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 63 #undef ioport_set_pin_input_mode 64 #define ioport_set_pin_input_mode(pin, mode, sense) \ 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));\ 73 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT 94 static void _setup_memory_region(
void )
97 uint32_t dw_region_base_addr;
98 uint32_t dw_region_attr;
107 dw_region_base_addr =
125 dw_region_base_addr =
145 dw_region_base_addr =
162 dw_region_base_addr =
181 dw_region_base_addr =
193 #ifdef MPU_HAS_NOCACHE_REGION 194 dw_region_base_addr =
195 SRAM_NOCACHE_START_ADDRESS |
197 MPU_NOCACHE_SRAM_REGION;
201 INNER_OUTER_NORMAL_NOCACHE_TYPE(
SHAREABLE ) |
212 dw_region_base_addr =
230 dw_region_base_addr =
248 dw_region_base_addr =
265 dw_region_base_addr =
284 dw_region_base_addr =
310 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT 311 #if defined(__GNUC__) 312 extern char _itcm_lma, _sitcm, _eitcm;
318 static inline void tcm_enable(
void)
340 SCB->ITCMCR &= ~(uint32_t)(1UL);
348 static
void waitPinPullup(
void)
351 for (
volatile int i = 0; i < 200000; i++) {}
373 s_pfnHandleBoardIoCfg = fpIoCfg;
382 #ifdef CONF_BOARD_I2C_UINS 407 #ifdef CONF_BOARD_SERIAL_UINS_SER0 419 #ifdef CONF_BOARD_SPI_UINS 453 #ifdef CONF_BOARD_SERIAL_UINS_SER1 465 #ifdef CONF_BOARD_SERIAL_SP330 481 #ifdef CONF_BOARD_SERIAL_XBEE 528 #ifdef CONF_BOARD_SPI_ATWINC_WIFI 557 #ifdef CONF_BOARD_CAN1 565 if (s_pfnHandleBoardIoCfg)
567 s_pfnHandleBoardIoCfg();
607 #ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT 612 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT 613 _setup_memory_region();
618 #if CONF_BOARD_ENABLE_DCACHE == 1 622 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT 629 #if defined(__GNUC__) 630 volatile char *dst = &_sitcm;
631 volatile char *src = &_itcm_lma;
633 while(dst < &_eitcm){
692 #ifdef CONF_BOARD_SERIAL_EXT_RADIO // External Radio 700 #ifdef CONF_BOARD_SERIAL_ATWINC_BLE // ATWINC3400 Bluetooth 708 #ifdef CONF_BOARD_SERIAL_SP330 // RS232/RS422/RS485 converter 718 #ifdef CONF_BOARD_SERIAL_GPIO_H8 // GPIO TTL 727 #ifdef CONF_BOARD_SPI_ATWINC_WIFI // ATWINC WIFI 741 #ifdef CONF_BOARD_I2C_UINS // UINS I2C 746 #ifdef CONF_BOARD_CAN1 754 #ifdef CONF_BOARD_SD_MMC_HSMCI 773 #ifdef CONF_BOARD_TWIHS0 778 #ifdef CONF_BOARD_CAN0 787 #ifdef CONF_BOARD_SPI 792 #ifdef CONF_BOARD_SPI_NPCS0 796 #ifdef CONF_BOARD_SPI_NPCS1 801 #ifdef CONF_BOARD_QSPI 810 #ifdef CONF_BOARD_PWM_LED0 815 #ifdef CONF_BOARD_PWM_LED1 820 #ifdef CONF_BOARD_USART_SCK 825 #ifdef CONF_BOARD_USART_CTS 830 #ifdef CONF_BOARD_USART_RTS 835 #ifdef CONF_BOARD_ILI9488 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);
849 #if (defined CONF_BOARD_USB_PORT) 850 # if defined(CONF_BOARD_USB_VBUS_DETECT) 853 # if defined(CONF_BOARD_USB_ID_DETECT) 858 #ifdef CONF_BOARD_SDRAMC 899 #ifdef CONF_BOARD_ILI9488 #define SPI_WIFI_MOSI_FLAGS
#define UART_INS_SER0_TXD_PIN
void refresh_led_cfg(void)
#define UART_XBEE_TXD_FLAGS
#define PIN_HSMCI_MCDA2_FLAGS
#define SDRAM_START_ADDRESS
#define UART_XBEE_TXD_PIN
#define PIN_HSMCI_MCDA1_FLAGS
int serSetBaudRate(int serialNum, int baudrate)
Change USART baudrate. 0 on success, -1 on failure.
#define PMC
(PMC ) Base Address
#define MPU_QSPIMEM_REGION
#define SCB_SHCSR_USGFAULTENA_Msk
#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.
static void ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Set pin mode for one single IOPORT pin.
void board_init(void)
This function initializes the board target resources.
#define UART_EXT_RADIO_RXD_PIN
#define PIN_USART0_RTS_IDX
#define SPI_WIFI_MOSI_PIN
#define PIN_USART0_CTS_IDX
#define UART_XBEE_N_CTS_FLAGS
#define SCB_DTCMCR_RETEN_Msk
#define UART_BTLE_TXD_PIN
#define PIN_HSMCI_MCDA2_GPIO
#define EVB_HDW_DETECT_1_GPIO
#define UART_XBEE_N_DTR_PIN
#define PIN_HSMCI_MCCDA_FLAGS
#define UART_XBEE_N_CTS_PIN
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...
SAMV70/SAMV71/SAME70/SAMS70-XULTRA board mpu config.
static void pll_disable(uint32_t ul_pll_id)
#define USBHSRAM_END_ADDRESS
#define INNER_NORMAL_WB_RWA_TYPE(x)
#define SPI_WIFI_SCLK_PIN
#define MPU_REGION_EXECUTE_NEVER
#define PIN_USART0_CTS_FLAGS
#define MPU_DEFAULT_SRAM_REGION_2
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...
#define UART_SP330_TXD_FLAGS
#define PIN_HSMCI_MCDA3_FLAGS
#define MPU_AP_PRIVILEGED_READ_WRITE
#define EEFC_FCR_FARG(value)
#define UART_INS_SER0_RXD_FLAGS
#define SCB_SHCSR_MEMFAULTENA_Msk
static void tcm_disable(void)
TCM memory Disable.
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).
#define XBEE_SUPPLY_EN_PIN
#define UART_BTLE_CTS_PIN
uint32_t h4xRadioBaudRate
#define SD_MMC_0_CD_FLAGS
#define ioport_set_pin_peripheral_mode(pin, mode)
#define EVB_HDW_DETECT_2_GPIO
#define UART_SP330_RXD_FLAGS
#define IOPORT_MODE_PULLUP
__STATIC_INLINE void SCB_EnableDCache(void)
Enable D-Cache.
#define UART_INS_SER1_RXD_PIN
#define PIN_HSMCI_MCDA1_GPIO
#define UART_INS_SER0_RXD_PIN
#define USBHSRAM_START_ADDRESS
#define UART_BTLE_RXD_PIN
#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.
#define UART_INS_SER1_TXD_PIN
#define WDT
(WDT ) Base Address
void(* VoidFuncPtrVoid)(void)
#define STRONGLY_ORDERED_SHAREABLE_TYPE
#define SPI_INS_SCLK_FLAGS
static bool ioport_get_pin_level(ioport_pin_t pin)
Get current value of an IOPORT pin, which has been configured as an input.
__STATIC_INLINE void SCB_EnableICache(void)
Enable I-Cache.
void init_set_board_IO_config_callback(VoidFuncPtrVoid fpIoCfg)
#define SCB_DTCMCR_RMW_Msk
#define SP330_NFULL_DPLX_PIN
Commonly used includes, types and macros.
static void ioport_init(void)
Initializes the IOPORT service, ready for use.
#define MPU_USBHSRAM_REGION
#define MPU_DEFAULT_IFLASH_REGION
#define SCB_ITCMCR_RETEN_Msk
#define INS_DATA_RDY_PIN_IDX
#define UART_EXT_RADIO_TXD_PIN
#define EEFC_FCR_FKEY_PASSWD
#define UART_XBEE_N_RTS_PIN
#define SPI_INS_MOSI_FLAGS
#define SP330_485_N232_PIN
void spiTouINS_init(void)
#define SPI_WIFI_CS_FLAGS
#define SRAM_SECOND_END_ADDRESS
#define IFLASH_END_ADDRESS
#define SPI_WIFI_MISO_PIN
#define SP330_N485_RXEN_PIN
#define DTCM_START_ADDRESS
void sysclk_init(void)
Initialize the synchronous clock system.
#define UART_XBEE_RXD_PIN
#define MPU_DEFAULT_SDRAM_REGION
uint32_t mpu_cal_mpu_region_size(uint32_t dw_actual_size_in_bytes)
Calculate region size for the RASR.
void wifi_enable(int enable)
#define PIN_HSMCI_MCCDA_GPIO
#define SHAREABLE_DEVICE_TYPE
#define GPIO_H8_UART_TXD_FLAGS
#define EEFC_FCR_FCMD_SGPB
(EEFC_FCR) Set GPNVM bit
#define SCB_DTCMCR_EN_Msk
#define PIN_HSMCI_MCCK_GPIO
#define EFC
(EFC ) Base Address
#define SRAM_FIRST_END_ADDRESS
#define GPIO_H8_UART_TXD_PIN
#define PIN_HSMCI_MCDA0_FLAGS
#define MPU_AP_FULL_ACCESS
#define PIN_HSMCI_MCDA3_GPIO
#define GPIO_H8_UART_RXD_FLAGS
#define SCB_ITCMCR_RMW_Msk
#define ITCM_START_ADDRESS
#define UART_EXT_RADIO_RXD_FLAGS
#define GPIO_UART_INV_PIN
#define MPU_EXT_EBI_REGION
#define MPU_DEFAULT_DTCM_REGION
#define UART_BTLE_RTS_PIN
#define MPU_DEFAULT_SRAM_REGION_1
#define UART_BTLE_RXD_FLAGS
static void ioport_set_pin_dir(ioport_pin_t pin, enum ioport_direction dir)
Set direction for a single IOPORT pin.
#define IFLASH_START_ADDRESS
#define UART_BTLE_TXD_FLAGS
#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...
void mpu_enable(uint32_t dw_mpu_enable)
Enables the MPU module.
#define PMC_MCKR_CSS_PLLA_CLK
(PMC_MCKR) PLLA Clock is selected
#define PIN_USART0_SCK_IDX
static void ioport_enable_pin(ioport_pin_t pin)
Enable an IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
evb_flash_cfg_t * g_flashCfg
#define SCB_ITCMCR_EN_Msk
#define GPIO_H8_UART_RXD_PIN
#define UART_INS_SER1_RXD_FLAGS
#define QSPI_START_ADDRESS
#define UART_INS_SER1_TXD_FLAGS
#define INNER_NORMAL_WB_NWA_TYPE(x)
uint32_t pmc_switch_mck_to_mainck(uint32_t ul_pres)
Switch master clock source selection to main clock.
#define ioport_set_pin_output_mode(pin, level)
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.
#define UART_XBEE_RXD_FLAGS
#define MATRIX
(MATRIX) Base Address
#define MPU_REGION_ENABLE
#define EXT_EBI_START_ADDRESS
#define PIN_USART0_RTS_FLAGS
#define UART_INS_SER0_TXD_FLAGS
#define PIN_HSMCI_MCDA0_GPIO
#define EEFC_FCR_FCMD_CGPB
(EEFC_FCR) Clear GPNVM bit
#define UART_EXT_RADIO_TXD_FLAGS
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.
#define UART_XBEE_N_RTS_FLAGS
#define SPI_INS_MISO_FLAGS
#define MPU_PERIPHERALS_REGION
#define SRAM_FIRST_START_ADDRESS
#define PERIPHERALS_START_ADDRESS
void board_IO_config(void)
#define PIN_HSMCI_MCCK_FLAGS
#define SDRAM_END_ADDRESS
#define UART_SP330_RXD_PIN
#define SCB_SHCSR_BUSFAULTENA_Msk
#define UART_SP330_TXD_PIN
Standard board header file.
#define PMC_MCKR_CSS_Msk
(PMC_MCKR) Master Clock Source Selection
#define EXT_EBI_END_ADDRESS
#define WDT_MR_WDDIS
(WDT_MR) Watchdog Disable
__attribute__((optimize("O0")))
#define MPU_DEFAULT_ITCM_REGION
#define PERIPHERALS_END_ADDRESS
#define SRAM_SECOND_START_ADDRESS
#define SPI_WIFI_MISO_FLAGS
#define PIN_USART0_SCK_FLAGS
#define EVB_HDW_DETECT_0_GPIO
#define SPI_WIFI_SCLK_FLAGS