SAM DMA cyclic redundancy check (CRC) Driver.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <compiler.h>
Data Structures | |
struct | dma_crc_config |
Configurations for CRC calculation. More... | |
Macros | |
#define | DMA_CRC_CHANNEL_N_OFFSET 0x20 |
DMA channel n offset. More... | |
Enumerations | |
enum | crc_beat_size { CRC_BEAT_SIZE_BYTE, CRC_BEAT_SIZE_HWORD, CRC_BEAT_SIZE_WORD } |
CRC Beat Type. More... | |
enum | crc_polynomial_type { CRC_TYPE_16, CRC_TYPE_32 } |
CRC Polynomial Type. More... | |
Functions | |
static enum status_code | dma_crc_channel_enable (uint32_t channel_id, struct dma_crc_config *config) |
Enable DMA CRC module with an DMA channel. More... | |
static void | dma_crc_disable (void) |
Disable DMA CRC module. More... | |
static uint32_t | dma_crc_get_checksum (void) |
Get DMA CRC checksum value. More... | |
static void | dma_crc_get_config_defaults (struct dma_crc_config *config) |
Get DMA CRC default configurations. More... | |
static void | dma_crc_io_calculation (void *buffer, uint32_t total_beat_size) |
Calculate CRC with I/O. More... | |
static enum status_code | dma_crc_io_enable (struct dma_crc_config *config) |
Enable DMA CRC module with I/O. More... | |
#define DMA_CRC_CHANNEL_N_OFFSET 0x20 |
DMA channel n offset.
Referenced by dma_crc_channel_enable().
enum crc_beat_size |
enum crc_polynomial_type |
|
inlinestatic |
Enable DMA CRC module with an DMA channel.
This function enables a CRC calculation with an allocated DMA channel. This channel ID can be gotten from a successful dma_allocate.
[in] | channel_id | DMA channel expected with CRC calculation |
[in] | config | CRC calculation configurations |
STATUS_OK | Get the DMA CRC module |
STATUS_BUSY | DMA CRC module is already taken and not ready yet |
References DMA_CRC_CHANNEL_N_OFFSET, dma_crc_config::size, STATUS_BUSY, STATUS_OK, and dma_crc_config::type.
|
inlinestatic |
Disable DMA CRC module.
Referenced by generate_crc().
|
inlinestatic |
|
inlinestatic |
Get DMA CRC default configurations.
The default configuration is as follows:
[in] | config | default configurations |
References Assert, CRC_BEAT_SIZE_BYTE, CRC_TYPE_16, dma_crc_config::size, and dma_crc_config::type.
Referenced by generate_crc().
|
inlinestatic |
Calculate CRC with I/O.
This function calculate the CRC of the input data buffer.
[in] | buffer | CRC Pointer to calculation buffer |
[in] | total_beat_size | Total beat size to be calculated |
References buffer, counter, CRC_BEAT_SIZE_BYTE, CRC_BEAT_SIZE_HWORD, CRC_BEAT_SIZE_WORD, and nop.
Referenced by generate_crc().
|
inlinestatic |
Enable DMA CRC module with I/O.
This function enables a CRC calculation with I/O mode.
[in] | config | CRC calculation configurations. |
STATUS_OK | Get the DMA CRC module |
STATUS_BUSY | DMA CRC module is already taken and not ready yet |
References CRC_TYPE_32, dma_crc_config::size, STATUS_BUSY, STATUS_OK, and dma_crc_config::type.
Referenced by generate_crc().