litex/build/sim: small cleanup

This commit is contained in:
Florent Kermarrec 2017-06-28 16:25:56 +02:00
parent 1d8298af94
commit ab6f4de521
9 changed files with 10 additions and 44 deletions

View File

@ -16,9 +16,6 @@
static struct ext_module_list_s *modlist=NULL; static struct ext_module_list_s *modlist=NULL;
int lambdasim_register_ext_module(struct ext_module_s *mod) int lambdasim_register_ext_module(struct ext_module_s *mod)
{ {
int ret=RC_OK; int ret=RC_OK;
@ -43,7 +40,6 @@ int lambdasim_register_ext_module(struct ext_module_s *mod)
modlist = ml; modlist = ml;
out: out:
return ret; return ret;
} }
@ -140,7 +136,6 @@ out:
return ret; return ret;
} }
int lambdasim_find_module(struct module_s *first, char *name , struct module_s **found) int lambdasim_find_module(struct module_s *first, char *name , struct module_s **found)
{ {
struct module_s *list = NULL; struct module_s *list = NULL;

View File

@ -19,8 +19,6 @@ struct module_s {
struct module_s *next; struct module_s *next;
}; };
struct ext_module_s { struct ext_module_s {
char *name; char *name;
int (*start)(void *); int (*start)(void *);
@ -35,7 +33,6 @@ struct ext_module_list_s {
struct ext_module_list_s *next; struct ext_module_list_s *next;
}; };
int lambdasim_file_to_module_list(char *filename, struct module_s **mod); int lambdasim_file_to_module_list(char *filename, struct module_s **mod);
int lambdasim_load_ext_modules(struct ext_module_list_s **mlist); int lambdasim_load_ext_modules(struct ext_module_list_s **mlist);
int lambdasim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found); int lambdasim_find_ext_module(struct ext_module_list_s *first, char *name , struct ext_module_list_s **found);

View File

@ -86,7 +86,6 @@ static int clocker_add_pads(void *sess, struct pad_list_s *plist)
*s->sys_clk=0; *s->sys_clk=0;
out: out:
return ret; return ret;
} }
static int clocker_tick(void *sess) static int clocker_tick(void *sess)

View File

