]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/T-HEAD_CB2201_CDK/csi/csi_driver/csky/hobbit1_2/include/pinmux.h
Introduce a port for T-HEAD CK802. A simple demo for T-HEAD CB2201 is also included.
[freertos] / FreeRTOS / Demo / T-HEAD_CB2201_CDK / csi / csi_driver / csky / hobbit1_2 / include / pinmux.h
1 /*
2  * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /******************************************************************************
18  * @file     pinmux.h
19  * @brief    Header file for the pinmux
20  * @version  V1.0
21  * @date     23. August 2017
22  ******************************************************************************/
23 #ifndef HOBBIT1_2_PINMUX_H
24 #define HOBBIT1_2_PINMUX_H
25
26 #include <stdint.h>
27 #include "pin_name.h"
28
29 void hobbit_ioreuse_initial(void);
30 int32_t pin_mux(pin_name_t pin, uint16_t function);
31
32 /*IOMUX0L function definition */
33
34
35 /* IOMUX0H function definition */
36
37 #define PA16_UART1_RX     0x00010000
38 #define PA17_UART1_TX     0x00020000
39
40
41 #define PA20_UART1_RX       0x00020000
42 #define PA21_UART1_TX       0x00080000
43
44 //use for spi eth
45 #define PA3_SPI0MOSI        0x00000080
46 #define PA2_SPI0MISO        0x00000020
47 #define PA4_SPI0SCK         0x00000200
48 #define PA5_SPI0SSN         0x00000800
49
50 #define PA23_SPI1MOSI     0x00800000
51 #define PA22_SPI1MISO     0x00400000
52 #define PA21_SPI1SCK      0x00200000
53 #define PA18_SPI1SSN0     0x00040000
54
55
56
57
58 /* IOMUX1L function definition */
59
60 /* flag as identification */
61 #define GPIO_SET_BIT0  0x00000001
62 #define GPIO_SET_BIT1  0x00000002
63 #define GPIO_SET_BIT2  0x00000004
64 #define GPIO_SET_BIT3  0x00000008
65 #define GPIO_SET_BIT4  0x00000010
66 #define GPIO_SET_BIT5  0x00000020
67 #define GPIO_SET_BIT6  0x00000040
68 #define GPIO_SET_BIT7  0x00000080
69 #define GPIO_SET_BIT8  0x00000100
70 #define GPIO_SET_BIT9  0x00000200
71 #define GPIO_SET_BIT10 0x00000400
72 #define GPIO_SET_BIT11 0x00000800
73 #define GPIO_SET_BIT12 0x00001000
74 #define GPIO_SET_BIT13 0x00002000
75 #define GPIO_SET_BIT14 0x00004000
76 #define GPIO_SET_BIT15 0x00008000
77 #define GPIO_SET_BIT16 0x00010000
78 #define GPIO_SET_BIT17 0x00020000
79 #define GPIO_SET_BIT18 0x00040000
80 #define GPIO_SET_BIT19 0x00080000
81 #define GPIO_SET_BIT20 0x00100000
82 #define GPIO_SET_BIT21 0x00200000
83 #define GPIO_SET_BIT22 0x00400000
84 #define GPIO_SET_BIT23 0x00800000
85 #define GPIO_SET_BIT24 0x01000000
86 #define GPIO_SET_BIT25 0x02000000
87 #define GPIO_SET_BIT26 0x04000000
88 #define GPIO_SET_BIT27 0x08000000
89 #define GPIO_SET_BIT28 0x10000000
90 #define GPIO_SET_BIT29 0x20000000
91 #define GPIO_SET_BIT30 0x40000000
92 #define GPIO_SET_BIT31 0x80000000
93
94
95
96
97 /******************************************************************************
98  * hobbit1_2 gpio control and gpio reuse function
99  * selecting regester adddress
100  ******************************************************************************/
101
102 #define HOBBIT1_2_GIPO0_PORTCTL_REG 0x50006008
103 #define HOBBIT1_2_GIPO1_PORTCTL_REG 0x50009008
104 #define HOBBIT1_2_IOMUX0L_REG       0x50006100
105 #define HOBBIT1_2_IOMUX0H_REG       0x50006104
106 #define HOBBIT1_2_IOMUX1L_REG       0x50006108
107
108
109 /*************basic gpio reuse v1.0********************************************
110  * UART1(PA16,PA17) for bootrom
111  * UART1(PA20,PA21) for console
112  ******************************************************************************/
113 #define GPIO0_REUSE_EN                (0x00000000)
114 #define GPIO0_REUSE_DIS               (GPIO_SET_BIT16 | GPIO_SET_BIT17)
115
116 #define GPIO1_REUSE_EN                (0x00000000)
117 #define IOMUX0L_FUNCTION_SEL          (0x00000000)
118 #define IOMUX0H_FUNCTION_SEL          (0x00000000)
119 #define IOMUX1L_FUNCTION_SEL          (0x00000000)
120
121 #endif /* HOBBIT_PINMUX_H */
122