##// END OF EJS Templates
FSW modified to have correct answers to TC_LFR_DUMP_PAR
paul@pc-solar1.lab-lpp.local -
r15:d75852f5b698 default
parent child
Show More
@@ -1,46 +1,46
1 1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 2 <CodeBlocks_layout_file>
3 3 <ActiveTarget name="Debug" />
4 <File name="../header/ccsds_types.h" open="1" top="0" tabpos="2">
5 <Cursor position="553" topLine="24" />
4 <File name="../header/ccsds_types.h" open="0" top="0" tabpos="3">
5 <Cursor position="417" topLine="3" />
6 6 </File>
7 <File name="../header/fsw_init.h" open="0" top="0" tabpos="3">
8 <Cursor position="1521" topLine="15" />
7 <File name="../header/fsw_init.h" open="0" top="0" tabpos="6">
8 <Cursor position="1629" topLine="27" />
9 9 </File>
10 10 <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0">
11 11 <Cursor position="114" topLine="0" />
12 12 </File>
13 13 <File name="../header/fsw_params.h" open="0" top="0" tabpos="2">
14 <Cursor position="1358" topLine="31" />
14 <Cursor position="481" topLine="0" />
15 15 </File>
16 16 <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0">
17 17 <Cursor position="628" topLine="7" />
18 18 </File>
19 19 <File name="../header/grlib_regs.h" open="0" top="0" tabpos="4">
20 <Cursor position="1153" topLine="11" />
20 <Cursor position="1153" topLine="16" />
21 21 </File>
22 22 <File name="../header/tc_handler.h" open="0" top="0" tabpos="4">
23 <Cursor position="624" topLine="2" />
23 <Cursor position="1380" topLine="35" />
24 24 </File>
25 25 <File name="../header/wf_handler.h" open="0" top="0" tabpos="0">
26 <Cursor position="318" topLine="0" />
26 <Cursor position="341" topLine="0" />
27 27 </File>
28 <File name="../src/fsw_globals.c" open="0" top="0" tabpos="3">
29 <Cursor position="378" topLine="1" />
28 <File name="../src/fsw_globals.c" open="0" top="0" tabpos="5">
29 <Cursor position="99" topLine="0" />
30 30 </File>
31 31 <File name="../src/fsw_init.c" open="1" top="0" tabpos="1">
32 <Cursor position="10747" topLine="81" />
32 <Cursor position="12524" topLine="55" />
33 33 </File>
34 34 <File name="../src/fsw_misc.c" open="0" top="0" tabpos="2">
35 <Cursor position="475" topLine="0" />
35 <Cursor position="2621" topLine="0" />
36 36 </File>
37 37 <File name="../src/fsw_processing.c" open="0" top="0" tabpos="0">
38 <Cursor position="1696" topLine="59" />
38 <Cursor position="1792" topLine="43" />
39 39 </File>
40 <File name="../src/tc_handler.c" open="1" top="1" tabpos="3">
41 <Cursor position="11453" topLine="39" />
40 <File name="../src/tc_handler.c" open="1" top="1" tabpos="2">
41 <Cursor position="13883" topLine="80" />
42 42 </File>
43 43 <File name="../src/wf_handler.c" open="0" top="0" tabpos="4">
44 <Cursor position="1660" topLine="24" />
44 <Cursor position="4576" topLine="83" />
45 45 </File>
46 46 </CodeBlocks_layout_file>
1 NO CONTENT: modified file, binary diff hidden
@@ -23,6 +23,9 extern rtems_name Task_name[ ]; /* a
23 23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 24 extern int fdSPW; // grspw file descriptor
25 25 extern int fdUART; // uart file descriptor
26
27 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc);
28
26 29 // MODE PARAMETERS
27 30 extern struct param_norm_str param_norm;
28 31 extern struct param_burst_str param_burst;
@@ -42,11 +45,15 int create_message_queue();
42 45
43 46 // OTHER functions
44 47 void init_default_mode_parameters();
48
45 49 int configure_spw_link();
46 int send_console_outputs_on_serial_port();
50 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force
51 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable
52
47 53 extern int rtems_cpu_usage_report();
48 54 extern int rtems_cpu_usage_reset();
49 55 void print_statistics(spw_stats *);
50 56 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send);
57 void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc);
51 58
52 59 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -57,6 +57,7 int create_message_queue();
57 57 //***********
58 58 // TC ACTIONS
59 59 int action_default(ccsdsTelecommandPacket_t *TC);
60 int action_default_alt(ccsdsTelecommandPacket_t *TC);
60 61 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC);
61 62 //
62 63 int action_load_norm(ccsdsTelecommandPacket_t *TC);
@@ -50,4 +50,6 struct drvmgr_bus_res grlib_drv_resource
50 50 // {DRIVER_AMBAPP_GAISLER_APBUART_ID, 1, &grlib_drv_res_apbuart1[0]},
51 51 RES_EMPTY /* Mark end of device resource array */
52 52 }
53 };
53 };
54
55
@@ -42,3 +42,4 unsigned char param_common[2];
42 42 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
43 43
44 44 BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ];
45
@@ -67,6 +67,8 rtems_task Init( rtems_task_argument ign
67 67 create_all_tasks();
68 68 start_all_tasks();
69 69
70 grspw_timecode_callback = &timecode_irq_handler;
71
70 72 configure_spw_link();
71 73 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
72 74 IRQ_SPARC_SM, spectral_matrices_isr );
@@ -255,12 +257,15 int configure_spw_link()
255 257 rtems_task_wake_after(100);
256 258 }
257 259
258 PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
260 PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n")
259 261
260 262 // sets a few parameters of the link
261 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RMAPEN, 1); // sets the RMAP enable bit
262 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RMAPEN\n")
263 //
263 //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RMAPEN, 1); // sets the RMAP enable bit
264 //if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RMAPEN\n")
265
266 configure_spacewire_set_NP(1, REGS_ADDR_GRSPW); // No Port force
267 configure_spacewire_set_RE(1, REGS_ADDR_GRSPW); // the dedicated call seems to break the no port force configuration
268
264 269 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
265 270 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
266 271 //
@@ -272,22 +277,53 int configure_spw_link()
272 277 //
273 278 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
274 279 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
275
280 //
276 281 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // sets the link-error interrupt bit
277 282 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
278
283 //
279 284 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DESTKEY, CCSDS_DESTINATION_ID); // sets the destination key
280 285 PRINTF1("destination address set to: %d\n", CCSDS_DESTINATION_ID)
281 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
282
283 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_NODEADDR, CCSDS_NODE_ADDRESS); // sets the destination key
286 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_DESTKEY\n")
287 //
288 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_NODEADDR, CCSDS_NODE_ADDRESS); // sets the node address
284 289 PRINTF1("node address set to: %d\n", CCSDS_NODE_ADDRESS)
285 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
290 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_NODEADDR\n")
291 //
292 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909);
293 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
286 294
287 295 PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n")
288 296
289 297 return RTEMS_SUCCESSFUL;
290 298 }
299
300 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr) // No Port force
301 {
302 unsigned int *spwptr;
303 spwptr = (unsigned int*) regAddr;
304 if (val == 1)
305 {
306 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
307 }
308 if (val== 0)
309 {
310 *spwptr = *spwptr & 0xffdfffff;
311 }
312 }
313
314 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr) // RMAP Enable
315 {
316 unsigned int *spwptr;
317 spwptr = (unsigned int*) regAddr;
318 if (val == 1)
319 {
320 *spwptr = *spwptr | 0x00010000; // [NP] set the No port force bit
321 }
322 if (val== 0)
323 {
324 *spwptr = *spwptr & 0xfffdffff;
325 }
326 }
291 327
292 328 char *link_status(int status){
293 329 return lstates[status];
@@ -301,4 +337,9 rtems_status_code write_spw(spw_ioctl_pk
301 337 return status;
302 338 }
303 339
340 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc)
341 {
342 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
343 printf("In timecode_irq_handler *** Error sending event to DUMB\n");
344 }
304 345
@@ -393,20 +393,31 int create_message_queue()
393 393
394 394 //***********
395 395 // TC ACTIONS
396
396 397 int action_default(ccsdsTelecommandPacket_t *TC)
397 398 {
398 char data[100]; // buffer for the generic TM packet
399 TMHeader_t TM_header; // TM header
400 spw_ioctl_pkt_send spw_ioctl_send; // structure to send the TM packet if any
401 // BUILD HEADER
402 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP, 0, 0, &TM_header);
403 // BUILD DATA
404 TM_build_data( TC, data, SID_NOT_IMP, NULL);
405 // filling the strture for the spcawire transmission
399 TMHeader_t TM_header;
400 char data[8];
401 spw_ioctl_pkt_send spw_ioctl_send;
402
403 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP,
404 time_management_regs->coarse_time, time_management_regs->fine_time, &TM_header);
405
406 data[0] = 0x9c;
407 data[1] = 0x42;
408 data[2] = TC->packetID[0];
409 data[3] = TC->packetID[1];
410 data[4] = TC->packetSequenceControl[0];
411 data[5] = TC->packetSequenceControl[1];
412 data[6] = TC->dataFieldHeader[1]; // type
413 data[7] = TC->dataFieldHeader[2]; // subtype
414
415 // filling the structure for the spacewire transmission
406 416 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
407 417 spw_ioctl_send.hdr = (char*) &TM_header;
408 418 spw_ioctl_send.dlen = 8;
409 419 spw_ioctl_send.data = data;
420
410 421 // SEND DATA
411 422 write_spw(&spw_ioctl_send);
412 423
@@ -491,13 +502,13 int send_tm_lfr_tc_exe_success(ccsdsTele
491 502 rtems_isr commutation_isr1( rtems_vector_number vector )
492 503 {
493 504 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
494 printf("In spectral_matrices_isr *** Error sending event to DUMB\n");
505 printf("In commutation_isr1 *** Error sending event to DUMB\n");
495 506 }
496 507
497 508 rtems_isr commutation_isr2( rtems_vector_number vector )
498 509 {
499 510 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
500 printf("In spectral_matrices_isr *** Error sending event to DUMB\n");
511 printf("In commutation_isr2 *** Error sending event to DUMB\n");
501 512 }
502 513
503 514 rtems_task dumb_task( rtems_task_argument unused )
@@ -3,7 +3,7
3 3 rtems_isr waveforms_isr( rtems_vector_number vector )
4 4 {
5 5 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
6 printf("In spectral_matrices_isr *** Error sending event to WFRM\n");
6 printf("In waveforms_isr *** Error sending event to WFRM\n");
7 7 }
8 8
9 9 rtems_task wfrm_task(rtems_task_argument argument)
General Comments 0
You need to be logged in to leave comments. Login now