Commit 0b80f0f7 authored by Alessandro Rubini's avatar Alessandro Rubini

userspace/spll_dbg_proxy: trailing whitespace cleanup

parent 48ce6b02
...@@ -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);
} }
......
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