1 /*
2  * SPDX-License-Identifier: Apache-2.0
3  * Copyright (c) 2024 sensry.io
4  */
5 
6 #ifndef GANYMED_SY1XX_PAD_CTRL_H
7 #define GANYMED_SY1XX_PAD_CTRL_H
8 
9 #define SY1XX_PAD_CONFIG(pin_offset, SMT, SLEW, PULLUP, PULLDOWN, DRV, PMOD, DIR)                  \
10 	(((SMT << 7) | (SLEW << 6) | (PULLUP << 5) | (PULLDOWN << 4) | (DRV << 2) | (PMOD << 1) |  \
11 	  DIR)                                                                                     \
12 	 << pin_offset)
13 
14 #define SY1XX_PAD_CONFIG_ADDR (SY1XX_ARCHI_SOC_PERIPHERALS_ADDR + SY1XX_ARCHI_APB_SOC_CTRL_OFFSET)
15 
16 #define SY1XX_PAD_CONFIG_ADDR_UART (SY1XX_PAD_CONFIG_ADDR + 0x020)
17 #define SY1XX_PAD_CONFIG_ADDR_SPI  (SY1XX_PAD_CONFIG_ADDR + 0x02c)
18 #define SY1XX_PAD_CONFIG_ADDR_I2C  (SY1XX_PAD_CONFIG_ADDR + 0x100)
19 #define SY1XX_PAD_CONFIG_ADDR_MAC  (SY1XX_PAD_CONFIG_ADDR + 0x130)
20 
21 #define SY1XX_PAD_SMT_DISABLE 0
22 #define SY1XX_PAD_SMT_ENABLE  1
23 
24 #define SY1XX_PAD_SLEW_LOW  0
25 #define SY1XX_PAD_SLEW_HIGH 1
26 
27 #define SY1XX_PAD_PULLUP_DIS 0
28 #define SY1XX_PAD_PULLUP_EN  1
29 
30 #define SY1XX_PAD_PULLDOWN_DIS 0
31 #define SY1XX_PAD_PULLDOWN_EN  1
32 
33 #define SY1XX_PAD_DRIVE_2PF  0
34 #define SY1XX_PAD_DRIVE_4PF  1
35 #define SY1XX_PAD_DRIVE_8PF  2
36 #define SY1XX_PAD_DRIVE_16PF 3
37 
38 #define SY1XX_PAD_PMOD_NORMAL   0
39 #define SY1XX_PAD_PMOD_TRISTATE 1
40 
41 #define SY1XX_PAD_DIR_OUTPUT 0
42 #define SY1XX_PAD_DIR_INPUT  1
43 
44 #endif /* GANYMED_SY1XX_PAD_CTRL_H */
45