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");
#define TRUE
An alias for one, used for clarity.
char * name
Name of the temperature sensor device.
char * name
Name of the button as printed in the board.
#define BUTTONS_MB954B
Define the number of user buttons in the specific board revision.
#define BOARD_HAS_EEPROM
Flag to indicate if EEPROM is present.
#define BOARD_HAS_FTDI
Flag to indicate if FTDI is used as PC interface.
void halGpioConfig(uint32_t io, uint32_t config)
Configure an IO pin's operating mode.
Generic set of HAL includes for all platforms.
Cortex-M3 Manufacturing token system.
uint8_t gpioPin
GPIO pin associated with the sensor.
Data structure for button description.
#define BUTTONS_MB851B
Define the number of user buttons in the specific board revision.
const ButtonResourceType * buttons
Pointer to button resources.
#define BOARD_HAS_STM32F
Flag to indicate if STM32F is used as PC interface.
#define LEDS_MB851A
Define the number of LEDs in the specific board revision.
uint8_t leds
Number of leds.
#define LEDS_MB954A
Define the number of LEDs in the specific board revision.
Data structure for MEMS description.
#define BUTTONS_MB954A
Define the number of user buttons in the specific board revision.
#define LEDS_MB851B
Define the number of LEDs in the specific board revision.
void halBoardInit(void)
Initialize the board description data structure after autodetect of the boards based on the CIB Board...
void halBoardPowerDown(void)
Perform board specific action to power down the system, usually before going to deep sleep...
#define LEDS_MB851C
Define the number of LEDs in the specific board revision.
uint8_t buttons
Number of buttons.
#define PORTA_PIN(y)
Some registers and variables require indentifying GPIO by a single number instead of the port and pin...
const BoardIOType * io
Board I/O description.
#define BOARD_HAS_PA
Flag to indicate if external power amplifier is present.
#define BUTTONS_MB950A
Define the number of user buttons in the specific board revision.
void halGpioSet(uint32_t gpio, boolean value)
Set/Clear single GPIO bit.
uint8_t gpioPin
GPIO pin associated with the button.
#define PORTA
Peripheral PORTA base pointer.
#define NULL
The null pointer.
BoardResourcesType const * halBoardGetDescription(void)
Return pointer to board description structure.
const TempSensorResourceType * temperatureSensor
Board infrared temeprature sensor description.
uint8_t gpioPin
GPIO pin associated with the LED.
const LedResourceType * leds
Pointer to LED resources.
Data structure for temperature sensor description.
#define BUTTONS_MB951A
Define the number of user buttons in the specific board revision.
#define BUTTONS_MB851C
Define the number of user buttons in the specific board revision.
#define BUTTONS_MB851A
Define the number of user buttons in the specific board revision.
uint8_t gpioPort
GPIO port associated with the LED.
#define PORTC_PIN(y)
Some registers and variables require indentifying GPIO by a single number instead of the port and pin...
Data structure describing board features.
#define PORTB_PIN(y)
Some registers and variables require indentifying GPIO by a single number instead of the port and pin...
char * name
Name of the LED as printed in the board.
void halBoardPowerUp(void)
Perform board specific action to power up the system.
char * name
Name of the MEMS device.
#define FALSE
An alias for zero, used for clarity.
#define BOARD_HAS_TEMP_SENSOR
Flag to indicate if temeprature sensor is present.
const MemsResourceType * mems
Board infrared MEMS description.
#define BOARD_HAS_MEMS
Flag to indicate if MEMS is present.
#define PORTx_PIN(x, y)
Some registers and variables require indentifying GPIO by a single number instead of the port and pin...
uint8_t gpioPort
GPIO port associated with the button.
#define LEDS_MB950A
Define the number of LEDs in the specific board revision.
Data structure for led description.
boolean adcFix
Flag to indicate whether the ADC range extension bug fix is implemented.
uint8_t gpioPort
GPIO port associated with the sensor.
Data structure for board user I/O.
#define LEDS_MB951A
Define the number of LEDs in the specific board revision.
#define LEDS_MB954B
Define the number of LEDs in the specific board revision.
#define PORTB
Peripheral PORTB base pointer.