% output of the reference versions of the same functions written in
% Octave.
%
-% Ideas:
-% [ ] EB/No v BER curves changing Np, freq offset etc
-% + can do these pretty fast in C, if we have the channel models
-% [ ] better interpolation between two signals
-% [ ] feedback to correct out freq offset est
-% [ ] fading channel
-% [ ] freq drift
-% [ ] timing drift
-% [ ] one version to compare Octave to C
-% [ ] just compare C at some spot points
-% + drive C simul from command line?
-% + drive from octave?
-% [ ] one version to unit test against various impairments
-% [ ] measure/plot BER against impairments and ideal and tune
-% + 100 errors
-% [ ] freq offset
-% + feeback fine freq? This will cause IL
-% [ ] fading ch, compared to ideal
-% [ ] smaller freq est block size to min ram req
-% [ ] freq tracking eeback loop
graphics_toolkit ("gnuplot");
DATE CREATED: March 2015
Functions that implement a coherent PSK FDM modem.
-
+
+ TODO:
+
+ [ ] Code to plot EB/No v BER curves for
+ [ ] AWGN channel
+ [ ] freq offset
+ [ ] fading channel
+ [ ] freq drift
+ [ ] timing drift
+ [ ] tune and meas impl loss perf for above
+ [ ] out of sync state
+ [ ] freq offset/drift feedback loop
+ [ ] smaller freq est block size to min ram req
+
\*---------------------------------------------------------------------------*/
/*
{-1.0, 0.0}
};
+void corr_with_pilots(COMP *corr_out, float *mag_out, struct COHPSK *coh, int sampling_points[], int t, float f_fine);
+
/*---------------------------------------------------------------------------*\
FUNCTIONS
}
+void corr_with_pilots(COMP *corr_out, float *mag_out, struct COHPSK *coh, int sampling_points[], int t, float f_fine)
+{
+ COMP corr, f_fine_rect, f_corr;
+ float mag;
+ int c, p;
+
+ corr.real = 0.0; corr.imag = 0.0; mag = 0.0;
+ for (c=0; c<PILOTS_NC; c++) {
+ for (p=0; p<NPILOTSFRAME+2; p++) {
+ f_fine_rect.real = cosf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/RS);
+ f_fine_rect.imag = sinf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/RS);
+ f_corr = cmult(f_fine_rect, coh->ct_symb_buf[t+sampling_points[p]][c]);
+ corr = cadd(corr, fcmult(coh->pilot2[p][c], f_corr));
+ mag += cabsolute(f_corr);
+ }
+ }
+
+ *corr_out = corr;
+ *mag_out = mag;
+}
+
+
/*---------------------------------------------------------------------------*\
FUNCTION....: frame_sync_fine_timing_est()
void frame_sync_fine_freq_est(struct COHPSK *coh, COMP ch_symb[][PILOTS_NC], int sync, int *next_sync)
{
int sampling_points[] = {0, 1, 6, 7};
- int r,c,i,p,t;
+ int r,c,i,t;
float f_fine, mag, max_corr, max_mag;
- COMP f_fine_rect, f_corr, corr;
+ COMP corr;
/* update memory in symbol buffer */
max_corr = 0;
for (f_fine=-20; f_fine<=20; f_fine+=1.0) {
for (t=0; t<NSYMROWPILOT; t++) {
- corr.real = 0.0; corr.imag = 0.0; mag = 0.0;
- for (c=0; c<PILOTS_NC; c++) {
- for (p=0; p<NPILOTSFRAME+2; p++) {
- f_fine_rect.real = cosf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/RS);
- f_fine_rect.imag = sinf(f_fine*2.0*M_PI*(sampling_points[p]+1.0)/RS);
- f_corr = cmult(f_fine_rect, coh->ct_symb_buf[t+sampling_points[p]][c]);
- corr = cadd(corr, fcmult(coh->pilot2[p][c], f_corr));
- mag += cabsolute(f_corr);
- }
- }
+ corr_with_pilots(&corr, &mag, coh, sampling_points, t, f_fine);
//printf(" f: %f t: %d corr: %f %f\n", f_fine, t, corr.real, corr.imag);
if (cabsolute(corr) > max_corr) {
max_corr = cabsolute(corr);
COMP rx_fdm_frame_bb[M*NSYMROWPILOT];
COMP rx_baseband[PILOTS_NC][M+M/P];
COMP rx_filt[PILOTS_NC][P+1];
- float env[NT*P], rx_timing;
+ float env[NT*P], __attribute__((unused)) rx_timing;
COMP ch_symb[NSYMROWPILOT][PILOTS_NC];
COMP rx_onesym[PILOTS_NC];
int sync, next_sync, nin, r, c;
\*---------------------------------------------------------------------------*/
-static COMP cneg(COMP a)
+inline static COMP cneg(COMP a)
{
COMP res;
return res;
}
-static COMP cconj(COMP a)
+inline static COMP cconj(COMP a)
{
COMP res;
return res;
}
-static COMP cmult(COMP a, COMP b)
+inline static COMP cmult(COMP a, COMP b)
{
COMP res;
return res;
}
-static COMP fcmult(float a, COMP b)
+inline static COMP fcmult(float a, COMP b)
{
COMP res;
return res;
}
-static COMP cadd(COMP a, COMP b)
+inline static COMP cadd(COMP a, COMP b)
{
COMP res;
return res;
}
-static float cabsolute(COMP a)
+inline static float cabsolute(COMP a)
{
return sqrtf(powf(a.real, 2.0) + powf(a.imag, 2.0));
}