AD9857 IQ DDS Digital Up Converter Experiment using Nucleo F401

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dsp.h Source File

dsp.h

00001 #ifndef _DSP_H_
00002 #define _DSP_H_
00003 
00004 #define HILBERT_TRANSFORM_FIRSTATE_LENGTH 128*2
00005 
00006 extern int16_t htstat_buf[HILBERT_TRANSFORM_FIRSTATE_LENGTH];
00007 // capture interval 10ms onto double buffer (5ms each)
00008 // 48kHz x 2ch * 5ms = 240*2
00009 #define CAPTURE_LEN 240*2
00010 extern int16_t cap_buf[2][CAPTURE_LEN];
00011 // 240*2 * 4 = 1920, single buffer
00012 #define FIRSTATE_LENGTH 16*2
00013 extern int16_t fir_state[FIRSTATE_LENGTH];
00014 extern int16_t fir_buf[CAPTURE_LEN];
00015 #define CICBUF_LEN 1920
00016 extern int16_t cic_buf[CICBUF_LEN];
00017 // 1920 * 10 = 19200, double buffer
00018 #define DMA_DATALEN 19200
00019 extern int16_t dma_buf[2][DMA_DATALEN];
00020 
00021 
00022 typedef struct {
00023     uint32_t p0;        
00024     uint32_t s0;
00025 } CICState;
00026 
00027 extern CICState cic;
00028 
00029 void cic_interpolate_x10(CICState *cic, uint32_t *src, int src_len, uint32_t *dst);
00030 
00031 
00032 void fir_resample_x4(uint32_t *src_state, uint32_t *dst, int dst_len);
00033 
00034 void interpolate_test();
00035 
00036 void hilbert_transform(uint32_t *src, uint32_t *dst, int dst_len, int sign);
00037 void hilbert_transform_save_fir_state(uint32_t *src_tail);
00038 
00039 void hilbert_transform_test();
00040 
00041 
00042 typedef struct {
00043     uint16_t phase;
00044 } FMModState;
00045 
00046 extern FMModState fmmod;
00047 
00048 //uint32_t cos_sin(int16_t x);
00049 
00050 void fmmod_init(FMModState *fmmod);
00051 void frequency_modulation(FMModState *fmmod, uint32_t *src, uint32_t *dst, int dst_len);
00052 
00053 void amplitude_modulation(uint32_t *src, uint32_t *dst, int dst_len);
00054 
00055 
00056 #endif /* _DSP_H_ */