📄 tmdlfgpo.h
字号:
/* * Copyright (c) 2003, 2004 Koninklijke Philips Electronics N V. All rights * reserved. * * This source code and any compilation or derivative thereof is the proprietary * information of Koninklijke Philips Electronics N V and is confidential in * nature. Under no circumstances is this software to be exposed to or placed * under an Open Source License of any type without the express written * permission of Koninklijke Philips Electronics N V. * * ############################################################################# * * Module: %name: tmdlFgpo.h % %version: bl10#5 % * * %date_created: Wed Dec 14 13:35:50 2005 % %created_by: dsawaji % * * %date_modified: Wed Dec 14 13:35:59 2005 % %derived_by: dsawaji % * * ############################################################################# */#ifndef _TMDLFGPO_H_#define _TMDLFGPO_H_//-----------------------------------------------------------------------------// Standard include files://-----------------------------------------------------------------------------//#include <tmNxTypes.h> // DVP standard data types/structures#include <tmNxCompId.h> // DVP Component ID types/defines#include <tmNxModId.h>#include <tmFlags.h>#include <tmosal.h>//-----------------------------------------------------------------------------// Project include files://-----------------------------------------------------------------------------// #ifdef __cplusplusextern "C"{#endif//-----------------------------------------------------------------------------// Types and defines://-----------------------------------------------------------------------------//// NOTE: The Fgpo DevLib compatibility number, major version number, and// minor version number must be kept current with any Fgpo DevLib// interface changes. Changes to the Fgpo DevLib interface that// are not backwards compatible result in a compatibility number// incremental change. If interfaces are changed but remain// backwards compatible, the compatibility number remains the// same but the major version number is incremented. Refer to the// DVP Software Versioning Specification for more details.#define TMDL_FGPO_COMPATIBILITY_NR 1 // Fgpo DevLib Compatibility number#define TMDL_FGPO_MAJOR_VERSION_NR 1 // Fgpo DevLib Major Version number#define TMDL_FGPO_MINOR_VERSION_NR 0 // Fgpo DevLib Minor Version number #define TMDL_FGPO_BUFBASE_NULL 0xFFFFFFFC//// FGPO Device Library Errors//#define TMDL_ERR_FGPO_BASE (CID_DL_FGPO | CID_LAYER_DEVLIB)#define TMDL_ERR_FGPO_COMP (CID_DL_FGPO | CID_LAYER_DEVLIB | TM_ERR_COMP_UNIQUE_START)//#define TMDL_ERR_FGPO_COMPATIBILITY \/* !ErrorTag: component compatibility error in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_COMPATIBILITY)#define TMDL_ERR_FGPO_MAJOR_VERSION \/* !ErrorTag: component compatibility error in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_MAJOR_VERSION)#define TMDL_ERR_FGPO_BAD_INSTANCE \/* !ErrorTag: bad instance in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_BAD_INSTANCE)#define TMDL_ERR_FGPO_BAD_UNIT_NUM \/* !ErrorTag: bad unit number in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_BAD_UNIT_NUMBER)#define TMDL_ERR_FGPO_BAD_PARAMETER \/* !ErrorTag: bad parameter in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_BAD_PARAMETER)#define TMDL_ERR_FGPO_NO_INSTANCE \/* !ErrorTag: no instance in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_NO_INSTANCES)#define TMDL_ERR_FGPO_NO_RESOURCES \/* !ErrorTag: no resources error in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_NO_RESOURCES)#define TMDL_ERR_FGPO_NOT_SUPPORTED \/* !ErrorTag: not supported error in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_NOT_SUPPORTED)#define TMDL_ERR_FGPO_INVALID_COMMAND \/* !ErrorTag: invalid command in tmdlFgpo */ \ (TMDL_ERR_FGPO_BASE + TM_ERR_INVALID_COMMAND)//// FGPO DevLib Component Specific Status/Error Codes//#define TMDL_ERR_FGPO_INSTANCE_INVALID \/* !ErrorTag: invalid instance in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0002) #define TMDL_ERR_FGPO_POWER_IS_OFF \/* !ErrorTag: power is off in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0003) #define TMDL_ERR_FGPO_MEMORY_BANDWIDTH \/* !ErrorTag: memory bandwidth error in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0004) #define TMDL_ERR_FGPO_BUFFER_UNDERRUN \/* !ErrorTag: buffer underrun error in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0005) #define TMDL_ERR_FGPO_NO_BUFFER_AVAILABLE \/* !ErrorTag: no buffer available in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0006) #define TMDL_ERR_FGPO_DATA_XFER_ALREADY_STARTED \/* !ErrorTag: data transfer already started in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0007) #define TMDL_ERR_FGPO_ALLOCATION_FAILURE \/* !ErrorTag: allocation failed in tmdlFgpo */ \ (TMDL_ERR_FGPO_COMP + 0x0008) //-----------------------------------------------------------------------------// Structures//-----------------------------------------------------------------------------typedef struct tmdlFgpo_Capabilities{ UInt32 size; // Size of data struct in bytes tmSWVersion_t version; // FGPODevLib software version UInt32 numSupportedInstances; // number of supported instances UInt32 minThresh; // minimum interrupt threshold UInt32 maxThresh; // maximum interrupt threshold UInt32 minSamplePerRec; // minimum number of samples per record/message UInt32 maxSamplePerRec; // maximum number of samples per record/message UInt32 minRecPerBuf; // minimum number of record/message per buffer UInt32 maxRecPerBuf; // maximum number of record/message per buffer UInt32 minRecGap; // minimum number of clock delay between record/message UInt32 maxRecGap; // maximum number of clock delay between record/message UInt32 minBufGap; // minimum number of clock delay after a buffer is // output and before the next buffer is output UInt32 maxBufGap; // maximum number of clock delay after a buffer is // output and before the next buffer is output} tmdlFgpo_Capabilities_t, *ptmdlFgpo_Capabilities_t;typedef enum tmdlFgpo_Event{ tmdlFgpo_EvtNone = 0x0000, // no events tmdlFgpo_EvtBuf1Done = 0x0001, // buffer 1 done event tmdlFgpo_EvtBuf2Done = 0x0002, // buffer 2 done event tmdlFgpo_EvtThresh1Reached = 0x0004, // threshold 1 reached event tmdlFgpo_EvtThresh2Reached = 0x0008, // threshold 2 reached event tmdlFgpo_EvtBufUnderrun = 0x0010, // buffer underrun event tmdlFgpo_EvtMbe = 0x0020, // memory bandwidth event tmdlFgpo_EvtAll = 0x00FF // all events} tmdlFgpo_Event_t, *ptmdlFgpo_Event_t;// Enumerated type specifing the 2 main operating modes of the FGPOtypedef enum tmdlFgpo_Mode{ tmdlFgpo_RecOutput = 0, // record output mode. tmdlFgpo_MsgPassing // message passing mode} tmdlFgpo_Mode_t, *ptmdlFgpo_Mode_t;// Enumerated type specifing the function of fgpo_start/fgpo_rec_start pintypedef enum tmdlFgpo_DataStart{ tmdlFgpo_StartPulseOnFirstData = 0, // A one clock positive pulse concurrently with the first // data sample of each message/record output. tmdlFgpo_StartPulseBeforeFirstData, // A one clock positive pulse before the first // data sample of each message/record output. tmdlFgpo_StartLastingPulse, // A positve pulse asserted as long as valid data is ouput, // negated while waiting for record/message sync event on // fgpo_rec_sync} tmdlFgpo_DataStart_t, *ptmdlFgpo_DataStart_t;// Enumerated type specifing the function of fgpo_stop/fgpo_buf_start pin/* IMP NOTE : For DataStop only two bits are used. Only LSB is writeen to the hardware*/typedef enum tmdlFgpo_DataStop{ tmdlFgpo_RecBufStartPulseDuringFirstData = 0, // In record output mode, a one clock positive pulse // concurrently with the first data sample of each buffer output. tmdlFgpo_RecBufStartPulseBeforeFirstData, // In record output mode, a one clock positive pulse // before the first data sample of each buffer output. tmdlFgpo_RecBufStartLastingPulse, // In record output mode, a positive pulse asserted // when any buffer is active, negated while waiting // for a buffer sync. tmdlFgpo_RecBufStartLastingPulseBuf2Valid, // In record output mode, a positive pulse asserted // when data from buffer 2 is valid. tmdlFgpo_MsgStopPulseOnLastData , // (2LSB == 00) In message passing mode, a one clock positive pulse // concurrently with the last data sample. tmdlFgpo_MsgStopLastingPulse // (2LSB == 01) In message passing mode, a positive pulse asserted // when message data is valid.} tmdlFgpo_DataStop_t, *ptmdlFgpo_DataStop_t;// Enumerated type specifing the function of fgpo_rec_sync pintypedef enum tmdlFgpo_ExtRecSync{ tmdlFgpo_ExtRecSyncNo = 0, // No record/message sync. tmdlFgpo_ExtRecSyncWaitRecGap, // Wait FGPO_REC_GAP clock pulses before starting next // record/message. tmdlFgpo_ExtRecSyncOnRisingEdge, // Start record/message on fgpo_rec_sync rising edge. tmdlFgpo_ExtRecSyncOnFallingEdge // Start record/message on fgpo_rec_sync falling edge.}tmdlFgpo_ExtRecSync_t, *ptmdlFgpo_ExtRecSync_t;// Enumerated type specifing the function of fgpo_buf_sync pintypedef enum tmdlFgpo_ExtBufSync{ tmdlFgpo_ExtBufSyncNo = 0, // No buffer sync. tmdlFgpo_ExtBufSyncWaitBufGap, // Wait FGPO_BUF_GAP clock pulses before switch to // alternate buffer. tmdlFgpo_ExtBufSyncOnRisingEdge = 4 // Switch buffers on rising edge on fgpo_buf_sync input.}tmdlFgpo_ExtBufSync_t, *ptmdlFgpo_ExtBufSync_t;// Enumerated type specifing the size of the data samples output on the fgpodata pintypedef enum tmdlFgpo_SampleSize{ tmdlFgpo_SampleSize8Bit = 0, // 8-bit data samples tmdlFgpo_SampleSize16Bit, // 16-bit data samples tmdlFgpo_SampleSize32Bit // 32-bit data samples} tmdlFgpo_SampleSize_t, *ptmdlFgpo_SampleSize_t;typedef struct tmdlFgpo_InstanceSetup{ tmdlFgpo_Mode_t mainMode; tmdlFgpo_DataStart_t dataStartMode; tmdlFgpo_DataStop_t dataStopMode; tmdlFgpo_ExtRecSync_t extRecSyncMode; tmdlFgpo_ExtBufSync_t extBufSyncMode; UInt32 recGap; // Clock delay after a record/message is output // before the next record/message is output. // Check minRecGap and maxRecGap field // in tmdlFgpo_capabilities_t for allowed value range UInt32 bufGap; // Clock delay after a buffer is output // before the next buffer is output // Check minBufGap and maxBufGap field // in tmdlFgpo_capabilities_t for allowed value range tmdlFgpo_SampleSize_t sampleSize; // Specifing the size of the data samples input // on the fgpi_data pin UInt32 samplesPerRec; // Check minSampleNumPerRec and maxSampleNumPerRec field // in tmdlFgpo_capabilities_t for allowed value range UInt32 recPerBuf; // Check minRecNumPerBuf and maxRecNumPerBuf field // in tmdlFgpo_capabilities_t for allowed value range UInt32 thresh1; // Check minRecNumPerBuf and maxRecNumPerBuf field // in tmdlFgpo_capabilities_t for allowed value range UInt32 thresh2; // Check minRecNumPerBuf and maxRecNumPerBuf field // in tmdlFgpo_capabilities_t for allowed value range Bool timeStamp; // When true, a 4-byte time stamp is written // before record/message data Bool varLength; // When true, the length of each record/message(in samples) // is written before record/message data Bool polarityIn; // When true, the use alternate active edge as for outputs // To put FGPO in single buffer operation, pass in valid address for base1 and // set base2 to TMDL_FGPI_BUFBASE_NULL. // For double buffer operation, pass in valid address for both base1 and base2. UInt32 base1; // base address(physical) of buffer 1 UInt32 base2; // base address(physical) of buffer 2 UInt32 stride; // address stride between records/messages} tmdlFgpo_InstanceSetup_t, *ptmdlFgpo_InstanceSetup_t;/*Add here new command here if you want to set it on the fly */ enum { SET_RECORD_PER_BUFFER=1, SET_STRIDE_SIZE }Instance_Config_Command;//-----------------------------------------------------------------------------// Exported Functions//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------// FUNCTION: tmdlFgpo_GetNumberOfUnits://// DESCRIPTION: This Function returns the number of FGPO units in the system.//// RETURN: tmErrorCode_t: Status of operation (TM_OK = PASS)//// NOTES: None.//-----------------------------------------------------------------------------//tmErrorCode_t tmdlFgpo_GetNumberOfUnits( pUInt32 pFgpoUnitCount); // O: FGPO Unit Count pointer//-----------------------------------------------------------------------------// FUNCTION: tmdlFgpo_GetSWVersion://
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -