globals.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright 2014-2019 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT, IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef __GLOBALS_H_
14 #define __GLOBALS_H_
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 #include <asf.h>
21 #include "../../../src/ISComm.h"
22 #include "../../../src/data_sets.h"
23 #include "../../../src/ISConstants.h"
24 #include "../../../hw-libs/misc/bootloaderShared.h"
25 #include "../../../hw-libs/misc/rtos.h"
26 #include "../../../hw-libs/drivers/d_usartDMA.h"
27 #include "drivers/d_time.h"
28 #include "conf_board.h"
29 
30 #define USE_RTC_DATE_TIME 1 // Use RTC for system data and time
31 
32 #define STREAM_INS_FOR_TIME_SYNC 1
33 #define SKI_BOX_STATUS_LED_PIN GPIO_10_PIN
34 #define UBLOX_LOG_ENABLE 0
35 
36 typedef void (*VoidFuncPtrVoid)(void);
37 
38 typedef struct
39 {
40  uint32_t year, month, day, week, hour, minute, second;
41 } date_time_t;
42 
43 typedef struct
44 {
47 }evb_msg_t;
48 
49 typedef struct PACKED // Non-volatile memory state
50 {
51  uint32_t flash_write_needed; // 0=No write; 1=config write needed; 2=config write needed without backup 0xFFFFFFFF=reset defaults
52  uint32_t flash_write_count; // Number of times flash is written to since reset
53  uint32_t flash_write_enable; // 1 = enables flash writes. This is used to prevent stutters in RTOS caused by flash writes until controlled times.
54 } nvr_manage_t;
55 
57 
58 // All Flash Parameters - config max size is 8K for ARM
59 typedef struct PACKED
60 {
61  union
62  { // Standard EVB-2
64  uint32_t padding[BOOTLOADER_FLASH_BLOCK_SIZE / 2 / sizeof(uint32_t)]; // 4096 bytes
65  } g0;
66 
67  union
68  { // Reserved for Luna
69  uint32_t padding[BOOTLOADER_FLASH_BLOCK_SIZE / 2 / sizeof(uint32_t)]; // 4096 bytes
70  } g1;
71 
72 } nvm_config_t;
73 
75 
76 // Defined in init.c
78 void refresh_led_cfg(void);
79 void board_IO_config(void);
80 //
81 
82 #define STREAM_BUFFER_SIZE 4096
83 
84 extern uint8_t g_hdw_detect;
87 extern evb_status_t g_status;
91 extern evb_msg_t g_msg;
92 extern debug_array_t g_debug;
93 extern evb_rtos_info_t g_rtos;
95 //extern uint32_t g_CANbaud_kbps;
96 //extern uint32_t g_can_receive_address;
97 extern bool g_gpsTimeSync;
98 extern uint32_t g_comm_time_ms;
99 extern bool g_loggerEnabled;
100 extern uint32_t g_uInsBootloaderEnableTimeMs;
101 extern bool g_enRtosStats;
102 
103 void globals_init(void);
106 int comWrite(int serialNum, const unsigned char *buf, int size, uint32_t ledPin );
107 int comRead(int serialNum, unsigned char *buf, int size, uint32_t ledPin);
108 void com_bridge_forward(uint32_t srcPort, uint8_t *buf, int len);
109 void com_bridge_smart_forward(uint32_t srcPort, uint32_t ledPin);
110 
112 void nvr_init(void);
113 void nvr_slow_maintenance(void);
114 
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 
121 #endif // __GLOBALS_H_
union PACKED::@30 g0
bool g_enRtosStats
Definition: globals.c:35
void reset_config_defaults(evb_flash_cfg_t *cfg)
Definition: globals.c:437
dev_info_t uInsInfo
Definition: globals.h:45
void com_bridge_forward(uint32_t srcPort, uint8_t *buf, int len)
void board_IO_config(void)
Definition: init.c:376
uint32_t g_uInsBootloaderEnableTimeMs
Definition: globals.c:34
wheel_encoder_t g_wheelEncoder
Definition: globals.c:20
POP_PACK void init_set_board_IO_config_callback(VoidFuncPtrVoid fpIoCfg)
Definition: init.c:371
debug_array_t g_debug
Definition: globals.c:26
dev_info_t g_evbDevInfo
Definition: globals.c:19
int comWrite(int serialNum, const unsigned char *buf, int size, uint32_t ledPin)
int error_check_config(evb_flash_cfg_t *cfg)
Definition: globals.c:407
#define PUSH_PACK_1
Definition: ISConstants.h:231
nvr_manage_t g_nvr_manage_config
Definition: globals.c:23
uint32_t flash_write_count
Definition: globals.h:52
ins_2_t ins2
Definition: globals.h:46
uint32_t flash_write_needed
Definition: globals.h:51
evb_rtos_info_t g_rtos
Definition: globals.c:27
void(* VoidFuncPtrVoid)(void)
Definition: globals.h:36
void nvr_validate_config_integrity(evb_flash_cfg_t *cfg)
Definition: globals.c:275
void globals_init(void)
Definition: globals.c:38
void refresh_led_cfg(void)
Definition: init.c:355
#define BOOTLOADER_FLASH_BLOCK_SIZE
Board configuration.
void nvr_init(void)
Definition: globals.c:300
uint8_t buf[GPS_RAW_MESSAGE_BUF_SIZE]
Definition: data_sets.h:2901
uint32_t padding[BOOTLOADER_FLASH_BLOCK_SIZE/2/sizeof(uint32_t)]
Definition: globals.h:64
uint8_t g_hdw_detect
evb_flash_cfg_t * g_flashCfg
Definition: globals.c:22
evb_msg_t g_msg
Definition: globals.c:25
void com_bridge_smart_forward(uint32_t srcPort, uint32_t ledPin)
uint32_t year
Definition: globals.h:40
uint32_t flash_write_enable
Definition: globals.h:53
#define POP_PACK
Definition: ISConstants.h:234
date_time_t g_gps_date_time
Definition: globals.c:28
uint32_t g_comm_time_ms
Definition: globals.c:32
void nvr_slow_maintenance(void)
Definition: globals.c:322
void com_bridge_apply_preset(evb_flash_cfg_t *cfg)
Definition: globals.c:147
union PACKED::@31 g1
PUSH_PACK_1 struct PACKED nvm_config_t
Autogenerated API include file for the Atmel Software Framework (ASF)
int comRead(int serialNum, unsigned char *buf, int size, uint32_t ledPin)
struct PACKED nvr_manage_t
evb_status_t g_status
Definition: globals.c:21
bool g_loggerEnabled
Definition: globals.c:33
evb_flash_cfg_t m
Definition: globals.h:63
uint32_t size
nvm_config_t g_userPage
Definition: globals.c:24
bool g_gpsTimeSync
Definition: globals.c:31


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57