Microchip® Advanced Software Framework

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

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

Data Structures

struct  iisc_opt_t
 IISC configuration struct. More...
 

Macros

#define IISC_DATALENGTH(x)
 ! More...
 
#define IISC_DATALENGTH_16   (IISC_DATALENGTH(_16) )
 Set datalength to 16 bits compact stereo (left sample in bits 15 through 0 and right samples in bits 31 through 16 of the same word) More...
 
#define IISC_DATALENGTH_16C   (IISC_DATALENGTH(_16C))
 Set datalength to 8 bits. More...
 
#define IISC_DATALENGTH_18   (IISC_DATALENGTH(_18) )
 Set datalength to 16 bits. More...
 
#define IISC_DATALENGTH_20   (IISC_DATALENGTH(_20) )
 Set datalength to 18 bits. More...
 
#define IISC_DATALENGTH_24   (IISC_DATALENGTH(_24) )
 Set datalength to 20 bits. More...
 
#define IISC_DATALENGTH_32   (IISC_DATALENGTH(_32) )
 Set datalength to 24 bits. More...
 
#define IISC_DATALENGTH_8   (IISC_DATALENGTH(_8 ) )
 Set datalength to 8 bits compact stereo (left sample in bits 7 through 0 and right samples in bits 15 through 8 of the same word) More...
 
#define IISC_DATALENGTH_8C   (IISC_DATALENGTH(_8C) )
 
#define IISC_RETRY_VALUE   10000
 

Enumerations

enum  iisc_mode {
  IISC_MODE_MASTER = 1,
  IISC_MODE_SLAVE,
  IISC_MODE_TDM_MASTER,
  IISC_MODE_TDM_SLAVE
}
 IISC modes. More...
 

Functions

void iisc_disable (volatile avr32_iisc_t *iisc)
 IISC Disable function. More...
 
static void iisc_disable_clocks (volatile avr32_iisc_t *iisc)
 Disable the clocks for the IISC module. More...
 
void iisc_disable_interrupts (volatile avr32_iisc_t *iisc, unsigned long int_mask)
 Disables the specified IISC interrupts. More...
 
static void iisc_disable_reception (volatile avr32_iisc_t *iisc)
 Disable the IISC module in reception. More...
 
static void iisc_disable_transmission (volatile avr32_iisc_t *iisc)
 Disable the IISC module in transmission. More...
 
void iisc_enable (volatile avr32_iisc_t *iisc)
 IISC Enable function. More...
 
static void iisc_enable_clocks (volatile avr32_iisc_t *iisc)
 Enable the clocks for the IISC module. More...
 
void iisc_enable_interrupts (volatile avr32_iisc_t *iisc, unsigned long int_mask)
 Enables the specified IISC interrupts. More...
 
static void iisc_enable_reception (volatile avr32_iisc_t *iisc)
 Enable the IISC module in reception. More...
 
static void iisc_enable_transmission (volatile avr32_iisc_t *iisc)
 Enable the IISC module in transmission. More...
 
unsigned long iisc_get_status (volatile avr32_iisc_t *iisc)
 Returns the IISC status. More...
 
status_code_t iisc_init (volatile avr32_iisc_t *iisc, iisc_opt_t iisc_opt)
 Sets up registers and initializes IISC for use as I2S. More...
 
status_code_t iisc_read (volatile avr32_iisc_t *iisc, uint32_t *data)
 Read a single message of data. More...
 
static void iisc_reset (volatile avr32_iisc_t *iisc)
 Resets the IISC module. More...
 
status_code_t iisc_write (volatile avr32_iisc_t *iisc, uint32_t data)
 Write a single message of data. More...
 

IISC oversampling frequency

#define IISC_OVERSAMPLING(x)
 
#define IISC_OVERSAMPLING_x16   (IISC_OVERSAMPLING(_16) )
 x16 More...
 
#define IISC_OVERSAMPLING_x32   (IISC_OVERSAMPLING(_32) )
 x32 More...
 
#define IISC_OVERSAMPLING_x64   (IISC_OVERSAMPLING(_64) )
 x64 More...
 
#define IISC_OVERSAMPLING_x128   (IISC_OVERSAMPLING(_128) )
 x128 More...
 
#define IISC_OVERSAMPLING_x256   (IISC_OVERSAMPLING(_256) )
 x256 More...
 
#define IISC_OVERSAMPLING_x384   (IISC_OVERSAMPLING(_384) )
 x384 More...
 
