comparison src/shared_definitions.h @ 582:b455b31ce022

work on 2.97 stable
author heinrichsweikamp
date Mon, 26 Feb 2018 16:40:28 +0100
parents 1ab93aca7fa9
children ca4556fb60b9
comparison
equal deleted inserted replaced
581:f5de1ff88814 582:b455b31ce022
1 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 ; 2 ;
3 ; shared_definitions.h REFACTORED VERSION V2.95a1 3 ; shared_definitions.h REFACTORED VERSION V2.97
4 ; 4 ;
5 ; Declare variables used both in C and ASM code 5 ; Declare variables used both in C and ASM code
6 ; 6 ;
7 ; This program is free software: you can redistribute it and/or modify 7 ; This program is free software: you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by 8 ; it under the terms of the GNU General Public License as published by
43 ;============================================================================= 43 ;=============================================================================
44 ; HISTORY 44 ; HISTORY
45 #endif 45 #endif
46 46
47 #ifdef __18CXX 47 #ifdef __18CXX
48 //------------------------------------------------------------------------ 48 //------------------------------------------------------------------------
49 // C-style declarations: 49 // C-style declarations:
50 # ifndef TEST_MAIN 50 # ifndef TEST_MAIN
51 # define VAR_UCHAR(n) extern unsigned char n 51 # define VAR_UCHAR(n) extern unsigned char n
52 # define TAB_UCHAR(n,size) extern unsigned char n[size] 52 # define TAB_UCHAR(n,size) extern unsigned char n[size]
53 # define VAR_UINT(n) extern unsigned short n 53 # define VAR_UINT(n) extern unsigned short n
54 # define TAB_UINT(n,size) extern unsigned short n[size] 54 # define TAB_UINT(n,size) extern unsigned short n[size]
57 # define TAB_UCHAR(n,size) unsigned char n[size] 57 # define TAB_UCHAR(n,size) unsigned char n[size]
58 # define VAR_UINT(n) unsigned short n 58 # define VAR_UINT(n) unsigned short n
59 # define TAB_UINT(n,size) unsigned short n[size] 59 # define TAB_UINT(n,size) unsigned short n[size]
60 # endif 60 # endif
61 #else 61 #else
62 ;------------------------------------------------------------------------- 62 ;-------------------------------------------------------------------------
63 ; ASM-style declarations: 63 ; ASM-style declarations:
64 #define VAR_UCHAR(n) n res 1 64 #define VAR_UCHAR(n) n res 1
65 #define TAB_UCHAR(n,size) n res size 65 #define TAB_UCHAR(n,size) n res size
66 #define VAR_UINT(n) n res 2 66 #define VAR_UINT(n) n res 2
67 #define TAB_UINT(n,size) n res 2*size 67 #define TAB_UINT(n,size) n res 2*size
68 #endif 68 #endif
83 #define NUM_STOPS 0x20 83 #define NUM_STOPS 0x20
84 #define NUM_GAS 5 84 #define NUM_GAS 5
85 85
86 86
87 #ifdef __18CXX 87 #ifdef __18CXX
88 //---- BANK 3 DATA ------------------------------------------------------- 88 //---- BANK 3 DATA -------------------------------------------------------
89 // Gather all data C-code --> ASM-code 89 // Gather all data C-code --> ASM-code
90 // Memory usage: 41 Bytes left
90 # pragma udata overlay bank3=0x300 91 # pragma udata overlay bank3=0x300
91 #else 92 #else
92 ; In ASM, put the same bank, in overlay mode, at the same address 93 ; In ASM, put the same bank, in overlay mode, at the same address
93 bank3 udata_ovr 0x300 94 bank3 udata_ovr 0x300
94 #endif 95 #endif
95 96
96 VAR_UINT (int_O_gtissue_press); // pressure of leading compartment 97 VAR_UINT (int_O_desaturation_time); // time until tissues desaturated to 5% remains, in minutes
97 98 VAR_UINT (int_O_nofly_time); // altitude / no-fly waiting time time in minutes
98 VAR_UINT (int_O_desaturation_time); // time until tissues desaturated to 5% remains, in minutes 99
99 VAR_UINT (int_O_nofly_time); // altitude / no-fly waiting time time in minutes 100 VAR_UINT (int_O_ascenttime); // time-to-surface (TTS) in minutes
100 101 VAR_UINT (int_O_alternate_ascenttime); // TTS for the alternative dive plan
101 VAR_UINT (int_O_ascenttime); // time-to-surface (TTS) in minutes 102
102 VAR_UINT (int_O_alternate_ascenttime); // TTS for the alternative dive plan 103 VAR_UINT (int_O_CNS_fraction); // current CNS%
103 104 VAR_UINT (int_O_normal_CNS_fraction); // CNS% at end of dive in normal dive plan
104 VAR_UINT (int_O_CNS_fraction); // current CNS% 105 VAR_UINT (int_O_alternate_CNS_fraction); // CNS% at end of dive in alternative plan
105 VAR_UINT (int_O_normal_CNS_fraction); // CNS% at end of dive in normal dive plan 106
106 VAR_UINT (int_O_alternate_CNS_fraction); // CNS% at end of dive in alternative plan 107 VAR_UINT (int_O_gradient_factor); // current gradient factor in %
107 108
108 VAR_UINT (int_O_gradient_factor); // current gradient factor in % 109 VAR_UCHAR (char_O_nullzeit); // remaining NDL time in minutes
109 110 VAR_UCHAR (char_O_alternate_nullzeit); // remaining NDL time for the alternative dive plan
110 VAR_UCHAR (char_O_nullzeit); // remaining NDL time in minutes
111 VAR_UCHAR (char_O_alternate_nullzeit); // remaining NDL time for the alternative dive plan
112 111
113 VAR_UCHAR (char_O_main_status); // setup of the deco engine regarding the real tissue computations 112 VAR_UCHAR (char_O_main_status); // setup of the deco engine regarding the real tissue computations
114 VAR_UCHAR (char_O_deco_status); // setup of the deco engine regarding the decompression computations 113 VAR_UCHAR (char_O_deco_status); // setup of the deco engine regarding the decompression computations
115 114
116 VAR_UCHAR (char_O_gtissue_no); // number of the leading compartment 115 VAR_UCHAR (char_O_EAD); // equivalent air depth (EAD) of breathed gas
117 116 VAR_UCHAR (char_O_END); // equivalent narcosis depth (END) of breathed gas
118 VAR_UCHAR (char_O_EAD); // equivalent air depth (EAD) of breathed gas 117
119 VAR_UCHAR (char_O_END); // equivalent narcosis depth (END) of breathed gas 118 VAR_UCHAR (char_O_first_deco_depth); // depth of first stop (deco or gas change)
120 119 VAR_UCHAR (char_O_first_deco_time) ; // duration of first stop
121 VAR_UCHAR (char_O_first_deco_depth); // depth of first stop (deco or gas change) 120
122 VAR_UCHAR (char_O_first_deco_time) ; // duration of first stop 121 TAB_UCHAR (char_O_deco_depth, NUM_STOPS); // stops table: depth, ...
123 122 TAB_UCHAR (char_O_deco_time, NUM_STOPS); // ... duration, and
124 TAB_UCHAR (char_O_deco_depth, NUM_STOPS); // stops table: depth, ... 123 TAB_UCHAR (char_O_deco_gas, NUM_STOPS); // ... gas breathed
125 TAB_UCHAR (char_O_deco_time, NUM_STOPS); // ... duration, and 124
126 TAB_UCHAR (char_O_deco_gas, NUM_STOPS); // ... gas breathed 125 TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // variant of the stops table for logging purpose
127 126
128 TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // variant of the stops table for logging purpose 127 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // nitrogen tissue pressures for display purpose
129 128 TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // helium tissue pressures for display purpose
130 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // nitrogen tissue pressures for display purpose
131 TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // helium tissue pressures for display purpose
132 129
133 VAR_UCHAR (char_O_deco_warnings); // vector of warnings generated by the deco engine 130 VAR_UCHAR (char_O_deco_warnings); // vector of warnings generated by the deco engine
134 131
135 TAB_UINT (int_O_gas_volumes, NUM_GAS); // gas volumes needed in liters 132 TAB_UINT (int_O_gas_volumes, NUM_GAS); // gas volumes needed in liters
136 TAB_UINT (int_O_tank_pres_need, NUM_GAS); // tank pressures needed in bar 133 TAB_UINT (int_O_tank_pres_need, NUM_GAS); // tank pressures needed in bar
137 VAR_UINT (int_O_ceiling); // ultimate ascent bound in mbar relative pressure 134 VAR_UINT (int_O_ceiling); // ultimate ascent bound in mbar relative pressure
138 135
139 VAR_UINT (int_O_O2_ppO2); // ppO2 of pure O2 at current depth 136 VAR_UINT (int_O_O2_ppO2); // ppO2 of pure O2 at current depth
140 VAR_UINT (int_O_pure_ppO2); // ppO2 of the current gas or dil if breathed pure 137 VAR_UINT (int_O_pure_ppO2); // ppO2 of the current gas or dil if breathed pure
141 VAR_UINT (int_O_pSCR_ppO2); // ppO2 calculated in pSCR loop 138 VAR_UINT (int_O_pSCR_ppO2); // ppO2 calculated in pSCR loop
142 VAR_UINT (int_O_breathed_ppO2); // ppO2 actually breathed (= char_O_pure_ppO2 if in OC) 139 VAR_UINT (int_O_breathed_ppO2); // ppO2 actually breathed (= char_O_pure_ppO2 if in OC)
143 140
144 141
145 #ifdef __18CXX 142 #ifdef __18CXX
146 //---- BANK 4 DATA ------------------------------------------------------- 143 //---- BANK 4 DATA -------------------------------------------------------
147 // Gather all data ASM-code --> C-code 144 // Gather all data ASM-code --> C-code
145 // Memory usage: 183 bytes left
148 # pragma udata overlay bank4=0x400 146 # pragma udata overlay bank4=0x400
149 #else 147 #else
150 ; In ASM, put the same bank, in overlay mode, at the same address 148 ; In ASM, put the same bank, in overlay mode, at the same address
151 bank4 udata_ovr 0x400 149 bank4 udata_ovr 0x400
152 #endif 150 #endif
153 151
154 VAR_UINT (int_I_pres_respiration); // absolute pressure breathed 152 VAR_UINT (int_I_pres_respiration); // absolute pressure breathed
155 VAR_UINT (int_I_pres_surface); // absolute pressure at surface 153 VAR_UINT (int_I_pres_surface); // absolute pressure at surface
156 154
157 VAR_UCHAR (char_I_current_gas); // number of gas currently breathed (1..5 for configured gases, 6 for the manual gas) 155 VAR_UCHAR (char_I_current_gas); // number of gas currently breathed (1..5 for configured gases, 6 for the manual gas)
158 VAR_UCHAR (char_I_He_ratio); // helium ratio of the currently breathed gas 156 VAR_UCHAR (char_I_He_ratio); // helium ratio of the currently breathed gas
159 VAR_UCHAR (char_I_O2_ratio); // oxygen ratio of the currently breathed gas 157 VAR_UCHAR (char_I_O2_ratio); // oxygen ratio of the currently breathed gas
160 158
161 VAR_UCHAR (char_I_saturation_multiplier); // safety factor, 100 = no conservatism, 150 = 50% faster saturation 159 VAR_UCHAR (char_I_saturation_multiplier); // safety factor, 100 = no conservatism, 150 = 50% faster saturation
162 VAR_UCHAR (char_I_desaturation_multiplier);// safety factor, 100 = no conservatism, 66 = 50% slower desaturation 160 VAR_UCHAR (char_I_desaturation_multiplier); // safety factor, 100 = no conservatism, 66 = 50% slower desaturation
163 161
164 VAR_UCHAR (char_I_GF_High_percentage); // GF model high value 162 VAR_UCHAR (char_I_GF_High_percentage); // GF model high value
165 VAR_UCHAR (char_I_GF_Low_percentage); // GF model low value 163 VAR_UCHAR (char_I_GF_Low_percentage); // GF model low value
166 164
167 VAR_UCHAR (char_I_deco_distance); // assumed extra depth below required depth for CNS and gas volumes calculations 165 VAR_UCHAR (char_I_deco_distance); // assumed extra depth below required depth for CNS and gas volumes calculations
168 VAR_UCHAR (char_I_depth_last_deco); // depth of the last deco stop in meters 166 VAR_UCHAR (char_I_depth_last_deco); // depth of the last deco stop in meters
169 167
170 VAR_UCHAR (char_I_deco_model); // deco model selection: 0 = ZH-L16, 1 = ZH-L16-GF (with gradient factors) 168 VAR_UCHAR (char_I_deco_model); // deco model selection: 0 = ZH-L16, 1 = ZH-L16-GF (with gradient factors)
171 169
172 VAR_UCHAR (char_I_bottom_depth); // bottom depth, used for gas volume calculations 170 VAR_UCHAR (char_I_bottom_depth); // bottom depth, used for gas volume calculations
173 VAR_UCHAR (char_I_bottom_time); // bottom time, used for gas volume calculations 171 VAR_UCHAR (char_I_bottom_time); // bottom time, used for gas volume calculations
174 172
175 VAR_UCHAR (char_I_dive_interval); // duration of surface break before next dive in minutes, used in simulation 173 VAR_UCHAR (char_I_dive_interval); // duration of surface break before next dive in minutes, used in simulation
176 VAR_UCHAR (char_I_sim_advance_time); // 'fast forward' of dive time, used in simulation (+5 min function) 174 VAR_UCHAR (char_I_sim_advance_time); // 'fast forward' of dive time, used in simulation (+5 min function)
177 175
178 VAR_UCHAR (char_I_const_ppO2); // ppO2 reported from sensors or by setpoint 176 VAR_UCHAR (char_I_const_ppO2); // ppO2 reported from sensors or by setpoint
179 177
180 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS); // change depths of the OC gases 178 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS); // change depths of the OC gases
181 179 TAB_UCHAR (char_I_dil_change, NUM_GAS); // change depths of the diluent gases. Attention: must be placed after char_I_deco_gas_change! Remark: not used by C code, only by ASM code
182 TAB_UCHAR (char_I_setpoint_change,NUM_GAS); // change depth for the setpoints in meter 180
183 TAB_UCHAR (char_I_setpoint_cbar, NUM_GAS); // setpoints in cbar 181 TAB_UCHAR (char_I_setpoint_change,NUM_GAS); // change depth for the setpoints in meter
184 182 TAB_UCHAR (char_I_setpoint_cbar, NUM_GAS); // setpoints in cbar
185 TAB_UCHAR (char_I_deco_O2_ratio, NUM_GAS); // oxygen ratios of the configured gases, used for deco calculations 183
186 TAB_UCHAR (char_I_deco_He_ratio, NUM_GAS); // helium ratios of the configured gases, used for deco calculations 184 TAB_UCHAR (char_I_deco_O2_ratio, NUM_GAS); // oxygen ratios of the configured gases, used for deco calculations
187 185 TAB_UCHAR (char_I_deco_He_ratio, NUM_GAS); // helium ratios of the configured gases, used for deco calculations
188 TAB_UCHAR (char_I_tank_size, NUM_GAS); // tank sizes, used for pressure needs calculation 186
189 TAB_UCHAR (char_I_tank_pres_fill, NUM_GAS); // tank fill pressures, used for generating warnings 187 TAB_UCHAR (char_I_tank_size, NUM_GAS); // tank sizes, used for pressure needs calculation
190 188 TAB_UCHAR (char_I_tank_pres_fill, NUM_GAS); // tank fill pressures, used for generating warnings
191 VAR_UCHAR (char_I_cc_max_frac_o2); // limiter for maximum O2% in loop 189
192 VAR_UCHAR (char_I_PSCR_drop); // pSCR parameter drop [%] 190 VAR_UCHAR (char_I_cc_max_frac_o2); // limiter for maximum O2% in loop
193 VAR_UCHAR (char_I_PSCR_lungratio); // pSCR parameter lung ratio [1/x] 191 VAR_UCHAR (char_I_PSCR_drop); // pSCR parameter drop [%]
194 192 VAR_UCHAR (char_I_PSCR_lungratio); // pSCR parameter lung ratio [1/x]
195 VAR_UCHAR (char_I_altitude_wait); // selector for altitude / no-fly waiting time calculation 193
196 194 VAR_UCHAR (char_I_altitude_wait); // selector for altitude / no-fly waiting time calculation
197 VAR_UCHAR (char_I_bottom_usage); // gas consumption during bottom part and initial ascent in liters/minute 195
198 VAR_UCHAR (char_I_deco_usage); // gas consumption during deco stops and following ascents in liters/minute 196 VAR_UCHAR (char_I_bottom_usage); // gas consumption during bottom part and initial ascent in liters/minute
199 197 VAR_UCHAR (char_I_deco_usage); // gas consumption during deco stops and following ascents in liters/minute
200 VAR_UCHAR (char_I_extra_time); // extra bottom time for fTTs and delayed ascent calculation in minutes 198
201 199 VAR_UCHAR (char_I_extra_time); // extra bottom time for fTTs and delayed ascent calculation in minutes
202 VAR_UCHAR (char_I_ppO2_max); // warning threshold for maximum ppO2 during working phase of the dive 200
203 VAR_UCHAR (char_I_ppO2_max_deco); // warning threshold for maximum ppO2 during deco phase of the dive 201 VAR_UCHAR (char_I_ppO2_max); // warning threshold for maximum ppO2 during working phase of the dive
204 VAR_UCHAR (char_I_ppO2_min); // warning threshold for maximum ppO2 when breathing OC 202 VAR_UCHAR (char_I_ppO2_max_deco); // warning threshold for maximum ppO2 during deco phase of the dive
205 VAR_UCHAR (char_I_ppO2_min_loop); // warning threshold for maximum ppO2 when breathing from CCR or pSCR 203 VAR_UCHAR (char_I_ppO2_min); // warning threshold for maximum ppO2 when breathing OC
206 204 VAR_UCHAR (char_I_ppO2_min_loop); // warning threshold for maximum ppO2 when breathing from CCR or pSCR
207 VAR_UCHAR (char_I_ascent_speed); // ascent speed in meters/minute 205
208 VAR_UCHAR (char_I_gas_change_time); // extra time spent during a stop for doing a gas change, in minutes 206 VAR_UCHAR (char_I_ascent_speed); // ascent speed in meters/minute
209 207 VAR_UCHAR (char_I_gas_change_time); // extra time spent during a stop for doing a gas change, in minutes
210
211 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
212 // VAR_UCHAR (char_I_step_is_1min); // Use 1min integration for tissue and CNS. DELETED ## V2.95 - made local to p2_deco.c
213 // VAR_UINT (int_I_temp); // new in v101 DELETED ## no fly
214 // VAR_UINT (int_I_divemins); // Dive time (minutes) DELETED ## V2.95 - not used by p2_deco.c
215 // VAR_UCHAR (char_I_temp); // new in v101 DELETED ## no fly
216 // VAR_UCHAR (char_I_actual_ppO2); // DELETED ## V2.94
217 // VAR_UCHAR (char_I_first_gas); // Gas used at start of dive (bottom mix) DELETED ## V2.95 - made local to p2_deco.c
218 // VAR_UCHAR (char_I_N2_ratio); // N2 ratio of the currently breathed gas DELETED ## V2.95 - not read from ASM, but actually computed by p2_deco.c from H2 and O2 ratio
219 // VAR_UCHAR (char_O_deco_last_stop); // Depth reached during deco planning. DELETED ## V2.95 - not used in ASM
220 // VAR_UCHAR (temp_bankx400); // reserved space for temporary variables
221 #endif