COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
kpc9612p_lib.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
37 #ifndef _KPC9612PLIB_H
38 #define _KPC9612PLIB_H 1
39 
40 
41 #include "support/configCosmos.h"
42 
43 #include <stdio.h>
44 #include <errno.h>
45 
47 #include "support/cosmos-errno.h"
48 
49 #define KPC9612P_MTU 254
50 #define KPC9612P_PAYLOAD_SIZE KPC9612P_MTU
51 
52 //#define KPC9612P_PAYLOAD_SIZE 255
53 #define KPC9612P_FULL_SIZE (KPC9612P_PAYLOAD_SIZE+19)
54 #define AX25_FLAG 0x7E
55 #define AX25_NOLAYER3 0xF0
56 
57 #define KPC9612P_ID 1
58 #define KPC9612P_BAUD 19200
59 #define KPC9612P_BITS 8
60 #define KPC9612P_PARITY 0
61 #define KPC9612P_STOPBITS 1
62 
64 {
65  union
66  {
67  struct
68  {
69  union
70  {
71  struct
72  {
73  uint8_t flag;
75  char source_address[7];
76  uint8_t control;
77  uint8_t protocol_id;
78  } header;
79  uint8_t preamble[17];
80  };
82  } part;
84  };
85  uint16_t size;
86 };
87 
89 {
92  uint8_t flag;
93 };
94 
95 int32_t kpc9612p_connect(char *dev, kpc9612p_handle *handle, uint8_t flag);
99 int32_t kpc9612p_loadframe(kpc9612p_handle *handle, uint8_t *data, uint16_t size);
100 int32_t kpc9612p_loadframe(kpc9612p_handle *handle, vector<uint8_t> data);
101 int32_t kpc9612p_unloadframe(kpc9612p_handle *handle, uint8_t *data, uint16_t size);
102 int32_t kpc9612p_unloadframe(kpc9612p_handle *handle, vector<uint8_t> &data);
103 uint16_t kpc9612p_calc_fcs(uint8_t *data, uint16_t length);
107 
108 
109 #endif
char destination_address[7]
Definition: kpc9612p_lib.h:74
int32_t kpc9612p_sendframe(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:130
uint16_t kpc9612p_calc_fcs(uint8_t *data, uint16_t length)
Definition: kpc9612p_lib.cpp:67
#define KPC9612P_FULL_SIZE
Definition: kpc9612p_lib.h:53
uint8_t flag
Definition: kpc9612p_lib.h:73
int32_t kpc9612p_exitkiss(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:220
struct kpc9612p_frame::@12::@14 part
char source_address[7]
Definition: kpc9612p_lib.h:75
struct kpc9612p_frame::@12::@14::@15::@17 header
#define KPC9612P_PAYLOAD_SIZE
Definition: kpc9612p_lib.h:50
int32_t kpc9612p_entercmd(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:237
int32_t kpc9612p_connect(char *dev, kpc9612p_handle *handle, uint8_t flag)
Definition: kpc9612p_lib.cpp:78
Simple Serial library header file.
uint8_t preamble[17]
Definition: kpc9612p_lib.h:79
int32_t kpc9612p_unloadframe(kpc9612p_handle *handle, uint8_t *data, uint16_t size)
Definition: kpc9612p_lib.cpp:192
Definition: kpc9612p_lib.h:63
kpc9612p_frame frame
Definition: kpc9612p_lib.h:91
Headers and definitions common to all COSMOS.
cssl_t * serial
Definition: kpc9612p_lib.h:90
COSMOS Error Codes.
uint8_t payload[254+2]
Definition: kpc9612p_lib.h:81
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
uint8_t flag
Definition: kpc9612p_lib.h:92
png_uint_32 length
Definition: png.c:2173
int32_t kpc9612p_recvframe(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:111
int32_t kpc9612p_enterkiss(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:230
uint8_t protocol_id
Definition: kpc9612p_lib.h:77
int32_t kpc9612p_loadframe(kpc9612p_handle *handle, uint8_t *data, uint16_t size)
Definition: kpc9612p_lib.cpp:140
int32_t kpc9612p_disconnect(kpc9612p_handle *handle)
Definition: kpc9612p_lib.cpp:103
uint16_t size
Definition: kpc9612p_lib.h:85
uint8_t full[(254+19)]
Definition: kpc9612p_lib.h:83
Definition: kpc9612p_lib.h:88
Definition: cssl_lib.h:34
uint8_t control
Definition: kpc9612p_lib.h:76