@@ -29,12 +29,18 @@ __BEGIN_DECLS
2929/// @{
3030
3131/// Possible encodings
32- typedef enum APcmEncoding {
33- APCM_ENCODING_8_BIT ,
34- APCM_ENCODING_16_BIT ,
35- APCM_ENCODING_24_BIT ,
36- APCM_ENCODING_32_BIT
37- } APcmEncoding ;
32+ typedef enum AI2sEncoding {
33+ AI2S_ENCODING_PCM_8_BIT ,
34+ AI2S_ENCODING_PCM_16_BIT ,
35+ AI2S_ENCODING_PCM_24_BIT ,
36+ AI2S_ENCODING_PCM_32_BIT
37+ } AI2sEncoding ;
38+
39+ /// Flags to specify I2s bus direction.
40+ typedef enum AI2sFlags {
41+ AI2S_FLAG_DIRECTION_IN = 1 << 0 ,
42+ AI2S_FLAG_DIRECTION_OUT = 1 << 1
43+ } AI2sFlags ;
3844
3945typedef struct AI2sDevice AI2sDevice ;
4046
@@ -61,6 +67,32 @@ int AI2sDevice_write(const AI2sDevice* i2s,
6167int AI2sDevice_read (
6268 const AI2sDevice * i2s , void * data , int offset , int size , int * bytes_read );
6369
70+ /// Gets the timestamp when a specific sample entered the kernel.
71+ /// @param i2s Pointer to the AI2s struct.
72+ /// @param frame_position Output indicating number of frames read.
73+ /// @param nano_time Output indicating time (ns) when the frame was read.
74+ /// @param success Output indicating success (1) or failure (0).
75+ /// @return 0 on success, errno on error. This will only be nonzero on a fatal
76+ /// error such as the I2S device couldn't be found; in the normal case
77+ /// that a timestamp isn't available the success param will be used.
78+ int AI2sDevice_getInputTimestamp (const AI2sDevice * i2s ,
79+ int64_t * frame_position ,
80+ int64_t * nano_time ,
81+ int * success );
82+
83+ /// Gets the timestamp when a specific sample exited the kernel.
84+ /// @param i2s Pointer to the AI2s struct.
85+ /// @param frame_position Output indicating number of frames written.
86+ /// @param nano_time Output indicating time (ns) when the frame was written.
87+ /// @param success Output indicating success (1) or failure (0).
88+ /// @return 0 on success, errno on error. This will only be nonzero on a fatal
89+ /// error such as the I2S device couldn't be found; in the normal case
90+ /// that a timestamp isn't available the success param will be used.
91+ int AI2sDevice_getOutputTimestamp (const AI2sDevice * i2s ,
92+ int64_t * frame_position ,
93+ int64_t * nano_time ,
94+ int * success );
95+
6496/// Destroys an AI2s struct.
6597/// @param i2s Pointer to the AI2s struct.
6698void AI2sDevice_delete (AI2sDevice * i2s );
0 commit comments