#define IISC_OVERSAMPLING_x512   (IISC_OVERSAMPLING(_512) )
 x512 More...
 
#define IISC_OVERSAMPLING_x768   (IISC_OVERSAMPLING(_768) )
 x768 More...
 
#define IISC_OVERSAMPLING_x1024   (IISC_OVERSAMPLING(_1024))
 x1024 More...
 

IISC dma configuration

#define IISC_TXDMA_MULTIPLE
 
#define IISC_TXDMA_SINGLE
 
#define IISC_RXDMA_MULTIPLE
 
#define IISC_RXDMA_SINGLE
 

IISC Format Configuration

#define IISC_FORMAT_LJ   AVR32_IISC_MR_FORMAT_LJ
 
#define IISC_FORMAT_TDM_LJ   AVR32_IISC_MR_FORMAT_TDM_LJ
 

#define IISC_DATALENGTH (   x)
Value:
(AVR32_IISC_MR_DATALENGTH##x \
<< AVR32_IISC_MR_DATALENGTH_OFFSET)

!

IISC data length configuration macro

#define IISC_DATALENGTH_16   (IISC_DATALENGTH(_16) )

Set datalength to 16 bits compact stereo (left sample in bits 15 through 0 and right samples in bits 31 through 16 of the same word)

#define IISC_DATALENGTH_16C   (IISC_DATALENGTH(_16C))

Set datalength to 8 bits.

#define IISC_DATALENGTH_18   (IISC_DATALENGTH(_18) )

Set datalength to 16 bits.

#define IISC_DATALENGTH_20   (IISC_DATALENGTH(_20) )

Set datalength to 18 bits.

#define IISC_DATALENGTH_24   (IISC_DATALENGTH(_24) )

Set datalength to 20 bits.

#define IISC_DATALENGTH_32   (IISC_DATALENGTH(_32) )

Set datalength to 24 bits.

Set datalength to 32 bits

#define IISC_DATALENGTH_8   (IISC_DATALENGTH(_8 ) )

Set datalength to 8 bits compact stereo (left sample in bits 7 through 0 and right samples in bits 15 through 8 of the same word)

#define IISC_DATALENGTH_8C   (IISC_DATALENGTH(_8C) )
#define IISC_FORMAT_LJ   AVR32_IISC_MR_FORMAT_LJ
#define IISC_FORMAT_TDM_LJ   AVR32_IISC_MR_FORMAT_TDM_LJ
#define IISC_OVERSAMPLING (   x)
Value:
(AVR32_IISC_MR_IMCKFS##x \
<< AVR32_IISC_MR_IMCKFS_OFFSET)
#define IISC_OVERSAMPLING_x1024   (IISC_OVERSAMPLING(_1024))

x1024

#define IISC_OVERSAMPLING_x128   (IISC_OVERSAMPLING(_128) )

x128

#define IISC_OVERSAMPLING_x16   (IISC_OVERSAMPLING(_16) )

x16

#define IISC_OVERSAMPLING_x256   (IISC_OVERSAMPLING(_256) )

x256

#define IISC_OVERSAMPLING_x32   (IISC_OVERSAMPLING(_32) )

x32

#define IISC_OVERSAMPLING_x384   (IISC_OVERSAMPLING(_384) )

x384

#define IISC_OVERSAMPLING_x512   (IISC_OVERSAMPLING(_512) )

x512

#define IISC_OVERSAMPLING_x64   (IISC_OVERSAMPLING(_64) )

x64

#define IISC_OVERSAMPLING_x768   (IISC_OVERSAMPLING(_768) )

x768

#define IISC_RETRY_VALUE   10000

Referenced by iisc_read(), and iisc_write().

#define IISC_RXDMA_MULTIPLE
Value:
(AVR32_IISC_MR_RXDMA_MULTIPLE << \
AVR32_IISC_MR_RXDMA_OFFSET)
#define IISC_RXDMA_SINGLE
Value:
(AVR32_IISC_MR_RXDMA_SINGLE << \
AVR32_IISC_MR_RXDMA_OFFSET)
#define IISC_TXDMA_MULTIPLE
Value:
(AVR32_IISC_MR_TXDMA_MULTIPLE << \
AVR32_IISC_MR_TXDMA_OFFSET)
#define IISC_TXDMA_SINGLE
Value:
(AVR32_IISC_MR_TXDMA_SINGLE << \
AVR32_IISC_MR_TXDMA_OFFSET)

enum iisc_mode

IISC modes.

