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_CPU_FREQ (480000000UL) 25 26 #define GPIOA(pin) (pin) 27 #define GPIOB(pin) (pin + 32) 28 #define GPIOC(pin) (pin + 32 * 2) 29 #define GPIOD(pin) (pin + 32 * 3) 30 #define GPIOE(pin) (pin + 32 * 4) 31 #define GPIOF(pin) (pin + 32 * 5) 32 #define GPIOY(pin) (pin + 32 * 14) 33 #define GPIOZ(pin) (pin + 32 * 15) 34 35 /* enet section */ 36 #define BOARD_ENET_PPS HPM_ENET0 37 #define BOARD_ENET_PPS_IDX enet_pps_0 38 #define BOARD_ENET_PPS_PTP_CLOCK clock_ptp0 39 40 #define BOARD_ENET_RMII HPM_ENET0 41 #define BOARD_ENET_RMII_RST_GPIO 42 #define BOARD_ENET_RMII_RST_GPIO_INDEX 43 #define BOARD_ENET_RMII_RST_GPIO_PIN 44 #define BOARD_ENET_RMII HPM_ENET0 45 #define BOARD_ENET_RMII_INT_REF_CLK (1U) 46 #define BOARD_ENET_RMII_PTP_CLOCK (clock_ptp0) 47 #define BOARD_ENET_RMII_PPS0_PINOUT (1) 48 49 #define TEST_APP_I2C_CLK_NAME clock_i2c0 50 51 #define BOARD_GPIO_IN_IRQ_TASK_GPIO1 GPIOZ(02) 52 #define BOARD_GPIO_IN_IRQ_TASK_GPIO2 GPIOZ(03) 53 54 #define BOARD_GPIO_OUT_TASK_GPIO1 GPIOA(7) 55 #define BOARD_GPIO_OUT_TASK_GPIO2 GPIOA(8) 56 #define BOARD_GPIO_OUT_TASK_GPIO3 GPIOA(9) 57 58 #define spi_device_num (3) 59 #define I2C_BUS_NUM (0) 60 #define TEST_I2C_CLOCK_NAME clock_i2c0 61 62 void board_init(void); 63 void board_print_clock_freq(void); 64 void board_print_banner(void); 65 66 hpm_stat_t board_reset_enet_phy(ENET_Type *ptr); 67 hpm_stat_t board_init_enet_pins(ENET_Type *ptr); 68 hpm_stat_t board_init_enet_rmii_reference_clock(ENET_Type *ptr, bool internal); 69 hpm_stat_t board_init_enet_rgmii_clock_delay(ENET_Type *ptr); 70 hpm_stat_t board_init_enet_ptp_clock(ENET_Type *ptr); 71 void init_gpio_pins(void); 72 void init_gpio_out_task_pins(void); 73 void init_i2c_pins(I2C_Type *ptr); 74 void init_spi_pins(SPI_Type *ptr); 75 76 #if defined(__cplusplus) 77 } 78 #endif /* __cplusplus */ 79 #endif /* _HPM_BOARD_H */ 80