KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sys.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : sys.h
11  * Created : 22 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 
16 #ifndef SYS_H_
17 #define SYS_H_
18 
19 #include <stdint.h>
20 
21 /**
22  * @file
23  *
24  * @ingroup kernel
25  *
26  * System start up and management.
27  *
28  * This actually has no useful functions yet, but secretly contains the main function.
29  */
30 
31 
32 
33 /**
34  * Returns the Software date revision.
35  *
36  * It has the following structure, hex encoded (e.g. December = 0x12)
37  * Bits 31-24: Year
38  * Bits 23-16: Month
39  * Bits 15-8 : Day
40  * Bits 7 -0 : Revision
41  *
42  * @return The software date and revision hex encoded.
43  */
44 uint32_t sysSwDateRev();
45 
46 /**
47  * Returns the Hardware date revision.
48  *
49  * It has the following structure, hex encoded (e.g. December = 0x12)
50  * Bits 31-24: Year
51  * Bits 23-16: Month
52  * Bits 15-8 : Day
53  * Bits 7 -0 : Revision
54  *
55  * @return The hardware date and revision hex encoded.
56  */
57 uint32_t sysHwDateRev();
58 
59 
60 #ifndef IMAGETYPE
61 #define IMAGETYPE 0
62 #endif
63 
64 /**
65  * Number identifying the image type.
66  *
67  * @return
68  */
69 static inline uint8_t sysImageType() {
70  return IMAGETYPE;
71 }
72 
73 
74 /**
75  * Clear crash detect. No need to run this when the main-loop is running.
76  */
77 void sysClearCrashDetect();
78 
79 /**
80  * Gives the system load in percentage.
81  *
82  * Provide array of 3 bytes in percentage (0-100).
83  *
84  * @param values Array of 3 bytes is filled with:
85  * 0 - time idle
86  * 1 - time used for executing tasks
87  * 2 - time used for executing IRQ's
88  */
89 void sysLoad(uint8_t * values);
90 
91 
92 uint32_t sysPPSCount();
93 
94 /**
95  * Logs an error in the context of what the application is doing.
96  *
97  * @param doingWhat Message explaining what it was doing.
98  */
99 void sysLogClearError(const char * doingWhat);
100 
101 /**
102  * Returns the board temperature with a fractional part.
103  *
104  * @param brdTemp Temperature in celcius.
105  * @param brdTempFrq Fractional part of the temperature.
106  */
107 void sysBoardTemp(uint16_t * brdTemp, uint16_t * brdTempFrq);
108 
109 /**
110  * Prototype to be implemented by higher-level function to start the application.
111  */
112 void _appInit();
113 
114 /**
115  * Clears core dump information.
116  */
117 void coreDumpClear();
118 
119 /**
120  * Reboot the system. (soft reset).
121  */
122 void sysReboot();
123 
124 void sysCrash();
125 
126 #endif /* SYS_H_ */
void _appInit()
Prototype to be implemented by higher-level function to start the application.
Definition: app.c:45
void coreDumpClear()
Clears core dump information.
Definition: sys.c:156
uint32_t sysHwDateRev()
Returns the Hardware date revision.
Definition: sys.c:386
void sysReboot()
Reboot the system.
Definition: sys.c:515
void sysLogClearError(const char *doingWhat)
Logs an error in the context of what the application is doing.
Definition: sys.c:366
void sysBoardTemp(uint16_t *brdTemp, uint16_t *brdTempFrq)
Returns the board temperature with a fractional part.
Definition: sys.c:380
void sysClearCrashDetect()
Clear crash detect.
Definition: sys.c:322
uint32_t sysSwDateRev()
Returns the Software date revision.
Definition: sys.c:391
void sysLoad(uint8_t *values)
Gives the system load in percentage.
Definition: sys.c:373
static uint8_t sysImageType()
Number identifying the image type.
Definition: sys.h:69