Mercurial > public > mk2
annotate code_part1/OSTC_code_c_part2/shared_definitions.h @ 215:df63e01ac992
1.82beta release - 1.83beta start
| author | heinrichsweikamp |
|---|---|
| date | Wed, 23 Feb 2011 19:11:29 +0100 |
| parents | 2d9af08ed0ac |
| children | c7e32ff65636 |
| rev | line source |
|---|---|
| 163 | 1 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 2 ; | |
| 3 ; shared_definitions.h | |
| 4 ; | |
| 5 ; Declare variables used both in C and ASM code | |
| 6 ; | |
| 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 | |
| 9 ; the Free Software Foundation, either version 3 of the License, or | |
| 10 ; (at your option) any later version. | |
| 11 ; | |
| 12 ; This program is distributed in the hope that it will be useful, | |
| 13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 ; GNU General Public License for more details. | |
| 16 ; | |
| 17 ; You should have received a copy of the GNU General Public License | |
| 18 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 19 ; | |
| 20 ; Copyright (c) 2010, JD Gascuel. | |
| 21 ;============================================================================= | |
| 22 ; RATIONAL | |
| 23 ; | |
| 24 ; We must enforce good data passing between the C and the ASM parts of code. | |
| 25 ; The previous design used two independant definitions of each variable, | |
| 26 ; one in C, one in ASM. If they did not match, no error was generated, and | |
| 27 ; anything can happend at runtime... | |
| 28 ; | |
| 29 ; The new design use LINKING to ensure the variables defined in C are at the | |
| 30 ; same address when used in ASM code. And it uses a unique declaration file | |
| 31 ; (with suitable macros) to make sure they have the same size in both language. | |
| 32 ; | |
| 33 ; HISTORY | |
| 34 ; 2011-01-20: [jDG] Creation. | |
| 35 ; | |
| 36 ; NOTE | |
| 37 ; | |
| 38 ; This file have to obey both ASM and C syntax. The only common directives | |
| 39 ; are #if/#ifdef/#endif and the #define, so they are eavily used to do the | |
| 40 ; trick. | |
| 41 ; | |
| 42 ; BUGS | |
| 43 ;============================================================================= | |
| 44 #endif | |
| 45 | |
| 46 #ifdef __18CXX | |
| 47 //------------------------------------------------------------------------ | |
| 48 // C-style declarations: | |
| 167 | 49 # ifdef TEST_MAIN |
| 50 # define VAR_UCHAR(n) extern unsigned char n | |
| 51 # define TAB_UCHAR(n,size) extern unsigned char n[size] | |
| 52 # define VAR_UINT(n) extern unsigned int n | |
| 53 # define TAB_UINT(n,size) extern unsigned int n[size] | |
| 54 # else | |
| 55 # define VAR_UCHAR(n) unsigned char n | |
| 56 # define TAB_UCHAR(n,size) unsigned char n[size] | |
| 57 # define VAR_UINT(n) unsigned int n | |
| 58 # define TAB_UINT(n,size) unsigned int n[size] | |
| 59 # endif | |
| 163 | 60 #else |
| 61 ;------------------------------------------------------------------------- | |
| 62 ; ASM-style declarations: | |
| 63 #define VAR_UCHAR(n) n res 1 | |
| 64 #define TAB_UCHAR(n,size) n res size | |
| 65 #define VAR_UINT(n) n res 2 | |
| 66 #define TAB_UINT(n,size) n res 2*size | |
| 67 #endif | |
| 68 | |
| 69 #ifdef __18CXX | |
| 70 //---- BANK 2 DATA ------------------------------------------------------- | |
| 71 // Gather all data C-code --> ASM-code | |
| 72 # pragma udata overlay bank2=0x200 | |
| 73 #else | |
| 74 bank2 udata_ovr 0x200 | |
| 75 #endif | |
| 76 | |
| 77 VAR_UINT (int_O_gtissue_limit); | |
| 78 VAR_UINT (int_O_gtissue_press); | |
| 168 | 79 VAR_UINT (int_O_desaturation_time); // |
| 80 VAR_UINT (int_O_ascenttime); // TTS (in minutes) | |
| 163 | 81 |
| 82 VAR_UCHAR (char_O_nullzeit); // | |
| 83 VAR_UCHAR (char_O_deco_status); // | |
| 84 VAR_UCHAR (char_O_gradient_factor); // | |
| 85 VAR_UCHAR (char_O_gtissue_no); // | |
| 86 VAR_UCHAR (char_O_diluent); // new in v.101 | |
| 87 VAR_UCHAR (char_O_CNS_fraction); // new in v.101 | |
| 88 VAR_UCHAR (char_O_relative_gradient_GF); // new in v.102 | |
| 89 | |
|
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
168
diff
changeset
|
90 VAR_UCHAR (char_O_first_deco_depth); // Depth of first stop. |
|
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
168
diff
changeset
|
91 VAR_UCHAR (char_O_first_deco_time) ; // Duration of first stop. |
|
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
168
diff
changeset
|
92 TAB_UCHAR (char_O_deco_depth, 0x20); // Fusionned decompression table: |
|
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
168
diff
changeset
|
93 TAB_UCHAR (char_O_deco_time, 0x20); // Both ZH-L16 and L16-GF models. |
| 163 | 94 |
| 95 TAB_UCHAR (char_O_tissue_saturation, 0x20); // Compartiment desaturation time, in min. | |
| 96 | |
| 171 | 97 VAR_UINT (int_O_DBS_bitfield); // NOTE: 9 bytes dumped to divelog by store_dive_decodebug |
| 163 | 98 VAR_UINT (int_O_DBS2_bitfield); |
| 99 VAR_UINT (int_O_DBG_pre_bitfield); | |
| 100 VAR_UINT (int_O_DBG_post_bitfield); | |
| 101 VAR_UCHAR (char_O_NDL_at_20mtr); | |
| 102 | |
| 164 | 103 TAB_UCHAR (char_O_hash, 16); |
| 104 | |
| 163 | 105 #ifdef __18CXX |
| 106 //---- BANK 3 DATA ------------------------------------------------------- | |
| 107 // Gather all data ASM-code --> C-code | |
| 108 # pragma udata overlay bank3=0x300 | |
| 109 #else | |
| 110 ; In ASM, put the same bank, in overlay mode, at the same address | |
| 111 bank3 udata_ovr 0x300 | |
| 112 #endif | |
| 113 | |
| 114 VAR_UCHAR (char_I_step_is_1min); | |
| 115 | |
| 116 VAR_UINT (int_I_pres_respiration); // | |
| 117 VAR_UINT (int_I_pres_surface); // | |
| 118 VAR_UINT (int_I_temp); // new in v101 | |
| 203 | 119 VAR_UINT (int_I_divemins); // Dive time (minutes) |
| 163 | 120 VAR_UCHAR (char_I_temp); // new in v101 |
| 121 VAR_UCHAR (char_I_actual_ppO2); // | |
| 122 VAR_UCHAR (char_I_N2_ratio); // | |
| 123 VAR_UCHAR (char_I_He_ratio); // | |
| 124 VAR_UCHAR (char_I_saturation_multiplier); // for conservatism/safety values 1.0 no conservatism to 1.5 50% faster saturation | |
| 125 VAR_UCHAR (char_I_desaturation_multiplier);// for conservatism/safety values 0.66 50% slower desaturation to 1.0 no conservatism// consveratism used in calc_tissue , calc_tissue_step_1_min and sim_tissue_1min | |
| 126 VAR_UCHAR (char_I_GF_High_percentage); // new in v.102 | |
| 127 VAR_UCHAR (char_I_GF_Low_percentage); // new in v.102 | |
| 128 VAR_UCHAR (char_I_deco_distance); // | |
| 129 VAR_UCHAR (char_I_const_ppO2); // new in v.101 | |
| 130 VAR_UCHAR (char_I_deco_ppO2_change); // new in v.101 | |
| 131 VAR_UCHAR (char_I_deco_ppO2); // new in v.101 | |
| 132 VAR_UCHAR (char_I_depth_last_deco); // new in v.101 unit: [m] | |
| 167 | 133 VAR_UCHAR (char_I_deco_model); // new in v.102. 0 == ZH-L16, 1 = ZH-L16-GF (Grandiant facttor) |
| 163 | 134 |
| 167 | 135 VAR_UCHAR (char_I_deco_gas_change1); // new in v.101 |
| 163 | 136 VAR_UCHAR (char_I_deco_gas_change2); // new in v.109 |
| 137 VAR_UCHAR (char_I_deco_gas_change3); // new in v.109 | |
| 138 VAR_UCHAR (char_I_deco_gas_change4); // new in v.109 | |
| 139 VAR_UCHAR (char_I_deco_gas_change5); // new in v.109 | |
| 167 | 140 |
| 141 VAR_UCHAR (char_I_deco_N2_ratio1); // new in v.101 | |
| 142 VAR_UCHAR (char_I_deco_He_ratio1); // new in v.101 | |
| 143 VAR_UCHAR (char_I_deco_N2_ratio2); // new in v.109 | |
| 144 VAR_UCHAR (char_I_deco_He_ratio2); // new in v.109 | |
| 145 VAR_UCHAR (char_I_deco_N2_ratio3); // new in v.109 | |
| 146 VAR_UCHAR (char_I_deco_He_ratio3); // new in v.109 | |
| 147 VAR_UCHAR (char_I_deco_N2_ratio4); // new in v.109 | |
| 148 VAR_UCHAR (char_I_deco_He_ratio4); // new in v.109 | |
| 149 VAR_UCHAR (char_I_deco_N2_ratio5); // new in v.109 | |
| 150 VAR_UCHAR (char_I_deco_He_ratio5); // new in v.109 | |
| 151 | |
| 152 #ifdef __18CXX | |
| 153 //---------------------------------------------------------------------------- | |
| 154 // Access to various utilities defined in ASM-code. | |
| 155 // | |
| 156 // Note: Need to switch to BANK1 before calling most of them ! | |
| 157 extern unsigned char win_top, win_leftx2, win_font, win_invert; | |
| 158 extern ram unsigned char letter[26]; | |
| 159 | |
| 160 extern void PLED_ClearScreen(void); | |
| 161 extern void PLED_standard_color(void); | |
| 162 extern void PLED_warnings_color(void); | |
| 163 extern void PLED_divemask_color(void); | |
| 164 | |
| 165 extern void PLED_box(void); | |
| 166 extern void PLED_frame(void); | |
| 167 extern void aa_wordprocessor(void); | |
| 168 | |
| 169 /// Set WREG color. | |
| 170 extern void PLED_set_color(void); | |
| 171 #endif |
