Subversion Repositories svn.mios32

Rev

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

Rev Author Line No. Line
2141 Sauraen 1
// $Id: mios32_config.h 2044 2014-09-02 22:14:17Z 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
 
13
// Make sure only STM32F4
14
#if !defined(MIOS32_BOARD_STM32F4DISCOVERY) && !defined(MIOS32_BOARD_MBHP_CORE_STM32F4)
15
#error "MIDIbox FM V2.1 only supported on STM32F4 MCU!"
16
#endif
17
 
18
// The boot message which is print during startup and returned on a SysEx query
19
#define MIOS32_LCD_BOOT_MSG_DELAY 0 // we delay the boot and print a message inside the app
20
#define MIOS32_LCD_BOOT_MSG_LINE1 "MIDIbox FM V2.1"
21
#define MIOS32_LCD_BOOT_MSG_LINE2 "(C)2014 Sauraen/T.Klose"
22
 
23
// define a unique VID/PID for this application
24
#define MIOS32_USB_PRODUCT_STR  "MIDIbox FM V2.1"
25
 
26
// enable 4 USB ports
27
#define MIOS32_USB_MIDI_NUM_PORTS 4
28
 
29
// increased number of SRs
30
#define MIOS32_SRIO_NUM_SR 32
31
 
32
// use 32 DOUT pages
33
#define MIOS32_SRIO_NUM_DOUT_PAGES 32
34
 
35
// disables the default SRIO scan routine in programming_models/traditional/main.c
36
// allows to implement an own handler
37
// -> see app.c, APP_SRIO_*
38
#define MIOS32_DONT_SERVICE_SRIO_SCAN 1
39
 
40
// special callback which will be called for DIN pin emulation
41
#define MIOS32_SRIO_CALLBACK_BEFORE_DIN_COMPARE APP_SRIO_ServiceFinishBeforeDINCompare
42
 
43
// enable 4 MIDI ports (note: MIDI3 only used if AIN ports disabled)
44
#if defined(MIOS32_FAMILY_STM32F10x)
45
// enable third UART
46
# define MIOS32_UART_NUM 3
47
#else
48
// enable third and fourth UART
49
# define MIOS32_UART_NUM 4
50
#endif
51
 
52
 
53
// enable 128 encoders (because SCS allocates one encoder as well)
54
#define MIOS32_ENC_NUM_MAX 65
55
 
56
 
57
// the SCS is entered by pressing the EXIT button
58
//#define SCS_MENU_ENTERED_VIA_EXIT_BUTTON 1
59
 
60
// max. number of menu items (configurable with SCS num_items=...)
61
//#define SCS_NUM_MENU_ITEMS 8
62
 
63
 
64
// AIN configuration:
65
 
66
// bit mask to enable channels
67
//
68
// Pin mapping on MBHP_CORE_STM32 module:
69
//   15       14      13     12     11     10      9      8   
70
// J16.SO  J16.SI  J16.SC J16.RC J5C.A11 J5C.A10 J5C.A9 J5C.A8
71
//   7        6       5      4      3      2      1       0
72
// J5B.A7  J5B.A6  J5B.A5 J5B.A4 J5A.A3 J5A.A2 J5A.A1  J5A.A0
73
//
74
// Examples:
75
//   mask 0x000f will enable all J5A channels
76
//   mask 0x00f0 will enable all J5B channels
77
//   mask 0x0f00 will enable all J5C channels
78
//   mask 0x0fff will enable all J5A/B/C channels
79
// (all channels are disabled by default)
80
#if defined(MIOS32_FAMILY_STM32F10x) || defined(MIOS32_FAMILY_LPC17xx)
81
// reduced to 6 pins due to conflict with MIDI OUT3/IN3
82
#define MIOS32_AIN_CHANNEL_MASK 0x003f
83
#else
84
#define MIOS32_AIN_CHANNEL_MASK 0x00ff
85
#endif
86
 
87
// define the deadband (min. difference to report a change to the application hook)
88
// typically set to (2^(12-desired_resolution)-1)
89
// e.g. for a resolution of 7 bit, it's set to (2^(12-7)-1) = (2^5 - 1) = 31
90
#define MIOS32_AIN_DEADBAND 31
91
 
92
 
93
#define DEBUG_MSG MIOS32_MIDI_SendDebugMessage
94
 
95
// enable two AINSER modules
96
#define AINSER_NUM_MODULES 2
97
 
98
// enable 32 AOUT channels
99
#define AOUT_NUM_CHANNELS 32
100
// configurable chip select pin
101
extern char mbng_patch_aout_spi_rc_pin;
102
#define AOUT_SPI_RC_PIN mbng_patch_aout_spi_rc_pin
103
 
104
// enable 1 MAX72xx chain with up to 16 devices
105
#define MAX72XX_NUM_CHAINS 1
106
#define MAX72XX_NUM_DEVICES_PER_CHAIN 16
107
// configurable chip select pin
108
extern char mbng_patch_max72xx_spi_rc_pin;
109
#define MAX72XX_SPI_RC_PIN_CHAIN1 mbng_patch_max72xx_spi_rc_pin
110
 
111
 
