Commit ef74eb64 authored by Alessandro Rubini's avatar Alessandro Rubini

userspace/libwr: massive Lindent pass

This is a completely automatic pass, before we start making order
in this library (note: there is a missing semicolon in pps_gen.c:82
but it will be fixed in a later commit -- the bug is in the macro
being called, so the missing semicolon is ok for the compiler).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent f2b39316
......@@ -48,32 +48,31 @@ static int is_cpu_pwn = 0;
static int enable_d0 = 0;
static i2c_fpga_reg_t fpga_sensors_bus_master = {
.base_address = FPGA_I2C_ADDRESS,
.if_num = FPGA_I2C_SENSORS_IFNUM,
.prescaler = 500,
.base_address = FPGA_I2C_ADDRESS,
.if_num = FPGA_I2C_SENSORS_IFNUM,
.prescaler = 500,
};
static struct i2c_bus fpga_sensors_i2c = {
.name = "fpga_sensors",
.type = I2C_BUS_TYPE_FPGA_REG,
.type_specific = &fpga_sensors_bus_master,
.name = "fpga_sensors",
.type = I2C_BUS_TYPE_FPGA_REG,
.type_specific = &fpga_sensors_bus_master,
};
#define PI_FRACBITS 8
/* PI regulator state */
typedef struct {
float ki, kp; /* integral and proportional gains (1<<PI_FRACBITS == 1.0f) */
float integrator; /* current integrator value */
float bias; /* DC offset always added to the output */
float ki, kp; /* integral and proportional gains (1<<PI_FRACBITS == 1.0f) */
float integrator; /* current integrator value */
float bias; /* DC offset always added to the output */
int anti_windup; /* when non-zero, anti-windup is enabled */
float y_min; /* min/max output range, used by clapming and antiwindup algorithms */
float y_min; /* min/max output range, used by clapming and antiwindup algorithms */
float y_max;
float x, y; /* Current input (x) and output value (y) */
float x, y; /* Current input (x) and output value (y) */
} pi_controller_t;
static pi_controller_t fan_pi;
//-----------------------------------------
//-- Old CPU PWM system (<3.3)
static int pwm_fd;
......@@ -83,13 +82,13 @@ static volatile struct SPWM_WB *spwm_wbr;
static void shw_pwm_update_timeout(int tout_100ms)
{
fan_update_timeout=tout_100ms*100000;
TRACE(TRACE_INFO,"Fan tick timeout is =%d",fan_update_timeout);
fan_update_timeout = tout_100ms * 100000;
TRACE(TRACE_INFO, "Fan tick timeout is =%d", fan_update_timeout);
}
/* Processes a single sample (x) with Proportional Integrator control algorithm (pi). Returns the value (y) to
drive the actuator. */
static inline float pi_update(pi_controller_t *pi, float x)
static inline float pi_update(pi_controller_t * pi, float x)
{
float i_new, y;
pi->x = x;
......@@ -100,80 +99,79 @@ static inline float pi_update(pi_controller_t *pi, float x)
/* clamping (output has to be in <y_min, y_max>) and anti-windup:
stop the integrator if the output is already out of range and the output
is going further away from y_min/y_max. */
if(y < pi->y_min)
{
if (y < pi->y_min) {
y = pi->y_min;
if((pi->anti_windup && (i_new > pi->integrator)) || !pi->anti_windup)
if ((pi->anti_windup && (i_new > pi->integrator))
|| !pi->anti_windup)
pi->integrator = i_new;
} else if (y > pi->y_max) {
y = pi->y_max;
if((pi->anti_windup && (i_new < pi->integrator)) || !pi->anti_windup)
pi->integrator = i_new;
} else /* No antiwindup/clamping? */
if ((pi->anti_windup && (i_new < pi->integrator))
|| !pi->anti_windup)
pi->integrator = i_new;
} else /* No antiwindup/clamping? */
pi->integrator = i_new;
pi->y = y;
return y;
}
/* initializes the PI controller state. Currently almost a stub. */
static inline void pi_init(pi_controller_t *pi)
static inline void pi_init(pi_controller_t * pi)
{
pi->integrator = 0;
}
/* Configures a PWM output on gpio pin (pin). Rate accepts range from 0 (0%) to 1000 (100%) */
static void pwm_configure_pin(const pio_pin_t *pin, int enable, int rate)
static void pwm_configure_pin(const pio_pin_t * pin, int enable, int rate)
{
int index = pin->port * 32 + pin->pin;
if(pin==0) return;
if (pin == 0)
return;
if(enable && !enable_d0)
if (enable && !enable_d0)
ioctl(pwm_fd, AT91_SOFTPWM_ENABLE, index);
else if(!enable && enable_d0)
else if (!enable && enable_d0)
ioctl(pwm_fd, AT91_SOFTPWM_DISABLE, index);
enable_d0 = enable;
ioctl(pwm_fd, AT91_SOFTPWM_SETPOINT, rate);
}
/* Configures a PWM output on gpio pin (pin). Rate accepts range from 0 (0%) to 1000 (100%) */
static void pwm_configure_fpga(int enmask, float rate)
{
uint8_t u8speed=(uint8_t)((rate>=1)?0xff:(rate*255.0));
uint8_t u8speed = (uint8_t) ((rate >= 1) ? 0xff : (rate * 255.0));
if((enmask & 0x1)>0) spwm_wbr->DR0=u8speed;
if((enmask & 0x2)>0) spwm_wbr->DR1=u8speed;
if ((enmask & 0x1) > 0)
spwm_wbr->DR0 = u8speed;
if ((enmask & 0x2) > 0)
spwm_wbr->DR1 = u8speed;
}
/* Configures a PWM output. Rate accepts range is from 0 (0%) to 1 (100%) */
static void shw_pwm_speed(int enmask, float rate)
{
//TRACE(TRACE_INFO,"%x %f",enmask,rate);
if(is_cpu_pwn)
{
pwm_configure_pin(get_pio_pin(shw_io_box_fan_en), enmask, rate*1000);
}
else
{
pwm_configure_fpga(enmask,rate);
if (is_cpu_pwn) {
pwm_configure_pin(get_pio_pin(shw_io_box_fan_en), enmask,
rate * 1000);
} else {
pwm_configure_fpga(enmask, rate);
}
}
/* Texas Instruments TMP100 temperature sensor driver */
static uint32_t tmp100_read_reg(int dev_addr, uint8_t reg_addr, int n_bytes)
{
uint8_t data[8];
uint32_t rv=0, i;
uint32_t rv = 0, i;
data[0] = reg_addr;
i2c_write(&fpga_sensors_i2c, dev_addr, 1, data);
i2c_read(&fpga_sensors_i2c, dev_addr, n_bytes, data);
for(i=0; i<n_bytes;i++)
{
for (i = 0; i < n_bytes; i++) {
rv <<= 8;
rv |= data[i];
}
......@@ -181,8 +179,6 @@ static uint32_t tmp100_read_reg(int dev_addr, uint8_t reg_addr, int n_bytes)
return rv;
}
static void tmp100_write_reg(int dev_addr, uint8_t reg_addr, uint8_t value)
{
uint8_t data[2];
......@@ -192,17 +188,17 @@ static void tmp100_write_reg(int dev_addr, uint8_t reg_addr, uint8_t value)
i2c_write(&fpga_sensors_i2c, dev_addr, 2, data);
}
static float tmp100_read_temp(int dev_addr)
{
int temp = tmp100_read_reg(dev_addr, 0, 2);
return ((float) (temp >> 4)) / 16.0;
return ((float)(temp >> 4)) / 16.0;
}
static int shw_init_i2c_sensors()
{
if (i2c_init_bus(&fpga_sensors_i2c) < 0) {
TRACE(TRACE_FATAL, "can't initialize temperature sensors I2C bus.\n");
TRACE(TRACE_FATAL,
"can't initialize temperature sensors I2C bus.\n");
return -1;
}
return 0;
......@@ -210,20 +206,23 @@ static int shw_init_i2c_sensors()
int shw_init_fans()
{
uint32_t val=0;
uint32_t val = 0;
//Set the type of PWM
if(shw_get_hw_ver()<330) is_cpu_pwn=1;
else is_cpu_pwn=0;
if (shw_get_hw_ver() < 330)
is_cpu_pwn = 1;
else
is_cpu_pwn = 0;
TRACE(TRACE_INFO, "Configuring %s PWMs for fans (desired temperature = %.1f degC)...",is_cpu_pwn?"CPU":"FPGA",DESIRED_TEMPERATURE);
TRACE(TRACE_INFO,
"Configuring %s PWMs for fans (desired temperature = %.1f degC)...",
is_cpu_pwn ? "CPU" : "FPGA", DESIRED_TEMPERATURE);
if(is_cpu_pwn)
{
if (is_cpu_pwn) {
pwm_fd = open("/dev/at91_softpwm", O_RDWR);
if(pwm_fd < 0)
{
TRACE(TRACE_FATAL, "at91_softpwm driver not installed or device not created.\n");
if (pwm_fd < 0) {
TRACE(TRACE_FATAL,
"at91_softpwm driver not installed or device not created.\n");
return -1;
}
......@@ -232,15 +231,15 @@ int shw_init_fans()
fan_pi.y_min = 200;
fan_pi.bias = 200;
fan_pi.y_max = 800;
}
else
{
} else {
//Point to the corresponding WB direction
spwm_wbr= (volatile struct SPWM_WB *) (FPGA_BASE_ADDR + FPGA_BASE_SPWM);
spwm_wbr =
(volatile struct SPWM_WB *)(FPGA_BASE_ADDR +
FPGA_BASE_SPWM);
//Configure SPWM register the 30~=(62.5MHz÷(8kHz×2^8))−1
val= SPWM_CR_PRESC_W(30) | SPWM_CR_PERIOD_W(255);
spwm_wbr->CR=val;
val = SPWM_CR_PRESC_W(30) | SPWM_CR_PERIOD_W(255);
spwm_wbr->CR = val;
fan_pi.ki = 1.0;
fan_pi.kp = 4.0;
......@@ -251,7 +250,7 @@ int shw_init_fans()
shw_init_i2c_sensors();
tmp100_write_reg(FAN_TEMP_SENSOR_ADDR, 1, 0x60); // 12-bit resolution
tmp100_write_reg(FAN_TEMP_SENSOR_ADDR, 1, 0x60); // 12-bit resolution
pi_init(&fan_pi);
......@@ -260,7 +259,6 @@ int shw_init_fans()
return 0;
}
/*
* Reads out the temperature and drives the fan accordingly
* note: This call is done by hal_main.c:hal_update()
......@@ -270,13 +268,12 @@ void shw_update_fans()
static int64_t last_tics = -1;
int64_t cur_tics = shw_get_tics();
if(fan_update_timeout>0 && (last_tics < 0 || (cur_tics - last_tics) > fan_update_timeout))
{
if (fan_update_timeout > 0
&& (last_tics < 0 || (cur_tics - last_tics) > fan_update_timeout)) {
float t_cur = tmp100_read_temp(FAN_TEMP_SENSOR_ADDR);
float drive = pi_update(&fan_pi, t_cur - DESIRED_TEMPERATURE);
//TRACE(TRACE_INFO,"t=%f,pwm=%f",t_cur , drive);
shw_pwm_speed(0xFF, drive/1000); //enable two and one
shw_pwm_speed(0xFF, drive / 1000); //enable two and one
last_tics = cur_tics;
}
}
......@@ -22,25 +22,27 @@ volatile uint8_t *_fpga_base_virt;
/* Initializes the mapping of the Main FPGA to the CPU address space. */
int shw_fpga_mmap_init()
{
int fd;
int fd;
TRACE(TRACE_INFO, "Initializing FPGA memory mapping.");
TRACE(TRACE_INFO, "Initializing FPGA memory mapping.");
fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd < 0) {
perror("/dev/mem");
return -1;
}
_fpga_base_virt = mmap(NULL, SMC_CS0_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, SMC_CS0_BASE);
close(fd);
fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd < 0) {
perror("/dev/mem");
return -1;
}
_fpga_base_virt =
mmap(NULL, SMC_CS0_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
SMC_CS0_BASE);
close(fd);
if(_fpga_base_virt == MAP_FAILED) {
perror("mmap()");
return -1;
}
if (_fpga_base_virt == MAP_FAILED) {
perror("mmap()");
return -1;
}
TRACE(TRACE_INFO, "FPGA virtual base = 0x%08x", _fpga_base_virt);
TRACE(TRACE_INFO, "FPGA virtual base = 0x%08x", _fpga_base_virt);
return 0;
return 0;
}
......@@ -7,7 +7,7 @@
#define HAL_EXPORT_STRUCTURES
#include "hal_exports.h"
#define DEFAULT_TO 200000 /* ms */
#define DEFAULT_TO 200000 /* ms */
static struct minipc_ch *hal_ch;
......@@ -21,56 +21,56 @@ int halexp_lock_cmd(const char *port_name, int command, int priority)
return rval;
}
int halexp_query_ports(hexp_port_list_t *list)
int halexp_query_ports(hexp_port_list_t * list)
{
int ret;
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_query_ports,
list /* return val */);
list /* return val */ );
return ret;
}
int halexp_get_port_state(hexp_port_state_t *state, const char *port_name)
int halexp_get_port_state(hexp_port_state_t * state, const char *port_name)
{
int ret;
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_get_port_state,
state /* retval */, port_name);
state /* retval */ , port_name);
return ret;
}
int halexp_pps_cmd(int cmd, hexp_pps_params_t *params)
int halexp_pps_cmd(int cmd, hexp_pps_params_t * params)
{
int ret, rval;
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_pps_cmd,
&rval, cmd, params);
&rval, cmd, params);
if (ret < 0)
return ret;
return rval;
}
int halexp_get_timing_state(hexp_timing_state_t *tstate)
int halexp_get_timing_state(hexp_timing_state_t * tstate)
{
int ret;
ret = minipc_call(hal_ch, DEFAULT_TO, &__rpcdef_get_timing_state,
tstate);
tstate);
if (ret < 0)
return ret;
return 0;
}
int halexp_client_try_connect(int retries, int timeout)
{
for(;;) {
hal_ch = minipc_client_create(WRSW_HAL_SERVER_ADDR, MINIPC_FLAG_VERBOSE);
for (;;) {
hal_ch =
minipc_client_create(WRSW_HAL_SERVER_ADDR,
MINIPC_FLAG_VERBOSE);
if (hal_ch == 0)
retries--;
else
return 0;
if(!retries)
if (!retries)
return -1;
usleep(timeout);
......@@ -79,8 +79,7 @@ int halexp_client_try_connect(int retries, int timeout)
return -1;
}
int halexp_client_init()
{
return halexp_client_try_connect(0, 0);
}
\ No newline at end of file
}
......@@ -11,49 +11,49 @@
#define hwiu_read(reg) \
_fpga_readl(FPGA_BASE_HWIU + offsetof(struct HWIU_WB, reg))
static int hwiu_read_word(uint32_t adr, uint32_t *data)
static int hwiu_read_word(uint32_t adr, uint32_t * data)
{
uint32_t temp;
int timeout = 0;
uint32_t temp;
int timeout = 0;
temp = HWIU_CR_RD_EN | HWIU_CR_ADR_W(adr);
hwiu_write(CR, temp);
do {
temp = hwiu_read(CR);
++timeout;
} while( temp & HWIU_CR_RD_EN && timeout < HWIU_RD_TIMEOUT );
temp = HWIU_CR_RD_EN | HWIU_CR_ADR_W(adr);
hwiu_write(CR, temp);
do {
temp = hwiu_read(CR);
++timeout;
} while (temp & HWIU_CR_RD_EN && timeout < HWIU_RD_TIMEOUT);
if( timeout == HWIU_RD_TIMEOUT || temp & HWIU_CR_RD_ERR )
return -1;
if (timeout == HWIU_RD_TIMEOUT || temp & HWIU_CR_RD_ERR)
return -1;
*data = hwiu_read(REG_VAL);
return 0;
*data = hwiu_read(REG_VAL);
return 0;
}
int shw_hwiu_gwver(struct gw_info *info)
{
uint32_t data[HWIU_INFO_WORDS+1];
struct gw_info *s_data;
int i;
//read first word of info struct
if( hwiu_read_word(HWIU_INFO_START, data) < 0 )
return -1;
s_data = (struct gw_info *)data;
*info = *s_data;
if( info->nwords != HWIU_INFO_WORDS ) {
printf("nwords: sw=%u, hw=%u, ver=%u, data=%x\n", info->nwords, HWIU_INFO_WORDS, info->struct_ver, data[0]);
return -1;
}
//now read info words
for(i=0; i<info->nwords; ++i) {
if( hwiu_read_word(HWIU_INFO_WORDS_START+i, data+i+1) < 0 )
return -1;
}
*info = *( (struct gw_info*) data);
return 0;
uint32_t data[HWIU_INFO_WORDS + 1];
struct gw_info *s_data;
int i;
//read first word of info struct
if (hwiu_read_word(HWIU_INFO_START, data) < 0)
return -1;
s_data = (struct gw_info *)data;
*info = *s_data;
if (info->nwords != HWIU_INFO_WORDS) {
printf("nwords: sw=%u, hw=%u, ver=%u, data=%x\n", info->nwords,
HWIU_INFO_WORDS, info->struct_ver, data[0]);
return -1;
}
//now read info words
for (i = 0; i < info->nwords; ++i) {
if (hwiu_read_word(HWIU_INFO_WORDS_START + i, data + i + 1) < 0)
return -1;
}
*info = *((struct gw_info *)data);
return 0;
}
......@@ -23,65 +23,64 @@ int i2c_init_bus(struct i2c_bus *bus)
return ret;
}
int32_t i2c_transfer(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint32_t to_read, uint8_t* data)
int32_t i2c_transfer(struct i2c_bus * bus, uint32_t address, uint32_t to_write,
uint32_t to_read, uint8_t * data)
{
return bus->transfer(bus, address, to_write, to_read, data);
}
void i2c_free(struct i2c_bus* bus)
void i2c_free(struct i2c_bus *bus)
{
if (!bus)
return;
if (!bus)
return;
if (bus->type_specific)
shw_free(bus->type_specific);
if (bus->type_specific)
shw_free(bus->type_specific);
shw_free(bus);
shw_free(bus);
}
int32_t i2c_write(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint8_t* data)
int32_t i2c_write(struct i2c_bus *bus, uint32_t address, uint32_t to_write,
uint8_t * data)
{
//TRACE(TRACE_INFO,"%s (0x%X): 0x%X 2w:%d 2r:%d %d",bus->name,bus,address,to_write,0,data[0]);
return bus->transfer(bus, address, to_write, 0, data);
return bus->transfer(bus, address, to_write, 0, data);
}
int32_t i2c_read (struct i2c_bus* bus, uint32_t address, uint32_t to_read, uint8_t* data)
int32_t i2c_read(struct i2c_bus * bus, uint32_t address, uint32_t to_read,
uint8_t * data)
{
return bus->transfer(bus, address, 0, to_read, data);
//TRACE(TRACE_INFO,"%s (0x%X): 0x%X 2w:%d 2r:%d %d",bus->name,bus,address,0,to_read,data[0]);
return bus->transfer(bus, address, 0, to_read, data);
//TRACE(TRACE_INFO,"%s (0x%X): 0x%X 2w:%d 2r:%d %d",bus->name,bus,address,0,to_read,data[0]);
}
int32_t i2c_scan(struct i2c_bus* bus, uint8_t* data)
int32_t i2c_scan(struct i2c_bus * bus, uint8_t * data)
{
if (!bus)
return I2C_NULL_PARAM;
if (!bus)
return I2C_NULL_PARAM;
// const int devices = 128;
int address;
int address;
const int first_valid_address = 0;
const int last_valid_address = 0x7f;
const int first_valid_address = 0;
const int last_valid_address = 0x7f;
memset((void*)data, 0, 16); //16 bytes * 8 addresses per byte == 128 addresses
memset((void *)data, 0, 16); //16 bytes * 8 addresses per byte == 128 addresses
int found = 0;
int found = 0;
for (address = first_valid_address; address <= last_valid_address; address++)
{
int res = bus->scan(bus, address);
if (res) //device present
{
int offset = address >> 3; //choose proper byte
int bit = (1 << (address%8)); //choose proper bit
data[offset] |= bit;
found++;
for (address = first_valid_address; address <= last_valid_address;
address++) {
int res = bus->scan(bus, address);
if (res) //device present
{
int offset = address >> 3; //choose proper byte
int bit = (1 << (address % 8)); //choose proper bit
data[offset] |= bit;
found++;
}
}
}
TRACE(TRACE_INFO,"%s (0x%X): ndev=%d",bus->name,bus,found);
return found;
TRACE(TRACE_INFO, "%s (0x%X): ndev=%d", bus->name, bus, found);
return found;
}
......@@ -21,26 +21,27 @@
#define I2C_WRITE 0
#define I2C_READ 1
typedef struct i2c_bus
{
const char *name;
int type;
void* type_specific;
int32_t (*transfer)(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint32_t to_read, uint8_t* data);
int32_t (*scan)(struct i2c_bus* bus, uint32_t address);
int err;
typedef struct i2c_bus {
const char *name;
int type;
void *type_specific;
int32_t(*transfer) (struct i2c_bus * bus, uint32_t address,
uint32_t to_write, uint32_t to_read,
uint8_t * data);
int32_t(*scan) (struct i2c_bus * bus, uint32_t address);
int err;
} i2c_bus_t;
int i2c_init_bus(struct i2c_bus *bus);
int32_t i2c_transfer(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint32_t to_read, uint8_t* data);
int32_t i2c_transfer(struct i2c_bus *bus, uint32_t address, uint32_t to_write,
uint32_t to_read, uint8_t * data);
int32_t i2c_write(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint8_t* data);
int32_t i2c_read (struct i2c_bus* bus, uint32_t address, uint32_t to_read, uint8_t* data);
int32_t i2c_write(struct i2c_bus *bus, uint32_t address, uint32_t to_write,
uint8_t * data);
int32_t i2c_read(struct i2c_bus *bus, uint32_t address, uint32_t to_read,
uint8_t * data);
int32_t i2c_scan(struct i2c_bus* bus, uint8_t* data);
#endif //I2C_H
int32_t i2c_scan(struct i2c_bus *bus, uint8_t * data);
#endif //I2C_H
......@@ -10,20 +10,21 @@
#include <libwr/trace.h>
static int32_t i2c_bitbang_transfer(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint32_t to_read, uint8_t* data);
static int32_t i2c_bitbang_scan(struct i2c_bus* bus, uint32_t address);
static int32_t i2c_bitbang_transfer(struct i2c_bus *bus, uint32_t address,
uint32_t to_write, uint32_t to_read,
uint8_t * data);
static int32_t i2c_bitbang_scan(struct i2c_bus *bus, uint32_t address);
int i2c_bitbang_init_bus(struct i2c_bus *bus)
{
struct i2c_bitbang *priv;
if (!bus && !bus->type_specific && bus->type != I2C_TYPE_BITBANG)
return -1;
priv = (struct i2c_bitbang *)bus->type_specific;
TRACE(TRACE_INFO,"init: %s (0x%x) ",bus->name,bus);
TRACE(TRACE_INFO, "init: %s (0x%x) ", bus->name, bus);
shw_pio_configure(priv->scl);
shw_pio_configure(priv->sda);
shw_pio_setdir(priv->scl, 0);
......@@ -40,16 +41,16 @@ int i2c_bitbang_init_bus(struct i2c_bus *bus)
#define I2C_DELAY 4
static void mi2c_pin_out(pio_pin_t* pin, int state)
static void mi2c_pin_out(pio_pin_t * pin, int state)
{
shw_pio_setdir(pin, state ? 0 : 1);
shw_udelay(I2C_DELAY);
shw_pio_setdir(pin, state ? 0 : 1);
shw_udelay(I2C_DELAY);
}
static void mi2c_start(struct i2c_bitbang* bus)
static void mi2c_start(struct i2c_bitbang *bus)
{
mi2c_pin_out(bus->sda, 0);
mi2c_pin_out(bus->scl, 0);
mi2c_pin_out(bus->sda, 0);
mi2c_pin_out(bus->scl, 0);
}
/* not used right now
......@@ -62,53 +63,48 @@ static void mi2c_restart(struct i2c_bitbang* bus)
}
*/
static void mi2c_stop(struct i2c_bitbang* bus)
static void mi2c_stop(struct i2c_bitbang *bus)
{