• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /* I2C function*/
25 #define BOARD_CPU_FREQ (480000000UL)
26 #define TEST_APP_I2C_CLK_NAME clock_i2c0
27 
28 #define GPIOA(pin) (pin)
29 #define GPIOB(pin) (pin + 32)
30 #define GPIOC(pin) (pin + 32 * 2)
31 #define GPIOD(pin) (pin + 32 * 3)
32 #define GPIOE(pin) (pin + 32 * 4)
33 #define GPIOF(pin) (pin + 32 * 5)
34 #define GPIOY(pin) (pin + 32 * 14)
35 #define GPIOZ(pin) (pin + 32 * 15)
36 
37 /* SPI function*/
38 #define BOARD_APP_SPI_DATA_LEN_IN_BITS  (8U)
39 
40 #define BOARD_GPIO_IN_IRQ_TASK_GPIO1 GPIOZ(02)
41 #define BOARD_GPIO_IN_IRQ_TASK_GPIO2 GPIOZ(03)
42 
43 #define BOARD_GPIO_OUT_TASK_GPIO1 GPIOA(27)
44 #define BOARD_GPIO_OUT_TASK_GPIO2 GPIOB(01)
45 #define BOARD_GPIO_OUT_TASK_GPIO3 GPIOB(19)
46 
47 /*fix build error base on board*/
48 #define IOC_PZ02_FUNC_CTL_SOC_PZ_02 3
49 #define IOC_PZ03_FUNC_CTL_SOC_PZ_03 3
50 
51 #define spi_device_num (1)
52 #define I2C_BUS_NUM (0)
53 #define TEST_I2C_CLOCK_NAME clock_i2c0
54 
55 void board_init(void);
56 void board_print_clock_freq(void);
57 void board_print_banner(void);
58 void init_gpio_pins(void);
59 void init_gpio_out_task_pins(void);
60 void init_i2c_pins(I2C_Type *ptr);
61 void init_spi_pins(SPI_Type *ptr);
62 
63 #if defined(__cplusplus)
64 }
65 #endif /* __cplusplus */
66 #endif /* _HPM_BOARD_H */
67