CryptoAuthLib
Atmel CryptoAuthentication Library
swi_uart_samd21_asf.h
Go to the documentation of this file.
1 
44 #ifndef SWI_UART_SAMD21_ASF_H
45 #define SWI_UART_SAMD21_ASF_H
46 
47 #include <asf.h>
48 #include "cryptoauthlib.h"
49 
63 #define MAX_SWI_BUSES 6 // SAMD21 has up to 6 SERCOMS that can be configured as UART
64 
65 #define RECEIVE_MODE 0 // UART Receive mode, RX enabled
66 #define TRANSMIT_MODE 1 // UART Transmit mode, RX disabled
67 #define RX_DELAY { volatile uint8_t delay = 90; while (delay--) __asm__(""); }
68 #define TX_DELAY 90
69 
70 #define DEBUG_PIN_1 EXT2_PIN_5
71 #define DEBUG_PIN_2 EXT2_PIN_6
72 
74 typedef struct atcaSWImaster {
75  // struct usart_module for Atmel SWI interface
76  struct usart_module usart_instance;
77  // for conveniences during interface release phase
78  int bus_index;
80 
81 
84 void swi_uart_setbaud(ATCASWIMaster_t *instance, uint32_t baudrate);
85 void swi_uart_mode(ATCASWIMaster_t *instance, uint8_t mode);
86 void swi_uart_discover_buses(int swi_uart_buses[], int max_buses);
87 
88 ATCA_STATUS swi_uart_send_byte(ATCASWIMaster_t *instance, uint8_t data);
89 ATCA_STATUS swi_uart_receive_byte(ATCASWIMaster_t *instance, uint8_t *data);
90 
93 #endif // SWI_UART_ASF_H
struct atcaSWImaster ATCASWIMaster_t
this is the hal_data for ATCA HAL for ASF SERCOM
ATCA_STATUS swi_uart_deinit(ATCASWIMaster_t *instance)
Implementation of SWI UART deinit.
Definition: swi_uart_samd21_asf.c:108
Single aggregation point for all CryptoAuthLib header files.
void swi_uart_discover_buses(int swi_uart_buses[], int max_buses)
discover UART buses available for this hardware this maintains a list of logical to physical bus mapp...
Definition: swi_uart_samd21_asf.c:155
void swi_uart_mode(ATCASWIMaster_t *instance, uint8_t mode)
implementation of SWI UART change mode.
Definition: swi_uart_samd21_asf.c:142
void swi_uart_setbaud(ATCASWIMaster_t *instance, uint32_t baudrate)
implementation of SWI UART change baudrate.
Definition: swi_uart_samd21_asf.c:120
ATCA_STATUS swi_uart_send_byte(ATCASWIMaster_t *instance, uint8_t data)
HAL implementation of SWI UART send byte over ASF. This function send one byte over UART...
Definition: swi_uart_samd21_asf.c:170
ATCA_STATUS
Definition: atca_status.h:55
ATCA_STATUS swi_uart_receive_byte(ATCASWIMaster_t *instance, uint8_t *data)
HAL implementation of SWI UART receive bytes over ASF. This function receive one byte over UART...
Definition: swi_uart_samd21_asf.c:198
struct usart_module usart_instance
Definition: swi_uart_samd21_asf.h:76
This is the hal_data for ATCA HAL.
Definition: hal_swi_bitbang.h:81
int bus_index
for conveniences during interface release phase
Definition: hal_swi_bitbang.h:85
ATCA_STATUS swi_uart_init(ATCASWIMaster_t *instance)
Implementation of SWI UART init.
Definition: swi_uart_samd21_asf.c:64