20 #ifdef CONF_BOARD_SPI_UINS 26 #include "../../src/ISComm.h" 32 #define DMA_LLD_COUNT 32 //Must be 2^x in size 33 #define DMA_LLD_MASK (DMA_LLD_COUNT - 1) 42 volatile uint8_t *
buf;
43 volatile uint8_t *
end;
44 volatile uint8_t *
ptr;
67 volatile uint8_t *
buf;
68 volatile uint8_t *
end;
69 volatile uint8_t *
ptr;
96 #define CONCAT(A,B) A ## B 97 #define ARGN(N, LIST) CONCAT(ARG_, N) LIST 98 #define ARG_0(A0, ...) A0 99 #define ARG_1(A0, A1, ...) A1 100 #define ARG_2(A0, A1, A2, ...) A2 101 #define ARG_3(A0, A1, A2, A3, ...) A3 102 #define ARG_4(A0, A1, A2, A3, A4, ...) A4 105 #if MAX_NUMBER_SERIAL_PORTS >= 1 107 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port0[ARGN(4, PORT0_CONFIG)];
110 #if MAX_NUMBER_SERIAL_PORTS >= 2 112 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port1[ARGN(4, PORT1_CONFIG)];
115 #if MAX_NUMBER_SERIAL_PORTS >= 3 117 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port2[ARGN(4, PORT2_CONFIG)];
120 #if MAX_NUMBER_SERIAL_PORTS >= 4 122 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port3[ARGN(4, PORT3_CONFIG)];
125 #if MAX_NUMBER_SERIAL_PORTS >= 5 127 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port4[ARGN(4, PORT4_CONFIG)];
130 #if MAX_NUMBER_SERIAL_PORTS >= 6 132 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port5[ARGN(4, PORT5_CONFIG)];
135 #if MAX_NUMBER_SERIAL_PORTS >= 7 137 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port6[ARGN(4, PORT6_CONFIG)];
140 #if MAX_NUMBER_SERIAL_PORTS >= 8 142 COMPILER_ALIGNED(32) static uint8_t g_serRxDmaBuf_port7[ARGN(4, PORT7_CONFIG)];
145 #if MAX_NUMBER_SERIAL_PORTS >= 9 146 #error "Need to add more support" 168 usb_cdc_open =
false;
181 data_avail = dma->
ptr - dma->
end;
192 int bytesToEnd = dma->
buf + dma->
size - dma->
end;
193 int bytesToSend =
Min(data_avail, usb_avail);
195 if(bytesToSend < bytesToEnd)
198 dma->
end += bytesToSend;
220 return (
const uint8_t*)dma->
ptr;
254 if (dma->
ptr < curDmaAddr)
257 return (
int)(dma->
size - (curDmaAddr - dma->
ptr));
259 return (
int)(dma->
ptr - curDmaAddr);
267 if (curDmaAddr < dma->ptr)
270 return (
int)(dma->
size - (dma->
ptr - curDmaAddr));
272 return (
int)(curDmaAddr - dma->
ptr);
367 cfg.
mbr_sa = (uint32_t)noData_indicator;
443 int serWrite(
int serialNum,
const unsigned char *buf,
int size)
461 if ((uint32_t)size > dma->
size)
480 int bytesToEnd = dma->
buf + dma->
size - dma->
ptr;
481 if (size <= bytesToEnd)
484 memcpy((
void*)dma->
ptr, buf, size);
492 int bytesWrapped = size - bytesToEnd;
498 memcpy((
void*)dma->
ptr, buf, bytesToEnd);
502 memcpy((
void*)dma->
buf, buf + bytesToEnd, bytesWrapped);
505 dma->
ptr = dma->
buf + bytesWrapped;
514 g_portMonitorHelper[serialNum].
txByteCount += size;
519 #endif // #ifdef USB_PORT_NUM 523 if (!dma || (uint32_t)size > dma->
size)
return 0;
537 #ifndef __INERTIAL_SENSE_EVB_2__ 538 g_internal_diagnostic.txOverflowCount[serialNum]++;
551 int bytesToEnd = dma->
end - dma->
ptr;
554 if (size <= bytesToEnd)
574 dma->
ptr = dma->
ptr + size;
582 int bytesWrapped = size - bytesToEnd;
627 dma->
ptr = dma->
buf + bytesWrapped;
641 #if CONF_BOARD_USART_SPI_DATAREADY_ENABLE == 1 657 #if CONF_BOARD_USART_SPI_DATAREADY_ENABLE == 1 700 g_portMonitorHelper[serialNum].
txByteCount += size;
706 #ifdef CONF_BOARD_SPI_UINS 711 static volatile int xdmacSPICount = 0;
716 if(g_usartDMA[i].usart == 0)
724 #if CONF_BOARD_USART_SPI_DATAREADY_ENABLE == 1 726 if (g_usartDMA[i].uinfo.isSpiUsart)
735 if(2 <= xdmacSPICount)
782 int serRead(
int serialNum,
unsigned char *buf,
int size)
813 if (dmaUsed < dma->lastUsedRx)
822 #ifndef __INERTIAL_SENSE_EVB_2__ 823 g_internal_diagnostic.rxOverflowCount[serialNum]++;
830 size =
Min((uint32_t)size, dmaUsed);
835 int bytesToEnd = dma->
end - dma->
ptr;
837 if (size >= bytesToEnd)
843 int bytesWrapped = size - bytesToEnd;
849 dma->
ptr = dma->
buf + bytesWrapped;
866 #ifndef __INERTIAL_SENSE_EVB_2__ 873 g_internal_diagnostic.gapCountSerialDriver[serialNum]++;
880 g_portMonitorHelper[serialNum].
rxByteCount += size;
902 if(dmaUsed == 0)
return 0;
911 uint32_t chCount = 0;
912 volatile uint8_t *ptr = dma->
ptr;
913 while(++chCount <= dmaUsed)
979 #ifndef __INERTIAL_SENSE_EVB_2__ 998 if( !ser->
usart )
return -1;
1004 #ifndef __INERTIAL_SENSE_EVB_2__ 1019 if( !ser )
return -1;
1031 cfg.
mbr_sa = (uint32_t)ser->uinfo.usartRxRHR;
1032 cfg.
mbr_da = (uint32_t)ser->dmaRx.buf;
1043 cfg.
mbr_ubc = ser->dmaRx.size;
1047 ser->dmaRx.lld.mbr_ta = (uint32_t)ser->dmaRx.buf;
1048 ser->dmaRx.lld.mbr_nda = (uint32_t)&(ser->dmaRx.lld);
1049 ser->dmaRx.lld.mbr_ubc =
1068 cfg.
mbr_sa = (uint32_t)noData_indicator;
1069 cfg.
mbr_da = (uint32_t)ser->uinfo.usartTxTHR;
1084 ser->dmaTx.lld_fptr = 0;
1085 ser->dmaTx.lld_bptr = 0;
1087 if (ser->uinfo.isSpiUsart)
1097 ser->dmaTx.lld[i].mbr_nda = (uint32_t)&(ser->dmaTx.lld_spi_noData[i]);
1100 ser->dmaTx.lld_spi_noData[i].mbr_nda = (uint32_t)&(ser->dmaTx.lld_spi_noData[i]);
1103 ser->dmaTx.lld_spi_noData[i].mbr_ta = (uint32_t)noData_indicator;
1112 ser->dmaTx.lld_fptr = 1;
1114 #if CONF_BOARD_USART_SPI_DATAREADY_ENABLE == 1 1131 #if (ENABLE_COMM_LOOPBACK_DRIVER > 0) 1132 static void serLoopback(
int portNum)
1137 #define RX_BUF_SIZE 256 1138 static unsigned char rxBuf[RX_BUF_SIZE] = {0};
1142 #if ENABLE_COMM_LOOPBACK_DRIVER==1 // Loop back test - simple 1147 bytesRead =
serRead(portNum, rxBuf, RX_BUF_SIZE, 0);
1152 if (g_usartDMA[portNum].uinfo.isSpiUsart)
1156 for(i=0;i<bytesRead;i++)
1158 rxBuf[cnt++] = rxBuf[i];
1164 serWrite(portNum, rxBuf, bytesRead, 0);
1169 #ifndef __INERTIAL_SENSE_EVB_2__ 1170 watchdog_maintenance_force();
1173 #endif // ENABLE_COMM_LOOPBACK_DRIVER==1 1175 #if ENABLE_COMM_LOOPBACK_DRIVER==2 // Loop back test - multiple reads before multiple writes 1181 if (
serRead(portNum, &(rxBuf[bytesRead]), 1, 0))
1183 if (g_usartDMA[portNum].uinfo.isSpiUsart)
1185 if(rxBuf[bytesRead] != 0)
1200 if (bytesRead>=10 || ++timeout >= 100000)
1204 int bytesSend1 = bytesRead/2;
1205 int bytesSend2 = bytesRead - bytesSend1;
1206 serWrite(portNum, rxBuf, bytesSend1, 0);
1207 serWrite(portNum, &rxBuf[bytesSend1], bytesSend2, 0);
1217 watchdog_maintenance_force();
1219 #endif // ENABLE_COMM_LOOPBACK_DRIVER==2 1221 #if ENABLE_COMM_LOOPBACK_DRIVER == 3 // Raw read/write test 1242 watchdog_maintenance_force();
1244 #endif // ENABLE_COMM_LOOPBACK_DRIVER==3 1246 #if ENABLE_COMM_LOOPBACK_DRIVER==4 //Assembles a packet before sending back 1248 ((
Usart*)g_usartDMA[portNum].usart)->US_THR = 0;
1252 bool inpacket =
false;
1257 if (
serRead(portNum, &(rxBuf[bytesRead]), 1, 0))
1263 if(0xFE == rxBuf[bytesRead - 1])
1268 if( 0xFF == rxBuf[bytesRead])
1279 watchdog_maintenance_force();
1284 for(
int j=2;j<bytesRead-1;j++)
1286 if(rxBuf[j-1] + 1 != rxBuf[j])
1289 serWrite(portNum, rxBuf, bytesRead, 0);
1296 #endif // ENABLE_COMM_LOOPBACK_DRIVER==4 1299 #endif // ENABLE_COMM_LOOPBACK_DRIVER > 0 1308 else if(options !=
NULL)
1344 switch(serialNumber)
1348 #if MAX_NUMBER_SERIAL_PORTS >= 1 1355 ser->
dmaTx.
buf = g_serTxDmaBuf_port0;
1356 ser->
dmaRx.
buf = g_serRxDmaBuf_port0;
1359 #if MAX_NUMBER_SERIAL_PORTS >= 2 1366 ser->
dmaTx.
buf = g_serTxDmaBuf_port1;
1367 ser->
dmaRx.
buf = g_serRxDmaBuf_port1;
1370 #if MAX_NUMBER_SERIAL_PORTS >= 3 1377 ser->
dmaTx.
buf = g_serTxDmaBuf_port2;
1378 ser->
dmaRx.
buf = g_serRxDmaBuf_port2;
1381 #if MAX_NUMBER_SERIAL_PORTS >= 4 1388 ser->
dmaTx.
buf = g_serTxDmaBuf_port3;
1389 ser->
dmaRx.
buf = g_serRxDmaBuf_port3;
1392 #if MAX_NUMBER_SERIAL_PORTS >= 5 1399 ser->
dmaTx.
buf = g_serTxDmaBuf_port4;
1400 ser->
dmaRx.
buf = g_serRxDmaBuf_port4;
1403 #if MAX_NUMBER_SERIAL_PORTS >= 6 1410 ser->
dmaTx.
buf = g_serTxDmaBuf_port5;
1411 ser->
dmaRx.
buf = g_serRxDmaBuf_port5;
1414 #if MAX_NUMBER_SERIAL_PORTS >= 7 1421 ser->
dmaTx.
buf = g_serTxDmaBuf_port6;
1422 ser->
dmaRx.
buf = g_serRxDmaBuf_port6;
1425 #if MAX_NUMBER_SERIAL_PORTS >= 8 1432 ser->
dmaTx.
buf = g_serTxDmaBuf_port7;
1433 ser->
dmaRx.
buf = g_serRxDmaBuf_port7;
1467 #if CONF_BOARD_USART_SPI == 1 1571 #if (ENABLE_COMM_LOOPBACK_DRIVER==1 || ENABLE_COMM_LOOPBACK_DRIVER==2) 1572 serLoopback(serialNum);
1573 #endif // ENABLE_COMM_LOOPBACK_DRIVER == 1 || 2 1581 s_overrunStatus = overrunStatus;
1622 #if CONF_BOARD_ENABLE_DCACHE == 1 1633 #if (ENABLE_COMM_LOOPBACK_DRIVER > 0) 1634 serLoopback(serialNum);
void usart_enable_rx(Usart *p_usart)
Enable USART receiver.
#define XDMAC_PERID_UART4_TX
#define UART_MR_PAR_NO
(UART_MR) No parity
#define XDMAC_PERID_UART3_TX
#define XDMAC_PERID_UART1_RX
int serTxUsed(int serialNum)
Returns number of bytes used in Tx buffer.
#define XDMAC_CC_DSYNC_MEM2PER
(XDMAC_CC) Memory to Peripheral transfer
#define UART_MR_BRSRCCK_PERIPH_CLK
(UART_MR) The baud rate is driven by the peripheral clock
void d_usartDMA_callback_cdc_tx_empty_notify(void)
int serSetBaudRate(int serialNum, int baudrate)
Change USART baudrate. 0 on success, -1 on failure.
#define ID_USART1
USART 1 (USART1)
#define MEMCPY_DCACHE_CLEAN(dst, src, size)
#define UART_IER_PARE
(UART_IER) Enable Parity Error Interrupt
static void xdmac_channel_set_descriptor_control(Xdmac *xdmac, uint32_t channel_num, uint32_t config)
Set next descriptor's configuration for the relevant channel of given XDMA.
static int serTxFreeDma(dmaBuffer_tx_t *dma)
static dmaBuffer_rx_t * getRxDma(uint32_t serialNum)
#define ID_XDMAC
DMA (XDMAC)
__I uint32_t XDMAC_CIS
(XdmacChid Offset: 0xC) Channel Interrupt Status Register
static void ioport_set_pin_level(ioport_pin_t pin, bool level)
Set an IOPORT pin to a specified logical value.
#define XDMAC_CC_TYPE_PER_TRAN
(XDMAC_CC) Synchronized mode (Peripheral to Memory or Memory to Peripheral Transfer).
#define US_MR_NBSTOP_1_BIT
(US_MR) 1 stop bit
#define taskEXIT_CRITICAL()
#define MAX_NUMBER_SERIAL_PORTS
#define SCB_CLEAN_DCACHE_BY_ADDR_32BYTE_ALIGNED(addr, size)
static const uint8_t * getCurrentRxDmaAddress(dmaBuffer_rx_t *dma)
#define XDMAC_CC_SAM_FIXED_AM
(XDMAC_CC) The address remains unchanged.
uint32_t usart_init_spi_slave(Usart *p_usart, const usart_spi_opt_t *p_usart_opt)
Configure USART to work in SPI mode and act as a slave.
static void xdmac_disable_interrupt(Xdmac *xdmac, uint32_t channel_num)
Disables XDMAC global interrupt.
#define XDMAC_CNDC_NDVIEW_NDV0
(XDMAC_CNDC) Next Descriptor View 0
int serGetBaudRate(int serialNum)
Read USART baudrate. Return value is the baudrate or -1 on failure.
#define XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED
(XDMAC_CNDC) Destination parameters are updated when the descriptor is retrieved. ...
int serInit(int serialNum, uint32_t baudRate, sam_usart_opt_t *options, uint32_t *overrunStatus)
Initialize serial port with specific USART/UART and DMA settings. If not NULL, the overrun status wil...
void USART1_Handler(void)
Usart hardware registers.
void d_usartDMA_callback_cdc_disable(void)
#define Min(a, b)
Takes the minimal value of a and b.
void usart_enable_interrupt(Usart *p_usart, uint32_t ul_sources)
Enable USART interrupts.
bool d_usartDMA_callback_cdc_enable(void)
#define XDMAC
(XDMAC ) Base Address
static int serTxUsedDma(dmaBuffer_tx_t *dma)
volatile uint8_t dmaChNumber
static void xdmac_channel_software_flush_request(Xdmac *xdmac, uint32_t channel_num)
Set software flush request on the relevant channel.
size_t count(InputIterator first, InputIterator last, T const &item)
__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
Set Interrupt Priority.
static dmaBuffer_tx_t * getTxDma(uint32_t serialNum)
__I uint32_t XDMAC_CIM
(XdmacChid Offset: 0x8) Channel Interrupt Mask Register
#define ID_USBHS
USB Host / Device Controller (USBHS)
#define UART3
(UART3 ) Base Address
static void xdmac_channel_set_descriptor_addr(Xdmac *xdmac, uint32_t channel_num, uint32_t desc_addr, uint8_t ndaif)
Set next descriptor's address & interface for the relevant channel of given XDMA. ...
uint32_t pmc_enable_periph_clk(uint32_t ul_id)
Enable the specified peripheral clock.
volatile uint8_t dmaChNumber
#define UART_IER_OVRE
(UART_IER) Enable Overrun Error Interrupt
int serRead(int serialNum, unsigned char *buf, int size)
Read data on USART. Returns number of bytes read. With use of the PDCA ring buffer, buffer overrun may occur if bytes are received is greater than bytes read plus buffer size.
#define XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED
(XDMAC_CNDC) Source parameters are updated when the descriptor is retrieved.
#define XDMAC_PERID_USART1_TX
#define XDMAC_UBC_NDE_FETCH_EN
#define XDMAC_CC_MEMSET_NORMAL_MODE
(XDMAC_CC) Memset is not activated
#define XDMAC_PERID_UART2_TX
#define US_MR_PAR_NO
(US_MR) No parity
#define US_MR_CHMODE_NORMAL
(US_MR) Normal mode
#define XDMAC_UBC_UBLEN(value)
#define ID_UART3
UART 3 (UART3)
#define XDMAC_PERID_USART0_TX
uint32_t xdmacUsartTxPerId
#define XDMAC_PERID_UART2_RX
#define UART1
(UART1 ) Base Address
#define USART0
(USART0) Base Address
#define XDMAC_CC_DAM_FIXED_AM
(XDMAC_CC) The address remains unchanged.
void uart_enable(Uart *p_uart)
Enable UART receiver and transmitter.
iram_size_t udi_cdc_get_free_tx_buffer(void)
Gets the number of free byte in TX buffer.
#define ID_UART0
UART 0 (UART0)
static int serBufferInit(usartDMA_t *ser, int serialNumber)
#define USART1
(USART1) Base Address
uint32_t usart_get_status(Usart *p_usart)
Get current status.
uint32_t uart_init(Uart *p_uart, const sam_uart_opt_t *p_uart_opt)
Configure UART with the specified parameters.
static void xdmac_channel_set_source_addr(Xdmac *xdmac, uint32_t channel_num, uint32_t src_addr)
Set source address for the relevant channel of given XDMA.
iram_size_t udi_cdc_write_buf(const void *buf, iram_size_t size)
Writes a RAM buffer on CDC line.
volatile uint32_t lld_bptr
void udc_start(void)
Start the USB Device stack.
#define SER_INDICATE_TX()
#define XDMAC_CIE_BIE
(XDMAC_CIE) End of Block Interrupt Enable Bit
XdmacChid hardware registers.
#define UART_IER_FRAME
(UART_IER) Enable Framing Error Interrupt
#define XDMAC_CC_DAM_INCREMENTED_AM
(XDMAC_CC) The addressing mode is incremented (the increment size is set to the data size)...
__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn)
Disable External Interrupt.
#define XDMAC_CC_SIF_AHB_IF1
(XDMAC_CC) The data is read through the system bus interface 1
#define XDMAC_CNDC_NDE_DSCR_FETCH_EN
(XDMAC_CNDC) Descriptor fetch is enabled
volatile XdmacChid * dmaChId
static uint32_t sysclk_get_peripheral_hz(void)
Retrieves the current rate in Hz of the peripheral clocks.
volatile XdmacChid * dmaChId
__IO uint32_t XDMAC_CDA
(XdmacChid Offset: 0x14) Channel Destination Address Register
static void xdmac_channel_set_microblock_control(Xdmac *xdmac, uint32_t channel_num, uint32_t ublen)
Set microblock length for the relevant channel of given XDMA.
static int setup_usart_info(usartDMA_t *ser, int serialNumber, uint32_t baudRate, sam_usart_opt_t *options)
int serFindCharacter(int serialNum, uint8_t ch)
Returns number of characters in buffer before specified character.
#define XDMAC_PERID_UART4_RX
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable External Interrupt.
__IO uint32_t XDMAC_CSA
(XdmacChid Offset: 0x10) Channel Source Address Register
#define UART_MR_CHMODE_NORMAL
(UART_MR) Normal mode
iram_size_t udi_cdc_read_no_polling(void *buf, iram_size_t size)
Non polling reads of a up to 'size' data from CDC line.
uint32_t usart_init_rs232(Usart *p_usart, const sam_usart_opt_t *p_usart_opt, uint32_t ul_mck)
Configure USART to work in RS232 mode.
int serRxFree(int serialNum)
Returns number of bytes available in Rx buffer.
void XDMAC_spiTouINS_Handler(void)
static void xdmac_channel_disable_interrupt(Xdmac *xdmac, uint32_t channel_num, uint32_t mask)
Disable interrupt with mask on the relevant channel of given XDMA.
static void xdmac_enable_interrupt(Xdmac *xdmac, uint32_t channel_num)
Enables XDMAC global interrupt.
volatile uint32_t lld_fptr
__attribute__((optimize("O0")))
__STATIC_INLINE void SCB_CleanInvalidateDCache(void)
Clean & Invalidate D-Cache.
static const uint8_t * getCurrentTxDmaAddress(dmaBuffer_tx_t *dma)
static void xdmac_channel_disable(Xdmac *xdmac, uint32_t channel_num)
Disables the relevant channel of given XDMAC.
int serTxFree(int serialNum)
Returns number of bytes available in Tx buffer.
#define XDMAC_UBC_NSEN_UPDATED
#define XDMAC_UBC_NDEN_UPDATED
#define XDMAC_PERID_USART2_RX
#define XDMAC_PERID_USART0_RX
static void xdmac_channel_enable_interrupt(Xdmac *xdmac, uint32_t channel_num, uint32_t mask)
Enable interrupt with mask on the relevant channel of given XDMA.
#define XDMAC_PERID_USART1_RX
#define US_MR_CHRL_8_BIT
(US_MR) Character length is 8 bits
#define ID_UART1
UART 1 (UART1)
int serTxClear(int serialNum)
Clear the entire Tx buffer.
const unsigned int g_validBaudRates[IS_BAUDRATE_COUNT]
#define IS_32B_ALIGNED(_addr_)
int serRxClear(int serialNum, int size)
Removes removes data from USART Rx buffer. Returns number of bytes removed. Length of -1 removes all ...
void xdmac_configure_transfer(Xdmac *xdmac, uint32_t channel_num, xdmac_channel_config_t *cfg)
Configure DMA for a transfer.
#define XDMAC_CC_DIF_AHB_IF1
(XDMAC_CC) The data is written though the system bus interface 1
#define XDMAC_PERID_UART0_TX
#define US_CSR_RXRDY
(US_CSR) Receiver Ready (cleared by reading US_RHR)
__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn)
Clear Pending Interrupt.
#define ID_UART2
UART 2 (UART2)
COMPILER_WORD_ALIGNED volatile lld_view0 lld[DMA_LLD_COUNT]
#define _CLAMP(v, minV, maxV)
#define UART_MR_FILTER_DISABLED
(UART_MR) UART does not filter the receive line.
void USART0_Handler(void)
void USART2_Handler(void)
static void xdmac_channel_enable_no_cache(Xdmac *xdmac, uint32_t channel_num)
enables the relevant channel of given XDMAC without invalidating data cache.
#define XDMAC_CC_DSYNC_PER2MEM
(XDMAC_CC) Peripheral to Memory transfer
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
#define SCB_CLEANINVALIDATE_DCACHE_BY_ADDR_32BYTE_ALIGNED(addr, size)
Option list for UART peripheral initialization.
#define UINT32_TIME_DIFF(current, prev)
#define UART_CR_RSTSTA
(UART_CR) Reset Status
#define LEDS_ALL_TOGGLE()
static int serRxUsedDma(dmaBuffer_rx_t *dma)
Structure for storing parameters for DMA view0 that can be performed by the DMA Master transfer...
#define SPI_MODE_3
SPI mode 3.
#define US_CSR_TXRDY
(US_CSR) Transmitter Ready (cleared by writing US_THR)
#define taskENTER_CRITICAL()
#define SER_INDICATE_RX()
sam_usart_opt_t usart_options
#define ID_USART0
USART 0 (USART0)
port_monitor_helper_t g_portMonitorHelper[MAX_NUMBER_SERIAL_PORTS]
COMPILER_WORD_ALIGNED volatile lld_view0 lld
#define XDMAC_CIS_BIS
(XDMAC_CIS) End of Block Interrupt Status Bit
uint32_t xdmacUsartRxPerId
#define XDMAC_CC_PERID(value)
static uint32_t * s_overrunStatus
#define XDMACCHID_NUMBER
Xdmac hardware registers.
#define XDMAC_CC_SAM_INCREMENTED_AM
(XDMAC_CC) The addressing mode is incremented (the increment size is set to the data size)...
static volatile usartDMA_t g_usartDMA[MAX_NUMBER_SERIAL_PORTS]
int validateBaudRate(unsigned int baudRate)
Returns -1 if the baudrate is not a standard baudrate.
void usart_enable_tx(Usart *p_usart)
Enable USART transmitter.
#define CONF_LOOPBACK_PORT
static void sysclk_enable_peripheral_clock(uint32_t ul_id)
Enable a peripheral's clock.
Autogenerated API include file for the Atmel Software Framework (ASF)
#define XDMAC_GS_ST0
(XDMAC_GS) XDMAC Channel 0 Status Bit
#define XDMAC_PERID_USART2_TX
static int serRxFreeDma(dmaBuffer_rx_t *dma)
#define _ARRAY_ELEMENT_COUNT(a)
static int serEnable(int serialNum)
#define UART0
(UART0 ) Base Address
#define USART2
(USART2) Base Address
volatile uint32_t lastUsedRx
#define XDMAC_GE_EN0
(XDMAC_GE) XDMAC Channel 0 Enable Bit
COMPILER_WORD_ALIGNED volatile lld_view0 lld_spi_noData[DMA_LLD_COUNT]
#define XDMAC_UBC_NVIEW_NDV0
#define XDMAC_PERID_UART0_RX
#define XDMAC_CC_MBSIZE_SINGLE
(XDMAC_CC) The memory burst size is set to one.
#define UART4
(UART4 ) Base Address
int serRxUsed(int serialNum)
Returns number of bytes used in Rx buffer.
#define DCACHE_CLEAN_INVALIDATE_MEMCPY(dst, src, size)
#define Assert(expr)
This macro is used to test fatal errors.
#define XDMAC_CIM_BIM
(XDMAC_CIM) End of Block Interrupt Mask Bit
#define XDMAC_PERID_UART3_RX
#define XDMAC_CC_DWIDTH_BYTE
(XDMAC_CC) The data size is set to 8 bits
__IO uint32_t XDMAC_CNDA
(XdmacChid Offset: 0x18) Channel Next Descriptor Address Register
#define XDMAC_PERID_UART1_TX
#define US_CR_RSTSTA
(US_CR) Reset Status Bits
#define ID_USART2
USART 2 (USART2)
volatile uint32_t timestampRx
#define UART2
(UART2 ) Base Address
int serWrite(int serialNum, const unsigned char *buf, int size)
Write data on USART. Returns number of bytes written.
#define ID_UART4
UART 4 (UART4)