Private
Public Access
2
0

pinmap: Added aio support.

* Intel Galileo Rev D: Added analog information
* maa_check_aio, similar to maa_check_gpio, will setup multiplexers.
* aio: Removed now duplicated functionality.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-05-02 11:52:40 +01:00
parent 9878b2e419
commit fd1c1c80f4
6 changed files with 187 additions and 127 deletions

View File

@@ -54,41 +54,86 @@ typedef enum {
MAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
} maa_result_t;
/**
* MAA boolean type
* 1 For TRUE
*/
typedef unsigned int maa_boolean_t;
/**
* A bitfield representing the capabilities of a pin.
*/
typedef struct {
maa_boolean_t valid:1;
maa_boolean_t gpio:1;
maa_boolean_t pwm:1;
maa_boolean_t fast_gpio:1;
maa_boolean_t spi:1;
maa_boolean_t i2c:1;
}
maa_pincapabilities_t;
/*@{*/
maa_boolean_t valid:1; /**< Is the pin valid at all */
maa_boolean_t gpio:1; /**< Is the pin gpio capable */
maa_boolean_t pwm:1; /**< Is the pin pwm capable */
maa_boolean_t fast_gpio:1; /**< Is the pin fast gpio capable */
maa_boolean_t spi:1; /**< Is the pin spi capable */
maa_boolean_t i2c:1; /**< Is the pin i2c capable */
maa_boolean_t aio:1; /**< Is the pin analog input capable */
/*@}*/
} maa_pincapabilities_t;
/**
* A Structure representing a multiplexer and the required value
*/
typedef struct {
unsigned int pin;
unsigned int value;
/*@{*/
unsigned int pin; /**< Raw GPIO pin id */
unsigned int value; /**< Raw GPIO value */
/*@}*/
} maa_mux_t;
/**
* A Structure representing a physical Pin.
*/
typedef struct {
char name[8];// do we need this
unsigned int pin;
int parent_id;
maa_pincapabilities_t capabilites;
maa_mux_t mux[4];
unsigned int mux_total;
/*@{*/
char name[8]; /**< Pin's real world name */
unsigned int pin; /**< Pin ID */
int parent_id; /**< IO Parent ID*/
maa_pincapabilities_t capabilites; /**< Pin Capabiliites */
maa_mux_t mux[4]; /**< Multiplexer array */
unsigned int mux_total; /**< Total Multiplexors required */
/*@}*/
} maa_pininfo_t;
/**
* A Structure representing a platform/board.
*/
typedef struct {
unsigned int gpio_count;
unsigned int aio_count;
unsigned int pwm_count;
maa_pininfo_t* pins;
/*@{*/
unsigned int gpio_count; /**< GPIO Count */
unsigned int aio_count; /**< Analog In Count */
unsigned int pwm_count; /**< PWM Count */
maa_pininfo_t* pins; /**< Pointer to pin array */
/*@}*/
} maa_board_t;
/** Initialise MAA
*
* Detects running platform and attempts to use included pinmap
* @return maa_result_t maa result
*/
maa_result_t maa_init();
/** Check GPIO
*
* Will check input is valid for gpio and will also setup required multiplexers.
* @param pin the pin as read from the board surface. i.e IO3 would be 3/
* @return the pin as found in the pinmap
*/
unsigned int maa_check_gpio(int pin);
//unsigned int maa_check_aio(int pin);
/** Check AIO
*
* Will check input is valid for aio and will also setup required multiplexers.
* @param pin the pin as read from the board surface. i.e A3 would be 3/
* @return the pin as found in the pinmap
*/
unsigned int maa_check_aio(int pin);
//unsigned int maa_check_pwm(int pin);
/** Get the version string of maa autogenerated from git tag