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 
61 #define ioport_set_port_peripheral_mode(port, masks, mode) \
62  do {\
63  ioport_set_port_mode(port, masks, mode);\
64  ioport_disable_port(port, masks);\
65  } while (0)
66 
73 #define ioport_set_pin_peripheral_mode(pin, mode) \
74  do {\
75  ioport_set_pin_mode(pin, mode);\
76  ioport_disable_pin(pin);\
77  } while (0)
78 
87 #undef ioport_set_pin_input_mode
88 #define ioport_set_pin_input_mode(pin, mode, sense) \
89  do {\
90  ioport_enable_pin(pin);\
91  ioport_set_pin_dir(pin, IOPORT_DIR_INPUT);\
92  ioport_set_pin_mode(pin, mode);\
93  ioport_set_pin_sense_mode(pin, sense);\
94  } while (0)
95 
96 
97 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT
98 
111 uint8_t g_hdw_detect;
112 
116 static void _setup_memory_region( void )
117 {
118 
119  uint32_t dw_region_base_addr;
120  uint32_t dw_region_attr;
121 
122  __DMB();
123 
129  dw_region_base_addr =
133 
134  dw_region_attr =
137 
138  mpu_set_region( dw_region_base_addr, dw_region_attr);
139 
147  dw_region_base_addr =
151 
152  dw_region_attr =
153 // MPU_AP_READONLY |
157 
158  mpu_set_region( dw_region_base_addr, dw_region_attr);
159 
166  /* DTCM memory region */
167  dw_region_base_addr =
171 
172  dw_region_attr =
175 
176  mpu_set_region( dw_region_base_addr, dw_region_attr);
177 
183  /* SRAM memory region */
184  dw_region_base_addr =
188 
189  dw_region_attr =
193 
194  mpu_set_region( dw_region_base_addr, dw_region_attr);
195 
196 
202  /* SRAM memory region */
203  dw_region_base_addr =
207 
208  dw_region_attr =
212 
213  mpu_set_region( dw_region_base_addr, dw_region_attr);
214 
215 #ifdef MPU_HAS_NOCACHE_REGION
216  dw_region_base_addr =
217  SRAM_NOCACHE_START_ADDRESS |
219  MPU_NOCACHE_SRAM_REGION;
220 
221  dw_region_attr =
223  INNER_OUTER_NORMAL_NOCACHE_TYPE( SHAREABLE ) |
224  mpu_cal_mpu_region_size(NOCACHE_SRAM_REGION_SIZE) | MPU_REGION_ENABLE;
225 
226  mpu_set_region( dw_region_base_addr, dw_region_attr);
227 #endif
228 
234  dw_region_base_addr =
238 
239  dw_region_attr = MPU_AP_FULL_ACCESS |
243 
244  mpu_set_region( dw_region_base_addr, dw_region_attr);
245 
246 
252  dw_region_base_addr =
256 
257  dw_region_attr =
259  /* External memory Must be defined with 'Device' or 'Strongly Ordered' attribute for write accesses (AXI) */
262 
263  mpu_set_region( dw_region_base_addr, dw_region_attr);
264 
270  dw_region_base_addr =
274 
275  dw_region_attr =
279 
280  mpu_set_region( dw_region_base_addr, dw_region_attr);
281 
287  dw_region_base_addr =
291 
292  dw_region_attr =
297 
298  mpu_set_region( dw_region_base_addr, dw_region_attr);
299 
300 
306  dw_region_base_addr =
310 
311  dw_region_attr =
317 
318  mpu_set_region( dw_region_base_addr, dw_region_attr);
319 
320 
321  /* Enable the memory management fault , Bus Fault, Usage Fault exception */
323 
324  /* Enable the MPU region */
326 
327  __DSB();
328  __ISB();
329 }
330 #endif
331 
332 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT
333 #if defined(__GNUC__)
334 extern char _itcm_lma, _sitcm, _eitcm;
335 #endif
336 
340 static inline void tcm_enable(void)
341 {
342 
343  __DSB();
344  __ISB();
345 
348 
349  __DSB();
350  __ISB();
351 }
352 #else
353 
357 static inline void tcm_disable(void)
358 {
359 
360  __DSB();
361  __ISB();
362  SCB->ITCMCR &= ~(uint32_t)(1UL);
363  SCB->DTCMCR &= ~(uint32_t)SCB_DTCMCR_EN_Msk;
364  __DSB();
365  __ISB();
366 }
367 #endif
368 
369 __attribute__((optimize("O0")))
370 static void waitPinPullup(void)
371 {
372  // wait a tiny bit for pins to pull
373  for (volatile int i = 0; i < 200000; i++) {}
374 }
375 
376 
377 void refresh_CFG_LED(void)
378 {
379  switch(g_flashCfg->cbPreset)
380  {
381  default:
382  case EVB2_CB_PRESET_ALL_OFF: LED_CFG_OFF(); break;
383  case EVB2_CB_PRESET_RS232: LED_CFG_GREEN(); break;
386  case EVB2_CB_PRESET_SPI_RS232: LED_CFG_CYAN(); break;
389  }
390 }
391 
392 
393 void board_IO_config(void)
394 {
395  // uINS ser0
399  { // I/O tristate
402  }
403  else
404  {
405 #ifdef CONF_BOARD_SERIAL_UINS_SER0
408  serInit(EVB2_PORT_UINS0, 921600, NULL, NULL);
409 #endif
410  }
411 
412  // uINS ser1
414  {
415  #ifdef CONF_BOARD_SPI_UINS
419 
420  //CS will be handled by GPIO
423 
424  //Indicate to uINS that SPI is requested
427 
428  //Setup data ready pin
430  ioport_set_pin_mode(INS_DATA_RDY_PIN_IDX, IOPORT_MODE_PULLDOWN);
431 
432  spiTouINS_init();
433  #endif
434  }
438  { // I/O tristate - (Enable pin and set as input)
441 
447  }
448  else
449  {
450 #ifdef CONF_BOARD_SERIAL_UINS_SER1
453  serInit(EVB2_PORT_UINS1, 921600, NULL, NULL);
457 #endif
458  }
459 
460 #ifdef CONF_BOARD_SERIAL_SP330
462  { // RS422 mode
465  }
466  else
467  { // RS232 mode
470  }
472 #endif
473 
474 #ifdef CONF_BOARD_SERIAL_XBEE
476  { // XBee enabled
480  serInit(EVB2_PORT_XBEE, 115200, NULL, NULL);
481 #if 0
483  ioport_set_pin_peripheral_mode(UART_XBEE_DTR_PIN, UART_XBEE_DTR_FLAGS);
484 #else
487 #endif
488 // ioport_set_pin_output_mode(XBEE_VUSB_DISABLE_PIN, IOPORT_PIN_LEVEL_LOW); // Enable VBUS
489  ioport_set_pin_output_mode(XBEE_RST_PIN, IOPORT_PIN_LEVEL_HIGH); // Reset off (low asserted)
492  }
493  else
494  { // XBee disabled
501 
504 
507  }
509 
510  switch(g_flashCfg->cbPreset)
511  {
514  xbee_init();
515 
516  }
517 #endif
518 
519 #ifdef CONF_BOARD_SPI_ATWINC_WIFI
521  { // WiFi enabled
522  wifi_enable(true); // power on wifi. Connect to hot spot and TCP socket
523  }
524  else
525  { // WiFi disabled
526  wifi_enable(false); // power off wifi
527  }
528 #else
531 #endif
532 
533  // Reset default baud rates
535  { // I/O not tristate
538  {
540  }
541  }
542  serSetBaudRate(EVB2_PORT_BLE, 115200);
545 #ifdef CONF_BOARD_CAN1
547  {
549  CAN_init();
550  }
551 #endif
552 }
553 
554 
555 
556 void board_init(void)
557 {
558  // Hardware Detection - PCB version
565  waitPinPullup();
566 
567  g_hdw_detect = ~(0xF8 |
571 
572  // Disable hardware detect pullup/pulldown (tri-state pins)
576 
578  // Init system clocks
579  // If running on PLL, disable it so second PLL initialization does not hang device
580  if((PMC->PMC_MCKR & PMC_MCKR_CSS_Msk) == PMC_MCKR_CSS_PLLA_CLK)
581  {
584  }
585 
586  pmc_switch_sclk_to_32kxtal(PMC_OSC_XTAL); // set SLCK to use external 32kHz crystal rather than internal 32kHz RC oscillator.
587  sysclk_init();
588 
589 
590 #ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT
591  /* Disable the watchdog */
592  WDT->WDT_MR = WDT_MR_WDDIS;
593 #endif
594 
595 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT
596  _setup_memory_region();
597 #endif
598 
599  SCB_EnableICache();
600 
601 #if CONF_BOARD_ENABLE_DCACHE == 1
603 #endif
604 
605 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT
606  /* TCM Configuration */
608  | EEFC_FCR_FARG(8));
610  | EEFC_FCR_FARG(7));
611  tcm_enable();
612 #if defined(__GNUC__)
613  volatile char *dst = &_sitcm;
614  volatile char *src = &_itcm_lma;
615  /* copy code_TCM from flash to ITCM */
616  while(dst < &_eitcm){
617  *dst++ = *src++;
618  }
619 #endif
620 #else
621  /* TCM Configuration */
623  | EEFC_FCR_FARG(8));
625  | EEFC_FCR_FARG(7));
626 
627  tcm_disable();
628 #endif
629 
630  // Real-time timer
631  time_init();
632 
633  /* Initialize IOPORTs */
634  ioport_init();
635 
637  // LEDs - default to ALL on
644 
651 
652 #if 0
653  // Turn off LEDs
654  LED_CFG_OFF();
655  LED_LOG_OFF();
656 
663 #endif
664 
666  // Push Buttons
669 
671  // Serial Ports
672 
673  // UINS ser0 and ser1 - In board_IO_init() in main.cpp
674 
675 #ifdef CONF_BOARD_SERIAL_EXT_RADIO // External Radio
679 // ioport_set_pin_dir(EXT_RADIO_RST, IOPORT_DIR_OUTPUT);
680 // ioport_set_pin_level(EXT_RADIO_RST, IOPORT_PIN_LEVEL_HIGH); // Low assert
681 #endif
682 
683 #ifdef CONF_BOARD_SERIAL_ATWINC_BLE // ATWINC3400 Bluetooth
688  serInit(EVB2_PORT_BLE, 115200, NULL, NULL);
689 #endif
690 
691 #ifdef CONF_BOARD_SERIAL_SP330 // RS232/RS422/RS485 converter
695  ioport_set_pin_output_mode(SP330_NSLEW_PIN, IOPORT_PIN_LEVEL_HIGH); // Don't limit data rate to less than 250 Kbps
696  ioport_set_pin_output_mode(SP330_NFULL_DPLX_PIN, IOPORT_PIN_LEVEL_LOW); // RS485 full duplex (RS232 N/A)
698 #endif
699 
700 #ifdef CONF_BOARD_SERIAL_GPIO_H8 // GPIO TTL
703  MATRIX->CCFG_SYSIO |= CCFG_SYSIO_SYSIO4;
706 
707 // char buf[3] = "123";
708 // serWrite(EVB2_PORT_GPIO_H8, buf, 3, NULL);
709 #endif
710 
711 
713  // SPI Interface
714 #ifdef CONF_BOARD_SPI_ATWINC_WIFI // ATWINC WIFI
722 #else
724 #endif
725 
727  // I2C Interface
728 #ifdef CONF_BOARD_I2C_UINS // UINS I2C
731 #endif
732 
733 #ifdef CONF_BOARD_CAN1
734  /* Configure the CAN1 TX and RX pin. */
737 #endif
738 
740  // SD Card Interface
741 #ifdef CONF_BOARD_SD_MMC_HSMCI
742  /* Configure HSMCI pins */
749 
750  /* Configure SD/MMC card detect pin */
752 #endif
753 
754 
755 
759 
760 #ifdef CONF_BOARD_TWIHS0
761  ioport_set_pin_peripheral_mode(TWIHS0_DATA_GPIO, TWIHS0_DATA_FLAGS);
762  ioport_set_pin_peripheral_mode(TWIHS0_CLK_GPIO, TWIHS0_CLK_FLAGS);
763 #endif
764 
765 #ifdef CONF_BOARD_CAN0
766  /* Configure the CAN0 TX and RX pins. */
767  ioport_set_pin_peripheral_mode(PIN_CAN0_RX_IDX, PIN_CAN0_RX_FLAGS);
768  ioport_set_pin_peripheral_mode(PIN_CAN0_TX_IDX, PIN_CAN0_TX_FLAGS);
769  /* Configure the transiver0 RS & EN pins. */
770  ioport_set_pin_dir(PIN_CAN0_TR_RS_IDX, IOPORT_DIR_OUTPUT);
771  ioport_set_pin_dir(PIN_CAN0_TR_EN_IDX, IOPORT_DIR_OUTPUT);
772 #endif
773 
774 #ifdef CONF_BOARD_SPI
775  ioport_set_pin_peripheral_mode(SPI0_MISO_GPIO, SPI0_MISO_FLAGS);
776  ioport_set_pin_peripheral_mode(SPI0_MOSI_GPIO, SPI0_MOSI_FLAGS);
777  ioport_set_pin_peripheral_mode(SPI0_SPCK_GPIO, SPI0_SPCK_FLAGS);
778 
779 #ifdef CONF_BOARD_SPI_NPCS0
780  ioport_set_pin_peripheral_mode(SPI0_NPCS0_GPIO, SPI0_NPCS0_FLAGS);
781 #endif
782 
783 #ifdef CONF_BOARD_SPI_NPCS1
784  ioport_set_pin_peripheral_mode(SPI0_NPCS1_GPIO, SPI0_NPCS1_FLAGS);
785 #endif
786 #endif
787 
788 #ifdef CONF_BOARD_QSPI
789  ioport_set_pin_peripheral_mode(QSPI_QSCK_GPIO, QSPI_QSCK_FLAGS);
790  ioport_set_pin_peripheral_mode(QSPI_QCS_GPIO, QSPI_QCS_FLAGS);
791  ioport_set_pin_peripheral_mode(QSPI_QIO0_GPIO, QSPI_QIO0_FLAGS);
792  ioport_set_pin_peripheral_mode(QSPI_QIO1_GPIO, QSPI_QIO1_FLAGS);
793  ioport_set_pin_peripheral_mode(QSPI_QIO2_GPIO, QSPI_QIO2_FLAGS);
794  ioport_set_pin_peripheral_mode(QSPI_QIO3_GPIO, QSPI_QIO3_FLAGS);
795 #endif
796 
797 #ifdef CONF_BOARD_PWM_LED0
798  /* Configure PWM LED0 pin */
799  ioport_set_pin_peripheral_mode(PIN_PWM_LED0_GPIO, PIN_PWM_LED0_FLAGS);
800 #endif
801 
802 #ifdef CONF_BOARD_PWM_LED1
803  /* Configure PWM LED1 pin */
804  ioport_set_pin_peripheral_mode(PIN_PWM_LED1_GPIO, PIN_PWM_LED1_FLAGS);
805 #endif
806 
807 #ifdef CONF_BOARD_USART_SCK
808  /* Configure USART synchronous communication SCK pin */
810 #endif
811 
812 #ifdef CONF_BOARD_USART_CTS
813  /* Configure USART synchronous communication CTS pin */
815 #endif
816 
817 #ifdef CONF_BOARD_USART_RTS
818  /* Configure USART RTS pin */
820 #endif
821 
822 #ifdef CONF_BOARD_ILI9488
823 
824  pio_configure(PIN_EBI_RESET_PIO, PIN_EBI_RESET_TYPE, PIN_EBI_RESET_MASK, PIN_EBI_RESET_ATTRI);
825  pio_configure(PIN_EBI_CDS_PIO, PIN_EBI_CDS_TYPE, PIN_EBI_CDS_MASK, PIN_EBI_CDS_ATTRI);
826  pio_configure(PIN_EBI_DATAL_PIO, PIN_EBI_DATAL_TYPE, PIN_EBI_DATAL_MASK, PIN_EBI_DATAL_ATTRI);
827  pio_configure(PIN_EBI_DATAH_0_PIO, PIN_EBI_DATAH_0_TYPE, PIN_EBI_DATAH_0_MASK, PIN_EBI_DATAH_0_ATTRI);
828  pio_configure(PIN_EBI_DATAH_1_PIO, PIN_EBI_DATAH_1_TYPE, PIN_EBI_DATAH_1_MASK, PIN_EBI_DATAH_1_ATTRI);
829  pio_configure(PIN_EBI_NWE_PIO, PIN_EBI_NWE_TYPE, PIN_EBI_NWE_MASK, PIN_EBI_NWE_ATTRI);
830  pio_configure(PIN_EBI_NRD_PIO, PIN_EBI_NRD_TYPE, PIN_EBI_NRD_MASK, PIN_EBI_NRD_ATTRI);
831  pio_configure(PIN_EBI_CS_PIO, PIN_EBI_CS_TYPE, PIN_EBI_CS_MASK, PIN_EBI_CS_ATTRI);
832  pio_configure(PIN_EBI_BACKLIGHT_PIO, PIN_EBI_BACKLIGHT_TYPE, PIN_EBI_BACKLIGHT_MASK, PIN_EBI_BACKLIGHT_ATTRI);
833  pio_set(PIN_EBI_BACKLIGHT_PIO, PIN_EBI_BACKLIGHT_MASK);
834 #endif
835 
836 #if (defined CONF_BOARD_USB_PORT)
837 # if defined(CONF_BOARD_USB_VBUS_DETECT)
838  ioport_set_pin_dir(USB_VBUS_PIN, IOPORT_DIR_INPUT);
839 # endif
840 # if defined(CONF_BOARD_USB_ID_DETECT)
842 # endif
843 #endif
844 
845 #ifdef CONF_BOARD_SDRAMC
846  pio_configure_pin(SDRAM_BA0_PIO, SDRAM_BA0_FLAGS);
847  pio_configure_pin(SDRAM_SDCK_PIO, SDRAM_SDCK_FLAGS);
848  pio_configure_pin(SDRAM_SDCKE_PIO, SDRAM_SDCKE_FLAGS);
849  pio_configure_pin(SDRAM_SDCS_PIO, SDRAM_SDCS_FLAGS);
850  pio_configure_pin(SDRAM_RAS_PIO, SDRAM_RAS_FLAGS);
851  pio_configure_pin(SDRAM_CAS_PIO, SDRAM_CAS_FLAGS);
852  pio_configure_pin(SDRAM_SDWE_PIO, SDRAM_SDWE_FLAGS);
853  pio_configure_pin(SDRAM_NBS0_PIO, SDRAM_NBS0_FLAGS);
854  pio_configure_pin(SDRAM_NBS1_PIO, SDRAM_NBS1_FLAGS);
855  pio_configure_pin(SDRAM_A2_PIO, SDRAM_A_FLAGS);
856  pio_configure_pin(SDRAM_A3_PIO, SDRAM_A_FLAGS);
857  pio_configure_pin(SDRAM_A4_PIO, SDRAM_A_FLAGS);
858  pio_configure_pin(SDRAM_A5_PIO, SDRAM_A_FLAGS);
859  pio_configure_pin(SDRAM_A6_PIO, SDRAM_A_FLAGS);
860  pio_configure_pin(SDRAM_A7_PIO, SDRAM_A_FLAGS);
861  pio_configure_pin(SDRAM_A8_PIO, SDRAM_A_FLAGS);
862  pio_configure_pin(SDRAM_A9_PIO, SDRAM_A_FLAGS);
863  pio_configure_pin(SDRAM_A10_PIO, SDRAM_A_FLAGS);
864  pio_configure_pin(SDRAM_A11_PIO, SDRAM_A_FLAGS);
865  pio_configure_pin(SDRAM_SDA10_PIO, SDRAM_SDA10_FLAGS);
866  pio_configure_pin(SDRAM_D0_PIO, SDRAM_D_FLAGS);
867  pio_configure_pin(SDRAM_D1_PIO, SDRAM_D_FLAGS);
868  pio_configure_pin(SDRAM_D2_PIO, SDRAM_D_FLAGS);
869  pio_configure_pin(SDRAM_D3_PIO, SDRAM_D_FLAGS);
870  pio_configure_pin(SDRAM_D4_PIO, SDRAM_D_FLAGS);
871  pio_configure_pin(SDRAM_D5_PIO, SDRAM_D_FLAGS);
872  pio_configure_pin(SDRAM_D6_PIO, SDRAM_D_FLAGS);
873  pio_configure_pin(SDRAM_D7_PIO, SDRAM_D_FLAGS);
874  pio_configure_pin(SDRAM_D8_PIO, SDRAM_D_FLAGS);
875  pio_configure_pin(SDRAM_D9_PIO, SDRAM_D_FLAGS);
876  pio_configure_pin(SDRAM_D10_PIO, SDRAM_D_FLAGS);
877  pio_configure_pin(SDRAM_D11_PIO, SDRAM_D_FLAGS);
878  pio_configure_pin(SDRAM_D12_PIO, SDRAM_D_FLAGS);
879  pio_configure_pin(SDRAM_D13_PIO, SDRAM_D_FLAGS);
880  pio_configure_pin(SDRAM_D14_PIO, SDRAM_D_FLAGS);
881  pio_configure_pin(SDRAM_D15_PIO, SDRAM_D_FLAGS);
882 
883  MATRIX->CCFG_SMCNFCS = CCFG_SMCNFCS_SDRAMEN;
884 #endif
885 
886 #ifdef CONF_BOARD_ILI9488
887 
888  pio_configure_pin(LCD_SPI_MISO_PIO, LCD_SPI_MISO_FLAGS);
889  pio_configure_pin(LCD_SPI_MOSI_PIO, LCD_SPI_MOSI_FLAGS);
890  pio_configure_pin(LCD_SPI_SPCK_PIO, LCD_SPI_SPCK_FLAGS);
891  pio_configure_pin(LCD_SPI_NPCS_PIO, LCD_SPI_NPCS_FLAGS);
892  pio_configure_pin(LCD_SPI_RESET_PIO, LCD_SPI_RESET_FLAGS);
893  pio_configure_pin(LCD_SPI_CDS_PIO, LCD_SPI_CDS_FLAGS);
894  pio_configure_pin(LCD_SPI_BACKLIGHT_PIO, LCD_SPI_BACKLIGHT_FLAGS);
895  pio_set_pin_high(LCD_SPI_BACKLIGHT_PIO);
896 
897 #endif
898 }
#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
#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:3071
#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:556
#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:2952
#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
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
void board_IO_config(void)
Definition: init.c:393
#define UART_SP330_TXD_FLAGS
Definition: user_board.h:116
#define I2C_0_SCL_PIN
Definition: user_board.h:201
#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:357
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:3074
#define SPI_INS_MOSI_PIN
Definition: user_board.h:95
#define SD_MMC_0_CD_FLAGS
Definition: user_board.h:397
#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
#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
#define SCB_DTCMCR_RMW_Msk
Definition: core_cm7.h:733
#define SP330_NFULL_DPLX_PIN
Definition: user_board.h:120
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:204
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
#define ioport_set_pin_peripheral_mode(pin, mode)
Set peripheral mode for one single IOPORT pin. It will configure port mode and disable pin mode (but ...
Definition: init.c:73
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:3029
void refresh_CFG_LED(void)
Definition: init.c:377
#define SPI_WIFI_MISO_PIN
Definition: user_board.h:139
uint8_t cbPreset
Definition: data_sets.h:3020
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:88
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:202
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:203
#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
#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:3059
#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:369
#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:3077
#define SRAM_SECOND_START_ADDRESS
Definition: mpu.h:156
uint8_t uinsAuxPort
Definition: data_sets.h:3062
#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 Sat Sep 19 2020 03:19:04