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 #define TEST_APP_I2C_CLK_NAME clock_i2c0 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 #define BOARD_GPIO_IN_IRQ_TASK_GPIO1 GPIOA(9) 37 #define BOARD_GPIO_IN_IRQ_TASK_GPIO2 GPIOA(10) 38 39 #define BOARD_GPIO_OUT_TASK_GPIO1 GPIOA(23) 40 #define BOARD_GPIO_OUT_TASK_GPIO2 GPIOA(25) 41 #define BOARD_GPIO_OUT_TASK_GPIO3 GPIOA(26) 42 43 #define spi_device_num (1) 44 #define I2C_BUS_NUM (0) 45 #define TEST_I2C_CLOCK_NAME clock_i2c0 46 47 void board_init(void); 48 void board_print_clock_freq(void); 49 void board_print_banner(void); 50 void init_gpio_pins(void); 51 void init_gpio_out_task_pins(void); 52 void init_i2c_pins(I2C_Type *ptr); 53 void init_spi_pins(SPI_Type *ptr); 54 55 #if defined(__cplusplus) 56 } 57 #endif /* __cplusplus */ 58 #endif /* _HPM_BOARD_H */ 59