@@ -0,0 +1,32 | |||||
|
1 | #ifndef FSW_SPACEWIRE_H_INCLUDED | |||
|
2 | #define FSW_SPACEWIRE_H_INCLUDED | |||
|
3 | ||||
|
4 | #include <rtems.h> | |||
|
5 | ||||
|
6 | #include <grspw.h> | |||
|
7 | ||||
|
8 | #include <stdio.h> | |||
|
9 | #include <stdlib.h> | |||
|
10 | #include <fcntl.h> | |||
|
11 | ||||
|
12 | #include "fsw_params.h" | |||
|
13 | #include "ccsds_types.h" | |||
|
14 | #include "fsw_misc.h" | |||
|
15 | ||||
|
16 | extern spw_stats spacewire_stats; | |||
|
17 | extern spw_stats spacewire_stats_backup; | |||
|
18 | ||||
|
19 | // RTEMS TASK | |||
|
20 | rtems_task spiq_task(rtems_task_argument argument); | |||
|
21 | ||||
|
22 | int spacewire_configure_link( void ); | |||
|
23 | int spacewire_wait_for_link(void); | |||
|
24 | void spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force | |||
|
25 | void spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable | |||
|
26 | void spacewire_compute_stats_offsets(); | |||
|
27 | ||||
|
28 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc); | |||
|
29 | ||||
|
30 | void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc); | |||
|
31 | ||||
|
32 | #endif // FSW_SPACEWIRE_H_INCLUDED |
@@ -0,0 +1,200 | |||||
|
1 | #include "fsw_spacewire.h" | |||
|
2 | ||||
|
3 | char *lstates[6] = {"Error-reset", | |||
|
4 | "Error-wait", | |||
|
5 | "Ready", | |||
|
6 | "Started", | |||
|
7 | "Connecting", | |||
|
8 | "Run" | |||
|
9 | }; | |||
|
10 | ||||
|
11 | // RTEMS TASK | |||
|
12 | rtems_task spiq_task(rtems_task_argument unused) | |||
|
13 | { | |||
|
14 | rtems_event_set event_out; | |||
|
15 | rtems_status_code status; | |||
|
16 | unsigned char lfrMode; | |||
|
17 | ||||
|
18 | while(true){ | |||
|
19 | BOOT_PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n") | |||
|
20 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |||
|
21 | ||||
|
22 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode | |||
|
23 | ||||
|
24 | status = spacewire_wait_for_link(); | |||
|
25 | ||||
|
26 | if (status != RTEMS_SUCCESSFUL) | |||
|
27 | { | |||
|
28 | //**************** | |||
|
29 | // STOP THE SYSTEM | |||
|
30 | spacewire_compute_stats_offsets(); | |||
|
31 | stop_current_mode(); | |||
|
32 | if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task | |||
|
33 | PRINTF("in SPIQ *** Error suspending RECV Task\n") | |||
|
34 | } | |||
|
35 | if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task | |||
|
36 | PRINTF("in SPIQ *** Error suspending HOUS Task\n") | |||
|
37 | } | |||
|
38 | ||||
|
39 | //*************************** | |||
|
40 | // RESTART THE SPACEWIRE LINK | |||
|
41 | spacewire_configure_link(); | |||
|
42 | ||||
|
43 | //******************* | |||
|
44 | // RESTART THE SYSTEM | |||
|
45 | //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics | |||
|
46 | status = rtems_task_restart( Task_id[TASKID_HOUS], 1 ); | |||
|
47 | if (status != RTEMS_SUCCESSFUL) { | |||
|
48 | PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status) | |||
|
49 | } | |||
|
50 | status = rtems_task_restart(Task_id[TASKID_RECV], 1); | |||
|
51 | if ( status != RTEMS_SUCCESSFUL) { | |||
|
52 | PRINTF("in SPIQ *** Error restarting RECV Task\n") | |||
|
53 | } | |||
|
54 | enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption | |||
|
55 | } | |||
|
56 | } | |||
|
57 | } | |||
|
58 | ||||
|
59 | int spacewire_configure_link( void ) | |||
|
60 | { | |||
|
61 | rtems_status_code status; | |||
|
62 | ||||
|
63 | close(fdSPW); // close the device if it is already open | |||
|
64 | BOOT_PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n") | |||
|
65 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware | |||
|
66 | if ( fdSPW<0 ) { | |||
|
67 | PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") | |||
|
68 | } | |||
|
69 | ||||
|
70 | while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){ | |||
|
71 | PRINTF(".") | |||
|
72 | fflush( stdout ); | |||
|
73 | close( fdSPW ); // close the device | |||
|
74 | fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware | |||
|
75 | if (fdSPW<0) { | |||
|
76 | PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") | |||
|
77 | } | |||
|
78 | rtems_task_wake_after(100); | |||
|
79 | } | |||
|
80 | ||||
|
81 | BOOT_PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n") | |||
|
82 | ||||
|
83 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force | |||
|
84 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration | |||
|
85 | ||||
|
86 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |||
|
87 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |||
|
88 | // | |||
|
89 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |||
|
90 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |||
|
91 | // | |||
|
92 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |||
|
93 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") | |||
|
94 | // | |||
|
95 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |||
|
96 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") | |||
|
97 | // | |||
|
98 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |||
|
99 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") | |||
|
100 | // | |||
|
101 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full | |||
|
102 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") | |||
|
103 | // | |||
|
104 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |||
|
105 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") | |||
|
106 | ||||
|
107 | BOOT_PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n") | |||
|
108 | ||||
|
109 | return RTEMS_SUCCESSFUL; | |||
|
110 | } | |||
|
111 | ||||
|
112 | int spacewire_wait_for_link(void) | |||
|
113 | { | |||
|
114 | unsigned int i; | |||
|
115 | int linkStatus; | |||
|
116 | rtems_status_code status = RTEMS_UNSATISFIED; | |||
|
117 | ||||
|
118 | for(i = 0; i< 10; i++){ | |||
|
119 | PRINTF(".") | |||
|
120 | fflush( stdout ); | |||
|
121 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |||
|
122 | PRINTF1("in spacewire_wait_for_link *** link status is: %s\n", lstates[linkStatus]) | |||
|
123 | if ( linkStatus == 5) { | |||
|
124 | PRINTF("in spacewire_wait_for_link *** link is running\n") | |||
|
125 | status = RTEMS_SUCCESSFUL; | |||
|
126 | break; | |||
|
127 | } | |||
|
128 | rtems_task_wake_after(100); | |||
|
129 | } | |||
|
130 | ||||
|
131 | return status; | |||
|
132 | } | |||
|
133 | ||||
|
134 | void spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force | |||
|
135 | { | |||
|
136 | unsigned int *spwptr = (unsigned int*) regAddr; | |||
|
137 | ||||
|
138 | if (val == 1) { | |||
|
139 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit | |||
|
140 | } | |||
|
141 | if (val== 0) { | |||
|
142 | *spwptr = *spwptr & 0xffdfffff; | |||
|
143 | } | |||
|
144 | } | |||
|
145 | ||||
|
146 | void spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable | |||
|
147 | { | |||
|
148 | unsigned int *spwptr = (unsigned int*) regAddr; | |||
|
149 | ||||
|
150 | if (val == 1) | |||
|
151 | { | |||
|
152 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit | |||
|
153 | } | |||
|
154 | if (val== 0) | |||
|
155 | { | |||
|
156 | *spwptr = *spwptr & 0xfffdffff; | |||
|
157 | } | |||
|
158 | } | |||
|
159 | ||||
|
160 | void spacewire_compute_stats_offsets() | |||
|
161 | { | |||
|
162 | spw_stats spacewire_stats_grspw; | |||
|
163 | rtems_status_code status; | |||
|
164 | ||||
|
165 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |||
|
166 | ||||
|
167 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received | |||
|
168 | + spacewire_stats.packets_received; | |||
|
169 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent | |||
|
170 | + spacewire_stats.packets_sent; | |||
|
171 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err | |||
|
172 | + spacewire_stats.parity_err; | |||
|
173 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err | |||
|
174 | + spacewire_stats.disconnect_err; | |||
|
175 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err | |||
|
176 | + spacewire_stats.escape_err; | |||
|
177 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err | |||
|
178 | + spacewire_stats.credit_err; | |||
|
179 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err | |||
|
180 | + spacewire_stats.write_sync_err; | |||
|
181 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err | |||
|
182 | + spacewire_stats.rx_rmap_header_crc_err; | |||
|
183 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err | |||
|
184 | + spacewire_stats.rx_rmap_data_crc_err; | |||
|
185 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep | |||
|
186 | + spacewire_stats.early_ep; | |||
|
187 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address | |||
|
188 | + spacewire_stats.invalid_address; | |||
|
189 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err | |||
|
190 | + spacewire_stats.rx_eep_err; | |||
|
191 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated | |||
|
192 | + spacewire_stats.rx_truncated; | |||
|
193 | } | |||
|
194 | ||||
|
195 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc) | |||
|
196 | { | |||
|
197 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { | |||
|
198 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); | |||
|
199 | //} | |||
|
200 | } |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Oct 8 10:15:40 2013 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -10,7 +10,7 | |||||
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,7 +1,7 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 |
# CONFIG options = verbose *** cpu_usage_report *** |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa | |
4 |
CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
@@ -25,6 +25,10 contains( CONFIG, stack_report ) { | |||||
25 | DEFINES += PRINT_STACK_REPORT |
|
25 | DEFINES += PRINT_STACK_REPORT | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
|
28 | contains( CONFIG, boot_messages ) { | |||
|
29 | DEFINES += BOOT_MESSAGES | |||
|
30 | } | |||
|
31 | ||||
28 | TARGET = fsw |
|
32 | TARGET = fsw | |
29 | contains( CONFIG, gsa ) { |
|
33 | contains( CONFIG, gsa ) { | |
30 | DEFINES += GSA |
|
34 | DEFINES += GSA |
@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 2.8.0, 2013-10-0 |
|
3 | <!-- Written by QtCreator 2.8.0, 2013-10-08T06:59:51. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -19,12 +19,10 | |||||
19 |
|
19 | |||
20 | #include "fsw_spacewire.h" |
|
20 | #include "fsw_spacewire.h" | |
21 |
|
21 | |||
22 | extern int sched_yield( void ); |
|
22 | extern rtems_name misc_name[5]; | |
23 | extern int errno; |
|
23 | extern rtems_id misc_id[5]; | |
24 |
extern rtems_ |
|
24 | extern rtems_name Task_name[20]; /* array of task names */ | |
25 |
extern rtems_ |
|
25 | extern rtems_id Task_id[20]; /* array of task ids */ | |
26 | extern rtems_name misc_id[ ]; |
|
|||
27 | extern rtems_name misc_name[ ]; /* array of miscellaneous names for rtems objects */ |
|
|||
28 | extern unsigned int maxCount; |
|
26 | extern unsigned int maxCount; | |
29 | extern int fdSPW; // grspw file descriptor |
|
27 | extern int fdSPW; // grspw file descriptor | |
30 | extern int fdUART; // uart file descriptor |
|
28 | extern int fdUART; // uart file descriptor | |
@@ -45,8 +43,7 rtems_task wfrm_task(rtems_task_argument | |||||
45 | int create_names( void ); |
|
43 | int create_names( void ); | |
46 | int create_all_tasks( void ); |
|
44 | int create_all_tasks( void ); | |
47 | int start_all_tasks( void ); |
|
45 | int start_all_tasks( void ); | |
48 | // |
|
46 | rtems_status_code create_message_queues( void ); | |
49 | int create_message_queues( void ); |
|
|||
50 | // |
|
47 | // | |
51 | void init_parameter_dump( void ); |
|
48 | void init_parameter_dump( void ); | |
52 | void init_local_mode_parameters( void ); |
|
49 | void init_local_mode_parameters( void ); | |
@@ -56,4 +53,7 extern int rtems_cpu_usage_report( void | |||||
56 | extern int rtems_cpu_usage_reset( void ); |
|
53 | extern int rtems_cpu_usage_reset( void ); | |
57 | extern void rtems_stack_checker_report_usage( void ); |
|
54 | extern void rtems_stack_checker_report_usage( void ); | |
58 |
|
55 | |||
|
56 | extern int sched_yield( void ); | |||
|
57 | extern int errno; | |||
|
58 | ||||
59 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
59 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -31,4 +31,6 rtems_task stat_task(rtems_task_argument | |||||
31 | rtems_task hous_task(rtems_task_argument argument); |
|
31 | rtems_task hous_task(rtems_task_argument argument); | |
32 | rtems_task send_task(rtems_task_argument argument); |
|
32 | rtems_task send_task(rtems_task_argument argument); | |
33 |
|
33 | |||
|
34 | rtems_id get_pkts_queue_id( void ); | |||
|
35 | ||||
34 | #endif // FSW_MISC_H_INCLUDED |
|
36 | #endif // FSW_MISC_H_INCLUDED |
@@ -118,10 +118,8 | |||||
118 | #define TASK_PRIORITY_SPIQ 5 |
|
118 | #define TASK_PRIORITY_SPIQ 5 | |
119 | #define TASK_PRIORITY_SMIQ 10 |
|
119 | #define TASK_PRIORITY_SMIQ 10 | |
120 | // |
|
120 | // | |
121 |
#define TASK_PRIORITY_ |
|
121 | #define TASK_PRIORITY_RECV 20 | |
122 | // |
|
122 | #define TASK_PRIORITY_ACTN 30 | |
123 | #define TASK_PRIORITY_RECV 40 |
|
|||
124 | #define TASK_PRIORITY_ACTN 40 |
|
|||
125 | // |
|
123 | // | |
126 | #define TASK_PRIORITY_HOUS 40 |
|
124 | #define TASK_PRIORITY_HOUS 40 | |
127 | #define TASK_PRIORITY_CWF1 40 |
|
125 | #define TASK_PRIORITY_CWF1 40 | |
@@ -129,6 +127,8 | |||||
129 | #define TASK_PRIORITY_WFRM 40 |
|
127 | #define TASK_PRIORITY_WFRM 40 | |
130 | #define TASK_PRIORITY_CWF3 40 |
|
128 | #define TASK_PRIORITY_CWF3 40 | |
131 | // |
|
129 | // | |
|
130 | #define TASK_PRIORITY_SEND 40 | |||
|
131 | // | |||
132 | #define TASK_PRIORITY_AVF0 60 |
|
132 | #define TASK_PRIORITY_AVF0 60 | |
133 | #define TASK_PRIORITY_BPF0 60 |
|
133 | #define TASK_PRIORITY_BPF0 60 | |
134 | #define TASK_PRIORITY_MATR 100 |
|
134 | #define TASK_PRIORITY_MATR 100 | |
@@ -154,12 +154,32 | |||||
154 | #define PRINTF2(x,y,z) ; |
|
154 | #define PRINTF2(x,y,z) ; | |
155 | #endif |
|
155 | #endif | |
156 |
|
156 | |||
|
157 | #ifdef BOOT_MESSAGES | |||
|
158 | #define BOOT_PRINTF(x) printf(x); | |||
|
159 | #define BOOT_PRINTF1(x,y) printf(x,y); | |||
|
160 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |||
|
161 | #else | |||
|
162 | #define BOOT_PRINTF(x) ; | |||
|
163 | #define BOOT_PRINTF1(x,y) ; | |||
|
164 | #define BOOT_PRINTF2(x,y,z) ; | |||
|
165 | #endif | |||
|
166 | ||||
|
167 | #ifdef DEBUG_MESSAGES | |||
|
168 | #define DEBUG_PRINTF(x) printf(x); | |||
|
169 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |||
|
170 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |||
|
171 | #else | |||
|
172 | #define DEBUG_PRINTF(x) ; | |||
|
173 | #define DEBUG_PRINTF1(x,y) ; | |||
|
174 | #define DEBUG_PRINTF2(x,y,z) ; | |||
|
175 | #endif | |||
|
176 | ||||
157 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
177 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
158 |
|
178 | |||
159 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
179 | #define NB_SAMPLES_PER_SNAPSHOT 2048 | |
160 | #define TIME_OFFSET 2 |
|
180 | #define TIME_OFFSET 2 | |
161 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
181 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
162 | #define NB_BYTES_SWF_BLK 2 * 6 |
|
182 | #define NB_BYTES_SWF_BLK (2 * 6) | |
163 | #define NB_WORDS_SWF_BLK 3 |
|
183 | #define NB_WORDS_SWF_BLK 3 | |
164 |
|
184 | |||
165 | //****************** |
|
185 | //****************** |
@@ -32,8 +32,6 extern volatile int spec_mat_f2_bis[ ]; | |||||
32 | extern volatile int spec_mat_f0_0_bis[ ]; |
|
32 | extern volatile int spec_mat_f0_0_bis[ ]; | |
33 | extern volatile int spec_mat_f0_1_bis[ ]; |
|
33 | extern volatile int spec_mat_f0_1_bis[ ]; | |
34 |
|
34 | |||
35 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
|||
36 |
|
||||
37 | // parameters |
|
35 | // parameters | |
38 | extern struct param_local_str param_local; |
|
36 | extern struct param_local_str param_local; | |
39 |
|
37 | |||
@@ -62,7 +60,7 void BP2_set(float * compressed_spec_mat | |||||
62 | // |
|
60 | // | |
63 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
61 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
64 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
62 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
65 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send); |
|
63 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
66 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
64 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
67 | void fill_averaged_spectral_matrix(); |
|
65 | void fill_averaged_spectral_matrix(); | |
68 | void reset_spectral_matrix_regs(); |
|
66 | void reset_spectral_matrix_regs(); |
@@ -33,7 +33,7 void updateLFRCurrentMode(); | |||||
33 |
|
33 | |||
34 | //********************* |
|
34 | //********************* | |
35 | // ACCEPTANCE FUNCTIONS |
|
35 | // ACCEPTANCE FUNCTIONS | |
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); |
|
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_id); | |
37 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); |
|
37 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); | |
38 |
|
38 | |||
39 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
39 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |
@@ -47,17 +47,17 rtems_task dumb_task( rtems_task_argumen | |||||
47 |
|
47 | |||
48 | //*********** |
|
48 | //*********** | |
49 | // TC ACTIONS |
|
49 | // TC ACTIONS | |
50 | int action_reset(ccsdsTelecommandPacket_t *TC); |
|
50 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
51 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); |
|
51 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); | |
52 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC); |
|
52 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
53 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC); |
|
53 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
54 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC); |
|
54 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
55 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC); |
|
55 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
56 | int action_dump_par(ccsdsTelecommandPacket_t *TC); |
|
56 | int action_dump_par(ccsdsTelecommandPacket_t *TC); | |
57 | int action_enter_mode(ccsdsTelecommandPacket_t *TC); |
|
57 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
58 | int action_update_info(ccsdsTelecommandPacket_t *TC); |
|
58 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
59 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC); |
|
59 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
60 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC); |
|
60 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
61 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
61 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
62 |
|
62 | |||
63 | // mode transition |
|
63 | // mode transition | |
@@ -75,11 +75,11 int suspend_science_tasks(); | |||||
75 | // other functions |
|
75 | // other functions | |
76 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); |
|
76 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); | |
77 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); |
|
77 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); | |
78 | void close_action(ccsdsTelecommandPacket_t *TC, int result); |
|
78 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); | |
79 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC); |
|
79 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
80 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC); |
|
80 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
81 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC); |
|
81 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
82 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC); |
|
82 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
83 |
|
83 | |||
84 | #endif // TC_HANDLER_H_INCLUDED |
|
84 | #endif // TC_HANDLER_H_INCLUDED | |
85 |
|
85 |
@@ -16,7 +16,6 | |||||
16 |
|
16 | |||
17 | //#include <sys/ioctl.h> |
|
17 | //#include <sys/ioctl.h> | |
18 |
|
18 | |||
19 | extern rtems_id Task_id[]; /* array of task ids */ |
|
|||
20 | extern int fdSPW; |
|
19 | extern int fdSPW; | |
21 | extern volatile int wf_snap_f0[ ]; |
|
20 | extern volatile int wf_snap_f0[ ]; | |
22 | // |
|
21 | // | |
@@ -48,8 +47,8 int init_header_continuous_wf_table(unsi | |||||
48 | // |
|
47 | // | |
49 | void reset_waveforms( void ); |
|
48 | void reset_waveforms( void ); | |
50 |
|
49 | |||
51 | int send_waveform_SWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF); |
|
50 | int send_waveform_SWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id); | |
52 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF); |
|
51 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id); | |
53 |
|
52 | |||
54 | //************** |
|
53 | //************** | |
55 | // wfp registers |
|
54 | // wfp registers |
@@ -6,10 +6,10 | |||||
6 | #include <fsw_params.h> |
|
6 | #include <fsw_params.h> | |
7 |
|
7 | |||
8 | // RTEMS GLOBAL VARIABLES |
|
8 | // RTEMS GLOBAL VARIABLES | |
9 | rtems_name misc_name[5]; |
|
9 | rtems_name misc_name[5]; | |
10 |
rtems_ |
|
10 | rtems_id misc_id[5]; | |
11 |
rtems_ |
|
11 | rtems_name Task_name[20]; /* array of task names */ | |
12 |
rtems_ |
|
12 | rtems_id Task_id[20]; /* array of task ids */ | |
13 | unsigned int maxCount; |
|
13 | unsigned int maxCount; | |
14 | int fdSPW = 0; |
|
14 | int fdSPW = 0; | |
15 | int fdUART = 0; |
|
15 | int fdUART = 0; |
@@ -23,7 +23,7 | |||||
23 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
23 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 |
|
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
28 | #ifdef PRINT_STACK_REPORT |
|
28 | #ifdef PRINT_STACK_REPORT | |
29 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
29 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
@@ -54,11 +54,11 rtems_task Init( rtems_task_argument ign | |||||
54 | rtems_status_code status; |
|
54 | rtems_status_code status; | |
55 | rtems_isr_entry old_isr_handler; |
|
55 | rtems_isr_entry old_isr_handler; | |
56 |
|
56 | |||
57 | PRINTF("\n\n\n\n\n") |
|
57 | BOOT_PRINTF("\n\n\n\n\n") | |
58 | PRINTF("***************************\n") |
|
58 | BOOT_PRINTF("***************************\n") | |
59 | PRINTF("** START Flight Software **\n") |
|
59 | BOOT_PRINTF("** START Flight Software **\n") | |
60 | PRINTF("***************************\n") |
|
60 | BOOT_PRINTF("***************************\n") | |
61 | PRINTF("\n\n") |
|
61 | BOOT_PRINTF("\n\n") | |
62 |
|
62 | |||
63 | //send_console_outputs_on_apbuart_port(); |
|
63 | //send_console_outputs_on_apbuart_port(); | |
64 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
64 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
@@ -112,7 +112,7 rtems_task Init( rtems_task_argument ign | |||||
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); |
|
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); | |
113 | #endif |
|
113 | #endif | |
114 |
|
114 | |||
115 | PRINTF("delete INIT\n") |
|
115 | BOOT_PRINTF("delete INIT\n") | |
116 |
|
116 | |||
117 | status = rtems_task_delete(RTEMS_SELF); |
|
117 | status = rtems_task_delete(RTEMS_SELF); | |
118 |
|
118 | |||
@@ -182,9 +182,9 void init_local_mode_parameters( void ) | |||||
182 | set_local_sbm2_nb_cwf_max(); |
|
182 | set_local_sbm2_nb_cwf_max(); | |
183 | set_local_nb_interrupt_f0_MAX(); |
|
183 | set_local_nb_interrupt_f0_MAX(); | |
184 |
|
184 | |||
185 | PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
185 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
186 | PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
186 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
187 | PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
187 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
188 |
|
188 | |||
189 | reset_local_sbm1_nb_cwf_sent(); |
|
189 | reset_local_sbm1_nb_cwf_sent(); | |
190 | reset_local_sbm2_nb_cwf_sent(); |
|
190 | reset_local_sbm2_nb_cwf_sent(); | |
@@ -343,7 +343,7 int create_all_tasks( void ) | |||||
343 | // SEND |
|
343 | // SEND | |
344 | status = rtems_task_create( |
|
344 | status = rtems_task_create( | |
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
346 | RTEMS_DEFAULT_MODES, |
|
346 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
348 | ); |
|
348 | ); | |
349 |
|
349 | |||
@@ -356,96 +356,100 int start_all_tasks( void ) | |||||
356 |
|
356 | |||
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
358 | if (status!=RTEMS_SUCCESSFUL) { |
|
358 | if (status!=RTEMS_SUCCESSFUL) { | |
359 | PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
359 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
360 | } |
|
|||
361 |
|
||||
362 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
|||
363 | if (status!=RTEMS_SUCCESSFUL) { |
|
|||
364 | PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
|||
365 | } |
|
|||
366 |
|
||||
367 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
|||
368 | if (status!=RTEMS_SUCCESSFUL) { |
|
|||
369 | PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
|||
370 | } |
|
360 | } | |
371 |
|
361 | |||
372 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
362 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
373 | if (status!=RTEMS_SUCCESSFUL) { |
|
363 | if (status!=RTEMS_SUCCESSFUL) { | |
374 | PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
364 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
|
365 | } | |||
|
366 | ||||
|
367 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |||
|
368 | if (status!=RTEMS_SUCCESSFUL) { | |||
|
369 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |||
|
370 | } | |||
|
371 | ||||
|
372 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |||
|
373 | if (status!=RTEMS_SUCCESSFUL) { | |||
|
374 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |||
|
375 | } | |||
|
376 | ||||
|
377 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |||
|
378 | if (status!=RTEMS_SUCCESSFUL) { | |||
|
379 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |||
375 | } |
|
380 | } | |
376 |
|
381 | |||
377 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
382 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
378 | if (status!=RTEMS_SUCCESSFUL) { |
|
383 | if (status!=RTEMS_SUCCESSFUL) { | |
379 | PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
384 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
380 | } |
|
385 | } | |
381 |
|
386 | |||
382 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
387 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
383 | if (status!=RTEMS_SUCCESSFUL) { |
|
388 | if (status!=RTEMS_SUCCESSFUL) { | |
384 | PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
389 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
385 | } |
|
390 | } | |
386 |
|
391 | |||
387 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
392 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
388 | if (status!=RTEMS_SUCCESSFUL) { |
|
393 | if (status!=RTEMS_SUCCESSFUL) { | |
389 | PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
394 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
390 | } |
|
395 | } | |
391 |
|
396 | |||
392 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
397 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
393 | if (status!=RTEMS_SUCCESSFUL) { |
|
398 | if (status!=RTEMS_SUCCESSFUL) { | |
394 | PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
399 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
395 | } |
|
400 | } | |
396 |
|
401 | |||
397 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
402 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
398 | if (status!=RTEMS_SUCCESSFUL) { |
|
403 | if (status!=RTEMS_SUCCESSFUL) { | |
399 | PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
404 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
400 | } |
|
405 | } | |
401 |
|
406 | |||
402 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
407 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
403 | if (status!=RTEMS_SUCCESSFUL) { |
|
408 | if (status!=RTEMS_SUCCESSFUL) { | |
404 | PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
409 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
405 | } |
|
410 | } | |
406 |
|
411 | |||
407 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
412 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
408 | if (status!=RTEMS_SUCCESSFUL) { |
|
413 | if (status!=RTEMS_SUCCESSFUL) { | |
409 | PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
414 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") | |
410 | } |
|
415 | } | |
411 |
|
416 | |||
412 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
417 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
413 | if (status!=RTEMS_SUCCESSFUL) { |
|
418 | if (status!=RTEMS_SUCCESSFUL) { | |
414 | PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
419 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
415 | } |
|
420 | } | |
416 |
|
421 | |||
417 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
422 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
418 | if (status!=RTEMS_SUCCESSFUL) { |
|
423 | if (status!=RTEMS_SUCCESSFUL) { | |
419 | PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
424 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
420 | } |
|
425 | } | |
421 |
|
426 | |||
422 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
427 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
423 | if (status!=RTEMS_SUCCESSFUL) { |
|
428 | if (status!=RTEMS_SUCCESSFUL) { | |
424 | PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
429 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
425 | } |
|
|||
426 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
|||
427 | if (status!=RTEMS_SUCCESSFUL) { |
|
|||
428 | PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
|||
429 | } |
|
430 | } | |
430 |
|
431 | |||
431 | return 0; |
|
432 | return 0; | |
432 | } |
|
433 | } | |
433 |
|
434 | |||
434 |
|
|
435 | rtems_status_code create_message_queues( void ) | |
435 | { |
|
436 | { | |
436 | rtems_status_code status; |
|
437 | rtems_status_code status; | |
|
438 | rtems_status_code ret; | |||
|
439 | rtems_id queue_id; | |||
|
440 | ||||
|
441 | ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_SIZE, | |||
|
442 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |||
|
443 | if (ret != RTEMS_SUCCESSFUL) { | |||
|
444 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) | |||
|
445 | } | |||
437 |
|
446 | |||
438 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
447 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
439 |
RTEMS_FIFO | RTEMS_LOCAL, & |
|
448 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
440 | if (status!=RTEMS_SUCCESSFUL) { |
|
449 | if (status != RTEMS_SUCCESSFUL) { | |
441 | PRINTF("in create_message_queues *** ERR creating QUEU\n") |
|
450 | ret = status; | |
|
451 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) | |||
442 | } |
|
452 | } | |
443 |
|
453 | |||
444 | status = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_SIZE, |
|
454 | return ret; | |
445 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[QUEUE_PKTS] ); |
|
|||
446 | if (status!=RTEMS_SUCCESSFUL) { |
|
|||
447 | PRINTF("in create_message_queues *** ERR creating PKTS\n") |
|
|||
448 | } |
|
|||
449 |
|
||||
450 | return 0; |
|
|||
451 | } |
|
455 | } |
@@ -8,9 +8,9 int configure_timer(gptimer_regs_t *gpti | |||||
8 | rtems_isr_entry old_isr_handler; |
|
8 | rtems_isr_entry old_isr_handler; | |
9 |
|
9 | |||
10 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
10 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
11 |
if (status |
|
11 | if (status!=RTEMS_SUCCESSFUL) | |
12 | { |
|
12 | { | |
13 |
PRINTF(" |
|
13 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
16 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
@@ -125,7 +125,7 int set_apbuart_scaler_reload_register(u | |||||
125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
126 |
|
126 | |||
127 | apbuart_regs->scaler = value; |
|
127 | apbuart_regs->scaler = value; | |
128 | PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
128 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
129 |
|
129 | |||
130 | return 0; |
|
130 | return 0; | |
131 | } |
|
131 | } | |
@@ -139,7 +139,7 rtems_task stat_task(rtems_task_argument | |||||
139 | int j; |
|
139 | int j; | |
140 | i = 0; |
|
140 | i = 0; | |
141 | j = 0; |
|
141 | j = 0; | |
142 | PRINTF("in STAT *** \n") |
|
142 | BOOT_PRINTF("in STAT *** \n") | |
143 | while(1){ |
|
143 | while(1){ | |
144 | rtems_task_wake_after(1000); |
|
144 | rtems_task_wake_after(1000); | |
145 | PRINTF1("%d\n", j) |
|
145 | PRINTF1("%d\n", j) | |
@@ -159,6 +159,7 rtems_task hous_task(rtems_task_argument | |||||
159 | { |
|
159 | { | |
160 | rtems_status_code status; |
|
160 | rtems_status_code status; | |
161 | spw_ioctl_pkt_send spw_ioctl_send; |
|
161 | spw_ioctl_pkt_send spw_ioctl_send; | |
|
162 | rtems_id queue_id; | |||
162 |
|
163 | |||
163 | spw_ioctl_send.hlen = 0; |
|
164 | spw_ioctl_send.hlen = 0; | |
164 | spw_ioctl_send.hdr = NULL; |
|
165 | spw_ioctl_send.hdr = NULL; | |
@@ -166,7 +167,13 rtems_task hous_task(rtems_task_argument | |||||
166 | spw_ioctl_send.data = (char*) &housekeeping_packet; |
|
167 | spw_ioctl_send.data = (char*) &housekeeping_packet; | |
167 | spw_ioctl_send.options = 0; |
|
168 | spw_ioctl_send.options = 0; | |
168 |
|
169 | |||
169 | PRINTF("in HOUS ***\n") |
|
170 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
|
171 | if (status != RTEMS_SUCCESSFUL) | |||
|
172 | { | |||
|
173 | PRINTF1("in HOUS *** ERR %d\n", status) | |||
|
174 | } | |||
|
175 |