aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates/can_lld.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-02 10:06:54 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-02 10:06:54 +0000
commit099fc179cc2ce75fd43ed6c5524aea4ca5d77ea0 (patch)
treef0a8b9dd7f4b621271affc529bb922872efcadf7 /os/hal/templates/can_lld.h
parenteaa8acff48439e8b416dc396e7fceb0ae3daaa8e (diff)
downloadChibiOS-099fc179cc2ce75fd43ed6c5524aea4ca5d77ea0.tar.gz
ChibiOS-099fc179cc2ce75fd43ed6c5524aea4ca5d77ea0.tar.bz2
ChibiOS-099fc179cc2ce75fd43ed6c5524aea4ca5d77ea0.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7456 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates/can_lld.h')
-rw-r--r--os/hal/templates/can_lld.h70
1 files changed, 20 insertions, 50 deletions
diff --git a/os/hal/templates/can_lld.h b/os/hal/templates/can_lld.h
index bfa9bb1e5..1c3eefeb9 100644
--- a/os/hal/templates/can_lld.h
+++ b/os/hal/templates/can_lld.h
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
/**
- * @file templates/can_lld.h
- * @brief CAN Driver subsystem low level driver header template.
+ * @file PLATFORM/can_lld.h
+ * @brief PLATFORM CAN subsystem low level driver header.
*
* @addtogroup CAN
* @{
@@ -31,22 +31,6 @@
/* Driver constants. */
/*===========================================================================*/
-/**
- * @brief This switch defines whether the driver implementation supports
- * a low power switch mode with automatic an wakeup feature.
- */
-#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. */
/*===========================================================================*/
@@ -60,7 +44,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
/** @} */
@@ -68,10 +52,6 @@
/* Derived constants and error checks. */
/*===========================================================================*/
-#if CAN_USE_SLEEP_MODE && !CAN_SUPPORTS_SLEEP
-#error "CAN sleep mode not supported in this architecture"
-#endif
-
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -114,6 +94,10 @@ typedef struct {
*/
typedef struct {
struct {
+ uint8_t FMI; /**< @brief Filter id. */
+ uint16_t TIME; /**< @brief Time stamp. */
+ };
+ struct {
uint8_t DLC:4; /**< @brief Data length. */
uint8_t RTR:1; /**< @brief Frame type. */
uint8_t IDE:1; /**< @brief Identifier type. */
@@ -134,22 +118,10 @@ typedef struct {
} CANRxFrame;
/**
- * @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 {
- uint32_t dummy;
-} CANFilter;
-
-/**
* @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 {
+ /* End of the mandatory fields.*/
uint32_t dummy;
} CANConfig;
@@ -166,13 +138,13 @@ typedef struct {
*/
const CANConfig *config;
/**
- * @brief Transmission queue semaphore.
+ * @brief Transmission threads queue.
*/
- Semaphore txsem;
+ threads_queue_t txqueue;
/**
- * @brief Receive queue semaphore.
+ * @brief Receive threads queue.
*/
- Semaphore rxsem;
+ threads_queue_t rxqueue;
/**
* @brief One or more frames become available.
* @note After broadcasting this event it will not be broadcasted again
@@ -185,29 +157,29 @@ typedef struct {
* @note The flags associated to the listeners will indicate which
* receive mailboxes become non-empty.
*/
- EventSource rxfull_event;
+ event_source_t rxfull_event;
/**
* @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;
+ event_source_t txempty_event;
/**
* @brief A CAN bus error happened.
* @note The flags associated to the listeners will indicate the
* error(s) that have occurred.
*/
- EventSource error_event;
+ event_source_t error_event;
#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
/**
* @brief Entering sleep state event.
*/
- EventSource sleep_event;
+ event_source_t sleep_event;
/**
* @brief Exiting sleep state event.
*/
- EventSource wakeup_event;
+ event_source_t wakeup_event;
#endif /* CAN_USE_SLEEP_MODE */
/* End of the mandatory fields.*/
} CANDriver;
@@ -230,13 +202,11 @@ extern "C" {
void can_lld_init(void);
void can_lld_start(CANDriver *canp);
void can_lld_stop(CANDriver *canp);
- bool_t can_lld_is_tx_empty(CANDriver *canp,
- canmbx_t mailbox);
+ bool 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);
+ bool can_lld_is_rx_nonempty(CANDriver *canp, canmbx_t mailbox);
void can_lld_receive(CANDriver *canp,
canmbx_t mailbox,
CANRxFrame *ctfp);