Private
Public Access
2
0

mmap: remove implementation of mmap gpio

Instead of trying to have an implementation that covers most platforms
Leave all mmap up to platform definition. Through function pointers.

gpio_mmap_setup sets up the mmap

Within the internal gpio context struct two more function pointers now
exist mmap_read & mmap_write. They exist there so each context can its
own function for handling a write and read.

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-11-07 02:02:29 +00:00
parent d1f9e98060
commit 3865bebe8d
5 changed files with 13 additions and 95 deletions

View File

@@ -42,10 +42,7 @@ typedef struct {
mraa_result_t (*gpio_write_pre) (mraa_gpio_context dev, int value);
mraa_result_t (*gpio_write_post) (mraa_gpio_context dev, int value);
mraa_result_t (*gpio_mmaped_write_replace) (mraa_gpio_context dev, int value);
mraa_result_t (*gpio_mmaped_write_pre) (mraa_gpio_context dev, int value);
mraa_result_t (*gpio_mmaped_write_post) (mraa_gpio_context dev, int value);
mraa_result_t (*gpio_mmap_setup) (mraa_gpio_context dev, mraa_boolean_t en);
mraa_result_t (*i2c_init_pre) (unsigned int bus);
mraa_result_t (*i2c_init_post) (mraa_i2c_context dev);

View File

@@ -45,14 +45,6 @@ extern mraa_board_t* plat;
*/
mraa_result_t mraa_setup_mux_mapped(mraa_pin_t meta);
/**
* Setup gpio mux to go straight to SoC, galileo.
*
* @param pin physical pin to use
* @return mraa_mmap_pin_t
*/
mraa_mmap_pin_t* mraa_setup_mmap_gpio(int pin);
/**
* Setup uart muxes to exposes the pins physically.
*

View File

@@ -26,6 +26,7 @@
#pragma once
#include "common.h"
#include "mraa.h"
// general status failures for internal functions
#define MRAA_PLATFORM_NO_INIT -3
@@ -45,10 +46,8 @@ struct _gpio {
pthread_t thread_id; /**< the isr handler thread id */
int isr_value_fp; /**< the isr file pointer on the value */
mraa_boolean_t owner; /**< If this context originally exported the pin */
mraa_boolean_t mmap;
void *reg;
unsigned int reg_sz;
unsigned int reg_bit_pos;
mraa_result_t (*mmap_write) (mraa_gpio_context dev, int value);
int (*mmap_read) (mraa_gpio_context dev);
/*@}*/
};