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 61 #define ioport_set_port_peripheral_mode(port, masks, mode) \ 63 ioport_set_port_mode(port, masks, mode);\ 64 ioport_disable_port(port, masks);\ 73 #define ioport_set_pin_peripheral_mode(pin, mode) \ 75 ioport_set_pin_mode(pin, mode);\ 76 ioport_disable_pin(pin);\ 87 #undef ioport_set_pin_input_mode 88 #define ioport_set_pin_input_mode(pin, mode, sense) \ 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);\ 97 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT 116 static void _setup_memory_region(
void )
119 uint32_t dw_region_base_addr;
120 uint32_t dw_region_attr;
129 dw_region_base_addr =
147 dw_region_base_addr =
167 dw_region_base_addr =
184 dw_region_base_addr =
203 dw_region_base_addr =
215 #ifdef MPU_HAS_NOCACHE_REGION 216 dw_region_base_addr =
217 SRAM_NOCACHE_START_ADDRESS |
219 MPU_NOCACHE_SRAM_REGION;
223 INNER_OUTER_NORMAL_NOCACHE_TYPE(
SHAREABLE ) |
234 dw_region_base_addr =
252 dw_region_base_addr =
270 dw_region_base_addr =
287 dw_region_base_addr =
306 dw_region_base_addr =
332 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT 333 #if defined(__GNUC__) 334 extern char _itcm_lma, _sitcm, _eitcm;
340 static inline void tcm_enable(
void)
362 SCB->ITCMCR &= ~(uint32_t)(1UL);
370 static
void waitPinPullup(
void)
373 for (
volatile int i = 0; i < 200000; i++) {}
405 #ifdef CONF_BOARD_SERIAL_UINS_SER0 415 #ifdef CONF_BOARD_SPI_UINS 450 #ifdef CONF_BOARD_SERIAL_UINS_SER1 460 #ifdef CONF_BOARD_SERIAL_SP330 474 #ifdef CONF_BOARD_SERIAL_XBEE 519 #ifdef CONF_BOARD_SPI_ATWINC_WIFI 545 #ifdef CONF_BOARD_CAN1 590 #ifndef CONF_BOARD_KEEP_WATCHDOG_AT_INIT 595 #ifdef CONF_BOARD_CONFIG_MPU_AT_INIT 596 _setup_memory_region();
601 #if CONF_BOARD_ENABLE_DCACHE == 1 605 #ifdef CONF_BOARD_ENABLE_TCM_AT_INIT 612 #if defined(__GNUC__) 613 volatile char *dst = &_sitcm;
614 volatile char *src = &_itcm_lma;
616 while(dst < &_eitcm){
675 #ifdef CONF_BOARD_SERIAL_EXT_RADIO // External Radio 683 #ifdef CONF_BOARD_SERIAL_ATWINC_BLE // ATWINC3400 Bluetooth 691 #ifdef CONF_BOARD_SERIAL_SP330 // RS232/RS422/RS485 converter 700 #ifdef CONF_BOARD_SERIAL_GPIO_H8 // GPIO TTL 714 #ifdef CONF_BOARD_SPI_ATWINC_WIFI // ATWINC WIFI 728 #ifdef CONF_BOARD_I2C_UINS // UINS I2C 733 #ifdef CONF_BOARD_CAN1 741 #ifdef CONF_BOARD_SD_MMC_HSMCI 760 #ifdef CONF_BOARD_TWIHS0 765 #ifdef CONF_BOARD_CAN0 774 #ifdef CONF_BOARD_SPI 779 #ifdef CONF_BOARD_SPI_NPCS0 783 #ifdef CONF_BOARD_SPI_NPCS1 788 #ifdef CONF_BOARD_QSPI 797 #ifdef CONF_BOARD_PWM_LED0 802 #ifdef CONF_BOARD_PWM_LED1 807 #ifdef CONF_BOARD_USART_SCK 812 #ifdef CONF_BOARD_USART_CTS 817 #ifdef CONF_BOARD_USART_RTS 822 #ifdef CONF_BOARD_ILI9488 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);
836 #if (defined CONF_BOARD_USB_PORT) 837 # if defined(CONF_BOARD_USB_VBUS_DETECT) 840 # if defined(CONF_BOARD_USB_ID_DETECT) 845 #ifdef CONF_BOARD_SDRAMC 886 #ifdef CONF_BOARD_ILI9488 #define SPI_WIFI_MOSI_FLAGS
#define UART_INS_SER0_TXD_PIN
#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...
void board_IO_config(void)
#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 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
#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.
#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 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 ...
#define IFLASH_END_ADDRESS
void refresh_CFG_LED(void)
#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
#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