TI-RTOS Drivers  tidrivers_full_2_20_01_10
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
PDMCC26XX_util.h File Reference

Detailed Description

PDM utility includes helper functions for configuring the CC26XX I2S controller.

============================================================================

The PDMCC26XX utility header file should be included in an application as follows:

Overview

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/sysbios/knl/Semaphore.h>
#include <ti/sysbios/family/arm/m3/Hwi.h>
Include dependency graph for PDMCC26XX_util.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...
 

Macros

#define ti_sysbios_family_arm_m3_Hwi__nolocalnames
 
#define xI2S_DEBUG
 Define to control debug mode. More...
 
#define PDMCC26XX_I2S_MIN_ALLOWED_QUEUE_SIZE   3
 
#define I2S_BLOCK_OVERHEAD_IN_BYTES   12
 
#define PDMCC26XX_I2S_CMD_SUCCESS   0
 
#define PDMCC26XX_I2S_CMD_UNDEFINED   -1
 
#define PDMCC26XX_I2S_CMD_NO_SUCCESS   -2
 
#define PDMCC26XX_I2S_GENERIC_DISABLED   0
 
#define PDMCC26XX_I2S_GENERIC_ENABLED   1
 
#define PDMCC26XX_I2S_DEFAULT_SAMPLE_STAMP_MOD   0x0000FFFF
 
#define PDMCC26XX_I2S_WordClockPhase_Single   0
 
#define PDMCC26XX_I2S_WordClockPhase_Dual   1
 
#define PDMCC26XX_I2S_WordClockPhase_UserDefined   2
 
#define PDMCC26XX_I2S_SampleEdge_Negative   0
 
#define PDMCC26XX_I2S_SampleEdge_Postive   1
 
#define PDMCC26XX_I2S_WordClockSource_Ext   1
 
#define PDMCC26XX_I2S_WordClockSource_Int   2
 
#define PDMCC26XX_I2S_BitClockSource_Ext   0
 
#define PDMCC26XX_I2S_BitClockSource_Int   1
 
#define PDMCC26XX_I2S_ClockSource_Normal   0
 
#define PDMCC26XX_I2S_ClockSource_Inverted   1
 
#define PDMCC26XX_I2S_ADUsageDisabled   0
 
#define PDMCC26XX_I2S_ADUsageInput   1
 
#define PDMCC26XX_I2S_ADUsageOutput   2
 
#define PDMCC26XX_I2S_CHAN0_ACT   0x00000001
 
#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
 
#define PDMCC26XX_I2S_WordLength16   16
 
#define PDMCC26XX_I2S_WordLengthMax   24
 
#define PDMCC26XX_I2S_SinglePhase   0
 
#define PDMCC26XX_I2S_DualPhase   1
 
#define PDMCC26XX_I2S_NegativeEdge   0
 
#define PDMCC26XX_I2S_PositiveEdge   1
 
#define PDMCC26XX_I2S_MemLen16bit   0
 
#define PDMCC26XX_I2S_MemLen24bit   1
 
#define PDMCC26XX_I2S_FormatLJF   0
 
#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)
 

Typedefs

typedef struct PDMCC26XX_I2S_ConfigPDMCC26XX_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_READY_BUT_NO_AVAILABLE_BUFFERS,
  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...
 
bool PDMCC26XX_I2S_Params_init (PDMCC26XX_I2S_Params *params, PDMCC26XX_I2S_Mode mode, void *modeSpecificParams)
 Function to set initialization parameters for the audio interface. 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 []
 

Macro Definition Documentation

#define ti_sysbios_family_arm_m3_Hwi__nolocalnames

The following allows this header file to be included in an application file which also includes ti/sysbios/hal/Hwi.h.

#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(queueNodeI2S_t)

#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.

See also
I2SWCLKDIV.WDIV
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 Documentation

A handle that is returned from a PDMCC26XX_I2S_open() call.

Status codes that are set by the I2S driver.

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

The PDMCC26XX_I2S_Config structure contains a set of pointers used to characterize the PDMCC26XX_I2S driver implementation.

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:

  • inc/hw_memmap.h
  • inc/hw_ints.h

A sample structure is shown below:

1 const PDMCC26XX_I2S_HWAttrs PDMCC26XX_I2SHWAttrs = {
2  {
3  I2S0_BASE,
4  INT_I2S,
5  PERIPH_I2S,
6  Board_I2S_MCLK,
7  Board_I2S_BCLK,
8  Board_I2S_WCLK,
9  Board_I2S_ADI,
10  Board_I2S_ADO
11  },
12 };

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):

1 const PDMCC26XX_I2S_AudioClockConfig PDMCC26XX_I2Sobjects[] = {
2  16, // Word clock division
3  PDMCC26XX_I2S_SampleEdge_Negative,
4  PDMCC26XX_I2S_WordClockPhase_Dual,
5  PDMCC26XX_I2S_ClockSource_Inverted,
6  PDMCC26XX_I2S_WordClockSource_Int,
7  47, // Bit clock division
8  0, // Reserved
9  PDMCC26XX_I2S_BitClockSource_Int
10  6, // Master clock division
11 };

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):

