paul@205 | 1 | #ifndef __TASK_GPIO_H__ |
paul@205 | 2 | #define __TASK_GPIO_H__ |
paul@205 | 3 | |
paul@205 | 4 | #include "memory.h" |
paul@205 | 5 | #include "xburst_types.h" |
paul@205 | 6 | |
paul@205 | 7 | /* Special task versions of GPIO operations. */ |
paul@205 | 8 | |
paul@205 | 9 | #define TASK_GPIO_PXPIN(n) (TASK_GPIO_BASE + (0x00 + (n)*0x100)) /* PIN Level Register */ |
paul@205 | 10 | #define TASK_GPIO_PXDAT(n) (TASK_GPIO_BASE + (0x10 + (n)*0x100)) /* Port Data Register */ |
paul@205 | 11 | #define TASK_GPIO_PXDATS(n) (TASK_GPIO_BASE + (0x14 + (n)*0x100)) /* Port Data Set Register */ |
paul@205 | 12 | #define TASK_GPIO_PXDATC(n) (TASK_GPIO_BASE + (0x18 + (n)*0x100)) /* Port Data Clear Register */ |
paul@205 | 13 | |
paul@211 | 14 | #define TASK_GPIO_PXDIR(n) (TASK_GPIO_BASE + (0x60 + (n)*0x100)) /* Direction Register */ |
paul@211 | 15 | #define TASK_GPIO_PXDIRS(n) (TASK_GPIO_BASE + (0x64 + (n)*0x100)) /* Direction Set Register */ |
paul@211 | 16 | #define TASK_GPIO_PXDIRC(n) (TASK_GPIO_BASE + (0x68 + (n)*0x100)) /* Direction Clear Register */ |
paul@211 | 17 | |
paul@211 | 18 | #define TASK_REG_GPIO_PXPIN(n) REG32(TASK_GPIO_PXPIN((n))) |
paul@211 | 19 | #define TASK_REG_GPIO_PXDAT(n) REG32(TASK_GPIO_PXDAT((n))) |
paul@205 | 20 | #define TASK_REG_GPIO_PXDATS(n) REG32(TASK_GPIO_PXDATS((n))) |
paul@205 | 21 | #define TASK_REG_GPIO_PXDATC(n) REG32(TASK_GPIO_PXDATC((n))) |
paul@205 | 22 | |
paul@211 | 23 | #define TASK_REG_GPIO_PXDIR(n) REG32(TASK_GPIO_PXDIR((n))) |
paul@211 | 24 | #define TASK_REG_GPIO_PXDIRS(n) REG32(TASK_GPIO_PXDIRS((n))) |
paul@211 | 25 | #define TASK_REG_GPIO_PXDIRC(n) REG32(TASK_GPIO_PXDIRC((n))) |
paul@211 | 26 | |
paul@217 | 27 | void task_gpio_init(uint8_t task); |
paul@217 | 28 | void task_gpio_as_input(uint8_t pin); |
paul@217 | 29 | void task_gpio_as_output(uint8_t pin); |
paul@217 | 30 | void task_gpio_set_pin(uint8_t pin); |
paul@217 | 31 | void task_gpio_clear_pin(uint8_t pin); |
paul@217 | 32 | int task_gpio_get_pin(uint8_t pin); |
paul@205 | 33 | |
paul@205 | 34 | #endif /* __TASK_GPIO_H__ */ |