Subversion Repositories svn.mios32

Rev

Rev 2580 | Rev 2636 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
61 tk 1
// $Id: mios32_config.h 2628 2018-12-30 21:14:09Z 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
27
#define MIOS32_LCD_BOOT_MSG_LINE2 "(C) 2018 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
 
2444 tk 55
#define MIOS32_TASK_HOOKS_STACK_SIZE       1000
2509 tk 56
#define UIP_TASK_STACK_SIZE                1000
2551 tk 57
#ifdef MBSEQV4P
2559 tk 58
# define MIOS32_TASK_MIDI_HOOKS_STACK_SIZE 1900
59
# define MIDI_TASK_STACK_SIZE              1900
60
#else
61
# define MIOS32_TASK_MIDI_HOOKS_STACK_SIZE 1400
2551 tk 62
# define MIDI_TASK_STACK_SIZE              1400
63
#endif
2432 tk 64
#define PERIOD1MS_TASK_STACK_SIZE          1400
65
#define PERIOD1MS_LOWPRIO_TASK_STACK_SIZE  1400
66
 
67
// only used by idle task
68
#define MIOS32_MINIMAL_STACK_SIZE           384
69
 
70
 
1349 tk 71
// P.S.: in order to check if the stack size is sufficient, store a preset pattern in Event->Presets page
72
// Sequencer could crash with hardfault on a buffer overrun
134 tk 73
 
248 tk 74
// reserved memory for FreeRTOS pvPortMalloc function
2551 tk 75
#ifdef MBSEQV4P
2559 tk 76
# define MIOS32_HEAP_SIZE 15*1024
2551 tk 77
#else
78
# define MIOS32_HEAP_SIZE 13*1024
79
#endif
248 tk 80
 
1318 tk 81
// for LPC17: simplify allocation of large arrays
1234 tk 82
#if defined(MIOS32_FAMILY_LPC17xx)
83
# define AHB_SECTION __attribute__ ((section (".bss_ahb")))
84
#else
85
# define AHB_SECTION
86
#endif
248 tk 87
 
1234 tk 88
 
1864 tk 89
// increased number of SRs (MBSEQ uses 16 SRs by default, but it's possible to increase the number in MBSEQ_HW.V4)
90
#define MIOS32_SRIO_NUM_SR 23
91
 
1440 tk 92
// to save some RAM (only 128 bytes, but "Kleinvieh macht auch Mist" - especially for LPC17)
93
#define MIOS32_ENC_NUM_MAX 32
94
 
95
 
736 tk 96
// optional performance measuring
737 tk 97
// 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 98
#define configUSE_TRACE_FACILITY                0
736 tk 99
#define configGENERATE_RUN_TIME_STATS           0
2425 tk 100
#if configGENERATE_RUN_TIME_STATS
736 tk 101
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS  FREERTOS_UTILS_PerfCounterInit
102
#define portGET_RUN_TIME_COUNTER_VALUE          FREERTOS_UTILS_PerfCounterGet
2425 tk 103
#endif
736 tk 104
 
105
 
702 tk 106
// maximum idle counter value to be expected
1531 tk 107
#if defined(MIOS32_FAMILY_LPC17xx)
2275 tk 108
#define MAX_IDLE_CTR 628000 // LPC1769@120 MHz
109
#elif defined(MIOS32_FAMILY_STM32F4xx)
2533 tk 110
#define MAX_IDLE_CTR 956000 // STM32F407VG@160 MHz
1531 tk 111
#else
2275 tk 112
#define MAX_IDLE_CTR 192000 // STM32F103RE@80 MHz
1531 tk 113
#endif
702 tk 114
 
2275 tk 115
// will bypass all tasks to measure minimum load
116
#define MEASURE_IDLE_CTR 0
702 tk 117
 
2275 tk 118
 
272 tk 119
// memory alloccation method:
120
// 0: internal static allocation with one byte for each flag
121
// 1: internal static allocation with 8bit flags
122
// 2: internal static allocation with 16bit flags
123
// 3: internal static allocation with 32bit flags
124
// 4: FreeRTOS based pvPortMalloc
125
// 5: malloc provided by library
126
#define SEQ_MIDI_OUT_MALLOC_METHOD 3
127
 
