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

@@ -42,6 +42,9 @@ maa_get_version()
maa_result_t
maa_init()
{
/** Once more board definitions have been added,
* A method for detecting them will need to be devised.
*/
plat = maa_intel_galileo_rev_d();
return MAA_SUCCESS;
}
@@ -50,14 +53,14 @@ static maa_result_t
maa_setup_mux_mapped(maa_pininfo_t meta)
{
int mi;
for(mi = 0; mi < meta.mux_total; mi++) {
for (mi = 0; mi < meta.mux_total; mi++) {
maa_gpio_context* mux_i;
mux_i = maa_gpio_init_raw(meta.mux[mi].pin);
if(mux_i == NULL)
if (mux_i == NULL)
return MAA_ERROR_INVALID_HANDLE;
if(maa_gpio_dir(mux_i, MAA_GPIO_OUT) != MAA_SUCCESS)
if (maa_gpio_dir(mux_i, MAA_GPIO_OUT) != MAA_SUCCESS)
return MAA_ERROR_INVALID_RESOURCE;
if(maa_gpio_write(mux_i, meta.mux[mi].value) != MAA_SUCCESS)
if (maa_gpio_write(mux_i, meta.mux[mi].value) != MAA_SUCCESS)
return MAA_ERROR_INVALID_RESOURCE;
}
return MAA_SUCCESS;
@@ -66,14 +69,31 @@ maa_setup_mux_mapped(maa_pininfo_t meta)
unsigned int
maa_check_gpio(int pin)
{
if(plat == NULL)
if (plat == NULL)
return -1;
if(pin < 0 || pin > plat->gpio_count)
if (pin < 0 || pin > plat->gpio_count)
return -1;
if(plat->pins[pin].mux_total > 0)
if(maa_setup_mux_mapped(plat->pins[pin]) != MAA_SUCCESS)
if (plat->pins[pin].mux_total > 0)
if (maa_setup_mux_mapped(plat->pins[pin]) != MAA_SUCCESS)
return -1;
return plat->pins[pin].pin;
}
unsigned int
maa_check_aio(int aio)
{
if (plat == NULL)
return -3;
if (aio < 0 || aio > plat->aio_count)
return -1;
int pin = aio + plat->gpio_count;
if (plat->pins[pin].mux_total > 0)
if (maa_setup_mux_mapped(plat->pins[pin]) != MAA_SUCCESS)
return -2;
return plat->pins[pin].pin;
}