00001 #ifndef __PACKETS_H
00002 #define __PACKETS_H
00003
00004 #include <stdint.h>
00005 #include <drms_types.h>
00006
00007
00008 #define PACKETHEADERWORDS (19)
00009 #define PACKETHEADERBYTES (2*19)
00010 #define PACKETHEADERBITS (16*19)
00011
00012 #define PACKETDATAWORDS (869)
00013 #define PACKETDATABYTES (2*869)
00014 #define PACKETDATABITS (16*869)
00015
00016
00017 #define PACKETWORDS (PACKETHEADERWORDS+PACKETDATAWORDS)
00018 #define PACKETBYTES (PACKETHEADERBYTES+PACKETDATABYTES)
00019 #define PACKETBITS (PACKETHEADERBITS+PACKETDATABITS)
00020
00021
00022
00023
00024
00025
00026
00027 typedef enum {KW_TYPE_INT8, KW_TYPE_INT16, KW_TYPE_INT32,
00028 KW_TYPE_INT64, KW_TYPE_UINT8, KW_TYPE_UINT16,
00029 KW_TYPE_UINT32, KW_TYPE_UINT64,
00030 KW_TYPE_FLOAT, KW_TYPE_DOUBLE,
00031 KW_TYPE_TIME, KW_TYPE_STRING} KW_Type_t;
00032
00033 typedef union KW_Type_Value
00034 {
00035 int8_t int8_val;
00036 int16_t int16_val;
00037 int32_t int32_val;
00038 int64_t int64_val;
00039 uint8_t uint8_val;
00040 uint16_t uint16_val;
00041 uint32_t uint32_val;
00042 uint64_t uint64_val;
00043 float float_val;
00044 double double_val;
00045 double time_val;
00046 char *string_val;
00047 } KW_Type_Value_t;
00048
00049
00050
00051
00052
00053 #define MAX_KEYWORD_NAME_SIZE 64
00054 #define MAX_FITS_NAME_SIZE 9
00055 typedef struct HK_Keyword_struct {
00056 char name[MAX_KEYWORD_NAME_SIZE];
00057 char fitsname[MAX_FITS_NAME_SIZE];
00058 int64_t raw_value;
00059
00060 KW_Type_t eng_type;
00061 KW_Type_Value_t eng_value;
00062 struct HK_Keyword_struct *next;
00063 } HK_Keyword_t;
00064
00065
00066
00067 typedef struct IM_PDU_Packet_struct
00068 {
00069
00070 uint8_t im_pdu_id;
00071 uint64_t im_pdu_count;
00072
00073 uint8_t spare;
00074 uint16_t fhp;
00075
00076
00077 struct CCSDS_Packet_struct *packets;
00078
00079 } IM_PDU_Packet_t;
00080
00081
00082
00083
00084
00085
00086 typedef struct CCSDS_Packet_struct
00087 {
00088
00089 unsigned char version;
00090 unsigned char type;
00091 unsigned char shf;
00092 unsigned short apid;
00093 unsigned char sf;
00094 unsigned short ssc;
00095 unsigned short length;
00096
00097
00098 HK_Keyword_t *keywords;
00099
00100
00101 struct CCSDS_Packet_struct *next;
00102 } CCSDS_Packet_t;
00103
00104
00105 #if 0
00106
00107
00108
00109 typedef struct SciDataPacket_struct
00110 {
00111
00112 unsigned int shs;
00113 unsigned int shss;
00114 unsigned short ccdhead[4];
00115 short cropid;
00116 unsigned char romode;
00117 unsigned char headererr;
00118 unsigned char oflow;
00119
00120
00121
00122
00123 unsigned char tapcode;
00124 unsigned char bitselectid;
00125 unsigned char compid;
00126 unsigned char lutid;
00127 unsigned int offset;
00128
00129 unsigned short *data;
00130 } SciDataPacket_t;
00131 #endif
00132
00133
00134
00135
00136
00137 int decode_hk_packets(unsigned short *ptr, CCSDS_Packet_t **pk_head);
00138
00139
00140 int decode_hk_keywords(unsigned short *ptr, int apid, HK_Keyword_t **kw_head);
00141
00142 void test_function(int a, int b);
00143
00144 int decode_next_hk_vcdu( unsigned short vcdu[PACKETWORDS], CCSDS_Packet_t **hk_packets, unsigned int *Fsn);
00145
00146 #endif