Atmel Software Framework

ssc_i2s.c File Reference
#include "compiler.h"
#include "ssc_i2s.h"

Functions

static int set_clock_divider (volatile avr32_ssc_t *ssc, unsigned int bit_rate, unsigned int pba_hz)
 Sets the clock divider (DIV-field in CMR-register) More...
 
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...
 

static int set_clock_divider ( volatile avr32_ssc_t *  ssc,
unsigned int  bit_rate,
unsigned int  pba_hz 
)
static

Sets the clock divider (DIV-field in CMR-register)

This function sets the DIV field in the CMR-register to correct divider so that the divided clock runs at the specified rate.

Note
Clock divider is always rounded down, this means that the desired clock will be correct or faster than desired clock rate.
Parameters
sscpointer to the correct volatile avr32_ssc_t struct
bit_ratedesired clock rate (bit rate)
pba_hzPBA bus speed in Hz
Returns
Status or error code
Return values
SSC_I2S_OKon success
SSC_I2S_ERROR_ARGUMENTon invalid arguments
Todo:
check input values

References SSC_I2S_OK.

Referenced by ssc_i2s_init().