diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2018-09-11 15:37:36 +0200 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2018-09-25 14:46:22 +0200 |
commit | 01010e72728a979b0a991576d1101d19829ecec5 (patch) | |
tree | e636978754c914767ca9df791c5164c2f2a9be31 /drivers/fsl_flexcan.h | |
parent | 44b9ce104362ecc6b8850afbf97ce8007845c869 (diff) |
Improved CAN, locking and general IRQ performance
Fixes issues with CAN stopping when overwhelmed by data RX\TX.
Keeps can in freezemode until explicitly activated.
CANINTF_TX is now a CAN TX in progress flag.
Runtime asserts are now disabled.
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'drivers/fsl_flexcan.h')
-rw-r--r-- | drivers/fsl_flexcan.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/fsl_flexcan.h b/drivers/fsl_flexcan.h index e6baa93..40246fe 100644 --- a/drivers/fsl_flexcan.h +++ b/drivers/fsl_flexcan.h @@ -31,6 +31,8 @@ #define _FSL_FLEXCAN_H_ #include "fsl_common.h" +#include "FreeRTOS.h" +#include "task.h" /*! * @addtogroup flexcan_driver @@ -41,6 +43,11 @@ * Definitions *****************************************************************************/ +#define CAN_CTRLMODE_NORMAL 0x00 /* normal mode */ +#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ +#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ +#define CAN_CTRLMODE_3_SAMPLES 0x03 /* Triple sampling mode */ + /*! @name Driver version */ /*@{*/ /*! @brief FlexCAN driver version 2.2.0. */ @@ -400,7 +407,7 @@ typedef struct _flexcan_handle flexcan_handle_t; * If the status equals to other FlexCAN Message Buffer transfer status, the result is meaningless and should be * Ignored. */ -typedef void (*flexcan_transfer_callback_t)( +typedef BaseType_t (*flexcan_transfer_callback_t)( CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData); /*! @brief FlexCAN handle structure. */ @@ -487,6 +494,24 @@ void FLEXCAN_GetDefaultConfig(flexcan_config_t *config); */ /*! + * @brief Enter FlexCAN Freeze Mode. + * + * This function makes the FlexCAN work under Freeze Mode. + * + * @param base FlexCAN peripheral base address. + */ +void FLEXCAN_EnterFreezeMode(CAN_Type *base); + +/*! + * @brief Exit FlexCAN Freeze Mode. + * + * This function makes the FlexCAN leave Freeze Mode. + * + * @param base FlexCAN peripheral base address. + */ +void FLEXCAN_ExitFreezeMode(CAN_Type *base); + +/*! * @brief Sets the FlexCAN protocol timing characteristic. * * This function gives user settings to CAN bus timing characteristic. @@ -504,6 +529,8 @@ void FLEXCAN_SetTimingConfig(CAN_Type *base, const flexcan_timing_config_t *conf void FLEXCAN_SetBitRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps); +void FLEXCAN_SetMode(CAN_Type *base, uint32_t mode); + /*! * @brief Sets the FlexCAN receive message buffer global mask. * |