Commit 81250fc8 authored by Alessandro Rubini's avatar Alessandro Rubini

userspace: fix most compiler warnings

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 09b2e14d
......@@ -14,6 +14,6 @@
/* System reference clock rate (in Hertz). Update together with REF_CLOCK_PERIOD_PS */
#define REF_CLOCK_RATE_HZ 62500000
int shw_init();
int shw_init(void);
int shw_fpga_mmap_init(void);
#endif
......@@ -22,6 +22,7 @@
#include <pio.h>
#include <trace.h>
#include <string.h>
#include <stdio.h>
#include "shw_io.h"
......
......@@ -3,8 +3,10 @@
#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
#include <shw_io.h>
#include <fpga_io.h>
#include "shw_io.h"
#include "fpga_io.h"
#include "switch_hw.h"
#define VUART_BASE 0x10000
#define VUART_TDR 0x10
......@@ -16,13 +18,14 @@ int vuart_tx(char *buf, int size)
{
while(size--)
_fpga_writel(VUART_BASE+VUART_TDR, *buf++);
return 0;
}
int vuart_rx(char *buf, int size)
{
int n_rx;
int n_rx = 0;
int rdr;
while(size--) {
rdr = _fpga_readl(VUART_BASE+VUART_RDR);
if(rdr & RDR_RDY) {
......
......@@ -109,6 +109,7 @@ int fetch_rtu_vd(rtudexp_vd_entry_t *d, int *n_entries)
n+=list.num_entries;
} while(start > 0);
*n_entries = n;
return 0;
}
/**
......@@ -277,4 +278,5 @@ int main(int argc, char **argv)
printf("\n");
}
printf("\n");
return 0;
}
......@@ -25,7 +25,7 @@
#include <shw_io.h>
#include <hwiu.h>
#include "pio.h"
#include "switch_hw.h"
#ifndef __GIT_VER__
......@@ -87,8 +87,6 @@ int main(int argc, char **argv)
shw_io_init();
shw_io_configure_all();
shw_io_t* all_io = (shw_io_t*)_all_shw_io;
switch(func)
{
case 'p':
......
......@@ -25,6 +25,8 @@
#include <fpga_io.h>
#include <regs/softpll-regs.h>
#include "switch_hw.h"
/* TCP Port to listen on */
#define MY_PORT 12345
......@@ -202,8 +204,6 @@ void proxy_stuff(int fd)
}
extern void shw_fpga_mmap_init();
int main(int argc, char *argv[])
{
int sock_fd;
......
......@@ -209,7 +209,6 @@ int wrdate_internal_set(struct PPSG_WB *pps)
struct timeval tvh, tvr; /* host, rabbit */
signed long long diff64;
signed long diff;
unsigned long prev;
int tai_offset;
tai_offset = fix_host_tai();
......
......@@ -30,6 +30,7 @@
#include "rt_ipc.h"
#include "hal_client.h"
#include "switch_hw.h"
#define WRS3_FPGA_BASE 0x10000000
#define WRS3_FPGA_SIZE 0x100000
......@@ -246,7 +247,7 @@ void calc_trans(int ep, int argc, char *argv[])
if( rts_connect() < 0)
{
printf("Can't connect to the RT subsys\n");
return -1;
return;
}
......
......@@ -14,7 +14,7 @@
#include <switch_hw.h>
#include <hal_client.h>
static void parse_sysfs(int init);
#define pstats_rd(reg) \
_fpga_readl(FPGA_BASE_PSTATS + offsetof(struct PSTATS_WB, reg))
......@@ -32,8 +32,6 @@ struct cnt_word {
struct cnt_word cnt_pp[NPORTS][CNT_PP];
extern int shw_fpga_mmap_init();
char info[][20] = {{"Tu-run|"}, // 0
{"Ro-run|"}, // 1
{"Riv-cd|"}, // 2
......@@ -74,14 +72,11 @@ char info[][20] = {{"Tu-run|"}, // 0
{"RTUfwd|"}, // 37 ---
{"TRUrsp|"} // 38
};
static void read_cntval(int port, int adr, uint32_t *data);
int pstats_init(void)
{
int err, i, j;
uint32_t mem_val[2];
int ret = 0;
err = shw_fpga_mmap_init();
if(err) {
printf("shw_fpga_mmap_init failed with %d\n", err);
......@@ -100,7 +95,7 @@ int pstats_init(void)
return 0;
}
void parse_sysfs(int init)
static void parse_sysfs(int init)
{
FILE *file;
uint32_t port, cntr, val;
......@@ -191,8 +186,6 @@ void print_info(char *prgname)
int main(int argc, char **argv)
{
time_t last_show=0;
int option=0;
int prio_cnts[] = {21,22,23,24,25,26,27,28}; //8
int def_cnts[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,29,30,31,32,33,34,35,36,37}; //30
int rtu_cnts[] = {29,30,31,32,33,34,35,36,37,38}; //10
......
......@@ -96,6 +96,7 @@ static int parse_mask(char *arg)
for_each_port(p1)
printf(" %i", p1);
printf("\n");
return 0;
}
static void exit_mask(int present)
......
......@@ -126,34 +126,6 @@ int any_port_locked()
return rts_state.current_ref;
}
/* generates a unique MAC address for port if_name (currently produced from the MAC of the
management port). */
/* FIXME: MAC addresses should be kept in some EEPROM */
static int get_mac_address(const char *if_name, uint8_t *mac_addr)
{
struct ifreq ifr;
int idx;
sscanf(if_name, "wr%d", &idx);
strncpy(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name));
if(ioctl(fd_raw, SIOCGIFHWADDR, &ifr) < 0)
return -1;
if(mac_addr)
{
mac_addr[0] = 0x8 | 0x2; // locally administered MAC
mac_addr[1] = 0x00;
mac_addr[2] = 0x30;
mac_addr[3] = ifr.ifr_hwaddr.sa_data[3];
mac_addr[4] = ifr.ifr_hwaddr.sa_data[4];
mac_addr[5] = (ifr.ifr_hwaddr.sa_data[5] & 0xc0) + (idx + 2);
}
return 0;
}
/* Resets the state variables of a particular port and re-starts its state machines */
static void reset_port_state(hal_port_state_t *p)
{
......@@ -226,7 +198,6 @@ int hal_init_port(const char *name, int index)
{
char key_name[128];
char val[128];
char cmd[128];
hal_port_state_t *p = &ports[index];
/* check if the port is compiled into the firmware, if not, just ignore it. */
......
......@@ -52,9 +52,6 @@
#include "rtu_drv.h"
#include "wr_rtu.h"
extern int shw_fpga_mmap_init();
static void write_mfifo_addr(uint32_t zbt_addr);
static void write_mfifo_data(uint32_t word);
......
......@@ -81,11 +81,6 @@ struct hw_req *hw_req_list;
*/
static struct filtering_entry rtu_htab[HTAB_ENTRIES][RTU_BUCKETS];
/**
* \brief Mirror of Aging RAM.
*/
static uint32_t rtu_agr_htab[RTU_ARAM_WORDS];
/**
* \brief Max time that a dynamic MAC entry can remain
* in the MAC table after being used. [seconds]
......@@ -106,9 +101,6 @@ static struct hw_req *tail(struct hw_req *head);
static void clean_list(struct hw_req *head);
static int hw_request(int type, struct rtu_addr addr, struct filtering_entry *ent);
static inline int to_hw_addr(struct rtu_addr addr);
static inline struct rtu_addr from_hw_addr(int hw_addr);
static void clean_fd(void);
static void clean_vd(void);
......
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