|
| 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 */ |
0 commit comments