1 const PDMCC26XX_I2S_AudioPinConfig PDMCC26XX_I2Sobjects[] = {
2  PDMCC26XX_I2S_ADUsageDisabled,
3  0,
4  0,
5  0,
6  0,
7  PDMCC26XX_I2S_ADUsageInput,
8  0,
9  1,
10  2,
11  I2S_MONO_MODE
12 };

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):

1 const PDMCC26XX_I2S_AudioFormatConfig PDMCC26XX_I2Sobjects[] = {
2  PDMCC26XX_I2S_WordLength16,
3  PDMCC26XX_I2S_PositiveEdge,
4  PDMCC26XX_I2S_DualPhase,
5  PDMCC26XX_I2S_MemLen16bit,
6  PDMCC26XX_I2S_FormatI2SandDSP
7 };

PDMCC26XX_I2S Object.

The application must not access any member variables of this structure!

A PDMCC26XX_I2S_StreamNotification data structure is used with PDMCC26XX_I2S_CallbackFxn(). Provides notification about available buffers and potential errors.

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.

See also
PDMCC26XX_I2S_requestBuffer

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.

Parameters
PDMCC26XX_I2S_HandlePDMCC26XX_I2S_Handle

PDMCC26XX I2S Parameters are used when calling PDMCC26XX_I2S_open().

PDMCC26XX_I2S Object.

The application must not access any member variables of this structure!

Enumeration Type Documentation

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_READY_BUT_NO_AVAILABLE_BUFFERS 

Buffer ready, either IN or OUT or both, whichever are expected. However, driver has no more buffers available to provide to the hardware on next interrupt. This serves as an indication to the caller that the driver is about to fail, unless caller processes ready buffers

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

Definitions for various PDMCC26XX_I2S modes of operation.

Enumerator
PDMCC26XX_I2S_PDM 

PDMCC26XX_I2S in PDM microphone mode

PDMCC26XX_I2S_I2S 

PDMCC26XX_I2S in 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.

Function Documentation

void PDMCC26XX_I2S_init ( PDMCC26XX_I2S_Handle  handle)

I2S CC26XX initialization.

Parameters
handleA PDMCC26XX_I2S_Handle
bool PDMCC26XX_I2S_Params_init ( PDMCC26XX_I2S_Params params,
PDMCC26XX_I2S_Mode  mode,
void *  modeSpecificParams 
)

Function to set initialization parameters for the audio interface.

The parameter mode specifies which mode the audio interface module will operate. modeSpecificParams must point to a struct that matches the selected mode. This is because this function will type-cast the void* based on the selected mode.

params is filled correctly by this function. Its memory must be allocated by the caller. Note however that it only has to live past the call to PDMCC26XX_I2S_open().

Parameters
paramsPointer to allocated structure to hold parameters to be used in PDMCC26XX_I2S_open
modeSelects what predefined mode to configure
modeSpecificParamsPointer to parameters that are specific to the requested configuration
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. PDMCC26XX_I2S_Params_init is a convenience function to initialize the struct correctly.

Precondition
I2S controller has been initialized
Parameters
handleA PDMCC26XX_I2S_Handle
paramsPointer to a parameter block, if NULL it will use default values
Returns
A PDMCC26XX_I2S_Handle on success or a NULL on an error or if it has been already opened
See also
PDMCC26XX_I2S_close()
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.

Precondition
PDMCC26XX_I2S_open() has to be called first.
Parameters
handleA PDMCC26XX_I2S_Handle returned from PDMCC26XX_I2S_open()
See also
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.

Precondition
PDMCC26XX_I2S_open() has to be called first.
Parameters
handleAn I2S handle returned from PDMCC26XX_I2S_open()
Returns
True if transfer is successful and false if not
See also
PDMCC26XX_I2S_open(), PDMCC26XX_I2S_stopStream()
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.

Precondition
PDMCC26XX_I2S_startStream() has to be called first.
Parameters
handleAn I2S handle returned from PDMCC26XX_I2S_open()
Returns
True if stream stopped successfully and false if not
See also
PDMCC26XX_I2S_open(), PDMCC26XX_I2S_startStream()
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().

Precondition
PDMCC26XX_I2S_open() and PDMCC26XX_I2S_startStream() has to be called first.
Parameters
handleA I2S handle returned from PDMCC26XX_I2S_open()
*bufferRequestPointer to PDMCC26XX_I2S_BufferRequest struct
Returns
True if a buffer is available, false if not.
See also
PDMCC26XX_I2S_open(), PDMCC26XX_I2S_startStream(), PDMCC26XX_I2S_releaseBuffer()
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().

Precondition
PDMCC26XX_I2S_requestBuffer() has to be called first.
Parameters
handleA I2S handle returned from PDMCC26XX_I2S_open()
*bufferReleasePointer to PDMCC26XX_I2S_BufferRelease struct
Returns
True if release is successful and false if not
See also
PDMCC26XX_I2S_open(), PDMCC26XX_I2S_startStream(), PDMCC26XX_I2S_requestBuffer()

Variable Documentation

const PDMCC26XX_I2S_Config PDMCC26XX_I2S_config[]

PDMCC26XX_I2S_Config struct defined in the board file

Copyright 2016, Texas Instruments Incorporated