Subversion Repositories svn.mios32

Rev

Rev 2636 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
61 tk 1
// $Id: mios32_config.h 2659 2019-01-13 14:17:46Z tk $
2
/*
3
 * Local MIOS32 configuration file
4
 *
5
 * this file allows to disable (or re-configure) default functions of MIOS32
6
 * available switches are listed in $MIOS32_PATH/modules/mios32/MIOS32_CONFIG.txt
7
 *
8
 */
9
 
10
#ifndef _MIOS32_CONFIG_H
11
#define _MIOS32_CONFIG_H
12
 
2551 tk 13
// V4+ switch depends on used processor
14
#if defined(MIOS32_FAMILY_STM32F4xx)
15
# define MBSEQV4P
16
#endif
229 tk 17
 
2551 tk 18
 
229 tk 19
// The boot message which is print during startup and returned on a SysEx query
496 tk 20
#define MIOS32_LCD_BOOT_MSG_DELAY 0 // we delay the boot and print a message inside the app
728 tk 21
//                                <---------------------->
2551 tk 22
#ifdef MBSEQV4P
2628 tk 23
#define MIOS32_LCD_BOOT_MSG_LINE1 "MIDIbox SEQ V4+.096"
2551 tk 24
#else
2628 tk 25
#define MIOS32_LCD_BOOT_MSG_LINE1 "MIDIbox SEQ V4.096"
2551 tk 26
#endif
2636 tk 27
#define MIOS32_LCD_BOOT_MSG_LINE2 "(C) 2019 T. Klose"
229 tk 28
 
287 tk 29
// USB settings
2551 tk 30
#ifdef MBSEQV4P
31
# define MIOS32_USB_PRODUCT_STR  "MIDIbox SEQ V4+"
32
#else
33
# define MIOS32_USB_PRODUCT_STR  "MIDIbox SEQ V4"
34
#endif
287 tk 35
#define MIOS32_USB_MIDI_NUM_PORTS 4
229 tk 36
 
308 tk 37
// port used for debugging via MIDI
38
//#define MIOS32_MIDI_DEBUG_PORT USB0
61 tk 39
 
343 tk 40
// function used to output debug messages (must be printf compatible!)
1868 tk 41
extern void APP_SendDebugMessage(char *format, ...);
42
#define DEBUG_MSG APP_SendDebugMessage
343 tk 43
 
44
 
248 tk 45
// Stack size for FreeRTOS tasks as defined by the programming model
46
// Note that each task maintains it's own stack!
47
// If you want to define a different stack size for your application tasks
2432 tk 48
 
49
// memory allocated for tasks (observe this with avstack.pl and "memory" terminal command!)
50
// add +64 for interrupts
2559 tk 51
 
52
// use ./../../bin/avstack.pl  | less
53
// to doublecheck memory consumption
54
 
2551 tk 55
#ifdef MBSEQV4P
2659 tk 56
# define MIOS32_TASK_HOOKS_STACK_SIZE      2048
57
# define UIP_TASK_STACK_SIZE               2048
58
# define MIOS32_TASK_MIDI_HOOKS_STACK_SIZE 2048
59
# define MIDI_TASK_STACK_SIZE              2048
2559 tk 60
#else
2659 tk 61
# define MIOS32_TASK_HOOKS_STACK_SIZE      1000
62
# define UIP_TASK_STACK_SIZE               1000
2559 tk 63
# define MIOS32_TASK_MIDI_HOOKS_STACK_SIZE 1400
2551 tk 64
# define MIDI_TASK_STACK_SIZE              1400
65
#endif
2432 tk 66
#define PERIOD1MS_TASK_STACK_SIZE          1400
67
#define PERIOD1MS_LOWPRIO_TASK_STACK_SIZE  1400
68
 
69
// only used by idle task
70
#define MIOS32_MINIMAL_STACK_SIZE           384
71
 
72
 
1349 tk 73
// P.S.: in order to check if the stack size is sufficient, store a preset pattern in Event->Presets page
74
// Sequencer could crash with hardfault on a buffer overrun
134 tk 75
 
248 tk 76
// reserved memory for FreeRTOS pvPortMalloc function
2551 tk 77
#ifdef MBSEQV4P
2659 tk 78
# define MIOS32_HEAP_SIZE 17*1024
2551 tk 79
#else
80
# define MIOS32_HEAP_SIZE 13*1024
81
#endif
248 tk 82
 
1318 tk 83
// for LPC17: simplify allocation of large arrays
1234 tk 84
#if defined(MIOS32_FAMILY_LPC17xx)
85
# define AHB_SECTION __attribute__ ((section (".bss_ahb")))
86
#else
87
# define AHB_SECTION
88
#endif
248 tk 89
 
1234 tk 90
 
1864 tk 91
// increased number of SRs (MBSEQ uses 16 SRs by default, but it's possible to increase the number in MBSEQ_HW.V4)
92
#define MIOS32_SRIO_NUM_SR 23
93
 
1440 tk 94
// to save some RAM (only 128 bytes, but "Kleinvieh macht auch Mist" - especially for LPC17)
95
#define MIOS32_ENC_NUM_MAX 32
96
 
97
 
736 tk 98
// optional performance measuring
737 tk 99
// see documentation under http://www.midibox.org/mios32/manual/group___f_r_e_e_r_t_o_s___u_t_i_l_s.html
1744 tk 100
#define configUSE_TRACE_FACILITY                0
736 tk 101
#define configGENERATE_RUN_TIME_STATS           0
2425 tk 102
#if configGENERATE_RUN_TIME_STATS
736 tk 103
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS  FREERTOS_UTILS_PerfCounterInit
104
#define portGET_RUN_TIME_COUNTER_VALUE          FREERTOS_UTILS_PerfCounterGet
2425 tk 105
#endif
736 tk 106
 
107
 
702 tk 108
// maximum idle counter value to be expected
1531 tk 109
#if defined(MIOS32_FAMILY_LPC17xx)
2275 tk 110
#define MAX_IDLE_CTR 628000 // LPC1769@120 MHz
111
#elif defined(MIOS32_FAMILY_STM32F4xx)
2533 tk 112
#define MAX_IDLE_CTR 956000 // STM32F407VG@160 MHz
1531 tk 113
#else
2275 tk 114
#define MAX_IDLE_CTR 192000 // STM32F103RE@80 MHz
1531 tk 115
#endif
702 tk 116
 
2275 tk 117
// will bypass all tasks to measure minimum load
118
#define MEASURE_IDLE_CTR 0
702 tk 119
 
2275 tk 120
 
272 tk 121
// memory alloccation method:
122
// 0: internal static allocation with one byte for each flag
123
// 1: internal static allocation with 8bit flags
124
// 2: internal static allocation with 16bit flags
125
// 3: internal static allocation with 32bit flags
126
// 4: FreeRTOS based pvPortMalloc
127
// 5: malloc provided by library
128
#define SEQ_MIDI_OUT_MALLOC_METHOD 3
129
 
130
// max number of scheduled events which will allocate memory
131
// each event allocates 12 bytes
132
// MAX_EVENTS must be a power of two! (e.g. 64, 128, 256, 512, ...)
1116 tk 133
#define SEQ_MIDI_OUT_MAX_EVENTS 256
272 tk 134
 
135
// enable seq_midi_out_max_allocated and seq_midi_out_dropouts
136
#define SEQ_MIDI_OUT_MALLOC_ANALYSIS 1
137
 
2206 tk 138
// support delays
139
#define SEQ_MIDI_OUT_SUPPORT_DELAY 1
272 tk 140
 
2206 tk 141
 
1336 tk 142
#if defined(MIOS32_FAMILY_STM32F10x)
1071 tk 143
// enable third UART
1336 tk 144
# define MIOS32_UART_NUM 3
145
#else
146
// enable third and fourth UART
147
# define MIOS32_UART_NUM 4
148
#endif
178 tk 149
 
1071 tk 150
 
652 tk 151
// configure IIC_MIDI
152
#define MIOS32_IIC_MIDI_NUM 4
153
// all interfaces are "OUT only"
154
#define MIOS32_IIC_MIDI0_ENABLED    1
155
#define MIOS32_IIC_MIDI1_ENABLED    1
156
#define MIOS32_IIC_MIDI2_ENABLED    1
157
#define MIOS32_IIC_MIDI3_ENABLED    1
158
#define MIOS32_IIC_MIDI4_ENABLED    1
159
#define MIOS32_IIC_MIDI5_ENABLED    1
160
#define MIOS32_IIC_MIDI6_ENABLED    1
161
#define MIOS32_IIC_MIDI7_ENABLED    1
162
 
163
 
524 tk 164
// configure BLM driver
165
#define BLM_DOUT_L1_SR  255 // dummy, will be changed in seq_file_hw.c
166
#define BLM_DOUT_R1_SR  255 // dummy, will be changed in seq_file_hw.c
167
#define BLM_DOUT_CATHODES_SR1   255 // dummy, will be changed in seq_file_hw.c
168
#define BLM_DOUT_CATHODES_SR2   255 // dummy, will be changed in seq_file_hw.c
169
#define BLM_CATHODES_INV_MASK   0x00
170
#define BLM_DOUT_L2_SR  255 // dummy, will be changed in seq_file_hw.c
171
#define BLM_DOUT_R2_SR  255 // dummy, will be changed in seq_file_hw.c
172
#define BLM_DOUT_L3_SR  0 // not used
173
#define BLM_DOUT_R3_SR  0 // not used
174
#define BLM_DIN_L_SR    255 // dummy, will be changed in seq_file_hw.c
175
#define BLM_DIN_R_SR    255 // dummy, will be changed in seq_file_hw.c
176
#define BLM_NUM_COLOURS 2
177
#define BLM_NUM_ROWS    8
178
#define BLM_DEBOUNCE_MODE 1
179
 
180
 
