From 83253ca3bda7197e88cb1cb5f5eb60d61cdb6955 Mon Sep 17 00:00:00 2001 From: Erik von Reis <evonreis@caltech.edu> Date: Fri, 30 Apr 2021 01:20:34 -0700 Subject: [PATCH] awgtpman: iop model switched over to use new awg data mbuf --- src/fe/moduleLoadCommon.c | 12 ++++++++++++ src/include/drv/daqLib.c | 20 +++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/fe/moduleLoadCommon.c b/src/fe/moduleLoadCommon.c index 9b602c22c..b53d09cab 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 ef1125f6b..6063595ac 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; -- GitLab