amiro-blt / Target / Source / gateway.h @ 73410535
History | View | Annotate | Download (6.501 KB)
1 |
/************************************************************************************//** |
---|---|
2 |
* \file Source\gateway.h
|
3 |
* \brief Bootloader gateway interface header file. Needs the communication module!
|
4 |
* \ingroup Core
|
5 |
* \internal
|
6 |
*----------------------------------------------------------------------------------------
|
7 |
* C O P Y R I G H T
|
8 |
*----------------------------------------------------------------------------------------
|
9 |
* Copyright (c) 2011 by Feaser http://www.feaser.com All rights reserved
|
10 |
*
|
11 |
*----------------------------------------------------------------------------------------
|
12 |
* L I C E N S E
|
13 |
*----------------------------------------------------------------------------------------
|
14 |
* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or
|
15 |
* modify it under the terms of the GNU General Public License as published by the Free
|
16 |
* Software Foundation, either version 3 of the License, or (at your option) any later
|
17 |
* version.
|
18 |
*
|
19 |
* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
20 |
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
21 |
* PURPOSE. See the GNU General Public License for more details.
|
22 |
*
|
23 |
* You should have received a copy of the GNU General Public License along with OpenBLT.
|
24 |
* If not, see <http://www.gnu.org/licenses/>.
|
25 |
*
|
26 |
* A special exception to the GPL is included to allow you to distribute a combined work
|
27 |
* that includes OpenBLT without being obliged to provide the source code for any
|
28 |
* proprietary components. The exception text is included at the bottom of the license
|
29 |
* file <license.html>.
|
30 |
*
|
31 |
* \endinternal
|
32 |
****************************************************************************************/
|
33 |
#ifndef GATE_H
|
34 |
#define GATE_H
|
35 |
|
36 |
#if (BOOT_GATE_ENABLE > 0) |
37 |
|
38 |
#if (BOOT_COM_ENABLE <= 0) |
39 |
/****************************************************************************************
|
40 |
* Macro definitions
|
41 |
****************************************************************************************/
|
42 |
/** \brief Defines the maximum number of bytes for transport layer reception
|
43 |
* depending on the activates interface(s).
|
44 |
*/
|
45 |
#define BOOT_COM_RX_MAX_DATA (1) |
46 |
/* update in case CAN interface uses more */
|
47 |
#if (BOOT_COM_CAN_RX_MAX_DATA > BOOT_COM_RX_MAX_DATA)
|
48 |
#undef BOOT_COM_RX_MAX_DATA
|
49 |
#define BOOT_COM_RX_MAX_DATA (BOOT_COM_CAN_RX_MAX_DATA)
|
50 |
#endif
|
51 |
/* update in case UART interface uses more */
|
52 |
#if (BOOT_COM_UART_RX_MAX_DATA > BOOT_COM_RX_MAX_DATA)
|
53 |
#undef BOOT_COM_RX_MAX_DATA
|
54 |
#define BOOT_COM_RX_MAX_DATA (BOOT_COM_UART_RX_MAX_DATA)
|
55 |
#endif
|
56 |
/* update in case USB interface uses more */
|
57 |
#if (BOOT_COM_USB_RX_MAX_DATA > BOOT_COM_RX_MAX_DATA)
|
58 |
#undef BOOT_COM_RX_MAX_DATA
|
59 |
#define BOOT_COM_RX_MAX_DATA (BOOT_COM_USB_RX_MAX_DATA)
|
60 |
#endif
|
61 |
/* update in case NET interface uses more */
|
62 |
#if (BOOT_COM_NET_RX_MAX_DATA > BOOT_COM_RX_MAX_DATA)
|
63 |
#undef BOOT_COM_RX_MAX_DATA
|
64 |
#define BOOT_COM_RX_MAX_DATA (BOOT_COM_NET_RX_MAX_DATA)
|
65 |
#endif
|
66 |
|
67 |
/** \brief Defines the maximum number of bytes for transport layer transmission
|
68 |
* depending on the activates interface(s).
|
69 |
*/
|
70 |
#define BOOT_COM_TX_MAX_DATA (1) |
71 |
/* update in case CAN interface uses more */
|
72 |
#if (BOOT_COM_CAN_TX_MAX_DATA > BOOT_COM_TX_MAX_DATA)
|
73 |
#undef BOOT_COM_TX_MAX_DATA
|
74 |
#define BOOT_COM_TX_MAX_DATA (BOOT_COM_CAN_TX_MAX_DATA)
|
75 |
#endif
|
76 |
/* update in case UART interface uses more */
|
77 |
#if (BOOT_COM_UART_TX_MAX_DATA > BOOT_COM_TX_MAX_DATA)
|
78 |
#undef BOOT_COM_TX_MAX_DATA
|
79 |
#define BOOT_COM_TX_MAX_DATA (BOOT_COM_UART_TX_MAX_DATA)
|
80 |
#endif
|
81 |
/* update in case USB interface uses more */
|
82 |
#if (BOOT_COM_USB_TX_MAX_DATA > BOOT_COM_TX_MAX_DATA)
|
83 |
#undef BOOT_COM_TX_MAX_DATA
|
84 |
#define BOOT_COM_TX_MAX_DATA (BOOT_COM_USB_TX_MAX_DATA)
|
85 |
#endif
|
86 |
/* update in case NET interface uses more */
|
87 |
#if (BOOT_COM_NET_TX_MAX_DATA > BOOT_COM_TX_MAX_DATA)
|
88 |
#undef BOOT_COM_TX_MAX_DATA
|
89 |
#define BOOT_COM_TX_MAX_DATA (BOOT_COM_NET_TX_MAX_DATA)
|
90 |
#endif
|
91 |
|
92 |
#endif /* BOOT_COM_ENABLE <= 0 */ |
93 |
|
94 |
|
95 |
/****************************************************************************************
|
96 |
* Plausibility
|
97 |
****************************************************************************************/
|
98 |
#if (BOOT_COM_TX_MAX_DATA < 1) |
99 |
#undef BOOT_COM_TX_MAX_DATA
|
100 |
#define BOOT_COM_TX_MAX_DATA (8) |
101 |
#endif
|
102 |
|
103 |
#if (BOOT_COM_TX_MAX_DATA > 256) |
104 |
#error "COM.H, BOOT_COM_TX_MAX_DATA cannot be larger than 256." |
105 |
#endif
|
106 |
|
107 |
#if (BOOT_COM_RX_MAX_DATA < 1) |
108 |
#undef BOOT_COM_RX_MAX_DATA
|
109 |
#define BOOT_COM_RX_MAX_DATA (8) |
110 |
#endif
|
111 |
|
112 |
#if (BOOT_COM_RX_MAX_DATA > 65536) |
113 |
#error "COM.H, BOOT_COM_RX_MAX_DATA cannot be larger than 65536." |
114 |
#endif
|
115 |
|
116 |
|
117 |
/****************************************************************************************
|
118 |
* Type definitions
|
119 |
****************************************************************************************/
|
120 |
/** \brief Enumeration for the different gateway interfaces. */
|
121 |
typedef enum |
122 |
{ |
123 |
GATE_IF_UART, /**< UART interface */
|
124 |
GATE_IF_CAN, /**< CAN interface */
|
125 |
GATE_IF_USB, /**< USB interface */
|
126 |
GATE_IF_NET, /**< NET interface */
|
127 |
GATE_IF_OTHER /**< Other interface */
|
128 |
} tGateInterfaceId; |
129 |
|
130 |
|
131 |
/****************************************************************************************
|
132 |
* Function prototypes
|
133 |
****************************************************************************************/
|
134 |
void GateInit(void); |
135 |
void GateTask(void); |
136 |
void GateFree(void); |
137 |
blt_int16u GateGetActiveInterfaceMaxRxLen(void);
|
138 |
blt_int16u GateGetActiveInterfaceMaxTxLen(void);
|
139 |
void GateTransmitPacket(blt_int8u *data, blt_int16u len);
|
140 |
#if (BOOT_GATE_CAN_ENABLE > 0) |
141 |
void GateTransmitPacketDirect(blt_int8u *data, blt_int8u len, blt_int32u deviceID);
|
142 |
#endif
|
143 |
blt_bool GateIsConnected(void);
|
144 |
#if (BOOT_DEBUGGING_UART2_ENABLE > 0) |
145 |
void BuildData(blt_int8u *debugData, blt_int8u *data, blt_int8u len);
|
146 |
#endif
|
147 |
|
148 |
#if (BOOT_DEBUGGING_UART2_ENABLE > 0) |
149 |
blt_int8u debugDataRCan[8];
|
150 |
blt_int8u debugDataTCan[8];
|
151 |
#endif
|
152 |
|
153 |
#endif /* BOOT_GATE_ENABLE > 0 */ |
154 |
|
155 |
#endif /* GATE_H */ |
156 |
/*********************************** end of gateway.h **************************************/
|