Runs on Mac OS 10.6.7
This commit is contained in:
parent
a17df99b3e
commit
bd4e73f6e6
|
@ -3,3 +3,45 @@ import ctypes
|
|||
|
||||
binpath = os.path.dirname(os.path.abspath(__file__))
|
||||
handle = ctypes.CDLL(binpath + "/../lib/libfesvr.so")
|
||||
|
||||
handle.new_htif_isasim.restype = ctypes.c_void_p
|
||||
handle.new_htif_isasim.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||
|
||||
handle.new_htif_csim.restype = ctypes.c_void_p
|
||||
handle.new_htif_csim.argtypes = [ctypes.c_int, ctypes.c_int]
|
||||
|
||||
handle.new_htif_rs232.restype = ctypes.c_void_p
|
||||
handle.new_htif_rs232.argtypes = [ctypes.c_char_p]
|
||||
|
||||
handle.new_htif_eth.restype = ctypes.c_void_p
|
||||
handle.new_htif_eth.argtypes = [ctypes.c_char_p, ctypes.c_int]
|
||||
|
||||
handle.new_memif.restype = ctypes.c_void_p
|
||||
handle.new_memif.argtypes = [ctypes.c_void_p]
|
||||
|
||||
handle.load_elf.restype = None
|
||||
handle.load_elf.argtypes = [ctypes.c_char_p, ctypes.c_void_p]
|
||||
|
||||
handle.htif_start.restype = None
|
||||
handle.htif_start.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
||||
|
||||
handle.htif_stop.restype = None
|
||||
handle.htif_stop.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
||||
|
||||
handle.htif_read_cr_until_change.restype = ctypes.c_int64
|
||||
handle.htif_read_cr_until_change.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
||||
|
||||
handle.htif_read_cr.restype = ctypes.c_int64
|
||||
handle.htif_read_cr.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
||||
|
||||
handle.htif_write_cr.restype = None
|
||||
handle.htif_write_cr.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int64]
|
||||
|
||||
handle.frontend_syscall.restype = None
|
||||
handle.frontend_syscall.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int64]
|
||||
|
||||
handle.mainvars_argc.restype = None
|
||||
handle.mainvars_argc.argtypes = [ctypes.c_int]
|
||||
|
||||
handle.mainvars_argv.restype = None
|
||||
handle.mainvars_argv.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_char_p]
|
||||
|
|
|
@ -552,7 +552,7 @@ PACKAGE_STRING='Frontend Server ?'
|
|||
PACKAGE_BUGREPORT='Yunsup Lee'
|
||||
PACKAGE_URL=''
|
||||
|
||||
ac_unique_file="fesvr/common.h"
|
||||
ac_unique_file="fesvr/htif.h"
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
fesvr_extra_libs
|
||||
|
|
|
@ -35,7 +35,7 @@ m4_define( proj_version, [?])
|
|||
#-------------------------------------------------------------------------
|
||||
|
||||
AC_INIT(proj_name,proj_version,proj_maintainer,proj_abbreviation)
|
||||
AC_CONFIG_SRCDIR([fesvr/common.h])
|
||||
AC_CONFIG_SRCDIR([fesvr/htif.h])
|
||||
AC_CONFIG_AUX_DIR([scripts])
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
|
|
@ -21,6 +21,7 @@ fesvr_hdrs = \
|
|||
htif_eth.h \
|
||||
htif-packet.h \
|
||||
memif.h \
|
||||
pylink.h \
|
||||
syscall.h \
|
||||
|
||||
fesvr_srcs = \
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "pylink.h"
|
||||
#include "htif_isasim.h"
|
||||
#include "htif_rtlsim.h"
|
||||
#include "htif_csim.h"
|
||||
|
@ -11,67 +12,52 @@ char mainvars[0x1000];
|
|||
long* mainvars_longp = (long*)mainvars;
|
||||
size_t mainvars_sz;
|
||||
|
||||
extern "C"
|
||||
void* new_htif_isasim(int fdin, int fdout)
|
||||
{
|
||||
|
||||
char* new_htif_isasim(int fdin, int fdout)
|
||||
{
|
||||
htif_isasim_t* htif = new htif_isasim_t(fdin, fdout);
|
||||
|
||||
return (char*)htif;
|
||||
return new htif_isasim_t(fdin, fdout);
|
||||
}
|
||||
|
||||
char* new_htif_rtlsim(int fdin, int fdout)
|
||||
void* new_htif_rtlsim(int fdin, int fdout)
|
||||
{
|
||||
htif_rtlsim_t* htif = new htif_rtlsim_t(fdin, fdout);
|
||||
|
||||
return (char*)htif;
|
||||
return new htif_rtlsim_t(fdin, fdout);
|
||||
}
|
||||
|
||||
char* new_htif_csim(int fdin, int fdout)
|
||||
void* new_htif_csim(int fdin, int fdout)
|
||||
{
|
||||
htif_csim_t* htif = new htif_csim_t(fdin, fdout);
|
||||
|
||||
return (char*)htif;
|
||||
return new htif_csim_t(fdin, fdout);
|
||||
}
|
||||
|
||||
char* new_htif_rs232(const char* tty)
|
||||
void* new_htif_rs232(const char* tty)
|
||||
{
|
||||
htif_rs232_t* htif = new htif_rs232_t(tty);
|
||||
|
||||
return (char*)htif;
|
||||
return new htif_rs232_t(tty);
|
||||
}
|
||||
|
||||
char* new_htif_eth(const char* tty, int sim)
|
||||
void* new_htif_eth(const char* tty, int sim)
|
||||
{
|
||||
htif_eth_t* htif = new htif_eth_t(tty, bool(sim));
|
||||
|
||||
return (char*)htif;
|
||||
return new htif_eth_t(tty, bool(sim));
|
||||
}
|
||||
|
||||
char* new_memif(char* htif)
|
||||
void* new_memif(void* htif)
|
||||
{
|
||||
memif_t* memif = new memif_t((htif_t*)htif);
|
||||
|
||||
return (char*)memif;
|
||||
return new memif_t((htif_t*)htif);
|
||||
}
|
||||
|
||||
void load_elf(const char* fn, char* memif)
|
||||
void load_elf(const char* fn, void* memif)
|
||||
{
|
||||
load_elf(fn, (memif_t*)memif);
|
||||
}
|
||||
|
||||
void htif_start(char* htif, int coreid)
|
||||
void htif_start(void* htif, int coreid)
|
||||
{
|
||||
((htif_t*)htif)->start(coreid);
|
||||
}
|
||||
|
||||
void htif_stop(char* htif, int coreid)
|
||||
void htif_stop(void* htif, int coreid)
|
||||
{
|
||||
((htif_t*)htif)->stop(coreid);
|
||||
}
|
||||
|
||||
reg_t htif_read_cr_until_change(char* htif, int coreid, int regnum)
|
||||
reg_t htif_read_cr_until_change(void* htif, int coreid, int regnum)
|
||||
{
|
||||
reg_t val;
|
||||
|
||||
|
@ -83,17 +69,17 @@ reg_t htif_read_cr_until_change(char* htif, int coreid, int regnum)
|
|||
return val;
|
||||
}
|
||||
|
||||
reg_t htif_read_cr(char* htif, int coreid, int regnum)
|
||||
reg_t htif_read_cr(void* htif, int coreid, int regnum)
|
||||
{
|
||||
return ((htif_t*)htif)->read_cr(coreid, regnum);
|
||||
}
|
||||
|
||||
void htif_write_cr(char* htif, int coreid, int regnum, reg_t val)
|
||||
void htif_write_cr(void* htif, int coreid, int regnum, reg_t val)
|
||||
{
|
||||
((htif_t*)htif)->write_cr(coreid, regnum, val);
|
||||
}
|
||||
|
||||
void frontend_syscall(char* htif, char* memif, addr_t mm)
|
||||
void frontend_syscall(void* htif, void* memif, addr_t mm)
|
||||
{
|
||||
dispatch_syscall((htif_t*)htif, (memif_t*)memif, mm);
|
||||
}
|
||||
|
@ -113,5 +99,3 @@ void mainvars_argv(int idx, int len, char* arg)
|
|||
memcpy(&mainvars[mainvars_sz], arg, len);
|
||||
mainvars_sz += len;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef _PYLINK_H
|
||||
#define _PYLINK_H
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
// WARNING: if you change any of these prototypes, change fesvr_pylink.py, too!
|
||||
|
||||
void* new_htif_isasim(int fdin, int fdout);
|
||||
void* new_htif_rtlsim(int fdin, int fdout);
|
||||
void* new_htif_csim(int fdin, int fdout);
|
||||
void* new_htif_rs232(const char* tty);
|
||||
void* new_htif_eth(const char* tty, int sim);
|
||||
void* new_memif(void* htif);
|
||||
|
||||
void load_elf(const char* fn, void* memif);
|
||||
|
||||
void htif_start(void* htif, int coreid);
|
||||
void htif_stop(void* htif, int coreid);
|
||||
reg_t htif_read_cr_until_change(void* htif, int coreid, int regnum);
|
||||
reg_t htif_read_cr(void* htif, int coreid, int regnum);
|
||||
void htif_write_cr(void* htif, int coreid, int regnum, reg_t val);
|
||||
|
||||
void frontend_syscall(void* htif, void* memif, addr_t mm);
|
||||
void mainvars_argc(int argc);
|
||||
void mainvars_argv(int idx, int len, char* arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue