-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmios.h
263 lines (227 loc) · 12.4 KB
/
cmios.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*
* Declaration of MIOS variables and functions
*
* ==========================================================================
*
* Copyright 1998-2006 Thorsten Klose ([email protected])
* Licensed for personal non-commercial use only.
* All other rights reserved.
*
* ==========================================================================
*/
#ifndef _CMIOS_H
#define _CMIOS_H
/*** general MIOS definitions ************************************************/
#define MIOS_MIDI_INTERFACE_COMMON 0x00
#define MIOS_MIDI_INTERFACE_TO_HOST 0x01
#define MIOS_MIDI_MERGER_DISABLED 0x00
#define MIOS_MIDI_MERGER_ENABLED 0x01
#define MIOS_MIDI_MERGER_MBLINK_EP 0x02
#define MIOS_MIDI_MERGER_MBLINK_FP 0x03
#define MIOS_ENC_SPEED_SLOW 0x00
#define MIOS_ENC_SPEED_NORMAL 0x01
#define MIOS_ENC_SPEED_FAST 0x02
#define MIOS_LCD_TYPE_CLCD 0x00
#define MIOS_LCD_TYPE_GLCD0 0x01
#define MIOS_LCD_TYPE_GLCD1 0x02
#define MIOS_LCD_TYPE_GLCD2 0x03
#define MIOS_LCD_TYPE_GLCD3 0x04
#define MIOS_LCD_TYPE_GLCD4 0x05
#define MIOS_LCD_TYPE_MLCD 0x06
#define MIOS_LCD_TYPE_GLCD_CUSTOM 0x07
#define MIOS_GLCD_FONT 0x7cfc
/*** structures of the CFG and STAT bytes ************************************/
typedef union {
struct {
unsigned ALL:8;
};
struct {
unsigned LCD_TYPE:3; // selects LCD type
unsigned USE_GLCD:1; // if 1, graphical LCD is connected
unsigned MERGER:1; // if 1, MIDI merger is enabled
unsigned MBLINK:1; // if 1, MIDIbox Link is enabled
unsigned TO_HOST:1; // if 1, MIDI interface will run with 38400 baud instead of 31250
unsigned FRQ_20MHz:1; // if 1, it is assumed that the bux is running with 20 MHz, else with 40 MHz
};
} mios_box_cfg0_t;
typedef union {
struct {
unsigned ALL:8;
};
struct {
unsigned BS_A:3; // A2..A0 of BankStick
unsigned BS_DIS_VERIFY:1; // if 1, writes to the BankStick will not be verified
unsigned IIC_STRETCH_CLK:1; // if 1, IIC clock stretching enabled
unsigned :1;
unsigned :1;
unsigned :1;
};
} mios_box_cfg1_t;
typedef union {
struct {
unsigned ALL:8;
};
struct {
unsigned BS_AVAILABLE:1; // if 1, BankStick is available
unsigned MBLINK_TUNNEL_PASS:1; // if 1, a MBLinked event will be tunnled
unsigned SUSPEND_ALL:1; // if 1, all system and user tasks are suspended
unsigned SUSPEND_USER:1; // if 1, all user tasks are suspended
unsigned AUTOREPEAT:1; // if 1, start the auto-repeat handler
unsigned MLCD_TRANSFER:1; // if 1, a transfer to the MLCD has been started
unsigned :1;
unsigned :1;
};
} mios_box_stat_t;
/*** MIOS tables *************************************************************/
extern const unsigned char MIOS_MPROC_EVENT_TABLE[2*128];
extern const unsigned char MIOS_ENC_PIN_TABLE[2*64];
/*** Addresses of global MIOS variables **************************************/
extern volatile mios_box_cfg0_t __at 0x000 MIOS_BOX_CFG0;
extern volatile mios_box_cfg1_t __at 0x001 MIOS_BOX_CFG1;
extern volatile mios_box_stat_t __at 0x002 MIOS_BOX_STAT;
extern volatile unsigned char __at 0x003 MIOS_PARAMETER1;
extern volatile unsigned char __at 0x004 MIOS_PARAMETER2;
extern volatile unsigned char __at 0x005 MIOS_PARAMETER3;
/*** Global MIOS functions ***************************************************/
extern void MIOS_MIDI_BeginStream(void) __wparam;
extern void MIOS_MIDI_DeviceIDAutoSet(void) __wparam;
extern unsigned char MIOS_MIDI_DeviceIDGet(void) __wparam;
extern void MIOS_MIDI_DeviceIDSet(unsigned char device_id) __wparam;
extern void MIOS_MIDI_EndStream(void) __wparam;
extern void MIOS_MIDI_Init(void) __wparam;
extern void MIOS_MIDI_InterfaceAutoSet(void) __wparam;
extern unsigned char MIOS_MIDI_InterfaceGet(void) __wparam;
extern void MIOS_MIDI_InterfaceSet(unsigned char interface) __wparam;
extern unsigned char MIOS_MIDI_MergerGet(void) __wparam;
extern void MIOS_MIDI_MergerSet(unsigned char mode) __wparam;
extern unsigned char MIOS_MIDI_RxBufferFree(void) __wparam;
extern unsigned char MIOS_MIDI_RxBufferGet(void) __wparam;
extern void MIOS_MIDI_RxBufferPut(unsigned char b) __wparam;
extern unsigned char MIOS_MIDI_RxBufferUsed(void) __wparam;
extern void MIOS_MIDI_TxBufferFlush(void) __wparam;
extern unsigned char MIOS_MIDI_TxBufferFree(void) __wparam;
extern unsigned char MIOS_MIDI_TxBufferGet(void) __wparam;
extern void MIOS_MIDI_TxBufferPut(unsigned char b) __wparam;
extern unsigned char MIOS_MIDI_TxBufferUsed(void) __wparam;
extern void MIOS_MPROC_MergerDisable(void) __wparam;
extern void MIOS_MPROC_MergerEnable(void) __wparam;
extern void MIOS_MPROC_MergerGet(void) __wparam;
extern unsigned char MIOS_AIN_DeadbandGet(void) __wparam;
extern void MIOS_AIN_DeadbandSet(unsigned char) __wparam;
extern void MIOS_AIN_Muxed(void) __wparam;
extern unsigned char MIOS_AIN_NumberGet(void) __wparam;
extern void MIOS_AIN_NumberSet(unsigned char pots) __wparam;
extern unsigned char MIOS_AIN_Pin7bitGet(unsigned char pot) __wparam;
extern unsigned int MIOS_AIN_PinGet(unsigned char pot) __wparam;
extern void MIOS_AIN_PinLSBGet(unsigned char pot) __wparam;
extern void MIOS_AIN_PinMSBGet(unsigned char pot) __wparam;
extern void MIOS_AIN_UnMuxed(void) __wparam;
extern unsigned char MIOS_MF_PWM_DutyCycleDownGet(void) __wparam;
extern void MIOS_MF_PWM_DutyCycleDownSet(unsigned char cali_down) __wparam;
extern unsigned char MIOS_MF_PWM_DutyCycleUpGet(void) __wparam;
extern void MIOS_MF_PWM_DutyCycleUpSet(unsigned char cali_up) __wparam;
extern unsigned char MIOS_MF_DeadbandGet(void) __wparam;
extern void MIOS_MF_DeadbandSet(unsigned char deadband) __wparam;
extern void MIOS_MF_Disable(void) __wparam;
extern void MIOS_MF_Enable(void) __wparam;
extern void MIOS_MF_FaderMove(unsigned char fader, unsigned int pos) __wparam;
extern void MIOS_MF_SuspendDisable(unsigned char fader) __wparam;
extern void MIOS_MF_SuspendEnable(unsigned char fader) __wparam;
extern unsigned char MIOS_MF_SuspendGet(unsigned char fader) __wparam;
extern unsigned char MIOS_MF_PWM_PeriodGet(void) __wparam;
extern void MIOS_MF_PWM_PeriodSet(unsigned char speed) __wparam;
extern void MIOS_MF_TouchDetectionReset(unsigned char fader) __wparam;
extern unsigned char MIOS_DIN_PinGet(unsigned char pin) __wparam;
extern unsigned char MIOS_DIN_SRGet(unsigned char sr) __wparam;
extern unsigned char MIOS_DOUT_PinGet(unsigned char pin) __wparam;
extern void MIOS_DOUT_PinSet(unsigned char pin, unsigned char pin_value) __wparam;
extern void MIOS_DOUT_PinSet0(unsigned char pin) __wparam;
extern void MIOS_DOUT_PinSet1(unsigned char pin) __wparam;
extern unsigned char MIOS_DOUT_SRGet(unsigned char sr) __wparam;
extern void MIOS_DOUT_SRSet(unsigned char sr, unsigned char sr_value) __wparam;
extern void MIOS_ENC_Abs7bitAdd(unsigned char enc, char add) __wparam;
extern unsigned char MIOS_ENC_Abs7bitGet(unsigned char enc) __wparam;
extern void MIOS_ENC_Abs7bitSet(unsigned char enc, unsigned char value) __wparam;
extern unsigned char MIOS_ENC_NumberGet(void) __wparam;
extern unsigned char MIOS_ENC_SpeedGet(unsigned char enc) __wparam;
extern void MIOS_ENC_SpeedSet(unsigned char enc, unsigned char mode, unsigned char parameter) __wparam;
extern unsigned char MIOS_SRIO_NumberGet(void) __wparam;
extern void MIOS_SRIO_NumberSet(unsigned char number_sr) __wparam;
extern unsigned char MIOS_SRIO_TS_SensitivityGet(void) __wparam;
extern void MIOS_SRIO_TS_SensitivitySet(unsigned char update_frq) __wparam;
extern unsigned char MIOS_SRIO_UpdateFrqGet(void) __wparam;
extern void MIOS_SRIO_UpdateFrqSet(unsigned char update_frq) __wparam;
extern unsigned char MIOS_SRIO_DebounceGet(void) __wparam;
extern void MIOS_SRIO_DebounceSet(unsigned char debounce_value) __wparam;
extern void MIOS_LCD_Clear(void) __wparam;
extern void MIOS_LCD_Cmd(unsigned char cmd) __wparam;
extern unsigned char MIOS_LCD_CursorGet(void) __wparam;
extern void MIOS_LCD_CursorSet(unsigned char pos) __wparam;
extern void MIOS_LCD_Data(unsigned char data) __wparam;
extern void MIOS_LCD_Init(void) __wparam;
extern void MIOS_LCD_PrintBCD1(unsigned char v) __wparam;
extern void MIOS_LCD_PrintBCD2(unsigned char v) __wparam;
extern void MIOS_LCD_PrintBCD3(unsigned char v) __wparam;
extern void MIOS_LCD_PrintBCD4(unsigned int v) __wparam;
extern void MIOS_LCD_PrintBCD5(unsigned int v) __wparam;
extern void MIOS_LCD_PrintChar(unsigned char c) __wparam;
extern void MIOS_LCD_PrintHex1(unsigned char h) __wparam;
extern void MIOS_LCD_PrintHex2(unsigned char h) __wparam;
extern void MIOS_LCD_PrintMessage(code char *str) __wparam;
extern void MIOS_LCD_PrintPreconfString(unsigned char len, code char *str) __wparam;
extern void MIOS_LCD_PrintString(code char *str) __wparam;
extern void MIOS_LCD_TypeAutoSet(void) __wparam;
extern unsigned char MIOS_LCD_TypeGet(void) __wparam;
extern void MIOS_LCD_TypeSet(unsigned char type, unsigned char par1, unsigned char par2) __wparam;
extern void MIOS_LCD_YAddressSet(unsigned char line0, unsigned char line1, unsigned char line2, unsigned char line3) __wparam;
extern unsigned char MIOS_LCD_YAddressGet(void) __wparam;
extern void MIOS_LCD_MessageStart(unsigned char delay) __wparam;
extern void MIOS_LCD_MessageStop(void) __wparam;
extern void MIOS_LCD_PrintCString(code char *str) __wparam; // not supported by MIOS itself, but by the wrapper
extern void MIOS_CLCD_SpecialCharInit(unsigned char num, code char *c_table) __wparam;
extern void MIOS_CLCD_SpecialCharsInit(code char *c_table) __wparam;
extern void MIOS_GLCD_FontInit(code char *font) __wparam;
extern unsigned char MIOS_GLCD_GCursorGet(void) __wparam;
extern void MIOS_GLCD_GCursorSet(unsigned char x, unsigned char y) __wparam;
extern unsigned char MIOS_EEPROM_Read(unsigned char addr) __wparam;
extern unsigned char MIOS_EEPROM_Write(unsigned char addr, unsigned char value) __wparam;
extern unsigned char MIOS_EEPROM_ReadPage(unsigned char addr, char *buffer) __wparam;
extern unsigned char MIOS_EEPROM_WritePage(unsigned char addr, char *buffer) __wparam;
extern unsigned char MIOS_FLASH_Read(code char *addr, char *buffer) __wparam;
extern unsigned char MIOS_FLASH_Write(code char *addr, char *buffer) __wparam;
extern unsigned char MIOS_BANKSTICK_Read(unsigned int addr) __wparam;
extern unsigned char MIOS_BANKSTICK_Write(unsigned int addr, unsigned char value) __wparam;
extern void MIOS_BANKSTICK_CtrlSet(unsigned char ctrl) __wparam;
extern unsigned char MIOS_BANKSTICK_CtrlGet(void) __wparam;
extern unsigned char MIOS_BANKSTICK_WritePage(unsigned int addr, char *buffer) __wparam;
extern unsigned char MIOS_BANKSTICK_ReadPage(unsigned int addr, char *buffer) __wparam;
extern void MIOS_TIMER_Init(unsigned char mode, unsigned int period) __wparam;
extern void MIOS_TIMER_Start(void) __wparam;
extern void MIOS_TIMER_Stop(void) __wparam;
extern void MIOS_TIMER_ReInit(unsigned char mode, unsigned int period) __wparam;
extern unsigned char MIOS_HLP_GetBitANDMask(unsigned char value) __wparam;
extern unsigned char MIOS_HLP_GetBitORMask(unsigned char value) __wparam;
extern unsigned char MIOS_HLP_16bitAddSaturate(unsigned char add_value, unsigned int *ptr, unsigned int max_value) __wparam;
extern unsigned char MIOS_HLP_Dec2BCD(unsigned int value) __wparam;
extern void MIOS_Delay(unsigned char delay) __wparam;
extern unsigned char MIOS_GPCounterGet(void) __wparam;
extern void MIOS_Reset(void) __wparam;
extern void MIOS_SystemResume(void) __wparam;
extern void MIOS_SystemSuspend(void) __wparam;
extern void MIOS_UserResume(void) __wparam;
extern void MIOS_UserSuspend(void) __wparam;
extern void MIOS_DIN_PinAutoRepeatEnable(unsigned char pin) __wparam;
extern void MIOS_DIN_PinAutoRepeatDisable(unsigned char pin) __wparam;
extern unsigned char MIOS_DIN_PinAutoRepeatGet(unsigned char pin) __wparam;
extern void MIOS_AIN_DynamicPrioSet(unsigned char enable) __wparam;
extern unsigned char MIOS_AIN_DynamicPrioGet(void) __wparam;
extern unsigned char MIOS_AIN_LastPinsGet(void) __wparam;
extern void MIOS_IIC_Start(void) __wparam;
extern void MIOS_IIC_Stop(void) __wparam;
extern unsigned char MIOS_IIC_ByteSend(unsigned char b) __wparam;
extern unsigned char MIOS_IIC_ByteReceive(void) __wparam;
extern void MIOS_IIC_AckSend(void) __wparam;
extern void MIOS_IIC_NakSend(void) __wparam;
extern void MIOS_IIC_CtrlSet(unsigned char ctrl) __wparam;
extern unsigned char MIOS_IIC_CtrlGet(void) __wparam;
#endif /* _CMIOS_H */