1 /* 2 * Copyright (c) 2022 HPMicro 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _HPM_BOARD_H 17 #define _HPM_BOARD_H 18 #include <stdio.h> 19 #include "hpm_common.h" 20 #include "hpm_clock_drv.h" 21 #include "hpm_soc.h" 22 #include "hpm_soc_feature.h" 23 24 #define BOARD_NAME "hpm6800evk" 25 #define BOARD_CPU_FREQ (500000000UL) 26 27 #define GPIOA(pin) (pin) 28 #define GPIOB(pin) (pin + 32) 29 #define GPIOC(pin) (pin + 32 * 2) 30 #define GPIOD(pin) (pin + 32 * 3) 31 #define GPIOE(pin) (pin + 32 * 4) 32 #define GPIOF(pin) (pin + 32 * 5) 33 #define GPIOY(pin) (pin + 32 * 14) 34 #define GPIOZ(pin) (pin + 32 * 15) 35 36 /* enet section */ 37 #define BOARD_ENET_COUNT (1U) 38 #define BOARD_ENET_PPS HPM_ENET0 39 #define BOARD_ENET_PPS_IDX enet_pps_0 40 #define BOARD_ENET_PPS_PTP_CLOCK clock_ptp0 41 42 #define BOARD_ENET_RGMII_PHY_ITF enet_inf_rgmii 43 #define BOARD_ENET_RGMII_RST_GPIO HPM_GPIO0 44 #define BOARD_ENET_RGMII_RST_GPIO_INDEX GPIO_DO_GPIOD 45 #define BOARD_ENET_RGMII_RST_GPIO_PIN (18U) 46 #define BOARD_ENET_RGMII HPM_ENET0 47 #define BOARD_ENET_RGMII_TX_DLY (0U) 48 #define BOARD_ENET_RGMII_RX_DLY (0U) 49 #define BOARD_ENET_RGMII_PTP_CLOCK clock_ptp0 50 #define BOARD_ENET_RGMII_PPS0_PINOUT (1) 51 52 #define TEST_APP_I2C_CLK_NAME clock_i2c1 53 54 #define BOARD_GPIO_IN_IRQ_TASK_GPIO1 GPIOF(6) 55 #define BOARD_GPIO_IN_IRQ_TASK_GPIO2 GPIOF(7) 56 57 #define BOARD_GPIO_OUT_TASK_GPIO1 GPIOF(1) 58 #define BOARD_GPIO_OUT_TASK_GPIO2 GPIOF(2) 59 #define BOARD_GPIO_OUT_TASK_GPIO3 GPIOF(5) 60 61 #define spi_device_num (3) 62 #define I2C_BUS_NUM (1) 63 #define TEST_I2C_CLOCK_NAME clock_i2c0 64 65 void board_init(void); 66 void board_print_clock_freq(void); 67 void board_print_banner(void); 68 69 hpm_stat_t board_reset_enet_phy(ENET_Type *ptr); 70 hpm_stat_t board_init_enet_pins(ENET_Type *ptr); 71 hpm_stat_t board_init_enet_rmii_reference_clock(ENET_Type *ptr, bool internal); 72 hpm_stat_t board_init_enet_rgmii_clock_delay(ENET_Type *ptr); 73 hpm_stat_t board_init_enet_ptp_clock(ENET_Type *ptr); 74 void init_gpio_pins(void); 75 void init_gpio_out_task_pins(void); 76 void init_i2c_pins(I2C_Type *ptr); 77 void init_spi_pins(SPI_Type *ptr); 78 79 #if defined(__cplusplus) 80 } 81 #endif /* __cplusplus */ 82 #endif /* _HPM_BOARD_H */ 83