464 tk 181
// configure BLM_X driver
182
#define BLM_X_NUM_ROWS            8
183
#define BLM_X_BTN_NUM_COLS        8
184
#define BLM_X_LED_NUM_COLS        8
185
#define BLM_X_LED_NUM_COLORS      1
513 tk 186
#define BLM_X_ROWSEL_DOUT_SR      255 // dummy, will be changed in seq_file_hw.c
187
#define BLM_X_LED_FIRST_DOUT_SR   255 // dummy, will be changed in seq_file_hw.c
188
#define BLM_X_BTN_FIRST_DIN_SR    255 // dummy, will be changed in seq_file_hw.c
189
#define BLM_X_ROWSEL_INV_MASK     0   // dummy, will be changed in seq_file_hw.c
2530 tk 190
#define BLM_X_COL_INV_MASK        0   // dummy, will be changed in seq_file_hw.c
1281 tk 191
#define BLM_X_DEBOUNCE_MODE       1
134 tk 192
 
821 tk 193
 
2461 tk 194
// WS2816 LEDs (only supported by STM32F4)
195
#if defined(MIOS32_FAMILY_STM32F4xx)
196
# define WS2812_NUM_LEDS 64
197
#else
198
# define WS2812_NUM_LEDS 0
199
#endif
200
 
2579 tk 201
// AOUT interface: enable calibration for up to 12 octaves
2580 tk 202
#ifdef MBSEQV4P
2579 tk 203
#define AOUT_NUM_CALI_POINTS_X 12
204
#define AOUT_NUM_CALI_POINTS_Y_INTERVAL (12*0x200)
2580 tk 205
#endif
2461 tk 206
 
2263 tk 207
// BLM_SCALAR master driver: enable this switch if the application supports OSC (based on osc_server module)
208
#define BLM_SCALAR_MASTER_OSC_SUPPORT 1
209
 
210
// map MIDI mutex to BLM_SCALAR master
211
// located in tasks.c to access MIDI IN/OUT mutex from external
212
extern void TASKS_MUTEX_MIDIOUT_Take(void);
213
extern void TASKS_MUTEX_MIDIOUT_Give(void);
214
#define BLM_SCALAR_MASTER_MUTEX_MIDIOUT_TAKE { TASKS_MUTEX_MIDIOUT_Take(); }
215
#define BLM_SCALAR_MASTER_MUTEX_MIDIOUT_GIVE       { TASKS_MUTEX_MIDIOUT_Give(); }
216
 
217
 
821 tk 218
// optional for Francois' 4 * 20x2 LCD configuration
219
// currently this option cannot be enabled in the MBSEQ_HW.V4 file - this will be possible later
220
#if 0
221
#define LCD_NUM_DEVICES          4
222
#define LCD_COLUMNS_PER_DEVICE  20
223
#define MIOS32_BOARD_LCD_E3_PORT GPIOB       // J15C.A10
224
#define MIOS32_BOARD_LCD_E3_PIN  GPIO_Pin_0
225
 
226
#define MIOS32_BOARD_LCD_E4_PORT GPIOB       // J15C.A11
227
#define MIOS32_BOARD_LCD_E4_PIN  GPIO_Pin_1
228
#endif
229
 
1241 tk 230
// LPC17 Ethernet driver: locate buffers to lower (default) section
231
// (no attribute passed to this variable)
232
#define LPC17XX_EMAC_MEM_SECTION
233
// reduce number of buffers to save memory
234
#define LPC17XX_EMAC_NUM_RX_FRAG 2
235
#define LPC17XX_EMAC_NUM_TX_FRAG 2
236
#define LPC17XX_EMAC_FRAG_SIZE   1024
1049 tk 237
 
238
 
1311 tk 239
// map MIDI mutex to UIP task
240
// located in tasks.c to access MIDI IN/OUT mutex from external
241
extern void TASKS_MUTEX_MIDIOUT_Take(void);
242
extern void TASKS_MUTEX_MIDIOUT_Give(void);
243
extern void TASKS_MUTEX_MIDIIN_Take(void);
244
extern void TASKS_MUTEX_MIDIIN_Give(void);
245
#define UIP_TASK_MUTEX_MIDIOUT_TAKE { TASKS_MUTEX_MIDIOUT_Take(); }
246
#define UIP_TASK_MUTEX_MIDIOUT_GIVE { TASKS_MUTEX_MIDIOUT_Give(); }
247
#define UIP_TASK_MUTEX_MIDIIN_TAKE  { TASKS_MUTEX_MIDIIN_Take(); }
248
#define UIP_TASK_MUTEX_MIDIIN_GIVE  { TASKS_MUTEX_MIDIIN_Give(); }
249
 
1049 tk 250
// Mutex for J16 access
251
extern void TASKS_J16SemaphoreTake(void);
252
extern void TASKS_J16SemaphoreGive(void);
253
#define MIOS32_SDCARD_MUTEX_TAKE   { TASKS_J16SemaphoreTake(); }
254
#define MIOS32_SDCARD_MUTEX_GIVE   { TASKS_J16SemaphoreGive(); }
255
#define MIOS32_ENC28J60_MUTEX_TAKE { TASKS_J16SemaphoreTake(); }
256
#define MIOS32_ENC28J60_MUTEX_GIVE { TASKS_J16SemaphoreGive(); }
257
 
61 tk 258
#endif /* _MIOS32_CONFIG_H */