Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
40deb0eb
Commit
40deb0eb
authored
Jan 28, 2013
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug: adding trace message
parent
fd31acf3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
i2c.c
userspace/libswitchhw/i2c.c
+5
-1
i2c_bitbang.c
userspace/libswitchhw/i2c_bitbang.c
+6
-0
i2c_sfp.c
userspace/libswitchhw/i2c_sfp.c
+6
-0
init.c
userspace/libswitchhw/init.c
+2
-0
No files found.
userspace/libswitchhw/i2c.c
View file @
40deb0eb
...
...
@@ -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
;
}
userspace/libswitchhw/i2c_bitbang.c
View file @
40deb0eb
...
...
@@ -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
;
...
...
userspace/libswitchhw/i2c_sfp.c
View file @
40deb0eb
...
...
@@ -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
)
...
...
userspace/libswitchhw/init.c
View file @
40deb0eb
...
...
@@ -11,6 +11,8 @@
int
shw_init
()
{
TRACE
(
TRACE_INFO
,
"%s
\n
========================================================="
,
__TIME__
);
/* Init input/output (GPIO & CPU I2C) */
assert_init
(
shw_io_init
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment