diff --git a/src/fe/moduleLoadCommon.c b/src/fe/moduleLoadCommon.c index 9b602c22cffce689988d92aa7153cf007541a8e2..b53d09cab71c75c6145036e1e8d4c88ce322b51d 100644 --- a/src/fe/moduleLoadCommon.c +++ b/src/fe/moduleLoadCommon.c @@ -280,6 +280,18 @@ attach_shared_memory( ) pLocalEpics = (CDS_EPICS*)&( (RFM_FE_COMMS*)_epics_shm )->epicsSpace; pLocalEpics->epicsOutput.fe_status = 0; + /// Allocate AWG data memory area + ret = mbuf_allocate_area("" SYSTEM_NAME_STRING_LOWER SHMEM_AWG_SUFFIX, SHMEM_AWG_SIZE ); + if ( ret < 0 ) + { + printk( "" SYSTEM_NAME_STRING_LOWER + ": ERROR: mbuf_allocate_area(awg) failed; ret = %d\n", + ret ); + return -12; + } + // Set pointer to AWG area + _awg_shm = (volatile AWG_DATA *)( kmalloc_area[ ret ] ); + /// Allocate IPC memory area ret = mbuf_allocate_area( "ipc", 32 * 1024 * 1024, 0 ); if ( ret < 0 ) diff --git a/src/include/drv/daqLib.c b/src/include/drv/daqLib.c index ef1125f6b6defa38c5175c9151505fa18585cbda..6063595ac6399f498b0712be4268af4d95dce5c5 100644 --- a/src/include/drv/daqLib.c +++ b/src/include/drv/daqLib.c @@ -126,7 +126,7 @@ daqWrite( int flag, static int tpNumNet[ DAQ_GDS_MAX_TP_ALLOWED ]; /* TP/EXC selects to send to FB. */ static int totalChans; /* DAQ + TP + EXC chans selected. */ - int* statusPtr; + volatile float* dataPtr; /* Ptr to excitation chan data. */ int exChanOffset; /* shmem offset to next EXC value. */ int tpx; @@ -699,25 +699,23 @@ daqWrite( int flag, if ( localTable[ ii ].type < DAQ_SRC_FM_EXC ) continue; - exChanOffset = localTable[ ii ].sigNum * excDataSize; - statusPtr = - (int*)( exciteDataPtr + excBlockNum * DAQ_DCU_BLOCK_SIZE + - exChanOffset ); - if ( *statusPtr == 0 ) + //find right page for the excitation + int page_index = FIND_PAGE_INDEX(localTable[ ii ].sigNum + excBlockNum); + AWG_DATA_PAGE *awg_page = _awg_shm->page + page_index; + + if ( _awg_page->status == 0 ) { validEx = FE_ERROR_EXC_SET; - dataPtr = (float*)( exciteDataPtr + - excBlockNum * DAQ_DCU_BLOCK_SIZE + - exChanOffset + excSlot * 4 + 4 ); + if ( localTable[ ii ].type == DAQ_SRC_FM_EXC ) { dspPtr->data[ localTable[ ii ].fmNum ].exciteInput = - *dataPtr; + awg_page->buf; } else if ( localTable[ ii ].type == DAQ_SRC_NFM_EXC ) { // extra excitation - excSignal[ localTable[ ii ].fmNum ] = *dataPtr; + excSignal[ localTable[ ii ].fmNum ] = awg_page->buf; } } // else dspPtr->data[localTable[ii].fmNum].exciteInput = 0.0;