Microchip® Advanced Software Framework

aes_example.c File Reference
#include "board.h"
#include "print_funcs.h"
#include "gpio.h"
#include "pm.h"
#include "intc.h"
#include "usart.h"
#include "aes.h"

Macros

#define AES_EXAMPLE_REFBUF_SIZE   16
 
Board-Related Example Settings
#define AES_EXAMPLE_USART   (&AVR32_USART1)
 
#define AES_EXAMPLE_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN
 
#define AES_EXAMPLE_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
 
#define AES_EXAMPLE_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN
 
#define AES_EXAMPLE_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
 
#define AES_EXAMPLE_USART_BAUDRATE   57600
 
#define AES_EXAMPLE_LED1   LED0_GPIO
 
#define AES_EXAMPLE_LED2   LED1_GPIO
 
#define AES_EXAMPLE_LED3   LED2_GPIO
 
#define AES_EXAMPLE_LED4   LED3_GPIO
 
Example internal states
#define AES_EXAMPLE_STATE_1   0
 
#define AES_EXAMPLE_STATE_2   1
 
#define AES_EXAMPLE_STATE_3   2
 
#define AES_EXAMPLE_STATE_4   3
 
#define AES_EXAMPLE_STATE_5   4
 
#define AES_EXAMPLE_STATE_6   5
 
#define AES_EXAMPLE_STATE_7   6
 
#define AES_EXAMPLE_STATE_8   7
 

Functions

static void aes_int_handler (void)
 The AES interrupt handler. More...
 
static void init_hmatrix (void)
 Initializes the HSB bus matrix. More...
 
int main (void)
 The main function. More...
 

Variables

const unsigned int CBCRefInputData [AES_EXAMPLE_REFBUF_SIZE]
 
const unsigned int CBCRefOutputData [AES_EXAMPLE_REFBUF_SIZE]
 
volatile unsigned int ccountt0
 
volatile unsigned int ccountt1
 
const unsigned int CipherKey256 [8]
 
volatile unsigned char ContinueCBCProcess = true
 
const unsigned int InitVectorCBC [4]
 
volatile unsigned int OutputData [AES_EXAMPLE_REFBUF_SIZE]
 
pm_freq_param_t pm_freq_param
 
volatile unsigned char state = 0
 
volatile unsigned long Tempo
 
volatile unsigned char urad_evt = false
 
static const gpio_map_t USART_GPIO_MAP
 
static const usart_options_t USART_OPTIONS
 

#define AES_EXAMPLE_LED1   LED0_GPIO

Referenced by aes_int_handler().

#define AES_EXAMPLE_LED2   LED1_GPIO

Referenced by aes_int_handler().

#define AES_EXAMPLE_LED3   LED2_GPIO

Referenced by aes_int_handler().

#define AES_EXAMPLE_LED4   LED3_GPIO

Referenced by aes_int_handler().

#define AES_EXAMPLE_REFBUF_SIZE   16

Referenced by main().

#define AES_EXAMPLE_STATE_1   0

Referenced by aes_int_handler(), and main().

#define AES_EXAMPLE_STATE_2   1

Referenced by aes_int_handler(), and main().

#define AES_EXAMPLE_STATE_3   2

Referenced by aes_int_handler().

#define AES_EXAMPLE_STATE_4   3

Referenced by aes_int_handler(), and main().

#define AES_EXAMPLE_STATE_5   4

Referenced by aes_int_handler().

#define AES_EXAMPLE_STATE_6   5
#define AES_EXAMPLE_STATE_7   6
#define AES_EXAMPLE_STATE_8   7

Referenced by aes_int_handler(), and main().

#define AES_EXAMPLE_USART   (&AVR32_USART1)

Referenced by main().

#define AES_EXAMPLE_USART_BAUDRATE   57600
#define AES_EXAMPLE_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
#define AES_EXAMPLE_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN
#define AES_EXAMPLE_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
#define AES_EXAMPLE_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN

static void aes_int_handler ( void  )
static

The AES interrupt handler.

Note
The `__attribute__((interrupt))' (under GNU GCC for AVR32) and `__interrupt' (under IAR Embedded Workbench for Atmel AVR32) C function attributes are used to manage the `rete' instruction.