Enumerator
IISC_MODE_MASTER 
IISC_MODE_SLAVE 
IISC_MODE_TDM_MASTER 
IISC_MODE_TDM_SLAVE 

void iisc_disable ( volatile avr32_iisc_t *  iisc)

IISC Disable function.

Parameters
iiscPointer to the correct volatile avr32_iisc_t struct

References iisc_disable_clocks(), iisc_disable_reception(), iisc_disable_transmission(), rx_is_enabled, and tx_is_enabled.

static void iisc_disable_clocks ( volatile avr32_iisc_t *  iisc)
inlinestatic

Disable the clocks for the IISC module.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_disable().

void iisc_disable_interrupts ( volatile avr32_iisc_t *  iisc,
unsigned long  int_mask 
)

Disables the specified IISC interrupts.

Parameters
iiscBase address of the IISC instance.
int_maskBit-mask of IISC interrupts (AVR32_IDR_x_MASK).

References cpu_irq_restore(), and cpu_irq_save().

static void iisc_disable_reception ( volatile avr32_iisc_t *  iisc)
inlinestatic

Disable the IISC module in reception.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_disable().

static void iisc_disable_transmission ( volatile avr32_iisc_t *  iisc)
inlinestatic

Disable the IISC module in transmission.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_disable().

void iisc_enable ( volatile avr32_iisc_t *  iisc)

IISC Enable function.

Parameters
iiscPointer to the correct volatile avr32_iisc_t struct

References iisc_enable_clocks(), iisc_enable_reception(), iisc_enable_transmission(), rx_is_enabled, and tx_is_enabled.

static void iisc_enable_clocks ( volatile avr32_iisc_t *  iisc)
inlinestatic

Enable the clocks for the IISC module.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_enable().

void iisc_enable_interrupts ( volatile avr32_iisc_t *  iisc,
unsigned long  int_mask 
)

Enables the specified IISC interrupts.

Parameters
iiscBase address of the IISC instance.
int_maskBit-mask of IISC interrupts (AVR32_IER_x_MASK).
static void iisc_enable_reception ( volatile avr32_iisc_t *  iisc)
inlinestatic

Enable the IISC module in reception.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_enable().

static void iisc_enable_transmission ( volatile avr32_iisc_t *  iisc)
inlinestatic

Enable the IISC module in transmission.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_enable().

unsigned long iisc_get_status ( volatile avr32_iisc_t *  iisc)

Returns the IISC status.

Parameters
iiscBase address of the IISC instance.
Returns
The IISC Status Register.
status_code_t iisc_init ( volatile avr32_iisc_t *  iisc,
iisc_opt_t  iisc_opt 
)

Sets up registers and initializes IISC for use as I2S.

Parameters
iiscPointer to the correct volatile avr32_iisc_t struct
iisc_optOption structure for IISC Configuration.
Returns
Status
Return values
IISC_OKwhen no error occurred.
IISC_ERROR_ARGUMENTwhen invalid arguments are passed

References ERR_INVALID_ARG, if(), IISC_MODE_MASTER, IISC_MODE_SLAVE, IISC_MODE_TDM_MASTER, iisc_reset(), iisc_opt_t::mode, iisc_opt_t::num_rx_channels, iisc_opt_t::num_tx_channels, iisc_opt_t::option, rx_is_enabled, STATUS_OK, and tx_is_enabled.

status_code_t iisc_read ( volatile avr32_iisc_t *  iisc,
uint32_t *  data 
)

Read a single message of data.

Parameters
iiscPointer to the correct volatile avr32_iisc_t struct
*dataThe data to read
Returns
Status
Return values
IISC_OKwhen no error occurred.
IISC_TIMEOUTwhen a timeout occurred while trying to transfer

References ERR_TIMEOUT, IISC_RETRY_VALUE, and STATUS_OK.

static void iisc_reset ( volatile avr32_iisc_t *  iisc)
inlinestatic

Resets the IISC module.

Parameters
iiscpointer to the correct volatile avr32_iisc_t struct

Referenced by iisc_init().

status_code_t iisc_write ( volatile avr32_iisc_t *  iisc,
uint32_t  data 
)

Write a single message of data.

Parameters
iiscPointer to the correct volatile avr32_iisc_t struct
dataThe data to write
Returns
Status
Return values
IISC_OKwhen no error occurred.
IISC_TIMEOUTwhen a timeout occurred while trying to transfer

References data, ERR_TIMEOUT, IISC_RETRY_VALUE, and STATUS_OK.