Skip to content

Commit 5172da6

Browse files
HedongGaoxiaoxiang781216
authored andcommitted
socketlin : add lin.h and lin bus-type
Add lin.h adn lin bus-type Signed-off-by: gaohedong <[email protected]>
1 parent 427e5f1 commit 5172da6

File tree

2 files changed

+89
-1
lines changed

2 files changed

+89
-1
lines changed

include/nuttx/lin.h

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/****************************************************************************
2+
* include/nuttx/lin.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __INCLUDE_NUTTX_LIN_H
22+
#define __INCLUDE_NUTTX_LIN_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <nuttx/config.h>
29+
#include <nuttx/can.h>
30+
31+
/****************************************************************************
32+
* Pre-processor Definitions
33+
****************************************************************************/
34+
35+
#define LIN_ID_BITS 6
36+
#define LIN_ID_MASK ((1 << LIN_ID_BITS) - 1)
37+
#define LIN_ID_MAX LIN_ID_MASK
38+
39+
#define LIN_CTRL_FRAME CAN_EFF_FLAG
40+
41+
/* When slave response to master, slave node should send frame immediately
42+
* which already be cached in last transmission in case of response interval
43+
* over time;
44+
*/
45+
46+
#define LIN_CACHE_RESPONSE (1 << (LIN_ID_BITS))
47+
48+
/* LIN checksum have two types, default type will be classic checksum */
49+
50+
#define LIN_CHECKSUM_EXTENDED (1 << (LIN_ID_BITS + 1))
51+
52+
/* Cache LIN frame only work once. then will be clear */
53+
54+
#define LIN_SINGLE_RESPONSE (1 << (LIN_ID_BITS + 2))
55+
56+
/* Error flags */
57+
58+
#define LIN_ERR_RX_TIMEOUT (1 << (LIN_ID_BITS + 3))
59+
#define LIN_ERR_CHECKSUM (1 << (LIN_ID_BITS + 4))
60+
#define LIN_ERR_FRAMING (1 << (LIN_ID_BITS + 5))
61+
62+
/* TxConfirmation flag */
63+
64+
#define LIN_TCF_FRAMING (1 << (LIN_ID_BITS + 6))
65+
66+
/* Event flag */
67+
68+
#define LIN_EVT_FRAMING (1 << (LIN_ID_BITS + 7))
69+
70+
/****************************************************************************
71+
* Public Function Prototypes
72+
****************************************************************************/
73+
74+
#undef EXTERN
75+
#if defined(__cplusplus)
76+
#define EXTERN extern "C"
77+
extern "C"
78+
{
79+
#else
80+
#define EXTERN extern
81+
#endif
82+
83+
#undef EXTERN
84+
#if defined(__cplusplus)
85+
}
86+
#endif
87+
88+
#endif /* __INCLUDE_NUTTX_LIN_H */

include/nuttx/net/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ enum net_lltype_e
111111
NET_LL_IEEE802154, /* IEEE 802.15.4 MAC */
112112
NET_LL_PKTRADIO, /* Non-standard packet radio */
113113
NET_LL_MBIM, /* CDC-MBIM USB host driver */
114-
NET_LL_CAN, /* CAN bus */
114+
NET_LL_CAN, /* CAN/LIN bus */
115115
NET_LL_CELL /* Cellular Virtual Network Device */
116116
};
117117

0 commit comments

Comments
 (0)