Private
Public Access
2
0

maa: hide and rename internal maa functions

Based on feedback received. All check functions renamed to setup.
Update all modules to use new name and header.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-05-21 13:17:16 +01:00
parent 0813271423
commit 2b8ab38418
7 changed files with 18 additions and 49 deletions

View File

@@ -184,43 +184,6 @@ maa_result_t maa_init() __attribute__((constructor));
maa_result_t maa_init();
#endif
/** 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);
/** 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);
/** Check i2c interface, sets up multiplexer on device.
*
* @return unsigned int if using /dev/i2c-2 returned would be 2
*/
unsigned int maa_check_i2c();
/** Check spi interface, sets up multiplexer on device.
*
* @return spi bus type
*/
maa_spi_bus_t* maa_check_spi(int bus);
/** Check PWM
*
* Will check input is valid for pwm and will also setup required multiplexers.
* IF the pin also does gpio (strong chance), DO NOTHING, REV D is strange.
* @param pin the pin as read from the board surface.
* @return the pwm pin_info_t of that IO pin
*/
maa_pin_t* maa_check_pwm(int pin);
/** Get the version string of maa autogenerated from git tag
*
* The version returned may not be what is expected however it is a reliable

View File

@@ -27,6 +27,7 @@
#include <errno.h>
#include "aio.h"
#include "maa_internal.h"
struct _aio {
unsigned int channel;
@@ -59,7 +60,7 @@ static maa_result_t aio_get_valid_fp(maa_aio_context dev)
*/
maa_aio_context maa_aio_init(unsigned int aio_channel)
{
int checked_pin = maa_check_aio(aio_channel);
int checked_pin = maa_setup_aio(aio_channel);
if (checked_pin < 0) {
switch(checked_pin) {
case -1:

View File

@@ -23,6 +23,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "gpio.h"
#include "maa_internal.h"
#include <stdlib.h>
#include <fcntl.h>
@@ -68,7 +69,7 @@ maa_gpio_get_valfp(maa_gpio_context dev)
maa_gpio_context
maa_gpio_init(int pin)
{
int pinm = maa_check_gpio(pin);
int pinm = maa_setup_gpio(pin);
if (pinm < 0)
return NULL;

View File

@@ -24,6 +24,7 @@
#include "i2c.h"
#include "smbus.h"
#include "maa_internal.h"
struct _i2c {
/*@{*/
@@ -31,12 +32,12 @@ struct _i2c {
int fh; /**< the file handle to the /dev/i2c-* device */
int addr; /**< the address of the i2c slave */
/*@}*/
};
};
maa_i2c_context
maa_i2c_init(int bus)
{
int checked_pin = maa_check_i2c(bus);
int checked_pin = maa_setup_i2c(bus);
if (checked_pin < 0) {
switch(checked_pin) {
case -1:

View File

@@ -27,6 +27,7 @@
#include <stdlib.h>
#include "maa.h"
#include "maa_internal.h"
#include "intel_galileo_rev_d.h"
#include "gpio.h"
#include "version.h"
@@ -82,7 +83,7 @@ maa_setup_mux_mapped(maa_pin_t meta)
}
unsigned int
maa_check_gpio(int pin)
maa_setup_gpio(int pin)
{
if (plat == NULL)
return -1;
@@ -100,7 +101,7 @@ maa_check_gpio(int pin)
}
unsigned int
maa_check_aio(int aio)
maa_setup_aio(int aio)
{
if (plat == NULL)
return -3;
@@ -120,7 +121,7 @@ maa_check_aio(int aio)
}
unsigned int
maa_check_i2c(int bus_s)
maa_setup_i2c(int bus_s)
{
if (plat == NULL)
return -3;
@@ -145,7 +146,7 @@ maa_check_i2c(int bus_s)
}
maa_spi_bus_t*
maa_check_spi(int bus)
maa_setup_spi(int bus)
{
if (plat == NULL)
return NULL;
@@ -179,7 +180,7 @@ maa_check_spi(int bus)
}
maa_pin_t*
maa_check_pwm(int pin)
maa_setup_pwm(int pin)
{
if (plat == NULL)
return NULL;

View File

@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include "pwm.h"
#include "maa_internal.h"
#define MAX_SIZE 64
#define SYSFS_PWM "/sys/class/pwm"
@@ -131,7 +132,7 @@ maa_pwm_get_duty(maa_pwm_context dev)
maa_pwm_context
maa_pwm_init(int pin) {
maa_pin_t* pinm = maa_check_pwm(pin);
maa_pin_t* pinm = maa_setup_pwm(pin);
if (pinm == NULL)
return NULL;
int chip = pinm->parent_id;

View File

@@ -30,12 +30,13 @@
#include <fcntl.h>
#include "spi.h"
#include "maa_internal.h"
#define MAX_SIZE 64
#define SPI_MAX_LENGTH 4096
/**
* A strucutre representing the SPI device
* A structure representing the SPI device
*/
struct _spi {
/*@{*/
@@ -50,7 +51,7 @@ struct _spi {
maa_spi_context
maa_spi_init(int bus)
{
maa_spi_bus_t *spi = maa_check_spi(bus);
maa_spi_bus_t *spi = maa_setup_spi(bus);
if(bus < 0) {
fprintf(stderr, "Failed. SPI platform Error\n");
return NULL;