/* real-valued short sample output, useful for going straight to DAC */
/* TX routines for 2400 FSK modes, after codec2 encoding */
+#ifndef CORTEX_M4
static void freedv_tx_fsk_voice(struct freedv *f, short mod_out[]) {
int i;
float *tx_float; /* To hold on to modulated samps from fsk/fmfsk */
}
}
}
+#endif
/* TX routines for 2400 FSK modes, data channel */
+#ifndef CORTEX_M4
static void freedv_tx_fsk_data(struct freedv *f, short mod_out[]) {
int i;
float *tx_float; /* To hold on to modulated samps from fsk/fmfsk */
}
}
}
+#endif
void freedv_tx(struct freedv *f, short mod_out[], short speech_in[]) {
assert(f != NULL);
/* FSK and MEFSK/FMFSK modems work only on real samples. It's simpler to just
* stick them in the real sample tx/rx functions than to add a comp->real converter
* to comptx */
+
if((f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B)){
+ #ifndef CORTEX_M4
codec2_encode(f->codec2, f->packed_codec_bits, speech_in);
freedv_tx_fsk_voice(f, mod_out);
+ #endif
}else{
freedv_comptx(f, tx_fdm, speech_in);
for(i=0; i<f->n_nom_modem_samples; i++)
for(i=0; i<f->n_nom_modem_samples; i++)
mod_out[i] = fcmult(FDMDV_SCALE, tx_fdm[i]);
}
-
+#ifndef CORTEX_M4
static void freedv_comptx_fdmdv_700(struct freedv *f, COMP mod_out[]) {
int bit, byte, i, j, k;
int bits_per_codec_frame, bits_per_modem_frame;
// Caution: assert fails if f->n_nat_modem_samples * 16.0 / 15.0 is not an integer
}
+#endif
void freedv_comptx(struct freedv *f, COMP mod_out[], short speech_in[]) {
assert(f != NULL);
memcpy(f->packed_codec_bits, packed_codec_bits, bytes_per_codec_frame * codec_frames);
switch(f->mode) {
- case FREEDV_MODE_700:
- case FREEDV_MODE_700B:
- freedv_comptx_fdmdv_700(f, tx_fdm);
- break;
case FREEDV_MODE_1600:
freedv_comptx_fdmdv_1600(f, tx_fdm);
break;
- case FREEDV_MODE_2400A:
+ #ifndef CORTEX_M4
+ case FREEDV_MODE_700:
+ case FREEDV_MODE_700B:
+ freedv_comptx_fdmdv_700(f, tx_fdm);
+ break;
+ case FREEDV_MODE_2400A:
case FREEDV_MODE_2400B:
- freedv_tx_fsk_voice(f, mod_out);
- return; /* output is already real */
+ freedv_tx_fsk_voice(f, mod_out);
+ return; /* output is already real */
+ #endif
}
/* convert complex to real */
for(i=0; i<f->n_nom_modem_samples; i++)
void freedv_datatx (struct freedv *f, short mod_out[]){
assert(f != NULL);
-
+ #ifndef CORTEX_M4
if (f->mode == FREEDV_MODE_2400A || f->mode == FREEDV_MODE_2400B) {
freedv_tx_fsk_data(f, mod_out);
}
+ #endif
}
int freedv_data_ntxframes (struct freedv *f){
assert(f != NULL);
-
+ #ifndef CORTEX_M4
if (f->mode == FREEDV_MODE_2400A || f->mode == FREEDV_MODE_2400B) {
if (f->deframer->fdc)
return freedv_data_get_n_tx_frames(f->deframer->fdc);
}
+ #endif
return 0;
}
int i;
int nin = freedv_nin(f);
assert(nin <= f->n_max_modem_samples);
+
+ #ifndef CORTEX_M4
/* FSK RX happens in real floats, so convert to those and call their demod here */
if( (f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B) ){
for(i=0; i<nin; i++) {
rx_float[i] = ((float)demod_in[i]);
}
return freedv_floatrx(f,speech_out,rx_float);
- }else { /* FDM RX happens with complex samps, so do that */
-
+ }
+ #endif
+ if( (f->mode == FREEDV_MODE_1600) || (f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)){
+ /* FDM RX happens with complex samps, so do that */
for(i=0; i<nin; i++) {
rx_fdm[i].real = (float)demod_in[i];
rx_fdm[i].imag = 0.0;
}
-
return freedv_comprx(f, speech_out, rx_fdm);
}
return 0; /* should never get here */
// float input samples version
-
+#ifndef CORTEX_M4
int freedv_floatrx_fsk_2400(struct freedv *f, float demod_in[], int *valid) {
/* Varicode and protocol bits */
uint8_t vc_bits[2];
}
return f->n_speech_samples;
}
+#endif
int freedv_floatrx(struct freedv *f, short speech_out[], float demod_in[]) {
assert(f != NULL);
assert(nin <= f->n_max_modem_samples);
/* FSK RX happens in real floats, so demod for those goes here */
+ #ifndef CORTEX_M4
if( (f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B) ){
int valid;
- int nout = freedv_floatrx_fsk_2400(f, demod_in, &valid);
-
- if (valid == 0)
+ int nout = freedv_floatrx_fsk_2400(f, demod_in, &valid);
+ if (valid == 0)
for (i = 0; i < nout; i++)
speech_out[i] = 0;
else if (valid < 0)
for (i = 0; i < nout; i++)
- speech_out[i] = demod_in[i];
+ speech_out[i] = demod_in[i];
else {
int bits_per_codec_frame = codec2_bits_per_frame(f->codec2);
int bytes_per_codec_frame = (bits_per_codec_frame + 7) / 8;
codec2_decode(f->codec2, speech_out, f->packed_codec_bits + i * bytes_per_codec_frame);
speech_out += codec2_samples_per_frame(f->codec2);
}
-
}
return f->n_speech_samples;
- }else {
+ }
+ #endif
+ if( (f->mode == FREEDV_MODE_1600) || (f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)){
for(i=0; i<nin; i++) {
rx_fdm[i].real = demod_in[i];
rx_fdm[i].imag = 0;
float rx_float[f->n_max_modem_samples];
assert(nin <= f->n_max_modem_samples);
-
+
+#ifndef CORTEX_M4
/* FSK RX happens in real floats, so convert to those and call their demod here */
if( (f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B) ){
for(i=0; i<nin; i++) {
rx_float[i] = ((float)demod_in[i]);
}
- } else {
+ }
+#endif
+ if( (f->mode == FREEDV_MODE_1600) || (f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)){
for(i=0; i<nin; i++) {
rx_fdm[i].real = (float)demod_in[i];
rx_fdm[i].imag = 0.0;
}
}
-
- if( (f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B) ){
- freedv_floatrx_fsk_2400(f, rx_float, &valid);
- }
if (f->mode == FREEDV_MODE_1600) {
freedv_comprx_fdmdv_1600(f, rx_fdm, &valid);
}
if ((f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B)) {
freedv_comprx_fdmdv_700(f, rx_fdm, &valid);
}
+
+ if( (f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B) ){
+ freedv_floatrx_fsk_2400(f, rx_float, &valid);
+ }
#endif
if (valid == 1) {
If the returned size of the datatx callback is zero the data frame is still
generated, but will contain only a header update.
\*---------------------------------------------------------------------------*/
+#ifndef CORTEX_M4
void freedv_set_callback_data(struct freedv *f, freedv_callback_datarx datarx, freedv_callback_datatx datatx, void *callback_state) {
if ((f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B)){
if (!f->deframer->fdc)
freedv_data_set_cb_tx(f->deframer->fdc, datatx, callback_state);
}
}
+#endif
/*---------------------------------------------------------------------------*\
The header will also be used for fill packets when a data frame is requested
without a packet available.
\*---------------------------------------------------------------------------*/
+#ifndef CORTEX_M4
void freedv_set_data_header(struct freedv *f, unsigned char *header)
{
if ((f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B)){
freedv_data_set_header(f->deframer->fdc, header);
}
}
-
+#endif
/*---------------------------------------------------------------------------*\
{
if (f->mode == FREEDV_MODE_1600)
fdmdv_get_demod_stats(f->fdmdv, stats);
- if ((f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B)){
- memcpy(stats,&(f->stats),sizeof(struct MODEM_STATS));
- }
#ifndef CORTEX_M4
+ if ((f->mode == FREEDV_MODE_2400A) || (f->mode == FREEDV_MODE_2400B))
+ memcpy(stats,&(f->stats),sizeof(struct MODEM_STATS));
+
if ((f->mode == FREEDV_MODE_700) || (f->mode == FREEDV_MODE_700B))
cohpsk_get_demod_stats(f->cohpsk, stats);
#endif