]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasdk/test_dsp/io/ioData.h
PASDK-577:Add McASP LLD ch reset before McASP LLD ch delete
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / io / ioData.h
2 #ifndef IODATA_H
3 #define IODATA_H
5 #include <stdint.h>
6 #include "ioBuff.h"
8 // I/O DATA error code
9 enum {
10     IODATA_NO_ERR,
11     IODATA_ERR_MEMORY,
12     IODATA_ERR_BAD_PARAMS,
13         IODATA_ERR_IOBUF_UNDERFLOW,
14         IODATA_ERR_IOBUF_OVERFLOW
15 };
17 // define a type for I/O DATA handle
18 typedef void * ioDataHandle_t;
20 // I/O DATA configuration parameters
21 typedef struct ioDataParam_s{
22   ioBuffHandle_t    ioBuffHandle;           // handle to the associated I/O BUFF
23   uint_least16_t   *frameLengthsIEC;        // pointer to array of supported IEC frame lengths
24   uint_least16_t    frameLengthPCM;         // frame length for PCM input
25   uint_least16_t    frameLengthDef;         // default frame length for SYNC search
26   int_least32_t     unknownSourceTimeOut;   // time out value to declare unknown source
27   uint_least32_t    zeroRunTrigger;         // threshold to declare zero run
28   uint_least32_t    zeroRunRestart;         // threshold to restart auto-detection under zero run
29   int8_t            ibMode;                 // IB Mode
30 } ioDataParam_t;
32 // Information needed for decoders to read a bitstream frame
33 typedef struct ioDataReadInfo_s {
34   void *buffBase;            // base address of the buffer holding the bitstream data
35   uint_least32_t buffSize;   // size of the buffer holding the bitstream data
36   void *startAddress;        // start address of next complete frame to read
37   uint_least32_t frameSize;  // size of the frame in bytes
38 } ioDataReadInfo_t;
40 // Control commands for ioDataControl
41 enum {
42         //IODATA_CTL_SET_ELEMENT_SIZE,
43         IODATA_CTL_SET_PCM_FRAME_LENGTH,
44         IODATA_CTL_GET_INPBUFFINFO,
45     IODATA_CTL_GET_AUTODET_STATUS,
46 };
48 // SYNC search/detection status
49 enum
50 {
51     IODATA_SYNC_NONE,
52     IODATA_SYNC_ONE,
53 //      IODATA_SYNC_CHECK,
54     IODATA_SYNC_BITSTREAM,
55     IODATA_SYNC_PCM,
56     IODATA_SYNC_PCM_FORCED,
57     IODATA_SYNC_PCM_ZERORUN,
58     IODATA_SYNC_AUTO
59 };
61 // Frame information
62 typedef struct ioDataFrameInfo_s {
63   uint_fast32_t frameLength;       // length in units of elements
64   int8_t        elementSize;       // size of elements in bytes
65 } ioDataFrameInfo_t;
67 // Auto-detection status
68 typedef struct ioDataAutoDetStat_s {
69   uint_least16_t   syncState;      // SYNC state
70   uint_least16_t   bitStreamInfo;  // bit stream information - value of IEC_PC
71   uint8_t          deliverZeros;   // flag to indicate whether zeros should be sent to output
72   uint8_t          syncTimeOut;
73 } ioDataAutoDetStat_t;
75 // I/O DATA control structure
76 typedef struct ioDataCtl_s {
77   uint_fast16_t code;
78   union {
79         ioDataReadInfo_t    dataReadInfo;   // IODATA_CTL_GET_INPBUFFINFO
80         uint_fast32_t       frameLengthPcm; // IODATA_CTL_SET_PCM_FRAME_LENGTH
81         ioDataAutoDetStat_t autoDetStats;   // IODATA_CTL_GET_AUTODET_STATUS
82   } param;      
83 } ioDataCtl_t;
85 /**
86  *  @brief ioDataNumAlloc
87  *    Returns the maximum number of memory allocation requests that ioDataAlloc()
88  *    requires.
89  */
90 int ioDataNumAlloc(void);
92 /**
93  *  @brief ioDataAlloc
94  *    Returns a table of memory records that describe the size, alignment, type
95  *    and memory space of all buffers required by I/O DATA component.
96  */
97 int ioDataAlloc(lib_mem_rec_t *mem_tbl);
99 /**
100  *  @brief ioDataCreate
101  *    Based on the provided memory blocks, this function creates an I/O DATA
102  *    instance and returns a handle. This handle points to the memory block
103  *    that contains the instance.
104  */
105 int ioDataCreate(ioDataHandle_t *handle, const lib_mem_rec_t *mem_tbl);
107 /**
108  *  @brief ioDATAInit
109  *    Initializes the I/O DATA instance.
110  */
111 int ioDataInit(ioDataHandle_t handle, ioDataParam_t *cfgParams);
113 /**
114  *  @brief ioDataProcess
115  *    The main function of I/O DATA processing, i.e. auto-detection.
116  */
117 int ioDataProcess(ioDataHandle_t handle);
119 /**
120  *  @brief ioDataReadComplete
121  *    This function marks as read complete the data in the input buffer that has
122  *    been processed by ioDataProcess and the decoder. It should be called after
123  *    ioDataProcess() is called and after the decoder finishes reading current
124  *    frame in the input buffer.
125  */
126 int ioDataReadComplete(ioDataHandle_t handle);
129 /**
130  *  @brief ioDataControl
131  *    This function allows run-time control of I/O DATA components through control
132  *    command IODATA_CTL_XXX and control structure ioDataCtl_t.
133  */
134 int ioDataControl(ioDataHandle_t handle, ioDataCtl_t *ctlParams);
137 #endif