| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
AudioOutput.c File Reference
`#include "AudioOutput.h"`

Go to the source code of this file.

## Data Structures
struct | I2S_RATE_CONFIG

## Macros
#define | AUDIO_MAX_SAMPLE_FREQ 48000
#define | AUDIO_SPEEP_UP_TRIGGER (audio_buffer_size*5/8)
#define | AUDIO_NORMAL_SPEED_TRIGGER (audio_buffer_size*3/8)
#define | AUDIO_MAX_PC 10

## Functions
PRAGMA_ALIGN_4 uint8_t audio_buffer[2048 *2] | ATTR_ALIGNED (4)
Status | I2S_RateFind (LPC_I2S_T *I2Sx, Chip_I2S_Audio_Format_T *audio_format, I2S_RATE_CONFIG *I2S_Config)
void | Audio_Reset_Data_Buffer (void)
uint32_t | Audio_Get_ISO_Buffer_Address (uint32_t last_packet_size)
void | Audio_Init (uint32_t samplefreq)
void | Audio_DeInit (void)
void | I2S0_IRQHandler (void)
uint32_t | CALLBACK_HAL_GetISOBufferAddress (const uint32_t EPNum, uint32_t *last_packet_size)
int | main (void)
| Main program body.
void | SetupHardware (void)
| Hardware setup event callback function.
void | EVENT_USB_Device_Connect (void)
| USB Device connect event callback.
void | EVENT_USB_Device_Disconnect (void)
| USB Device disconnect event callback.
void | EVENT_USB_Device_ConfigurationChanged (void)
| USB Device configuration change event callback.
void | EVENT_USB_Device_ControlRequest (void)
| USB Device control request receive event callback.
void | EVENT_Audio_Device_StreamStartStop (USB_ClassInfo_Audio_Device_t *const AudioInterfaceInfo)
| Audio class driver event for an Audio Stream start/stop change. This event fires each time the device receives a stream enable or disable control request from the host, to start and stop the audio stream. The current state of the stream can be determined by the State.InterfaceEnabled value inside the Audio interface structure passed as a parameter.
bool | CALLBACK_Audio_Device_GetSetEndpointProperty (USB_ClassInfo_Audio_Device_t *const AudioInterfaceInfo, const uint8_t EndpointProperty, const uint8_t EndpointAddress, const uint8_t EndpointControl, uint16_t *const DataLength, uint8_t *Data)

## Variables
USB_ClassInfo_Audio_Device_t | Speaker_Audio_Interface
uint32_t | CurrentAudioSampleFrequency = AUDIO_MAX_SAMPLE_FREQ
uint32_t | audio_buffer_size = 0
uint32_t | audio_buffer_rd_index = 0
uint32_t | audio_buffer_wr_index = 0
uint32_t | audio_buffer_count = 0
static uint32_t | I2S_SpeedConfig_index

## Macro Definition Documentation

#define AUDIO_MAX_PC 10

Audio APIAudio max packet count.

Definition at line 64 of file AudioOutput.c.

#define AUDIO_MAX_SAMPLE_FREQ 48000

Max Sample Frequency.

Definition at line 52 of file AudioOutput.c.

#define AUDIO_NORMAL_SPEED_TRIGGER (audio_buffer_size*3/8)

if audio buffer count is under this value, i2s will run in normal speed

Definition at line 56 of file AudioOutput.c.

#define AUDIO_SPEEP_UP_TRIGGER (audio_buffer_size*5/8)

if audio buffer count is over this value, i2s will run in higher speed

Definition at line 54 of file AudioOutput.c.

## Function Documentation

PRAGMA_ALIGN_4 uint8_t audio_buffer [2048*2] ATTR_ALIGNED | ( | 4 |  | ) |

Definition at line 42 of file USBTask.c.

void Audio_DeInit | ( | void |  | ) |

Definition at line 276 of file AudioOutput.c.

uint32_t Audio_Get_ISO_Buffer_Address | ( | uint32_t | last_packet_size | ) |

Definition at line 207 of file AudioOutput.c.

void Audio_Init | ( | uint32_t | samplefreq | ) |

Definition at line 221 of file AudioOutput.c.

void Audio_Reset_Data_Buffer | ( | void |  | ) |

Definition at line 200 of file AudioOutput.c.

uint32_t CALLBACK_HAL_GetISOBufferAddress | ( | const uint32_t | EPNum,
|  | uint32_t * | last_packet_size
| ) |  |

This callback function provides iso buffer address for HAL iso transfer processing.

Definition at line 325 of file AudioOutput.c.

void I2S0_IRQHandler | ( | void |  | ) |

Definition at line 283 of file AudioOutput.c.

Status I2S_RateFind | ( | LPC_I2S_T * | I2Sx,
|  | Chip_I2S_Audio_Format_T * | audio_format,
|  | I2S_RATE_CONFIG * | I2S_Config
| ) |  |

Definition at line 128 of file AudioOutput.c.

## Variable Documentation

uint32_t audio_buffer_count = 0

Definition at line 70 of file AudioOutput.c.

uint32_t audio_buffer_rd_index = 0

Definition at line 68 of file AudioOutput.c.

uint32_t audio_buffer_size = 0

Definition at line 67 of file AudioOutput.c.

uint32_t audio_buffer_wr_index = 0

Definition at line 69 of file AudioOutput.c.

uint32_t CurrentAudioSampleFrequency = AUDIO_MAX_SAMPLE_FREQ

Current audio sampling frequency of the streaming audio endpoint.

Definition at line 58 of file AudioOutput.c.

uint32_t I2S_SpeedConfig_index
| static

Definition at line 82 of file AudioOutput.c.

USB_ClassInfo_Audio_Device_t Speaker_Audio_Interface

Initial value:
= {
.Config = {
.StreamingInterfaceNumber = 1,
.DataOUTEndpointNumber = AUDIO_STREAM_EPNUM,
.DataOUTEndpointSize = AUDIO_STREAM_EPSIZE,
.PortNumber = 0,
},
}

LPCUSBlib Audio Class driver interface configuration and state information. This structure is passed to all Audio Class driver functions, so that multiple instances of the same class within a device can be differentiated from one another.

Definition at line 41 of file AudioOutput.c.