diff options
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c')
-rw-r--r-- | software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c | 129 |
1 files changed, 71 insertions, 58 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c index 7d52366..a319e66 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c @@ -2,7 +2,7 @@ File: oct6100_events.c - Copyright (c) 2001-2007 Octasic Inc. + Copyright (c) 2001-2008 Octasic Inc. Description: @@ -22,9 +22,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.00-PR49 $ +$Octasic_Release: OCT612xAPI-01.01.01 $ -$Octasic_Revision: 81 $ +$Octasic_Revision: 83 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -618,34 +618,40 @@ UINT32 Oct6100ApiTransferToneEvents( /* generate the "PRESENT" event and then generate the "STOP" event. */ pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else + + /* Also generate STOP event if this is not a 2100 Hz tone or if the user requested STOP events on 2100 Hz tones */ + if ( ( f2100Tone == FALSE ) || + ( ( f2100Tone == TRUE ) && ( pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) ) { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; + pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; + pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; + pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; + /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ + pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; + + /* Update the control variables of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; + if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; + + /* If enough space for the "STOP" event. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + { + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; + + /* We continue in the loop in order to empty the hardware buffer. */ + continue; + } } break; @@ -759,35 +765,42 @@ UINT32 Oct6100ApiTransferToneEvents( /* generate the "PRESENT" event and then generate the "STOP" event. */ pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else + + /* Also generate STOP event if this is not a 2100 Hz tone or if the user requested STOP events on 2100 Hz tones */ + if ( ( f2100Tone == FALSE ) || + ( ( f2100Tone == TRUE ) && ( pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) ) { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } + pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; + pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; + pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; + /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ + pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; + pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; + + /* Update the control variables of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; + if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) + pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; + + /* If enough space for the "STOP" event. */ + if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && + ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) + { + mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) + pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; + + pSoftEvent->ulEventType = cOCT6100_TONE_STOP; + } + else + { + /* Set the overflow flag of the buffer. */ + pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; + + /* We continue in the loop in order to empty the hardware buffer. */ + continue; + } + + } break; case 4: |