76 lines
3.6 KiB
C
76 lines
3.6 KiB
C
|
|
|
|
#ifndef __QL_BOOT_GPIO_H__
|
|
#define __QL_BOOT_GPIO_H__
|
|
|
|
|
|
typedef enum GPIO_PIN_NUMBER_ENUM
|
|
{
|
|
GPIO_PIN_NO_NOT_ASSIGNED = -1,
|
|
|
|
GPIO_PIN_NO_0=0,GPIO_PIN_NO_1, GPIO_PIN_NO_2, GPIO_PIN_NO_3, GPIO_PIN_NO_4, GPIO_PIN_NO_5, GPIO_PIN_NO_6, GPIO_PIN_NO_7,
|
|
GPIO_PIN_NO_8, GPIO_PIN_NO_9, GPIO_PIN_NO_10, GPIO_PIN_NO_11, GPIO_PIN_NO_12, GPIO_PIN_NO_13, GPIO_PIN_NO_14, GPIO_PIN_NO_15,
|
|
GPIO_PIN_NO_16, GPIO_PIN_NO_17, GPIO_PIN_NO_18, GPIO_PIN_NO_19, GPIO_PIN_NO_20, GPIO_PIN_NO_21, GPIO_PIN_NO_22, GPIO_PIN_NO_23,
|
|
GPIO_PIN_NO_24, GPIO_PIN_NO_25, GPIO_PIN_NO_26, GPIO_PIN_NO_27, GPIO_PIN_NO_28, GPIO_PIN_NO_29, GPIO_PIN_NO_30, GPIO_PIN_NO_31,
|
|
GPIO_PIN_NO_32, GPIO_PIN_NO_33, GPIO_PIN_NO_34, GPIO_PIN_NO_35, GPIO_PIN_NO_36, GPIO_PIN_NO_37, GPIO_PIN_NO_38, GPIO_PIN_NO_39,
|
|
GPIO_PIN_NO_40, GPIO_PIN_NO_41, GPIO_PIN_NO_42, GPIO_PIN_NO_43, GPIO_PIN_NO_44, GPIO_PIN_NO_45, GPIO_PIN_NO_46, GPIO_PIN_NO_47,
|
|
GPIO_PIN_NO_48, GPIO_PIN_NO_49, GPIO_PIN_NO_50, GPIO_PIN_NO_51, GPIO_PIN_NO_52, GPIO_PIN_NO_53, GPIO_PIN_NO_54, GPIO_PIN_NO_55,
|
|
GPIO_PIN_NO_56, GPIO_PIN_NO_57, GPIO_PIN_NO_58, GPIO_PIN_NO_59, GPIO_PIN_NO_60, GPIO_PIN_NO_61, GPIO_PIN_NO_62, GPIO_PIN_NO_63,
|
|
|
|
GPIO_PIN_NO_64, GPIO_PIN_NO_65, GPIO_PIN_NO_66, GPIO_PIN_NO_67, GPIO_PIN_NO_68, GPIO_PIN_NO_69, GPIO_PIN_NO_70, GPIO_PIN_NO_71,
|
|
GPIO_PIN_NO_72, GPIO_PIN_NO_73, GPIO_PIN_NO_74, GPIO_PIN_NO_75, GPIO_PIN_NO_76, GPIO_PIN_NO_77, GPIO_PIN_NO_78, GPIO_PIN_NO_79,
|
|
GPIO_PIN_NO_80, GPIO_PIN_NO_81, GPIO_PIN_NO_82, GPIO_PIN_NO_83, GPIO_PIN_NO_84, GPIO_PIN_NO_85, GPIO_PIN_NO_86, GPIO_PIN_NO_87,
|
|
GPIO_PIN_NO_88, GPIO_PIN_NO_89, GPIO_PIN_NO_90, GPIO_PIN_NO_91, GPIO_PIN_NO_92, GPIO_PIN_NO_93, GPIO_PIN_NO_94, GPIO_PIN_NO_95,
|
|
GPIO_PIN_NO_96, GPIO_PIN_NO_97, GPIO_PIN_NO_98, GPIO_PIN_NO_99, GPIO_PIN_NO_100, GPIO_PIN_NO_101, GPIO_PIN_NO_102, GPIO_PIN_NO_103,
|
|
GPIO_PIN_NO_104, GPIO_PIN_NO_105, GPIO_PIN_NO_106, GPIO_PIN_NO_107, GPIO_PIN_NO_108, GPIO_PIN_NO_109, GPIO_PIN_NO_110, GPIO_PIN_NO_111,
|
|
GPIO_PIN_NO_112, GPIO_PIN_NO_113, GPIO_PIN_NO_114, GPIO_PIN_NO_115, GPIO_PIN_NO_116, GPIO_PIN_NO_117, GPIO_PIN_NO_118, GPIO_PIN_NO_119,
|
|
GPIO_PIN_NO_120, GPIO_PIN_NO_121, GPIO_PIN_NO_122, GPIO_PIN_NO_123, GPIO_PIN_NO_124, GPIO_PIN_NO_125, GPIO_PIN_NO_126, GPIO_PIN_NO_127,
|
|
GPIO_MAX_AMOUNT_OF_PINS,
|
|
}GPIO_PIN_NUMBER_E;
|
|
|
|
typedef enum PIN_DIRECTION_ENUM
|
|
{
|
|
PIN_DIRECTION_IN = 0,
|
|
PIN_DIRECTION_OUT,
|
|
}PIN_DIRECTION_E;
|
|
|
|
typedef enum PIN_LEVEL_ENUM {
|
|
PIN_LEVEL_LOW = 0,
|
|
PIN_LEVEL_HIGH,
|
|
}PIN_LEVEL_E;
|
|
|
|
typedef enum PIN_PULL_ENUM {
|
|
PIN_PULL_DISABLE = 0,
|
|
PIN_PULL_PU,
|
|
PIN_PULL_PD,
|
|
}PIN_PULL_E;
|
|
|
|
typedef enum PIN_EDGE_ENUM {
|
|
PIN_NO_EDGE = 0,
|
|
PIN_RISING_EDGE,
|
|
PIN_FALLING_EDGE,
|
|
PIN_BOTH_EDGE,
|
|
}PIN_EDGE_E;
|
|
|
|
typedef struct quec_gpio_cfg_struct {
|
|
GPIO_PIN_NUMBER_E gpio_pin_num;
|
|
PIN_DIRECTION_E pin_dir;
|
|
PIN_EDGE_E pin_edge;
|
|
PIN_PULL_E pin_pull;
|
|
PIN_LEVEL_E pin_level;
|
|
}quec_gpio_cfg_t;
|
|
|
|
int ql_gpio_init(GPIO_PIN_NUMBER_E gpio_num, PIN_DIRECTION_E pin_dir, PIN_PULL_E pin_pull, PIN_LEVEL_E pin_level);
|
|
int ql_gpio_set_level(GPIO_PIN_NUMBER_E gpio_num, PIN_LEVEL_E pin_level);
|
|
int ql_gpio_get_level(GPIO_PIN_NUMBER_E gpio_num, PIN_LEVEL_E *p_pin_level);
|
|
int ql_gpio_set_direction(GPIO_PIN_NUMBER_E gpio_num, PIN_DIRECTION_E pin_dir);
|
|
int ql_gpio_get_direction(GPIO_PIN_NUMBER_E gpio_num, PIN_DIRECTION_E *p_pin_dir);
|
|
int ql_gpio_set_pull(GPIO_PIN_NUMBER_E gpio_num, PIN_PULL_E pin_pull);
|
|
int ql_gpio_get_pull(GPIO_PIN_NUMBER_E gpio_num, PIN_PULL_E *p_pin_pull);
|
|
UINT32 GPIO_MFPR_ADDR(UINT32 n) ;
|
|
void quec_gpio_set_output(unsigned int port);
|
|
__inline void quec_gpio_set_value(unsigned int port, int value);
|
|
|
|
#endif
|
|
|