EFM32 Happy Gecko Software Documentation  efm32hg-doc-5.1.2
bsp_dk_3200.c
Go to the documentation of this file.
1 /***************************************************************************/
18 #include "em_device.h"
19 #include "em_cmu.h"
20 #include "em_ebi.h"
21 #include "em_gpio.h"
22 #include "em_system.h"
23 #include "em_usart.h"
24 #include "bsp_dk_bcreg_3200.h"
25 #include "bsp.h"
26 
27 #if defined( BSP_DK_BRD3200 )
28 
30 /* USART used for SPI access */
31 #define BSP_SPI_USART_USED USART2
32 #define BSP_SPI_USART_CLK cmuClock_USART2
34 /* GPIO pins used fotr SPI pins, please refer to DK user guide. */
35 #define BSP_PORT_SPIBUS_CONNECT gpioPortC
36 #define BSP_PIN_SPIBUS_CONNECT 13
37 #define BSP_PORT_EBIBUS_CONNECT gpioPortC
38 #define BSP_PIN_EBIBUS_CONNECT 12
39 #define BSP_PORT_SPI_TX gpioPortC
40 #define BSP_PIN_SPI_TX 2
41 #define BSP_PORT_SPI_RX gpioPortC
42 #define BSP_PIN_SPI_RX 3
43 #define BSP_PORT_SPI_CLK gpioPortC
44 #define BSP_PIN_SPI_CLK 4
45 #define BSP_PORT_SPI_CS gpioPortC
46 #define BSP_PIN_SPI_CS 5
48 static uint16_t SpiBcAccess(uint8_t addr, uint8_t rw, uint16_t data);
49 static void SpiBcInit(void);
50 static void SpiBcDisable(void);
51 static bool SpiInit(void);
52 static uint16_t SpiRegisterRead(volatile uint16_t *addr);
53 static void SpiRegisterWrite(volatile uint16_t *addr, uint16_t data);
54 static volatile const uint16_t *lastAddr = 0;
56 #if defined( BSP_BC_CTRL_EBI )
57 static void EbiConfigure(void);
58 static bool EbiInit(void);
59 static void EbiDisable(void);
60 #endif
61 
63 
65 {
66  (void)mode; /* Unused parameter. */
68 }
69 
71 {
72  return busMode;
73 }
74 
75 uint32_t BSP_DipSwitchGet(void)
76 {
77  return (~BSP_RegisterRead(BC_DIPSWITCH)) & 0x00ff;
78 }
79 
80 int BSP_Disable(void)
81 {
82 #if defined( BSP_BC_CTRL_EBI )
83  /* Handover bus control */
85  /* Disable EBI interface */
86  EbiDisable();
87 #else
88 
89  SpiBcDisable();
90 #endif
91 
92  busMode = BSP_BusControl_Undefined;
93 
94  return BSP_STATUS_OK;
95 }
96 
98 {
99  (void)option; /* Unused parameter. */
101 }
102 
103 int BSP_EbiExtendedAddressRange(bool enable)
104 {
105  (void)enable; /* Unused parameter. */
107 }
108 
109 int BSP_EnergyModeSet(uint16_t energyMode)
110 {
111  BSP_RegisterWrite(BC_EM, energyMode);
112  return BSP_STATUS_OK;
113 }
114 
115 int BSP_Init(uint32_t flags)
116 {
117  bool ret = false;
118  (void)flags; /* Unused parameter. */
119 
120 #if defined( BSP_BC_CTRL_EBI )
121  ret = EbiInit();
122  busMode = BSP_BusControl_EBI;
123 #else
124  ret = SpiInit();
125  busMode = BSP_BusControl_SPI;
126 #endif
127 
128  if (ret == false)
129  {
130  /* Board is configured in wrong mode, please restart KIT! */
131  while (1) ;
132  }
133 
134  /* Set Energy Mode 0. */
136 
137  return BSP_STATUS_OK;
138 }
139 
140 int BSP_InterruptDisable(uint16_t flags)
141 {
142  uint16_t tmp;
143 
144  /* Clear flags from interrupt enable register */
145  tmp = BSP_RegisterRead(BC_INTEN);
146  flags = ~(flags);
147  tmp &= flags;
149  return BSP_STATUS_OK;
150 }
151 
152 int BSP_InterruptEnable(uint16_t flags)
153 {
154  uint16_t tmp;
155 
156  /* Add flags to interrupt enable register */
157  tmp = BSP_RegisterRead(BC_INTEN);
158  tmp |= flags;
160  return BSP_STATUS_OK;
161 }
162 
163 int BSP_InterruptFlagsClear(uint16_t flags)
164 {
166  return BSP_STATUS_OK;
167 }
168 
169 uint16_t BSP_InterruptFlagsGet(void)
170 {
172 }
173 
174 uint16_t BSP_JoystickGet(void)
175 {
176  uint16_t joyStick = 0;
177  uint16_t aemState;
178 
179  /* Check state */
180  aemState = BSP_RegisterRead(BC_AEMSTATE);
181  /* Read pushbutton status */
182  if (aemState == BC_AEMSTATE_EFM)
183  {
184  joyStick = (~(BSP_RegisterRead(BC_JOYSTICK))) & 0x001f;
185  }
186  return joyStick;
187 }
188 
189 int BSP_PeripheralAccess(BSP_Peripheral_TypeDef perf, bool enable)
190 {
191  uint16_t bit;
192  uint16_t tmp;
193 
194  /* Calculate which bit to set */
195  bit = (uint16_t)perf;
196 
197  /* Read peripheral control register */
199 
200  /* Enable or disable the specificed peripheral by setting board control switch */
201  if (enable)
202  {
203  /* Enable peripheral */
204  tmp |= bit;
205 
206  /* Special case for RS232, if enabled disable shutdown */
207  if ((perf == BSP_RS232A) || (perf == BSP_RS232B))
208  {
209  /* clear shutdown bit */
210  tmp &= ~(BC_PERCTRL_RS232_SHUTDOWN);
211  }
212 
213  /* Special case for IRDA if enabled disable shutdown */
214  if (perf == BSP_IRDA)
215  {
216  /* clear shutdown bit */
217  tmp &= ~(BC_PERCTRL_IRDA_SHUTDOWN);
218  }
219  }
220  else
221  {
222  /* Disable peripheral */
223  tmp &= ~(bit);
224 
225  /* Special case for RS232, if enabled disable shutdown */
226  if ((perf == BSP_RS232A) || (perf == BSP_RS232B))
227  {
228  /* Set shutdown bit */
229  tmp |= (BC_PERCTRL_RS232_SHUTDOWN);
230  }
231 
232  /* Special case for IRDA */
233  if (perf == BSP_IRDA)
234  {
235  /* Set shutdown bit */
236  tmp |= (BC_PERCTRL_IRDA_SHUTDOWN);
237  }
238  }
239 
241 
242  return BSP_STATUS_OK;
243 }
244 
245 uint16_t BSP_PushButtonsGet(void)
246 {
247  uint16_t pb = 0;
248  uint16_t aemState;
249 
250  /* Check state */
251  aemState = BSP_RegisterRead(BC_AEMSTATE);
252  /* Read pushbutton status */
253  if (aemState == BC_AEMSTATE_EFM)
254  {
255  pb = (~(BSP_RegisterRead(BC_PUSHBUTTON))) & 0x000f;
256  }
257  return pb;
258 }
259 
260 uint16_t BSP_RegisterRead(volatile uint16_t *addr)
261 {
262 #if defined( BSP_BC_CTRL_EBI )
263  return *addr;
264 #else
265  return SpiRegisterRead(addr);
266 #endif
267 }
268 
269 int BSP_RegisterWrite(volatile uint16_t *addr, uint16_t data)
270 {
271 #if defined( BSP_BC_CTRL_EBI )
272  *addr = data;
273 #else
274  SpiRegisterWrite(addr, data);
275 #endif
276 
277  return BSP_STATUS_OK;
278 }
279 
280 #if defined( BSP_BC_CTRL_EBI )
281 static void EbiConfigure(void)
282 {
283  EBI_Init_TypeDef ebiConfig = EBI_INIT_DEFAULT;
284 
285  /* Run time check if we have EBI on-chip capability on this device */
286  switch ( SYSTEM_GetPartNumber() )
287  {
288  /* Only device types EFM32G 280/290/880 and 890 have EBI capability */
289  case 280:
290  case 290:
291  case 880:
292  case 890:
293  break;
294  default:
295  /* This device do not have EBI capability - use SPI to interface DK */
296  /* With high probability your project has been configured for an */
297  /* incorrect part number. */
298  while (1) ;
299  }
300 
301  /* Enable clocks */
302  CMU_ClockEnable(cmuClock_EBI, true);
304 
305  /* Configure mode - disable SPI, enable EBI */
306  GPIO_PinModeSet(gpioPortC, 13, gpioModePushPull, 1);
307  GPIO_PinModeSet(gpioPortC, 12, gpioModePushPull, 0);
308 
309  /* Configure GPIO pins as push pull */
310  /* EBI AD9..15 */
311  GPIO_PinModeSet(gpioPortA, 0, gpioModePushPull, 0);
312  GPIO_PinModeSet(gpioPortA, 1, gpioModePushPull, 0);
313  GPIO_PinModeSet(gpioPortA, 2, gpioModePushPull, 0);
314  GPIO_PinModeSet(gpioPortA, 3, gpioModePushPull, 0);
315  GPIO_PinModeSet(gpioPortA, 4, gpioModePushPull, 0);
316  GPIO_PinModeSet(gpioPortA, 5, gpioModePushPull, 0);
317  GPIO_PinModeSet(gpioPortA, 6, gpioModePushPull, 0);
318 
319  /* EBI AD8 */
320  GPIO_PinModeSet(gpioPortA, 15, gpioModePushPull, 0);
321 
322  /* EBI CS0-CS3 */
323  GPIO_PinModeSet(gpioPortD, 9, gpioModePushPull, 0);
324  GPIO_PinModeSet(gpioPortD, 10, gpioModePushPull, 0);
325  GPIO_PinModeSet(gpioPortD, 11, gpioModePushPull, 0);
326  GPIO_PinModeSet(gpioPortD, 12, gpioModePushPull, 0);
327 
328  /* EBI AD0..7 */
329  GPIO_PinModeSet(gpioPortE, 8, gpioModePushPull, 0);
330  GPIO_PinModeSet(gpioPortE, 9, gpioModePushPull, 0);
331  GPIO_PinModeSet(gpioPortE, 10, gpioModePushPull, 0);
332  GPIO_PinModeSet(gpioPortE, 11, gpioModePushPull, 0);
333  GPIO_PinModeSet(gpioPortE, 12, gpioModePushPull, 0);
334  GPIO_PinModeSet(gpioPortE, 13, gpioModePushPull, 0);
335  GPIO_PinModeSet(gpioPortE, 14, gpioModePushPull, 0);
336  GPIO_PinModeSet(gpioPortE, 15, gpioModePushPull, 0);
337 
338  /* EBI ARDY/ALEN/Wen/Ren */
339  GPIO_PinModeSet(gpioPortF, 2, gpioModePushPull, 0);
340  GPIO_PinModeSet(gpioPortF, 3, gpioModePushPull, 0);
341  GPIO_PinModeSet(gpioPortF, 4, gpioModePushPull, 0);
342  GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, 0);
343 
344  /* Configure EBI controller, changing default values */
345  ebiConfig.mode = ebiModeD16A16ALE;
346  /* Enable bank 0 address map 0x80000000, FPGA Flash */
347  /* Enable bank 1 address map 0x84000000, FPGA SRAM */
348  /* Enable bank 2 address map 0x88000000, FPGA TFT Display (SSD2119) */
349  /* Enable bank 3 address map 0x8c000000, FPGA Board Control Registers */
350  ebiConfig.banks = EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3;
351  ebiConfig.csLines = EBI_CS0 | EBI_CS1 | EBI_CS2 | EBI_CS3;
352 
353  /* Address Setup and hold time */
354  ebiConfig.addrHoldCycles = 3;
355  ebiConfig.addrSetupCycles = 3;
356 
357  /* Read cycle times */
358  ebiConfig.readStrobeCycles = 7;
359  ebiConfig.readHoldCycles = 3;
360  ebiConfig.readSetupCycles = 3;
361 
362  /* Write cycle times */
363  ebiConfig.writeStrobeCycles = 7;
364  ebiConfig.writeHoldCycles = 3;
365  ebiConfig.writeSetupCycles = 3;
366 
367  /* Polarity values are default */
368 
369  /* Configure EBI */
370  EBI_Init(&ebiConfig);
371 }
372 
373 static void EbiDisable(void)
374 {
375  /* Disable EBI and SPI _BC_BUS_CONNECT */
376  GPIO_PinModeSet(gpioPortC, 12, gpioModeDisabled, 0);
377  GPIO_PinModeSet(gpioPortC, 13, gpioModeDisabled, 0);
378 
379  /* Configure GPIO pins as disabled */
380  GPIO_PinModeSet(gpioPortA, 0, gpioModeDisabled, 0);
381  GPIO_PinModeSet(gpioPortA, 1, gpioModeDisabled, 0);
382  GPIO_PinModeSet(gpioPortA, 2, gpioModeDisabled, 0);
383  GPIO_PinModeSet(gpioPortA, 3, gpioModeDisabled, 0);
384  GPIO_PinModeSet(gpioPortA, 4, gpioModeDisabled, 0);
385  GPIO_PinModeSet(gpioPortA, 5, gpioModeDisabled, 0);
386  GPIO_PinModeSet(gpioPortA, 6, gpioModeDisabled, 0);
387 
388  GPIO_PinModeSet(gpioPortA, 15, gpioModeDisabled, 0);
389 
390  GPIO_PinModeSet(gpioPortD, 9, gpioModeDisabled, 0);
391  GPIO_PinModeSet(gpioPortD, 10, gpioModeDisabled, 0);
392  GPIO_PinModeSet(gpioPortD, 11, gpioModeDisabled, 0);
393  GPIO_PinModeSet(gpioPortD, 12, gpioModeDisabled, 0);
394 
395  GPIO_PinModeSet(gpioPortE, 8, gpioModeDisabled, 0);
396  GPIO_PinModeSet(gpioPortE, 9, gpioModeDisabled, 0);
397  GPIO_PinModeSet(gpioPortE, 10, gpioModeDisabled, 0);
398  GPIO_PinModeSet(gpioPortE, 11, gpioModeDisabled, 0);
399  GPIO_PinModeSet(gpioPortE, 12, gpioModeDisabled, 0);
400  GPIO_PinModeSet(gpioPortE, 13, gpioModeDisabled, 0);
401  GPIO_PinModeSet(gpioPortE, 14, gpioModeDisabled, 0);
402  GPIO_PinModeSet(gpioPortE, 15, gpioModeDisabled, 0);
403 
404  GPIO_PinModeSet(gpioPortF, 2, gpioModeDisabled, 0);
405  GPIO_PinModeSet(gpioPortF, 3, gpioModeDisabled, 0);
406  GPIO_PinModeSet(gpioPortF, 4, gpioModeDisabled, 0);
407  GPIO_PinModeSet(gpioPortF, 5, gpioModeDisabled, 0);
408 
409  /* Disable EBI clock in CMU */
410  CMU_ClockEnable(cmuClock_EBI, false);
411 }
412 
413 /**************************************************************************/
421 static bool EbiInit(void)
422 {
423  uint16_t ebiMagic;
424  int retry = 10;
425 
426  /* Disable all GPIO pins and register */
427  EbiDisable();
428  /* Configure EBI */
429  EbiConfigure();
430  /* Verify that EBI access is working, if not kit is in SPI mode and needs to
431  * be configured for EBI access */
432  ebiMagic = BSP_RegisterRead(BC_MAGIC);
433  while ((ebiMagic != BC_MAGIC_VALUE) && retry)
434  {
435  EbiDisable();
436  /* Enable SPI interface */
437  SpiInit();
438  /* Set EBI mode - after this SPI access will no longer be available */
439  ebiMagic = SpiRegisterRead(BC_MAGIC);
440  SpiRegisterWrite(BC_CFG, BC_CFG_EBI);
441  /* Disable SPI */
442  SpiBcDisable();
443 
444  /* Now setup EBI again */
445  EbiConfigure();
446  /* Wait until ready */
447  ebiMagic = BSP_RegisterRead(BC_MAGIC);
448  if (ebiMagic == BC_MAGIC_VALUE) break;
449 
450  retry--;
451  }
452  if (!retry) return false;
453 
454  BSP_RegisterWrite(BC_LED, retry);
455  return true;
456 }
457 #endif
458 
459 static uint16_t SpiBcAccess(uint8_t addr, uint8_t rw, uint16_t data)
460 {
461  uint16_t tmp;
462 
463  /* Enable CS */
464  GPIO_PinOutClear(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS);
465 
466  /* Write SPI address MSB */
467  USART_Tx(BSP_SPI_USART_USED, (addr & 0x3) | rw << 3);
468  /* Just ignore data read back */
469  USART_Rx(BSP_SPI_USART_USED);
470 
471  /* Write SPI address LSB */
472  USART_Tx(BSP_SPI_USART_USED, data & 0xFF);
473 
474  tmp = (uint16_t) USART_Rx(BSP_SPI_USART_USED);
475 
476  /* SPI data MSB */
477  USART_Tx(BSP_SPI_USART_USED, data >> 8);
478  tmp |= (uint16_t) USART_Rx(BSP_SPI_USART_USED) << 8;
479 
480  /* Disable CS */
481  GPIO_PinOutSet(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS);
482 
483  return tmp;
484 }
485 
486 static void SpiBcDisable(void)
487 {
488  USART_Reset(BSP_SPI_USART_USED);
489 
490  /* Disable LCD_SELECT */
491  GPIO_PinModeSet(gpioPortD, 13, gpioModeDisabled, 0);
492 
493  /* Disable SPI pins */
494  GPIO_PinModeSet(BSP_PORT_SPIBUS_CONNECT, 13, gpioModeDisabled, 0);
495  GPIO_PinModeSet(BSP_PORT_SPIBUS_CONNECT, 12, gpioModeDisabled, 0);
496  GPIO_PinModeSet(BSP_PORT_SPI_TX, BSP_PIN_SPI_TX, gpioModeDisabled, 0);
497  GPIO_PinModeSet(BSP_PORT_SPI_RX, BSP_PIN_SPI_RX, gpioModeDisabled, 0);
498  GPIO_PinModeSet(BSP_PORT_SPI_CLK, BSP_PIN_SPI_CLK, gpioModeDisabled, 0);
499  GPIO_PinModeSet(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS, gpioModeDisabled, 0);
500 
501  /* Disable USART clock - we can't disable GPIO or HFPER as we don't know who else
502  * might be using it */
503  CMU_ClockEnable(BSP_SPI_USART_CLK, false);
504 }
505 
506 static void SpiBcInit(void)
507 {
509 
510  /* Enable module clocks */
511  CMU_ClockEnable(BSP_SPI_USART_CLK, true);
512 
513  /* Configure SPI bus connect pins, DOUT set to 0, disable EBI */
514  GPIO_PinModeSet(BSP_PORT_SPIBUS_CONNECT, BSP_PIN_SPIBUS_CONNECT, gpioModePushPull, 0);
515  GPIO_PinModeSet(BSP_PORT_EBIBUS_CONNECT, BSP_PIN_EBIBUS_CONNECT, gpioModePushPull, 1);
516 
517  /* Configure SPI pins */
518  GPIO_PinModeSet(BSP_PORT_SPI_TX, BSP_PIN_SPI_TX, gpioModePushPull, 0);
519  GPIO_PinModeSet(BSP_PORT_SPI_RX, BSP_PIN_SPI_RX, gpioModeInput, 0);
520  GPIO_PinModeSet(BSP_PORT_SPI_CLK, BSP_PIN_SPI_CLK, gpioModePushPull, 0);
521 
522  /* Keep CS high to not activate slave */
523  GPIO_PinModeSet(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS, gpioModePushPull, 1);
524 
525  /* Configure to use SPI master with manual CS */
526  /* For now, configure SPI for worst case 32MHz clock in order to work for all */
527  /* configurations. */
528 
529  bcinit.refFreq = 32000000;
530  bcinit.baudrate = 7000000;
531 
532  /* Initialize USART */
533  USART_InitSync(BSP_SPI_USART_USED, &bcinit);
534 
535  /* Enable pins at default location */
536  BSP_SPI_USART_USED->ROUTE = USART_ROUTE_TXPEN | USART_ROUTE_RXPEN | USART_ROUTE_CLKPEN;
537 }
538 
539 static bool SpiInit(void)
540 {
541  uint16_t bcMagic;
542 
543  /* Enable HF and GPIO clocks */
546 
547  SpiBcInit();
548  /* Read "board control Magic" register to verify SPI is up and running */
549  /* if not FPGA is configured to be in EBI mode */
550  bcMagic = SpiRegisterRead(BC_MAGIC);
551  if (bcMagic != BC_MAGIC_VALUE)
552  {
553  return false;
554  }
555  else
556  {
557  return true;
558  }
559 }
560 
561 static uint16_t SpiRegisterRead(volatile uint16_t *addr)
562 {
563  uint16_t data;
564 
565  if (addr != lastAddr)
566  {
567  SpiBcAccess(0x00, 0, 0xFFFF & ((uint32_t) addr)); /* LSBs of address */
568  SpiBcAccess(0x01, 0, 0xFF & ((uint32_t) addr >> 16)); /* MSBs of address */
569  SpiBcAccess(0x02, 0, (0x0C000000 & (uint32_t) addr) >> 26); /* Chip select */
570  }
571  /* Read twice; when register address has changed we need two SPI transfer
572  * to clock out valid data through board controller FIFOs */
573  data = SpiBcAccess(0x03, 1, 0);
574  data = SpiBcAccess(0x03, 1, 0);
575  lastAddr = addr;
576  return data;
577 }
578 
579 static void SpiRegisterWrite(volatile uint16_t *addr, uint16_t data)
580 {
581  if (addr != lastAddr)
582  {
583  SpiBcAccess(0x00, 0, 0xFFFF & ((uint32_t) addr)); /* LSBs of address */
584  SpiBcAccess(0x01, 0, 0xFF & ((uint32_t) addr >> 16)); /* MSBs of address */
585  SpiBcAccess(0x02, 0, (0x0C000000 & (uint32_t) addr) >> 26); /* Chip select */
586  }
587  SpiBcAccess(0x03, 0, data); /* Data */
588  lastAddr = addr;
589 }
590 
592 #endif /* BSP_DK_BRD3200 */
Clock management unit (CMU) API.
void USART_Tx(USART_TypeDef *usart, uint8_t data)
Transmit one 4-9 bit frame.
Definition: em_usart.c:1084
#define BC_PERCTRL
uint16_t BSP_PushButtonsGet(void)
Get status of the pushbutton switches on the DK.
Definition: bsp_dk_3201.c:677
#define BC_INTEN
Board support package API definitions.
#define BC_MAGIC
#define USART_ROUTE_TXPEN
void USART_InitSync(USART_TypeDef *usart, const USART_InitSync_TypeDef *init)
Init USART for synchronous mode.
Definition: em_usart.c:640
int BSP_EnergyModeSet(uint16_t energyMode)
Inform board controller about current energy mode.
Definition: bsp_dk_3201.c:344
int BSP_BusControlModeSet(BSP_BusControl_TypeDef mode)
Configure Board Controller bus decode logic.
Definition: bsp_dk_3201.c:187
uint8_t USART_Rx(USART_TypeDef *usart)
Receive one 4-8 bit frame, (or part of 10-16 bit frame).
Definition: em_usart.c:923
#define BC_MAGIC_VALUE
#define BC_PUSHBUTTON
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
Universal synchronous/asynchronous receiver/transmitter (USART/UART) peripheral API.
int BSP_InterruptEnable(uint16_t flags)
Enable interrupts from board controller.
Definition: bsp_dk_3201.c:376
#define BC_AEMSTATE
#define BSP_STATUS_OK
Definition: bsp.h:45
uint16_t BSP_RegisterRead(volatile uint16_t *addr)
Read from a board controller register.
Definition: bsp_dk_3201.c:687
int BSP_InterruptDisable(uint16_t flags)
Disable interrupts from board controller.
Definition: bsp_dk_3201.c:357
#define BC_CFG
External Bus Iterface (EBI) peripheral API.
int BSP_InterruptFlagsClear(uint16_t flags)
Clear board controller interrupt flags.
Definition: bsp_dk_3201.c:394
void GPIO_PinModeSet(GPIO_Port_TypeDef port, unsigned int pin, GPIO_Mode_TypeDef mode, unsigned int out)
Set the mode for a GPIO pin.
Definition: em_gpio.c:269
#define BSP_STATUS_NOT_IMPLEMENTED
Definition: bsp.h:47
BSP_BusControl_TypeDef
Definition: bsp.h:77
int BSP_EbiExtendedAddressRange(bool enable)
Extended the EBI addressing range by enabling address lines A16-A22. On Gxxx_DK's this functions is a...
Definition: bsp_dk_3201.c:323
General Purpose IO (GPIO) peripheral API.
#define BC_LED
__STATIC_INLINE void GPIO_PinOutSet(GPIO_Port_TypeDef port, unsigned int pin)
Set a single pin in GPIO data out register to 1.
Definition: em_gpio.h:856
void CMU_ClockEnable(CMU_Clock_TypeDef clock, bool enable)
Enable/disable a clock.
Definition: em_cmu.c:1453
uint32_t BSP_DipSwitchGet(void)
Get status of the DIP switches on the DK.
Definition: bsp_dk_3201.c:238
#define BC_EM
uint16_t BSP_InterruptFlagsGet(void)
Get board controller interrupt flags.
Definition: bsp_dk_3201.c:430
void USART_Reset(USART_TypeDef *usart)
Reset USART/UART to same state as after a HW reset.
Definition: em_usart.c:856
BSP_Peripheral_TypeDef
Definition: bsp.h:117
int BSP_Init(uint32_t flags)
Initialize board support package functionality.
Definition: bsp_dk_3201.c:127
BSP_Display_TypeDef
Definition: bsp.h:63
#define BC_PERCTRL_IRDA_SHUTDOWN
int BSP_PeripheralAccess(BSP_Peripheral_TypeDef perf, bool enable)
DK Peripheral Access Control Enable or disable access to on-board peripherals through switches and SP...
Definition: bsp_dk_3201.c:461
__STATIC_INLINE uint16_t SYSTEM_GetPartNumber(void)
Get part number of the MCU.
Definition: em_system.h:431
Board Control register definitions.
#define BC_DIPSWITCH
#define BC_AEMSTATE_EFM
System API.
#define BC_CFG_EBI
int BSP_RegisterWrite(volatile uint16_t *addr, uint16_t data)
Write to a board controller register.
Definition: bsp_dk_3201.c:704
#define BC_INTFLAG
#define BC_PERCTRL_RS232_SHUTDOWN
int BSP_Disable(void)
Deinitialize board support package functionality. Reverse actions performed by BSP_Init(). This function is a dummy on STK's.
Definition: bsp_dk_3201.c:97
__STATIC_INLINE void GPIO_PinOutClear(GPIO_Port_TypeDef port, unsigned int pin)
Set a single pin in GPIO data out port register to 0.
Definition: em_gpio.h:811
BSP_BusControl_TypeDef BSP_BusControlModeGet(void)
Get current board controller bus decode logic configuration.
Definition: bsp_dk_3201.c:173
int BSP_DisplayControl(BSP_Display_TypeDef option)
Configure display control.
Definition: bsp_dk_3201.c:251
#define BC_BUS_CFG
#define USART_INITSYNC_DEFAULT
Definition: em_usart.h:484
#define BC_JOYSTICK
#define USART_ROUTE_CLKPEN
#define USART_ROUTE_RXPEN
uint16_t BSP_JoystickGet(void)
Get status of joystick on the DK.
Definition: bsp_dk_3201.c:440