Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_ADSB/GDL90_protocol/hostGDL90Support.h
Views: 1799
/*1Copyright (C) 2021 Kraus Hamdani Aerospace Inc. All rights reserved.23This program is free software: you can redistribute it and/or modify4it under the terms of the GNU General Public License as published by5the Free Software Foundation, either version 3 of the License, or6(at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program. If not, see <http://www.gnu.org/licenses/>.151617Author: GDL90/UCP protocol by uAvionix, 2021.18Implemented by: Tom Pittenger19*/2021#ifndef _GDL90_H_22#define _GDL90_H_2324#include <stdint.h>2526#define GDL90_QUEUE_LENGTH (2)2728#define GDL90_FLAG_BYTE (0x7E)29#define GDL90_CONTROL_ESCAPE_BYTE (0x7D)30#define GDL90_STUFF_BYTE (0x20)31#define GDL90_OVERHEAD_LENGTH (3) // Not counting framing bytes323334// Transmit message sizes35#define GDL90_TX_MAX_PAYLOAD_LENGTH (552)36#define GDL90_TX_MAX_PACKET_LENGTH (GDL90_TX_MAX_PAYLOAD_LENGTH + GDL90_OVERHEAD_LENGTH)37#define GDL90_TX_MAX_FRAME_LENGTH (2 + ((15 * GDL90_TX_MAX_PACKET_LENGTH) / 10)) // IF every other byte was stuffed3839// Receive message sizes40#define GDL90_RX_MAX_PAYLOAD_LENGTH (128)41#define GDL90_RX_MAX_PACKET_LENGTH (GDL90_RX_MAX_PAYLOAD_LENGTH + GDL90_OVERHEAD_LENGTH)4243typedef union __attribute__((__packed__))44{45struct __attribute__((__packed__))46{47GDL90_MESSAGE_ID messageId;48uint8_t payload[GDL90_TX_MAX_PAYLOAD_LENGTH];49uint16_t crc; // Actually CRC location varies. This is a placeholder50};51uint8_t raw[GDL90_TX_MAX_PACKET_LENGTH];52} GDL90_TX_MESSAGE;5354typedef union __attribute__((__packed__))55{56struct __attribute__((__packed__))57{58GDL90_MESSAGE_ID messageId;59uint8_t payload[GDL90_RX_MAX_PAYLOAD_LENGTH];60uint16_t crc; // Actually CRC location varies. This is a placeholder61};62uint8_t raw[GDL90_RX_MAX_PACKET_LENGTH];63} GDL90_RX_MESSAGE;6465typedef enum66{67GDL90_RX_IDLE,68GDL90_RX_IN_PACKET,69GDL90_RX_UNSTUFF,70} GDL90_RX_STATE;7172typedef struct73{74GDL90_RX_STATE state;75uint16_t length;76uint8_t prev_data;77} GDL90_RX_STATUS;7879#endif808182