Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IISC - Inter-IC Sound Controller

Driver for the IISC - Inter-IC Sound Controller module.

IISC provides a 5-wire, bidirectional, synchronous, digital audio link with off-chip audio devices: ISDI, ISDO, IWS, ISCK and IMCK pins.

Modules

 

Data Structures

struct  iis_config
 Configuration setting structure. More...
 
struct  iis_dev_inst
 

Macros

#define IIS_RETRY_VALUE   10000
 

Typedefs

typedef void(* iis_callback_t )(void)
 
typedef enum iis_interrupt_source iis_interrupt_source_t
 IIS interrupt source. More...
 

Enumerations

enum  iis_data_format {
  IIS_DATE_32BIT = 0,
  IIS_DATE_24BIT,
  IIS_DATE_20BIT,
  IIS_DATE_18BIT,
  IIS_DATE_16BIT,
  IIS_DATE_16BIT_COMPACT,
  IIS_DATE_8BIT,
  IIS_DATE_8BIT_COMPACT
}
 Data format. More...
 
enum  iis_dma_channel {
  IIS_ONE_DMA_CHANNEL_FOR_BOTH_CHANNELS = 0,
  IIS_ONE_DMA_CHANNEL_FOR_ONE_CHANNEL
}
 DMA channel usage for IIS transfer. More...
 
enum  iis_fs_rate {
  IIS_FS_RATE_16 = 0,
  IIS_FS_RATE_32 = 1,
  IIS_FS_RATE_48 = 2,
  IIS_FS_RATE_64 = 3,
  IIS_FS_RATE_96 = 5,
  IIS_FS_RATE_128 = 7,
  IIS_FS_RATE_192 = 11,
  IIS_FS_RATE_256 = 15,
  IIS_FS_RATE_384 = 23,
  IIS_FS_RATE_512 = 31,
  IIS_FS_RATE_768 = 47,
  IIS_FS_RATE_1024 = 63
}
 Supported Master Clock to Sample Frequency (fs) Ratio. More...
 
enum  iis_interrupt_source {
  IIS_INTERRUPT_RXRDY = 0,
  IIS_INTERRUPT_RXOR,
  IIS_INTERRUPT_TXRDY,
  IIS_INTERRUPT_TXUR,
  _IIS_INTERRUPT_SOURCE_NUM
}
 IIS interrupt source. More...
 
enum  iis_number_of_channels {
  IIS_CHANNEL_MONO = 0,
  IIS_CHANNEL_STEREO
}
 Supported number of channels. More...
 
enum  iis_slot_length {
  IIS_SLOT_LENGTH_8BIT = 8,
  IIS_SLOT_LENGTH_16BIT = 16,
  IIS_SLOT_LENGTH_24BIT = 24,
  IIS_SLOT_LENGTH_32BIT = 32
}
 Slot length. More...
 

Functions

