aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios/os/common/abstractions/nasa_cfe/psp/include
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios/os/common/abstractions/nasa_cfe/psp/include')
-rw-r--r--lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp.h375
-rw-r--r--lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp_config.h21
-rw-r--r--lib/chibios/os/common/abstractions/nasa_cfe/psp/include/psp_version.h38
3 files changed, 434 insertions, 0 deletions
diff --git a/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp.h b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp.h
new file mode 100644
index 000000000..402064c1f
--- /dev/null
+++ b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp.h
@@ -0,0 +1,375 @@
1/*
2** File Name: cfe_psp.h
3**
4** Copyright (c) 2004-2006, United States government as represented by the
5** administrator of the National Aeronautics Space Administration.
6** All rights reserved. This software(cFE) was created at NASA's Goddard
7** Space Flight Center pursuant to government contracts.
8**
9** This software may be used only pursuant to a United States government
10** sponsored project and the United States government may not be charged
11** for use thereof.
12**
13** Author: A. Cudmore
14**
15** Purpose: This file contains the cFE Platform Support Package(PSP)
16** prototypes.
17** The PSP routines serve as the "glue" between the RTOS and
18** the cFE Flight Software. The routines fill gaps that are not
19** really considered part of the OS Abstraction, but are required
20** for the cFE flight software implementation. It is possible that
21** some of these routines could migrate into the OS AL.
22**
23** $Log: cfe_psp.h $
24** Revision 1.3 2009/07/29 12:04:46GMT-05:00 acudmore
25** Added Bank parameter to EEPROM Power up/down and EEPROM write enable/disable functions.
26** Revision 1.2 2009/07/22 17:34:10EDT acudmore
27** Added new watchdog API
28** Revision 1.1 2009/06/10 09:28:44EDT acudmore
29** Initial revision
30** Member added to project c:/MKSDATA/MKS-REPOSITORY/CFE-PSP-REPOSITORY/fsw/inc/project.pj
31**
32*/
33
34#ifndef _cfe_psp_
35#define _cfe_psp_
36
37/*
38** Include Files
39*/
40
41#include "common_types.h"
42#include "osapi.h"
43#include "cfe_psp_config.h"
44#include "psp_version.h"
45
46/*
47** Macro Definitions
48*/
49
50/*
51** Error and return codes
52*/
53#define CFE_PSP_SUCCESS (0)
54#define CFE_PSP_ERROR (-1)
55#define CFE_PSP_INVALID_POINTER (-2)
56#define CFE_PSP_ERROR_ADDRESS_MISALIGNED (-3)
57#define CFE_PSP_ERROR_TIMEOUT (-4)
58#define CFE_PSP_INVALID_INT_NUM (-5)
59#define CFE_PSP_INVALID_MEM_ADDR (-21)
60#define CFE_PSP_INVALID_MEM_TYPE (-22)
61#define CFE_PSP_INVALID_MEM_RANGE (-23)
62#define CFE_PSP_INVALID_MEM_WORDSIZE (-24)
63#define CFE_PSP_INVALID_MEM_SIZE (-25)
64#define CFE_PSP_INVALID_MEM_ATTR (-26)
65#define CFE_PSP_ERROR_NOT_IMPLEMENTED (-27)
66
67
68
69/*
70** Definitions for PSP PANIC types
71*/
72#define CFE_PSP_PANIC_STARTUP 1
73#define CFE_PSP_PANIC_VOLATILE_DISK 2
74#define CFE_PSP_PANIC_MEMORY_ALLOC 3
75#define CFE_PSP_PANIC_NONVOL_DISK 4
76#define CFE_PSP_PANIC_STARTUP_SEM 5
77#define CFE_PSP_PANIC_CORE_APP 6
78#define CFE_PSP_PANIC_GENERAL_FAILURE 7
79
80/*
81** Macros for the file loader
82*/
83#define BUFF_SIZE 256
84#define SIZE_BYTE 1
85#define SIZE_HALF 2
86#define SIZE_WORD 3
87
88/*
89** Define memory types
90*/
91#define CFE_PSP_MEM_RAM 1
92#define CFE_PSP_MEM_EEPROM 2
93#define CFE_PSP_MEM_ANY 3
94#define CFE_PSP_MEM_INVALID 4
95
96/*
97** Define Memory Read/Write Attributes
98*/
99#define CFE_PSP_MEM_ATTR_WRITE 0x01
100#define CFE_PSP_MEM_ATTR_READ 0x02
101#define CFE_PSP_MEM_ATTR_READWRITE 0x03
102
103/*
104** Define the Memory Word Sizes
105*/
106#define CFE_PSP_MEM_SIZE_BYTE 0x01
107#define CFE_PSP_MEM_SIZE_WORD 0x02
108#define CFE_PSP_MEM_SIZE_DWORD 0x04
109
110/*
111** Type Definitions
112*/
113
114/*
115** Memory table type
116*/
117typedef struct
118{
119 uint32 MemoryType;
120 uint32 WordSize;
121 uint32 StartAddr;
122 uint32 Size;
123 uint32 Attributes;
124} CFE_PSP_MemTable_t;
125
126/*
127** Function prototypes
128*/
129
130/*
131** PSP entry point and reset routines
132*/
133extern void CFE_PSP_Main(int ModeId, char *StartupFilePath);
134
135/*
136** CFE_PSP_Main is the entry point that the real time OS calls to start our
137** software. This routine will do any BSP/OS specific setup, then call the
138** entrypoint of the flight software ( i.e. the cFE main entry point ).
139** The flight software (i.e. cFE ) should not call this routine.
140*/
141
142extern void CFE_PSP_GetTime(OS_time_t *LocalTime);
143/* This call gets the local time from the hardware on the Vxworks system
144 * on the mcp750s
145 * on the other os/hardware setup, it will get the time the normal way */
146
147
148extern void CFE_PSP_Restart(uint32 resetType);
149/*
150** CFE_PSP_Restart is the entry point back to the BSP to restart the processor.
151** The flight software calls this routine to restart the processor.
152*/
153
154
155extern uint32 CFE_PSP_GetRestartType(uint32 *restartSubType );
156/*
157** CFE_PSP_GetRestartType returns the last reset type and if a pointer to a valid
158** memory space is passed in, it returns the reset sub-type in that memory.
159** Right now the reset types are application specific. For the cFE they
160** are defined in the cfe_es.h file.
161*/
162
163
164extern void CFE_PSP_FlushCaches(uint32 type, uint32 address, uint32 size);
165/*
166** This is a BSP specific cache flush routine
167*/
168
169extern uint32 CFE_PSP_GetProcessorId ( void );
170/*
171** CFE_PSP_GetProcessorId returns the CPU ID as defined by the specific board
172** and BSP.
173*/
174
175
176extern uint32 CFE_PSP_GetSpacecraftId ( void );
177/*
178** CFE_PSP_GetSpacecraftId retuns the Spacecraft ID (if any )
179*/
180
181
182extern uint32 CFE_PSP_Get_Timer_Tick(void);
183/*
184** CFE_PSP_Get_Timer_Tick returns the underlying OS timer tick value
185** It is used for the performance monitoring software
186*/
187
188extern uint32 CFE_PSP_GetTimerTicksPerSecond(void);
189/*
190** CFE_PSP_GetTimerTicksPerSecond provides the resolution of the least significant
191** 32 bits of the 64 bit time stamp returned by CFE_PSP_Get_Timebase in timer
192** ticks per second. The timer resolution for accuracy should not be any slower
193** than 1000000 ticks per second or 1 us per tick
194*/
195
196extern uint32 CFE_PSP_GetTimerLow32Rollover(void);
197/*
198** CFE_PSP_GetTimerLow32Rollover provides the number that the least significant
199** 32 bits of the 64 bit time stamp returned by CFE_PSP_Get_Timebase rolls over.
200** If the lower 32 bits rolls at 1 second, then the CFE_PSP_TIMER_LOW32_ROLLOVER
201** will be 1000000. if the lower 32 bits rolls at its maximum value (2^32) then
202** CFE_PSP_TIMER_LOW32_ROLLOVER will be 0.
203*/
204
205extern void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl);
206/*
207** CFE_PSP_Get_Timebase
208*/
209
210extern uint32 CFE_PSP_Get_Dec(void);
211/*
212** CFE_PSP_Get_Dec
213*/
214
215
216extern int32 CFE_PSP_InitProcessorReservedMemory(uint32 RestartType );
217/*
218** CFE_PSP_InitProcessorReservedMemory initializes all of the memory in the
219** BSP that is preserved on a processor reset. The memory includes the
220** Critical Data Store, the ES Reset Area, the Volatile Disk Memory, and
221** the User Reserved Memory. In general, the memory areas will be initialized
222** ( cleared ) on a Power On reset, and preserved during a processor reset.
223*/
224
225extern int32 CFE_PSP_GetCDSSize(uint32 *SizeOfCDS);
226/*
227** CFE_PSP_GetCDSSize fetches the size of the OS Critical Data Store area.
228*/
229
230extern int32 CFE_PSP_WriteToCDS(void *PtrToDataToWrite, uint32 CDSOffset, uint32 NumBytes);
231/*
232** CFE_PSP_WriteToCDS writes to the CDS Block.
233*/
234
235extern int32 CFE_PSP_ReadFromCDS(void *PtrToDataToRead, uint32 CDSOffset, uint32 NumBytes);
236/*
237** CFE_PSP_ReadFromCDS reads from the CDS Block
238*/
239
240extern int32 CFE_PSP_GetResetArea (void *PtrToResetArea, uint32 *SizeOfResetArea);
241/*
242** CFE_PSP_GetResetArea returns the location and size of the ES Reset information area.
243** This area is preserved during a processor reset and is used to store the
244** ER Log, System Log and reset related variables
245*/
246
247extern int32 CFE_PSP_GetUserReservedArea(void *PtrToUserArea, uint32 *SizeOfUserArea );
248/*
249** CFE_PSP_GetUserReservedArea returns the location and size of the memory used for the cFE
250** User reserved area.
251*/
252
253extern int32 CFE_PSP_GetVolatileDiskMem(void *PtrToVolDisk, uint32 *SizeOfVolDisk );
254/*
255** CFE_PSP_GetVolatileDiskMem returns the location and size of the memory used for the cFE
256** volatile disk.
257*/
258
259extern int32 CFE_PSP_GetKernelTextSegmentInfo(void *PtrToKernelSegment, uint32 *SizeOfKernelSegment);
260/*
261** CFE_PSP_GetKernelTextSegmentInfo returns the location and size of the kernel memory.
262*/
263
264extern int32 CFE_PSP_GetCFETextSegmentInfo(void *PtrToCFESegment, uint32 *SizeOfCFESegment);
265/*
266** CFE_PSP_GetCFETextSegmentInfo returns the location and size of the kernel memory.
267*/
268
269extern void CFE_PSP_WatchdogInit(void);
270/*
271** CFE_PSP_WatchdogInit configures the watchdog timer.
272*/
273
274extern void CFE_PSP_WatchdogEnable(void);
275/*
276** CFE_PSP_WatchdogEnable enables the watchdog timer.
277*/
278
279extern void CFE_PSP_WatchdogDisable(void);
280/*
281** CFE_PSP_WatchdogDisable disables the watchdog timer.
282*/
283
284extern void CFE_PSP_WatchdogService(void);
285/*
286** CFE_PSP_WatchdogService services the watchdog timer according to the
287** value set in WatchDogSet.
288*/
289
290extern uint32 CFE_PSP_WatchdogGet(void);
291/*
292** CFE_PSP_WatchdogGet gets the watchdog time in milliseconds
293*/
294
295extern void CFE_PSP_WatchdogSet(uint32 WatchdogValue);
296/*
297** CFE_PSP_WatchdogSet sets the watchdog time in milliseconds
298*/
299
300extern void CFE_PSP_Panic(int32 ErrorCode);
301/*
302** CFE_PSP_Panic is called by the cFE Core startup code when it needs to abort the
303** cFE startup. This should not be called by applications.
304*/
305
306extern int32 CFE_PSP_InitSSR(uint32 bus, uint32 device, char *DeviceName );
307/*
308** CFE_PSP_InitSSR will initialize the Solid state recorder memory for a particular platform
309*/
310
311extern int32 CFE_PSP_Decompress( char * srcFileName, char * dstFileName );
312/*
313** CFE_PSP_Decompress will uncompress the source file to the file specified in the
314** destination file name. The Decompress uses the "gzip" algorithm. Files can
315** be compressed using the "gzip" program available on almost all host platforms.
316*/
317
318extern void CFE_PSP_AttachExceptions(void);
319/*
320** CFE_PSP_AttachExceptions will setup the exception environment for the chosen platform
321** On a board, this can be configured to look at a debug flag or switch in order to
322** keep the standard OS exeption handlers, rather than restarting the system
323*/
324
325
326extern void CFE_PSP_SetDefaultExceptionEnvironment(void);
327/*
328**
329** CFE_PSP_SetDefaultExceptionEnvironment defines the CPU and FPU exceptions that are enabled for each cFE Task/App
330**
331** Notes: The exception environment is local to each task Therefore this must be
332** called for each task that that wants to do floating point and catch exceptions
333*/
334
335
336/*
337** I/O Port API
338*/
339int32 CFE_PSP_PortRead8 (uint32 PortAddress, uint8 *ByteValue);
340int32 CFE_PSP_PortWrite8 (uint32 PortAddress, uint8 ByteValue);
341int32 CFE_PSP_PortRead16 (uint32 PortAddress, uint16 *uint16Value);
342int32 CFE_PSP_PortWrite16 (uint32 PortAddress, uint16 uint16Value);
343int32 CFE_PSP_PortRead32 (uint32 PortAddress, uint32 *uint32Value);
344int32 CFE_PSP_PortWrite32 (uint32 PortAddress, uint32 uint32Value);
345
346/*
347** Memory API
348*/
349int32 CFE_PSP_MemRead8 (uint32 MemoryAddress, uint8 *ByteValue);
350int32 CFE_PSP_MemWrite8 (uint32 MemoryAddress, uint8 ByteValue);
351int32 CFE_PSP_MemRead16 (uint32 MemoryAddress, uint16 *uint16Value);
352int32 CFE_PSP_MemWrite16 (uint32 MemoryAddress, uint16 uint16Value);
353int32 CFE_PSP_MemRead32 (uint32 MemoryAddress, uint32 *uint32Value);
354int32 CFE_PSP_MemWrite32 (uint32 MemoryAddress, uint32 uint32Value);
355
356int32 CFE_PSP_MemCpy (void *dest, void *src, uint32 n);
357int32 CFE_PSP_MemSet (void *dest, uint8 value, uint32 n);
358
359int32 CFE_PSP_MemValidateRange (uint32 Address, uint32 Size, uint32 MemoryType);
360uint32 CFE_PSP_MemRanges (void);
361int32 CFE_PSP_MemRangeSet (uint32 RangeNum, uint32 MemoryType, uint32 StartAddr,
362 uint32 Size, uint32 WordSize, uint32 Attributes);
363int32 CFE_PSP_MemRangeGet (uint32 RangeNum, uint32 *MemoryType, uint32 *StartAddr,
364 uint32 *Size, uint32 *WordSize, uint32 *Attributes);
365
366int32 CFE_PSP_EepromWrite8 (uint32 MemoryAddress, uint8 ByteValue);
367int32 CFE_PSP_EepromWrite16 (uint32 MemoryAddress, uint16 uint16Value);
368int32 CFE_PSP_EepromWrite32 (uint32 MemoryAddress, uint32 uint32Value);
369
370int32 CFE_PSP_EepromWriteEnable (uint32 Bank);
371int32 CFE_PSP_EepromWriteDisable(uint32 Bank);
372int32 CFE_PSP_EepromPowerUp (uint32 Bank);
373int32 CFE_PSP_EepromPowerDown (uint32 Bank);
374
375#endif /* _cfe_psp_ */
diff --git a/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp_config.h b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp_config.h
new file mode 100644
index 000000000..0967e078c
--- /dev/null
+++ b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/cfe_psp_config.h
@@ -0,0 +1,21 @@
1/*
2** cfe_psp_config.h
3**
4** Copyright (c) 2004-2006, United States government as represented by the
5** administrator of the National Aeronautics Space Administration.
6** All rights reserved. This software(cFE) was created at NASA Goddard
7** Space Flight Center pursuant to government contracts.
8**
9** This software may be used only pursuant to a United States government
10** sponsored project and the United States government may not be charged
11** for use thereof.
12**
13**
14*/
15
16#ifndef _cfe_psp_config_
17#define _cfe_psp_config_
18
19#include "common_types.h"
20
21#endif /* _cfe_psp_config_ */
diff --git a/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/psp_version.h b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/psp_version.h
new file mode 100644
index 000000000..c5374c461
--- /dev/null
+++ b/lib/chibios/os/common/abstractions/nasa_cfe/psp/include/psp_version.h
@@ -0,0 +1,38 @@
1/*
2** $Id: psp_version.h 1.2.2.3 2014/10/01 15:41:27GMT-05:00 sstrege Exp $
3**
4**
5** Copyright (c) 2004-2006, United States government as represented by the
6** administrator of the National Aeronautics Space Administration.
7** All rights reserved. This software(cFE) was created at NASA's Goddard
8** Space Flight Center pursuant to government contracts.
9**
10** This software may be used only pursuant to a United States government
11** sponsored project and the United States government may not be charged
12** for use thereof.
13**
14**
15**
16** Purpose:
17** Provide version identifiers for the cFE Platform Support Packages (PSP).
18**
19*/
20
21#ifndef _psp_version_
22#define _psp_version_
23
24
25/*
26** Macro Definitions
27*/
28#define CFE_PSP_MAJOR_VERSION 1
29#define CFE_PSP_MINOR_VERSION 2
30#define CFE_PSP_REVISION 0
31#define CFE_PSP_MISSION_REV 0
32
33/* For backwards compatibility */
34#define CFE_PSP_SUBMINOR_VERSION CFE_PSP_REVISION
35
36
37#endif /* _psp_version_ */
38