From 16178e1c45a76544d34ce63db37932838353637c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 28 Nov 2009 12:25:35 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1333 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 154 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 os/hal/templates/can_lld.h (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h new file mode 100644 index 000000000..c899055c6 --- /dev/null +++ b/os/hal/templates/can_lld.h @@ -0,0 +1,154 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file templates/can_lld.h + * @brief CAN Driver subsystem low level driver header template + * @addtogroup CAN_LLD + * @{ + */ + +#ifndef _CAN_LLD_H_ +#define _CAN_LLD_H_ + +#if CH_HAL_USE_CAN + +/** + * @brief This switch defines whether the driver implementation supports + * a low power switch mode with automatic an wakeup feature. + */ +#define CAN_SUPPORTS_SLEEP TRUE + +/*===========================================================================*/ +/* Driver pre-compile time settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + * @note This switch is enforced to @p FALSE if the driver implementation + * does not support the sleep mode. + */ +#if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif +#else /* !CAN_SUPPORTS_SLEEP */ +#define CAN_USE_SLEEP_MODE FALSE +#endif /* !CAN_SUPPORTS_SLEEP */ + +/*===========================================================================*/ +/* Driver constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver data structures and types. */ +/*===========================================================================*/ + +/** + * @brief CAN frame. + * @note Accessing the frame data as word16 or word32 is not portable because + * machine data endianness, it can be still useful for a quick filling. + */ +typedef struct { + uint8_t cf_DLC:4; /**< @brief Data length. */ + uint8_t cf_IDE:1; /**< @brief Identifier type. */ + uint8_t cf_RTR:1; /**< @brief Frame type. */ + uint32_t cf_id; /**< @brief Frame identifier. */ + union { + uint8_t cf_data8[8]; /**< @brief Frame data. */ + uint16_t cf_data16[4]; /**< @brief Frame data. */ + uint32_t cf_data32[2]; /**< @brief Frame data. */ + }; +} CANFrame; + +/** + * @brief Driver configuration structure. + * @note It could be empty on some architectures. + */ +typedef struct { +} CANConfig; + +/** + * @brief Structure representing an CAN driver. + */ +typedef struct { + /** + * @brief Driver state. + */ + canstate_t can_state; + /** + * @brief Current configuration data. + */ + const CANConfig *can_config; + /** + * @brief Transmission queue semaphore. + */ + Semaphore can_txsem; + /** + * @brief Receive queue semaphore. + */ + Semaphore can_rxsem; + /** + * @brief One or more frames become available. + */ + EventSource can_rxfull_event; + /** + * @brief One or more transmission slots become available. + */ + EventSource can_txempty_event; +#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) + /** + * @brief Entering sleep state event. + */ + EventSource can_sleep_event; + /** + * @brief Exiting sleep state event. + */ + EventSource can_wakeup_event; +#endif /* CAN_USE_SLEEP_MODE */ + /* End of the mandatory fields.*/ +} CANDriver; + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +#ifdef __cplusplus +extern "C" { +#endif + void can_lld_init(void); + void can_lld_start(CANDriver *canp); + void can_lld_stop(CANDriver *canp); + bool_t can_lld_can_transmit(CANDriver *canp); + msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp); + bool_t can_lld_can_receive(CANDriver *canp); + msg_t can_lld_receive(CANDriver *canp, CANFrame *cfp); +#if CAN_USE_SLEEP_MODE + void can_lld_sleep(CANDriver *canp); + void can_lld_wakeup(CANDriver *canp); +#endif /* CAN_USE_SLEEP_MODE */ +#ifdef __cplusplus +} +#endif + +#endif /* CH_HAL_USE_CAN */ + +#endif /* _CAN_LLD_H_ */ + +/** @} */ -- cgit v1.2.3 From 0d0e4d619185ad86270ca5c0212c314f7f4529d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 08:25:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1342 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 154 --------------------------------------------- 1 file changed, 154 deletions(-) delete mode 100644 os/hal/templates/can_lld.h (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h deleted file mode 100644 index c899055c6..000000000 --- a/os/hal/templates/can_lld.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. - - This file is part of ChibiOS/RT. - - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/** - * @file templates/can_lld.h - * @brief CAN Driver subsystem low level driver header template - * @addtogroup CAN_LLD - * @{ - */ - -#ifndef _CAN_LLD_H_ -#define _CAN_LLD_H_ - -#if CH_HAL_USE_CAN - -/** - * @brief This switch defines whether the driver implementation supports - * a low power switch mode with automatic an wakeup feature. - */ -#define CAN_SUPPORTS_SLEEP TRUE - -/*===========================================================================*/ -/* Driver pre-compile time settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - * @note This switch is enforced to @p FALSE if the driver implementation - * does not support the sleep mode. - */ -#if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif -#else /* !CAN_SUPPORTS_SLEEP */ -#define CAN_USE_SLEEP_MODE FALSE -#endif /* !CAN_SUPPORTS_SLEEP */ - -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver data structures and types. */ -/*===========================================================================*/ - -/** - * @brief CAN frame. - * @note Accessing the frame data as word16 or word32 is not portable because - * machine data endianness, it can be still useful for a quick filling. - */ -typedef struct { - uint8_t cf_DLC:4; /**< @brief Data length. */ - uint8_t cf_IDE:1; /**< @brief Identifier type. */ - uint8_t cf_RTR:1; /**< @brief Frame type. */ - uint32_t cf_id; /**< @brief Frame identifier. */ - union { - uint8_t cf_data8[8]; /**< @brief Frame data. */ - uint16_t cf_data16[4]; /**< @brief Frame data. */ - uint32_t cf_data32[2]; /**< @brief Frame data. */ - }; -} CANFrame; - -/** - * @brief Driver configuration structure. - * @note It could be empty on some architectures. - */ -typedef struct { -} CANConfig; - -/** - * @brief Structure representing an CAN driver. - */ -typedef struct { - /** - * @brief Driver state. - */ - canstate_t can_state; - /** - * @brief Current configuration data. - */ - const CANConfig *can_config; - /** - * @brief Transmission queue semaphore. - */ - Semaphore can_txsem; - /** - * @brief Receive queue semaphore. - */ - Semaphore can_rxsem; - /** - * @brief One or more frames become available. - */ - EventSource can_rxfull_event; - /** - * @brief One or more transmission slots become available. - */ - EventSource can_txempty_event; -#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) - /** - * @brief Entering sleep state event. - */ - EventSource can_sleep_event; - /** - * @brief Exiting sleep state event. - */ - EventSource can_wakeup_event; -#endif /* CAN_USE_SLEEP_MODE */ - /* End of the mandatory fields.*/ -} CANDriver; - -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - -#ifdef __cplusplus -extern "C" { -#endif - void can_lld_init(void); - void can_lld_start(CANDriver *canp); - void can_lld_stop(CANDriver *canp); - bool_t can_lld_can_transmit(CANDriver *canp); - msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp); - bool_t can_lld_can_receive(CANDriver *canp); - msg_t can_lld_receive(CANDriver *canp, CANFrame *cfp); -#if CAN_USE_SLEEP_MODE - void can_lld_sleep(CANDriver *canp); - void can_lld_wakeup(CANDriver *canp); -#endif /* CAN_USE_SLEEP_MODE */ -#ifdef __cplusplus -} -#endif - -#endif /* CH_HAL_USE_CAN */ - -#endif /* _CAN_LLD_H_ */ - -/** @} */ -- cgit v1.2.3 From d4c616e6eeb0587ca450c75b1086efa77ac690e5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 08:50:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1351 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 154 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 os/hal/templates/can_lld.h (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h new file mode 100644 index 000000000..c899055c6 --- /dev/null +++ b/os/hal/templates/can_lld.h @@ -0,0 +1,154 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file templates/can_lld.h + * @brief CAN Driver subsystem low level driver header template + * @addtogroup CAN_LLD + * @{ + */ + +#ifndef _CAN_LLD_H_ +#define _CAN_LLD_H_ + +#if CH_HAL_USE_CAN + +/** + * @brief This switch defines whether the driver implementation supports + * a low power switch mode with automatic an wakeup feature. + */ +#define CAN_SUPPORTS_SLEEP TRUE + +/*===========================================================================*/ +/* Driver pre-compile time settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + * @note This switch is enforced to @p FALSE if the driver implementation + * does not support the sleep mode. + */ +#if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif +#else /* !CAN_SUPPORTS_SLEEP */ +#define CAN_USE_SLEEP_MODE FALSE +#endif /* !CAN_SUPPORTS_SLEEP */ + +/*===========================================================================*/ +/* Driver constants. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver data structures and types. */ +/*===========================================================================*/ + +/** + * @brief CAN frame. + * @note Accessing the frame data as word16 or word32 is not portable because + * machine data endianness, it can be still useful for a quick filling. + */ +typedef struct { + uint8_t cf_DLC:4; /**< @brief Data length. */ + uint8_t cf_IDE:1; /**< @brief Identifier type. */ + uint8_t cf_RTR:1; /**< @brief Frame type. */ + uint32_t cf_id; /**< @brief Frame identifier. */ + union { + uint8_t cf_data8[8]; /**< @brief Frame data. */ + uint16_t cf_data16[4]; /**< @brief Frame data. */ + uint32_t cf_data32[2]; /**< @brief Frame data. */ + }; +} CANFrame; + +/** + * @brief Driver configuration structure. + * @note It could be empty on some architectures. + */ +typedef struct { +} CANConfig; + +/** + * @brief Structure representing an CAN driver. + */ +typedef struct { + /** + * @brief Driver state. + */ + canstate_t can_state; + /** + * @brief Current configuration data. + */ + const CANConfig *can_config; + /** + * @brief Transmission queue semaphore. + */ + Semaphore can_txsem; + /** + * @brief Receive queue semaphore. + */ + Semaphore can_rxsem; + /** + * @brief One or more frames become available. + */ + EventSource can_rxfull_event; + /** + * @brief One or more transmission slots become available. + */ + EventSource can_txempty_event; +#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) + /** + * @brief Entering sleep state event. + */ + EventSource can_sleep_event; + /** + * @brief Exiting sleep state event. + */ + EventSource can_wakeup_event; +#endif /* CAN_USE_SLEEP_MODE */ + /* End of the mandatory fields.*/ +} CANDriver; + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +#ifdef __cplusplus +extern "C" { +#endif + void can_lld_init(void); + void can_lld_start(CANDriver *canp); + void can_lld_stop(CANDriver *canp); + bool_t can_lld_can_transmit(CANDriver *canp); + msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp); + bool_t can_lld_can_receive(CANDriver *canp); + msg_t can_lld_receive(CANDriver *canp, CANFrame *cfp); +#if CAN_USE_SLEEP_MODE + void can_lld_sleep(CANDriver *canp); + void can_lld_wakeup(CANDriver *canp); +#endif /* CAN_USE_SLEEP_MODE */ +#ifdef __cplusplus +} +#endif + +#endif /* CH_HAL_USE_CAN */ + +#endif /* _CAN_LLD_H_ */ + +/** @} */ -- cgit v1.2.3 From f90ae4d17df24cd6477f2557bc86ef9433e93414 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 Nov 2009 10:37:31 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1354 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index c899055c6..202f7e044 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -27,7 +27,7 @@ #ifndef _CAN_LLD_H_ #define _CAN_LLD_H_ -#if CH_HAL_USE_CAN +#if CH_HAL_USE_CAN || defined(__DOXYGEN__) /** * @brief This switch defines whether the driver implementation supports -- cgit v1.2.3 From 8a433087afe80e92aea1c558965994b53bfcfb48 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 30 Nov 2009 21:34:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1368 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 202f7e044..14588c0d5 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -60,6 +60,11 @@ /* Driver data structures and types. */ /*===========================================================================*/ +/** + * @brief CAN status flags. + */ +typedef uint32_t canstatus_t; + /** * @brief CAN frame. * @note Accessing the frame data as word16 or word32 is not portable because @@ -91,36 +96,44 @@ typedef struct { /** * @brief Driver state. */ - canstate_t can_state; + canstate_t cd_state; /** * @brief Current configuration data. */ - const CANConfig *can_config; + const CANConfig *cd_config; /** - * @brief Transmission queue semaphore. + * @brief Transmission queue semaphore. */ - Semaphore can_txsem; + Semaphore cd_txsem; /** * @brief Receive queue semaphore. */ - Semaphore can_rxsem; + Semaphore cd_rxsem; + /** + * @brief One or more frames become available. + */ + EventSource cd_rxfull_event; + /** + * @brief One or more transmission slots become available. + */ + EventSource cd_txempty_event; /** - * @brief One or more frames become available. + * @brief A CAN bus error happened. */ - EventSource can_rxfull_event; + EventSource cd_error_event; /** - * @brief One or more transmission slots become available. + * @brief Error flags set when an error event is broadcasted. */ - EventSource can_txempty_event; + canstatus_t cd_status; #if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) /** - * @brief Entering sleep state event. + * @brief Entering sleep state event. */ - EventSource can_sleep_event; + EventSource cd_sleep_event; /** - * @brief Exiting sleep state event. + * @brief Exiting sleep state event. */ - EventSource can_wakeup_event; + EventSource cd_wakeup_event; #endif /* CAN_USE_SLEEP_MODE */ /* End of the mandatory fields.*/ } CANDriver; -- cgit v1.2.3 From 03a0255b043e9a418e96cf3b3e0564ed2f6efe8e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 4 Dec 2009 20:56:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1374 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 74 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 13 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 14588c0d5..9b1124a18 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -29,6 +29,10 @@ #if CH_HAL_USE_CAN || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver constants. */ +/*===========================================================================*/ + /** * @brief This switch defines whether the driver implementation supports * a low power switch mode with automatic an wakeup feature. @@ -52,10 +56,6 @@ #define CAN_USE_SLEEP_MODE FALSE #endif /* !CAN_SUPPORTS_SLEEP */ -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ @@ -66,21 +66,63 @@ typedef uint32_t canstatus_t; /** - * @brief CAN frame. + * @brief CAN transmission frame. + * @note Accessing the frame data as word16 or word32 is not portable because + * machine data endianness, it can be still useful for a quick filling. + */ +typedef struct { + struct { + uint8_t cf_DLC:4; /**< @brief Data length. */ + uint8_t cf_RTR:1; /**< @brief Frame type. */ + uint8_t cf_IDE:1; /**< @brief Identifier type. */ + }; + union { + struct { + uint32_t cf_SID:11; /**< @brief Standard identifier.*/ + }; + struct { + uint32_t cf_EID:29; /**< @brief Extended identifier.*/ + }; + }; + union { + uint8_t cf_data8[8]; /**< @brief Frame data. */ + uint16_t cf_data16[4]; /**< @brief Frame data. */ + uint32_t cf_data32[2]; /**< @brief Frame data. */ + }; +} CANTxFrame; + +/** + * @brief CAN received frame. * @note Accessing the frame data as word16 or word32 is not portable because - * machine data endianness, it can be still useful for a quick filling. + * machine data endianness, it can be still useful for a quick filling. */ typedef struct { - uint8_t cf_DLC:4; /**< @brief Data length. */ - uint8_t cf_IDE:1; /**< @brief Identifier type. */ - uint8_t cf_RTR:1; /**< @brief Frame type. */ - uint32_t cf_id; /**< @brief Frame identifier. */ + struct { + uint8_t cf_DLC:4; /**< @brief Data length. */ + uint8_t cf_RTR:1; /**< @brief Frame type. */ + uint8_t cf_IDE:1; /**< @brief Identifier type. */ + }; + union { + struct { + uint32_t cf_SID:11; /**< @brief Standard identifier.*/ + }; + struct { + uint32_t cf_EID:29; /**< @brief Extended identifier.*/ + }; + }; union { uint8_t cf_data8[8]; /**< @brief Frame data. */ uint16_t cf_data16[4]; /**< @brief Frame data. */ uint32_t cf_data32[2]; /**< @brief Frame data. */ }; -} CANFrame; +} CANRxFrame; + +/** + * @brief CAN filter. + * @note It could not be present on some architectures. + */ +typedef struct { +} CANFilter; /** * @brief Driver configuration structure. @@ -111,6 +153,12 @@ typedef struct { Semaphore cd_rxsem; /** * @brief One or more frames become available. + * @note After broadcasting this event it will not be broadcasted again + * until the received frames queue has been completely emptied. It + * is not broadcasted for each received frame. It is + * responsibility of the application to empty the queue by repeatedly + * invoking @p chReceive() when listening to this event. This behavior + * minimizes the interrupt served by the system because CAN traffic. */ EventSource cd_rxfull_event; /** @@ -149,9 +197,9 @@ extern "C" { void can_lld_start(CANDriver *canp); void can_lld_stop(CANDriver *canp); bool_t can_lld_can_transmit(CANDriver *canp); - msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp); + void can_lld_transmit(CANDriver *canp, const CANTxFrame *crfp); bool_t can_lld_can_receive(CANDriver *canp); - msg_t can_lld_receive(CANDriver *canp, CANFrame *cfp); + void can_lld_receive(CANDriver *canp, CANRxFrame *ctfp); #if CAN_USE_SLEEP_MODE void can_lld_sleep(CANDriver *canp); void can_lld_wakeup(CANDriver *canp); -- cgit v1.2.3 From bdb7f4ab20bd3daf261ab93dfe733e0ff11dca0f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 17:37:49 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1397 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 9b1124a18..5b41536e1 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -19,7 +19,7 @@ /** * @file templates/can_lld.h - * @brief CAN Driver subsystem low level driver header template + * @brief CAN Driver subsystem low level driver header template. * @addtogroup CAN_LLD * @{ */ -- cgit v1.2.3 From cb565d0734615184aa74eb76981e55ff2aaebd35 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Dec 2009 10:08:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1441 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 5b41536e1..b70c839be 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -56,6 +56,14 @@ #define CAN_USE_SLEEP_MODE FALSE #endif /* !CAN_SUPPORTS_SLEEP */ +/*===========================================================================*/ +/* Derived constants and error checks. */ +/*===========================================================================*/ + +#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS +#error "the ADC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS" +#endif + /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ -- cgit v1.2.3 From fe24da9fcca4967e58b25a2698c46717995de0ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 29 Dec 2009 11:12:05 +0000 Subject: Reorganized sections in HAL files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1473 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index b70c839be..c6f0de0cb 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -194,6 +194,10 @@ typedef struct { /* End of the mandatory fields.*/ } CANDriver; +/*===========================================================================*/ +/* Driver macros. */ +/*===========================================================================*/ + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ -- cgit v1.2.3 From bedb87c1e7cc9741c57c299d81d6e24c5e9c59c5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 13:35:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1495 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index c6f0de0cb..6e55eb2c6 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -60,8 +60,8 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if !CH_USE_SEMAPHORES || !CH_USE_EVENTS -#error "the ADC driver requires CH_USE_SEMAPHORES and CH_USE_EVENTS" +#if CAN_USE_SLEEP_MODE && !CAN_SUPPORTS_SLEEP +#error "CAN sleep mode not supported in this architecture" #endif /*===========================================================================*/ -- cgit v1.2.3 From e4be2c3b13ec4bc059b5b1b2f40c7f84ce6ab77c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 7 Feb 2010 11:11:45 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1583 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 53 ++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 6e55eb2c6..3543e039d 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -18,8 +18,9 @@ */ /** - * @file templates/can_lld.h - * @brief CAN Driver subsystem low level driver header template. + * @file templates/can_lld.h + * @brief CAN Driver subsystem low level driver header template. + * * @addtogroup CAN_LLD * @{ */ @@ -34,8 +35,8 @@ /*===========================================================================*/ /** - * @brief This switch defines whether the driver implementation supports - * a low power switch mode with automatic an wakeup feature. + * @brief This switch defines whether the driver implementation supports + * a low power switch mode with automatic an wakeup feature. */ #define CAN_SUPPORTS_SLEEP TRUE @@ -44,9 +45,9 @@ /*===========================================================================*/ /** - * @brief Sleep mode related APIs inclusion switch. - * @note This switch is enforced to @p FALSE if the driver implementation - * does not support the sleep mode. + * @brief Sleep mode related APIs inclusion switch. + * @note This switch is enforced to @p FALSE if the driver implementation + * does not support the sleep mode. */ #if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) @@ -69,14 +70,15 @@ /*===========================================================================*/ /** - * @brief CAN status flags. + * @brief CAN status flags. */ typedef uint32_t canstatus_t; /** - * @brief CAN transmission frame. - * @note Accessing the frame data as word16 or word32 is not portable because - * machine data endianness, it can be still useful for a quick filling. + * @brief CAN transmission frame. + * @note Accessing the frame data as word16 or word32 is not portable + * because machine data endianness, it can be still useful for a + * quick filling. */ typedef struct { struct { @@ -100,9 +102,10 @@ typedef struct { } CANTxFrame; /** - * @brief CAN received frame. - * @note Accessing the frame data as word16 or word32 is not portable because - * machine data endianness, it can be still useful for a quick filling. + * @brief CAN received frame. + * @note Accessing the frame data as word16 or word32 is not portable + * because machine data endianness, it can be still useful for a + * quick filling. */ typedef struct { struct { @@ -126,21 +129,21 @@ typedef struct { } CANRxFrame; /** - * @brief CAN filter. - * @note It could not be present on some architectures. + * @brief CAN filter. + * @note It could not be present on some architectures. */ typedef struct { } CANFilter; /** - * @brief Driver configuration structure. - * @note It could be empty on some architectures. + * @brief Driver configuration structure. + * @note It could be empty on some architectures. */ typedef struct { } CANConfig; /** - * @brief Structure representing an CAN driver. + * @brief Structure representing an CAN driver. */ typedef struct { /** @@ -161,12 +164,12 @@ typedef struct { Semaphore cd_rxsem; /** * @brief One or more frames become available. - * @note After broadcasting this event it will not be broadcasted again - * until the received frames queue has been completely emptied. It - * is not broadcasted for each received frame. It is - * responsibility of the application to empty the queue by repeatedly - * invoking @p chReceive() when listening to this event. This behavior - * minimizes the interrupt served by the system because CAN traffic. + * @note After broadcasting this event it will not be broadcasted again + * until the received frames queue has been completely emptied. It + * is not broadcasted for each received frame. It is + * responsibility of the application to empty the queue by repeatedly + * invoking @p chReceive() when listening to this event. This behavior + * minimizes the interrupt served by the system because CAN traffic. */ EventSource cd_rxfull_event; /** -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 3543e039d..3049d8a94 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -36,7 +36,7 @@ /** * @brief This switch defines whether the driver implementation supports - * a low power switch mode with automatic an wakeup feature. + * a low power switch mode with automatic an wakeup feature. */ #define CAN_SUPPORTS_SLEEP TRUE @@ -47,7 +47,7 @@ /** * @brief Sleep mode related APIs inclusion switch. * @note This switch is enforced to @p FALSE if the driver implementation - * does not support the sleep mode. + * does not support the sleep mode. */ #if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -- cgit v1.2.3 From 18b825ef0cd7ad3eed9e76310d94178eb27307d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 7 Sep 2010 13:37:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2167 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 3049d8a94..afca6821e 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -130,6 +130,8 @@ typedef struct { /** * @brief CAN filter. + * @note Implementations may extend this structure to contain more, + * architecture dependent, fields. * @note It could not be present on some architectures. */ typedef struct { @@ -137,6 +139,8 @@ typedef struct { /** * @brief Driver configuration structure. + * @note Implementations may extend this structure to contain more, + * architecture dependent, fields. * @note It could be empty on some architectures. */ typedef struct { @@ -144,6 +148,8 @@ typedef struct { /** * @brief Structure representing an CAN driver. + * @note Implementations may extend this structure to contain more, + * architecture dependent, fields. */ typedef struct { /** -- cgit v1.2.3 From 61922d458b3032cca129b795c430eee089864a43 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 25 Oct 2010 18:48:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2291 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index afca6821e..312a664f6 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -21,7 +21,7 @@ * @file templates/can_lld.h * @brief CAN Driver subsystem low level driver header template. * - * @addtogroup CAN_LLD + * @addtogroup CAN * @{ */ -- cgit v1.2.3 From d8be44136c1e6d02ee105ac0791f9e6732551fec Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 1 Nov 2010 17:29:56 +0000 Subject: Fixed bug 3100946, renamed HAL switches removing the CH_ part. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2326 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 312a664f6..37ce7f157 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -28,7 +28,7 @@ #ifndef _CAN_LLD_H_ #define _CAN_LLD_H_ -#if CH_HAL_USE_CAN || defined(__DOXYGEN__) +#if HAL_USE_CAN || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ @@ -229,7 +229,7 @@ extern "C" { } #endif -#endif /* CH_HAL_USE_CAN */ +#endif /* HAL_USE_CAN */ #endif /* _CAN_LLD_H_ */ -- cgit v1.2.3 From 18fb8f676f0f650d83f69bc29ab45b04b73e86c1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Mar 2011 10:09:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2808 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 37ce7f157..4817cdc7f 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -82,22 +82,22 @@ typedef uint32_t canstatus_t; */ typedef struct { struct { - uint8_t cf_DLC:4; /**< @brief Data length. */ - uint8_t cf_RTR:1; /**< @brief Frame type. */ - uint8_t cf_IDE:1; /**< @brief Identifier type. */ + uint8_t DLC:4; /**< @brief Data length. */ + uint8_t RTR:1; /**< @brief Frame type. */ + uint8_t IDE:1; /**< @brief Identifier type. */ }; union { struct { - uint32_t cf_SID:11; /**< @brief Standard identifier.*/ + uint32_t SID:11; /**< @brief Standard identifier.*/ }; struct { - uint32_t cf_EID:29; /**< @brief Extended identifier.*/ + uint32_t EID:29; /**< @brief Extended identifier.*/ }; }; union { - uint8_t cf_data8[8]; /**< @brief Frame data. */ - uint16_t cf_data16[4]; /**< @brief Frame data. */ - uint32_t cf_data32[2]; /**< @brief Frame data. */ + uint8_t data8[8]; /**< @brief Frame data. */ + uint16_t data16[4]; /**< @brief Frame data. */ + uint32_t data32[2]; /**< @brief Frame data. */ }; } CANTxFrame; @@ -109,22 +109,22 @@ typedef struct { */ typedef struct { struct { - uint8_t cf_DLC:4; /**< @brief Data length. */ - uint8_t cf_RTR:1; /**< @brief Frame type. */ - uint8_t cf_IDE:1; /**< @brief Identifier type. */ + uint8_t DLC:4; /**< @brief Data length. */ + uint8_t RTR:1; /**< @brief Frame type. */ + uint8_t IDE:1; /**< @brief Identifier type. */ }; union { struct { - uint32_t cf_SID:11; /**< @brief Standard identifier.*/ + uint32_t SID:11; /**< @brief Standard identifier.*/ }; struct { - uint32_t cf_EID:29; /**< @brief Extended identifier.*/ + uint32_t EID:29; /**< @brief Extended identifier.*/ }; }; union { - uint8_t cf_data8[8]; /**< @brief Frame data. */ - uint16_t cf_data16[4]; /**< @brief Frame data. */ - uint32_t cf_data32[2]; /**< @brief Frame data. */ + uint8_t data8[8]; /**< @brief Frame data. */ + uint16_t data16[4]; /**< @brief Frame data. */ + uint32_t data32[2]; /**< @brief Frame data. */ }; } CANRxFrame; @@ -155,19 +155,19 @@ typedef struct { /** * @brief Driver state. */ - canstate_t cd_state; + canstate_t state; /** * @brief Current configuration data. */ - const CANConfig *cd_config; + const CANConfig *config; /** * @brief Transmission queue semaphore. */ - Semaphore cd_txsem; + Semaphore txsem; /** * @brief Receive queue semaphore. */ - Semaphore cd_rxsem; + Semaphore rxsem; /** * @brief One or more frames become available. * @note After broadcasting this event it will not be broadcasted again @@ -177,28 +177,28 @@ typedef struct { * invoking @p chReceive() when listening to this event. This behavior * minimizes the interrupt served by the system because CAN traffic. */ - EventSource cd_rxfull_event; + EventSource rxfull_event; /** * @brief One or more transmission slots become available. */ - EventSource cd_txempty_event; + EventSource txempty_event; /** * @brief A CAN bus error happened. */ - EventSource cd_error_event; + EventSource error_event; /** * @brief Error flags set when an error event is broadcasted. */ - canstatus_t cd_status; + canstatus_t status; #if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) /** * @brief Entering sleep state event. */ - EventSource cd_sleep_event; + EventSource sleep_event; /** * @brief Exiting sleep state event. */ - EventSource cd_wakeup_event; + EventSource wakeup_event; #endif /* CAN_USE_SLEEP_MODE */ /* End of the mandatory fields.*/ } CANDriver; -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 4817cdc7f..d07bd78cc 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 718dc5084f7719f91eaacfc99e8c7de654eb2ad8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Aug 2011 13:36:25 +0000 Subject: HAL documentation improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3252 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index d07bd78cc..d1f8d6044 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -45,19 +45,6 @@ /* Driver pre-compile time settings. */ /*===========================================================================*/ -/** - * @brief Sleep mode related APIs inclusion switch. - * @note This switch is enforced to @p FALSE if the driver implementation - * does not support the sleep mode. - */ -#if CAN_SUPPORTS_SLEEP || defined(__DOXYGEN__) -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif -#else /* !CAN_SUPPORTS_SLEEP */ -#define CAN_USE_SLEEP_MODE FALSE -#endif /* !CAN_SUPPORTS_SLEEP */ - /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index d1f8d6044..e8ef292b5 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index e8ef292b5..91a3ac4b9 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 679520b160a61950c5746351ab97632ad48f377b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 24 Feb 2013 09:36:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5309 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 102 ++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 34 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 91a3ac4b9..c4bf67937 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -39,12 +39,34 @@ * @brief This switch defines whether the driver implementation supports * a low power switch mode with automatic an wakeup feature. */ -#define CAN_SUPPORTS_SLEEP TRUE +#define CAN_SUPPORTS_SLEEP TRUE + +/** + * @brief This implementation supports three transmit mailboxes. + */ +#define CAN_TX_MAILBOXES 3 + +/** + * @brief This implementation supports two receive mailboxes. + */ +#define CAN_RX_MAILBOXES 2 /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ +/** + * @name Configuration options + * @{ + */ +/** + * @brief CAN1 driver enable switch. + * @details If set to @p TRUE the support for CAN1 is included. + */ +#if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__) +#define PLATFORM_CAN_USE_CAN1 FALSE +#endif + /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ @@ -58,15 +80,14 @@ /*===========================================================================*/ /** - * @brief CAN status flags. + * @brief Type of a transmission mailbox index. */ -typedef uint32_t canstatus_t; +typedef uint32_t canmbx_t; /** * @brief CAN transmission frame. - * @note Accessing the frame data as word16 or word32 is not portable - * because machine data endianness, it can be still useful for a - * quick filling. + * @note Accessing the frame data as word16 or word32 is not portable because + * machine data endianness, it can be still useful for a quick filling. */ typedef struct { struct { @@ -91,9 +112,8 @@ typedef struct { /** * @brief CAN received frame. - * @note Accessing the frame data as word16 or word32 is not portable - * because machine data endianness, it can be still useful for a - * quick filling. + * @note Accessing the frame data as word16 or word32 is not portable because + * machine data endianness, it can be still useful for a quick filling. */ typedef struct { struct { @@ -123,6 +143,7 @@ typedef struct { * @note It could not be present on some architectures. */ typedef struct { + uint32_t dummy; } CANFilter; /** @@ -132,59 +153,62 @@ typedef struct { * @note It could be empty on some architectures. */ typedef struct { + uint32_t dummy; } CANConfig; /** * @brief Structure representing an CAN driver. - * @note Implementations may extend this structure to contain more, - * architecture dependent, fields. */ typedef struct { /** - * @brief Driver state. + * @brief Driver state. */ canstate_t state; /** - * @brief Current configuration data. + * @brief Current configuration data. */ const CANConfig *config; /** - * @brief Transmission queue semaphore. + * @brief Transmission queue semaphore. */ Semaphore txsem; /** - * @brief Receive queue semaphore. + * @brief Receive queue semaphore. */ Semaphore rxsem; /** - * @brief One or more frames become available. - * @note After broadcasting this event it will not be broadcasted again - * until the received frames queue has been completely emptied. It - * is not broadcasted for each received frame. It is - * responsibility of the application to empty the queue by repeatedly - * invoking @p chReceive() when listening to this event. This behavior - * minimizes the interrupt served by the system because CAN traffic. + * @brief One or more frames become available. + * @note After broadcasting this event it will not be broadcasted again + * until the received frames queue has been completely emptied. It + * is not broadcasted for each received frame. It is + * responsibility of the application to empty the queue by + * repeatedly invoking @p chReceive() when listening to this event. + * This behavior minimizes the interrupt served by the system + * because CAN traffic. + * @note The flags associated to the listeners will indicate which + * receive mailboxes become non-empty. */ EventSource rxfull_event; /** - * @brief One or more transmission slots become available. + * @brief One or more transmission mailbox become available. + * @note The flags associated to the listeners will indicate which + * transmit mailboxes become empty. + * */ EventSource txempty_event; /** - * @brief A CAN bus error happened. + * @brief A CAN bus error happened. + * @note The flags associated to the listeners will indicate the + * error(s) that have occurred. */ EventSource error_event; - /** - * @brief Error flags set when an error event is broadcasted. - */ - canstatus_t status; #if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__) /** - * @brief Entering sleep state event. + * @brief Entering sleep state event. */ EventSource sleep_event; /** - * @brief Exiting sleep state event. + * @brief Exiting sleep state event. */ EventSource wakeup_event; #endif /* CAN_USE_SLEEP_MODE */ @@ -199,16 +223,26 @@ typedef struct { /* External declarations. */ /*===========================================================================*/ +#if PLATFORM_CAN_USE_CAN1 && !defined(__DOXYGEN__) +extern CANDriver CAND1; +#endif + #ifdef __cplusplus extern "C" { #endif void can_lld_init(void); void can_lld_start(CANDriver *canp); void can_lld_stop(CANDriver *canp); - bool_t can_lld_can_transmit(CANDriver *canp); - void can_lld_transmit(CANDriver *canp, const CANTxFrame *crfp); - bool_t can_lld_can_receive(CANDriver *canp); - void can_lld_receive(CANDriver *canp, CANRxFrame *ctfp); + bool_t can_lld_is_tx_empty(CANDriver *canp, + canmbx_t mailbox); + void can_lld_transmit(CANDriver *canp, + canmbx_t mailbox, + const CANTxFrame *crfp); + bool_t can_lld_is_rx_nonempty(CANDriver *canp, + canmbx_t mailbox); + void can_lld_receive(CANDriver *canp, + canmbx_t mailbox, + CANRxFrame *ctfp); #if CAN_USE_SLEEP_MODE void can_lld_sleep(CANDriver *canp); void can_lld_wakeup(CANDriver *canp); -- cgit v1.2.3 From 9a1b57db6d7da73e6a1ae070de1835caaf276341 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 24 Feb 2013 10:37:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5312 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 1 + 1 file changed, 1 insertion(+) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index c4bf67937..85db551e8 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -66,6 +66,7 @@ #if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__) #define PLATFORM_CAN_USE_CAN1 FALSE #endif +/** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ -- cgit v1.2.3 From ac598a7b1c4227cbffbbb1af449f2be21e6976a5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 25 Feb 2013 13:10:39 +0000 Subject: LLD templates fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5319 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 85db551e8..97cc4f00f 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -64,7 +64,7 @@ * @details If set to @p TRUE the support for CAN1 is included. */ #if !defined(PLATFORM_CAN_USE_CAN1) || defined(__DOXYGEN__) -#define PLATFORM_CAN_USE_CAN1 FALSE +#define PLATFORM_CAN_USE_CAN1 FALSE #endif /** @} */ -- cgit v1.2.3 From 853216256ad4cdacf5f94edb7d6b738c6be165a1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Mar 2013 10:32:37 +0000 Subject: Relicensing parts of the tree under the Apache 2.0 license. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/templates/can_lld.h | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'os/hal/templates/can_lld.h') diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h index 97cc4f00f..bfa9bb1e5 100644 --- a/os/hal/templates/can_lld.h +++ b/os/hal/templates/can_lld.h @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ /** -- cgit v1.2.3