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 struct
37 {
38  uint32_t year, month, day, week, hour, minute, second;
39 } date_time_t;
40 
41 typedef struct
42 {
45 }evb_msg_t;
46 
47 typedef struct PACKED // Non-volatile memory state
48 {
49  uint32_t flash_write_needed; // 0=No write; 1=config write needed; 2=config write needed without backup 0xFFFFFFFF=reset defaults
50  uint32_t flash_write_count; // Number of times flash is written to since reset
51  uint32_t flash_write_enable; // 1 = enables flash writes. This is used to prevent stutters in RTOS caused by flash writes until controlled times.
52 } nvr_manage_t;
53 
55 
56 // All Flash Parameters - config max size is 8K for ARM
57 typedef struct PACKED
58 {
59  union
60  {
62  uint32_t padding[BOOTLOADER_FLASH_BLOCK_SIZE / sizeof(uint32_t)]; // 8 Kb
63 // uint32_t padding[IFLASH_PAGE_SIZE / sizeof(uint32_t)]; // 512 bytes
64  } g0;
65 } nvm_config_t;
66 
68 
69 
70 #define STREAM_BUFFER_SIZE 4096
71 
72 extern uint8_t g_hdw_detect;
75 extern evb_status_t g_status;
79 extern evb_msg_t g_msg;
80 extern debug_array_t g_debug;
81 extern evb_rtos_info_t g_rtos;
83 //extern uint32_t g_CANbaud_kbps;
84 //extern uint32_t g_can_receive_address;
85 extern bool g_gpsTimeSync;
86 extern uint32_t g_comm_time_ms;
87 extern bool g_loggerEnabled;
88 extern uint32_t g_uInsBootloaderEnableTimeMs;
89 extern bool g_enRtosStats;
90 
91 
92 void globals_init(void);
95 int comWrite(int serialNum, const unsigned char *buf, int size, uint32_t ledPin );
96 int comRead(int serialNum, unsigned char *buf, int size, uint32_t ledPin);
97 void com_bridge_forward(uint32_t srcPort, uint8_t *buf, int len);
98 void com_bridge_smart_forward(uint32_t srcPort, uint32_t ledPin);
99 
100 void nvr_init(void);
101 void nvr_slow_maintenance(void);
102 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #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:426
dev_info_t uInsInfo
Definition: globals.h:43
void com_bridge_forward(uint32_t srcPort, uint8_t *buf, int len)
uint32_t g_uInsBootloaderEnableTimeMs
Definition: globals.c:34
wheel_encoder_t g_wheelEncoder
Definition: globals.c:20
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:396
#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:50
ins_2_t ins2
Definition: globals.h:44
uint32_t flash_write_needed
Definition: globals.h:49
evb_rtos_info_t g_rtos
Definition: globals.c:27
void globals_init(void)
Definition: globals.c:38
#define BOOTLOADER_FLASH_BLOCK_SIZE
Board configuration.
void nvr_init(void)
Definition: globals.c:290
uint8_t buf[GPS_RAW_MESSAGE_BUF_SIZE]
Definition: data_sets.h:2784
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:38
uint32_t flash_write_enable
Definition: globals.h:51
#define POP_PACK
Definition: ISConstants.h:234
date_time_t g_gps_date_time
Definition: globals.c:28
uint32_t padding[BOOTLOADER_FLASH_BLOCK_SIZE/sizeof(uint32_t)]
Definition: globals.h:62
uint32_t g_comm_time_ms
Definition: globals.c:32
void nvr_slow_maintenance(void)
Definition: globals.c:311
void com_bridge_apply_preset(evb_flash_cfg_t *cfg)
Definition: globals.c:147
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:61
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 Sat Sep 19 2020 03:19:04