@@ -2,45 +2,45 | |||||
2 | <CodeBlocks_layout_file> |
|
2 | <CodeBlocks_layout_file> | |
3 | <ActiveTarget name="Debug" /> |
|
3 | <ActiveTarget name="Debug" /> | |
4 | <File name="../header/ccsds_types.h" open="0" top="0" tabpos="3"> |
|
4 | <File name="../header/ccsds_types.h" open="0" top="0" tabpos="3"> | |
5 |
<Cursor position=" |
|
5 | <Cursor position="1196" topLine="121" /> | |
6 | </File> |
|
6 | </File> | |
7 |
<File name="../header/fsw_init.h" open="0" top="0" tabpos=" |
|
7 | <File name="../header/fsw_init.h" open="0" top="0" tabpos="4"> | |
8 |
<Cursor position=" |
|
8 | <Cursor position="232" topLine="0" /> | |
9 | </File> |
|
9 | </File> | |
10 | <File name="../header/fsw_misc.h" open="0" top="0" tabpos="3"> |
|
10 | <File name="../header/fsw_misc.h" open="0" top="0" tabpos="3"> | |
11 |
<Cursor position="2 |
|
11 | <Cursor position="292" topLine="0" /> | |
12 | </File> |
|
12 | </File> | |
13 |
<File name="../header/fsw_params.h" open="0" top="0" tabpos=" |
|
13 | <File name="../header/fsw_params.h" open="0" top="0" tabpos="2"> | |
14 |
<Cursor position="1 |
|
14 | <Cursor position="1815" topLine="53" /> | |
15 | </File> |
|
15 | </File> | |
16 | <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0"> |
|
16 | <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0"> | |
17 |
<Cursor position=" |
|
17 | <Cursor position="576" topLine="0" /> | |
18 | </File> |
|
18 | </File> | |
19 | <File name="../header/grlib_regs.h" open="0" top="0" tabpos="4"> |
|
19 | <File name="../header/grlib_regs.h" open="0" top="0" tabpos="4"> | |
20 |
<Cursor position=" |
|
20 | <Cursor position="1318" topLine="36" /> | |
21 | </File> |
|
21 | </File> | |
22 | <File name="../header/tc_handler.h" open="0" top="0" tabpos="4"> |
|
22 | <File name="../header/tc_handler.h" open="0" top="0" tabpos="4"> | |
23 |
<Cursor position=" |
|
23 | <Cursor position="658" topLine="36" /> | |
24 | </File> |
|
24 | </File> | |
25 |
<File name="../header/wf_handler.h" open="0" top="0" tabpos=" |
|
25 | <File name="../header/wf_handler.h" open="0" top="0" tabpos="3"> | |
26 |
<Cursor position=" |
|
26 | <Cursor position="732" topLine="7" /> | |
27 | </File> |
|
27 | </File> | |
28 |
<File name="../src/fsw_globals.c" open=" |
|
28 | <File name="../src/fsw_globals.c" open="0" top="0" tabpos="5"> | |
29 |
<Cursor position=" |
|
29 | <Cursor position="663" topLine="18" /> | |
30 | </File> |
|
30 | </File> | |
31 |
<File name="../src/fsw_init.c" open=" |
|
31 | <File name="../src/fsw_init.c" open="0" top="0" tabpos="1"> | |
32 |
<Cursor position=" |
|
32 | <Cursor position="3984" topLine="98" /> | |
33 | </File> |
|
33 | </File> | |
34 | <File name="../src/fsw_misc.c" open="0" top="0" tabpos="2"> |
|
34 | <File name="../src/fsw_misc.c" open="0" top="0" tabpos="2"> | |
35 |
<Cursor position=" |
|
35 | <Cursor position="1183" topLine="46" /> | |
36 | </File> |
|
36 | </File> | |
37 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="4"> |
|
37 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="4"> | |
38 |
<Cursor position=" |
|
38 | <Cursor position="79" topLine="0" /> | |
39 | </File> |
|
39 | </File> | |
40 |
<File name="../src/tc_handler.c" open="0" top="0" tabpos=" |
|
40 | <File name="../src/tc_handler.c" open="0" top="0" tabpos="3"> | |
41 |
<Cursor position="5 |
|
41 | <Cursor position="22195" topLine="58" /> | |
42 | </File> |
|
42 | </File> | |
43 |
<File name="../src/wf_handler.c" open=" |
|
43 | <File name="../src/wf_handler.c" open="0" top="0" tabpos="2"> | |
44 |
<Cursor position="5 |
|
44 | <Cursor position="5903" topLine="117" /> | |
45 | </File> |
|
45 | </File> | |
46 | </CodeBlocks_layout_file> |
|
46 | </CodeBlocks_layout_file> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,117 +1,138 | |||||
1 | #ifndef CCSDS_H_INCLUDED |
|
1 | #ifndef CCSDS_H_INCLUDED | |
2 | #define CCSDS_H_INCLUDED |
|
2 | #define CCSDS_H_INCLUDED | |
3 |
|
3 | |||
4 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
4 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
5 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
5 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
6 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
6 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
7 | #define CCSDS_TC_PKT_MAX_SIZE 50 // size of the TC_LFR_UPDATE_INFO packet |
|
7 | #define CCSDS_TC_PKT_MAX_SIZE 50 // size of the TC_LFR_UPDATE_INFO packet | |
8 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
8 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
9 | #define CCSDS_PROCESS_ID 76 |
|
9 | #define CCSDS_PROCESS_ID 76 | |
10 | #define CCSDS_PACKET_CATEGORY 12 |
|
10 | #define CCSDS_PACKET_CATEGORY 12 | |
11 | #define CCSDS_NODE_ADDRESS 0xfe |
|
11 | #define CCSDS_NODE_ADDRESS 0xfe | |
12 | // |
|
12 | // | |
13 | #define CCSDS_DESTINATION_ID_GROUND 0x00 |
|
13 | #define CCSDS_DESTINATION_ID_GROUND 0x00 | |
14 | #define CCSDS_DESTINATION_ID 0x01 |
|
14 | #define CCSDS_DESTINATION_ID 0x01 | |
15 | #define CCSDS_DESTINATION_ID_DPU 0x01 |
|
15 | #define CCSDS_DESTINATION_ID_DPU 0x01 | |
16 | // |
|
16 | // | |
17 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
17 | #define CCSDS_PROTOCOLE_ID 0x02 | |
18 | #define CCSDS_USER_APP 0x00 |
|
18 | #define CCSDS_USER_APP 0x00 | |
19 |
|
19 | |||
20 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
20 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
21 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
21 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
22 |
|
22 | |||
23 | #define ILLEGAL_APID 0 |
|
23 | #define ILLEGAL_APID 0 | |
24 | #define WRONG_LEN_PACKET 1 |
|
24 | #define WRONG_LEN_PACKET 1 | |
25 | #define INCOR_CHECKSUM 2 |
|
25 | #define INCOR_CHECKSUM 2 | |
26 | #define ILL_TYPE 3 |
|
26 | #define ILL_TYPE 3 | |
27 | #define ILL_SUBTYPE 4 |
|
27 | #define ILL_SUBTYPE 4 | |
28 | #define WRONG_APP_DATA 5 |
|
28 | #define WRONG_APP_DATA 5 | |
29 | #define WRONG_CMD_CODE 6 |
|
29 | #define WRONG_CMD_CODE 6 | |
30 | #define CCSDS_TM_VALID 7 |
|
30 | #define CCSDS_TM_VALID 7 | |
31 | // |
|
31 | ||
32 | #define TC_NOT_EXE 40000 |
|
32 | // TC TYPES | |
33 | #define WRONG_SRC_ID 40001 |
|
33 | #define TC_TYPE_GEN 181 | |
34 |
#define |
|
34 | #define TC_TYPE_TIME 9 | |
35 | #define FAIL_DETECTED 40003 |
|
35 | ||
36 | #define NOT_ALLOWED 40004 |
|
36 | // TC SUBTYPES | |
37 | #define CORRUPTED 40005 |
|
37 | #define TC_SUBTYPE_RESET 1 | |
38 |
|
38 | #define TC_SUBTYPE_LOAD_COMM 11 | ||
39 | // // TC SUBTYPES |
|
39 | #define TC_SUBTYPE_LOAD_NORM 13 | |
40 |
#define TC_SUBTYPE_ |
|
40 | #define TC_SUBTYPE_LOAD_BURST 19 | |
41 |
#define TC_SUBTYPE_LOAD_ |
|
41 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
42 |
#define TC_SUBTYPE_LOAD_ |
|
42 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
43 |
#define TC_SUBTYPE_ |
|
43 | #define TC_SUBTYPE_DUMP 31 | |
44 |
#define TC_SUBTYPE_ |
|
44 | #define TC_SUBTYPE_ENTER 41 | |
45 |
#define TC_SUBTYPE_ |
|
45 | #define TC_SUBTYPE_UPDT_INFO 51 | |
46 |
#define TC_SUBTYPE_ |
|
46 | #define TC_SUBTYPE_EN_CAL 61 | |
47 |
#define TC_SUBTYPE_ |
|
47 | #define TC_SUBTYPE_DIS_CAL 63 | |
48 |
#define TC_SUBTYPE_UPDT_ |
|
48 | #define TC_SUBTYPE_UPDT_TIME 129 | |
49 | #define TC_SUBTYPE_EN_CAL 60 |
|
49 | ||
50 | #define TC_SUBTYPE_DIS_CAL 61 |
|
50 | // TC LEN | |
51 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
51 | #define TC_LEN_RESET 12 | |
52 |
|
52 | #define TC_LEN_LOAD_COMM 14 | ||
53 | #define SID_DEFAULT 0 |
|
53 | #define TC_LEN_LOAD_NORM 20 | |
54 | #define SID_HK 1 |
|
54 | #define TC_LEN_LOAD_BURST 14 | |
55 | #define SID_EXE_INC 5 |
|
55 | #define TC_LEN_LOAD_SBM1 14 | |
56 | #define SID_NOT_EXE 40000 |
|
56 | #define TC_LEN_LOAD_SBM2 14 | |
57 | #define SID_NOT_IMP 40002 |
|
57 | #define TC_LEN_DUMP 12 | |
58 | #define SID_EXE_ERR 40003 |
|
58 | #define TC_LEN_ENTER 20 | |
59 | #define SID_EXE_CORR 40005 |
|
59 | #define TC_LEN_UPDT_INFO 48 | |
60 |
|
60 | #define TC_LEN_EN_CAL 12 | ||
61 | #define SID_NORM_SWF_F0 3 |
|
61 | #define TC_LEN_DIS_CAL 12 | |
62 | #define SID_NORM_SWF_F1 4 |
|
62 | #define TC_LEN_UPDT_TIME 18 | |
63 | #define SID_NORM_SWF_F2 5 |
|
63 | ||
64 | #define SID_NORM_CWF_F3 1 |
|
64 | // TM TYPES | |
65 | #define SID_BURST_CWF_F2 2 |
|
65 | #define TM_TYPE_LFR_SCIENCE 21 | |
66 | #define SID_SBM1_CWF_F1 24 |
|
66 | ||
67 | #define SID_SBM2_CWF_F2 25 |
|
67 | // TM SUBTYPES | |
68 | #define SID_NORM_ASM_F0 11 |
|
68 | #define TM_SUBTYPE_EXE_OK 7 | |
69 | #define SID_NORM_ASM_F1 12 |
|
69 | #define TM_SUBTYPE_EXE_NOK 8 | |
70 | #define SID_NORM_ASM_F2 13 |
|
70 | #define TM_SUBTYPE_HK 25 | |
71 | #define SID_NORM_BP1_F0 14 |
|
71 | #define TM_SUBTYPE_SCIENCE 3 | |
72 | #define SID_NORM_BP1_F1 15 |
|
72 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
73 | #define SID_NORM_BP1_F2 16 |
|
73 | ||
74 | #define SID_NORM_BP2_F0 19 |
|
74 | #define SID_DEFAULT 0 | |
75 |
#define SID_ |
|
75 | #define SID_HK 1 | |
76 | #define SID_NORM_BP2_F2 21 |
|
76 | #define SID_EXE_INC 5 | |
77 | #define SID_BURST_BP1_F0 17 |
|
77 | #define SID_NOT_EXE 40000 | |
78 |
#define SID_ |
|
78 | #define SID_NOT_IMP 40002 | |
79 | #define SID_BURST_BP1_F1 18 |
|
79 | #define SID_EXE_ERR 40003 | |
80 | #define SID_BURST_BP2_F1 23 |
|
80 | #define SID_EXE_CORR 40005 | |
81 | #define SID_SBM1_BP1_F0 28 |
|
81 | ||
82 |
#define SID_ |
|
82 | #define SID_NORM_SWF_F0 3 | |
83 |
#define SID_ |
|
83 | #define SID_NORM_SWF_F1 4 | |
84 |
#define SID_ |
|
84 | #define SID_NORM_SWF_F2 5 | |
85 |
#define SID_ |
|
85 | #define SID_NORM_CWF_F3 1 | |
86 |
#define SID_ |
|
86 | #define SID_BURST_CWF_F2 2 | |
87 |
|
87 | #define SID_SBM1_CWF_F1 24 | ||
88 | // LENGTH (BYTES) |
|
88 | #define SID_SBM2_CWF_F2 25 | |
89 | #define LENGTH_TM_LFR_HK 126 |
|
89 | #define SID_NORM_ASM_F0 11 | |
90 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
90 | #define SID_NORM_ASM_F1 12 | |
91 | #define LENGTH_TM_LFR_SCIENCE_NORMAL_WF_MAX 4102 |
|
91 | #define SID_NORM_ASM_F2 13 | |
92 | // |
|
92 | #define SID_NORM_BP1_F0 14 | |
93 | #define TM_LEN_EXE 20 - CCSDS_TC_TM_PACKET_OFFSET |
|
93 | #define SID_NORM_BP1_F1 15 | |
94 | #define TM_LEN_NOT_EXE 26 - CCSDS_TC_TM_PACKET_OFFSET |
|
94 | #define SID_NORM_BP1_F2 16 | |
95 | #define TM_LEN_NOT_IMP 24 - CCSDS_TC_TM_PACKET_OFFSET |
|
95 | #define SID_NORM_BP2_F0 19 | |
96 | #define TM_LEN_EXE_ERR 24 - CCSDS_TC_TM_PACKET_OFFSET |
|
96 | #define SID_NORM_BP2_F1 20 | |
97 | #define TM_LEN_EXE_CORR 32 - CCSDS_TC_TM_PACKET_OFFSET |
|
97 | #define SID_NORM_BP2_F2 21 | |
98 | #define TM_HEADER_LEN 16 |
|
98 | #define SID_BURST_BP1_F0 17 | |
99 |
|
99 | #define SID_BURST_BP2_F0 22 | ||
100 | #define LEN_TM_LFR_HK 126 + 4 |
|
100 | #define SID_BURST_BP1_F1 18 | |
101 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 24 +4 |
|
101 | #define SID_BURST_BP2_F1 23 | |
102 |
|
102 | #define SID_SBM1_BP1_F0 28 | ||
103 | #define TM_LEN_SCI_NORM_SWF_340 340 * 12 + 6 + 10 - 1 |
|
103 | #define SID_SBM1_BP2_F0 31 | |
104 | #define TM_LEN_SCI_NORM_SWF_8 8 * 12 + 6 + 10 - 1 |
|
104 | #define SID_SBM2_BP1_F0 29 | |
105 |
|
105 | #define SID_SBM2_BP2_F0 32 | ||
106 | enum TM_TYPE{ |
|
106 | #define SID_SBM1_BP1_F1 30 | |
107 | TM_LFR_TC_EXE_OK, |
|
107 | #define SID_SBM1_BP2_F1 33 | |
108 | TM_LFR_TC_EXE_ERR, |
|
108 | ||
109 | TM_LFR_HK, |
|
109 | // LENGTH (BYTES) | |
110 | TM_LFR_SCI, |
|
110 | #define LENGTH_TM_LFR_HK 126 | |
111 | TM_LFR_SCI_SBM, |
|
111 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
112 | TM_LFR_PAR_DUMP |
|
112 | #define LENGTH_TM_LFR_SCIENCE_NORMAL_WF_MAX 4102 | |
|
113 | // | |||
|
114 | #define TM_LEN_EXE 20 - CCSDS_TC_TM_PACKET_OFFSET | |||
|
115 | #define TM_LEN_NOT_EXE 26 - CCSDS_TC_TM_PACKET_OFFSET | |||
|
116 | #define TM_LEN_NOT_IMP 24 - CCSDS_TC_TM_PACKET_OFFSET | |||
|
117 | #define TM_LEN_EXE_ERR 24 - CCSDS_TC_TM_PACKET_OFFSET | |||
|
118 | #define TM_LEN_EXE_CORR 32 - CCSDS_TC_TM_PACKET_OFFSET | |||
|
119 | #define TM_HEADER_LEN 16 | |||
|
120 | ||||
|
121 | #define LEN_TM_LFR_HK 126 + 4 | |||
|
122 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 24 +4 | |||
|
123 | ||||
|
124 | #define TM_LEN_SCI_NORM_SWF_340 340 * 12 + 6 + 10 - 1 | |||
|
125 | #define TM_LEN_SCI_NORM_SWF_8 8 * 12 + 6 + 10 - 1 | |||
|
126 | ||||
|
127 | enum TM_TYPE{ | |||
|
128 | TM_LFR_TC_EXE_OK, | |||
|
129 | TM_LFR_TC_EXE_ERR, | |||
|
130 | TM_LFR_HK, | |||
|
131 | TM_LFR_SCI, | |||
|
132 | TM_LFR_SCI_SBM, | |||
|
133 | TM_LFR_PAR_DUMP | |||
113 | }; |
|
134 | }; | |
114 |
|
135 | |||
115 | struct TMHeader_str |
|
136 | struct TMHeader_str | |
116 | { |
|
137 | { | |
117 | volatile unsigned char targetLogicalAddress; |
|
138 | volatile unsigned char targetLogicalAddress; | |
@@ -123,8 +144,8 struct TMHeader_str | |||||
123 | volatile unsigned char packetLength[2]; |
|
144 | volatile unsigned char packetLength[2]; | |
124 | volatile unsigned char dataFieldHeader[10]; |
|
145 | volatile unsigned char dataFieldHeader[10]; | |
125 | }; |
|
146 | }; | |
126 | typedef struct TMHeader_str TMHeader_t; |
|
147 | typedef struct TMHeader_str TMHeader_t; | |
127 |
|
148 | |||
128 | struct Packet_TM_LFR_HK_str |
|
149 | struct Packet_TM_LFR_HK_str | |
129 | { |
|
150 | { | |
130 | volatile unsigned char targetLogicalAddress; |
|
151 | volatile unsigned char targetLogicalAddress; | |
@@ -134,11 +155,11 struct Packet_TM_LFR_HK_str | |||||
134 | volatile unsigned char packetID[2]; |
|
155 | volatile unsigned char packetID[2]; | |
135 | volatile unsigned char packetSequenceControl[2]; |
|
156 | volatile unsigned char packetSequenceControl[2]; | |
136 | volatile unsigned char packetLength[2]; |
|
157 | volatile unsigned char packetLength[2]; | |
137 | volatile unsigned char dataFieldHeader[10]; |
|
158 | volatile unsigned char dataFieldHeader[10]; | |
138 | volatile unsigned char data[LENGTH_TM_LFR_HK - 10 + 1]; |
|
159 | volatile unsigned char data[LENGTH_TM_LFR_HK - 10 + 1]; | |
139 | }; |
|
160 | }; | |
140 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
161 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; | |
141 |
|
162 | |||
142 | struct Packet_TM_LFR_TC_EXE_str |
|
163 | struct Packet_TM_LFR_TC_EXE_str | |
143 | { |
|
164 | { | |
144 | volatile unsigned char targetLogicalAddress; |
|
165 | volatile unsigned char targetLogicalAddress; | |
@@ -148,11 +169,11 struct Packet_TM_LFR_TC_EXE_str | |||||
148 | volatile unsigned char packetID[2]; |
|
169 | volatile unsigned char packetID[2]; | |
149 | volatile unsigned char packetSequenceControl[2]; |
|
170 | volatile unsigned char packetSequenceControl[2]; | |
150 | volatile unsigned char packetLength[2]; |
|
171 | volatile unsigned char packetLength[2]; | |
151 | volatile unsigned char dataFieldHeader[10]; |
|
172 | volatile unsigned char dataFieldHeader[10]; | |
152 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; |
|
173 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; | |
153 | }; |
|
174 | }; | |
154 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
175 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; | |
155 |
|
176 | |||
156 | struct Packet_TM_LFR_SCIENCE_NORMAL_WF_str |
|
177 | struct Packet_TM_LFR_SCIENCE_NORMAL_WF_str | |
157 | { |
|
178 | { | |
158 | volatile unsigned char targetLogicalAddress; |
|
179 | volatile unsigned char targetLogicalAddress; | |
@@ -162,14 +183,14 struct Packet_TM_LFR_SCIENCE_NORMAL_WF_s | |||||
162 | volatile unsigned char packetID[2]; |
|
183 | volatile unsigned char packetID[2]; | |
163 | volatile unsigned char packetSequenceControl[2]; |
|
184 | volatile unsigned char packetSequenceControl[2]; | |
164 | volatile unsigned char packetLength[2]; |
|
185 | volatile unsigned char packetLength[2]; | |
165 | volatile unsigned char dataFieldHeader[10]; |
|
186 | volatile unsigned char dataFieldHeader[10]; | |
166 | volatile unsigned char auxiliaryHeader[6]; |
|
187 | volatile unsigned char auxiliaryHeader[6]; | |
167 | volatile unsigned char data[LENGTH_TM_LFR_SCIENCE_NORMAL_WF_MAX - 10 + 1]; |
|
188 | volatile unsigned char data[LENGTH_TM_LFR_SCIENCE_NORMAL_WF_MAX - 10 + 1]; | |
168 | }; |
|
189 | }; | |
169 | typedef struct Packet_TM_LFR_SCIENCE_NORMAL_WF_str Packet_TM_LFR_SCIENCE_NORMAL_WF_t; |
|
190 | typedef struct Packet_TM_LFR_SCIENCE_NORMAL_WF_str Packet_TM_LFR_SCIENCE_NORMAL_WF_t; | |
170 |
|
191 | |||
171 | struct ExtendedTMHeader_str |
|
192 | struct ExtendedTMHeader_str | |
172 | { |
|
193 | { | |
173 | volatile unsigned char targetLogicalAddress; |
|
194 | volatile unsigned char targetLogicalAddress; | |
174 | volatile unsigned char protocolIdentifier; |
|
195 | volatile unsigned char protocolIdentifier; | |
175 | volatile unsigned char reserved; |
|
196 | volatile unsigned char reserved; | |
@@ -177,10 +198,10 struct ExtendedTMHeader_str | |||||
177 | volatile unsigned char packetID[2]; |
|
198 | volatile unsigned char packetID[2]; | |
178 | volatile unsigned char packetSequenceControl[2]; |
|
199 | volatile unsigned char packetSequenceControl[2]; | |
179 | volatile unsigned char packetLength[2]; |
|
200 | volatile unsigned char packetLength[2]; | |
180 | volatile unsigned char dataFieldHeader[10]; |
|
201 | volatile unsigned char dataFieldHeader[10]; | |
181 | volatile unsigned char auxiliaryHeader[6]; |
|
202 | volatile unsigned char auxiliaryHeader[6]; | |
182 | }; |
|
203 | }; | |
183 | typedef struct ExtendedTMHeader_str ExtendedTMHeader_t; |
|
204 | typedef struct ExtendedTMHeader_str ExtendedTMHeader_t; | |
184 |
|
205 | |||
185 | struct ccsdsTelecommandPacket_str |
|
206 | struct ccsdsTelecommandPacket_str | |
186 | { |
|
207 | { | |
@@ -191,9 +212,9 struct ccsdsTelecommandPacket_str | |||||
191 | volatile unsigned char packetID[2]; |
|
212 | volatile unsigned char packetID[2]; | |
192 | volatile unsigned char packetSequenceControl[2]; |
|
213 | volatile unsigned char packetSequenceControl[2]; | |
193 | volatile unsigned char packetLength[2]; |
|
214 | volatile unsigned char packetLength[2]; | |
194 | volatile unsigned char dataFieldHeader[4]; |
|
215 | volatile unsigned char dataFieldHeader[4]; | |
195 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
216 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
196 | }; |
|
217 | }; | |
197 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
218 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; | |
198 |
|
219 | |||
199 | #endif // CCSDS_H_INCLUDED |
|
220 | #endif // CCSDS_H_INCLUDED |
@@ -16,7 +16,7 | |||||
16 | #include <wf_handler.h> |
|
16 | #include <wf_handler.h> | |
17 | #include <grlib_regs.h> |
|
17 | #include <grlib_regs.h> | |
18 |
|
18 | |||
19 | extern int sched_yield(); |
|
19 | extern int sched_yield( void ); | |
20 | extern int errno; |
|
20 | extern int errno; | |
21 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
21 | extern rtems_id Task_id[ ]; /* array of task ids */ | |
22 | extern rtems_name Task_name[ ]; /* array of task names */ |
|
22 | extern rtems_name Task_name[ ]; /* array of task names */ | |
@@ -39,21 +39,21 rtems_task recv_task(rtems_task_argument | |||||
39 | rtems_task spiq_task(rtems_task_argument argument); |
|
39 | rtems_task spiq_task(rtems_task_argument argument); | |
40 | rtems_task stat_task(rtems_task_argument argument); |
|
40 | rtems_task stat_task(rtems_task_argument argument); | |
41 | rtems_task wfrm_task(rtems_task_argument argument); |
|
41 | rtems_task wfrm_task(rtems_task_argument argument); | |
42 | int create_names(); |
|
42 | int create_names( void ); | |
43 | int create_all_tasks(); |
|
43 | int create_all_tasks( void ); | |
44 | int start_all_tasks(); |
|
44 | int start_all_tasks( void ); | |
45 | int create_message_queue(); |
|
45 | int create_message_queue( void ); | |
46 |
|
46 | |||
47 | // OTHER functions |
|
47 | // OTHER functions | |
48 | void init_default_mode_parameters(); |
|
48 | void init_default_mode_parameters( void ); | |
49 |
|
49 | |||
50 | int configure_spw_link(); |
|
50 | int configure_spw_link( void ); | |
51 | void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force |
|
51 | void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force | |
52 | void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable |
|
52 | void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable | |
53 |
|
53 | |||
54 | extern int rtems_cpu_usage_report(); |
|
54 | extern int rtems_cpu_usage_report( void ); | |
55 | extern int rtems_cpu_usage_reset(); |
|
55 | extern int rtems_cpu_usage_reset( void ); | |
56 | void print_statistics(spw_stats *); |
|
56 | ||
57 | rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send); |
|
57 | rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send); | |
58 | void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc); |
|
58 | void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc); | |
59 |
|
59 |
@@ -10,15 +10,15 | |||||
10 | #include <grspw.h> |
|
10 | #include <grspw.h> | |
11 | #include <ccsds_types.h> |
|
11 | #include <ccsds_types.h> | |
12 |
|
12 | |||
13 |
rtems_name HK_name; |
|
13 | rtems_name HK_name; // name of the HK rate monotonic | |
14 |
rtems_id HK_id; |
|
14 | rtems_id HK_id; // id of the HK rate monotonic period | |
15 |
|
15 | |||
16 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
16 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
17 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
17 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
18 | void print_statistics(spw_stats *stats); |
|
18 | void print_statistics(spw_stats *stats); | |
19 |
|
19 | |||
20 | // SERIAL LINK |
|
20 | // SERIAL LINK | |
21 | int send_console_outputs_on_serial_port(); |
|
21 | int send_console_outputs_on_serial_port( void ); | |
22 | int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); |
|
22 | int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); | |
23 |
|
23 | |||
24 | // RTEMS TASKS |
|
24 | // RTEMS TASKS |
@@ -1,66 +1,67 | |||||
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED | |
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED | |
3 |
|
3 | |||
4 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
4 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
5 | #define UART_DEVICE_NAME "/dev/console" |
|
5 | #define UART_DEVICE_NAME "/dev/console" | |
6 |
|
6 | |||
7 | //********** |
|
7 | //********** | |
8 | // LFR MODES |
|
8 | // LFR MODES | |
9 | #define LFR_MODE_STANDBY 0 |
|
9 | #define LFR_MODE_STANDBY 0 | |
10 | #define LFR_MODE_NORMAL 1 |
|
10 | #define LFR_MODE_NORMAL 1 | |
11 | #define LFR_MODE_BURST 2 |
|
11 | #define LFR_MODE_BURST 2 | |
12 | #define LFR_MODE_SBM1 3 |
|
12 | #define LFR_MODE_SBM1 3 | |
13 | #define LFR_MODE_SBM2 4 |
|
13 | #define LFR_MODE_SBM2 4 | |
14 |
|
14 | |||
15 | //***************************** |
|
15 | //***************************** | |
16 | // APB REGISTERS BASE ADDRESSES |
|
16 | // APB REGISTERS BASE ADDRESSES | |
17 | #define REGS_ADDR_APBUART 0x80000100 |
|
17 | #define REGS_ADDR_APBUART 0x80000100 | |
18 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
18 | #define REGS_ADDR_GPTIMER 0x80000300 | |
19 | #define REGS_ADDR_GRSPW 0x80000500 |
|
19 | #define REGS_ADDR_GRSPW 0x80000500 | |
20 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
20 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
21 | #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700 |
|
21 | #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700 | |
22 |
|
22 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | ||
23 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
23 | ||
24 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 |
|
24 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
25 |
|
25 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 | ||
26 | //********** |
|
26 | ||
|
27 | //********** | |||
27 | // IRQ LINES |
|
28 | // IRQ LINES | |
28 | #define IRQ_SM 9 |
|
29 | #define IRQ_SM 9 | |
29 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
30 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
30 | #define IRQ_WF 10 |
|
31 | #define IRQ_WF 10 | |
31 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
32 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels | |
32 | #define IRQ_TIME1 12 |
|
33 | #define IRQ_TIME1 12 | |
33 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
34 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels | |
34 | #define IRQ_TIME2 13 |
|
35 | #define IRQ_TIME2 13 | |
35 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
36 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
36 |
|
37 | #define IRQ_WAVEFORM_PICKER 14 | ||
37 | //***** |
|
38 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
38 | // TIME |
|
39 | ||
39 | #define CLKDIV_SM_SIMULATOR 9999 |
|
40 | //***** | |
40 | #define CLKDIV_WF_SIMULATOR 9999999 |
|
41 | // TIME | |
41 |
#define |
|
42 | #define CLKDIV_SM_SIMULATOR 9999 | |
42 |
#define |
|
43 | #define CLKDIV_WF_SIMULATOR 9999999 | |
43 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
44 | #define TIMER_SM_SIMULATOR 1 | |
44 |
|
45 | #define TIMER_WF_SIMULATOR 2 | ||
45 | //****** |
|
46 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |
46 | // RTEMS |
|
47 | ||
47 | #define TASKID_RECV 1 |
|
48 | //****** | |
48 | #define TASKID_ACTN 2 |
|
49 | // RTEMS | |
49 |
#define TASKID_ |
|
50 | #define TASKID_RECV 1 | |
50 |
#define TASKID_ |
|
51 | #define TASKID_ACTN 2 | |
51 |
#define TASKID_S |
|
52 | #define TASKID_SPIQ 3 | |
52 |
#define TASKID_ |
|
53 | #define TASKID_SMIQ 4 | |
53 |
#define TASKID_ |
|
54 | #define TASKID_STAT 5 | |
54 |
#define TASKID_ |
|
55 | #define TASKID_AVF0 6 | |
55 |
#define TASKID_ |
|
56 | #define TASKID_BPF0 7 | |
56 |
#define TASKID_ |
|
57 | #define TASKID_WFRM 8 | |
57 |
|
58 | #define TASKID_DUMB 9 | ||
58 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
59 | #define TASKID_HOUS 10 | |
59 |
|
60 | |||
60 | //******* |
|
61 | #define ACTION_MSG_QUEUE_COUNT 10 | |
61 | // MACROS |
|
62 | ||
62 | #define PRINT_TASK_STATISTICS |
|
63 | //******* | |
63 | #define PRINT_MESSAGES_ON_CONSOLE // enable or disable the printf instructions |
|
64 | // MACROS | |
64 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
65 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
65 | #define PRINTF(x) printf(x); |
|
66 | #define PRINTF(x) printf(x); | |
66 | #define PRINTF1(x,y) printf(x,y); |
|
67 | #define PRINTF1(x,y) printf(x,y); | |
@@ -69,38 +70,35 | |||||
69 | #define PRINTF(x) ; |
|
70 | #define PRINTF(x) ; | |
70 | #define PRINTF1(x,y) ; |
|
71 | #define PRINTF1(x,y) ; | |
71 | #define PRINTF2(x,y,z) ; |
|
72 | #define PRINTF2(x,y,z) ; | |
72 | #endif |
|
73 | #endif | |
73 |
|
74 | |||
74 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
75 | #define NB_SAMPLES_PER_SNAPSHOT 2048 | |
75 | #define NB_BYTES_SWF_BLK 2 * 6 |
|
76 | #define TIME_OFFSET 2 | |
76 | #define NB_WORDS_SWF_BLK 3 |
|
77 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
77 |
|
78 | #define NB_BYTES_SWF_BLK 2 * 6 | ||
78 | struct param_norm_str{ |
|
79 | #define NB_WORDS_SWF_BLK 3 | |
79 | unsigned int sy_lfr_n_swf_l; // length of the snapshots |
|
80 | ||
80 | unsigned int sy_lfr_n_swf_p; // time between two snapshots |
|
81 | struct param_norm_str{ | |
81 |
unsigned int sy_lfr_n_ |
|
82 | unsigned int sy_lfr_n_swf_l; // length of the snapshots | |
82 |
unsigned |
|
83 | unsigned int sy_lfr_n_swf_p; // time between two snapshots | |
83 |
unsigned |
|
84 | unsigned int sy_lfr_n_asm_p; // time between two asm | |
84 | }; |
|
85 | unsigned char sy_lfr_n_bp_p0; // timebetween two products BP1 set | |
85 |
|
86 | unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set | ||
86 | struct param_burst_str{ |
|
87 | }; | |
87 | unsigned char sy_lfr_b_bp_p0; // timebetween two products BP1 set |
|
88 | ||
88 | unsigned char sy_lfr_b_bp_p1; // time between two products BP2 set |
|
89 | struct param_burst_str{ | |
89 | }; |
|
90 | unsigned char sy_lfr_b_bp_p0; // timebetween two products BP1 set | |
90 |
|
91 | unsigned char sy_lfr_b_bp_p1; // time between two products BP2 set | ||
91 | struct param_sbm1_str{ |
|
92 | }; | |
92 | unsigned char sy_lfr_s1_bp_p0; // timebetween two products BP1 set |
|
93 | ||
93 | unsigned char sy_lfr_s1_bp_p1; // time between two products BP2 set |
|
94 | struct param_sbm1_str{ | |
94 | }; |
|
95 | unsigned char sy_lfr_s1_bp_p0; // timebetween two products BP1 set | |
95 |
|
96 | unsigned char sy_lfr_s1_bp_p1; // time between two products BP2 set | ||
96 | struct param_sbm2_str{ |
|
97 | }; | |
97 | unsigned char sy_lfr_s2_bp_p0; // timebetween two products BP1 set |
|
98 | ||
98 | unsigned char sy_lfr_s2_bp_p1; // time between two products BP2 set |
|
99 | struct param_sbm2_str{ | |
99 | }; |
|
100 | unsigned char sy_lfr_s2_bp_p0; // timebetween two products BP1 set | |
100 |
|
101 | unsigned char sy_lfr_s2_bp_p1; // time between two products BP2 set | ||
101 | extern volatile int wf_snap_f0[ ]; // 24576 bytes |
|
102 | }; | |
102 | extern volatile int wf_snap_f1[ ]; // 24576 bytes |
|
103 | ||
103 | extern volatile int wf_snap_f2[ ]; // 24576 bytes |
|
104 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED | |
104 | extern volatile int wf_cont_f3[ ]; // 24576 bytes |
|
|||
105 |
|
||||
106 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
@@ -13,7 +13,10 | |||||
13 |
|
13 | |||
14 | #include <rtems.h> |
|
14 | #include <rtems.h> | |
15 | #include <grlib_regs.h> |
|
15 | #include <grlib_regs.h> | |
16 | #include <fsw_params.h> |
|
16 | #include <fsw_params.h> | |
|
17 | #include <stdio.h> | |||
|
18 | #include <stdlib.h> | |||
|
19 | #include <leon.h> | |||
17 |
|
20 | |||
18 | struct BP1_str{ |
|
21 | struct BP1_str{ | |
19 | volatile unsigned char PE[2]; |
|
22 | volatile unsigned char PE[2]; | |
@@ -24,7 +27,25 struct BP1_str{ | |||||
24 | volatile unsigned char SZ; |
|
27 | volatile unsigned char SZ; | |
25 | volatile unsigned char VPHI; |
|
28 | volatile unsigned char VPHI; | |
26 | }; |
|
29 | }; | |
27 | typedef struct BP1_str BP1_t; |
|
30 | typedef struct BP1_str BP1_t; | |
|
31 | ||||
|
32 | extern volatile int spec_mat_f0_a[ ]; | |||
|
33 | extern volatile int spec_mat_f0_b[ ]; | |||
|
34 | extern volatile int spec_mat_f0_c[ ]; | |||
|
35 | extern volatile int spec_mat_f0_d[ ]; | |||
|
36 | extern volatile int spec_mat_f0_e[ ]; | |||
|
37 | extern volatile int spec_mat_f0_f[ ]; | |||
|
38 | extern volatile int spec_mat_f0_g[ ]; | |||
|
39 | extern volatile int spec_mat_f0_h[ ]; | |||
|
40 | extern float averaged_spec_mat_f0[ ]; | |||
|
41 | extern float compressed_spec_mat_f0[ ]; | |||
|
42 | extern unsigned char LFR_BP1_F0[ ]; | |||
|
43 | ||||
|
44 | extern BP1_t data_BP1[ ]; | |||
|
45 | ||||
|
46 | extern rtems_id Task_id[ ]; /* array of task ids */ | |||
|
47 | ||||
|
48 | extern spectral_matrices_regs_t *spectral_matrices_regs; | |||
28 |
|
49 | |||
29 | // ISR |
|
50 | // ISR | |
30 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
51 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
@@ -45,4 +45,20 struct time_management_regs_str{ | |||||
45 | }; |
|
45 | }; | |
46 | typedef struct time_management_regs_str time_management_regs_t; |
|
46 | typedef struct time_management_regs_str time_management_regs_t; | |
47 |
|
47 | |||
|
48 | struct waveform_picker_regs_str{ | |||
|
49 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW | |||
|
50 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 | |||
|
51 | volatile int addr_data_f0; // 0x08 10 *** | |||
|
52 | volatile int addr_data_f1; // 0x0c 11 *** | |||
|
53 | volatile int addr_data_f2; // 0x10 100 *** | |||
|
54 | volatile int addr_data_f3; // 0x14 101 *** | |||
|
55 | volatile int status; // 0x18 110 *** | |||
|
56 | volatile int delta_snapshot; // 0x1c 111 *** | |||
|
57 | volatile int delta_f2_f1; // 0x20 0000 *** | |||
|
58 | volatile int delta_f2_f0; // 0x24 0001 *** | |||
|
59 | volatile int nb_burst_available;// 0x28 0010 *** | |||
|
60 | volatile int nb_snapshot_param; // 0x2c 0011 *** | |||
|
61 | }; | |||
|
62 | typedef struct waveform_picker_regs_str waveform_picker_regs_t; | |||
|
63 | ||||
48 | #endif // GRLIBREGS_H_INCLUDED |
|
64 | #endif // GRLIBREGS_H_INCLUDED |
@@ -1,70 +1,65 | |||||
1 | #ifndef TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TC_HANDLER_H_INCLUDED | |
2 | #define TC_HANDLER_H_INCLUDED |
|
2 | #define TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <bsp.h> // for the LEON_Unmask_interrupt function |
|
5 | #include <bsp.h> // for the LEON_Unmask_interrupt function | |
6 | #include <stdio.h> |
|
6 | #include <stdio.h> | |
7 | #include <unistd.h> // for the read call |
|
7 | #include <unistd.h> // for the read call | |
8 | #include <sys/ioctl.h> // for the ioctl call |
|
8 | #include <sys/ioctl.h> // for the ioctl call | |
9 | #include <ccsds_types.h> |
|
9 | #include <ccsds_types.h> | |
10 | #include <grspw.h> |
|
10 | #include <grspw.h> | |
11 | #include <fsw_init.h> |
|
11 | #include <fsw_init.h> | |
12 |
|
12 | |||
13 | extern int fdSPW; |
|
13 | extern int fdSPW; | |
14 | extern rtems_name misc_name[ ]; |
|
14 | extern rtems_name misc_name[ ]; | |
15 | extern rtems_name misc_id[ ]; |
|
15 | extern rtems_name misc_id[ ]; | |
16 | extern rtems_id Task_id[ ]; // array of task ids |
|
16 | extern rtems_id Task_id[ ]; // array of task ids | |
17 | // MODE PARAMETERS |
|
17 | // MODE PARAMETERS | |
18 | extern struct param_norm_str param_norm; |
|
18 | extern struct param_norm_str param_norm; | |
19 | extern struct param_sbm1_str param_sbm1; |
|
19 | extern struct param_sbm1_str param_sbm1; | |
20 | extern struct param_sbm2_str param_sbm2; |
|
20 | extern struct param_sbm2_str param_sbm2; | |
21 | extern time_management_regs_t *time_management_regs; |
|
21 | extern time_management_regs_t *time_management_regs; | |
22 | extern unsigned char param_common[]; |
|
22 | extern waveform_picker_regs_t *waveform_picker_regs; | |
23 |
|
23 | extern gptimer_regs_t *gptimer_regs; | ||
24 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field |
|
24 | extern unsigned char param_common[]; | |
25 | unsigned char currentTC_COMPUTED_CRC[2]; |
|
25 | ||
26 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
26 | //**** | |
27 | unsigned int currentTM_length; |
|
|||
28 | unsigned char currentTC_processedFlag; |
|
|||
29 |
|
||||
30 | //**** |
|
|||
31 | // ISR |
|
27 | // ISR | |
32 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
28 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
33 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
29 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
34 |
|
30 | |||
35 | //********************** |
|
31 | //********************** | |
36 | // GENERAL USE FUNCTIONS |
|
32 | // GENERAL USE FUNCTIONS | |
37 |
|
|
33 | void initLookUpTableForCRC( void ); | |
38 | void initLookUpTableForCRC(); |
|
34 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); | |
39 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
35 | ||
40 |
|
36 | //********************* | ||
41 | //********************* |
|
|||
42 | // ACCEPTANCE FUNCTIONS |
|
37 | // ACCEPTANCE FUNCTIONS | |
43 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv); |
|
38 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv); | |
|
39 | ||||
|
40 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |||
|
41 | unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader); | |||
|
42 | unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC); | |||
|
43 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); | |||
44 |
|
44 | |||
45 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
45 | //*********** | |
46 | unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader); |
|
46 | // RTEMS TASK | |
47 | unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC); |
|
47 | rtems_task recv_task( rtems_task_argument unused ); | |
48 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); |
|
48 | rtems_task actn_task( rtems_task_argument unused ); | |
49 |
|
49 | rtems_task dumb_task( rtems_task_argument unused ); | ||
50 | //*********** |
|
50 | int create_message_queue( void ); | |
51 | // RTEMS TASK |
|
51 | ||
52 | rtems_task recv_task( rtems_task_argument unused ); |
|
52 | //*********** | |
53 | rtems_task actn_task( rtems_task_argument unused ); |
|
53 | // TC ACTIONS | |
54 | rtems_task dumb_task( rtems_task_argument unused ); |
|
54 | int action_default(ccsdsTelecommandPacket_t *TC); | |
55 | int create_message_queue(); |
|
55 | int action_default_alt(ccsdsTelecommandPacket_t *TC); | |
56 |
|
56 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC); | ||
57 | //*********** |
|
57 | // | |
58 | // TC ACTIONS |
|
58 | int action_load_norm(ccsdsTelecommandPacket_t *TC); | |
59 |
int action_ |
|
59 | int action_enter(ccsdsTelecommandPacket_t *TC); | |
60 |
int action_ |
|
60 | int action_updt_time(ccsdsTelecommandPacket_t *TC); | |
61 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC); |
|
|||
62 | // |
|
|||
63 | int action_load_norm(ccsdsTelecommandPacket_t *TC); |
|
|||
64 | int action_enter(ccsdsTelecommandPacket_t *TC); |
|
|||
65 | int action_updt_time(ccsdsTelecommandPacket_t *TC); |
|
|||
66 |
|
61 | |||
67 | #endif // TC_HANDLER_H_INCLUDED |
|
62 | #endif // TC_HANDLER_H_INCLUDED | |
68 |
|
63 | |||
69 |
|
64 | |||
70 |
|
65 |
@@ -8,18 +8,30 | |||||
8 | #include <ccsds_types.h> |
|
8 | #include <ccsds_types.h> | |
9 | #include <stdio.h> |
|
9 | #include <stdio.h> | |
10 | #include <fsw_init.h> |
|
10 | #include <fsw_init.h> | |
|
11 | #include <math.h> | |||
|
12 | ||||
|
13 | #define pi 3.1415 | |||
11 |
|
14 | |||
12 | //#include <sys/ioctl.h> |
|
15 | //#include <sys/ioctl.h> | |
13 |
|
16 | |||
14 | extern rtems_id Task_id[]; /* array of task ids */ |
|
17 | extern rtems_id Task_id[]; /* array of task ids */ | |
15 | extern int fdSPW; |
|
18 | extern int fdSPW; | |
|
19 | extern volatile int wf_snap_f0[ ]; | |||
|
20 | extern volatile int wf_snap_f1[ ]; | |||
|
21 | extern volatile int wf_snap_f2[ ]; | |||
|
22 | extern volatile int wf_cont_f3[ ]; | |||
|
23 | extern waveform_picker_regs_t *waveform_picker_regs; | |||
16 |
|
24 | |||
17 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
25 | rtems_isr waveforms_isr( rtems_vector_number vector ); | |
|
26 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); | |||
18 | rtems_task wfrm_task(rtems_task_argument argument); |
|
27 | rtems_task wfrm_task(rtems_task_argument argument); | |
19 |
|
28 | |||
20 | //****************** |
|
29 | //****************** | |
21 | // general functions |
|
30 | // general functions | |
22 | void init_waveforms(); |
|
31 | void init_waveforms( void ); | |
23 | int buil_value(int value1, int value0); |
|
32 | void reset_waveforms( void ); | |
|
33 | void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform, unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send); | |||
|
34 | void init_waveform_picker_regs(); | |||
|
35 | int build_value(int value1, int value0); | |||
24 |
|
36 | |||
25 | #endif // WF_HANDLER_H_INCLUDED |
|
37 | #endif // WF_HANDLER_H_INCLUDED |
@@ -5,31 +5,35 | |||||
5 | // RTEMS GLOBAL VARIABLES |
|
5 | // RTEMS GLOBAL VARIABLES | |
6 | rtems_name misc_name[5]; |
|
6 | rtems_name misc_name[5]; | |
7 | rtems_name misc_id[5]; |
|
7 | rtems_name misc_id[5]; | |
8 | rtems_id Task_id[15]; /* array of task ids */ |
|
8 | rtems_id Task_id[15]; /* array of task ids */ | |
9 | rtems_name Task_name[15]; /* array of task names */ |
|
9 | rtems_name Task_name[15]; /* array of task names */ | |
10 | int fdSPW; |
|
10 | int fdSPW = 0; | |
11 | int fdUART; |
|
11 | int fdUART = 0; | |
|
12 | ||||
|
13 | spectral_matrices_regs_t *spectral_matrices_regs = NULL; | |||
12 |
|
14 | |||
13 | // APB CONFIGURATION REGISTERS |
|
15 | // APB CONFIGURATION REGISTERS | |
14 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
16 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
|
17 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; | |||
|
18 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |||
15 |
|
19 | |||
16 | // WAVEFORMS GLOBAL VARIABLES |
|
20 | // WAVEFORMS GLOBAL VARIABLES | |
17 |
volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_ |
|
21 | volatile int wf_snap_f0[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
18 |
volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_ |
|
22 | volatile int wf_snap_f1[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
19 |
volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_ |
|
23 | volatile int wf_snap_f2[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
20 |
volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_ |
|
24 | volatile int wf_cont_f3[ 2 * NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + 2]; // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
21 |
|
25 | |||
22 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
26 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
23 | volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ]; |
|
27 | volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ]; | |
24 | volatile int spec_mat_f0_b[ TOTAL_SIZE_SPEC_MAT ]; |
|
28 | volatile int spec_mat_f0_b[ TOTAL_SIZE_SPEC_MAT ]; | |
25 | volatile int spec_mat_f0_c[ TOTAL_SIZE_SPEC_MAT ]; |
|
29 | volatile int spec_mat_f0_c[ TOTAL_SIZE_SPEC_MAT ]; | |
26 | volatile int spec_mat_f0_d[ TOTAL_SIZE_SPEC_MAT ]; |
|
30 | volatile int spec_mat_f0_d[ TOTAL_SIZE_SPEC_MAT ]; | |
27 | volatile int spec_mat_f0_e[ TOTAL_SIZE_SPEC_MAT ]; |
|
31 | volatile int spec_mat_f0_e[ TOTAL_SIZE_SPEC_MAT ]; | |
28 | volatile int spec_mat_f0_f[ TOTAL_SIZE_SPEC_MAT ]; |
|
32 | volatile int spec_mat_f0_f[ TOTAL_SIZE_SPEC_MAT ]; | |
29 | volatile int spec_mat_f0_g[ TOTAL_SIZE_SPEC_MAT ]; |
|
33 | volatile int spec_mat_f0_g[ TOTAL_SIZE_SPEC_MAT ]; | |
30 | volatile int spec_mat_f0_h[ TOTAL_SIZE_SPEC_MAT ]; |
|
34 | volatile int spec_mat_f0_h[ TOTAL_SIZE_SPEC_MAT ]; | |
31 | // |
|
35 | // | |
32 | float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ]; |
|
36 | float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ]; | |
33 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
37 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; | |
34 |
|
38 | |||
35 | // MODE PARAMETERS |
|
39 | // MODE PARAMETERS | |
@@ -42,7 +46,7 unsigned char param_common[2]; | |||||
42 | // HK PACKETS |
|
46 | // HK PACKETS | |
43 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
47 | Packet_TM_LFR_HK_t housekeeping_packet; | |
44 |
|
48 | |||
45 | // BASIC PARAMETERS GLOBAL VARIABLES |
|
49 | // BASIC PARAMETERS GLOBAL VARIABLES | |
46 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; |
|
50 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; | |
47 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; |
|
51 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; | |
48 |
|
52 |
This diff has been collapsed as it changes many lines, (513 lines changed) Show them Hide them | |||||
@@ -2,31 +2,31 | |||||
2 | // GPL reminder to be added |
|
2 | // GPL reminder to be added | |
3 | //************************* |
|
3 | //************************* | |
4 |
|
4 | |||
5 | #include <rtems.h> |
|
5 | #include <rtems.h> | |
|
6 | ||||
|
7 | /* configuration information */ | |||
|
8 | ||||
|
9 | #define CONFIGURE_INIT | |||
6 |
|
10 | |||
7 | /* configuration information */ |
|
|||
8 |
|
||||
9 | #define CONFIGURE_INIT |
|
|||
10 |
|
||||
11 | #include <bsp.h> /* for device driver prototypes */ |
|
11 | #include <bsp.h> /* for device driver prototypes */ | |
12 |
|
12 | |||
13 | /* configuration information */ |
|
13 | /* configuration information */ | |
14 |
|
14 | |||
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|