socketlin : add lin.h and lin bus-type

Add lin.h adn lin bus-type

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
This commit is contained in:
gaohedong 2024-08-31 17:39:33 +08:00 committed by Xiang Xiao
parent 427e5f18e8
commit 5172da6b16
2 changed files with 89 additions and 1 deletions

88
include/nuttx/lin.h Normal file
View File

@ -0,0 +1,88 @@
/****************************************************************************
* include/nuttx/lin.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_LIN_H
#define __INCLUDE_NUTTX_LIN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/can.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define LIN_ID_BITS 6
#define LIN_ID_MASK ((1 << LIN_ID_BITS) - 1)
#define LIN_ID_MAX LIN_ID_MASK
#define LIN_CTRL_FRAME CAN_EFF_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;
*/
#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))
/* Error flags */
#define LIN_ERR_RX_TIMEOUT (1 << (LIN_ID_BITS + 3))
#define LIN_ERR_CHECKSUM (1 << (LIN_ID_BITS + 4))
#define LIN_ERR_FRAMING (1 << (LIN_ID_BITS + 5))
/* TxConfirmation flag */
#define LIN_TCF_FRAMING (1 << (LIN_ID_BITS + 6))
/* Event flag */
#define LIN_EVT_FRAMING (1 << (LIN_ID_BITS + 7))
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_LIN_H */

View File

@ -111,7 +111,7 @@ enum net_lltype_e
NET_LL_IEEE802154, /* IEEE 802.15.4 MAC */
NET_LL_PKTRADIO, /* Non-standard packet radio */
NET_LL_MBIM, /* CDC-MBIM USB host driver */
NET_LL_CAN, /* CAN bus */
NET_LL_CAN, /* CAN/LIN bus */
NET_LL_CELL /* Cellular Virtual Network Device */
};