-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
can: add support for MSCAN module of KEA MCU family
Signed-off-by: Anton Gerasimov <[email protected]>
- Loading branch information
Anton Gerasimov
committed
Feb 7, 2019
1 parent
6037fa2
commit 223103b
Showing
5 changed files
with
718 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (C) 2018 HERE Deutschland GmbH | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser General | ||
* Public License v2.1. See the file LICENSE in the top level directory for more | ||
* details. | ||
*/ | ||
|
||
/** | ||
* @defgroup cpu_kinetis_mscan MSCAN driver | ||
* @ingroup cpu_kinetis | ||
* @brief Implementation of the driver for CAN controller in Kinetis KEA | ||
* MCUs | ||
* | ||
* @{ | ||
* | ||
* @file | ||
* @brief Interface definition for the MSCAN driver. | ||
* | ||
* @author Anton Gerasimov <[email protected]> | ||
*/ | ||
|
||
#ifndef MSCAN_H | ||
#define MSCAN_H | ||
|
||
#include "can/candev.h" | ||
#include "can/device.h" | ||
|
||
#ifndef CANDEV_KEA_DEFAULT_BITRATE | ||
/** | ||
* Default bitrate setup | ||
*/ | ||
#define CANDEV_KEA_DEFAULT_BITRATE (50000) | ||
#endif | ||
|
||
#ifndef CANDEV_KEA_DEFAULT_SPT | ||
/** | ||
* Default sampling point setup | ||
*/ | ||
#define CANDEV_KEA_DEFAULT_SPT (875) | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
/** | ||
* @brief Board-specific MSCAN configuration | ||
*/ | ||
typedef struct candev_kea_conf { | ||
uint32_t clock_freq; /**< input clock frequency */ | ||
candev_params_t params; /**< device parameters */ | ||
} candev_kea_conf_t; | ||
|
||
/** | ||
* @brief MSCAN-specific "subclass" of candev_t | ||
*/ | ||
typedef struct candev_kea { | ||
candev_t candev; /**< candev base structure */ | ||
canopt_state_t mode; /**< power state */ | ||
const candev_kea_conf_t *conf; /**< device configuration */ | ||
|
||
} candev_kea_t; | ||
|
||
/** | ||
* @brief Initialize device with configuration | ||
* | ||
* @return 0 on success | ||
* @return <0 on error | ||
*/ | ||
int candev_kea_init(candev_kea_t *dev, const candev_kea_conf_t *conf); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* MSCAN_H */ | ||
|
||
/** @} */ |
Oops, something went wrong.