#include <avr32/io.h>
#include "compiler.h"
#include "board.h"
#include "power_clocks_lib.h"
#include "gpio.h"
#include "spi.h"
#include "conf_sd_mmc_spi.h"
#include "sd_mmc_spi.h"
#include "usart.h"
#include "print_funcs.h"
#include "pdca.h"
#include "intc.h"
#include "dummy.h"
Macros | |
#define | AVR32_PDCA_CHANNEL_SPI_RX 0 |
#define | AVR32_PDCA_CHANNEL_SPI_TX 1 |
#define | AVR32_PDCA_CHANNEL_USED_RX AVR32_PDCA_PID_SPI1_RX |
#define | AVR32_PDCA_CHANNEL_USED_TX AVR32_PDCA_PID_SPI1_TX |
#define | BUFFERSIZE 64 |
Number of bytes in the receive buffer when operating in slave mode. More... | |
#define | PBA_HZ FOSC0 |
PBA clock frequency (Hz) More... | |
Functions | |
void | local_pdca_init (void) |
Initialize PDCA (Peripheral DMA Controller A) resources for the SPI transfer and start a dummy transfer. More... | |
int | main (void) |
Main function. Execution starts here. More... | |
static void | pdca_int_handler (void) |
static void | sd_mmc_resources_init (void) |
Initializes SD/MMC resources: GPIO, SPI and SD/MMC. More... | |
void | wait () |
Variables | |
const char | dummy_data [] |
volatile bool | end_of_transfer |
volatile avr32_pdca_channel_t * | pdca_channelrx |
volatile avr32_pdca_channel_t * | pdca_channeltx |
volatile char | ram_buffer [1000] |
#define AVR32_PDCA_CHANNEL_SPI_RX 0 |
Referenced by local_pdca_init(), main(), and pdca_int_handler().
#define AVR32_PDCA_CHANNEL_SPI_TX 1 |
Referenced by local_pdca_init(), main(), and pdca_int_handler().
#define AVR32_PDCA_CHANNEL_USED_RX AVR32_PDCA_PID_SPI1_RX |
Referenced by local_pdca_init().
#define AVR32_PDCA_CHANNEL_USED_TX AVR32_PDCA_PID_SPI1_TX |
Referenced by local_pdca_init().
#define BUFFERSIZE 64 |
Number of bytes in the receive buffer when operating in slave mode.
#define PBA_HZ FOSC0 |
PBA clock frequency (Hz)
Referenced by main(), and sd_mmc_resources_init().
void local_pdca_init | ( | void | ) |
Initialize PDCA (Peripheral DMA Controller A) resources for the SPI transfer and start a dummy transfer.
Enable pdca transfer interrupt when completed
References pdca_channel_options_t::addr, AVR32_PDCA_CHANNEL_SPI_RX, AVR32_PDCA_CHANNEL_SPI_TX, AVR32_PDCA_CHANNEL_USED_RX, AVR32_PDCA_CHANNEL_USED_TX, dummy_data, INTC_register_interrupt(), pdca_init_channel(), pdca_int_handler(), PDCA_TRANSFER_SIZE_BYTE, and ram_buffer.
Referenced by main().
int main | ( | void | ) |
Main function. Execution starts here.
References AVR32_PDCA_CHANNEL_SPI_RX, AVR32_PDCA_CHANNEL_SPI_TX, capacity, dummy_data, Enable_global_interrupt, end_of_transfer, FOSC0, init_dbg_rs232(), INTC_init_interrupts(), local_pdca_init(), OSC0_STARTUP, PBA_HZ, PCL_OSC0, pcl_switch_to_osc(), pdca_channelrx, pdca_channeltx, pdca_enable_interrupt_transfer_complete(), pdca_get_handler(), pdca_load_channel(), print_dbg(), print_dbg_char_hex(), print_dbg_ulong(), ram_buffer, sd_mmc_resources_init(), SD_MMC_SPI, sd_mmc_spi_get_capacity(), sd_mmc_spi_mem_check(), sd_mmc_spi_read_open_PDCA(), and spi_write().
|
static |
|
static |
Initializes SD/MMC resources: GPIO, SPI and SD/MMC.
References gpio_enable_module(), PBA_HZ, spi_options_t::reg, SD_MMC_SPI, SD_MMC_SPI_BITS, sd_mmc_spi_init(), SD_MMC_SPI_MASTER_SPEED, SD_MMC_SPI_MISO_FUNCTION, SD_MMC_SPI_MISO_PIN, SD_MMC_SPI_MOSI_FUNCTION, SD_MMC_SPI_MOSI_PIN, SD_MMC_SPI_NPCS, SD_MMC_SPI_NPCS_FUNCTION, SD_MMC_SPI_NPCS_PIN, SD_MMC_SPI_SCK_FUNCTION, SD_MMC_SPI_SCK_PIN, spi_enable(), spi_initMaster(), and spi_selectionMode().
Referenced by main().
void wait | ( | ) |
Referenced by pdca_int_handler().
const char dummy_data[] |
Referenced by local_pdca_init(), and main().
volatile bool end_of_transfer |
Referenced by main(), and pdca_int_handler().
volatile avr32_pdca_channel_t* pdca_channelrx |
Referenced by main().
volatile avr32_pdca_channel_t* pdca_channeltx |
Referenced by main().
volatile char ram_buffer[1000] |
Referenced by local_pdca_init(), and main().