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
0b80f0f7
Commit
0b80f0f7
authored
Mar 19, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/spll_dbg_proxy: trailing whitespace cleanup
parent
48ce6b02
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
42 deletions
+51
-42
spll_dbg_proxy.c
userspace/spll_dbg_proxy/spll_dbg_proxy.c
+51
-42
No files found.
userspace/spll_dbg_proxy/spll_dbg_proxy.c
View file @
0b80f0f7
...
@@ -4,8 +4,9 @@
...
@@ -4,8 +4,9 @@
via TCP connection to the application running on an outside host, where
via TCP connection to the application running on an outside host, where
the can be plotted, analyzed, etc.
the can be plotted, analyzed, etc.
The debug stream contains run-time signals coming in/out the SoftPLL - for example,
The debug stream contains run-time signals coming in/out the SoftPLL
the phase/frequency errors on each channel, DAC drive values, phase tags.
- for example, the phase/frequency errors on each channel, DAC drive
values, phase tags.
Todo: poll the hardware FIFO through a driver with interrupt support
Todo: poll the hardware FIFO through a driver with interrupt support
*/
*/
...
@@ -68,7 +69,8 @@ void rbuf_push(struct ring_buffer *rbuf, void *what)
...
@@ -68,7 +69,8 @@ void rbuf_push(struct ring_buffer *rbuf, void *what)
return
;
return
;
rbuf
->
count
++
;
rbuf
->
count
++
;
memcpy
(
rbuf
->
base
+
rbuf
->
wr_ptr
*
rbuf
->
entry_size
,
what
,
rbuf
->
entry_size
);
memcpy
(
rbuf
->
base
+
rbuf
->
wr_ptr
*
rbuf
->
entry_size
,
what
,
rbuf
->
entry_size
);
rbuf
->
wr_ptr
++
;
rbuf
->
wr_ptr
++
;
if
(
rbuf
->
wr_ptr
==
rbuf
->
num_entries
)
if
(
rbuf
->
wr_ptr
==
rbuf
->
num_entries
)
rbuf
->
wr_ptr
=
0
;
rbuf
->
wr_ptr
=
0
;
...
@@ -80,7 +82,8 @@ int rbuf_pop(struct ring_buffer *rbuf, void *dst)
...
@@ -80,7 +82,8 @@ int rbuf_pop(struct ring_buffer *rbuf, void *dst)
return
0
;
return
0
;
rbuf
->
count
--
;
rbuf
->
count
--
;
memcpy
(
dst
,
rbuf
->
base
+
rbuf
->
rd_ptr
*
rbuf
->
entry_size
,
rbuf
->
entry_size
);
memcpy
(
dst
,
rbuf
->
base
+
rbuf
->
rd_ptr
*
rbuf
->
entry_size
,
rbuf
->
entry_size
);
rbuf
->
rd_ptr
++
;
rbuf
->
rd_ptr
++
;
if
(
rbuf
->
rd_ptr
==
rbuf
->
num_entries
)
if
(
rbuf
->
rd_ptr
==
rbuf
->
num_entries
)
...
@@ -147,13 +150,15 @@ void sighandler(int sig)
...
@@ -147,13 +150,15 @@ void sighandler(int sig)
void
proxy_stuff
(
int
fd
)
void
proxy_stuff
(
int
fd
)
{
{
if
(
rbuf_init
(
&
spll_trace
,
RING_BUFFER_ENTRIES
,
sizeof
(
struct
fifo_entry
))
<
0
)
if
(
rbuf_init
(
&
spll_trace
,
RING_BUFFER_ENTRIES
,
sizeof
(
struct
fifo_entry
))
<
0
)
{
{
perror
(
"rbuf_init()"
);
perror
(
"rbuf_init()"
);
return
;
return
;
}
}
fprintf
(
stderr
,
"Connection accepted [record size %d].
\n
"
,
sizeof
(
struct
fifo_entry
));
fprintf
(
stderr
,
"Connection accepted [record size %d].
\n
"
,
sizeof
(
struct
fifo_entry
));
proxy_done
=
0
;
proxy_done
=
0
;
signal
(
SIGPIPE
,
sighandler
);
signal
(
SIGPIPE
,
sighandler
);
...
@@ -166,8 +171,9 @@ void proxy_stuff(int fd)
...
@@ -166,8 +171,9 @@ void proxy_stuff(int fd)
struct
fifo_entry
tx_buf
[
ENTRIES_PER_PACKET
];
struct
fifo_entry
tx_buf
[
ENTRIES_PER_PACKET
];
int
i
;
int
i
;
/* fixme: make endian-independent */
for
(
i
=
0
;
i
<
ENTRIES_PER_PACKET
;
i
++
)
for
(
i
=
0
;
i
<
ENTRIES_PER_PACKET
;
i
++
)
rbuf_pop
(
&
spll_trace
,
&
tx_buf
[
i
]);
/* fixme: make endian-independent */
rbuf_pop
(
&
spll_trace
,
&
tx_buf
[
i
]);
if
(
proxy_done
)
if
(
proxy_done
)
{
{
...
@@ -204,7 +210,8 @@ int main(int argc, char *argv[])
...
@@ -204,7 +210,8 @@ int main(int argc, char *argv[])
}
}
int
yes
=
1
;
int
yes
=
1
;
if
(
setsockopt
(
sock_fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
yes
,
sizeof
(
yes
))
<
0
)
{
if
(
setsockopt
(
sock_fd
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
yes
,
sizeof
(
yes
))
<
0
)
{
perror
(
"setsockopt()"
);
perror
(
"setsockopt()"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -232,7 +239,9 @@ int main(int argc, char *argv[])
...
@@ -232,7 +239,9 @@ int main(int argc, char *argv[])
socklen_t
client_len
=
sizeof
(
client_addr
);
socklen_t
client_len
=
sizeof
(
client_addr
);
int
client_fd
;
int
client_fd
;
if
((
client_fd
=
accept
(
sock_fd
,
(
struct
sockaddr
*
)
&
client_addr
,
&
client_len
))
>
0
)
if
((
client_fd
=
accept
(
sock_fd
,
(
struct
sockaddr
*
)
&
client_addr
,
&
client_len
))
>
0
)
proxy_stuff
(
client_fd
);
proxy_stuff
(
client_fd
);
}
}
...
...
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