NanoPayload

Annotated stage2/task_gpio.h

205:a95d655275ac
2016-10-03 Paul Boddie Added initial support for task-based GPIO access.
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@205 14
#define TASK_REG_GPIO_PXPIN(n)	REG32(TASK_GPIO_PXPIN((n)))  /* PIN level */
paul@205 15
#define TASK_REG_GPIO_PXDAT(n)	REG32(TASK_GPIO_PXDAT((n)))  /* 1: interrupt pending */
paul@205 16
#define TASK_REG_GPIO_PXDATS(n)	REG32(TASK_GPIO_PXDATS((n)))
paul@205 17
#define TASK_REG_GPIO_PXDATC(n)	REG32(TASK_GPIO_PXDATC((n)))
paul@205 18
paul@205 19
void task_gpio_init(unsigned short task);
paul@205 20
void task_gpio_set_pin(unsigned short pin);
paul@205 21
void task_gpio_clear_pin(unsigned short pin);
paul@205 22
int task_gpio_get_pin(unsigned short pin);
paul@205 23
paul@205 24
#endif /* __TASK_GPIO_H__ */