|
PER Firmware
|
G4 FDCAN private/register level implementation. More...
#include <stdint.h>#include "stm32g474xx.h"Go to the source code of this file.
Enumerations | |
| enum | PHAL_FDCAN_DefaultFilterAction_t : uint32_t { FDCAN_PRIV_FILTER_ACCEPT_IN_RX_FIFO0 = 0x00000000U , FDCAN_PRIV_FILTER_REJECT = 0x00000002U } |
Functions | |
| uint32_t | PHAL_FDCAN_priv_ramBase (const FDCAN_GlobalTypeDef *fdcan) |
| Base address of this peripheral's slice of shared message RAM. | |
| void | PHAL_FDCAN_priv_enableClock (void) |
| Enable FDCAN kernel + peripheral clocks (PCLK1) | |
| void | PHAL_FDCAN_priv_enterConfig (FDCAN_GlobalTypeDef *fdcan) |
| Enter INIT mode and unlock configuration registers. Blocks until entered. | |
| void | PHAL_FDCAN_priv_exitConfig (FDCAN_GlobalTypeDef *fdcan) |
| Leave INIT mode, ending configuration. Blocks until left. | |
| void | PHAL_FDCAN_priv_controlConfig (FDCAN_GlobalTypeDef *fdcan) |
| void | PHAL_FDCAN_priv_setTransmitFifoQueueModeToFifo (FDCAN_GlobalTypeDef *fdcan) |
| Set TX FIFO/Queue mode to FIFO (not queue) | |
| void | PHAL_FDCAN_setInterruptLines (FDCAN_GlobalTypeDef *fdcan) |
| Set up RX new message -> line 0, TX complete -> line 1. | |
| void | PHAL_FDCAN_priv_writeFilterAction (FDCAN_GlobalTypeDef *fdcan, PHAL_FDCAN_DefaultFilterAction_t action) |
| Write a filter action to RXGFC (accept/reject all) | |
| uint32_t | PHAL_FDCAN_priv_getNBTP (PHAL_FDCAN_BaudRate_t bit_rate) |
| void | PHAL_FDCAN_priv_writeStandardFilters (FDCAN_GlobalTypeDef *fdcan, const uint32_t *sid_list, uint32_t num_sid) |
| Set num_sid exact-match standard filters and forward to RX FIFO0. | |
| void | PHAL_FDCAN_priv_writeExtendedFilters (FDCAN_GlobalTypeDef *fdcan, const uint32_t *xid_list, uint32_t num_xid) |
| Set num_xid exact-match extended filters and forward to RX FIFO0. | |
| void | PHAL_FDCAN_priv_writeTxElement (FDCAN_GlobalTypeDef *fdcan, CanMsgTypeDef_t *msg) |
| bool | PHAL_FDCAN_priv_readRxElement (FDCAN_GlobalTypeDef *fdcan, CanMsgTypeDef_t *msg) |
| Pop and decode the oldest element from RX FIFO0. | |
| bool | PHAL_FDCAN_priv_readTxFifoQueueStatusFullFlag (const FDCAN_GlobalTypeDef *fdcan) |
| Check whether the TX FIFO/Queue is full. | |
| bool | PHAL_FDCAN_priv_readReceiveFifo0NewMessageInterruptFlag (const FDCAN_GlobalTypeDef *fdcan) |
| Check whether the RX FIFO0 new message interrupt flag is set. | |
| void | PHAL_FDCAN_priv_clearReceiveFifo0NewMessageInterruptFlag (FDCAN_GlobalTypeDef *fdcan) |
| Clear the RX FIFO0 new message interrupt flag. | |
| bool | PHAL_FDCAN_priv_readTransmitCompleteInterruptFlag (const FDCAN_GlobalTypeDef *fdcan) |
| Check whether the TX complete interrupt flag is set. | |
| void | PHAL_FDCAN_priv_clearTransmitCompleteInterruptFlag (FDCAN_GlobalTypeDef *fdcan) |
| Clear the TX complete interrupt flag. | |
Variables | |
| static constexpr uint32_t | FDCAN_PRIV_KER_CLK_HZ = 16'000'000U |
| static constexpr uint32_t | FDCAN_PRIV_RCC_FDCANCLKSOURCE_PCLK1 = RCC_CCIPR_FDCANSEL_1 |
| FDCAN clock is derived from PCLK1. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLS_NBR = 28 |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLE_NBR = 8 |
| Max standard id filters. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF0_NBR = 3 |
| Max extended id filters. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF1_NBR = 3 |
| RX FIFO 0 Elements Number. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TEF_NBR = 3 |
| RX FIFO 1 Elements Number. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TFQ_NBR = 3 |
| TX Event FIFO Elements Number. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLS_SIZE = 1 * 4 |
| TX FIFO Elements Number. | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLE_SIZE = 2 * 4 |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF0_SIZE = 18 * 4 |
| Size in bytes of one RX FIFO 0 element (set by the hardware format) | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF1_SIZE = 18 * 4 |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TEF_SIZE = 2 * 4 |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TFQ_SIZE = 18 * 4 |
| Size in bytes of one TX FIFO/queue element (set by the hardware format) | |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLSSA = 0 |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_FLESA = FDCAN_PRIV_SRAMCAN_FLSSA + FDCAN_PRIV_SRAMCAN_FLS_NBR * FDCAN_PRIV_SRAMCAN_FLS_SIZE |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF0SA = FDCAN_PRIV_SRAMCAN_FLESA + FDCAN_PRIV_SRAMCAN_FLE_NBR * FDCAN_PRIV_SRAMCAN_FLE_SIZE |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_RF1SA = FDCAN_PRIV_SRAMCAN_RF0SA + FDCAN_PRIV_SRAMCAN_RF0_NBR * FDCAN_PRIV_SRAMCAN_RF0_SIZE |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TEFSA = FDCAN_PRIV_SRAMCAN_RF1SA + FDCAN_PRIV_SRAMCAN_RF1_NBR * FDCAN_PRIV_SRAMCAN_RF1_SIZE |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_TFQSA = FDCAN_PRIV_SRAMCAN_TEFSA + FDCAN_PRIV_SRAMCAN_TEF_NBR * FDCAN_PRIV_SRAMCAN_TEF_SIZE |
| static constexpr uint32_t | FDCAN_PRIV_SRAMCAN_SIZE = FDCAN_PRIV_SRAMCAN_TFQSA + FDCAN_PRIV_SRAMCAN_TFQ_NBR * FDCAN_PRIV_SRAMCAN_TFQ_SIZE |
| Bytes required/consumed by one instance's full Message RAM layout (filters + RX FIFOs + TX event FIFO + TX FIFO) | |
G4 FDCAN private/register level implementation.
| enum PHAL_FDCAN_DefaultFilterAction_t : uint32_t |
| void PHAL_FDCAN_priv_clearReceiveFifo0NewMessageInterruptFlag | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Clear the RX FIFO0 new message interrupt flag.
| void PHAL_FDCAN_priv_clearTransmitCompleteInterruptFlag | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Clear the TX complete interrupt flag.
| void PHAL_FDCAN_priv_controlConfig | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
| void PHAL_FDCAN_priv_enableClock | ( | void | ) |
Enable FDCAN kernel + peripheral clocks (PCLK1)
| void PHAL_FDCAN_priv_enterConfig | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Enter INIT mode and unlock configuration registers. Blocks until entered.
| void PHAL_FDCAN_priv_exitConfig | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Leave INIT mode, ending configuration. Blocks until left.
| uint32_t PHAL_FDCAN_priv_getNBTP | ( | PHAL_FDCAN_BaudRate_t | bit_rate | ) |
Compute the NBTP register value for one of the supported bit rates. 16-time-quantum nominal bit time (~87.5% sample point)
| uint32_t PHAL_FDCAN_priv_ramBase | ( | const FDCAN_GlobalTypeDef * | fdcan | ) |
Base address of this peripheral's slice of shared message RAM.
| bool PHAL_FDCAN_priv_readReceiveFifo0NewMessageInterruptFlag | ( | const FDCAN_GlobalTypeDef * | fdcan | ) |
Check whether the RX FIFO0 new message interrupt flag is set.
| bool PHAL_FDCAN_priv_readRxElement | ( | FDCAN_GlobalTypeDef * | fdcan, |
| CanMsgTypeDef_t * | msg ) |
Pop and decode the oldest element from RX FIFO0.
| bool PHAL_FDCAN_priv_readTransmitCompleteInterruptFlag | ( | const FDCAN_GlobalTypeDef * | fdcan | ) |
Check whether the TX complete interrupt flag is set.
| bool PHAL_FDCAN_priv_readTxFifoQueueStatusFullFlag | ( | const FDCAN_GlobalTypeDef * | fdcan | ) |
Check whether the TX FIFO/Queue is full.
| void PHAL_FDCAN_priv_setTransmitFifoQueueModeToFifo | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Set TX FIFO/Queue mode to FIFO (not queue)
| void PHAL_FDCAN_priv_writeExtendedFilters | ( | FDCAN_GlobalTypeDef * | fdcan, |
| const uint32_t * | xid_list, | ||
| uint32_t | num_xid ) |
Set num_xid exact-match extended filters and forward to RX FIFO0.
| void PHAL_FDCAN_priv_writeFilterAction | ( | FDCAN_GlobalTypeDef * | fdcan, |
| PHAL_FDCAN_DefaultFilterAction_t | action ) |
Write a filter action to RXGFC (accept/reject all)
| void PHAL_FDCAN_priv_writeStandardFilters | ( | FDCAN_GlobalTypeDef * | fdcan, |
| const uint32_t * | sid_list, | ||
| uint32_t | num_sid ) |
Set num_sid exact-match standard filters and forward to RX FIFO0.
| void PHAL_FDCAN_priv_writeTxElement | ( | FDCAN_GlobalTypeDef * | fdcan, |
| CanMsgTypeDef_t * | msg ) |
Write one classic-CAN TX element for msg into the next free TX FIFO slot Not safe to call if the TX FIFO is full
| void PHAL_FDCAN_setInterruptLines | ( | FDCAN_GlobalTypeDef * | fdcan | ) |
Set up RX new message -> line 0, TX complete -> line 1.
|
staticconstexpr |
The FDCAN kernel clock frequency (the clock NBTP's prescaler divides down. Our HAL for FDCAN is always clocked from PCLK1. NOTE: delicate to PCLK1 changes!!
|
staticconstexpr |
FDCAN clock is derived from PCLK1.
|
staticconstexpr |
Max standard id filters.
|
staticconstexpr |
|
staticconstexpr |
Filter List Extended Start Address
|
staticconstexpr |
|
staticconstexpr |
TX FIFO Elements Number.
|
staticconstexpr |
Filter List Standard Start Address
|
staticconstexpr |
Max extended id filters.
|
staticconstexpr |
Size in bytes of one RX FIFO 0 element (set by the hardware format)
|
staticconstexpr |
Rx FIFO 0 Start Address
|
staticconstexpr |
RX FIFO 0 Elements Number.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Bytes required/consumed by one instance's full Message RAM layout (filters + RX FIFOs + TX event FIFO + TX FIFO)
|
staticconstexpr |
RX FIFO 1 Elements Number.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
TX Event FIFO Elements Number.
|
staticconstexpr |
Size in bytes of one TX FIFO/queue element (set by the hardware format)
|
staticconstexpr |
Tx FIFO/Queue Start Address