Driver for the I2S protocol using the SSC (Synchronous Serial Controller).
The Atmel SSC provides a synchronous communication link with external devices. It supports several serial synchronous communication protocols generally used in audio and telecom applications such as I2S, Short Frame Sync, Long Frame Sync, etc.
Macros | |
#define | SSC_I2S_TIMEOUT_VALUE 10000 |
Enumerations | |
enum | { SSC_I2S_ERROR = -1, SSC_I2S_OK = 0, SSC_I2S_TIMEOUT = 1, SSC_I2S_ERROR_ARGUMENT, SSC_I2S_ERROR_RX, SSC_I2S_ERROR_TX } |
Error codes used by SSC I2S driver. More... | |
enum | { SSC_I2S_MODE_STEREO_OUT = 1, SSC_I2S_MODE_STEREO_OUT_EXT_CLK, SSC_I2S_MODE_SLAVE_STEREO_OUT, SSC_I2S_MODE_SLAVE_STEREO_IN, SSC_I2S_MODE_STEREO_OUT_MONO_IN, SSC_I2S_MODE_RIGHT_IN, SSC_I2S_MODE_STEREO_IN, SSC_I2S_MODE_STEREO_OUT_STEREO_IN } |
SSC I2S modes. More... | |
Functions | |
void | ssc_i2s_disable_interrupts (volatile avr32_ssc_t *ssc, unsigned long int_mask) |
Disables the specified SSC interrupts. More... | |
void | ssc_i2s_enable_interrupts (volatile avr32_ssc_t *ssc, unsigned long int_mask) |
Enables the specified SSC interrupts. More... | |
unsigned long | ssc_i2s_get_status (volatile avr32_ssc_t *ssc) |
Returns the SSC status. More... | |
int | ssc_i2s_init (volatile avr32_ssc_t *ssc, unsigned int sample_frequency, unsigned int data_bit_res, unsigned int frame_bit_res, unsigned char mode, unsigned int pba_hz) |
Sets up registers and initializes SSC for use as I2S. More... | |
void | ssc_i2s_reset (volatile avr32_ssc_t *ssc) |
Resets the SSC module. More... | |
int | ssc_i2s_transfer (volatile avr32_ssc_t *ssc, unsigned int data) |
Transfers a single message of data. More... | |
#define SSC_I2S_TIMEOUT_VALUE 10000 |
Referenced by ssc_i2s_transfer().
anonymous enum |
anonymous enum |
SSC I2S modes.
void ssc_i2s_disable_interrupts | ( | volatile avr32_ssc_t * | ssc, |
unsigned long | int_mask | ||
) |
Disables the specified SSC interrupts.
ssc | Base address of the SSC instance. |
int_mask | Bit-mask of SSC interrupts (AVR32_SSC_IDR_x_MASK ). |
References cpu_irq_disable, cpu_irq_enable, and cpu_irq_is_enabled.
void ssc_i2s_enable_interrupts | ( | volatile avr32_ssc_t * | ssc, |
unsigned long | int_mask | ||
) |
Enables the specified SSC interrupts.
ssc | Base address of the SSC instance. |
int_mask | Bit-mask of SSC interrupts (AVR32_SSC_IER_x_MASK ). |
unsigned long ssc_i2s_get_status | ( | volatile avr32_ssc_t * | ssc | ) |
Returns the SSC status.
ssc | Base address of the SSC instance. |
int ssc_i2s_init | ( | volatile avr32_ssc_t * | ssc, |
unsigned int | sample_frequency, | ||
unsigned int | data_bit_res, | ||
unsigned int | frame_bit_res, | ||
unsigned char | mode, | ||
unsigned int | pba_hz | ||
) |
Sets up registers and initializes SSC for use as I2S.
ssc | Pointer to the correct volatile avr32_ssc_t struct |
sample_frequency | The sample frequency given in Hz |
data_bit_res | Number of significant data bits in an I2S channel frame |
frame_bit_res | Total number of bits in an I2S channel frame |
mode | I2S-mode
|
pba_hz | The clock speed of the PBA bus in Hz. |
SSC_I2S_OK | when no error occurred. |
SSC_I2S_ERROR_ARGUMENT | when invalid arguments are passed |
References set_clock_divider(), SSC_I2S_MODE_RIGHT_IN, SSC_I2S_MODE_SLAVE_STEREO_IN, SSC_I2S_MODE_SLAVE_STEREO_OUT, SSC_I2S_MODE_STEREO_OUT, SSC_I2S_MODE_STEREO_OUT_EXT_CLK, SSC_I2S_MODE_STEREO_OUT_MONO_IN, SSC_I2S_OK, and ssc_i2s_reset().
Referenced by aic23b_dac_setup().
void ssc_i2s_reset | ( | volatile avr32_ssc_t * | ssc | ) |
Resets the SSC module.
ssc | pointer to the correct volatile avr32_ssc_t struct |
Referenced by aic23b_dac_stop(), and ssc_i2s_init().
int ssc_i2s_transfer | ( | volatile avr32_ssc_t * | ssc, |
unsigned int | data | ||
) |
Transfers a single message of data.
ssc | Pointer to the correct volatile avr32_ssc_t struct |
data | The data to transfer |
SSC_I2S_OK | when no error occurred. |
SSC_I2S_TIMEOUT | when a timeout occurred while trying to transfer |
References data, SSC_I2S_OK, SSC_I2S_TIMEOUT, and SSC_I2S_TIMEOUT_VALUE.