init.c
Go to the documentation of this file.
1 
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 
37 #include "compiler.h"
38 #include "board.h"
39 #include "conf_board.h"
40 #include "ioport.h"
41 #include "pio.h"
42 #include "../../../../../../../src/data_sets.h"
43 #include "../../../../../../../hw-libs/drivers/d_usartDMA.h"
44 #include "../../../../drivers/d_time.h"
45 #include "../../../../spiTouINS.h"
46 #include "../../../../xbee.h"
47 #include "../../../../wifi.h"
48 #include "../../../../globals.h"
49 #include "../../../../CAN.h"
50 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT
51 #include "mpu.h"
52 #endif
53 
54 
63 #undef ioport_set_pin_input_mode
64 #define ioport_set_pin_input_mode(pin, mode, sense) \
65  do {\
66  ioport_enable_pin((pin));\
67  ioport_set_pin_dir((pin), IOPORT_DIR_INPUT);\
68  ioport_set_pin_mode((pin), (mode));\
69  ioport_set_pin_sense_mode((pin), (sense));\
70  } while (0)
71 
72 
73 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT
74 
87 uint8_t g_hdw_detect;
88 static VoidFuncPtrVoid s_pfnHandleBoardIoCfg = NULLPTR;
89 
90 
94 static void _setup_memory_region( void )
95 {
96 
97  uint32_t dw_region_base_addr;
98  uint32_t dw_region_attr;
99 
100  __DMB();
101 
107  dw_region_base_addr =
111 
112  dw_region_attr =
115 
116  mpu_set_region( dw_region_base_addr, dw_region_attr);
117 
125  dw_region_base_addr =
129 
130  dw_region_attr =
131 // MPU_AP_READONLY |
135 
136  mpu_set_region( dw_region_base_addr, dw_region_attr);
137 
144  /* DTCM memory region */
145  dw_region_base_addr =
149 
150  dw_region_attr =
153 
154  mpu_set_region( dw_region_base_addr, dw_region_attr);
155 
161  /* SRAM memory region */
162  dw_region_base_addr =
166 
167  dw_region_attr =
171 
172  mpu_set_region( dw_region_base_addr, dw_region_attr);
173 
174 
180  /* SRAM memory region */
181  dw_region_base_addr =
185 
186  dw_region_attr =
190 
191  mpu_set_region( dw_region_base_addr, dw_region_attr);
192 
193 #ifdef MPU_HAS_NOCACHE_REGION
194  dw_region_base_addr =
195  SRAM_NOCACHE_START_ADDRESS |
197  MPU_NOCACHE_SRAM_REGION;
198 
199  dw_region_attr =
201  INNER_OUTER_NORMAL_NOCACHE_TYPE( SHAREABLE ) |
202  mpu_cal_mpu_region_size(NOCACHE_SRAM_REGION_SIZE) | MPU_REGION_ENABLE;
203 
204  mpu_set_region( dw_region_base_addr, dw_region_attr);
205 #endif
206 
212  dw_region_base_addr =
216 
217  dw_region_attr = MPU_AP_FULL_ACCESS |
221 
222  mpu_set_region( dw_region_base_addr, dw_region_attr);
223 
224 
230  dw_region_base_addr =
234 
235  dw_region_attr =
237  /* External memory Must be defined with 'Device' or 'Strongly Ordered' attribute for write accesses (AXI) */
240 
241  mpu_set_region( dw_region_base_addr, dw_region_attr);
242 
248  dw_region_base_addr =
252 
253  dw_region_attr =
257 
258  mpu_set_region( dw_region_base_addr, dw_region_attr);
259 
265  dw_region_base_addr =
269 
270  dw_region_attr =
275 
276  mpu_set_region( dw_region_base_addr, dw_region_attr);
277 
278 
284  dw_region_base_addr =
288 
289  dw_region_attr =
295 
296  mpu_set_region( dw_region_base_addr, dw_region_attr);
297 
298 
299  /* Enable the memory management fault , Bus Fault, Usage Fault exception */
301 
302  /* Enable the MPU region */
304 
305  __DSB();
306  __ISB();
307 }
308 #endif
309 
310 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT
311 #if defined(__GNUC__)
312 extern char _itcm_lma, _sitcm, _eitcm;
313 #endif
314 
318 static inline void tcm_enable(void)
319 {
320 
321  __DSB();
322  __ISB();
323 
326 
327  __DSB();
328  __ISB();
329 }
330 #else
331 
335 static inline void tcm_disable(void)
336 {
337 
338  __DSB();
339  __ISB();
340  SCB->ITCMCR &= ~(uint32_t)(1UL);
341  SCB->DTCMCR &= ~(uint32_t)SCB_DTCMCR_EN_Msk;
342  __DSB();
343  __ISB();
344 }
345 #endif
346 
347 __attribute__((optimize("O0")))
348 static void waitPinPullup(void)
349 {
350  // wait a tiny bit for pins to pull
351  for (volatile int i = 0; i < 200000; i++) {}
352 }
353 
354 
355 void refresh_led_cfg(void)
356 {
357  switch(g_flashCfg->cbPreset)
358  {
359  default:
360  case EVB2_CB_PRESET_ALL_OFF: LED_CFG_OFF(); break;
361  case EVB2_CB_PRESET_RS232: LED_CFG_GREEN(); break;
364  case EVB2_CB_PRESET_SPI_RS232: LED_CFG_CYAN(); break;
367  }
368 }
369 
370 
372 {
373  s_pfnHandleBoardIoCfg = fpIoCfg;
374 }
375 
376 void board_IO_config(void)
377 {
379  // EVB uINS G1,G2 (CAN, Ser2, I2C)
380  // EVB-PA3 - SDA
381  // EVB-PA4 - SCL
382 #ifdef CONF_BOARD_I2C_UINS
385  {
386  i2cInit();
387  }
388  else
389  { // Disable pins
392  }
393 #endif
394 
396  // uINS G3,G4 (Ser0)
397  // EVB-PA5,PA6
401  { // I/O tristate
404  }
405  else
406  {
407 #ifdef CONF_BOARD_SERIAL_UINS_SER0
410  serInit(EVB2_PORT_UINS0, 921600, NULL, NULL);
411 #endif
412  }
413 
415  // uINS G6,G7 (Ser1, SPI, QDEC0)
416  // EVB-PA9,PA10
418  {
419  #ifdef CONF_BOARD_SPI_UINS
423 
424  //CS will be handled by GPIO
427 
428  //Indicate to uINS that SPI is requested
431 
432  //Setup data ready pin
434  ioport_set_pin_mode(INS_DATA_RDY_PIN_IDX, IOPORT_MODE_PULLDOWN);
435 
436  spiTouINS_init();
437  #endif
438  }
441  { // I/O tristate - (Enable pin and set as input)
444 
450  }
451  else
452  {
453 #ifdef CONF_BOARD_SERIAL_UINS_SER1
456  serInit(EVB2_PORT_UINS1, 921600, NULL, NULL);
460 #endif
461  }
462 
464  // SP330 - RS232/RS485 interface
465 #ifdef CONF_BOARD_SERIAL_SP330
467  { // RS422 mode
470  }
471  else
472  { // RS232 mode
475  }
477 #endif
478 
480  // XBee
481 #ifdef CONF_BOARD_SERIAL_XBEE
483  { // XBee enabled
487  serInit(EVB2_PORT_XBEE, 115200, NULL, NULL);
488 #if 0
490  ioport_set_pin_peripheral_mode(UART_XBEE_DTR_PIN, UART_XBEE_DTR_FLAGS);
491 #else
494 #endif
495 // ioport_set_pin_output_mode(XBEE_VUSB_DISABLE_PIN, IOPORT_PIN_LEVEL_LOW); // Enable VBUS
496  ioport_set_pin_output_mode(XBEE_RST_PIN, IOPORT_PIN_LEVEL_HIGH); // Reset off (low asserted)
499  }
500  else
501  { // XBee disabled
508 
511 
514  }
516 
517  switch(g_flashCfg->cbPreset)
518  {
521  xbee_init();
522 
523  }
524 #endif
525 
527  // WiFi
528 #ifdef CONF_BOARD_SPI_ATWINC_WIFI
530  { // WiFi enabled
531  wifi_enable(true); // power on wifi. Connect to hot spot and TCP socket
532  }
533  else
534  { // WiFi disabled
535  wifi_enable(false); // power off wifi
536  }
537 #else
540 #endif
541 
542  // Reset default baud rates
544  { // I/O not tristate
547  {
549  }
550  }
551  serSetBaudRate(EVB2_PORT_BLE, 115200);
554 
556  // CAN
557 #ifdef CONF_BOARD_CAN1
559  {
561  CAN_init();
562  }
563 #endif
564 
565  if (s_pfnHandleBoardIoCfg)
566  {
567  s_pfnHandleBoardIoCfg();
568  }
569 }
570 
571 
572 
573 void board_init(void)
574 {
575  // Hardware Detection - PCB version
582  waitPinPullup();
583 
584  g_hdw_detect = ~(0xF8 |
588 
589  // Disable hardware detect pullup/pulldown (tri-state pins)
593 
595  // Init system clocks
596  // If running on PLL, disable it so second PLL initialization does not hang device
597  if((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_PLLA_CLK)
598  {
601  }
602 
603  pmc_switch_sclk_to_32kxtal(PMC_OSC_XTAL); // set SLCK to use external 32kHz crystal rather than internal 32kHz RC oscillator.
604  sysclk_init();
605 
606 
607 #ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT
608  /* Disable the watchdog */
609  WDT->WDT_MR = WDT_MR_WDDIS;
610 #endif
611 
612 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT
613  _setup_memory_region();
614 #endif
615 
616  SCB_EnableICache();
617 
618 #if CONF_BOARD_ENABLE_DCACHE == 1
620 #endif
621 
622 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT
623  /* TCM Configuration */
625  | EEFC_FCR_FARG(8));
627  | EEFC_FCR_FARG(7));
628  tcm_enable();
629 #if defined(__GNUC__)
630  volatile char *dst = &_sitcm;
631  volatile char *src = &_itcm_lma;
632  /* copy code_TCM from flash to ITCM */
633  while(dst < &_eitcm){
634  *dst++ = *src++;
635  }
636 #endif
637 #else
638  /* TCM Configuration */
640  | EEFC_FCR_FARG(8));
642  | EEFC_FCR_FARG(7));
643 
644  tcm_disable();
645 #endif
646 
647  // Real-time timer
648  time_init();
649 
650  /* Initialize IOPORTs */
651  ioport_init();
652 
654  // LEDs - default to ALL on
661 
668 
669 #if 0
670  // Turn off LEDs
671  LED_CFG_OFF();
672  LED_LOG_OFF();
673 
680 #endif
681 
683  // Push Buttons
686 
688  // Serial Ports
689 
690  // UINS ser0 and ser1 - In board_IO_init() in main.cpp
691 
692 #ifdef CONF_BOARD_SERIAL_EXT_RADIO // External Radio
696 // ioport_set_pin_dir(EXT_RADIO_RST, IOPORT_DIR_OUTPUT);
697 // ioport_set_pin_level(EXT_RADIO_RST, IOPORT_PIN_LEVEL_HIGH); // Low assert
698 #endif
699 
700 #ifdef CONF_BOARD_SERIAL_ATWINC_BLE // ATWINC3400 Bluetooth
705  serInit(EVB2_PORT_BLE, 115200, NULL, NULL);
706 #endif
707 
708 #ifdef CONF_BOARD_SERIAL_SP330 // RS232/RS422/RS485 converter
712  ioport_set_pin_output_mode(SP330_NSLEW_PIN, IOPORT_PIN_LEVEL_HIGH); // Don't limit data rate to less than 250 Kbps
713  ioport_set_pin_output_mode(SP330_NFULL_DPLX_PIN, IOPORT_PIN_LEVEL_LOW); // RS485 full duplex (RS232 N/A)
715 #endif
716 
718 #ifdef CONF_BOARD_SERIAL_GPIO_H8 // GPIO TTL
720  MATRIX->CCFG_SYSIO |= CCFG_SYSIO_SYSIO4;
723 #endif
724 
726  // SPI Interface
727 #ifdef CONF_BOARD_SPI_ATWINC_WIFI // ATWINC WIFI
735 #else
737 #endif
738 
740  // I2C Interface
741 #ifdef CONF_BOARD_I2C_UINS // UINS I2C
744 #endif
745 
746 #ifdef CONF_BOARD_CAN1
747  /* Configure the CAN1 TX and RX pin. */
750 #endif
751 
753  // SD Card Interface
754 #ifdef CONF_BOARD_SD_MMC_HSMCI
755  /* Configure HSMCI pins */
762 
763  /* Configure SD/MMC card detect pin */
765 #endif
766 
767 
768 
772 
773 #ifdef CONF_BOARD_TWIHS0
774  ioport_set_pin_peripheral_mode(TWIHS0_DATA_GPIO, TWIHS0_DATA_FLAGS);
775  ioport_set_pin_peripheral_mode(TWIHS0_CLK_GPIO, TWIHS0_CLK_FLAGS);
776 #endif
777 
778 #ifdef CONF_BOARD_CAN0
779  /* Configure the CAN0 TX and RX pins. */
780  ioport_set_pin_peripheral_mode(PIN_CAN0_RX_IDX, PIN_CAN0_RX_FLAGS);
781  ioport_set_pin_peripheral_mode(PIN_CAN0_TX_IDX, PIN_CAN0_TX_FLAGS);
782  /* Configure the transiver0 RS & EN pins. */
783  ioport_set_pin_dir(PIN_CAN0_TR_RS_IDX, IOPORT_DIR_OUTPUT);
784  ioport_set_pin_dir(PIN_CAN0_TR_EN_IDX, IOPORT_DIR_OUTPUT);
785 #endif
786 
787 #ifdef CONF_BOARD_SPI
788  ioport_set_pin_peripheral_mode(SPI0_MISO_GPIO, SPI0_MISO_FLAGS);
789  ioport_set_pin_peripheral_mode(SPI0_MOSI_GPIO, SPI0_MOSI_FLAGS);
790  ioport_set_pin_peripheral_mode(SPI0_SPCK_GPIO, SPI0_SPCK_FLAGS);
791 
792 #ifdef CONF_BOARD_SPI_NPCS0
793  ioport_set_pin_peripheral_mode(SPI0_NPCS0_GPIO, SPI0_NPCS0_FLAGS);
794 #endif
795 
796 #ifdef CONF_BOARD_SPI_NPCS1
797  ioport_set_pin_peripheral_mode(SPI0_NPCS1_GPIO, SPI0_NPCS1_FLAGS);
798 #endif
799 #endif
800 
801 #ifdef CONF_BOARD_QSPI
802  ioport_set_pin_peripheral_mode(QSPI_QSCK_GPIO, QSPI_QSCK_FLAGS);
803  ioport_set_pin_peripheral_mode(QSPI_QCS_GPIO, QSPI_QCS_FLAGS);
804  ioport_set_pin_peripheral_mode(QSPI_QIO0_GPIO, QSPI_QIO0_FLAGS);
805  ioport_set_pin_peripheral_mode(QSPI_QIO1_GPIO, QSPI_QIO1_FLAGS);
806  ioport_set_pin_peripheral_mode(QSPI_QIO2_GPIO, QSPI_QIO2_FLAGS);
807  ioport_set_pin_peripheral_mode(QSPI_QIO3_GPIO, QSPI_QIO3_FLAGS);
808 #endif
809 
810 #ifdef CONF_BOARD_PWM_LED0
811  /* Configure PWM LED0 pin */
812  ioport_set_pin_peripheral_mode(PIN_PWM_LED0_GPIO, PIN_PWM_LED0_FLAGS);
813 #endif
814 
815 #ifdef CONF_BOARD_PWM_LED1
816  /* Configure PWM LED1 pin */
817  ioport_set_pin_peripheral_mode(PIN_PWM_LED1_GPIO, PIN_PWM_LED1_FLAGS);
818 #endif
819 
820 #ifdef CONF_BOARD_USART_SCK
821  /* Configure USART synchronous communication SCK pin */
823 #endif
824 
825 #ifdef CONF_BOARD_USART_CTS
826  /* Configure USART synchronous communication CTS pin */
828 #endif
829 
830 #ifdef CONF_BOARD_USART_RTS
831  /* Configure USART RTS pin */
833 #endif
834 
835 #ifdef CONF_BOARD_ILI9488
836 
837  pio_configure(PIN_EBI_RESET_PIO, PIN_EBI_RESET_TYPE, PIN_EBI_RESET_MASK, PIN_EBI_RESET_ATTRI);
838  pio_configure(PIN_EBI_CDS_PIO, PIN_EBI_CDS_TYPE, PIN_EBI_CDS_MASK, PIN_EBI_CDS_ATTRI);
839  pio_configure(PIN_EBI_DATAL_PIO, PIN_EBI_DATAL_TYPE, PIN_EBI_DATAL_MASK, PIN_EBI_DATAL_ATTRI);
840  pio_configure(PIN_EBI_DATAH_0_PIO, PIN_EBI_DATAH_0_TYPE, PIN_EBI_DATAH_0_MASK, PIN_EBI_DATAH_0_ATTRI);
841  pio_configure(PIN_EBI_DATAH_1_PIO, PIN_EBI_DATAH_1_TYPE, PIN_EBI_DATAH_1_MASK, PIN_EBI_DATAH_1_ATTRI);
842  pio_configure(PIN_EBI_NWE_PIO, PIN_EBI_NWE_TYPE, PIN_EBI_NWE_MASK, PIN_EBI_NWE_ATTRI);
843  pio_configure(PIN_EBI_NRD_PIO, PIN_EBI_NRD_TYPE, PIN_EBI_NRD_MASK, PIN_EBI_NRD_ATTRI);
844  pio_configure(PIN_EBI_CS_PIO, PIN_EBI_CS_TYPE, PIN_EBI_CS_MASK, PIN_EBI_CS_ATTRI);
845  pio_configure(PIN_EBI_BACKLIGHT_PIO, PIN_EBI_BACKLIGHT_TYPE, PIN_EBI_BACKLIGHT_MASK, PIN_EBI_BACKLIGHT_ATTRI);
846  pio_set(PIN_EBI_BACKLIGHT_PIO, PIN_EBI_BACKLIGHT_MASK);
847 #endif
848 
849 #if (defined CONF_BOARD_USB_PORT)
850 # if defined(CONF_BOARD_USB_VBUS_DETECT)
851  ioport_set_pin_dir(USB_VBUS_PIN, IOPORT_DIR_INPUT);
852 # endif
853 # if defined(CONF_BOARD_USB_ID_DETECT)
855 # endif
856 #endif
857 
858 #ifdef CONF_BOARD_SDRAMC
859  pio_configure_pin(SDRAM_BA0_PIO, SDRAM_BA0_FLAGS);
860  pio_configure_pin(SDRAM_SDCK_PIO, SDRAM_SDCK_FLAGS);
861  pio_configure_pin(SDRAM_SDCKE_PIO, SDRAM_SDCKE_FLAGS);
862  pio_configure_pin(SDRAM_SDCS_PIO, SDRAM_SDCS_FLAGS);
863  pio_configure_pin(SDRAM_RAS_PIO, SDRAM_RAS_FLAGS);
864  pio_configure_pin(SDRAM_CAS_PIO, SDRAM_CAS_FLAGS);
865  pio_configure_pin(SDRAM_SDWE_PIO, SDRAM_SDWE_FLAGS);
866  pio_configure_pin(SDRAM_NBS0_PIO, SDRAM_NBS0_FLAGS);
867  pio_configure_pin(SDRAM_NBS1_PIO, SDRAM_NBS1_FLAGS);
868  pio_configure_pin(SDRAM_A2_PIO, SDRAM_A_FLAGS);
869  pio_configure_pin(SDRAM_A3_PIO, SDRAM_A_FLAGS);
870  pio_configure_pin(SDRAM_A4_PIO, SDRAM_A_FLAGS);
871  pio_configure_pin(SDRAM_A5_PIO, SDRAM_A_FLAGS);
872  pio_configure_pin(SDRAM_A6_PIO, SDRAM_A_FLAGS);
873  pio_configure_pin(SDRAM_A7_PIO, SDRAM_A_FLAGS);
874  pio_configure_pin(SDRAM_A8_PIO, SDRAM_A_FLAGS);
875  pio_configure_pin(SDRAM_A9_PIO, SDRAM_A_FLAGS);
876  pio_configure_pin(SDRAM_A10_PIO, SDRAM_A_FLAGS);
877  pio_configure_pin(SDRAM_A11_PIO, SDRAM_A_FLAGS);
878  pio_configure_pin(SDRAM_SDA10_PIO, SDRAM_SDA10_FLAGS);
879  pio_configure_pin(SDRAM_D0_PIO, SDRAM_D_FLAGS);
880  pio_configure_pin(SDRAM_D1_PIO, SDRAM_D_FLAGS);
881  pio_configure_pin(SDRAM_D2_PIO, SDRAM_D_FLAGS);
882  pio_configure_pin(SDRAM_D3_PIO, SDRAM_D_FLAGS);
883  pio_configure_pin(SDRAM_D4_PIO, SDRAM_D_FLAGS);
884  pio_configure_pin(SDRAM_D5_PIO, SDRAM_D_FLAGS);
885  pio_configure_pin(SDRAM_D6_PIO, SDRAM_D_FLAGS);
886  pio_configure_pin(SDRAM_D7_PIO, SDRAM_D_FLAGS);
887  pio_configure_pin(SDRAM_D8_PIO, SDRAM_D_FLAGS);
888  pio_configure_pin(SDRAM_D9_PIO, SDRAM_D_FLAGS);
889  pio_configure_pin(SDRAM_D10_PIO, SDRAM_D_FLAGS);
890  pio_configure_pin(SDRAM_D11_PIO, SDRAM_D_FLAGS);
891  pio_configure_pin(SDRAM_D12_PIO, SDRAM_D_FLAGS);
892  pio_configure_pin(SDRAM_D13_PIO, SDRAM_D_FLAGS);
893  pio_configure_pin(SDRAM_D14_PIO, SDRAM_D_FLAGS);
894  pio_configure_pin(SDRAM_D15_PIO, SDRAM_D_FLAGS);
895 
896  MATRIX->CCFG_SMCNFCS = CCFG_SMCNFCS_SDRAMEN;
897 #endif
898 
899 #ifdef CONF_BOARD_ILI9488
900 
901  pio_configure_pin(LCD_SPI_MISO_PIO, LCD_SPI_MISO_FLAGS);
902  pio_configure_pin(LCD_SPI_MOSI_PIO, LCD_SPI_MOSI_FLAGS);
903  pio_configure_pin(LCD_SPI_SPCK_PIO, LCD_SPI_SPCK_FLAGS);
904  pio_configure_pin(LCD_SPI_NPCS_PIO, LCD_SPI_NPCS_FLAGS);
905  pio_configure_pin(LCD_SPI_RESET_PIO, LCD_SPI_RESET_FLAGS);
906  pio_configure_pin(LCD_SPI_CDS_PIO, LCD_SPI_CDS_FLAGS);
907  pio_configure_pin(LCD_SPI_BACKLIGHT_PIO, LCD_SPI_BACKLIGHT_FLAGS);
908  pio_set_pin_high(LCD_SPI_BACKLIGHT_PIO);
909 
910 #endif
911 }
#define SPI_WIFI_MOSI_FLAGS
Definition: user_board.h:142
#define SPI_INS_SCLK_PIN
Definition: user_board.h:97
#define UART_INS_SER0_TXD_PIN
Definition: user_board.h:85
void refresh_led_cfg(void)
Definition: init.c:355
#define UART_XBEE_TXD_FLAGS
Definition: user_board.h:172
#define PIN_HSMCI_MCDA2_FLAGS
Definition: user_board.h:388
#define SDRAM_START_ADDRESS
Definition: mpu.h:168
#define UART_XBEE_TXD_PIN
Definition: user_board.h:171
uint32_t h3sp330BaudRate
Definition: data_sets.h:3193
#define MPU_REGION_VALID
Definition: mpu.h:65
#define PIN_HSMCI_MCDA1_FLAGS
Definition: user_board.h:385
int serSetBaudRate(int serialNum, int baudrate)
Change USART baudrate. 0 on success, -1 on failure.
Definition: d_usartDMA.c:995
#define PMC
(PMC ) Base Address
Definition: same70j19.h:524
#define LED_LOG_OFF()
Definition: user_board.h:270
#define MPU_QSPIMEM_REGION
Definition: mpu.h:59
#define LED_OFF(led)
Definition: user_board.h:235
#define SCB_SHCSR_USGFAULTENA_Msk
Definition: core_cm7.h:579
#define MPU_ENABLE
Definition: mpu.h:69
#define CCFG_SYSIO_SYSIO4
(CCFG_SYSIO) PB4 or TDI Assignment
void pio_set_pin_high(uint32_t ul_pin)
Drive a GPIO pin to 1.
Definition: pio.c:711
#define CAN_RXD_FLAGS
Definition: user_board.h:196
static void ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Set pin mode for one single IOPORT pin.
Definition: ioport.h:217
void board_init(void)
This function initializes the board target resources.
Definition: init.c:573
#define UART_EXT_RADIO_RXD_PIN
Definition: user_board.h:162
#define PIN_USART0_RTS_IDX
Definition: user_board.h:367
#define SPI_WIFI_MOSI_PIN
Definition: user_board.h:141
#define PIN_USART0_CTS_IDX
Definition: user_board.h:363
#define UART_XBEE_N_CTS_FLAGS
Definition: user_board.h:180
#define LED_CFG_BLUE()
Definition: user_board.h:244
#define SCB_DTCMCR_RETEN_Msk
Definition: core_cm7.h:730
#define UART_BTLE_TXD_PIN
Definition: user_board.h:154
#define PIN_HSMCI_MCDA2_GPIO
Definition: user_board.h:387
#define MPU_PRIVDEFENA
Definition: mpu.h:71
#define EVB_HDW_DETECT_1_GPIO
Definition: user_board.h:75
#define QSPI_END_ADDRESS
Definition: mpu.h:173
uint32_t evbStatus
Definition: data_sets.h:3069
#define LED_WIFI_RXD_PIN
Definition: user_board.h:285
void CAN_init(void)
Definition: CAN.cpp:26
#define UART_XBEE_N_DTR_PIN
Definition: user_board.h:184
#define LED_CFG_YELLOW()
Definition: user_board.h:246
#define PIN_HSMCI_MCCDA_FLAGS
Definition: user_board.h:376
#define UART_XBEE_N_CTS_PIN
Definition: user_board.h:179
#define WIFI_IRQN_PIN
Definition: user_board.h:149
int serInit(int serialNum, uint32_t baudRate, sam_usart_opt_t *options, uint32_t *overrunStatus)
Initialize serial port with specific USART/UART and DMA settings. If not NULL, the overrun status wil...
Definition: d_usartDMA.c:1560
SAMV70/SAMV71/SAME70/SAMS70-XULTRA board mpu config.
static void pll_disable(uint32_t ul_pll_id)
Definition: same70/pll.h:175
#define LED_CFG_OFF()
Definition: user_board.h:249
#define USBHSRAM_END_ADDRESS
Definition: mpu.h:177
int i2cInit(void)
Definition: d_i2c.c:26
void xbee_init(void)
Definition: xbee.cpp:236
#define INNER_NORMAL_WB_RWA_TYPE(x)
Definition: mpu.h:101
#define SPI_WIFI_SCLK_PIN
Definition: user_board.h:143
#define MPU_REGION_EXECUTE_NEVER
Definition: mpu.h:78
#define BUTTON_LOG_SENSE
Definition: user_board.h:294
#define PIN_USART0_CTS_FLAGS
Definition: user_board.h:364
#define MPU_DEFAULT_SRAM_REGION_2
Definition: mpu.h:55
void pio_set(Pio *p_pio, const uint32_t ul_mask)
Set a high output level on all the PIOs defined in ul_mask. This has no immediate effects on PIOs tha...
Definition: pio.c:117
#define UART_SP330_TXD_FLAGS
Definition: user_board.h:116
#define I2C_0_SCL_PIN
Definition: user_board.h:203
#define PIN_HSMCI_MCDA3_FLAGS
Definition: user_board.h:391
#define SPI_INS_EN
Definition: user_board.h:101
#define MPU_AP_PRIVILEGED_READ_WRITE
Definition: mpu.h:81
#define EEFC_FCR_FARG(value)
#define UART_INS_SER0_RXD_FLAGS
Definition: user_board.h:84
#define SCB_SHCSR_MEMFAULTENA_Msk
Definition: core_cm7.h:585
static void tcm_disable(void)
TCM memory Disable.
Definition: init.c:335
Common IOPORT service main header file for AVR, UC3 and ARM architectures.
void pmc_switch_sclk_to_32kxtal(uint32_t ul_bypass)
Switch slow clock source selection to external 32k (Xtal or Bypass).
Definition: pmc.c:319
#define NULL
Definition: nm_bsp.h:52
#define XBEE_SUPPLY_EN_PIN
Definition: user_board.h:186
#define UART_BTLE_CTS_PIN
Definition: user_board.h:158
uint32_t h4xRadioBaudRate
Definition: data_sets.h:3196
#define SPI_INS_MOSI_PIN
Definition: user_board.h:95
#define SD_MMC_0_CD_FLAGS
Definition: user_board.h:397
#define ioport_set_pin_peripheral_mode(pin, mode)
Definition: user_board.h:312
#define LED_INS_TXD_PIN
Definition: user_board.h:280
#define EVB_HDW_DETECT_2_GPIO
Definition: user_board.h:76
#define LED_WIFI_TXD_PIN
Definition: user_board.h:286
#define UART_SP330_RXD_FLAGS
Definition: user_board.h:114
#define IOPORT_MODE_PULLUP
Definition: ioport_pio.h:78
__STATIC_INLINE void SCB_EnableDCache(void)
Enable D-Cache.
Definition: core_cm7.h:1935
#define UART_INS_SER1_RXD_PIN
Definition: user_board.h:88
#define PIN_HSMCI_MCDA1_GPIO
Definition: user_board.h:384
#define UART_INS_SER0_RXD_PIN
Definition: user_board.h:83
#define USBHSRAM_START_ADDRESS
Definition: mpu.h:176
#define UART_BTLE_RXD_PIN
Definition: user_board.h:152
#define CCFG_SMCNFCS_SDRAMEN
(CCFG_SMCNFCS) SDRAM Enable
void mpu_set_region(uint32_t dw_region_base_addr, uint32_t dw_region_attr)
Setup a memory region.
Definition: mpu.c:116
#define BUTTON_LOG_FLAGS
Definition: user_board.h:293
#define UART_INS_SER1_TXD_PIN
Definition: user_board.h:90
#define WDT
(WDT ) Base Address
Definition: same70j19.h:535
#define SP330_NSHDN_PIN
Definition: user_board.h:118
void(* VoidFuncPtrVoid)(void)
Definition: globals.h:36
#define STRONGLY_ORDERED_SHAREABLE_TYPE
Definition: mpu.h:103
#define SPI_INS_SCLK_FLAGS
Definition: user_board.h:98
#define CAN_TXD_PIN
Definition: user_board.h:197
static bool ioport_get_pin_level(ioport_pin_t pin)
Get current value of an IOPORT pin, which has been configured as an input.
Definition: ioport.h:301
__STATIC_INLINE void SCB_EnableICache(void)
Enable I-Cache.
Definition: core_cm7.h:1885
void init_set_board_IO_config_callback(VoidFuncPtrVoid fpIoCfg)
Definition: init.c:371
#define SCB_DTCMCR_RMW_Msk
Definition: core_cm7.h:733
#define SP330_NFULL_DPLX_PIN
Definition: user_board.h:120
#define NULLPTR
Definition: ISConstants.h:426
Commonly used includes, types and macros.
#define SHAREABLE
Definition: mpu.h:98
#define LED_XBEE_TXD_PIN
Definition: user_board.h:283
#define SCB
Definition: core_cm7.h:1599
static void ioport_init(void)
Initializes the IOPORT service, ready for use.
Definition: ioport.h:145
#define LED_LOG_GRN_PIN
Definition: user_board.h:261
#define MPU_USBHSRAM_REGION
Definition: mpu.h:60
#define CAN_RXD_PIN
Definition: user_board.h:195
#define MPU_DEFAULT_IFLASH_REGION
Definition: mpu.h:52
#define SP330_NSLEW_PIN
Definition: user_board.h:117
#define XBEE_RST_PIN
Definition: user_board.h:188
#define SCB_ITCMCR_RETEN_Msk
Definition: core_cm7.h:717
#define INS_DATA_RDY_PIN_IDX
Definition: user_board.h:104
#define UART_EXT_RADIO_TXD_PIN
Definition: user_board.h:164
#define EEFC_FCR_FKEY_PASSWD
Definition: efc.c:100
#define UART_XBEE_N_RTS_PIN
Definition: user_board.h:181
#define LED_CFG_CYAN()
Definition: user_board.h:245
#define SPI_INS_MOSI_FLAGS
Definition: user_board.h:96
#define SP330_485_N232_PIN
Definition: user_board.h:121
#define I2C_0_SDA_FLAGS
Definition: user_board.h:202
void spiTouINS_init(void)
#define SPI_WIFI_CS_FLAGS
Definition: user_board.h:146
#define DTCM_END_ADDRESS
Definition: mpu.h:134
#define SRAM_SECOND_END_ADDRESS
Definition: mpu.h:157
evb_status_t g_status
Definition: globals.c:21
#define SPI_WIFI_CS_PIN
Definition: user_board.h:145
#define LED_LOG_RED_PIN
Definition: user_board.h:260
#define IFLASH_END_ADDRESS
Definition: mpu.h:123
uint32_t cbOptions
Definition: data_sets.h:3151
#define SPI_WIFI_MISO_PIN
Definition: user_board.h:139
uint8_t cbPreset
Definition: data_sets.h:3142
Board configuration.
#define SP330_N485_RXEN_PIN
Definition: user_board.h:119
#define DTCM_START_ADDRESS
Definition: mpu.h:133
void time_init(void)
Definition: d_time.c:40
void sysclk_init(void)
Initialize the synchronous clock system.
Definition: sysclk.c:158
#define SPI_INS_CS_PIN
Definition: user_board.h:99
#define UART_XBEE_RXD_PIN
Definition: user_board.h:169
#define MPU_DEFAULT_SDRAM_REGION
Definition: mpu.h:58
uint32_t mpu_cal_mpu_region_size(uint32_t dw_actual_size_in_bytes)
Calculate region size for the RASR.
Definition: mpu.c:126
void wifi_enable(int enable)
Definition: wifi.c:236
#define PIN_HSMCI_MCCDA_GPIO
Definition: user_board.h:375
#define SHAREABLE_DEVICE_TYPE
Definition: mpu.h:104
#define GPIO_H8_UART_TXD_FLAGS
Definition: user_board.h:229
#define LED_CFG_WHITE()
Definition: user_board.h:248
#define EEFC_FCR_FCMD_SGPB
(EEFC_FCR) Set GPNVM bit
#define SD_MMC_0_CD_GPIO
Definition: user_board.h:395
#define SCB_DTCMCR_EN_Msk
Definition: core_cm7.h:736
#define PIN_HSMCI_MCCK_GPIO
Definition: user_board.h:378
#define EFC
(EFC ) Base Address
Definition: same70j19.h:528
#define LED_LOG_BLU_PIN
Definition: user_board.h:262
#define SRAM_FIRST_END_ADDRESS
Definition: mpu.h:148
#define GPIO_H8_UART_TXD_PIN
Definition: user_board.h:228
#define BUTTON_CFG_PIN
Definition: user_board.h:289
#define PIN_HSMCI_MCDA0_FLAGS
Definition: user_board.h:382
#define MPU_AP_FULL_ACCESS
Definition: mpu.h:83
#define PIN_HSMCI_MCDA3_GPIO
Definition: user_board.h:390
#define GPIO_H8_UART_RXD_FLAGS
Definition: user_board.h:226
#define LED_XBEE_RXD_PIN
Definition: user_board.h:282
#define SCB_ITCMCR_RMW_Msk
Definition: core_cm7.h:720
#define ITCM_START_ADDRESS
Definition: mpu.h:120
#define UART_EXT_RADIO_RXD_FLAGS
Definition: user_board.h:163
#define GPIO_UART_INV_PIN
Definition: user_board.h:222
#define PMC_OSC_XTAL
#define MPU_EXT_EBI_REGION
Definition: mpu.h:57
#define MPU_DEFAULT_DTCM_REGION
Definition: mpu.h:53
#define UART_BTLE_RTS_PIN
Definition: user_board.h:156
uint8_t g_hdw_detect
#define MPU_DEFAULT_SRAM_REGION_1
Definition: mpu.h:54
#define UART_BTLE_RXD_FLAGS
Definition: user_board.h:153
static void ioport_set_pin_dir(ioport_pin_t pin, enum ioport_direction dir)
Set direction for a single IOPORT pin.
Definition: ioport.h:263
#define IFLASH_START_ADDRESS
Definition: mpu.h:122
#define UART_BTLE_TXD_FLAGS
Definition: user_board.h:155
#define ioport_set_pin_input_mode(pin, mode, sense)
Set input mode for one single IOPORT pin. It will configure port mode and disable pin mode (but enabl...
Definition: init.c:64
void mpu_enable(uint32_t dw_mpu_enable)
Enables the MPU module.
Definition: mpu.c:87
#define LED_CFG_GREEN()
Definition: user_board.h:243
#define PMC_MCKR_CSS_PLLA_CLK
(PMC_MCKR) PLLA Clock is selected
#define PIN_USART0_SCK_IDX
Definition: user_board.h:359
static void ioport_enable_pin(ioport_pin_t pin)
Enable an IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
Definition: ioport.h:156
#define SPI_INS_MISO_PIN
Definition: user_board.h:93
evb_flash_cfg_t * g_flashCfg
Definition: globals.c:22
#define SCB_ITCMCR_EN_Msk
Definition: core_cm7.h:723
#define GPIO_H8_UART_RXD_PIN
Definition: user_board.h:225
#define UART_INS_SER1_RXD_FLAGS
Definition: user_board.h:89
#define LED_INS_RXD_PIN
Definition: user_board.h:279
#define LED_CFG_GRN_PIN
Definition: user_board.h:240
#define QSPI_START_ADDRESS
Definition: mpu.h:172
#define UART_INS_SER1_TXD_FLAGS
Definition: user_board.h:91
#define BUTTON_CFG_FLAGS
Definition: user_board.h:290
#define INNER_NORMAL_WB_NWA_TYPE(x)
Definition: mpu.h:102
uint32_t pmc_switch_mck_to_mainck(uint32_t ul_pres)
Switch master clock source selection to main clock.
Definition: pmc.c:186
#define ioport_set_pin_output_mode(pin, level)
Definition: user_board.h:331
#define LED_CFG_RED_PIN
Definition: user_board.h:239
#define I2C_0_SCL_FLAGS
Definition: user_board.h:204
uint32_t pio_configure(Pio *p_pio, const pio_type_t ul_type, const uint32_t ul_mask, const uint32_t ul_attribute)
Perform complete pin(s) configuration; general attributes and PIO init if necessary.
Definition: pio.c:348
#define UART_XBEE_RXD_FLAGS
Definition: user_board.h:170
#define MATRIX
(MATRIX) Base Address
Definition: same70j19.h:522
#define MPU_REGION_ENABLE
Definition: mpu.h:66
#define EXT_EBI_START_ADDRESS
Definition: mpu.h:164
#define LED_CFG_PURPLE()
Definition: user_board.h:247
#define PIN_USART0_RTS_FLAGS
Definition: user_board.h:368
#define BUTTON_LOG_PIN
Definition: user_board.h:292
#define UART_INS_SER0_TXD_FLAGS
Definition: user_board.h:86
#define WIFI_CHIPEN_PIN
Definition: user_board.h:148
#define PIN_HSMCI_MCDA0_GPIO
Definition: user_board.h:381
#define EEFC_FCR_FCMD_CGPB
(EEFC_FCR) Clear GPNVM bit
#define I2C_0_SDA_PIN
Definition: user_board.h:201
#define UART_EXT_RADIO_TXD_FLAGS
Definition: user_board.h:165
uint32_t pio_configure_pin(uint32_t ul_pin, const uint32_t ul_flags)
Perform complete pin(s) configuration; general attributes and PIO init if necessary.
Definition: pio.c:763
#define UART_XBEE_N_RTS_FLAGS
Definition: user_board.h:182
#define SPI_INS_MISO_FLAGS
Definition: user_board.h:94
#define MPU_PERIPHERALS_REGION
Definition: mpu.h:56
#define SRAM_FIRST_START_ADDRESS
Definition: mpu.h:147
#define LED_CFG_BLU_PIN
Definition: user_board.h:241
#define ITCM_END_ADDRESS
Definition: mpu.h:121
#define PERIPHERALS_START_ADDRESS
Definition: mpu.h:160
void board_IO_config(void)
Definition: init.c:376
#define BUTTON_CFG_SENSE
Definition: user_board.h:291
#define PLLA_ID
Definition: same70/pll.h:62
#define PIN_HSMCI_MCCK_FLAGS
Definition: user_board.h:379
#define SDRAM_END_ADDRESS
Definition: mpu.h:169
#define UART_SP330_RXD_PIN
Definition: user_board.h:113
uint8_t uinsComPort
Definition: data_sets.h:3181
#define SCB_SHCSR_BUSFAULTENA_Msk
Definition: core_cm7.h:582
#define NON_SHAREABLE
Definition: mpu.h:99
#define UART_SP330_TXD_PIN
Definition: user_board.h:115
Standard board header file.
#define PMC_MCKR_CSS_Msk
(PMC_MCKR) Master Clock Source Selection
#define EXT_EBI_END_ADDRESS
Definition: mpu.h:165
#define WDT_MR_WDDIS
(WDT_MR) Watchdog Disable
#define CAN_TXD_FLAGS
Definition: user_board.h:198
__attribute__((optimize("O0")))
Definition: init.c:347
#define WIFI_RST_PIN
Definition: user_board.h:147
#define MPU_DEFAULT_ITCM_REGION
Definition: mpu.h:51
#define PERIPHERALS_END_ADDRESS
Definition: mpu.h:161
uint32_t h8gpioBaudRate
Definition: data_sets.h:3199
#define SRAM_SECOND_START_ADDRESS
Definition: mpu.h:156
uint8_t uinsAuxPort
Definition: data_sets.h:3184
#define SPI_WIFI_MISO_FLAGS
Definition: user_board.h:140
#define PIN_USART0_SCK_FLAGS
Definition: user_board.h:360
#define EVB_HDW_DETECT_0_GPIO
Definition: user_board.h:74
#define SPI_WIFI_SCLK_FLAGS
Definition: user_board.h:144


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57