128
// max number of scheduled events which will allocate memory
129
// each event allocates 12 bytes
130
// MAX_EVENTS must be a power of two! (e.g. 64, 128, 256, 512, ...)
1116 tk 131
#define SEQ_MIDI_OUT_MAX_EVENTS 256
272 tk 132
 
133
// enable seq_midi_out_max_allocated and seq_midi_out_dropouts
134
#define SEQ_MIDI_OUT_MALLOC_ANALYSIS 1
135
 
2206 tk 136
// support delays
137
#define SEQ_MIDI_OUT_SUPPORT_DELAY 1
272 tk 138
 
2206 tk 139
 
1336 tk 140
#if defined(MIOS32_FAMILY_STM32F10x)
1071 tk 141
// enable third UART
1336 tk 142
# define MIOS32_UART_NUM 3
143
#else
144
// enable third and fourth UART
145
# define MIOS32_UART_NUM 4
146
#endif
178 tk 147
 
1071 tk 148
 
652 tk 149
// configure IIC_MIDI
150
#define MIOS32_IIC_MIDI_NUM 4
151
// all interfaces are "OUT only"
152
#define MIOS32_IIC_MIDI0_ENABLED    1
153
#define MIOS32_IIC_MIDI1_ENABLED    1
154
#define MIOS32_IIC_MIDI2_ENABLED    1
155
#define MIOS32_IIC_MIDI3_ENABLED    1
156
#define MIOS32_IIC_MIDI4_ENABLED    1
157
#define MIOS32_IIC_MIDI5_ENABLED    1
158
#define MIOS32_IIC_MIDI6_ENABLED    1
159
#define MIOS32_IIC_MIDI7_ENABLED    1
160
 
161
 
524 tk 162
// configure BLM driver
163
#define BLM_DOUT_L1_SR  255 // dummy, will be changed in seq_file_hw.c
164
#define BLM_DOUT_R1_SR  255 // dummy, will be changed in seq_file_hw.c
165
#define BLM_DOUT_CATHODES_SR1   255 // dummy, will be changed in seq_file_hw.c
166
#define BLM_DOUT_CATHODES_SR2   255 // dummy, will be changed in seq_file_hw.c
167
#define BLM_CATHODES_INV_MASK   0x00
168
#define BLM_DOUT_L2_SR  255 // dummy, will be changed in seq_file_hw.c
169
#define BLM_DOUT_R2_SR  255 // dummy, will be changed in seq_file_hw.c
170
#define BLM_DOUT_L3_SR  0 // not used
171
#define BLM_DOUT_R3_SR  0 // not used
172
#define BLM_DIN_L_SR    255 // dummy, will be changed in seq_file_hw.c
173
#define BLM_DIN_R_SR    255 // dummy, will be changed in seq_file_hw.c
174
#define BLM_NUM_COLOURS 2
175
#define BLM_NUM_ROWS    8
176
#define BLM_DEBOUNCE_MODE 1
177
 
178
 
464 tk 179
// configure BLM_X driver
180
#define BLM_X_NUM_ROWS            8
181
#define BLM_X_BTN_NUM_COLS        8
182
#define BLM_X_LED_NUM_COLS        8
183
#define BLM_X_LED_NUM_COLORS      1
513 tk 184
#define BLM_X_ROWSEL_DOUT_SR      255 // dummy, will be changed in seq_file_hw.c
185
#define BLM_X_LED_FIRST_DOUT_SR   255 // dummy, will be changed in seq_file_hw.c
186
#define BLM_X_BTN_FIRST_DIN_SR    255 // dummy, will be changed in seq_file_hw.c
187
#define BLM_X_ROWSEL_INV_MASK     0   // dummy, will be changed in seq_file_hw.c
2530 tk 188
#define BLM_X_COL_INV_MASK        0   // dummy, will be changed in seq_file_hw.c
1281 tk 189
#define BLM_X_DEBOUNCE_MODE       1
134 tk 190
 
821 tk 191
 
2461 tk 192
// WS2816 LEDs (only supported by STM32F4)
193
#if defined(MIOS32_FAMILY_STM32F4xx)
194
# define WS2812_NUM_LEDS 64
195
#else
196
# define WS2812_NUM_LEDS 0
197
#endif
198
 