112
// reserved memory for FreeRTOS pvPortMalloc function
113
#define MIOS32_HEAP_SIZE 10*1024
114
// UMM heap located in default section (means for LPC17: not in AHB memory, because we are using it for the event pool)
115
#define UMM_HEAP_SECTION
116
 
117
// stack sizes which are used by various tasks (see APP_Init() in app.c)
118
#define APP_BIG_STACK_SIZE     (2048)
119
#define APP_REDUCED_STACK_SIZE (1024)
120
// for the MIOS32 hooks in main.c
121
#define MIOS32_MINIMAL_STACK_SIZE APP_BIG_STACK_SIZE
122
// for the UIP task
123
#define UIP_TASK_STACK_SIZE       APP_BIG_STACK_SIZE
124
 
125
// optionally for task analysis - if enabled, the stats can be displayed with the "system" command in MIOS Terminal
126
#if 0
127
#define configUSE_TRACE_FACILITY                1
128
#define configGENERATE_RUN_TIME_STATS           0
2425 tk 129
#if configGENERATE_RUN_TIME_STATS
2141 Sauraen 130
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS  FREERTOS_UTILS_PerfCounterInit
131
#define portGET_RUN_TIME_COUNTER_VALUE          FREERTOS_UTILS_PerfCounterGet
132
#endif
2425 tk 133
#endif
2141 Sauraen 134
 
135
// for LPC17: simplify allocation of large arrays
136
//#if defined(MIOS32_FAMILY_LPC17xx)
137
//# define AHB_SECTION __attribute__ ((section (".bss_ahb")))
138
//#else
139
# define AHB_SECTION //should not be using LPC17
140
//#endif
141
 
142
// LPC17 Ethernet driver: locate buffers to lower (default) section
143
// (no attribute passed to this variable)
144
//#define LPC17XX_EMAC_MEM_SECTION
145
// reduce number of buffers to save memory
146
//#define LPC17XX_EMAC_NUM_RX_FRAG 2
147
//#define LPC17XX_EMAC_NUM_TX_FRAG 2
148
//#define LPC17XX_EMAC_FRAG_SIZE   1024
149
 
150
 
151
// size of SysEx buffers
152
// if longer SysEx strings are received, they will be forwarded directly
153
// in this case, multiple strings concurrently sent to the same port won't be merged correctly anymore.
154
#define MIDI_ROUTER_SYSEX_BUFFER_SIZE 16
155
 
156
// Keyboard Handler
157
#define KEYBOARD_NOTIFY_TOGGLE_HOOK MBNG_KB_NotifyToggle
158
#define KEYBOARD_DONT_USE_MIDI_CFG 1
159
#define KEYBOARD_DONT_USE_AIN 1
160
 
161
 
162
// map MIDI mutex to UIP task
163
// located in app.c to access MIDI IN/OUT mutex from external
164
extern void APP_MUTEX_MIDIOUT_Take(void);
165
extern void APP_MUTEX_MIDIOUT_Give(void);
166
extern void APP_MUTEX_MIDIIN_Take(void);
167
extern void APP_MUTEX_MIDIIN_Give(void);
168
#define UIP_TASK_MUTEX_MIDIOUT_TAKE { APP_MUTEX_MIDIOUT_Take(); }
169
#define UIP_TASK_MUTEX_MIDIOUT_GIVE { APP_MUTEX_MIDIOUT_Give(); }
170
#define UIP_TASK_MUTEX_MIDIIN_TAKE  { APP_MUTEX_MIDIIN_Take(); }
171
#define UIP_TASK_MUTEX_MIDIIN_GIVE  { APP_MUTEX_MIDIIN_Give(); }
172
 
173
// Mutex for J16 access
174
extern void APP_J16SemaphoreTake(void);
175
extern void APP_J16SemaphoreGive(void);
176
#define MIOS32_SDCARD_MUTEX_TAKE   { APP_J16SemaphoreTake(); }
177
#define MIOS32_SDCARD_MUTEX_GIVE   { APP_J16SemaphoreGive(); }
178
#define MIOS32_ENC28J60_MUTEX_TAKE { APP_J16SemaphoreTake(); }
179
#define MIOS32_ENC28J60_MUTEX_GIVE { APP_J16SemaphoreGive(); }
180
 
181
 
182
//For OPL3 modules
183
#define OPL3_COUNT 2
184
#define OPL3_RS_PORT  GPIOA      
185
#define OPL3_RS_PIN   GPIO_Pin_15
186
#define OPL3_CS_PINS  {12,13}    //J10 pin numbers
187
#define OPL3_CS_MASKS {1<<4,1<<5}//Port E pin numbers (1-shifted-to-it)
188
 
189
//For MIDIbox FM
190
#define MBFM_MODL_NUMCONN 16 //ideally ???
191
#define MBFM_WT_LEN 32
192
#define MBFM_DLY_STEPS 64 //maybe good, 256 is better (doesn't have to be power-of-two)
193
#define MBFM_DLY_USEVEL 1
194
 
195
#define MBFM_ALLOW_MULTIPLE_SAME_NOTES //two voices in same channel playing same note because two note-ons received
196
 
197
 
198
#endif /* _MIOS32_CONFIG_H */