PDM utility includes helper functions for configuring the CC26XX I2S controller.
============================================================================
The PDMCC26XX utility header file should be included in an application as follows:
This utility file is written specifically for the I2S module on CC26XX. The user should be aware that although this HW module is called I2S it is a highly configurable audio interface module. I2S is only one of many configurations.
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
Go to the source code of this file.
Data Structures | |
struct | PDMCC26XX_I2S_Config |
The PDMCC26XX_I2S_Config structure contains a set of pointers used to characterize the PDMCC26XX_I2S driver implementation. More... | |
struct | PDMCC26XX_I2S_HWAttrs |
PDMCC26XX_I2S Hardware attributes. More... | |
struct | PDMCC26XX_I2S_AudioClockConfig |
PDMCC26XX_I2S Audio Clock configuration. More... | |
union | PDMCC26XX_I2S_AudioPinConfig |
PDMCC26XX_I2S Audio Pin configuration. More... | |
struct | PDMCC26XX_I2S_AudioFormatConfig |
PDMCC26XX_I2S Hardware configuration. More... | |
struct | PDMCC26XX_I2S_StreamNotification |
A PDMCC26XX_I2S_StreamNotification data structure is used with PDMCC26XX_I2S_CallbackFxn(). Provides notification about available buffers and potential errors. More... | |
struct | PDMCC26XX_I2S_BufferRequest |
A PDMCC26XX_I2S_BufferRequest data structure is used with PDMCC26XX_I2S_requestBuffer(). More... | |
struct | PDMCC26XX_I2S_BufferRelease |
A PDMCC26XX_I2S_BufferRelease data structure is used with PDMCC26XX_I2S_releaseBuffer(). More... | |
struct | PDMCC26XX_I2S_Params |
PDMCC26XX I2S Parameters are used when calling PDMCC26XX_I2S_open(). More... | |
struct | PDMCC26XX_I2S_Object |
PDMCC26XX_I2S Object. More... | |
Typedefs | |
typedef void *(* | PDMCC26XX_I2S_MallocFxn) (size_t memSize) |
PDMCC26XX_I2S_MallocFxn is a function pointer for the malloc function to be used by the driver. More... | |
typedef void(* | PDMCC26XX_I2S_FreeFxn) (void *ptr, size_t memSize) |
PDMCC26XX_I2S_FreeFxn is a function pointer for the free function to be used by the driver. This is needed for memory clean up, if something goes wrong. More... | |
typedef struct PDMCC26XX_I2S_Config * | PDMCC26XX_I2S_Handle |
A handle that is returned from a PDMCC26XX_I2S_open() call. More... | |
typedef enum PDMCC26XX_I2S_Status | PDMCC26XX_I2S_Status |
Status codes that are set by the I2S driver. More... | |
typedef enum PDMCC26XX_I2S_Mode | PDMCC26XX_I2S_Mode |
Definitions for various PDMCC26XX_I2S modes of operation. More... | |
typedef uint32_t | PDMCC26XX_I2S_TransferSize |
typedef struct PDMCC26XX_I2S_Config | PDMCC26XX_I2S_Config |
The PDMCC26XX_I2S_Config structure contains a set of pointers used to characterize the PDMCC26XX_I2S driver implementation. More... | |
typedef struct PDMCC26XX_I2S_HWAttrs | PDMCC26XX_I2S_HWAttrs |
PDMCC26XX_I2S Hardware attributes. More... | |
typedef struct PDMCC26XX_I2S_AudioClockConfig | PDMCC26XX_I2S_AudioClockConfig |
PDMCC26XX_I2S Audio Clock configuration. More... | |
typedef union PDMCC26XX_I2S_AudioPinConfig | PDMCC26XX_I2S_AudioPinConfig |
PDMCC26XX_I2S Audio Pin configuration. More... | |
typedef struct PDMCC26XX_I2S_AudioFormatConfig | PDMCC26XX_I2S_AudioFormatConfig |
PDMCC26XX_I2S Hardware configuration. More... | |
typedef enum PDMCC26XX_I2S_RequestMode | PDMCC26XX_I2S_RequestMode |
PDMCC26XX_I2S Object. More... | |
typedef struct PDMCC26XX_I2S_StreamNotification | PDMCC26XX_I2S_StreamNotification |
A PDMCC26XX_I2S_StreamNotification data structure is used with PDMCC26XX_I2S_CallbackFxn(). Provides notification about available buffers and potential errors. More... | |
typedef struct PDMCC26XX_I2S_BufferRequest | PDMCC26XX_I2S_BufferRequest |
A PDMCC26XX_I2S_BufferRequest data structure is used with PDMCC26XX_I2S_requestBuffer(). More... | |
typedef struct PDMCC26XX_I2S_BufferRelease | PDMCC26XX_I2S_BufferRelease |
A PDMCC26XX_I2S_BufferRelease data structure is used with PDMCC26XX_I2S_releaseBuffer(). More... | |
typedef void(* | PDMCC26XX_I2S_CallbackFxn) (PDMCC26XX_I2S_Handle handle, PDMCC26XX_I2S_StreamNotification *notification) |
The definition of a callback function used when wakeup on chip select is enabled. More... | |
typedef struct PDMCC26XX_I2S_Params | PDMCC26XX_I2S_Params |
PDMCC26XX I2S Parameters are used when calling PDMCC26XX_I2S_open(). More... | |
typedef struct PDMCC26XX_I2S_Object | PDMCC26XX_I2S_Object |
PDMCC26XX_I2S Object. More... | |
Enumerations | |
enum | PDMCC26XX_I2S_Status { PDMCC26XX_I2S_STREAM_IDLE = 0, PDMCC26XX_I2S_STREAM_STARTED, PDMCC26XX_I2S_STREAM_CANCELED, PDMCC26XX_I2S_STREAM_FAILED, PDMCC26XX_I2S_STREAM_ERROR, PDMCC26XX_I2S_STREAM_BUFFER_READY, PDMCC26XX_I2S_STREAM_BUFFER_DROPPED, PDMCC26XX_I2S_STREAM_STOPPING, PDMCC26XX_I2S_STREAM_STOPPED, PDMCC26XX_I2S_STREAM_FAILED_TO_STOP } |
Status codes that are set by the I2S driver. More... | |
enum | PDMCC26XX_I2S_Mode { PDMCC26XX_I2S_PDM = 0, PDMCC26XX_I2S_I2S = 1 } |
Definitions for various PDMCC26XX_I2S modes of operation. More... | |
enum | PDMCC26XX_I2S_RequestMode { PDMCC26XX_I2S_MODE_BLOCKING, PDMCC26XX_I2S_CALLBACK_MODE } |
PDMCC26XX_I2S Object. More... | |
Functions | |
void | PDMCC26XX_I2S_init (PDMCC26XX_I2S_Handle handle) |
I2S CC26XX initialization. More... | |
PDMCC26XX_I2S_Handle | PDMCC26XX_I2S_open (PDMCC26XX_I2S_Handle handle, PDMCC26XX_I2S_Params *params) |
Function to open a given CC26XX I2S peripheral specified by the I2S handle. More... | |
void | PDMCC26XX_I2S_close (PDMCC26XX_I2S_Handle handle) |
Function to close a given CC26XX I2S peripheral specified by the I2S handle. More... | |
bool | PDMCC26XX_I2S_startStream (PDMCC26XX_I2S_Handle handle) |
Function for starting an I2S interface. More... | |
bool | PDMCC26XX_I2S_stopStream (PDMCC26XX_I2S_Handle handle) |
Function for stopping an I2S interface. More... | |
bool | PDMCC26XX_I2S_requestBuffer (PDMCC26XX_I2S_Handle handle, PDMCC26XX_I2S_BufferRequest *bufferRequest) |
Function for requesting buffer. More... | |
void | PDMCC26XX_I2S_releaseBuffer (PDMCC26XX_I2S_Handle handle, PDMCC26XX_I2S_BufferRelease *bufferRelease) |
Function for releasing buffer. More... | |
Variables | |
const PDMCC26XX_I2S_Config | PDMCC26XX_I2S_config [] |
#define xI2S_DEBUG |
Define to control debug mode.
Production code should set this to xI2S_DEBUG. To enable debug mode rename the define to I2S_DEBUG.
#define PDMCC26XX_I2S_MIN_ALLOWED_QUEUE_SIZE 3 |
At least three elements must exist for good flow in driver
#define I2S_BLOCK_OVERHEAD_IN_BYTES 12 |
PDM block overhead size in number of bytes –> sizeof(PDMCC26XX_I2S_QueueNode)
#define PDMCC26XX_I2S_CMD_SUCCESS 0 |
Return code when PDMCC26XX_I2S_control() was successful.
#define PDMCC26XX_I2S_CMD_UNDEFINED -1 |
Return code when a I2S command or function is undefined/not-implemented.
#define PDMCC26XX_I2S_CMD_NO_SUCCESS -2 |
Return code when PDMCC26XX_I2S_control() was unsuccessful.
#define PDMCC26XX_I2S_GENERIC_DISABLED 0 |
Generic macro for disabled
#define PDMCC26XX_I2S_GENERIC_ENABLED 1 |
Generic macro for enabled
#define PDMCC26XX_I2S_DEFAULT_SAMPLE_STAMP_MOD 0x0000FFFF |
We don't use sample stamp generator, but we can't start without enabling it and configuring the trigger. This is because the trigger also starts the audio stream Since we don't use it we keep the word period at its max 2^16 For the driverlib which runs a modulo on the word period we can set the modulo to 0xFFFF to avoid issues with division by zero.
#define PDMCC26XX_I2S_WordClockPhase_Single 0 |
Definitions for different I2S Word Clock phase settings.
Defines how WCLK division ratio is calculated to generate different duty cycles.
Macro | Value |
---|---|
PDMCC26XX_I2S_WordClockPhase_Single | 0 |
PDMCC26XX_I2S_WordClockPhase_Dual | 1 |
PDMCC26XX_I2S_WordClockPhase_UserDefined | 2 |
#define PDMCC26XX_I2S_WordClockPhase_Dual 1 |
#define PDMCC26XX_I2S_WordClockPhase_UserDefined 2 |
#define PDMCC26XX_I2S_SampleEdge_Negative 0 |
Definitions to set sample edge
Macro | Value |
---|---|
PDMCC26XX_I2S_SampleEdge_Negative | 0 |
PDMCC26XX_I2S_SampleEdge_Postive | 1 |
#define PDMCC26XX_I2S_SampleEdge_Postive 1 |
#define PDMCC26XX_I2S_WordClockSource_Ext 1 |
Definitions different I2S Word Clock source settings.
Macro | Value |
---|---|
PDMCC26XX_I2S_WordClockSource_Ext | 0 |
PDMCC26XX_I2S_WordClockSource_Int | 1 |
#define PDMCC26XX_I2S_WordClockSource_Int 2 |
#define PDMCC26XX_I2S_BitClockSource_Ext 0 |
Definitions different I2S Bit Clock source settings.
Macro | Value |
---|---|
PDMCC26XX_I2S_BitClockSource_Ext | 0 |
PDMCC26XX_I2S_BitClockSource_Int | 1 |
#define PDMCC26XX_I2S_BitClockSource_Int 1 |
#define PDMCC26XX_I2S_ClockSource_Normal 0 |
Definitions to either invert I2S word or bit clock or not
Macro | Value |
---|---|
PDMCC26XX_I2S_ClockSource_Normal | 0 |
PDMCC26XX_I2S_ClockSource_Inverted | 1 |
#define PDMCC26XX_I2S_ClockSource_Inverted 1 |
#define PDMCC26XX_I2S_ADUsageDisabled 0 |
PDMCC26XX_I2S Audio Data Pin Usage.
Macro | Details |
---|---|
PDMCC26XX_I2S_ADUsageDisabled | Disabled |
PDMCC26XX_I2S_ADUsageInput | Input |
PDMCC26XX_I2S_ADUsageOutput | Output |
#define PDMCC26XX_I2S_ADUsageInput 1 |
#define PDMCC26XX_I2S_ADUsageOutput 2 |
#define PDMCC26XX_I2S_CHAN0_ACT 0x00000001 |
PDMCC26XX_I2S Audio Channel Masks.
Macro | Value | Usage |
---|---|---|
PDMCC26XX_I2S_CHAN0_ACT | 0x00000001 | OR in to enable channel 0 |
PDMCC26XX_I2S_CHAN1_ACT | 0x00000002 | OR in to enable channel 1 |
PDMCC26XX_I2S_CHAN2_ACT | 0x00000004 | OR in to enable channel 2 |
PDMCC26XX_I2S_CHAN3_ACT | 0x00000008 | OR in to enable channel 3 |
PDMCC26XX_I2S_CHAN4_ACT | 0x00000010 | OR in to enable channel 4 |
PDMCC26XX_I2S_CHAN5_ACT | 0x00000020 | OR in to enable channel 5 |
PDMCC26XX_I2S_CHAN6_ACT | 0x00000040 | OR in to enable channel 6 |
PDMCC26XX_I2S_CHAN7_ACT | 0x00000080 | OR in to enable channel 7 |
PDMCC26XX_I2S_MONO_MODE | 0x00000001 | Use to set Mono mode |
PDMCC26XX_I2S_STEREO_MODE | 0x00000003 | Use to set Stereo mode |
PDMCC26XX_I2S_DISABLED_MODE | 0x00000000 | Use to disable |
PDMCC26XX_I2S_CHAN_CFG_MASK | 0x000000FF | Use to mask out invalid |
#define PDMCC26XX_I2S_CHAN1_ACT 0x00000002 |
#define PDMCC26XX_I2S_CHAN2_ACT 0x00000004 |
#define PDMCC26XX_I2S_CHAN3_ACT 0x00000008 |
#define PDMCC26XX_I2S_CHAN4_ACT 0x00000010 |
#define PDMCC26XX_I2S_CHAN5_ACT 0x00000020 |
#define PDMCC26XX_I2S_CHAN6_ACT 0x00000040 |
#define PDMCC26XX_I2S_CHAN7_ACT 0x00000080 |
#define PDMCC26XX_I2S_MONO_MODE 0x00000001 |
#define PDMCC26XX_I2S_STEREO_MODE 0x00000003 |
#define PDMCC26XX_I2S_DISABLED_MODE 0x00000000 |
#define PDMCC26XX_I2S_CHAN_CFG_MASK 0x000000FF |
#define PDMCC26XX_I2S_WordLengthMin 8 |
PDMCC26XX_I2S data word length is used to determine how bits to transfer per word.
Macro | Value | Usage |
---|---|---|
PDMCC26XX_I2S_WordLengthMin | 8 | Minimum transfer length is 8 bits |
PDMCC26XX_I2S_WordLength16 | 16 | A typical transfer length is 16 bits |
PDMCC26XX_I2S_WordLengthMax | 24 | Maximum transfer length is 24 bits |
#define PDMCC26XX_I2S_WordLength16 16 |
#define PDMCC26XX_I2S_WordLengthMax 24 |
#define PDMCC26XX_I2S_SinglePhase 0 |
PDMCC26XX_I2S Phase is set to select Dual or Single phase format
Macro | Value |
---|---|
PDMCC26XX_I2S_SinglePhase | 0 |
PDMCC26XX_I2S_DualPhase | 1 |
#define PDMCC26XX_I2S_DualPhase 1 |
#define PDMCC26XX_I2S_NegativeEdge 0 |
PDMCC26XX_I2S Sample Edge is set to control what edge to sample and clock out data on.
Macro | Value |
---|---|
PDMCC26XX_I2S_NegativeEdge | 0 |
PDMCC26XX_I2S_PositiveEdge | 1 |
#define PDMCC26XX_I2S_PositiveEdge 1 |
#define PDMCC26XX_I2S_MemLen16bit 0 |
PDMCC26XX_I2S data word size is used to determine how to configure the I2S data transfers to/from memory.
Macro | Value | Usage |
---|---|---|
PDMCC26XX_I2S_MemLen16bit | 0 | sample 16 bits per word |
PDMCC26XX_I2S_MemLen24bit | 1 | sample 24 bits per word |
PDMCC26XX_I2S_MemLen16bit: sample 16 bits per word PDMCC26XX_I2S_MemLen24bit: sample 24 bits per word
#define PDMCC26XX_I2S_MemLen24bit 1 |
#define PDMCC26XX_I2S_FormatLJF 0 |
PDMCC26XX_I2S Data Delay, which translates into format (LJF, I2S/DSP, RJF).
This field can be set to any 8 bit value. The macros are just defined for convenience. Left justified mode means that sampling should start immediately. For right justified mode the data delay depends on how many samples should be taken per word. It is an alignment.
I2S is a special mode that defines that no sample occur on first edge, hence there is one period data delay.
Macro | Value | Usage |
---|---|---|
PDMCC26XX_I2S_FormatLJF | 0 | no data delay |
PDMCC26XX_I2S_FormatI2SandDSP | 1 | one period data delay |
PDMCC26XX_I2S_FormatRJFmin | 2 | two periods data delay |
PDMCC26XX_I2S_FormatRJFmax | 255 | 255 periods data delay |
#define PDMCC26XX_I2S_FormatI2SandDSP 1 |
#define PDMCC26XX_I2S_FormatRJFmin 2 |
#define PDMCC26XX_I2S_FormatRJFmax 255 |
#define PDMCC26XX_I2S_DIR_CHA_M (I2S_LINE_MASK | I2S_CHAN_CFG_MASK) |
Mask to use with PDMCC26XX_I2S_AudioPinConfig.driverLibParams when calling DriverLib.
typedef void*(* PDMCC26XX_I2S_MallocFxn) (size_t memSize) |
PDMCC26XX_I2S_MallocFxn is a function pointer for the malloc function to be used by the driver.
typedef void(* PDMCC26XX_I2S_FreeFxn) (void *ptr, size_t memSize) |
PDMCC26XX_I2S_FreeFxn is a function pointer for the free function to be used by the driver. This is needed for memory clean up, if something goes wrong.
typedef struct PDMCC26XX_I2S_Config* PDMCC26XX_I2S_Handle |
A handle that is returned from a PDMCC26XX_I2S_open() call.
typedef enum PDMCC26XX_I2S_Status PDMCC26XX_I2S_Status |
Status codes that are set by the I2S driver.
typedef enum PDMCC26XX_I2S_Mode PDMCC26XX_I2S_Mode |
Definitions for various PDMCC26XX_I2S modes of operation.
typedef uint32_t PDMCC26XX_I2S_TransferSize |
Number of samples (16 or 24 bits) per queue element buffer
typedef struct PDMCC26XX_I2S_Config PDMCC26XX_I2S_Config |
The PDMCC26XX_I2S_Config structure contains a set of pointers used to characterize the PDMCC26XX_I2S driver implementation.
typedef struct PDMCC26XX_I2S_HWAttrs PDMCC26XX_I2S_HWAttrs |
PDMCC26XX_I2S Hardware attributes.
These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For CC26xxWare these definitions are found in:
A sample structure is shown below:
typedef struct PDMCC26XX_I2S_AudioClockConfig PDMCC26XX_I2S_AudioClockConfig |
PDMCC26XX_I2S Audio Clock configuration.
These fields are used by the driver to set up the I2S module
A sample structure is shown below (single PDM microphone):
typedef union PDMCC26XX_I2S_AudioPinConfig PDMCC26XX_I2S_AudioPinConfig |
PDMCC26XX_I2S Audio Pin configuration.
These fields are used by the driver to set up the I2S module
A sample structure is shown below (single PDM microphone):
typedef struct PDMCC26XX_I2S_AudioFormatConfig PDMCC26XX_I2S_AudioFormatConfig |
PDMCC26XX_I2S Hardware configuration.
These fields are used by the driver to set up the I2S module
A sample structure is shown below (single PDM microphone):
typedef enum PDMCC26XX_I2S_RequestMode PDMCC26XX_I2S_RequestMode |
PDMCC26XX_I2S Object.
The application must not access any member variables of this structure!
typedef struct PDMCC26XX_I2S_StreamNotification PDMCC26XX_I2S_StreamNotification |
A PDMCC26XX_I2S_StreamNotification data structure is used with PDMCC26XX_I2S_CallbackFxn(). Provides notification about available buffers and potential errors.
typedef struct PDMCC26XX_I2S_BufferRequest PDMCC26XX_I2S_BufferRequest |
A PDMCC26XX_I2S_BufferRequest data structure is used with PDMCC26XX_I2S_requestBuffer().
bufferIn is a pointer to the requested buffer. It is NULL if no buffer is available
Input Mode | Interpretation of bufferIn being NULL after returning |
---|---|
Blocking mode | Request timed out and still no buffer available |
Non-Blocking mode | No buffer available |
PDMCC26XX_I2S_requestBuffer will also return false if there are no buffers available.
typedef struct PDMCC26XX_I2S_BufferRelease PDMCC26XX_I2S_BufferRelease |
A PDMCC26XX_I2S_BufferRelease data structure is used with PDMCC26XX_I2S_releaseBuffer().
bufferHandleIn and bufferHandleOut allows the driver to take back and reuse memory.
typedef void(* PDMCC26XX_I2S_CallbackFxn) (PDMCC26XX_I2S_Handle handle, PDMCC26XX_I2S_StreamNotification *notification) |
The definition of a callback function used when wakeup on chip select is enabled.
PDMCC26XX_I2S_Handle | PDMCC26XX_I2S_Handle |
typedef struct PDMCC26XX_I2S_Params PDMCC26XX_I2S_Params |
PDMCC26XX I2S Parameters are used when calling PDMCC26XX_I2S_open().
typedef struct PDMCC26XX_I2S_Object PDMCC26XX_I2S_Object |
PDMCC26XX_I2S Object.
The application must not access any member variables of this structure!
enum PDMCC26XX_I2S_Status |
Status codes that are set by the I2S driver.
Enumerator | |
---|---|
PDMCC26XX_I2S_STREAM_IDLE | Idle mode. Stream not started |
PDMCC26XX_I2S_STREAM_STARTED | Stream started, no buffer yet available |
PDMCC26XX_I2S_STREAM_CANCELED | Unused state. |
PDMCC26XX_I2S_STREAM_FAILED | PDMCC26XX_I2S_startStream() called while stream is already running |
PDMCC26XX_I2S_STREAM_ERROR | No pointer available when one was expected, meaning the driver failed to provide new pointer and PDMCC26XX_I2S_stopStream() was not called |
PDMCC26XX_I2S_STREAM_BUFFER_READY | Buffer ready, either IN or OUT or both, whichever are expected |
PDMCC26XX_I2S_STREAM_BUFFER_DROPPED | A new buffer is ready but the old ones were not processed in time. The oldest buffer was dropped to provide space for newer data. |
PDMCC26XX_I2S_STREAM_STOPPING | PDMCC26XX_I2S_stopStream() is called, a graceful shutdown procedure is started |
PDMCC26XX_I2S_STREAM_STOPPED | Driver transitioned from Stopping to Stopped state during graceful shutdown. Now a pointer error is expected, and upon it a semaphore is set allowing PDMCC26XX_I2S_stopStream() to return |
PDMCC26XX_I2S_STREAM_FAILED_TO_STOP | PDMCC26XX_I2S_stopStream() was called, but driver timed out trying to gracefully shutdown |
enum PDMCC26XX_I2S_Mode |
PDMCC26XX_I2S Object.
The application must not access any member variables of this structure!
Enumerator | |
---|---|
PDMCC26XX_I2S_MODE_BLOCKING | PDMCC26XX_I2S_requestBuffer() blocks execution. This mode can only be used when called within a Task context. |
PDMCC26XX_I2S_CALLBACK_MODE | PDMCC26XX_I2S_requestBuffer returns immediately if no buffer is available. The caller is notified through events each time a buffer is available. This mode can be used in a Task, Swi, or Hwi context. |
void PDMCC26XX_I2S_init | ( | PDMCC26XX_I2S_Handle | handle | ) |
I2S CC26XX initialization.
handle | A PDMCC26XX_I2S_Handle |
PDMCC26XX_I2S_Handle PDMCC26XX_I2S_open | ( | PDMCC26XX_I2S_Handle | handle, |
PDMCC26XX_I2S_Params * | params | ||
) |
Function to open a given CC26XX I2S peripheral specified by the I2S handle.
The function will set a dependency on its power domain, i.e. power up the module and enable the clock. The IOs are allocated. The I2S will not be enabled.
params must point a correctly initialized PDMCC26XX_I2S_Params struct.
handle | A PDMCC26XX_I2S_Handle |
params | Pointer to a parameter block, if NULL it will use default values |
void PDMCC26XX_I2S_close | ( | PDMCC26XX_I2S_Handle | handle | ) |
Function to close a given CC26XX I2S peripheral specified by the I2S handle.
Will disable the I2S, disable all I2S interrupts and release the dependency on the corresponding power domain. It will also destroy all semaphores and queues that have been used.
handle | A PDMCC26XX_I2S_Handle returned from PDMCC26XX_I2S_open() |
bool PDMCC26XX_I2S_startStream | ( | PDMCC26XX_I2S_Handle | handle | ) |
Function for starting an I2S interface.
Calling this function will prevent the device from sleeping, as the stream is continuous and thus require power to the audio interface module from start to end. This function will configure all hardware registers that does not have retention. Hence, one may call PDMCC26XX_I2S_open then go to sleep before this function is called.
If non-blocking mode is selected then the PDMCC26XX_I2S module will begin calling the provided callback function every time a new buffer is ready.
handle | An I2S handle returned from PDMCC26XX_I2S_open() |
bool PDMCC26XX_I2S_stopStream | ( | PDMCC26XX_I2S_Handle | handle | ) |
Function for stopping an I2S interface.
This function will initiate the shut down sequence. The audio interface module is designed with a graceful shutdown. What this means is that the current buffer is filled before stopping. This function will block while the last buffer is completing. The maximum blocking delay is a function of the configured DMA transfer size, and the word clock rate.
When this function returns it is recommended to complete processing of all pending ready buffers. If the caller is not interested in the last audio data it may simply call PDMCC26XX_I2S_requestBuffer() and PDMCC26XX_I2S_releaseBuffer() in a loop until PDMCC26XX_I2S_requestBuffer() returns false.
Will disable the I2S, disable all I2S interrupts and release the dependency on the corresponding power domain.
handle | An I2S handle returned from PDMCC26XX_I2S_open() |
bool PDMCC26XX_I2S_requestBuffer | ( | PDMCC26XX_I2S_Handle | handle, |
PDMCC26XX_I2S_BufferRequest * | bufferRequest | ||
) |
Function for requesting buffer.
In PDMCC26XX_I2S_MODE_BLOCKING, PDMCC26XX_I2S_requestBuffer will block task execution until at least one buffer is ready.
In PDMCC26XX_I2S_CALLBACK_MODE, PDMCC26XX_I2S_requestBuffer returns immediately if no buffer is available. The caller is notified through events each time a buffer is available.
This function takes as an argument a pointer to a struct which contains 4 pointers. There are two pairs; one for Input and one for Output. If input is defined then the input buffer pointer will point to the new input buffer. Same goes for output and the output buffer pointer. The caller is not expected to allocate memory for the buffer as no copy is performed. The other two pointers must be maintained by the caller until it is ready to call PDMCC26XX_I2S_releaseBuffer().
handle | A I2S handle returned from PDMCC26XX_I2S_open() |
*bufferRequest | Pointer to PDMCC26XX_I2S_BufferRequest struct |
void PDMCC26XX_I2S_releaseBuffer | ( | PDMCC26XX_I2S_Handle | handle, |
PDMCC26XX_I2S_BufferRelease * | bufferRelease | ||
) |
Function for releasing buffer.
The caller of PDMCC26XX_I2S_requestBuffer() must call this function when it is finished working on the buffer. This function takes as an argument a pointer to a struct which contains two other pointers. These pointers must be set the pointers received in PDMCC26XX_I2S_requestBuffer().
handle | A I2S handle returned from PDMCC26XX_I2S_open() |
*bufferRelease | Pointer to PDMCC26XX_I2S_BufferRelease struct |
const PDMCC26XX_I2S_Config PDMCC26XX_I2S_config[] |
PDMCC26XX_I2S_Config struct defined in the board file