48 extern __eds__ ECANMSG __esos_ecan_msgBuf[__ESOS_ECAN_HW_NUM_BUFS] __attribute__((space(dma),aligned(__ESOS_ECAN_HW_NUM_BUFS*16),eds));
50 void __esos_ecan_hw_config_ecan (
void ) {
53 CHANGE_MODE_ECAN1(ECAN_MODE_CONFIGURE);
59 C1FCTRL = ECAN_FIFO_START_AREA_1 | ECAN_DMA_BUF_SIZE_8;
64 for ( u8_i = 0; u8_i < 8; u8_i++ ) {
65 if ( u8_i < __ESOS_ECAN_HW_NUM_TX_BUFS ) {
72 __esos_ecan_hw_config_dma_tx();
73 __esos_ecan_hw_config_dma_rx();
76 RPINR26bits.C1RXR = 101;
81 void __esos_ecan_hw_config_dma_tx (
void ) {
84 DMA0PAD = (
unsigned int) &C1TXD;
85 DMA0REQ = DMA_IRQ_ECAN1TX;
86 DMA0STAL = (
unsigned int) &__esos_ecan_msgBuf;
87 DMA0STAH = (
unsigned int) &__esos_ecan_msgBuf;
92 DMA_DIR_WRITE_PERIPHERAL |
95 DMA_AMODE_PERIPHERAL_INDIRECT |
102 void __esos_ecan_hw_config_dma_rx (
void ) {
104 DMA1PAD = (
unsigned int) &C1RXD;
105 DMA1REQ = DMA_IRQ_ECAN1RX;
106 DMA1STAL = (
unsigned int) &__esos_ecan_msgBuf;
107 DMA1STAH = (
unsigned int) &__esos_ecan_msgBuf;
112 DMA_DIR_READ_PERIPHERAL |
115 DMA_AMODE_PERIPHERAL_INDIRECT |
122 void __esos_ecan_hw_mark_message_received ( uint16_t u16_rx_buff_id ) {
129 void __esos_ecan_hw_format_and_send ( ECANMSG *p_temp_Msg, uint16_t u16_can_id,
uint8_t u8_payload_len ) {
131 __esos_ecan_msgBuf[0] = *p_temp_Msg;
void clrRxFullOvfFlagsECAN1(void)
void clrRxFullFlagECAN1(uint8_t u8_bufNum)
void formatStandardDataFrameECAN(ECANMSG *p_ecanmsg, uint16_t u16_id, uint8_t u8_len)
void configRxFilterECAN1(uint8_t u8_filtNum, uint32_t u32_id, uint8_t u8_idType, uint8_t u8_bufnum, uint8_t u8_maskReg)
void configTxRxBufferECAN1(uint8_t u8_bufNum, uint8_t u8_type, uint8_t u8_priority)
This is the master include file for implementing ESOS on Microchip PIC24 MCUs.
void startTxECAN1(uint8_t u8_bufNum)
This file contains routines which configure and use an ECAN interface on the Microchip PIC24 MCUs...
#define CONFIG_C1TX_TO_RP(Rxy_RP)
unsigned char uint8_t
An abbreviation for an 8-bit unsigned integer.
void configBaudECAN1(void)
void configRxMaskECAN1(uint8_t u8_maskNum, uint32_t u32_idMask, uint8_t u8_idType, uint8_t u8_matchType)