References AES_EXAMPLE_LED1, AES_EXAMPLE_LED2, AES_EXAMPLE_LED3, AES_EXAMPLE_LED4, AES_EXAMPLE_STATE_1, AES_EXAMPLE_STATE_2, AES_EXAMPLE_STATE_3, AES_EXAMPLE_STATE_4, AES_EXAMPLE_STATE_5, AES_EXAMPLE_STATE_8, aes_get_status(), aes_read_outputdata(), aes_swreset(), AES_URAT_READ_WRITEONLY, ccountt1, ContinueCBCProcess, Get_system_register, gpio_clr_gpio_pin(), OutputData, state, Tempo, and urad_evt.

Referenced by main().

static void init_hmatrix ( void  )
static

Initializes the HSB bus matrix.

const unsigned int CBCRefInputData[AES_EXAMPLE_REFBUF_SIZE]
Initial value:
= {
0x6bc1bee2,
0x2e409f96,
0xe93d7e11,
0x7393172a,
0xae2d8a57,
0x1e03ac9c,
0x9eb76fac,
0x45af8e51,
0x30c81c46,
0xa35ce411,
0xe5fbc119,
0x1a0a52ef,
0xf69f2445,
0xdf4f9b17,
0xad2b417b,
0xe66c3710 }

Referenced by main().

const unsigned int CBCRefOutputData[AES_EXAMPLE_REFBUF_SIZE]
Initial value:
= {
0xf58c4c04,
0xd6e5f1ba,
0x779eabfb,
0x5f7bfbd6,
0x9cfc4e96,
0x7edb808d,
0x679f777b,
0xc6702c7d,
0x39f23369,
0xa9d9bacf,
0xa530e263,
0x04231461,
0xb2eb05e2,
0xc39be9fc,
0xda6c1907,
0x8c6a9d1b }

Referenced by main().

volatile unsigned int ccountt0

Referenced by main(), and test_ram_aes_ram().

volatile unsigned int ccountt1
const unsigned int CipherKey256[8]
Initial value:
= {
0x603deb10,
0x15ca71be,
0x2b73aef0,
0x857d7781,
0x1f352c07,
0x3b6108d7,
0x2d9810a3,
0x0914dff4
}

Referenced by main().

volatile unsigned char ContinueCBCProcess = true

Referenced by aes_int_handler(), and main().

const unsigned int InitVectorCBC[4]
Initial value:
= {
0x00010203,
0x04050607,
0x08090a0b,
0x0c0d0e0f
}

Referenced by main().

volatile unsigned int OutputData[AES_EXAMPLE_REFBUF_SIZE]
pm_freq_param_t pm_freq_param
Initial value:
=
{
.cpu_f = AES_EXAMPLE_CPU_FREQ,
.pba_f = AES_EXAMPLE_CPU_FREQ,
.osc0_f = FOSC0,
.osc0_startup = OSC0_STARTUP
}
#define FOSC0
Definition: bsp-evk1104.c:26

Referenced by main(), and mmi_task().

volatile unsigned char state = 0
volatile unsigned long Tempo

Referenced by aes_int_handler(), and main().

volatile unsigned char urad_evt = false

Referenced by aes_int_handler(), and main().

const gpio_map_t USART_GPIO_MAP
static
Initial value:
=
{
}
#define AES_EXAMPLE_USART_TX_FUNCTION
Definition: aes_example.c:97
#define AES_EXAMPLE_USART_RX_FUNCTION
Definition: aes_example.c:95
#define AES_EXAMPLE_USART_RX_PIN
Definition: aes_example.c:94
#define AES_EXAMPLE_USART_TX_PIN
Definition: aes_example.c:96
const usart_options_t USART_OPTIONS
static
Initial value:
=
{
.charlength = 8,
.paritytype = USART_NO_PARITY,
.stopbits = USART_1_STOPBIT,
.channelmode = USART_NORMAL_CHMODE
}
#define USART_NO_PARITY
Don't use a parity bit.
Definition: usart.h:81
#define USART_NORMAL_CHMODE
Normal communication.
Definition: usart.h:96
#define USART_1_STOPBIT
Use 1 stop bit.
Definition: usart.h:88
#define AES_EXAMPLE_USART_BAUDRATE
Definition: aes_example.c:98