##// END OF EJS Templates
Initial commit.
paul -
r0:452a68f7426f default
parent child
Show More
@@ -0,0 +1,5
1 syntax: glob
2 *.pdf
3 *~
4 *.o
5 tests/*.err
@@ -0,0 +1,49
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 <CodeBlocks_project_file>
3 <FileVersion major="1" minor="6" />
4 <Project>
5 <Option title="FSW-rtems" />
6 <Option pch_mode="2" />
7 <Option compiler="sparc_rtems_gcc" />
8 <Build>
9 <Target title="Debug">
10 <Option output="bin\Debug\FSW-rtems" prefix_auto="1" extension_auto="1" />
11 <Option object_output="obj\Debug\" />
12 <Option type="1" />
13 <Option compiler="sparc_rtems_gcc" />
14 <Compiler>
15 <Add option="-O3" />
16 <Add option="-g" />
17 <Add directory="..\header" />
18 <Add directory="..\src" />
19 </Compiler>
20 </Target>
21 <Target title="Release">
22 <Option output="bin\Release\FSW-rtems" prefix_auto="1" extension_auto="1" />
23 <Option object_output="obj\Release\" />
24 <Option type="1" />
25 <Option compiler="sparc_rtems_gcc" />
26 <Compiler>
27 <Add option="-O2" />
28 </Compiler>
29 <Linker>
30 <Add option="-s" />
31 </Linker>
32 </Target>
33 </Build>
34 <Compiler>
35 <Add option="-Wall" />
36 </Compiler>
37 <Unit filename="..\header\FSW-rtems-processing.h" />
38 <Unit filename="..\src\FSW-rtems-processing.c">
39 <Option compilerVar="CC" />
40 </Unit>
41 <Unit filename="..\src\FSW-rtems.c">
42 <Option compilerVar="CC" />
43 </Unit>
44 <Extensions>
45 <code_completion />
46 <debugger />
47 </Extensions>
48 </Project>
49 </CodeBlocks_project_file>
@@ -0,0 +1,37
1 # depslib dependency file v1.0
2 1352469400 source:e:\missions\solo\dev_ple\src\fsw-rtems.c
3 <rtems.h>
4 <bsp.h>
5 <rtems/confdefs.h>
6 <drvmgr/drvmgr_confdefs.h>
7 <rtems.h>
8 <errno.h>
9 <fcntl.h>
10 <stdio.h>
11 <stdlib.h>
12 <FSW-config.c>
13 <grspw.h>
14 <apbuart.h>
15 <FSW-rtems-processing.h>
16
17 1350983928 source:e:\missions\solo\dev_ple\src\grspw.c
18 <..\header\grspw.h>
19 <stdio.h>
20
21 1350983928 e:\missions\solo\dev_ple\header\grspw.h
22
23 1351173364 source:e:\missions\solo\dev_ple\src\fsw-config.c
24 <drvmgr/ambapp_bus.h>
25
26 1351506239 e:\missions\solo\dev_ple\src\fsw-config.c
27 <drvmgr/ambapp_bus.h>
28
29 1352470008 source:e:\missions\solo\dev_ple\src\fsw-rtems-processing.c
30 <FSW-rtems-processing.h>
31 <math.h>
32 <stdio.h>
33 <leon.h>
34
35 1352470001 e:\missions\solo\dev_ple\header\fsw-rtems-processing.h
36 <rtems.h>
37
@@ -0,0 +1,13
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 <CodeBlocks_layout_file>
3 <ActiveTarget name="Debug" />
4 <File name="..\header\FSW-rtems-processing.h" open="1" top="1" tabpos="3">
5 <Cursor position="1016" topLine="1" />
6 </File>
7 <File name="..\src\FSW-rtems-processing.c" open="1" top="0" tabpos="2">
8 <Cursor position="17123" topLine="155" />
9 </File>
10 <File name="..\src\FSW-rtems.c" open="1" top="0" tabpos="1">
11 <Cursor position="5330" topLine="155" />
12 </File>
13 </CodeBlocks_layout_file>
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,60
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 <CodeBlocks_project_file>
3 <FileVersion major="1" minor="6" />
4 <Project>
5 <Option title="FSW" />
6 <Option pch_mode="2" />
7 <Option compiler="sparc_gcc" />
8 <Build>
9 <Target title="Debug">
10 <Option output="bin\Debug\FSW" prefix_auto="1" extension_auto="1" />
11 <Option object_output="obj\Debug\" />
12 <Option type="1" />
13 <Option compiler="sparc_gcc" />
14 <Compiler>
15 <Add directory="E:\MISSIONS\SOLO\DEV_PLE\src" />
16 <Add directory="E:\MISSIONS\SOLO\DEV_PLE\header" />
17 </Compiler>
18 </Target>
19 <Target title="Release">
20 <Option output="bin\Release\FSW" prefix_auto="1" extension_auto="1" />
21 <Option object_output="obj\Release\" />
22 <Option type="1" />
23 <Option compiler="sparc_gcc" />
24 <Compiler>
25 <Add option="-O2" />
26 </Compiler>
27 <Linker>
28 <Add option="-s" />
29 </Linker>
30 </Target>
31 </Build>
32 <Compiler>
33 <Add option="-Wall" />
34 </Compiler>
35 <Unit filename="..\header\LPP_grspw.h" />
36 <Unit filename="..\header\LPP_spwAPI.h" />
37 <Unit filename="..\header\TC_handler.h" />
38 <Unit filename="..\header\basic_parameters.h" />
39 <Unit filename="..\header\ccsds_types.h" />
40 <Unit filename="..\src\FSW.c">
41 <Option compilerVar="CC" />
42 </Unit>
43 <Unit filename="..\src\LPP_grspw.c">
44 <Option compilerVar="CC" />
45 </Unit>
46 <Unit filename="..\src\LPP_spwAPI.c">
47 <Option compilerVar="CC" />
48 </Unit>
49 <Unit filename="..\src\TC_handler.c">
50 <Option compilerVar="CC" />
51 </Unit>
52 <Unit filename="..\src\basic_parameters.c">
53 <Option compilerVar="CC" />
54 </Unit>
55 <Extensions>
56 <code_completion />
57 <debugger />
58 </Extensions>
59 </Project>
60 </CodeBlocks_project_file>
@@ -0,0 +1,54
1 # depslib dependency file v1.0
2 1350886242 source:e:\missions\solo\dev_ple\src\tc_handler.c
3 <..\header\TC_handler.h>
4
5 1350886291 e:\missions\solo\dev_ple\header\tc_handler.h
6 <..\header\ccsds_types.h>
7
8 1350657619 e:\missions\solo\dev_ple\header\ccsds_types.h
9
10 1350886272 source:e:\missions\solo\dev_ple\src\basic_parameters.c
11 <..\header\basic_parameters.h>
12 <math.h>
13
14 1350892168 e:\missions\solo\dev_ple\header\basic_parameters.h
15
16 1350896474 e:\missions\solo\dev_ple\header\spwapi_lpp.h
17 <asm-leon/leonstack.h>
18 <..\header\grspw.h>
19
20 1350904997 source:e:\missions\solo\dev_ple\src\spwapi_lpp.c
21 <..\header\spwAPI_LPP.h>
22 <stdlib.h>
23 <stdio.h>
24
25 1350989918 source:e:\missions\solo\dev_ple\src\fsw.c
26 <..\header\LPP_spwAPI.h>
27 <..\header\basic_parameters.h>
28 <..\header\ccsds_types.h>
29 <stdio.h>
30 <stdlib.h>
31 <asm-leon/timer.h>
32 <asm-leon/irq.h>
33
34 1350983928 e:\missions\solo\dev_ple\header\grspw.h
35
36 1350983928 source:e:\missions\solo\dev_ple\src\grspw.c
37 <..\header\grspw.h>
38 <stdio.h>
39
40 1350989928 source:e:\missions\solo\dev_ple\src\lpp_grspw.c
41 <..\header\LPP_grspw.h>
42 <stdio.h>
43
44 1350983928 e:\missions\solo\dev_ple\header\lpp_grspw.h
45
46 1350990063 source:e:\missions\solo\dev_ple\src\lpp_spwapi.c
47 <..\header\LPP_spwAPI.h>
48 <stdlib.h>
49 <stdio.h>
50
51 1350990050 e:\missions\solo\dev_ple\header\lpp_spwapi.h
52 <asm-leon/leonstack.h>
53 <..\header\LPP_grspw.h>
54
@@ -0,0 +1,31
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 <CodeBlocks_layout_file>
3 <ActiveTarget name="Debug" />
4 <File name="..\header\LPP_grspw.h" open="0" top="0" tabpos="0">
5 <Cursor position="315" topLine="0" />
6 </File>
7 <File name="..\header\TC_handler.h" open="0" top="0" tabpos="0">
8 <Cursor position="98" topLine="0" />
9 </File>
10 <File name="..\header\basic_parameters.h" open="0" top="0" tabpos="0">
11 <Cursor position="203" topLine="0" />
12 </File>
13 <File name="..\header\ccsds_types.h" open="0" top="0" tabpos="7">
14 <Cursor position="191" topLine="0" />
15 </File>
16 <File name="..\src\FSW.c" open="0" top="0" tabpos="1">
17 <Cursor position="23" topLine="39" />
18 </File>
19 <File name="..\src\LPP_grspw.c" open="0" top="0" tabpos="0">
20 <Cursor position="24" topLine="0" />
21 </File>
22 <File name="..\src\LPP_spwAPI.c" open="0" top="0" tabpos="0">
23 <Cursor position="670" topLine="15" />
24 </File>
25 <File name="..\src\TC_handler.c" open="0" top="0" tabpos="0">
26 <Cursor position="67" topLine="0" />
27 </File>
28 <File name="..\src\basic_parameters.c" open="0" top="0" tabpos="0">
29 <Cursor position="39" topLine="0" />
30 </File>
31 </CodeBlocks_layout_file>
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,1
1 grmon -gresb -ip 129.104.27.249 -dna 0xfe -sna 32 -link 0 -u
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,32
1 #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED
2 #define FSW_RTEMS_PROCESSING_H_INCLUDED
3
4 #include <rtems.h>
5
6 #define ADDRESS_APB_SPECTRAL_MATRICES 0x80000700
7 #define LPP_SPECTRAL_MATRIX_CTRL 0x80000700
8 #define LPP_SPECTRAL_MATRIX_1 0x80000704
9 #define LPP_SPECTRAL_MATRIX_2 0x80000708
10 #define IRQ_SPECTRAL_MATRICES 12
11
12 #define NB_BINS_SPECTRAL_MATRIX 128
13 #define NB_VALUES_PER_SPECTRAL_MATRIX 25
14 #define TOTAL_SIZE_SPECTRAL_MATRIX NB_BINS_SPECTRAL_MATRIX * NB_VALUES_PER_SPECTRAL_MATRIX
15 #define NB_BINS_COMPRESSED_MATRIX_f0 11
16 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f1 13
17 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f2 12
18 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX
19 #define NB_AVERAGE_NORMAL_f0 96*4
20
21 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
22 rtems_task spw_bppr_task(rtems_task_argument argument);
23 rtems_task spw_avf0_task(rtems_task_argument argument);
24 rtems_task spw_bpf0_task(rtems_task_argument argument);
25 rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument);
26 void matrix_average(volatile int *spectral_matrix, float *averaged_spectral_matrix);
27 void matrix_compression(float *averaged_spectral_matrix, unsigned char fChannel, float *compressed_spectral_matrix);
28 void matrix_reset(float *averaged_spectral_matrix);
29 void BP1_set(float * compressed_spectral_matrix, unsigned char nb_bins_compressed_spectral_matrix, unsigned char * LFR_BP1);
30 void BP2_set(float * compressed_spectral_matrix, unsigned char nb_bins_compressed_spectral_matrix);
31
32 #endif // FSW_RTEMS_PROCESSING_H_INCLUDED
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,235
1 #ifndef GRSPW_H_INCLUDED
2 #define GRSPW_H_INCLUDED
3
4 #define GRSPW_APB_ADDR 0x80000500
5
6 #define NODEADDR 0xfe
7 #define NODEADDR_M7A3P1000 0xfd
8 #define CLKDIV 0x0303
9 #define DESTKEY 0
10 #define RXMAXLEN 64
11 #define HEADERLEN 4
12
13 #define IFORCE 0x08
14 #define ICLEAR 0x0c
15 #define IMASK 0x40
16 #define GRSPW_IRQ 10
17
18 #define SPW_LINK_STATE_RESET 0
19 #define SPW_LINK_STATE_WAIT 1
20 #define SPW_LINK_STATE_READY 2
21 #define SPW_LINK_STATE_STARTED 3
22 #define SPW_LINK_STATE_CONNECTING 4
23 #define SPW_LINK_STATE_RUN 5
24
25 /////////////////////////////////////
26 /* GRSPW - Control Register - 0x00 */
27 #define GRSPW_CTRL_RA_BIT 31 // RMAP avaialble
28 #define GRSPW_CTRL_RX_BIT 30 // RX unaligned access
29 #define GRSPW_CTRL_RC_BIT 29 // RMAP CRC available
30 #define GRSPW_CTRL_NCH_BIT 27 // 28:27 number of DMA channels minus 1
31 #define GRSPW_CTRL_PO_BIT 26 // number of ports minus 1
32 #define GRSPW_CTRL_PS_BIT 21 // Port select
33 #define GRSPW_CTRL_NP_BIT 20 // No port force
34 #define GRSPW_CTRL_RD_BIT 17 // RMAP buffer disable
35 #define GRSPW_CTRL_RE_BIT 16 // RMAP Enable
36 #define GRSPW_CTRL_TR_BIT 11 // Time Rx enable
37 #define GRSPW_CTRL_TT_BIT 10 // Time Tx enable
38 #define GRSPW_CTRL_LI_BIT 9 // Link error IRQ
39 #define GRSPW_CTRL_TQ_BIT 8 // Tick-out IRQ
40 #define GRSPW_CTRL_RS_BIT 6 // Reset
41 #define GRSPW_CTRL_PM_BIT 5 // Promiscuous mode
42 #define GRSPW_CTRL_TI_BIT 4 // Tick In
43 #define GRSPW_CTRL_IE_BIT 3 // Interrupt enable
44 #define GRSPW_CTRL_AS_BIT 2 // Autostart
45 #define GRSPW_CTRL_LS_BIT 1 // Link Start
46 #define GRSPW_CTRL_LD_BIT 0 // Lind Disable
47
48 #define GRSPW_CTRL_RA (1<<GRSPW_CTRL_RA_BIT)
49 #define GRSPW_CTRL_RX (1<<GRSPW_CTRL_RX_BIT)
50 #define GRSPW_CTRL_RC (1<<GRSPW_CTRL_RC_BIT)
51 #define GRSPW_CTRL_NCH (0x3<<GRSPW_CTRL_NCH_BIT)
52 #define GRSPW_CTRL_PO (1<<GRSPW_CTRL_PO_BIT)
53 #define GRSPW_CTRL_PS (1<<GRSPW_CTRL_PS_BIT)
54 #define GRSPW_CTRL_NP (1<<GRSPW_CTRL_NP_BIT)
55 #define GRSPW_CTRL_RD (1<<GRSPW_CTRL_RD_BIT)
56 #define GRSPW_CTRL_RE (1<<GRSPW_CTRL_RE_BIT)
57 #define GRSPW_CTRL_TR (1<<GRSPW_CTRL_TR_BIT)
58 #define GRSPW_CTRL_TT (1<<GRSPW_CTRL_TT_BIT)
59 #define GRSPW_CTRL_LI (1<<GRSPW_CTRL_LI_BIT)
60 #define GRSPW_CTRL_TQ (1<<GRSPW_CTRL_TQ_BIT)
61 #define GRSPW_CTRL_RS (1<<GRSPW_CTRL_RS_BIT)
62 #define GRSPW_CTRL_PM (1<<GRSPW_CTRL_PM_BIT)
63 #define GRSPW_CTRL_TI (1<<GRSPW_CTRL_TI_BIT)
64 #define GRSPW_CTRL_IE (1<<GRSPW_CTRL_IE_BIT)
65 #define GRSPW_CTRL_AS (1<<GRSPW_CTRL_AS_BIT)
66 #define GRSPW_CTRL_LS (1<<GRSPW_CTRL_LS_BIT)
67 #define GRSPW_CTRL_LD (1<<GRSPW_CTRL_LD_BIT)
68
69 ////////////////////////////////////
70 /* GRSPW - Status Register - 0x04 */
71 #define GRSPW_STAT_LS_BIT 21 // Link State
72 #define GRSPW_STAT_AP_BIT 9 // Active Port
73 #define GRSPW_STAT_EE_BIT 8 // Early EOP-EEP
74 #define GRSPW_STAT_IA_BIT 7 // Invalid Address
75 #define GRSPW_STAT_PE_BIT 4 // Parity Error
76 #define GRSPW_STAT_DE_BIT 3 // Disconnect Error
77 #define GRSPW_STAT_ER_BIT 2 // Escape Error
78 #define GRSPW_STAT_CE_BIT 1 // Credit Error
79 #define GRSPW_STAT_TO_BIT 0 // Tick Out
80
81 #define GRSPW_STAT_LS (0x7<<GRSPW_STAT_LS_BIT)
82 #define GRSPW_STAT_AP (1<<GRSPW_STAT_AP_BIT)
83 #define GRSPW_STAT_EE (1<<GRSPW_STAT_EE_BIT)
84 #define GRSPW_STAT_IA (1<<GRSPW_STAT_IA_BIT)
85 #define GRSPW_STAT_WE (1<<GRSPW_STAT_WE_BIT)
86 #define GRSPW_STAT_PE (1<<GRSPW_STAT_PE_BIT)
87 #define GRSPW_STAT_DE (1<<GRSPW_STAT_DE_BIT)
88 #define GRSPW_STAT_ER (1<<GRSPW_STAT_ER_BIT)
89 #define GRSPW_STAT_CE (1<<GRSPW_STAT_CE_BIT)
90 #define GRSPW_STAT_TO (1<<GRSPW_STAT_TO_BIT)
91
92 /////////////////////////////////////////////
93 /* GRSPW - Default Address Register - 0x08 */
94 #define GRSPW_DEF_ADDR_BIT 0 // Default address
95 #define GRSPW_DEF_MASK_BIT 8 // Default mask
96 #define GRSPW_DEF_ADDR (0xff<<GRSPW_DEF_ADDR_BIT)
97 #define GRSPW_DEF_MASK (0xff<<GRSPW_DEF_MASK_BIT)
98
99 ///////////////////////////////////////////
100 /* GRSPW - Clock Divisor Register - 0x0C */
101 #define GRSPW_CLKDIV_START_BIT 8 // Clock divisor startup
102 #define GRSPW_CLKDIV_RUN_BIT 0 // Clock divisor run
103 #define GRSPW_CLKDIV_START (0xff<<GRSPW_CLKDIV_START_BIT)
104 #define GRSPW_CLKDIV_RUN (0xff<<GRSPW_CLKDIV_RUN_BIT)
105 #define GRSPW_CLKDIV_MASK (GRSPW_CLKDIV_START|GRSPW_CLKDIV_RUN)
106
107 /////////////////////////////////////////////
108 /* GRSPW - Destination key Register - 0x10 */
109 #define GRSPW_DK_DESTKEY_BIT 0 // Destination key
110 #define GRSPW_DK_DESTKEY (0xff<<GRSPW_DK_DESTKEY_BIT)
111
112 //////////////////////////////////
113 /* GRSPW - Time Register - 0x14 */
114 #define GRSPW_TIME_CTRL_BIT 0 // Time counter
115 #define GRSPW_TIME_CNT_BIT 6 // Time control flags
116 #define GRSPW_TIME_CTRL (0x3f<<GRSPW_TIME_CTRL_BIT)
117 #define GRSPW_TIME_TCNT (0x3<<GRSPW_TIME_CNT_BIT)
118
119 ///////////////////////////////////////////
120 /* GRSPW - DMA Control Register - 0x20*N */
121 #define GRSPW_DMACTRL_LE_BIT 16 // Link error disable
122 #define GRSPW_DMACTRL_SP_BIT 15 // Strip PID
123 #define GRSPW_DMACTRL_SA_BIT 14 // Strip address
124 #define GRSPW_DMACTRL_EN_BIT 13 // Enable address
125 #define GRSPW_DMACTRL_NS_BIT 12 // No spill
126 #define GRSPW_DMACTRL_RD_BIT 11 // Rx descriptors available
127 #define GRSPW_DMACTRL_RX_BIT 10 // RX active
128 #define GRSPW_DMACTRL_AT_BIT 9 // Abort TX
129 #define GRSPW_DMACTRL_RA_BIT 8 // RX AHB error
130 #define GRSPW_DMACTRL_TA_BIT 7 // TX AHB error
131 #define GRSPW_DMACTRL_PR_BIT 6 // Packet received
132 #define GRSPW_DMACTRL_PS_BIT 5 // Packet sent
133 #define GRSPW_DMACTRL_AI_BIT 4 // AHB error interrupt
134 #define GRSPW_DMACTRL_RI_BIT 3 // Receive interrupt
135 #define GRSPW_DMACTRL_TI_BIT 2 // Transmit interrupt
136 #define GRSPW_DMACTRL_RE_BIT 1 // Receiver enable
137 #define GRSPW_DMACTRL_TE_BIT 0 // Transmitter enable
138
139 #define GRSPW_DMACTRL_LE (1<<GRSPW_DMACTRL_LE_BIT)
140 #define GRSPW_DMACTRL_SP (1<<GRSPW_DMACTRL_SP_BIT)
141 #define GRSPW_DMACTRL_SA (1<<GRSPW_DMACTRL_SA_BIT)
142 #define GRSPW_DMACTRL_EN (1<<GRSPW_DMACTRL_EN_BIT)
143 #define GRSPW_DMACTRL_NS (1<<GRSPW_DMACTRL_NS_BIT)
144 #define GRSPW_DMACTRL_RD (1<<GRSPW_DMACTRL_RD_BIT)
145 #define GRSPW_DMACTRL_RX (1<<GRSPW_DMACTRL_RX_BIT)
146 #define GRSPW_DMACTRL_AT (1<<GRSPW_DMACTRL_AT_BIT)
147 #define GRSPW_DMACTRL_RA (1<<GRSPW_DMACTRL_RA_BIT)
148 #define GRSPW_DMACTRL_TA (1<<GRSPW_DMACTRL_TA_BIT)
149 #define GRSPW_DMACTRL_PR (1<<GRSPW_DMACTRL_PR_BIT)
150 #define GRSPW_DMACTRL_PS (1<<GRSPW_DMACTRL_PS_BIT)
151 #define GRSPW_DMACTRL_AI (1<<GRSPW_DMACTRL_AI_BIT)
152 #define GRSPW_DMACTRL_RI (1<<GRSPW_DMACTRL_RI_BIT)
153 #define GRSPW_DMACTRL_TI (1<<GRSPW_DMACTRL_TI_BIT)
154 #define GRSPW_DMACTRL_RE (1<<GRSPW_DMACTRL_RE_BIT)
155 #define GRSPW_DMACTRL_TE (1<<GRSPW_DMACTRL_TE_BIT)
156
157 //////////////////////////////////////////////////////////////////////
158 /* GRSPW - DMA Channel Max Packet Length Register - (0x20*N + 0x04) */
159 #define GRSPW_DMARXLEN_MAX_BIT 0 // RX maximum length
160 #define GRSPW_DMARXLEN_MAX (0xffffff<<GRSPW_DMARXLEN_MAX_BIT)
161
162 /* GRSPW - DMA Channel Address Register - (0x20*N + 0x10) */
163 #define GRSPW_DMAADR_ADDR_BIT 0 // address
164 #define GRSPW_DMAADR_MASK_BIT 8 // Mask
165 #define GRSPW_DMAADR_ADDR (0xff<<GRSPW_DMAADR_ADDR_BIT)
166 #define GRSPW_DMAADR_MASK (0xff<<GRSPW_DMAADR_MASK_BIT)
167
168 /* RX Buffer Descriptor */
169 struct grspw_rxbd {
170 volatile unsigned int ctrl;
171 volatile unsigned int addr;
172 };
173
174 /* TX Buffer Descriptor */
175 struct grspw_txbd {
176 volatile unsigned int ctrl;
177 volatile unsigned int haddr;
178 volatile unsigned int dlen;
179 volatile unsigned int daddr;
180 };
181
182 ///////////////////////////////////////////
183 /* GRSPW - DMA Receive descriptor word 0 */
184 #define GRSPW_RXBD_LEN_BIT 0
185 #define GRSPW_RXBD_LEN (0x1ffffff<<GRSPW_RXBD_LEN_BIT)
186 #define GRSPW_RXBD_EN (1<<25) // Enable
187 #define GRSPW_RXBD_WR (1<<26) // Wrap
188 #define GRSPW_RXBD_IE (1<<27) // Interrupt enable
189 #define GRSPW_RXBD_EP (1<<28) // EEP termination
190 #define GRSPW_RXBD_HC (1<<29) // Header CRC
191 #define GRSPW_RXBD_DC (1<<30) // Data CRC
192 #define GRSPW_RXBD_TR (1<<31) // Truncated
193
194 ////////////////////////////////////////////
195 /* GRSPW - DMA Transmit descriptor word 0 */
196 #define GRSPW_TXBD_HLEN (0xff<<0) // header length
197 #define GRSPW_TXBD_NCL (0xf<<8) // non-CRC bytes
198 #define GRSPW_TXBD_EN (1<<12) // Enable
199 #define GRSPW_TXBD_WR (1<<13) // Wrap
200 #define GRSPW_TXBD_IE (1<<14) // Interrupt enable
201 #define GRSPW_TXBD_LE (1<<15) // Link error
202 #define GRSPW_TXBD_HC (1<<16) // Append header CRC
203 #define GRSPW_TXBD_DC (1<<17) // Append data CRC
204
205 struct grspwregs_str
206 {
207 volatile int ctrl;
208 volatile int status;
209 volatile int nodeaddr;
210 volatile int clkdiv;
211 volatile int destkey;
212 volatile int time;
213 volatile int unused[2];
214 volatile int dmactrl;
215 volatile int rxmaxlen;
216 volatile int txdesc;
217 volatile int rxdesc;
218 };
219 typedef struct grspwregs_str grspwregs_t;
220
221 struct spacewire_PARAMETERS_str
222 {
223 int *size;
224 volatile char *rx;
225 volatile int *rxd;
226 char *tx;
227 volatile int *txd;
228 grspwregs_t *regs;
229 } spacewire_PARAMETERS;
230
231 ////////////
232 // FUNCTIONS
233 unsigned int grspw_link_state(grspwregs_t *);
234
235 #endif // GRSPW_H_INCLUDED
@@ -0,0 +1,95
1 #ifndef SPWAPI_LPP_H
2 #define SPWAPI_LPP_H
3
4 #include <asm-leon/leonstack.h>
5 #include <..\header\LPP_grspw.h>
6
7 #define LPP_TIME_MANAGER 0x80000600
8
9 struct spectral_matrices_regs_str
10 {
11 volatile unsigned int ctrl;
12 volatile unsigned int address1;
13 volatile unsigned int address2;
14 };
15 typedef struct spectral_matrices_regs_str spectral_matrices_regs_t;
16
17 struct packet_type_str
18 {
19 char time_packet;
20 char tc_packet;
21 } packet_type;
22
23 struct spwHeader_str
24 {
25 unsigned char targetLogicalAddress;
26 unsigned char protocolIdentifier;
27 unsigned char reserved;
28 unsigned char userApplication;
29 };
30 typedef struct spwHeader_str spwHeader_t;
31
32 struct time_manager_regs_str
33 {
34 volatile int ctrl;
35 volatile int next_coarse_time;
36 volatile int current_coarse_time;
37 volatile int fine_time;
38 };
39 typedef struct time_manager_regs_str time_manager_regs_t;
40
41 // GENERAL PURPOSE FUNCTIONS
42
43 inline int loadmemAPI(int addr);
44
45 inline char loadb(int addr);
46
47 char *almalloc(int sz);
48
49 ////////////////
50 // SPW FUNCTIONS
51 ////////////////
52
53 void spw_reset(grspwregs_t *regs);
54
55 void spw_init(int nodeaddr, int clkdiv, int destkey, int rxmaxlen, grspwregs_t *regs);
56
57 void set_txd(char *dataAddress, unsigned int dataLength, char *headerAddress, unsigned int headerLength, volatile int *txd);
58
59 int spw_checkrx(int* size, volatile int *rxd, grspwregs_t *regs);
60
61 int spw_checktx(grspwregs_t *regs);
62
63 void enable_transmitter_descriptor(unsigned int headerLength, volatile int *txd);
64
65 void enable_transmitter(grspwregs_t *regs);
66
67 void enable_receiver_descriptor(volatile char *rx, volatile int *rxd);
68
69 void enable_receiver(grspwregs_t *regs);
70
71 void send_data(unsigned int headerLength, volatile int *txd, grspwregs_t *regs, char* tx, char value);
72
73 int enable_timecode_reception(grspwregs_t *regs);
74
75 int check_time(grspwregs_t *grspw_regs);
76
77 //////////////
78 // GENERAL USE
79 //////////////
80
81 void send_fine_time(unsigned int fine_time);
82
83 //////
84 // IRQ
85 //////
86
87 int irqhandler_receive_CCSDS(int irq, void * args, struct leonbare_pt_regs *leon_regs);
88
89 int enable_irq(int irq);
90
91 int disable_irq(int irq);
92
93 int force_irq(int irq);
94
95 #endif // SPWAPI_LPP_H
@@ -0,0 +1,8
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
4 #include <..\header\ccsds_types.h>
5
6 char TM_checker(ccsdsTelecommandSourcePacketHeader_t * TMPacket);
7
8 #endif // TC_HANDLER_H_INCLUDED
@@ -0,0 +1,28
1 #ifndef BASIC_PARAMETERS_H_INCLUDED
2 #define BASIC_PARAMETERS_H_INCLUDED
3
4 #define LPP_SPECTRAL_MATRIX_CTRL 0x80000700
5 #define LPP_SPECTRAL_MATRIX_1 0x80000704
6 #define LPP_SPECTRAL_MATRIX_2 0x80000708
7
8 #define NB_BINS_SPECTRAL_MATRIX 128
9 #define NB_VALUES_PER_SPECTRAL_MATRIX 30
10 #define TOTAL_SIZE_SPECTRAL_MATRIX NB_BINS_SPECTRAL_MATRIX * NB_VALUES_PER_SPECTRAL_MATRIX
11 #define NB_BINS_COMPRESSED_MATRIX_f0 11
12 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f1 13
13 #define SIZE_COMPRESSED_SPECTRAL_MATRIX_f2 12
14 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_SPECTRAL_MATRIX
15 #define NB_AVERAGE_NORMAL_f0 4
16
17 volatile int spectral_matrix_f0_a[TOTAL_SIZE_SPECTRAL_MATRIX];
18 volatile int spectral_matrix_f0_b[TOTAL_SIZE_SPECTRAL_MATRIX];
19 int averaged_spectral_matrix_f0[TOTAL_SIZE_SPECTRAL_MATRIX];
20
21 float compressed_spectral_matrix_f0[TOTAL_SIZE_COMPRESSED_MATRIX_f0];
22
23 unsigned char LFR_BP1_F0[NB_BINS_COMPRESSED_MATRIX_f0*9];
24
25 void BP1_set();
26 void BP2_set();
27
28 #endif // BASIC_PARAMETERS_H_INCLUDED
@@ -0,0 +1,68
1 #ifndef CCSDS_H_INCLUDED
2 #define CCSDS_H_INCLUDED
3
4 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
5 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
6 #define CCSDS_TELECOMMAND_MAX_PACKET_LENGTH 248
7 #define CCSDS_PROCESS_ID 11
8 #define CCSDS_PACKET_CATEGORY 12
9
10 #define CCSDS_ERR_PID -1
11 #define CCSDS_ERR_CAT -2
12 #define CCSDS_ERR_LENGTH -3
13 #define CCSDS_ERR_TYPE -4
14 #define CCSDS_ERR_SUBTYPE -5
15 #define CCSDS_ERR_SRC -6
16 #define CCSDS_ERR_CRC -7
17 #define CCSDS_TM_VALID 1
18
19 struct ccsdsTelemetrySourcePacketHeader_str
20 {
21 unsigned char targetLogicalAddress;
22 unsigned char protocolIdentifier;
23 unsigned char reserved;
24 unsigned char userApplication;
25 unsigned char packetID[2];
26 unsigned char packetSequenceControl[2];
27 unsigned char packetLength[2];
28 unsigned char dataFieldHeader[10];
29 };
30 typedef struct ccsdsTelemetrySourcePacketHeader_str ccsdsTelemetrySourcePacketHeader_t;
31
32 struct ccsdsTelecommandSourcePacketHeader_str
33 {
34 unsigned char targetLogicalAddress;
35 unsigned char protocolIdentifier;
36 unsigned char reserved;
37 unsigned char userApplication;
38 unsigned char packetID[2];
39 unsigned char packetSequenceControl[2];
40 unsigned char packetLength[2];
41 unsigned char dataFieldHeader[4];
42 };
43 typedef struct ccsdsTelemetrySourcePacketHeader_str ccsdsTelecommandSourcePacketHeader_t;
44
45 // initialize the ccsds telemetry header
46 ccsdsTelemetrySourcePacketHeader_t ccsdsTelemetryHeader;
47 #define INIT_CCSDS_TELEMETRY_HEADER ccsdsTelemetryHeader.targetLogicalAddress = 0x21; \
48 ccsdsTelemetryHeader.protocolIdentifier = 0x02; \
49 ccsdsTelemetryHeader.reserved = 0x00; \
50 ccsdsTelemetryHeader.userApplication = 0x00; \
51 ccsdsTelemetryHeader.packetID[0] = 0x08; \
52 ccsdsTelemetryHeader.packetID[1] = 0xbc; \
53 ccsdsTelemetryHeader.packetSequenceControl[0] = 0xc0; \
54 ccsdsTelemetryHeader.packetSequenceControl[1] = 0x00; \
55 ccsdsTelemetryHeader.packetLength[0] = 0x00; \
56 ccsdsTelemetryHeader.packetLength[1] = 0x00; \
57 ccsdsTelemetryHeader.dataFieldHeader[0] = 0x00; \
58 ccsdsTelemetryHeader.dataFieldHeader[1] = 0x00; \
59 ccsdsTelemetryHeader.dataFieldHeader[2] = 0x00; \
60 ccsdsTelemetryHeader.dataFieldHeader[3] = 0x00; \
61 ccsdsTelemetryHeader.dataFieldHeader[4] = 0x00; \
62 ccsdsTelemetryHeader.dataFieldHeader[5] = 0x00; \
63 ccsdsTelemetryHeader.dataFieldHeader[6] = 0x00; \
64 ccsdsTelemetryHeader.dataFieldHeader[7] = 0x00; \
65 ccsdsTelemetryHeader.dataFieldHeader[8] = 0x00; \
66 ccsdsTelemetryHeader.dataFieldHeader[9] = 0x00;
67
68 #endif // CCSDS_H_INCLUDED
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,44
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2 <CodeBlocks_project_file>
3 <FileVersion major="1" minor="6" />
4 <Project>
5 <Option title="rtems-hello" />
6 <Option pch_mode="2" />
7 <Option compiler="sparc_rtems_gcc" />
8 <Build>
9 <Target title="Debug">
10 <Option output="bin\Debug\rtems-hello" prefix_auto="1" extension_auto="1" />
11 <Option object_output="obj\Debug\" />
12 <Option type="1" />
13 <Option compiler="sparc_rtems_gcc" />
14 <Compiler>
15 <Add option="-g" />
16 <Add directory="C:\opt\rtems-4.10-mingw\src\samples" />
17 <Add directory="C:\opt\rtems-4.10-mingw\sparc-rtems\leon3\lib\include" />
18 </Compiler>
19 </Target>
20 <Target title="Release">
21 <Option output="bin\Release\rtems-hello" prefix_auto="1" extension_auto="1" />
22 <Option object_output="obj\Release\" />
23 <Option type="1" />
24 <Option compiler="sparc_rtems_gcc" />
25 <Compiler>
26 <Add option="-O2" />
27 </Compiler>
28 <Linker>
29 <Add option="-s" />
30 </Linker>
31 </Target>
32 </Build>
33 <Compiler>
34