1 /*
2  * Copyright (c) 2021 hpmicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef _RTT_BOARD_H
9 #define _RTT_BOARD_H
10 #include "hpm_common.h"
11 #include "hpm_soc.h"
12 
13 /* gpio section */
14 #define APP_LED0_GPIO_CTRL HPM_GPIO0
15 #define APP_LED0_GPIO_INDEX GPIO_DI_GPIOF
16 #define APP_LED0_GPIO_PIN 1
17 #define APP_LED1_GPIO_CTRL HPM_GPIO0
18 #define APP_LED1_GPIO_INDEX GPIO_DI_GPIOF
19 #define APP_LED1_GPIO_PIN 2
20 #define APP_LED2_GPIO_CTRL HPM_GPIO0
21 #define APP_LED2_GPIO_INDEX GPIO_DI_GPIOF
22 #define APP_LED2_GPIO_PIN 5
23 #define APP_LED_ON (1)
24 #define APP_LED_OFF (0)
25 
26 
27 
28 /* mchtimer section */
29 #define BOARD_MCHTMR_FREQ_IN_HZ (24000000UL)
30 
31 /* CAN section */
32 #define BOARD_CAN_NAME                        "can3"
33 #define BOARD_CAN_HWFILTER_INDEX               (3U)
34 
35 /* UART section */
36 #define BOARD_UART_NAME                        "uart3"
37 #define BOARD_UART_RX_BUFFER_SIZE              BSP_UART3_RX_BUFSIZE
38 
39 /* eeprom section */
40 #define BOARD_EEPROM_I2C_NAME                  "i2c1"
41 
42 #define BOARD_SD_NAME                          "sd1"
43 /* audio section */
44 #define BOARD_AUDIO_CODEC_I2C_NAME             "i2c3"
45 #define BOARD_AUDIO_CODEC_I2S_NAME             "i2s3"
46 
47 #define IRQn_PendSV IRQn_DEBUG0
48 
49 /***************************************************************
50  *
51  * RT-Thread related definitions
52  *
53  **************************************************************/
54 extern unsigned int __heap_start__;
55 extern unsigned int __heap_end__;
56 
57 #define RT_HW_HEAP_BEGIN ((void*)&__heap_start__)
58 #define RT_HW_HEAP_END ((void*)&__heap_end__)
59 
60 
61 typedef struct {
62     uint16_t vdd;
63     uint8_t bus_width;
64     uint8_t drive_strength;
65 }sdxc_io_cfg_t;
66 
67 
68 #if defined(__cplusplus)
69 extern "C" {
70 #endif /* __cplusplus */
71 
72 
73 void app_init_led_pins(void);
74 void app_led_write(uint32_t index, bool state);
75 void app_init_usb_pins(void);
76 
77 #if defined(__cplusplus)
78 }
79 #endif /* __cplusplus */
80 #endif /* _RTT_BOARD_H */
81