• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
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 __DUET_PINMUX_H
17 #define __DUET_PINMUX_H
18 
19 #include "duet.h"
20 
21 #ifdef __cplusplus
22 extern "c" {
23 #endif
24 
25     typedef enum {
26         PAD0,
27         PAD1,
28         PAD2,
29         PAD3,
30         PAD4,
31         PAD5,
32         PAD6,
33         PAD7,
34         PAD8,
35         PAD9,
36         PAD10,
37         PAD11,
38         PAD12,
39         PAD13,
40         PAD14,
41         PAD15,
42         PAD16,
43         PAD17,
44         PAD18,
45         PAD19,
46         PAD20,
47         PAD21,
48         PAD22,
49         PAD23,
50         PAD24,
51         PAD25,
52         PAD26,
53         PAD27,
54         PAD28,
55         PAD29,
56         PAD30
57     } Pad_Num_Type;
58 
59     typedef enum {
60         PF_GPIO0, PF_GPIO1, PF_GPIO2, PF_GPIO3, PF_GPIO4, PF_GPIO5,
61         PF_GPIO6, PF_GPIO7, PF_GPIO8, PF_GPIO9, PF_GPIO10, PF_GPIO11,
62         PF_GPIO12, PF_GPIO13, PF_GPIO14, PF_GPIO15, PF_GPIO16, PF_GPIO17,
63         PF_GPIO18, PF_GPIO19, PF_GPIO20, PF_GPIO21, PF_GPIO22, PF_GPIO23,
64         PF_SWD,
65         PF_UART0, PF_UART1, PF_UART2, PF_UART3,
66         PF_SPI0,  PF_SPI1,  PF_SPI2,
67         PF_PWM0,  PF_PWM1,  PF_PWM2,  PF_PWM3,  PF_PWM4, PF_PWM5, PF_PWM6, PF_PWM7,
68         PF_I2C0,  PF_I2C1,
69         PF_SDIO0,
70         PF_I2S,
71         PF_PSRAM
72     } Pad_Func_Type;
73 
74     typedef enum {
75         Config_Success,
76         Config_Fail
77     } Pad_Config_State;
78 
79     typedef enum {
80         PULL_DEFAULT = 0x00,
81         PULL_UP,
82         PULL_DOWN,
83         PULL_NONE
84     } Pad_Pull_Type;
85 
86     typedef enum {
87         DS1DS0_00 = 0x00,
88         DS1DS0_01,
89         DS1DS0_10,
90         DS1DS0_11
91     } Pad_DS_Type;
92 
93     Pad_Config_State duet_pinmux_config(Pad_Num_Type pad_num, Pad_Func_Type pad_func);
94     void duet_pad_config(Pad_Num_Type pad_num, Pad_Pull_Type pull_type);
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif /* __DUET_PINMUX_H */