void iis_clear_status (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Clear the IIS status value. More...
 
void iis_disable (struct iis_dev_inst *const dev_inst)
 Disable the IIS module. More...
 
static void iis_disable_clocks (struct iis_dev_inst *dev_inst)
 Disable the clocks for the IIS module. More...
 
void iis_disable_interrupt (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Disable the specified interrput sources. More...
 
static void iis_disable_reception (struct iis_dev_inst *dev_inst)
 Disable the IIS module in reception. More...
 
static void iis_disable_transmission (struct iis_dev_inst *dev_inst)
 Disable the IIS module in transmission. More...
 
void iis_enable (struct iis_dev_inst *const dev_inst)
 Enable the IIS module. More...
 
static void iis_enable_clocks (struct iis_dev_inst *dev_inst)
 Enable the clocks for the IIS module. More...
 
void iis_enable_interrupt (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Enable the specified interrput sources. More...
 
static void iis_enable_reception (struct iis_dev_inst *dev_inst)
 Enable the IIS module in reception. More...
 
static void iis_enable_transmission (struct iis_dev_inst *dev_inst)
 Enable the IIS module in transmission. More...
 
static void iis_get_config_defaults (struct iis_config *const cfg)
 Get the default IIS module configuration: Data format: 32 bits Slot length: 32 bits Sample frequecny ratio: 1024 Tx channel: Stereo Rx channel: Stereo DMA for Tx: 1 DMA channel for 1 IIS Tx channel DMA for Rx: 1 DMA channel for 1 IIS Rx channel Loopback: No Master: Yes. More...
 
static uint32_t iis_get_interrupt_mask (struct iis_dev_inst *const dev_inst)
 Get the IIS interrupts mask value. More...
 
static uint32_t iis_get_status (struct iis_dev_inst *dev_inst)
 Get the IIS status value. More...
 
enum status_code iis_init (struct iis_dev_inst *const dev_inst, Iisc *iisc, struct iis_config *const cfg)
 Initialize and configure the IIS module. More...
 
enum status_code iis_read (struct iis_dev_inst *dev_inst, uint32_t *data)
 Read a single message of data. More...
 
static void iis_reset (struct iis_dev_inst *dev_inst)
 Resets the IIS module. More...
 
void iis_set_callback (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source, iis_callback_t callback, uint8_t irq_level)
 Set callback for IIS. More...
 
enum status_code iis_write (struct iis_dev_inst *dev_inst, uint32_t data)
 Write a single message of data. More...
 

#define IIS_RETRY_VALUE   10000

Referenced by iis_read(), and iis_write().

typedef void(* iis_callback_t)(void)

IIS interrupt source.

Data format.

Enumerator
IIS_DATE_32BIT 
IIS_DATE_24BIT 
IIS_DATE_20BIT 
IIS_DATE_18BIT 
IIS_DATE_16BIT 
IIS_DATE_16BIT_COMPACT 
IIS_DATE_8BIT 
IIS_DATE_8BIT_COMPACT 

DMA channel usage for IIS transfer.

Enumerator
IIS_ONE_DMA_CHANNEL_FOR_BOTH_CHANNELS 
IIS_ONE_DMA_CHANNEL_FOR_ONE_CHANNEL 

Supported Master Clock to Sample Frequency (fs) Ratio.

Enumerator
IIS_FS_RATE_16 
IIS_FS_RATE_32 
IIS_FS_RATE_48 
IIS_FS_RATE_64 
IIS_FS_RATE_96 
IIS_FS_RATE_128 
IIS_FS_RATE_192 
IIS_FS_RATE_256 
IIS_FS_RATE_384 
IIS_FS_RATE_512 
IIS_FS_RATE_768 
IIS_FS_RATE_1024 

IIS interrupt source.

Enumerator
IIS_INTERRUPT_RXRDY 
IIS_INTERRUPT_RXOR 
IIS_INTERRUPT_TXRDY 
IIS_INTERRUPT_TXUR 
_IIS_INTERRUPT_SOURCE_NUM 

Supported number of channels.

Enumerator
IIS_CHANNEL_MONO 
IIS_CHANNEL_STEREO 

Slot length.

Enumerator
IIS_SLOT_LENGTH_8BIT 
IIS_SLOT_LENGTH_16BIT 
IIS_SLOT_LENGTH_24BIT 
IIS_SLOT_LENGTH_32BIT 

void iis_clear_status ( struct iis_dev_inst dev_inst,
iis_interrupt_source_t  source 
)

Clear the IIS status value.

Parameters
dev_instDevice structure pointer.
sourceInterrupt source

References Assert, iis_dev_inst::hw_dev, IIS_INTERRUPT_RXOR, and IIS_INTERRUPT_TXUR.

void iis_disable ( struct iis_dev_inst *const  dev_inst)

Disable the IIS module.

Parameters
dev_instDevice structure pointer.

References SLEEPMGR_ACTIVE, sleepmgr_unlock_mode(), and UNUSED.

Referenced by run_iis_test().

static void iis_disable_clocks ( struct iis_dev_inst dev_inst)
inlinestatic

Disable the clocks for the IIS module.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

void iis_disable_interrupt ( struct iis_dev_inst *const  dev_inst,
iis_interrupt_source_t  source 
)

Disable the specified interrput sources.

Parameters
dev_instDevice structure pointer.
sourceInterrupt source

References Assert, iis_dev_inst::hw_dev, IIS_INTERRUPT_RXOR, IIS_INTERRUPT_RXRDY, IIS_INTERRUPT_TXRDY, and IIS_INTERRUPT_TXUR.

static void iis_disable_reception ( struct iis_dev_inst dev_inst)
inlinestatic

Disable the IIS module in reception.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

static void iis_disable_transmission ( struct iis_dev_inst dev_inst)
inlinestatic

Disable the IIS module in transmission.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

void iis_enable ( struct iis_dev_inst *const  dev_inst)

Enable the IIS module.

Parameters
dev_instDevice structure pointer.

References SLEEPMGR_ACTIVE, sleepmgr_lock_mode(), and UNUSED.

Referenced by run_iis_test().

static void iis_enable_clocks ( struct iis_dev_inst dev_inst)
inlinestatic

Enable the clocks for the IIS module.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

Referenced by run_iis_test().

void iis_enable_interrupt ( struct iis_dev_inst *const  dev_inst,
iis_interrupt_source_t  source 
)

Enable the specified interrput sources.

Parameters
dev_instDevice structure pointer.
sourceInterrupt source

References Assert, iis_dev_inst::hw_dev, IIS_INTERRUPT_RXOR, IIS_INTERRUPT_RXRDY, IIS_INTERRUPT_TXRDY, and IIS_INTERRUPT_TXUR.

Referenced by iis_set_callback().

static void iis_enable_reception ( struct iis_dev_inst dev_inst)
inlinestatic

Enable the IIS module in reception.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

Referenced by run_iis_test().

static void iis_enable_transmission ( struct iis_dev_inst dev_inst)
inlinestatic

Enable the IIS module in transmission.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

Referenced by run_iis_test().

static void iis_get_config_defaults ( struct iis_config *const  cfg)
inlinestatic

Get the default IIS module configuration: Data format: 32 bits Slot length: 32 bits Sample frequecny ratio: 1024 Tx channel: Stereo Rx channel: Stereo DMA for Tx: 1 DMA channel for 1 IIS Tx channel DMA for Rx: 1 DMA channel for 1 IIS Rx channel Loopback: No Master: Yes.

Parameters
cfgPointer to IIS configuration.

References Assert, iis_config::data_format, iis_config::fs_ratio, IIS_CHANNEL_STEREO, IIS_DATE_32BIT, IIS_FS_RATE_1024, IIS_ONE_DMA_CHANNEL_FOR_ONE_CHANNEL, IIS_SLOT_LENGTH_32BIT, iis_config::loopback, iis_config::master, iis_config::rx_channels, iis_config::rx_dma, iis_config::slot_length, iis_config::tx_channels, and iis_config::tx_dma.

Referenced by run_iis_test().

static uint32_t iis_get_interrupt_mask ( struct iis_dev_inst *const  dev_inst)
inlinestatic

Get the IIS interrupts mask value.

Parameters
dev_instDevice structure pointer.
Returns
Interrupt mask value

References iis_dev_inst::hw_dev.

Referenced by iis_interrupt_handler().

static uint32_t iis_get_status ( struct iis_dev_inst dev_inst)
inlinestatic

Get the IIS status value.

Parameters
dev_instDevice structure pointer.
Returns
Status value

References iis_dev_inst::hw_dev.

Referenced by iis_interrupt_handler().

enum status_code iis_init ( struct iis_dev_inst *const  dev_inst,
Iisc *  iisc,
struct iis_config *const  cfg 
)

Initialize and configure the IIS module.

Parameters
dev_instDevice structure pointer.
iiscBase address of the IISC instance.
cfgPointer to IIS configuration.
Returns
status

References _iis_set_config(), Assert, iis_dev_inst::cfg, dev_inst, iis_dev_inst::hw_dev, iis_reset(), and sysclk_enable_peripheral_clock().

Referenced by run_iis_test().

enum status_code iis_read ( struct iis_dev_inst *const  dev_inst,
uint32_t *  data 
)

Read a single message of data.

Parameters
dev_instDevice structure pointer.
*dataPointer for receive data
Returns
status

References Assert, iis_dev_inst::hw_dev, IIS_RETRY_VALUE, STATUS_ERR_TIMEOUT, and STATUS_OK.

static void iis_reset ( struct iis_dev_inst dev_inst)
inlinestatic

Resets the IIS module.

Parameters
dev_instDevice structure pointer.

References iis_dev_inst::hw_dev.

Referenced by iis_init().

void iis_set_callback ( struct iis_dev_inst *const  dev_inst,
iis_interrupt_source_t  source,
iis_callback_t  callback,
uint8_t  irq_level 
)

Set callback for IIS.

Parameters
dev_instDevice structure pointer.
sourceInterrupt source.
callbackCallback function pointer.
irq_levelInterrupt level.

References Assert, callback, iis_callback_pointer, and iis_enable_interrupt().

enum status_code iis_write ( struct iis_dev_inst *const  dev_inst,
uint32_t  data 
)

Write a single message of data.

Parameters
dev_instDevice structure pointer.
dataThe data to write
Returns
status

References Assert, data, iis_dev_inst::hw_dev, IIS_RETRY_VALUE, STATUS_ERR_TIMEOUT, and STATUS_OK.