drivers: can: Implement Bosch M_CAN driver
Implementation of the Bosch M_CAN IP driver. This driver is just the base for a specific SoC implementation. Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
This commit is contained in:
parent
2ccbfd661e
commit
1c50ef6c43
12 changed files with 2846 additions and 2 deletions
24
drivers/can/can_stm32fd.c
Normal file
24
drivers/can/can_stm32fd.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Alexander Wachter
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <drivers/can.h>
|
||||
|
||||
u32_t can_mcan_get_core_clock(struct device *dev)
|
||||
{
|
||||
u32_t core_clock = LL_RCC_GetFDCANClockFreq(LL_RCC_FDCAN_CLKSOURCE);
|
||||
u32_t dbrp, nbrp;
|
||||
|
||||
#if CONFIG_CAN_CKDIV != 0
|
||||
core_clock /= CONFIG_CAN_CKDIV * 2;
|
||||
#endif
|
||||
|
||||
__weak void can_mcan_clock_enable()
|
||||
{
|
||||
LL_RCC_SetFDCANClockSource(LL_RCC_FDCAN_CLKSOURCE_PCLK1);
|
||||
__HAL_RCC_FDCAN_CLK_ENABLE();
|
||||
|
||||
FDCAN_CONFIG->CKDIV = CONFIG_CAN_CKDIV;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue