// destroy frame synchronizer object, freeing all internal memory void flexframesync_destroy(flexframesync _q) { #if DEBUG_FLEXFRAMESYNC // clean up debug objects (if created) if (_q->debug_objects_created) { windowcf_destroy(_q->debug_x); } #endif // destroy synchronization objects detector_cccf_destroy(_q->frame_detector); // frame detector windowcf_destroy(_q->buffer); // p/n sample buffer firpfb_crcf_destroy(_q->mf); // matched filter firpfb_crcf_destroy(_q->dmf); // derivative matched filter nco_crcf_destroy(_q->nco_coarse); // coarse NCO nco_crcf_destroy(_q->nco_fine); // fine-tuned NCO modem_destroy(_q->demod_header); // header demodulator packetizer_destroy(_q->p_header); // header packetizer modem_destroy(_q->demod_payload); // payload demodulator packetizer_destroy(_q->p_payload); // payload decoder // free buffers and arrays free(_q->payload_mod); // free(_q->payload_enc); // free(_q->payload_dec); // // free main object memory free(_q); }
// destroy frame synchronizer object, freeing all internal memory void flexframesync_destroy(flexframesync _q) { #if DEBUG_FLEXFRAMESYNC // clean up debug objects (if created) if (_q->debug_objects_created) windowcf_destroy(_q->debug_x); #endif // free allocated arrays free(_q->preamble_pn); free(_q->preamble_rx); free(_q->header_sym); free(_q->header_mod); free(_q->header_dec); free(_q->payload_sym); free(_q->payload_dec); // destroy synchronization objects qpilotsync_destroy (_q->header_pilotsync); // header demodulator/decoder qpacketmodem_destroy (_q->header_decoder); // header demodulator/decoder modem_destroy (_q->payload_demod); // payload demodulator (for PLL) qpacketmodem_destroy (_q->payload_decoder); // payload demodulator/decoder qdetector_cccf_destroy(_q->detector); // frame detector firpfb_crcf_destroy (_q->mf); // matched filter nco_crcf_destroy (_q->mixer); // oscillator (coarse) nco_crcf_destroy (_q->pll); // oscillator (fine) #if FLEXFRAMESYNC_ENABLE_EQ eqlms_cccf_destroy (_q->equalizer); // LMS equalizer #endif // free main object memory free(_q); }