This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 87d74d141a8 LIN:adjust the LIN flag
87d74d141a8 is described below

commit 87d74d141a843c3400266d15c7d13b1012346a99
Author: wangxiaoxin <[email protected]>
AuthorDate: Mon Dec 2 14:13:53 2024 +0800

    LIN:adjust the LIN flag
    
    Fix incorrect and non-existent flag usage in LIN handling:
    
    - Replace undefined CANFD_FLAGS_BITS usage with valid bit definitions.
    - Reassign CAN_TCF_FLAG to an available flag bit, as it is not defined in 
can.h.
    - Add an identifier for LIN noise error frames.
    
    Signed-off-by: wangxiaoxin <[email protected]>
---
 include/nuttx/lin.h | 65 +++++++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 29 deletions(-)

diff --git a/include/nuttx/lin.h b/include/nuttx/lin.h
index e6a603edbdf..8eb7044347c 100644
--- a/include/nuttx/lin.h
+++ b/include/nuttx/lin.h
@@ -40,35 +40,40 @@
 #define LIN_ID_MASK               ((1 << LIN_ID_BITS) - 1)
 #define LIN_ID_MAX                LIN_ID_MASK
 
-#define LIN_CTRL_FLAG             CAN_EFF_FLAG  /* Describe control 
information (such as write etc.) */
-#define LIN_RTR_FLAG              CAN_RTR_FLAG  /* Describe the direction of 
sending and receiving */
-#define LIN_ERR_FLAG              CAN_ERR_FLAG  /* The flag indicates this is 
LIN err_frame */
+/* Describe control information (such as write etc.) */
 
-/* Bit flags on can_frame.types
- *
- * Use can_frame.types to identify other special frame.
- *
- * LIN_TCF_FLAG : TxConfirmation message frame. Lower_half use this flag to
- *                confirm frame-transmit
- *
- * LIN_EVT_FLAG : Event message frame. Lower_half use this flag to report
- *                state switch event
- *
- * LIN_CACHE_RESP_FLAG: When slave response to master, slave node should send
- *                      frame immediately which already be cached in last
- *                      transmission in case of response interval over time.
- *
- * LIN_CHKSUM_EXT_FLAG: LIN checksum have two types, default type will be
- *                      classic checksum
- *
- * LIN_SINGLE_RESP_FLAG: Cache LIN frame only work once, then will be cleared
- */
+#define LIN_CTRL_FLAG             CAN_EFF_FLAG
+
+/* Describe the direction of sending and receiving */
+
+#define LIN_RTR_FLAG              CAN_RTR_FLAG
+
+/* The flag indicate  this is LIN err_frame */
+
+#define LIN_ERR_FLAG              CAN_ERR_FLAG
+
+/* Lower_half report state switch event frame */
 
-#define LIN_TCF_FLAG              CAN_TCF_FLAG
 #define LIN_EVT_FLAG              CAN_EVT_FLAG
-#define LIN_CACHE_RESP_FLAG       (1 << (CANFD_FLAGS_BITS + 2))
-#define LIN_CHKSUM_EXT_FLAG       (1 << (CANFD_FLAGS_BITS + 3))
-#define LIN_SINGLE_RESP_FLAG      (1 << (CANFD_FLAGS_BITS + 4))
+
+/* When slave response to master, slave node should send frame immediately
+ * which already be cached in last transmission in case of response interval
+ * over time
+ */
+
+#define LIN_CACHE_RESPONSE        (1 << (LIN_ID_BITS))
+
+/* LIN checksum have two types, default type will be classic checksum */
+
+#define LIN_CHECKSUM_EXTENDED     (1 << (LIN_ID_BITS + 1))
+
+/* Cache LIN frame only work once. then will be clear */
+
+#define LIN_SINGLE_RESPONSE       (1 << (LIN_ID_BITS + 2))
+
+/* TxConfirmation frame. Lower_half use the flag to confirm frame-transmit */
+
+#define LIN_TCF_FLAG              (1 << (LIN_ID_BITS + 3))
 
 /* LIN Error Indications ****************************************************/
 
@@ -76,13 +81,14 @@
  * The error frame consists of err_flag(LIN_ERR_FLAG)、err_class
  * (defined in data[0]) and err_reason(defined in data[1] to data[4]).
  * The error frame is described using the following structure:
- * begin_packed_struct struct can_frame {
+ * struct can_frame {
  *    canid_t can_id;
  *    uint8_t can_dlc;
- *    uint16_t flags;
+ *    uint8_t __pad;
+ *    uint8_t __res0;
  *    uint8_t __res1;
  *    uint8_t data[CAN_MAX_DLEN] __attribute__((aligned(8)));
- *  } end_packed_struct;
+ *  };
  *
  * Error frame description format:
  *
@@ -143,6 +149,7 @@
 #define LIN_ERR_CRTL_UNSPEC       0x00     /* Unspecified error */
 #define LIN_ERR_CRTL_RXOVERFLOW   (1 << 0) /* Hardware controller receive 
overflow */
 #define LIN_ERR_CTRL_FRAMEERROR   (1 << 1) /* Hardware controller frame error 
*/
+#define LIN_ERR_CTRL_NOISE        (1 << 2) /* Hardware controller noise error 
*/
 
 /* LIN States Indications ***************************************************/
 

Reply via email to