can: Add RX timestamp to zcan_frame

This commit introduces a timestamp for received CAN frames.
The timestamp is optional and can be activated via Kconfig.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
Alexander Wachter 2019-07-24 15:34:51 +02:00 committed by Jukka Rissanen
commit 3febaad1d6
2 changed files with 15 additions and 0 deletions

View file

@ -42,6 +42,14 @@ config CAN_WORKQ_FRAMES_BUF_CNT
help
Number of frames in the buffer of a zcan_work.
config CAN_RX_TIMESTAMP
bool "Enable receiving timestamps"
depends on CAN_STM32
help
This option enables a timestamp value of the CAN free running timer.
The value is incremented every bit time and starts when the controller
is initialized.
config CAN_0
bool "Enable CAN 0"
help

View file

@ -173,6 +173,13 @@ struct zcan_frame {
u8_t data[8];
u32_t data_32[2];
};
#if defined(CONFIG_CAN_RX_TIMESTAMP)
/** Timer value of the CAN free running timer.
* The timer is incremented every bit time and captured at the start
* of frame bit (SOF).
*/
u16_t timestamp;
#endif
} __packed;
/**