Microchip® Advanced Software Framework

ram_aes_ram_example.c File Reference
#include <string.h>
#include "board.h"
#include "print_funcs.h"
#include "gpio.h"
#include "pm.h"
#include "intc.h"
#include "usart.h"
#include "aes.h"

Macros

#define DMACA_AES_EVAL_BUF_SIZE   256
 
#define DMACA_AES_EVAL_REFBUF_SIZE   16
 
Board-Related Example Settings
#define DMACA_AES_EVAL_USART   (&AVR32_USART1)
 
#define DMACA_AES_EVAL_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN
 
#define DMACA_AES_EVAL_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
 
#define DMACA_AES_EVAL_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN
 
#define DMACA_AES_EVAL_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
 
#define DMACA_AES_EVAL_USART_BAUDRATE   57600
 
#define DMACA_AES_EVAL_LED1   LED0_GPIO
 
#define DMACA_AES_EVAL_LED2   LED1_GPIO
 
#define DMACA_AES_EVAL_LED3   LED2_GPIO
 

Functions

static void init_hmatrix (void)
 Initializes the HSB bus matrix. More...
 
int main (void)
 The main function. More...
 
void test_ram_aes_ram (unsigned short int u16BufferSize, unsigned int *pSrcBuf, unsigned int *pDstBuf)
 1) Configure two DMACA channels: More...
 

Variables

volatile unsigned int ccountt0
 
volatile unsigned int ccountt1
 
const unsigned int CipherKey [8]
 
const unsigned int InitVector [4]
 
unsigned int InputData [DMACA_AES_EVAL_BUF_SIZE]
 
volatile unsigned int OutputData [DMACA_AES_EVAL_BUF_SIZE]
 
volatile unsigned int * pDstData_HsbSram
 
pm_freq_param_t pm_freq_param
 
unsigned int * pSrcData_HsbSram
 
const unsigned int RefInputData [DMACA_AES_EVAL_REFBUF_SIZE]
 
const unsigned int RefOutputData [DMACA_AES_EVAL_REFBUF_SIZE]
 

#define DMACA_AES_EVAL_BUF_SIZE   256

Referenced by main().

#define DMACA_AES_EVAL_LED1   LED0_GPIO

Referenced by main().

#define DMACA_AES_EVAL_LED2   LED1_GPIO

Referenced by main().

#define DMACA_AES_EVAL_LED3   LED2_GPIO

Referenced by main().

#define DMACA_AES_EVAL_REFBUF_SIZE   16

Referenced by main(), and test_ram_aes_ram().

#define DMACA_AES_EVAL_USART   (&AVR32_USART1)

Referenced by main(), and test_ram_aes_ram().

#define DMACA_AES_EVAL_USART_BAUDRATE   57600

Referenced by main().

#define DMACA_AES_EVAL_USART_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION

Referenced by main().

#define DMACA_AES_EVAL_USART_RX_PIN   AVR32_USART1_RXD_0_0_PIN

Referenced by main().

#define DMACA_AES_EVAL_USART_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION

Referenced by main().

#define DMACA_AES_EVAL_USART_TX_PIN   AVR32_USART1_TXD_0_0_PIN

Referenced by main().

static void init_hmatrix ( void  )
static

Initializes the HSB bus matrix.

Referenced by main().

void test_ram_aes_ram ( unsigned short int  u16BufferSize,
unsigned int *  pSrcBuf,
unsigned int *  pDstBuf 
)

1) Configure two DMACA channels:

  • RAM -> AES
  • AES -> RAM 2) Set the AES cryptographic key and init vector. 3) Start the process 4) Check the result on the first 16 Words.

References aes_set_initvector(), aes_set_key(), ccountt0, ccountt1, CipherKey, DMACA_AES_EVAL_REFBUF_SIZE, DMACA_AES_EVAL_USART, Get_system_register, InitVector, OutputData, print(), print_ulong(), and RefOutputData.

Referenced by main().

volatile unsigned int ccountt0

Referenced by test_ram_aes_ram().

volatile unsigned int ccountt1

Referenced by test_ram_aes_ram().

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

Referenced by test_ram_aes_ram().

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

Referenced by test_ram_aes_ram().

unsigned int InputData[DMACA_AES_EVAL_BUF_SIZE]

Referenced by main().

volatile unsigned int OutputData[DMACA_AES_EVAL_BUF_SIZE]

Referenced by main(), and test_ram_aes_ram().

volatile unsigned int* pDstData_HsbSram

Referenced by main().

pm_freq_param_t pm_freq_param
Initial value:
=
{
.cpu_f = 12000000,
.pba_f = 12000000,
.osc0_f = FOSC0,
.osc0_startup = OSC0_STARTUP
}
#define OSC0_STARTUP
Osc0 startup time: RCOsc periods.
Definition: evk1104.h:62
#define FOSC0
Osc0 frequency: Hz.
Definition: evk1104.h:61
unsigned int* pSrcData_HsbSram

Referenced by main().

const unsigned int RefInputData[DMACA_AES_EVAL_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 RefOutputData[DMACA_AES_EVAL_REFBUF_SIZE]
Initial value:
= {
0xf58c4c04,
0xd6e5f1ba,
0x779eabfb,
0x5f7bfbd6,
0x9cfc4e96,
0x7edb808d,
0x679f777b,
0xc6702c7d,
0x39f23369,
0xa9d9bacf,
0xa530e263,
0x04231461,
0xb2eb05e2,
0xc39be9fc,
0xda6c1907,
0x8c6a9d1b }

Referenced by test_ram_aes_ram().