19 #include PLATFORM_HEADER
22 #include "stack/include/ember.h"
23 #include "stack/include/error.h"
25 #define PORTA (0 << 3)
26 #define PORTB (1 << 3)
27 #define PORTC (2 << 3)
248 #define PORT_NAME(x) ((x == PORTA) ? "A": ((x == PORTB) ? "B" : ((x == PORTC) ? "C": "?")))
254 boardDescription =
NULL;
256 halCommonGetToken(boardName, TOKEN_MFG_BOARD_NAME);
258 halCommonGetMfgToken(boardName, TOKEN_MFG_BOARD_NAME);
262 while ((i >= 0) && (boardName[i] == 0xFF)) {
267 for (i = 0; i < (
sizeof(boardList)/4) ; i++)
268 if (strcmp(boardName, (boardList[i])->name) == 0) {
273 if (boardDescription ==
NULL) {
281 return boardDescription;
287 GPIO_PACFGL = (GPIOCFG_IN <<PA0_CFG_BIT)|
288 (GPIOCFG_IN <<PA1_CFG_BIT)|
289 (GPIOCFG_IN <<PA2_CFG_BIT)|
290 (GPIOCFG_IN <<PA3_CFG_BIT);
291 GPIO_PACFGH = (GPIOCFG_IN <<PA4_CFG_BIT)|
292 (GPIOCFG_IN <<PA5_CFG_BIT)|
293 (GPIOCFG_IN <<PA6_CFG_BIT)|
294 (GPIOCFG_IN <<PA7_CFG_BIT);
295 GPIO_PBCFGL = (GPIOCFG_IN <<PB0_CFG_BIT)|
296 (GPIOCFG_IN <<PB1_CFG_BIT)|
297 (GPIOCFG_IN <<PB2_CFG_BIT)|
298 (GPIOCFG_IN <<PB3_CFG_BIT);
299 GPIO_PBCFGH = (GPIOCFG_IN <<PB4_CFG_BIT)|
300 (GPIOCFG_IN <<PB5_CFG_BIT)|
301 (GPIOCFG_IN <<PB6_CFG_BIT)|
302 (GPIOCFG_IN <<PB7_CFG_BIT);
303 GPIO_PCCFGL = (GPIOCFG_IN <<PC0_CFG_BIT)|
304 (GPIOCFG_IN <<PC1_CFG_BIT)|
305 (GPIOCFG_IN <<PC2_CFG_BIT)|
306 (GPIOCFG_IN <<PC3_CFG_BIT);
307 GPIO_PCCFGH = (GPIOCFG_IN <<PC4_CFG_BIT)|
308 (GPIOCFG_IN <<PC5_CFG_BIT)|
310 (CFG_C6 <<PC6_CFG_BIT)|
311 (CFG_C7 <<PC7_CFG_BIT);
313 (GPIOCFG_IN <<PC6_CFG_BIT)|
314 (GPIOCFG_IN <<PC7_CFG_BIT);
322 for (i = 0; i < boardDescription->
buttons; i++) {
332 for (i = 0; i < boardDescription->
leds; i++) {
353 GPIO_PACFGL = (GPIOCFG_IN <<PA0_CFG_BIT)|
354 (GPIOCFG_IN <<PA1_CFG_BIT)|
355 (GPIOCFG_IN <<PA2_CFG_BIT)|
356 (GPIOCFG_IN <<PA3_CFG_BIT);
357 GPIO_PACFGH = (GPIOCFG_IN <<PA4_CFG_BIT)|
358 (GPIOCFG_IN <<PA5_CFG_BIT)|
359 (GPIOCFG_IN <<PA6_CFG_BIT)|
360 (GPIOCFG_IN <<PA7_CFG_BIT);
361 GPIO_PBCFGL = (GPIOCFG_IN <<PB0_CFG_BIT)|
362 (GPIOCFG_OUT_ALT <<PB1_CFG_BIT)|
363 (GPIOCFG_IN <<PB2_CFG_BIT)|
364 (GPIOCFG_IN <<PB3_CFG_BIT);
365 GPIO_PBCFGH = (GPIOCFG_IN <<PB4_CFG_BIT)|
366 (GPIOCFG_IN <<PB5_CFG_BIT)|
367 (GPIOCFG_IN <<PB6_CFG_BIT)|
368 (GPIOCFG_IN <<PB7_CFG_BIT);
369 GPIO_PCCFGL = (GPIOCFG_IN <<PC0_CFG_BIT)|
370 (GPIOCFG_IN <<PC1_CFG_BIT)|
371 (GPIOCFG_IN <<PC2_CFG_BIT)|
372 (GPIOCFG_IN <<PC3_CFG_BIT);
373 GPIO_PCCFGH = (GPIOCFG_IN <<PC4_CFG_BIT)|
374 (GPIOCFG_IN <<PC5_CFG_BIT)|
376 (CFG_C6 <<PC6_CFG_BIT)|
377 (CFG_C7 <<PC7_CFG_BIT);
379 (GPIOCFG_IN <<PC6_CFG_BIT)|
380 (GPIOCFG_IN <<PC7_CFG_BIT);
398 for (i = 0; i < boardDescription->
leds; i++) {
408 for (i = 0; i < boardDescription->
buttons; i++) {
436 printf (
"Led %s (port:%s, bit:%d)\r\n", leds->
name, PORT_NAME(leds->
gpioPort), leds->
gpioPin);
444 printf (
"Button %s (port:%s, bit:%d)\r\n", buttons->
name, PORT_NAME(buttons->
gpioPort), buttons->
gpioPin);
449 void boardPrintStringDescription(
void)
453 while (boardList[i] !=
NULL) {
454 if ((boardDescription == boardList[i]) || (boardDescription ==
NULL)) {
456 printf (
"*************************************\r\n");
457 printf (
"Board name = %s\r\n", ptr->name);
458 printf (
"*************************************\r\n");
459 printLeds(ptr->
leds);
462 printf (
"MEMS = %s\r\n", ptr->
mems->
name);
465 printf (
"Temp sensor = %s, port:%s, pin:%d, adcFix:%s\r\n",
472 printf (
"EEProm:%s\r\n", ptr->EEProm ?
"Yes" :
"No");
473 printf (
"PC i/f:%s\r\n", ptr->FTDInotSTM32 ?
"FTDI" :
"STM32F");
474 printf (
"Power Amplifier:%s\r\n", ptr->PowerAmplifier ?
"Yes" :
"No");