Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ MCAN1 Loopback Test

Device Drivers -> CAN Driver support
CONFIG_CAN=y # Enable the upper-half CAN driver
CONFIG_CAN_FIFOSIZE=8
CONFIG_CAN_TXFIFOSIZE=8
CONFIG_CAN_RXFIFOSIZE=8
CONFIG_CAN_NPENDINGRTR=4

System Type -> SAMV7 Peripheral Selections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ MCAN1 Loopback Test

Device Drivers -> CAN Driver support
CONFIG_CAN=y # Enable the upper-half CAN driver
CONFIG_CAN_FIFOSIZE=8
CONFIG_CAN_TXFIFOSIZE=8
CONFIG_CAN_RXFIFOSIZE=8
CONFIG_CAN_NPENDINGRTR=4

System Type -> SAMV7 Peripheral Selections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ Cloudctrl-specific Configuration Options

CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,11 @@ M3 Wildfire-specific Configuration Options
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ HY-Mini specific Configuration Options
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,11 @@ Shenzhou-specific Configuration Options

CONFIG_CAN - Enables CAN support (one or both of CONFIG_STM32_CAN1 or
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@ STM3210E-EVAL-specific Configuration Options
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ STM32 Tiny - specific Configuration Options
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ STM32F103 Minimum - specific Configuration Options
CONFIG_STM32_CAN2 must also be defined)
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.
CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8
CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8
CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Default: 4
Expand Down
7 changes: 6 additions & 1 deletion Documentation/platforms/arm/stm32f2/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ CAN
- CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID.
Default Standard 11-bit IDs.

- CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
- CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Expand Down
7 changes: 6 additions & 1 deletion Documentation/platforms/arm/stm32f3/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ CAN character device
- CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.

- CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
- CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Expand Down
7 changes: 6 additions & 1 deletion Documentation/platforms/arm/stm32f4/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ CAN
- CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
Standard 11-bit IDs.

- CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages.
- CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests.
Expand Down
8 changes: 7 additions & 1 deletion Documentation/platforms/arm/stm32f7/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ CAN

- CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default Standard 11-bit IDs.

- CONFIG_CAN_FIFOSIZE - The size of the circular buffer of CAN messages. Default: 8
- CONFIG_CAN_TXFIFOSIZE - The size of the circular tx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_RXFIFOSIZE - The size of the circular rx buffer
of CAN messages.
Default: 8

- CONFIG_CAN_NPENDINGRTR - The size of the list of pending RTR requests. Default: 4

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/at32/at32_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ static int at32can_rxinterrupt(struct can_dev_s *dev, int rxmb)
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* Extract the RTR bit */

Expand Down Expand Up @@ -1895,7 +1895,7 @@ static int at32can_sceinterrupt(int irq, void *context, void *arg)
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the error report to the upper half logic */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/lpc17xx_40xx/lpc17_40_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ static void can_interrupt(struct lpc17_40_can_s *dev)
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = ((rfs & CAN_RFS_FF) != 0);
#else
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

if ((rfs & CAN_RFS_FF) != 0)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/sama5/sam_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ static inline void can_rxinterrupt(struct can_dev_s *dev, int mbndx,
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the CAN message to the upper half logic */

Expand Down
14 changes: 7 additions & 7 deletions arch/arm/src/sama5/sam_mcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -3459,14 +3459,14 @@ static void mcan_error(struct can_dev_s *dev, uint32_t status)
{
/* Format the CAN header for the error report. */

hdr.ch_id = errbits;
hdr.ch_dlc = CAN_ERROR_DLC;
hdr.ch_rtr = 0;
hdr.ch_error = 1;
hdr.ch_id = errbits;
hdr.ch_dlc = CAN_ERROR_DLC;
hdr.ch_rtr = 0;
hdr.ch_error = 1;
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the error report to the upper half logic */

Expand Down Expand Up @@ -3628,7 +3628,7 @@ static void mcan_receive(struct can_dev_s *dev, uint32_t *rxbuffer,
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

if ((regval & BUFFER_R0_RTR) != 0)
{
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/src/samv7/sam_mcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -3483,7 +3483,7 @@ static void mcan_error(struct can_dev_s *dev, uint32_t status)
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the error report to the upper half logic */

Expand Down Expand Up @@ -3535,9 +3535,9 @@ static void mcan_receive(struct can_dev_s *dev, uint32_t *rxbuffer,
reginfo("R0: %08" PRIx32 "\n", regval);

#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0;
hdr.ch_error = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

if ((regval & BUFFER_R0_RTR) != 0)
{
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/stm32/stm32_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ static int stm32can_rxinterrupt(struct can_dev_s *dev, int rxmb)
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* Extract the RTR bit */

Expand Down Expand Up @@ -1890,7 +1890,7 @@ static int stm32can_sceinterrupt(int irq, void *context, void *arg)
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the error report to the upper half logic */

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/src/stm32/stm32_fdcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2801,7 +2801,7 @@ static void fdcan_error(struct can_dev_s *dev, uint32_t status)
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* And provide the error report to the upper half logic */

Expand Down Expand Up @@ -2846,7 +2846,7 @@ static void fdcan_receive(struct can_dev_s *dev,
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* Extract the RTR bit */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32f7/stm32_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ static int stm32can_rxinterrupt(struct can_dev_s *dev, int rxmb)
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* Extract the RTR bit */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/stm32l4/stm32l4_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ static int stm32l4can_rxinterrupt(int irq, void *context, int rxmb)
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;

/* Extract the RTR bit */

Expand Down
25 changes: 22 additions & 3 deletions drivers/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,37 @@ config CAN_FD
---help---
Enables support for the CAN_FD mode.

config CAN_FIFOSIZE
int "CAN driver I/O buffer size"
config CAN_TXFIFOSIZE
int "CAN driver I/O tx buffer size"
default 8
range 1 255
---help---
The size of the circular buffer of CAN messages. Default: 8
The size of the circular tx buffer of CAN messages. Default: 8

config CAN_RXFIFOSIZE
int "CAN driver I/O rx buffer size"
default 8
range 1 255
---help---
The size of the circular rx buffer of CAN messages. Default: 8

config CAN_NPENDINGRTR
int "Number of pending RTRs"
default 4
---help---
The size of the list of pending RTR requests. Default: 4

config CAN_TXCONFIRM
bool "can txconfirm ability"
default n
---help---
this section enables the can txconfirm ability.

Enabling this feature adds support for the can txconfirm
ability, the ability is used from CAN interrupt handler
when the transfer is complete, the ability will notify all
readers that the canid has been transferred.

config CAN_TXREADY
bool "can_txready interface"
default n
Expand Down
Loading