2014-04-22 15:51:28 +01:00
|
|
|
/*
|
|
|
|
|
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
|
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
|
* a copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
* the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-04-29 15:01:24 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
|
2014-04-10 11:04:02 +01:00
|
|
|
#include "maa.h"
|
2014-04-29 15:01:24 +01:00
|
|
|
#include "gpio.h"
|
2014-04-28 00:29:14 +01:00
|
|
|
#include "version.h"
|
2014-04-08 18:43:26 +01:00
|
|
|
|
2014-04-29 15:01:24 +01:00
|
|
|
static maa_pininfo* pindata;
|
|
|
|
|
|
2014-04-28 00:29:14 +01:00
|
|
|
const char *
|
2014-04-27 21:17:54 +01:00
|
|
|
maa_get_version()
|
2014-04-08 18:43:26 +01:00
|
|
|
{
|
2014-04-28 00:29:14 +01:00
|
|
|
return gVERSION;
|
2014-04-08 18:43:26 +01:00
|
|
|
}
|
2014-04-29 15:01:24 +01:00
|
|
|
|
|
|
|
|
maa_result_t
|
|
|
|
|
maa_init()
|
|
|
|
|
{
|
|
|
|
|
return MAA_ERROR_FEATURE_NOT_IMPLEMENTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
maa_check_gpio(int pin){
|
|
|
|
|
|
|
|
|
|
if(pindata == NULL) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
//Check in gpio bounds?
|
|
|
|
|
if(pindata[pin].mux_total > 0) {
|
|
|
|
|
int mi;
|
|
|
|
|
for(mi = 0; mi < pindata[pin].mux_total; mi++) {
|
|
|
|
|
//Do we want to keep the gpio object around
|
|
|
|
|
//I dont think so
|
|
|
|
|
maa_gpio_context* mux_i;
|
|
|
|
|
//TODO CHANGE TO RAW
|
|
|
|
|
mux_i = maa_gpio_init(pindata[pin].mux[mi].pin);
|
|
|
|
|
maa_gpio_dir(mux_i, "out");
|
|
|
|
|
maa_gpio_write(mux_i, pindata[pin].mux[mi].value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return pindata[pin].pin
|
|
|
|
|
}
|
|
|
|
|
|