Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
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
Software for White Rabbit PTP Core
Commits
50f9a2ea
Commit
50f9a2ea
authored
Oct 25, 2013
by
Wesley W. Terpstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
w1-tools: remove dependency on duplicated code
parent
4fd8e991
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
12 deletions
+27
-12
w1-eeprom.c
dev/w1-eeprom.c
+9
-1
w1-hw.c
dev/w1-hw.c
+1
-1
w1.c
dev/w1.c
+12
-2
Makefile
tools/Makefile
+3
-6
wrpc-w1-read.c
tools/wrpc-w1-read.c
+1
-1
wrpc-w1-write.c
tools/wrpc-w1-write.c
+1
-1
No files found.
dev/w1-eeprom.c
View file @
50f9a2ea
...
...
@@ -4,9 +4,14 @@
*/
#include <stdlib.h>
#include <string.h>
#include <w1.h>
#ifndef EXTERNAL_W1
#include <wrc.h>
#include <shell.h>
#include <w1.h>
#else
#include <unistd.h>
#endif
#define LSB_ADDR(X) ((X) & 0xFF)
#define MSB_ADDR(X) (((X) & 0xFF00)>>8)
...
...
@@ -138,6 +143,7 @@ int w1_write_eeprom_bus(struct w1_bus *bus,
return
-
1
;
}
#ifndef EXTERNAL_W1
#define BLEN 32
/* A shell command, for testing write: "w1w <offset> <byte> [<byte> ...]" */
...
...
@@ -190,3 +196,5 @@ DEFINE_WRC_COMMAND(w1r) = {
.
name
=
"w1r"
,
.
exec
=
cmd_w1_r
,
};
#endif
dev/w1-hw.c
View file @
50f9a2ea
...
...
@@ -6,9 +6,9 @@
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include <wrc.h>
#include <string.h>
#include <w1.h>
#include <board.h>
#include <hw/sockit_owm_regs.h>
static
inline
uint32_t
__wait_cycle
(
void
*
base
)
...
...
dev/w1.c
View file @
50f9a2ea
...
...
@@ -2,11 +2,17 @@
* Onewire generic interface
* Alessandro Rubini, 2013 GNU GPL2 or later
*/
#include <wrc.h>
#include <string.h>
#include <shell.h>
#include <w1.h>
#ifndef EXTERNAL_W1
#include <wrc.h>
#include <shell.h>
#else
#include <unistd.h>
#define pp_printf(...) do {} while (0)
#endif
static
const
struct
w1_ops
*
ops
=
&
wrpc_w1_ops
;
/* local shorter name */
void
w1_write_byte
(
struct
w1_bus
*
bus
,
int
byte
)
...
...
@@ -146,6 +152,8 @@ void w1_match_rom(struct w1_dev *dev)
}
}
#ifndef EXTERNAL_W1
/* A shell command, for checking */
static
int
cmd_w1
(
const
char
*
args
[])
{
...
...
@@ -171,3 +179,5 @@ DEFINE_WRC_COMMAND(w1) = {
.
name
=
"w1"
,
.
exec
=
cmd_w1
,
};
#endif
tools/Makefile
View file @
50f9a2ea
CFLAGS
=
-Wall
-ggdb
CFLAGS
=
-Wall
-ggdb
-DEXTERNAL_W1
-I
../include
LDFLAGS
=
-lutil
ALL
=
genraminit genramvhd genrammif wrpc-uart-sw
ALL
+=
wrpc-w1-read wrpc-w1-write
...
...
@@ -18,14 +18,11 @@ all: $(ALL)
%
:
%.c
$(CC)
$(CFLAGS)
$<
$(LDFLAGS)
-o
$@
wrpc-w1-read
:
wrpc-w1-read.c
w1-host/libw1.a
wrpc-w1-read
:
wrpc-w1-read.c
../dev/w1.c ../dev/w1-eeprom.c ../dev/w1-hw.c
$(CC)
$(CFLAGS)
$^
$(LDFLAGS)
-o
$@
wrpc-w1-write
:
wrpc-w1-write.c
w1-host/libw1.a
wrpc-w1-write
:
wrpc-w1-write.c
../dev/w1.c ../dev/w1-eeprom.c ../dev/w1-hw.c
$(CC)
$(CFLAGS)
$^
$(LDFLAGS)
-o
$@
w1-host/libw1.a
:
$(MAKE)
-C
w1-host
clean
:
rm
-f
$(ALL)
*
.o
*
~
$(MAKE)
-C
w1-host clean
tools/wrpc-w1-read.c
View file @
50f9a2ea
...
...
@@ -20,7 +20,7 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include
"w1-host/w1.h"
#include
<w1.h>
#define SPEC_W1_OFFSET 0x20600
/* from "sdb" on the shell, current gateware */
...
...
tools/wrpc-w1-write.c
View file @
50f9a2ea
...
...
@@ -20,7 +20,7 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include
"w1-host/w1.h"
#include
<w1.h>
#define SPEC_W1_OFFSET 0x20600
/* from "sdb" on the shell, current gateware */
...
...
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