Microchip® Advanced Software Framework

adpcm_encoder/adpcm_example.c File Reference
#include <avr32/io.h>
#include "compiler.h"
#include "board.h"
#include "dsp.h"
#include "pm.h"
#include "gpio.h"
#include "usart.h"
#include "intc.h"
#include "pwm.h"
#include "flashc.h"
#include "preprocessor.h"
#include "adc.h"
#include "tc.h"
#include "pdca.h"

Macros

#define ADC_CHANNEL   1
 ADC channel. More...
 
#define AVR32_PDCA_PID_USART_TX   AVR32_PDCA_PID_USART1_TX
 
#define BUFFER_SIZE   (252*4)
 The size of the buffer. More...
 
#define CP_PBA_SPEED   12000000
 The clock frequency. More...
 
#define EXAMPLE_USART   (&AVR32_USART1)
 
#define EXAMPLE_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
 
#define EXAMPLE_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN
 
#define EXAMPLE_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
 
#define EXAMPLE_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN
 
#define NB_BUFFERS   2
 Number of buffers. More...
 
#define PDCA_ADC_CHANNEL   0
 PDCA channel for the ADC. More...
 
#define PDCA_USART_CHANNEL   1
 PDCA channel for the USART. More...
 
#define STATE_GET_SAMPLES   2
 
#define STATE_SEND_USART   1
 
#define TC_CHANNEL   0
 Timer Counter channel. More...
 

Enumerations

enum  {
  BUFFER_STATE_FREE = 0,
  BUFFER_STATE_BUSY = 1,
  BUFFER_STATE_FILLED = 2
}
 

Functions

void init_adc ()
 
void init_pdca_adc ()
 
void init_pdca_usart ()
 
void init_tc (int rate)
 
void init_usart ()
 this function initializes the USART module at 115200 bauds More...
 
int main (int argc, char *argv[])
 The main function. More...
 
static void pdca_adc_interrupt_handler (void)
 
static void pdca_usart_interrupt_handler (void)
 
void sys_cpu_48MHz (void)
 To set the clock frequency to 48MHz. More...
 

Variables

A_ALIGNED char buffer [NB_BUFFERS][BUFFER_SIZE]
 The main buffer. More...
 
enum { ... }  buffer_state [NB_BUFFERS]
 
int i_r
 
int i_w
 
char * pbuffer_r
 
char * pbuffer_w
 
 return
 Low-level initialization routine called during startup, before the main function. More...
 
volatile int state
 state machine variable More...
 
A_ALIGNED char tbuffer [BUFFER_SIZE/4+4]
 Transfer buffer. More...
 

#define ADC_CHANNEL   1

ADC channel.

Referenced by init_adc().

#define AVR32_PDCA_PID_USART_TX   AVR32_PDCA_PID_USART1_TX

Referenced by init_pdca_usart(), and main().

#define BUFFER_SIZE   (252*4)

The size of the buffer.

Referenced by main().

#define CP_PBA_SPEED   12000000

The clock frequency.

Referenced by init_tc(), and init_usart().

#define EXAMPLE_USART   (&AVR32_USART1)

Referenced by init_usart().

#define EXAMPLE_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION

Referenced by init_usart().

#define EXAMPLE_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN

Referenced by init_usart().

#define EXAMPLE_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION

Referenced by init_usart().

#define EXAMPLE_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN

Referenced by init_usart().

#define NB_BUFFERS   2

Number of buffers.

Referenced by main(), pdca_adc_interrupt_handler(), and pdca_usart_interrupt_handler().

#define PDCA_ADC_CHANNEL   0

PDCA channel for the ADC.

Referenced by init_pdca_adc(), main(), and pdca_adc_interrupt_handler().

#define PDCA_USART_CHANNEL   1

PDCA channel for the USART.

Referenced by init_pdca_usart(), main(), and pdca_usart_interrupt_handler().

#define STATE_GET_SAMPLES   2

Referenced by main(), and pdca_adc_interrupt_handler().

#define STATE_SEND_USART   1

Referenced by main(), and pdca_adc_interrupt_handler().

#define TC_CHANNEL   0

Timer Counter channel.

Referenced by init_adc(), init_tc(), init_timer_isr(), and ISR().

anonymous enum
Enumerator
BUFFER_STATE_FREE 
BUFFER_STATE_BUSY 
BUFFER_STATE_FILLED 

void init_adc ( )
static void pdca_usart_interrupt_handler ( void  )
static
void sys_cpu_48MHz ( void  )

enum { ... } buffer_state[NB_BUFFERS]
int i_r
int i_w

Referenced by main(), and pdca_adc_interrupt_handler().

char* pbuffer_r
char* pbuffer_w
return
Initial value:
{
#define Enable_global_exception()
Enables exceptions globally.
Definition: compiler.h:1012

Low-level initialization routine called during startup, before the main function.

A_ALIGNED char tbuffer[BUFFER_SIZE/4+4]

Transfer buffer.

Referenced by main().