Microchip® Advanced Software Framework

qs_i2c_master_dma.c File Reference

SAM SERCOM I2C Master with DMA Quick Start Guide.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>

Macros

#define DATA_LENGTH   10
 [packet_data] More...
 
#define SLAVE_ADDRESS   0x12
 
#define TIMEOUT   1000
 [packet_data] More...
 

Functions

static void configure_dma_resource (struct dma_resource *resource)
 [transfer_done] More...
 
static void configure_i2c_master (void)
 [dev_i2c_inst] More...
 
int main (void)
 [setup_dma_transfer_descriptor] More...
 
static void setup_dma_descriptor (DmacDescriptor *descriptor)
 [config_dma_resource] More...
 
static void transfer_done (struct dma_resource *const resource)
 [transfer_descriptor] More...
 

Variables

static uint8_t buffer [DATA_LENGTH]
 
struct dma_resource example_resource
 [initialize_i2c] More...
 
struct i2c_master_module i2c_master_instance
 [timeout] More...
 
DmacDescriptor example_descriptor SECTION_DMAC_DESCRIPTOR
 [transfer_done_flag] More...
 
static volatile bool transfer_is_done = false
 [dma_resource] More...
 

#define DATA_LENGTH   10

[packet_data]

Referenced by main(), and setup_dma_descriptor().

#define SLAVE_ADDRESS   0x12

Referenced by main().

#define TIMEOUT   1000

[packet_data]

[timeout]

static void configure_dma_resource ( struct dma_resource resource)
static

[transfer_done]

[config_dma_resource]

[dma_setup_1]

[dma_setup_1]

[dma_setup_2]

[dma_setup_2]

[dma_setup_3]

[dma_setup_3]

[dma_setup_4]

[dma_setup_4]

References dma_allocate(), dma_get_config_defaults(), DMA_TRIGGER_ACTION_BEAT, dma_resource_config::peripheral_trigger, and dma_resource_config::trigger_action.

static void configure_i2c_master ( void  )
static

[dev_i2c_inst]

[initialize_i2c]

[init_conf]

[init_conf]

[conf_change]

[conf_change]

[init_module]

[init_module]

[enable_module]

[enable_module]

References i2c_master_config::buffer_timeout, i2c_master_enable(), i2c_master_get_config_defaults(), i2c_master_init(), i2c_master_instance, i2c_master_config::pinmux_pad0, and i2c_master_config::pinmux_pad1.

Referenced by main().

int main ( void  )

[setup_dma_transfer_descriptor]

[init] [config_i2c]

[config_i2c]

[config_dma]

[config_dma] [init]

[main] [start_transfer_job]

[start_transfer_job]

[set_i2c_addr]

[set_i2c_addr]

[waiting_for_complete]

[waiting_for_complete]

[inf_loop]

[inf_loop] [main]

References configure_dma_resource(), configure_i2c_master(), DATA_LENGTH, dma_add_descriptor(), DMA_CALLBACK_TRANSFER_DONE, dma_enable_callback(), dma_register_callback(), dma_start_transfer_job(), example_resource, i2c_master_dma_set_transfer(), i2c_master_instance, I2C_TRANSFER_WRITE, setup_dma_descriptor(), SLAVE_ADDRESS, system_init(), transfer_done(), and transfer_is_done.

static void setup_dma_descriptor ( DmacDescriptor *  descriptor)
static

[config_dma_resource]

[setup_dma_transfer_descriptor]

[dma_setup_5]

[dma_setup_5]

[dma_setup_6]

[dma_setup_6]

[dma_setup_7]

[dma_setup_7]

[dma_setup_8]

[dma_setup_8]

References dma_descriptor_config::beat_size, dma_descriptor_config::block_transfer_count, buffer, DATA_LENGTH, dma_descriptor_config::destination_address, DMA_BEAT_SIZE_BYTE, dma_descriptor_create(), dma_descriptor_get_config_defaults(), dma_descriptor_config::dst_increment_enable, i2c_master_instance, and dma_descriptor_config::source_address.

Referenced by main().

static void transfer_done ( struct dma_resource *const  resource)
static

[transfer_descriptor]

[transfer_done]

References transfer_is_done, and UNUSED.

struct dma_resource example_resource

[initialize_i2c]

[dma_resource]

struct i2c_master_module i2c_master_instance

[timeout]

[dev_i2c_inst]

DmacDescriptor example_descriptor SECTION_DMAC_DESCRIPTOR

[transfer_done_flag]

[transfer_descriptor]

volatile bool transfer_is_done = false
static

[dma_resource]

[transfer_done_flag]

Referenced by main(), and transfer_done().