Commit 40deb0eb authored by Benoit Rat's avatar Benoit Rat

debug: adding trace message

parent fd31acf3
......@@ -6,6 +6,8 @@
#include "i2c_bitbang.h"
#include "i2c_fpga_reg.h"
#include <trace.h>
int i2c_init_bus(struct i2c_bus *bus)
{
int ret;
......@@ -40,6 +42,7 @@ void i2c_free(struct i2c_bus* bus)
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);
}
......@@ -47,6 +50,7 @@ int32_t i2c_write(struct i2c_bus* bus, uint32_t address, uint32_t to_write, uint
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]);
}
......@@ -77,6 +81,6 @@ int32_t i2c_scan(struct i2c_bus* bus, uint8_t* data)
found++;
}
}
TRACE(TRACE_INFO,"%s (0x%X): ndev=%d",bus->name,bus,found);
return found;
}
......@@ -8,17 +8,21 @@
#include "i2c_bitbang.h"
#include "trace.h"
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,"%s (0x%x) ",bus->name,bus);
shw_pio_configure(priv->scl);
TRACE(TRACE_INFO,"%s (0x%x) ",bus->name,bus);
shw_pio_configure(priv->sda);
shw_pio_setdir(priv->scl, 0);
shw_pio_setdir(priv->sda, 0);
......@@ -143,6 +147,8 @@ int i2c_bitbang_transfer(i2c_bus_t* bus, uint32_t address, uint32_t to_write, ui
if (bus->type != I2C_TYPE_BITBANG)
return I2C_BUS_MISMATCH;
//TRACE(TRACE_INFO,"%s (0x%x) @ 0x%x: w=%d/r=%d; cmd=%d d=%d (0b%s)",bus->name,bus,address,to_write,to_read,data[0],data[1],shw_2binary(data[1]));
struct i2c_bitbang* ts = (struct i2c_bitbang*)bus->type_specific;
int sent = 0;
......
......@@ -444,9 +444,13 @@ void shw_sfp_gpio_set(int num, uint8_t state)
send[0] = 0x1;
/* Read current state of pins */
i2c_transfer(bus, addr, 1, 0, send);
i2c_transfer(bus, addr, 0, 1, &curr);
//TRACE(TRACE_INFO,"%d: 0x%x 0x%x s=%d, send=%d,%d c=%d, \n",num,bus,addr,state,send[0],send[1],&curr);
if (top)
curr &= 0xf;
else
......@@ -463,6 +467,8 @@ void shw_sfp_gpio_set(int num, uint8_t state)
send[1] = curr;
i2c_transfer(bus, addr, 2, 0, send);
//TRACE(TRACE_INFO,"%d: 0x%x 0x%x s=%d, send=%d,%d c=%d, \n",num,bus,addr,state,send[0],send[1],curr);
}
uint8_t shw_sfp_gpio_get(int num)
......
......@@ -11,6 +11,8 @@
int shw_init()
{
TRACE(TRACE_INFO,"%s\n=========================================================",__TIME__);
/* Init input/output (GPIO & CPU I2C) */
assert_init(shw_io_init());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment