HRESULT Dot11aTxFrameEncode9(PBB11A_TX_VECTOR info, IN OUT PPACKET_BASE pPacket) { unsigned int uiScrambledSize; unsigned int uiSymbolCountData; unsigned int uiPilotIndex = 0; unsigned int i; char * pbInput; PTXSAMPLE pcOutput; ULONG PacketSizePlusCRC32 = pPacket->PacketSize + 4; ClearWindow(info->cWindow); uiScrambledSize = SERVICE_LEN_IN_BITS + PADDING_LEN_IN_BITS + (PacketSizePlusCRC32 << BITS_PER_BYTE_SHIFT); uiSymbolCountData = (uiScrambledSize + (DBPS - 1)) / DBPS; ULONG SignalBytes = GetSignalBytes(info, uiSymbolCountData); ULONG SampleBufferSize = 0; SoraPacketGetTxSampleBuffer(pPacket, (PTXSAMPLE *)&pcOutput, &SampleBufferSize); ALIGN_WITH_RCB_BUFFER_PADDING_ZERO(pcOutput, SignalBytes); SoraPacketSetSignalLength(pPacket, SignalBytes); // Copy preamble pcOutput += CopyPreamble16_NT(info, pcOutput, info->cWindow); ConvEncodeReset(info->bConvEncoderReg); // Generate Signal pcOutput += GenerateSignal(info, pcOutput, info->cWindow, SIGNAL_RATE, (unsigned short)PacketSizePlusCRC32); // Scramble Data if (!(uiSymbolCountData & 0x1)) { Scramble11a(pPacket->pMdl, info->bFrameScrambled, (uiSymbolCountData >> 1) * (DBPS * 2 / BITS_PER_BYTE), pPacket->Reserved1, info->ulRadom); }
void COctopusAOTF::Start( void ) { olDaSetClockFrequency( hdass_9834, 0.25 * freq * outbuffersize ); olDmAllocBuffer( 0, outbuffersize, &hBuf_DAC ); if( hBuf_DAC == NULL ) { AfxMessageBox(_T("Error Allocating buffer.")); return; } GenerateSignal(); olDaPutBuffer( hdass_9834, hBuf_DAC ); olDaConfig( hdass_9834 ); olDaStart( hdass_9834 ); B.AOTF_running = true; m_status_AOTF.SetBitmap( m_bmp_yes ); }
/* Run one inverse FFT test in test mode */ float RunOneInverseTest(int fft_log_size, int signal_type, float signal_value, struct SnrResult* snr) { OMX_F32* x; OMX_FC32* y; OMX_F32* z; struct AlignedPtr* x_aligned; struct AlignedPtr* y_aligned; struct AlignedPtr* z_aligned; OMX_FC32* yTrue; struct AlignedPtr* yTrueAligned; OMX_INT n; OMX_INT fft_spec_buffer_size; OMXResult status; OMXFFTSpec_R_F32 * fft_fwd_spec = NULL; OMXFFTSpec_R_F32 * fft_inv_spec = NULL; int fft_size; fft_size = 1 << fft_log_size; status = omxSP_FFTGetBufSize_R_F32(fft_log_size, &fft_spec_buffer_size); if (verbose > 3) { printf("fft_spec_buffer_size = %d\n", fft_spec_buffer_size); } fft_inv_spec = (OMXFFTSpec_R_F32*)malloc(fft_spec_buffer_size); status = omxSP_FFTInit_R_F32(fft_inv_spec, fft_log_size); if (status) { fprintf(stderr, "Failed to init backward FFT: status = %d\n", status); exit(1); } x_aligned = AllocAlignedPointer(32, sizeof(*x) * fft_size); y_aligned = AllocAlignedPointer(32, sizeof(*y) * (fft_size / 2 + 1)); z_aligned = AllocAlignedPointer(32, sizeof(*z) * fft_size); yTrueAligned = AllocAlignedPointer(32, sizeof(*y) * (fft_size / 2 + 1)); x = x_aligned->aligned_pointer_; y = y_aligned->aligned_pointer_; z = z_aligned->aligned_pointer_; yTrue = yTrueAligned->aligned_pointer_; GenerateSignal(x, yTrue, fft_size, signal_type, signal_value); if (verbose > 255) { printf("input = %p - %p\n", yTrue, yTrue + fft_size / 2 + 1); printf("output = %p - %p\n", z, z + fft_size); DumpFFTSpec(fft_inv_spec); } if (verbose > 63) { printf("Inverse FFT Input Signal\n"); DumpArrayComplexFloat("y", 1 + fft_size / 2, yTrue); printf("Expected Inverse FFT output\n"); DumpArrayFloat("x", fft_size, x); } status = InverseRFFT((OMX_F32 *) yTrue, z, fft_inv_spec); if (status) { fprintf(stderr, "Inverse FFT failed: status = %d\n", status); exit(1); } if (verbose > 63) { printf("Actual Inverse FFT Output\n"); DumpArrayFloat("z", fft_size, z); } CompareFloat(snr, z, x, fft_size); FreeAlignedPointer(x_aligned); FreeAlignedPointer(y_aligned); FreeAlignedPointer(z_aligned); FreeAlignedPointer(yTrueAligned); free(fft_inv_spec); return snr->real_snr_; }
/* Run one forward FFT test in test mode */ float RunOneForwardTest(int fft_log_size, int signal_type, float signal_value, struct SnrResult* snr) { OMX_F32* x; OMX_FC32* y; struct AlignedPtr* x_aligned; struct AlignedPtr* y_aligned; OMX_FC32* y_true; OMX_INT n; OMX_INT fft_spec_buffer_size; OMXResult status; OMXFFTSpec_R_F32 * fft_fwd_spec = NULL; int fft_size; fft_size = 1 << fft_log_size; status = omxSP_FFTGetBufSize_R_F32(fft_log_size, &fft_spec_buffer_size); if (verbose > 63) { printf("fft_spec_buffer_size = %d\n", fft_spec_buffer_size); } fft_fwd_spec = (OMXFFTSpec_R_F32*) malloc(fft_spec_buffer_size); status = omxSP_FFTInit_R_F32(fft_fwd_spec, fft_log_size); if (status) { fprintf(stderr, "Failed to init forward FFT: status = %d\n", status); exit(1); } x_aligned = AllocAlignedPointer(32, sizeof(*x) * fft_size); y_aligned = AllocAlignedPointer(32, sizeof(*y) * (fft_size + 2)); x = x_aligned->aligned_pointer_; y = y_aligned->aligned_pointer_; y_true = (OMX_FC32*) malloc(sizeof(*y_true) * (fft_size / 2 + 1)); GenerateSignal(x, y_true, fft_size, signal_type, signal_value); if (verbose > 255) { printf("input = %p - %p\n", x, x + fft_size); printf("output = %p - %p\n", y, y + fft_size / 2 + 1); DumpFFTSpec(fft_fwd_spec); } if (verbose > 63) { printf("Signal\n"); DumpArrayFloat("x", fft_size, x); printf("Expected FFT output\n"); DumpArrayComplexFloat("y", 1 + fft_size / 2, y_true); } status = ForwardRFFT(x, (OMX_F32*) y, fft_fwd_spec); if (status) { fprintf(stderr, "Forward FFT failed: status = %d\n", status); exit(1); } if (verbose > 63) { printf("FFT Output\n"); DumpArrayComplexFloat("y", 1 + fft_size / 2, y); } CompareComplexFloat(snr, y, y_true, fft_size / 2 + 1); FreeAlignedPointer(x_aligned); FreeAlignedPointer(y_aligned); free(y_true); free(fft_fwd_spec); return snr->complex_snr_; }
/* * Like TestFFT, but do just the inverse FFT */ float RunOneInverseTest(int fft_log_size, int signal_type, float signal_value, struct SnrResult* snr) { OMX_SC32* x; OMX_SC32* y; OMX_SC32* z; struct AlignedPtr* x_aligned; struct AlignedPtr* y_aligned; struct AlignedPtr* z_aligned; OMX_INT n, fft_spec_buffer_size; OMXResult status; OMXFFTSpec_C_SC32 * fft_fwd_spec = NULL; OMXFFTSpec_C_SC32 * fft_inv_spec = NULL; int fft_size; fft_size = 1 << fft_log_size; status = omxSP_FFTGetBufSize_C_SC32(fft_log_size, &fft_spec_buffer_size); if (verbose > 3) { printf("fft_spec_buffer_size = %d\n", fft_spec_buffer_size); } fft_inv_spec = (OMXFFTSpec_C_SC32*)malloc(fft_spec_buffer_size); status = omxSP_FFTInit_C_SC32(fft_inv_spec, fft_log_size); if (status) { fprintf(stderr, "Failed to init backward FFT: status = %d\n", status); exit(1); } x_aligned = AllocAlignedPointer(32, sizeof(*x) * fft_size); y_aligned = AllocAlignedPointer(32, sizeof(*y) * (fft_size + 2)); z_aligned = AllocAlignedPointer(32, sizeof(*z) * fft_size); x = x_aligned->aligned_pointer_; y = y_aligned->aligned_pointer_; z = z_aligned->aligned_pointer_; GenerateSignal(x, y, fft_size, signal_type); if (verbose > 63) { printf("Inverse FFT Input Signal\n"); printf("n\tx[n]\n"); DumpArrayComplex32("x", fft_size, y); printf("Expected Inverse FFT output\n"); DumpArrayComplex32("y", fft_size, x); } status = omxSP_FFTInv_CToC_SC32_Sfs(y, z, fft_inv_spec, 0); if (status) { fprintf(stderr, "Inverse FFT failed: status = %d\n", status); exit(1); } if (verbose > 63) { printf("Actual Inverse FFT Output\n"); DumpArrayComplex32("y", fft_size, z); } CompareComplex32(snr, z, x, fft_size); FreeAlignedPointer(x_aligned); FreeAlignedPointer(y_aligned); FreeAlignedPointer(z_aligned); free(fft_inv_spec); return snr->complex_snr_; }