void * host_timer;
};
-typedef addr_t vnet_lock_t;
+typedef unsigned long vnet_lock_t;
struct vnet_host_hooks {
void *(*thread_start)(int (*fn)(void * arg), void * arg, char * thread_name);
- void (*thread_sleep)(int timeout);
+ void (*thread_sleep)(long timeout);
void (*thread_wakeup)(void * thread);
void (*thread_stop)(void * thread);
- int (*thread_should_stop)();
+ int (*thread_should_stop)(void);
void *(*timer_create)(unsigned long interval, void (* timer_fun)(void * priv_data), void * data);
void (*timer_del)(void * timer);
- int (*timer_start)(void * timer);
- int (*timer_stop)(void * timer);
+ void (*timer_start)(void * timer);
+ void (*timer_stop)(void * timer);
void (*timer_reset)(void * timer, unsigned long interval);
void (*udelay)(unsigned long usecs);
+#ifdef __V3VEE__
+
extern struct vnet_host_hooks * host_hooks;
return NULL;
}
-static inline void * Vnet_PAddr(void *addr) {
+static inline void * Vnet_PAddr(void * addr) {
if ((host_hooks) && host_hooks->vaddr_to_paddr) {
return host_hooks->vaddr_to_paddr(addr);
}
}
-static inline void Vnet_Yield(){
+static inline void Vnet_Yield(void){
if ((host_hooks) && (host_hooks)->yield_cpu) {
host_hooks->yield_cpu();
}
}
/* THREAD FUNCTIONS */
-struct vnet_thread * vnet_start_thread(int (*func)(void *),
- void *arg, char * name);
+struct vnet_thread * vnet_start_thread(int (*func)(void *), void * arg, char * name);
static inline void vnet_thread_sleep(long timeout){
if((host_hooks) && host_hooks->thread_sleep){
}
}
-static inline int vnet_thread_should_stop(){
+static inline int vnet_thread_should_stop(void){
if((host_hooks) && host_hooks->thread_should_stop){
return host_hooks->thread_should_stop();
}
/* TIMER FUNCTIONS */
/* interval, in jittes */
-struct vnet_timer * vnet_create_timer(unsigned long interval,
- void (* timer_fun)(void * priv_data),
- void * pri_data);
+struct vnet_timer * vnet_create_timer(unsigned long interval, void (* timer_fun)(void * priv_data), void * pri_data);
static inline void vnet_del_timer(struct vnet_timer * timer){
if((host_hooks) && host_hooks->timer_del){
}
}
-static inline int vnet_start_timer(struct vnet_timer * timer){
+static inline void vnet_start_timer(struct vnet_timer * timer){
if((host_hooks) && host_hooks->timer_start){
- return host_hooks->timer_start(timer->host_timer);
+ host_hooks->timer_start(timer->host_timer);
}
-
- return -1;
}
-static inline int vnet_stop_timer(struct vnet_timer * timer){
+static inline void vnet_stop_timer(struct vnet_timer * timer){
if((host_hooks) && host_hooks->timer_stop){
- return host_hooks->timer_stop(timer->host_timer);
+ host_hooks->timer_stop(timer->host_timer);
}
-
- return -1;
}
static inline void vnet_reset_timer(struct vnet_timer * timer, unsigned long new_interval){
#define Vnet_Print(level, fmt, args...) \
- do { \
- extern int vnet_debug; \
- if(level <= vnet_debug) { \
+ do { \
+ extern int vnet_debug; \
+ if(level <= vnet_debug) { \
extern struct vnet_host_hooks * host_hooks; \
if ((host_hooks) && (host_hooks)->print) { \
(host_hooks)->print((fmt), ##args); \
- } \
- } \
+ } \
+ } \
} while (0)
#define Vnet_Debug(fmt, args...) \
- do { \
- extern struct vnet_host_hooks * host_hooks; \
- if ((host_hooks) && (host_hooks)->print) { \
- (host_hooks)->print((fmt), ##args); \
- } \
+ do { \
+ extern struct vnet_host_hooks * host_hooks; \
+ if ((host_hooks) && (host_hooks)->print) { \
+ (host_hooks)->print((fmt), ##args); \
+ } \
} while (0)
+
/* Lock Utilities */
int vnet_lock_init(vnet_lock_t * lock);
host_hooks->mutex_unlock((void *)lock);
}
-static inline addr_t vnet_lock_irqsave(vnet_lock_t lock) {
- addr_t irq_state = v3_irq_save();
+static inline unsigned long vnet_lock_irqsave(vnet_lock_t lock) {
+ //addr_t irq_state = v3_irq_save();
host_hooks->mutex_lock((void *)lock, 1);
- return irq_state;
+ return 0;
}
static inline void vnet_unlock_irqrestore(vnet_lock_t lock, addr_t irq_state) {
host_hooks->mutex_unlock((void *)lock);
- v3_irq_restore(irq_state);
+ //v3_irq_restore(irq_state);
}
-
+#endif
+\r
void init_vnet(struct vnet_host_hooks * hooks);