@ -35,7 +35,6 @@ struct session_s {
struct event *ev; struct event *ev;
}; };
static struct event_base *base=NULL; static struct event_base *base=NULL;
int lambdasim_module_get_args( char *args, char *arg, char **val) int lambdasim_module_get_args( char *args, char *arg, char **val)
@ -74,7 +73,6 @@ out:
return ret; return ret;
} }
static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal) static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{ {
int ret; int ret;
@ -109,8 +107,6 @@ static int ethernet_start(void *b)
return RC_OK; return RC_OK;
} }
void event_handler(int fd, short event, void *arg) void event_handler(int fd, short event, void *arg)
{ {
struct session_s *s=(struct session_s*)arg; struct session_s *s=(struct session_s*)arg;
@ -139,6 +135,7 @@ void event_handler(int fd, short event, void *arg)
} }
} }
} }
static const char macadr[6] = {0xaa, 0xb6, 0x24, 0x69, 0x77, 0x21}; static const char macadr[6] = {0xaa, 0xb6, 0x24, 0x69, 0x77, 0x21};
static int ethernet_new(void **sess, char *args) static int ethernet_new(void **sess, char *args)
@ -194,7 +191,6 @@ static int ethernet_new(void **sess, char *args)
out: out:
*sess=(void*)s; *sess=(void*)s;
return ret; return ret;
} }
static int ethernet_add_pads(void *sess, struct pad_list_s *plist) static int ethernet_add_pads(void *sess, struct pad_list_s *plist)
@ -225,8 +221,8 @@ static int ethernet_add_pads(void *sess, struct pad_list_s *plist)
out: out:
return ret; return ret;
} }
static int ethernet_tick(void *sess) static int ethernet_tick(void *sess)
{ {
char c; char c;

View File

@ -52,8 +52,6 @@ out:
return ret; return ret;
} }
void set_conio_terminal_mode(void) void set_conio_terminal_mode(void)
{ {
struct termios new_termios; struct termios new_termios;
@ -63,8 +61,6 @@ void set_conio_terminal_mode(void)
tcsetattr(0, TCSANOW, &new_termios); tcsetattr(0, TCSANOW, &new_termios);
} }
static int serial2console_start(void *b) static int serial2console_start(void *b)
{ {
base =(struct event_base *)b; base =(struct event_base *)b;
@ -97,7 +93,6 @@ static void event_handler(int fd, short event, void *arg)
} }
} }
static int serial2console_new(void **sess, char *args) static int serial2console_new(void **sess, char *args)
{ {
int ret=RC_OK; int ret=RC_OK;
@ -155,8 +150,8 @@ static int serial2console_add_pads(void *sess, struct pad_list_s *plist)
out: out:
return ret; return ret;
} }
static int serial2console_tick(void *sess) static int serial2console_tick(void *sess)
{ {

View File

@ -27,7 +27,6 @@ struct session_s {
struct event_base *base; struct event_base *base;
int lambdasim_module_get_args( char *args, char *arg, char **val) int lambdasim_module_get_args( char *args, char *arg, char **val)
{ {
int ret=RC_OK; int ret=RC_OK;
@ -64,8 +63,6 @@ out:
return ret; return ret;
} }
static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal) static int lambdasim_module_pads_get( struct pad_s *pads, char *name, void **signal)
{ {
int ret; int ret;
@ -93,8 +90,6 @@ out:
return ret; return ret;
} }
static int serial2tcp_start(void *b) static int serial2tcp_start(void *b)
{ {
base =(struct event_base *)b; base =(struct event_base *)b;
@ -127,9 +122,6 @@ static void event_handler(int fd, short event, void *arg)
} }
} }
static void accept_conn_cb(struct evconnlistener *listener, evutil_socket_t fd, struct sockaddr *address, int socklen, void *ctx) static void accept_conn_cb(struct evconnlistener *listener, evutil_socket_t fd, struct sockaddr *address, int socklen, void *ctx)
{ {
struct session_s *s= (struct session_s*)ctx; struct session_s *s= (struct session_s*)ctx;
@ -158,14 +150,12 @@ static int serial2tcp_new(void **sess, char *args)
struct evconnlistener *listener; struct evconnlistener *listener;
struct sockaddr_in sin; struct sockaddr_in sin;
if(!sess) if(!sess)
{ {
ret = RC_INVARG; ret = RC_INVARG;
goto out; goto out;
} }
ret = lambdasim_module_get_args(args, "port", &cport); ret = lambdasim_module_get_args(args, "port", &cport);
{ {
if(RC_OK != ret) if(RC_OK != ret)
@ -184,7 +174,6 @@ static int serial2tcp_new(void **sess, char *args)
goto out; goto out;
} }
s=(struct session_s*)malloc(sizeof(struct session_s)); s=(struct session_s*)malloc(sizeof(struct session_s));
if(!s) if(!s)
{ {
@ -206,9 +195,6 @@ static int serial2tcp_new(void **sess, char *args)
} }
evconnlistener_set_error_cb(listener, accept_error_cb); evconnlistener_set_error_cb(listener, accept_error_cb);
out: out:
*sess=(void*)s; *sess=(void*)s;
return ret; return ret;
@ -257,7 +243,6 @@ static int serial2tcp_tick(void *sess)
return RC_OK; return RC_OK;
} }
*s->tx_ready = 1; *s->tx_ready = 1;
if(s->fd && *s->tx_valid) if(s->fd && *s->tx_valid)
{ {

View File

@ -7,6 +7,7 @@
#include "pads.h" #include "pads.h"
static struct pad_list_s *padlist=NULL; static struct pad_list_s *padlist=NULL;
int lambdasim_register_pads(struct pad_s *pads, char *interface_name, int index) int lambdasim_register_pads(struct pad_s *pads, char *interface_name, int index)
{ {
int ret = RC_OK; int ret = RC_OK;

View File

@ -23,7 +23,6 @@
void lambdasim_init(void **out); void lambdasim_init(void **out);
struct session_list_s { struct session_list_s {
void *session; void *session;
char tickfirst; char tickfirst;
@ -61,7 +60,6 @@ static int lambdasim_initialize_all(void **dut, void *base)
} }
} }
/* Load configuration */ /* Load configuration */
ret = lambdasim_file_to_module_list("sim_config.js", &ml); ret = lambdasim_file_to_module_list("sim_config.js", &ml);
if(RC_OK != ret) if(RC_OK != ret)
@ -138,6 +136,7 @@ static int lambdasim_initialize_all(void **dut, void *base)
out: out:
return ret; return ret;
} }
int lambdasim_sort_session() int lambdasim_sort_session()
{ {
struct session_list_s *s; struct session_list_s *s;
@ -162,9 +161,10 @@ int lambdasim_sort_session()
} }
return RC_OK; return RC_OK;
} }
struct event *ev; struct event *ev;
static void cb(int sock, short which, void *arg) static void cb(int sock, short which, void *arg)
{ {
struct session_list_s *s; struct session_list_s *s;
@ -201,7 +201,6 @@ static void cb(int sock, short which, void *arg)
int main() int main()
{ {
void *vdut=NULL; void *vdut=NULL;
struct event_base *base=NULL; struct event_base *base=NULL;
struct timeval tv; struct timeval tv;

View File

@ -9,7 +9,6 @@
#include "verilated_vcd_c.h" #include "verilated_vcd_c.h"
#include <verilated.h> #include <verilated.h>
VerilatedVcdC* tfp; VerilatedVcdC* tfp;
extern "C" void lambdasim_eval(void *vdut) extern "C" void lambdasim_eval(void *vdut)