mraa: Remove global advance_func struct and place it in platform configuration
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
// FIXME: Nasty macro to test for presence of function in context structure function table
|
||||
#define IS_FUNC_DEFINED(dev, func) (dev != NULL && dev->advance_func != NULL && dev->advance_func->func != NULL)
|
||||
|
||||
|
||||
typedef struct {
|
||||
mraa_result_t (*gpio_init_internal_replace) (int pin);
|
||||
mraa_result_t (*gpio_init_pre) (int pin);
|
||||
|
||||
@@ -35,9 +35,6 @@ extern "C" {
|
||||
#include "mraa_adv_func.h"
|
||||
|
||||
extern mraa_board_t* plat;
|
||||
// TODO: Remove global advance_func and use module context instead
|
||||
extern mraa_adv_func_t* advance_func;
|
||||
|
||||
|
||||
/**
|
||||
* Takes in pin information and sets up the multiplexors.
|
||||
|
||||
@@ -50,7 +50,7 @@ struct _gpio {
|
||||
mraa_boolean_t owner; /**< If this context originally exported the pin */
|
||||
mraa_result_t (*mmap_write) (mraa_gpio_context dev, int value);
|
||||
int (*mmap_read) (mraa_gpio_context dev);
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ struct _i2c {
|
||||
int addr; /**< the address of the i2c slave */
|
||||
unsigned long funcs; /**< /dev/i2c-* device capabilities as per https://www.kernel.org/doc/Documentation/i2c/functionality */
|
||||
void *handle; /**< generic handle for non-standard drivers that don't use file descriptors */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
@@ -78,6 +78,7 @@ struct _spi {
|
||||
int clock; /**< clock to run transactions at */
|
||||
mraa_boolean_t lsb; /**< least significant bit mode */
|
||||
unsigned int bpw; /**< Bits per word */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
@@ -91,6 +92,7 @@ struct _pwm {
|
||||
int duty_fp; /**< File pointer to duty file */
|
||||
int period; /**< Cache the period to speed up setting duty */
|
||||
mraa_boolean_t owner; /**< Owner of pwm context*/
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
@@ -98,9 +100,12 @@ struct _pwm {
|
||||
* A structure representing a Analog Input Channel
|
||||
*/
|
||||
struct _aio {
|
||||
/*@{*/
|
||||
unsigned int channel; /**< the channel as on board and ADC module */
|
||||
int adc_in_fp; /**< File Pointer to raw sysfs */
|
||||
int value_bit; /**< 10 bits by default. Can be increased if board */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -111,6 +116,7 @@ struct _uart {
|
||||
int index; /**< the uart index, as known to the os. */
|
||||
const char* path; /**< the uart device path. */
|
||||
int fd; /**< file descriptor for device. */
|
||||
mraa_adv_func_t* advance_func; /**< override function table */
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user