2579 tk 199
// AOUT interface: enable calibration for up to 12 octaves
2580 tk 200
#ifdef MBSEQV4P
2579 tk 201
#define AOUT_NUM_CALI_POINTS_X 12
202
#define AOUT_NUM_CALI_POINTS_Y_INTERVAL (12*0x200)
2580 tk 203
#endif
2461 tk 204
 
2263 tk 205
// BLM_SCALAR master driver: enable this switch if the application supports OSC (based on osc_server module)
206
#define BLM_SCALAR_MASTER_OSC_SUPPORT 1
207
 
208
// map MIDI mutex to BLM_SCALAR master
209
// located in tasks.c to access MIDI IN/OUT mutex from external
210
extern void TASKS_MUTEX_MIDIOUT_Take(void);
211
extern void TASKS_MUTEX_MIDIOUT_Give(void);
212
#define BLM_SCALAR_MASTER_MUTEX_MIDIOUT_TAKE { TASKS_MUTEX_MIDIOUT_Take(); }
213
#define BLM_SCALAR_MASTER_MUTEX_MIDIOUT_GIVE       { TASKS_MUTEX_MIDIOUT_Give(); }
214
 
215
 
821 tk 216
// optional for Francois' 4 * 20x2 LCD configuration
217
// currently this option cannot be enabled in the MBSEQ_HW.V4 file - this will be possible later
218
#if 0
219
#define LCD_NUM_DEVICES          4
220
#define LCD_COLUMNS_PER_DEVICE  20
221
#define MIOS32_BOARD_LCD_E3_PORT GPIOB       // J15C.A10
222
#define MIOS32_BOARD_LCD_E3_PIN  GPIO_Pin_0
223
 
224
#define MIOS32_BOARD_LCD_E4_PORT GPIOB       // J15C.A11
225
#define MIOS32_BOARD_LCD_E4_PIN  GPIO_Pin_1
226
#endif
227
 
1241 tk 228
// LPC17 Ethernet driver: locate buffers to lower (default) section
229
// (no attribute passed to this variable)
230
#define LPC17XX_EMAC_MEM_SECTION
231
// reduce number of buffers to save memory
232
#define LPC17XX_EMAC_NUM_RX_FRAG 2
233
#define LPC17XX_EMAC_NUM_TX_FRAG 2
234
#define LPC17XX_EMAC_FRAG_SIZE   1024
1049 tk 235
 
236
 
1311 tk 237
// map MIDI mutex to UIP task
238
// located in tasks.c to access MIDI IN/OUT mutex from external
239
extern void TASKS_MUTEX_MIDIOUT_Take(void);
240
extern void TASKS_MUTEX_MIDIOUT_Give(void);
241
extern void TASKS_MUTEX_MIDIIN_Take(void);
242
extern void TASKS_MUTEX_MIDIIN_Give(void);
243
#define UIP_TASK_MUTEX_MIDIOUT_TAKE { TASKS_MUTEX_MIDIOUT_Take(); }
244
#define UIP_TASK_MUTEX_MIDIOUT_GIVE { TASKS_MUTEX_MIDIOUT_Give(); }
245
#define UIP_TASK_MUTEX_MIDIIN_TAKE  { TASKS_MUTEX_MIDIIN_Take(); }
246
#define UIP_TASK_MUTEX_MIDIIN_GIVE  { TASKS_MUTEX_MIDIIN_Give(); }
247
 
1049 tk 248
// Mutex for J16 access
249
extern void TASKS_J16SemaphoreTake(void);
250
extern void TASKS_J16SemaphoreGive(void);
251
#define MIOS32_SDCARD_MUTEX_TAKE   { TASKS_J16SemaphoreTake(); }
252
#define MIOS32_SDCARD_MUTEX_GIVE   { TASKS_J16SemaphoreGive(); }
253
#define MIOS32_ENC28J60_MUTEX_TAKE { TASKS_J16SemaphoreTake(); }
254
#define MIOS32_ENC28J60_MUTEX_GIVE { TASKS_J16SemaphoreGive(); }
255
 
61 tk 256
#endif /* _MIOS32_CONFIG_H */