forked from riscv-mcu/hbird-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SoC: Add sw drivers for hbirdv2 peripheral
- Loading branch information
Showing
13 changed files
with
728 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,28 @@ | ||
// See LICENSE for license details. | ||
#ifndef _HBIRD_GPIO_H | ||
#define _HBIRD_GPIO_H | ||
#ifndef _HBIRDV2_GPIO_H | ||
#define _HBIRDV2_GPIO_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define GPIO_INPUT_VAL (0x00) | ||
#define GPIO_INPUT_EN (0x04) | ||
#define GPIO_OUTPUT_EN (0x08) | ||
#define GPIO_OUTPUT_VAL (0x0C) | ||
#define GPIO_PULLUP_EN (0x10) | ||
#define GPIO_DRIVE (0x14) | ||
#define GPIO_RISE_IE (0x18) | ||
#define GPIO_RISE_IP (0x1C) | ||
#define GPIO_FALL_IE (0x20) | ||
#define GPIO_FALL_IP (0x24) | ||
#define GPIO_HIGH_IE (0x28) | ||
#define GPIO_HIGH_IP (0x2C) | ||
#define GPIO_LOW_IE (0x30) | ||
#define GPIO_LOW_IP (0x34) | ||
#define GPIO_IOF_EN (0x38) | ||
#define GPIO_IOF_SEL (0x3C) | ||
#define GPIO_OUTPUT_XOR (0x40) | ||
|
||
typedef enum iof_func { | ||
IOF_SEL_GPIO = 0, | ||
IOF_SEL_0 = 1, | ||
IOF_SEL_1 = 2 | ||
} IOF_FUNC; | ||
|
||
typedef enum gpio_int_type { | ||
GPIO_INT_RISE = 0, | ||
GPIO_INT_FALL = 1, | ||
GPIO_INT_HIGH = 2, | ||
GPIO_INT_LOW = 3 | ||
} GPIO_INT_TYPE; | ||
|
||
int32_t gpio_iof_config(GPIO_TypeDef *gpio, uint32_t mask, IOF_FUNC func); | ||
int32_t gpio_enable_output(GPIO_TypeDef *gpio, uint32_t mask); | ||
int32_t gpio_enable_input(GPIO_TypeDef *gpio, uint32_t mask); | ||
int32_t gpio_write(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value); | ||
int32_t gpio_toggle(GPIO_TypeDef *gpio, uint32_t mask); | ||
int32_t gpio_read(GPIO_TypeDef *gpio, uint32_t mask); | ||
int32_t gpio_set_pue(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value); | ||
int32_t gpio_set_ds(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value); | ||
int32_t gpio_set_outxor(GPIO_TypeDef *gpio, uint32_t mask, uint32_t value); | ||
int32_t gpio_enable_interrupt(GPIO_TypeDef *gpio, uint32_t mask, GPIO_INT_TYPE type); | ||
int32_t gpio_disable_interrupt(GPIO_TypeDef *gpio, uint32_t mask, GPIO_INT_TYPE type); | ||
int32_t gpio_clear_interrupt(GPIO_TypeDef *gpio, uint32_t mask, GPIO_INT_TYPE type); | ||
int32_t gpio_disable_interrupt(GPIO_TypeDef *gpio, uint32_t mask); | ||
int32_t gpio_clear_interrupt(GPIO_TypeDef *gpio, uint32_t mask); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif /* _HBIRD_GPIO_H */ | ||
#endif /* _HBIRDV2_GPIO_H */ |
Oops, something went wrong.