Filewatcher File Search
FTP Search
  
Directory (beta)
  
Content Search (beta)
   
pkg://xenomai-cvs-latest.tar.gz:6221940/xenomai/cvs-latest/xenomai/xenomai/nucleus/arch/mvm.h,v  downloads

head	1.46;
access;
symbols
	xenomai-final-1_x:1.46
	xenomai-1_1_1:1.46
	xenomai-1_1:1.46
	snapshot-1_1pre2:1.43
	xenomai-1_0:1.31
	xenomai-pre-1_0:1.28
	xenomai-pre1:1.28
	xenomai-0_7:1.20;
locks; strict;
comment	@ * @;


1.46
date	2002.08.12.09.10.36;	author rpm;	state Exp;
branches;
next	1.45;

1.45
date	2002.07.26.17.13.09;	author rpm;	state Exp;
branches;
next	1.44;

1.44
date	2002.07.18.17.16.00;	author rpm;	state Exp;
branches;
next	1.43;

1.43
date	2002.07.10.13.39.36;	author rpm;	state Exp;
branches;
next	1.42;

1.42
date	2002.07.06.15.36.56;	author rpm;	state Exp;
branches;
next	1.41;

1.41
date	2002.07.05.14.23.16;	author rpm;	state Exp;
branches;
next	1.40;

1.40
date	2002.07.03.12.07.02;	author rpm;	state Exp;
branches;
next	1.39;

1.39
date	2002.07.02.18.11.05;	author rpm;	state Exp;
branches;
next	1.38;

1.38
date	2002.07.01.16.51.54;	author rpm;	state Exp;
branches;
next	1.37;

1.37
date	2002.06.28.10.07.06;	author rpm;	state Exp;
branches;
next	1.36;

1.36
date	2002.06.27.16.54.33;	author rpm;	state Exp;
branches;
next	1.35;

1.35
date	2002.06.27.15.49.34;	author rpm;	state Exp;
branches;
next	1.34;

1.34
date	2002.06.27.09.39.00;	author rpm;	state Exp;
branches;
next	1.33;

1.33
date	2002.06.14.09.17.53;	author gch;	state Exp;
branches;
next	1.32;

1.32
date	2002.04.17.10.03.21;	author rpm;	state Exp;
branches;
next	1.31;

1.31
date	2002.03.27.15.44.07;	author rpm;	state Exp;
branches;
next	1.30;

1.30
date	2002.03.26.18.49.35;	author rpm;	state Exp;
branches;
next	1.29;

1.29
date	2002.03.20.13.02.13;	author rpm;	state Exp;
branches;
next	1.28;

1.28
date	2002.03.06.14.45.32;	author rpm;	state Exp;
branches;
next	1.27;

1.27
date	2002.03.05.12.32.30;	author rpm;	state Exp;
branches;
next	1.26;

1.26
date	2002.03.01.16.39.46;	author rpm;	state Exp;
branches;
next	1.25;

1.25
date	2002.02.28.18.39.47;	author rpm;	state Exp;
branches;
next	1.24;

1.24
date	2002.02.28.16.53.36;	author rpm;	state Exp;
branches;
next	1.23;

1.23
date	2002.02.27.18.52.14;	author rpm;	state Exp;
branches;
next	1.22;

1.22
date	2002.02.25.19.20.20;	author rpm;	state Exp;
branches;
next	1.21;

1.21
date	2002.02.25.17.09.45;	author rpm;	state Exp;
branches;
next	1.20;

1.20
date	2002.02.13.17.32.51;	author rpm;	state Exp;
branches;
next	1.19;

1.19
date	2002.02.07.15.08.53;	author rpm;	state Exp;
branches;
next	1.18;

1.18
date	2002.02.06.12.30.42;	author rpm;	state Exp;
branches;
next	1.17;

1.17
date	2002.02.05.19.59.43;	author rpm;	state Exp;
branches;
next	1.16;

1.16
date	2002.02.05.10.35.08;	author rpm;	state Exp;
branches;
next	1.15;

1.15
date	2002.02.04.18.57.54;	author rpm;	state Exp;
branches;
next	1.14;

1.14
date	2002.02.04.16.07.51;	author rpm;	state Exp;
branches;
next	1.13;

1.13
date	2002.02.04.14.50.31;	author rpm;	state Exp;
branches;
next	1.12;

1.12
date	2002.02.03.18.04.40;	author rpm;	state Exp;
branches;
next	1.11;

1.11
date	2002.02.01.16.32.38;	author rpm;	state Exp;
branches;
next	1.10;

1.10
date	2002.01.31.19.26.47;	author rpm;	state Exp;
branches;
next	1.9;

1.9
date	2002.01.27.18.15.27;	author rpm;	state Exp;
branches;
next	1.8;

1.8
date	2002.01.27.17.12.34;	author rpm;	state Exp;
branches;
next	1.7;

1.7
date	2002.01.27.12.31.01;	author rpm;	state Exp;
branches;
next	1.6;

1.6
date	2002.01.25.18.21.50;	author rpm;	state Exp;
branches;
next	1.5;

1.5
date	2002.01.20.21.43.17;	author rpm;	state Exp;
branches;
next	1.4;

1.4
date	2002.01.18.19.21.42;	author rpm;	state Exp;
branches;
next	1.3;

1.3
date	2002.01.17.18.43.19;	author rpm;	state Exp;
branches;
next	1.2;

1.2
date	2002.01.16.19.09.58;	author rpm;	state Exp;
branches;
next	1.1;

1.1
date	2002.01.15.17.35.09;	author rpm;	state Exp;
branches;
next	;


desc
@@


1.46
log
@Use domain-directed Adeos pipeline services
@
text
@/*
 * This file is part of the XENOMAI project.
 *
 * Copyright (c) 2001,2002 Philippe Gerum <rpm@@xenomai.org>.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Description: This file defines the interface between the Minute
 * Virtual Machine and the Xenomai nucleus.
 */

#ifndef _nucleus_arch_mvm_h
#define _nucleus_arch_mvm_h

#include <errno.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>

typedef int CPUFLAGS;
typedef int atomic_counter_t;
typedef unsigned long atomic_flags_t;

#define ATOMIC_ENTER(x)    ((x) = mvm_set_irqmask(-1))
#define ATOMIC_EXIT(x)     mvm_set_irqmask(x)

#define XNARCH_DEFAULT_TICK       10000000 /* ns, i.e. 10ms */
#define XNARCH_IRQ_MAX            7

#define XNARCH_ASYNCH        0	/* n/a */
#define XNARCH_SHMEM         0	/* n/a */

#define XNARCH_THREAD_COOKIE NULL
#define XNARCH_THREAD_STACKSZ 0 /* Let the simulator choose. */
#define XNARCH_ROOT_STACKSZ   0	/* Only a placeholder -- no stack */

struct xnthread;
struct xnsynch;
struct XenoThread;
struct mvm_displayctx;
struct mvm_displayctl;
struct TclList;
typedef struct TclList *mvm_tcl_listobj_t;

typedef struct xnarchtcb {	/* Per-thread arch-dependent block */

    struct xnthread *kthread;	/* Kernel thread pointer (opaque) */
    struct XenoThread *vmthread;  /* Simulation thread pointer (opaque) */
    void (*entry)(void *);	/* Thread entry */
    void *cookie;		/* Thread cookie passed on entry */
    int imask;			/* Initial interrupt mask */
    /* The following fields are unused by the Minute VM,
       however they are set by the nucleus. */
    unsigned stacksize;		/* Aligned size of stack (bytes) */
    int *stackbase;		/* Stack space */

} xnarchtcb_t;

typedef void *xnarch_fltinfo_t;	/* Unused but required */

#define xnarch_printf              printf
#define printk                     printf
#define xnarch_llimd(ll,m,d)       ((int)(ll) * (int)(m) / (int)(d))
#define xnarch_imuldiv(i,m,d)      ((int)(i) * (int)(m) / (int)(d))
#define xnarch_ulldiv(ull,uld,rem) (((*rem) = ((ull) % (uld))), (ull) / (uld))
#define xnarch_ullmod(ull,uld,rem) ((*rem) = ((ull) % (uld)))
#define xnarch_stack_size(tcb)     ((tcb)->stacksize)

/* Under the MVM, preemption only occurs at the C-source line level,
   so we just need plain C bitops and counter support. */

#define xnarch_memory_barrier()
#define xnarch_atomic_set(pcounter,i)          (*(pcounter) = (i))
#define xnarch_atomic_get(pcounter)            (*(pcounter))
#define xnarch_atomic_inc(pcounter)            (++(*(pcounter)))
#define xnarch_atomic_dec(pcounter)            (--(*(pcounter)))
#define xnarch_atomic_inc_and_test(pcounter)   (!(++(*(pcounter))))
#define xnarch_atomic_dec_and_test(pcounter)   (!(--(*(pcounter))))
#define xnarch_atomic_set_mask(pflags,mask)    (*(pflags) |= (mask))
#define xnarch_atomic_clear_mask(pflags,mask)  (*(pflags) &= ~(mask))

#define __mvm_breakable(f) f ## $kdoor$

#ifdef __cplusplus
extern "C" {
#endif

void xnpod_welcome_thread(struct xnthread *);

void mvm_init(int argc,
	      char *argv[]);

int mvm_run(void *tcbarg,
	    void *faddr);

void mvm_finalize_init(void);

int mvm_hook_irq(unsigned irq,
		 void (*handler)(void *cookie),
		 void *cookie);

int mvm_release_irq(unsigned irq);

int mvm_post_irq(unsigned irq);

int mvm_enable_irq(unsigned irq);

int mvm_disable_irq(unsigned irq);

int mvm_set_irqmask(int level);

void mvm_start_timer(unsigned long nstick,
		     void (*tickhandler)(void));

void mvm_stop_timer(void);

void *mvm_create_callback(void (*handler)(void *),
			  void *cookie);

void mvm_delete_callback (void *cbhandle);

void mvm_schedule_callback(void *cbhandle,
			   unsigned long ns);

unsigned long long mvm_get_cpu_time(void);

unsigned long mvm_get_cpu_freq(void);

struct XenoThread *mvm_spawn_thread(void *tcbarg,
				    void *faddr,
				    const char *name);

int mvm_get_thread_imask (void *tcbarg);

const char *mvm_get_thread_state(void *tcbarg);

void mvm_restart_thread(struct XenoThread *thread);

struct XenoThread *mvm_thread_self(void);

void __mvm_breakable(mvm_switch_threads)(struct XenoThread *out,
					   struct XenoThread *in);

void mvm_finalize_switch_threads(struct XenoThread *dead,
				 struct XenoThread *in);

void mvm_finalize_thread(struct XenoThread *dead);

void __mvm_breakable(mvm_terminate)(int xcode);

void __mvm_breakable(mvm_fatal)(const char *format, ...);

void __mvm_breakable(mvm_break)(void);

void __mvm_breakable(mvm_join_threads)(void);

void mvm_create_display(struct mvm_displayctx *ctx,
			struct mvm_displayctl *ctl,
			void *obj,
			const char *name);

void mvm_delete_display(struct mvm_displayctx *ctx);

void mvm_send_display(struct mvm_displayctx *ctx,
		      const char *s);

void __mvm_breakable(mvm_post_graph)(struct mvm_displayctx *ctx,
				       int state);

void mvm_tcl_init_list(mvm_tcl_listobj_t *tclist);

void mvm_tcl_destroy_list(mvm_tcl_listobj_t *tclist);

void mvm_tcl_set(mvm_tcl_listobj_t *tclist,
		 const char *s);

void mvm_tcl_append(mvm_tcl_listobj_t *tclist,
		    const char *s);

void mvm_tcl_clear(mvm_tcl_listobj_t *tclist);

void mvm_tcl_append_int(mvm_tcl_listobj_t *tclist,
			u_long n);

void mvm_tcl_append_hex(mvm_tcl_listobj_t *tclist,
			u_long n);

void mvm_tcl_append_list(mvm_tcl_listobj_t *tclist,
			 mvm_tcl_listobj_t *tclist2);

const char *mvm_tcl_value(mvm_tcl_listobj_t *tclist);

void mvm_tcl_build_pendq(mvm_tcl_listobj_t *tclist,
			 struct xnsynch *synch);

#ifdef XENO_INTR_MODULE

static inline int xnarch_hook_irq (unsigned irq,
				   void (*handler)(void *cookie),
				   void *cookie) {

    return mvm_hook_irq(irq,handler,cookie);
}

static inline int xnarch_release_irq (unsigned irq) {

    return mvm_release_irq(irq);
}

static inline int xnarch_enable_irq (unsigned irq) {

    return mvm_enable_irq(irq);
}

static inline int xnarch_disable_irq (unsigned irq) {

    return mvm_disable_irq(irq);
}

static inline void xnarch_isr_chain_irq (unsigned irq) {
    /* Fake */
}

static inline void xnarch_isr_enable_irq (unsigned irq) {
    /* Fake */
}

#endif /* XENO_INTR_MODULE */

#if defined(XENO_MAIN_MODULE) || \
    defined(RTIF_MAIN_MODULE) || \
    defined(RAW_MAIN_MODULE) || \
    defined(USER_MAIN_MODULE)

static int __attribute__ ((unused))

xnarch_read_environ (const char *name, const char **ptype, void *pvar)

{
    char *value;

    if (*ptype == NULL)
	return 0;	/* Already read in */

    *ptype = NULL;

    value = getenv(name);

    if (!value)
	return -1;

    if (**ptype == 's')
	*((char **)pvar) = value;
    else
	*((int *)pvar) = atoi(value);

    return 1;
}

/* Module arg macros */
#define vartype(var)               var ## _ ## tYpE
#define MODULE_DESCRIPTION(s);
#define MODULE_LICENSE(s);
#define MODULE_AUTHOR(s);
#define MODULE_PARM(var,type)      static const char *vartype(var) = type
#define MODULE_PARM_DESC(var,desc);
#define MODULE_PARM_VALUE(var)     (xnarch_read_environ(#var,&vartype(var),&var),var)

/* Nullify other kernel macros */
#define EXPORT_SYMBOL(sym);

#endif /* (XENO|RTIF|RAW|USER)_MAIN_MODULE */

#ifdef XENO_MAIN_MODULE

static inline int xnarch_init (void) {
    return 0;
}

static inline void xnarch_exit (void) {
}

int mvm_init_nanokernel(void);
void mvm_cleanup_nanokernel(void);
int mvm_init_interface(void);
void mvm_cleanup_interface(void);
int mvm_init_application(void);
void mvm_cleanup_application(void);

void mvm_root (void *cookie)

{
    int err;

    err = mvm_init_interface();

    if (err)
	__mvm_breakable(mvm_fatal)("init_interface() failed, err=%x\n",err);

    err = mvm_init_application();

    if (err)
	__mvm_breakable(mvm_fatal)("init_application() failed, err=%x\n",err);

    /* Wait for all RT-threads to finish */
    __mvm_breakable(mvm_join_threads)();

    mvm_cleanup_application();
    mvm_cleanup_interface();
    mvm_cleanup_nanokernel();

    __mvm_breakable(mvm_terminate)(0);
}

int main (int argc, char *argv[])

{
    xnarchtcb_t tcb;
    int err;

    err = mvm_init_nanokernel();

    if (err)
	__mvm_breakable(mvm_fatal)("init_nanokernel() failed, err=%x\n",err);

    mvm_init(argc,argv);

    tcb.entry = &mvm_root;
    tcb.cookie = NULL;
    tcb.kthread = NULL;
    tcb.vmthread = NULL;
    tcb.imask = 0;
    tcb.stacksize = 0;
    tcb.stackbase = NULL;

    return mvm_run(&tcb,(void *)&mvm_root);
}

#define INIT_MODULE    mvm_init_nanokernel
#define CLEANUP_MODULE mvm_cleanup_nanokernel

#else  /* !XENO_MAIN_MODULE */

#ifdef RTIF_MAIN_MODULE
#define INIT_MODULE    mvm_init_interface
#define CLEANUP_MODULE mvm_cleanup_interface
#else  /* !RTIF_MAIN_MODULE */
#define INIT_MODULE    mvm_init_application
#define CLEANUP_MODULE mvm_cleanup_application
#ifdef RAW_MAIN_MODULE
/* Entry/exit stubs for application modules directly using the
   nanokernel API */
int mvm_init_interface (void) {
    return 0;
}
void mvm_cleanup_interface (void) {
}
#endif /* RAW_MAIN_MODULE */
#endif /* RTIF_MAIN_MODULE */
#endif /* XENO_MAIN_MODULE */

#ifdef XENO_HEAP_MODULE

void *xnarch_sysalloc (unsigned bytes, int flags) {
    return malloc(bytes);
}

void xnarch_sysfree (void *chunk, unsigned bytes, int flags) {
    free(chunk);
}

#else /* !XENO_HEAP_MODULE */

void *xnarch_sysalloc(unsigned bytes,
		      int flags);

void xnarch_sysfree(void *chunk,
		    unsigned bytes,
		    int flags);

#endif /* XENO_HEAP_MODULE */

#ifdef XENO_POD_MODULE

static inline void xnarch_start_timer (unsigned long nstick,
				       void (*tickhandler)(void)) {
    mvm_start_timer(nstick,tickhandler);
}

static inline void xnarch_stop_timer (void) {
    mvm_stop_timer();
}

static inline void xnarch_enter_realtime(void) {
    /* Fake */
}

static inline void xnarch_exit_realtime(void) {
    /* Fake */
}

static inline void xnarch_switch_to (xnarchtcb_t *outtcb,
				     xnarchtcb_t *intcb) {

    __mvm_breakable(mvm_switch_threads)(outtcb->vmthread,intcb->vmthread);
}

static inline void xnarch_finalize_and_switch (xnarchtcb_t *deadtcb,
					       xnarchtcb_t *nexttcb) {

    mvm_finalize_switch_threads(deadtcb->vmthread,nexttcb->vmthread);
}

static inline void xnarch_finalize_no_switch (xnarchtcb_t *deadtcb) {

    if (deadtcb->vmthread)	/* Might be unstarted. */
	mvm_finalize_thread(deadtcb->vmthread);
}

static inline void xnarch_save_fpu(xnarchtcb_t *tcb) {
    /* Fake */
}

static inline void xnarch_restore_fpu(xnarchtcb_t *tcb) {
    /* Fake */
}

static inline void xnarch_init_tcb (xnarchtcb_t *tcb,
				    void *adcookie) { /* <= UNUSED */
    tcb->vmthread = NULL;
}

static inline void xnarch_init_thread (xnarchtcb_t *tcb,
				       void (*entry)(void *),
				       void *cookie,
				       int imask,
				       struct xnthread *thread,
				       char *name)
{
    tcb->imask = imask;
    tcb->kthread = thread;
    tcb->entry = entry;
    tcb->cookie = cookie;

    if (!entry)
	{
	tcb->vmthread = mvm_thread_self();
	return;
	}

    if (tcb->vmthread)	/* Restarting thread */
	{
	mvm_restart_thread(tcb->vmthread);
	return;
	}

    tcb->vmthread = mvm_spawn_thread(tcb,(void *)entry,name);
}

static inline void xnarch_init_root_thread (xnarchtcb_t *tcb,
					    struct xnthread *thread,
					    char *name)
{
    tcb->imask = 0;
    tcb->kthread = thread;
    tcb->entry = NULL;
    tcb->cookie = XNARCH_THREAD_COOKIE;
    tcb->vmthread = mvm_thread_self();
}

static inline void xnarch_init_fpu(xnarchtcb_t *tcb) {
    /* Fake */
}

int xnarch_setimask (int imask) {
    return mvm_set_irqmask(imask);
}

static inline void xnarch_halt (const char *emsg) {
    __mvm_breakable(mvm_fatal)("%s",emsg);
}

#define xnarch_announce_tick() /* Nullified */

#define xnarch_notify_ready() mvm_finalize_init()

#endif /* XENO_POD_MODULE */

static inline unsigned long long xnarch_tsc_to_ns (unsigned long long ts) {
    return ts;
}

static inline unsigned long long xnarch_get_cpu_time (void) {
    return mvm_get_cpu_time();
}

static inline unsigned long long xnarch_get_cpu_tsc (void) {
    return mvm_get_cpu_time();
}

static inline unsigned long xnarch_get_cpu_freq (void) {
    return mvm_get_cpu_freq();
}

int xnarch_setimask(int imask);

#ifdef __cplusplus
}
#endif

#define TEST_START(n)
#define TEST_MARK()
#define TEST_ASSERT(cond) { if (cond) ; }
#define TEST_ASSERT_OK(cond) { if (cond) ; }
#define TEST_FINISH()

typedef struct mvm_displayctl {

    void (*objctl)(struct mvm_displayctx *ctx, int op, const char *arg);
    const char *prefix;		/* Tcl prefix for iface procs */
    const char *group;		/* Plotting group of state diagram */
    const char *const *sarray;	/* States displayed in state diagram */

} mvm_displayctl_t;

#define MVM_DECL_DISPLAY_CONTROL(tag,objctl,group,slist...) \
void objctl(struct mvm_displayctx *ctx, int op, const char *arg); \
static const char *__mvm_sarray ## tag [] = { slist, NULL }; \
 mvm_displayctl_t __mvm_displayctl_ ## tag = { \
 objctl, \
 #tag, \
 (group), \
 __mvm_sarray ## tag, \
}

struct MvmDashboard;
struct MvmGraph;

typedef struct mvm_displayctx {

    struct MvmDashboard *dashboard; /* A control board */
    struct MvmGraph *graph;	/* A state diagram */
    mvm_displayctl_t *control;	/* The associated control block */
    void *obj;			/* The rt-iface object */

} mvm_displayctx_t;

#define XNARCH_DECL_DISPLAY_CONTEXT() \
mvm_displayctx_t __mvm_display_context

#define xnarch_init_display_context(obj) \
do { \
(obj)->__mvm_display_context.dashboard = NULL; \
(obj)->__mvm_display_context.graph = NULL; \
} while(0)

#define xnarch_create_display(obj,name,tag) \
do { \
extern mvm_displayctl_t __mvm_displayctl_ ## tag; \
mvm_create_display(&(obj)->__mvm_display_context,&__mvm_displayctl_ ## tag,obj,name); \
} while(0)

#define xnarch_delete_display(obj) \
mvm_delete_display(&(obj)->__mvm_display_context)

#define xnarch_post_graph(obj,state) \
__mvm_breakable(mvm_post_graph)(&(obj)->__mvm_display_context,state)

#define xnarch_post_graph_if(obj,state,cond) \
do \
if (cond) \
__mvm_breakable(mvm_post_graph)(&(obj)->__mvm_display_context,state); \
while(0)

#endif /* !_nucleus_arch_mvm_h */
@


1.45
log
@More configuration fixes + mvm_callback API
@
text
@a37 2
#define CRITICAL_ENTER(x)  ATOMIC_ENTER(x)
#define CRITICAL_EXIT(x)   ATOMIC_EXIT(x)
@


1.44
log
@More doc...
@
text
@d131 8
@


1.43
log
@More Adeos tuning
@
text
@d48 2
a49 1
#define XNARCH_ROOT_STACKSZ  0	/* Only a placeholder -- no stack */
@


1.42
log
@Documentation updates
@
text
@d36 4
a39 2
#define ATOMIC_ENTER(x)  ((x) = mvm_set_irqmask(-1))
#define ATOMIC_EXIT(x)   mvm_set_irqmask(x)
@


1.41
log
@Rewrite FPU support of kernel-based layers
@
text
@a31 2
#define ATOMIC_ENTER(x)  ((x) = mvm_set_irqmask(-1))
#define ATOMIC_EXIT(x)   mvm_set_irqmask(x)
d35 3
@


1.40
log
@Sync
@
text
@d462 12
a473 2
static inline void xnarch_init_fpu(xnarchtcb_t *currtcb,
				   xnarchtcb_t *newtcb) {
@


1.39
log
@Add interrupt reenabling
@
text
@d73 2
d129 2
d491 4
@


1.38
log
@Add fault information type
@
text
@d218 5
a222 1
static inline void xnarch_chain_irq (unsigned irq) {
@


1.37
log
@Finalize the initial Adeos layer
@
text
@d69 2
@


1.36
log
@Rework context switching code
@
text
@d471 4
d482 2
@


1.35
log
@More Adeos compat
@
text
@a325 1
    tcb.sp = NULL;
@


1.34
log
@Cosmetic changes
@
text
@d45 1
@


1.33
log
@Update of the wind4xeno API.
@
text
@a63 1
    int *sp;			/* Saved stack pointer */
a226 1
mvm_read_environ (const char *name, const char **ptype, void *pvar) {
d228 3
d258 1
a258 1
#define MODULE_PARM_VALUE(var)     (mvm_read_environ(#var,&vartype(var),&var), var)
@


1.32
log
@Fix queue debug
@
text
@d456 2
a457 2
static inline void xnarch_setimask (int imask) {
    mvm_set_irqmask(imask);
@


1.31
log
@Arch-dependent cookie fix
@
text
@d474 4
@


1.30
log
@Pre-release freeze
@
text
@d419 2
a420 1
static inline void xnarch_init_tcb (xnarchtcb_t *tcb) {
@


1.29
log
@Merge 1.0-pre4
@
text
@d44 2
@


1.28
log
@Debugger support
@
text
@d32 2
a33 2
#define CRITICAL_ENTER(x)  ((x) = mvm_set_irqmask(-1))
#define CRITICAL_EXIT(x)   mvm_set_irqmask(x)
d35 2
d73 13
d108 2
d222 1
a222 1
    defined(TEST_MAIN_MODULE) || \
d260 1
a260 1
#endif /* (XENO|RTIF|TEST|USER)_MAIN_MODULE */
d339 3
a341 2
#ifdef TEST_MAIN_MODULE
/* Stub emulation module entry/exit for test programs */
d347 1
a347 1
#endif /* TEST_MAIN_MODULE */
d405 2
a406 1
    mvm_finalize_thread(deadtcb->vmthread);
d457 2
a458 3
static inline void xnarch_halt (void) {
    __mvm_breakable(mvm_break)();
    __mvm_breakable(mvm_terminate)(1);
@


1.27
log
@Fix prototypes
@
text
@d438 1
a438 1
static inline void xnarch_freeze (void) {
@


1.26
log
@Sync
@
text
@d365 1
a365 1
static inline void xnarch_enter_realtime() {
d369 1
a369 1
static inline void xnarch_exit_realtime() {
@


1.25
log
@Fix compilation problems
@
text
@d281 1
d308 1
a308 5
    err = mvm_run(&tcb,(void *)&mvm_root);

    mvm_cleanup_nanokernel();

    return err;
@


1.24
log
@More uITRON stuff
@
text
@d4 1
a4 1
 * Copyright (c) 2001,2002 Philippe Gerum <rpm@@nanodwarf.org>.
@


1.23
log
@Sync
@
text
@d69 1
@


1.22
log
@Sync
@
text
@d441 1
@


1.21
log
@Add mvm_break()
@
text
@d63 1
a63 1
} xnarchtcb_t ;
@


1.20
log
@Make MVM termination more graceful
@
text
@d129 2
@


1.19
log
@Add initial VRTAI support
@
text
@d125 1
a125 1
void mvm_terminate(int xcode);
d279 1
a279 1
    mvm_terminate(0);
d439 1
a439 1
    mvm_terminate(1);
@


1.18
log
@Finalize the dashboard support
@
text
@d20 2
a21 2
 * Description: This file defines the platform-dependent support for
 * the Minute Virtual Machine.
d33 1
a33 1
#define CRITICAL_EXIT(x)   (mvm_set_irqmask(x))
d47 2
a48 1
struct mvm_tcl_listobj;
d70 1
a70 1
#define ____mvm_breakable(f) f ## $kdoor$
d117 1
a117 1
void ____mvm_breakable(mvm_switch_threads)(struct XenoThread *out,
d127 1
a127 1
void ____mvm_breakable(mvm_fatal)(const char *format, ...);
d129 1
a129 1
void ____mvm_breakable(mvm_join_threads)(void);
d141 1
a141 1
void ____mvm_breakable(mvm_post_graph)(struct mvm_displayctx *ctx,
d144 1
a144 1
void mvm_tcl_init_list(struct mvm_tcl_listobj *tclist);
d146 1
a146 1
void mvm_tcl_destroy_list(struct mvm_tcl_listobj *tclist);
d148 1
a148 1
void mvm_tcl_set(struct mvm_tcl_listobj *tclist,
d151 1
a151 1
void mvm_tcl_append(struct mvm_tcl_listobj *tclist,
d154 1
a154 1
void mvm_tcl_clear(struct mvm_tcl_listobj *tclist);
d156 1
a156 1
void mvm_tcl_append_int(struct mvm_tcl_listobj *tclist,
d159 1
a159 1
void mvm_tcl_append_hex(struct mvm_tcl_listobj *tclist,
d162 2
a163 2
void mvm_tcl_append_list(struct mvm_tcl_listobj *tclist,
			 struct mvm_tcl_listobj *tclist2);
d165 1
a165 1
const char *mvm_tcl_value(struct mvm_tcl_listobj *tclist);
d167 1
a167 1
void mvm_tcl_build_pendq(struct mvm_tcl_listobj *tclist,
d266 1
a266 1
	____mvm_breakable(mvm_fatal)("init_interface() failed, err=%x\n",err);
d271 1
a271 1
	____mvm_breakable(mvm_fatal)("init_application() failed, err=%x\n",err);
d274 1
a274 1
    ____mvm_breakable(mvm_join_threads)();
d291 1
a291 1
	____mvm_breakable(mvm_fatal)("init_nanokernel() failed, err=%x\n",err);
d376 1
a376 1
    ____mvm_breakable(mvm_switch_threads)(outtcb->vmthread,intcb->vmthread);
d442 1
a442 1
#define xnarch_announce_tick(); /* Nullified */
a492 6
struct TclList;

typedef struct mvm_tcl_listobj {
    struct TclList *listobj;
} mvm_tcl_listobj_t;

d512 1
a512 1
____mvm_breakable(mvm_post_graph)(&(obj)->__mvm_display_context,state)
d517 1
a517 1
____mvm_breakable(mvm_post_graph)(&(obj)->__mvm_display_context,state); \
@


1.17
log
@Finalize the MVM object interface
@
text
@d43 1
d166 3
d471 1
a471 1
extern void objctl(struct mvm_displayctx *ctx, int op, const char *arg); \
d480 1
a480 1
struct MvmDisplay;
d485 1
a485 1
    struct MvmDisplay *display; /* A display interface */
d503 1
a503 1
(obj)->__mvm_display_context.display = NULL; \
d505 1
a505 1
} while (0)
d508 4
a511 1
mvm_create_display(&(obj)->__mvm_display_context,&__mvm_displayctl_ ## tag,obj,name)
d523 1
a523 1
while (0)
@


1.16
log
@Reshape MVM object display support
@
text
@d46 1
d107 4
d129 3
a131 2
void mvm_create_display(struct mvm_displayctx *displayctx,
			struct mvm_displayctl *displayctl,
d134 17
a150 1
void mvm_delete_display(struct mvm_displayctx *displayctx);
d152 12
a163 2
void ____mvm_breakable(mvm_post_statediagram)(struct mvm_displayctx *displayctx,
					      int state);
d459 4
a462 5
    void (*expose)(const char *);
    void (*configure)(const char *);
    void (*trigger)(const char *);
    const char *group;
    const char *const *sarray;	/* State array */
d466 2
a467 1
#define XNARCH_DECL_DISPLAY_CONTROL(tag,expose,configure,trigger,group,slist...) \
d469 5
a473 6
mvm_displayctl_t __mvm_displayctl_ ## tag = { \
expose, \
configure, \
trigger, \
group, \
__mvm_sarray ## tag, \
d477 1
d482 1
d484 1
d488 6
d498 4
a501 1
((obj)->__mvm_display_context.display = NULL)
d503 2
a504 3
#define xnarch_create_display(obj,name,tag) { \
mvm_create_display(&(obj)->__mvm_display_context,&__mvm_displayctl_ ## tag,name); \
}
d509 2
a510 2
#define xnarch_post_statediagram(obj,state) \
____mvm_breakable(mvm_post_statediagram)(&(obj)->__mvm_display_context,state)
d512 1
a512 1
#define xnarch_post_statediagram_if(obj,state,cond) \
d515 1
a515 1
____mvm_breakable(mvm_post_statediagram)(&(obj)->__mvm_display_context,state); \
@


1.15
log
@Substitute missing RTAI_ROOTDIR in acinclude
@
text
@d44 2
a45 1
struct mvm_traceblock;
d67 1
a67 1
#define __hide_inner(f) f ## $kdoor$
d110 2
a111 2
void __hide_inner(mvm_switch_threads)(struct XenoThread *out,
			       struct XenoThread *in);
d120 1
a120 1
void __hide_inner(mvm_fatal)(const char *format, ...);
d122 1
a122 1
void __hide_inner(mvm_join_threads)(void);
d124 3
a126 4
void mvm_create_statediagram(struct mvm_traceblock *traceblock,
			     const char *name,
			     const char *group,
			     const char *const *sarray);
d128 1
a128 1
void mvm_delete_statediagram(struct mvm_traceblock *traceblock);
d130 2
a131 2
void __hide_inner(mvm_post_statediagram)(struct mvm_traceblock *traceblock,
				  int state);
d229 1
a229 1
	__hide_inner(mvm_fatal)("init_interface() failed, err=%x\n",err);
d234 1
a234 1
	__hide_inner(mvm_fatal)("init_application() failed, err=%x\n",err);
d237 1
a237 1
    __hide_inner(mvm_join_threads)();
d254 1
a254 1
	__hide_inner(mvm_fatal)("init_nanokernel() failed, err=%x\n",err);
d339 1
a339 1
    __hide_inner(mvm_switch_threads)(outtcb->vmthread,intcb->vmthread);
d425 20
d447 1
a447 1
typedef struct mvm_traceblock {
d449 2
a450 2
    struct MvmDisplay *graph; /* A display interface */
    const char *const *sarray;	/* Its associated states */
d452 1
a452 1
} mvm_traceblock_t;
d454 2
a455 2
#define XNARCH_TRACE_CONTROL_BLOCK() \
mvm_traceblock_t __mvm_trace_block
d457 2
a458 2
#define xnarch_init_trace_control(obj) \
((obj)->__mvm_trace_block.graph = NULL)
d460 2
a461 3
#define xnarch_declare_statediagram(obj,name,group,slist...) { \
static const char *__mvm_sarray[] = { slist, NULL }; \
mvm_create_statediagram(&(obj)->__mvm_trace_block,name,group,__mvm_sarray); \
d464 2
a465 2
#define xnarch_remove_statediagram(obj) \
mvm_delete_statediagram(&(obj)->__mvm_trace_block)
d468 1
a468 1
__hide_inner(mvm_post_statediagram)(&(obj)->__mvm_trace_block,state)
d473 1
a473 1
__hide_inner(mvm_post_statediagram)(&(obj)->__mvm_trace_block,state); \
@


1.14
log
@Rearrange display backends
@
text
@d434 1
a434 1
#define XNARCH_TRACE_CONTROL_BLOCK \
@


1.13
log
@Finalize simulation adaptors
@
text
@d425 1
a425 1
struct MvmStateExportObject;
d429 1
a429 1
    struct MvmStateExportObject *graph; /* A state diagram object */
@


1.12
log
@Make the MVM application-neutral
@
text
@d37 1
a37 1
#define XNARCH_IRQ_MAX            32
d66 1
a66 13
#ifndef name2
#define name2(a,b) a ## b
#endif // !name2

#define kdoor(f) name2(f,$kdoor$)
#define khook(f) name2(f,$khook$)
#define kisrt(f) name2(f,$kisrt$)
#define kdsrt(f) name2(f,$kdsrt$)
#define kroot(f) name2(f,$kroot$)
#define kcout(f) name2(f,$kcout$)
#define kidle(f) name2(f,$kidle$)
#define kinit(f) name2(f,$kinit$)
#define khide(f) name2(f,$khide$)
d74 5
a78 5
int mvm_run(int argc,
	    char *argv[],
	    void *tcbarg,
	    void *faddr,
	    void (*trampoline)(void *));
d109 1
a109 1
void kdoor(mvm_switch_threads)(struct XenoThread *out,
d119 1
a119 1
void kdoor(mvm_fatal)(const char *format, ...);
d121 1
a121 1
void kdoor(mvm_join_threads)(void);
d130 1
a130 1
void kdoor(mvm_post_statediagram)(struct mvm_traceblock *traceblock,
d229 1
a229 1
	kdoor(mvm_fatal)("init_interface() failed, err=%x\n",err);
d234 1
a234 1
	kdoor(mvm_fatal)("init_application() failed, err=%x\n",err);
d237 1
a237 1
    kdoor(mvm_join_threads)();
a244 13
static void mvm_thread_trampoline (xnarchtcb_t *tcb)

{
    tcb->vmthread = mvm_thread_self();

    if (tcb->kthread)
	xnpod_welcome_thread(tcb->kthread);

    mvm_set_irqmask(tcb->imask);

    tcb->entry(tcb->cookie);
}

d254 3
a256 1
	kdoor(mvm_fatal)("init_nanokernel() failed, err=%x\n",err);
d267 1
a267 5
    err = mvm_run(argc,
		  argv,
		  &tcb,
		  (void *)&mvm_root,
		  (void (*)(void *))&mvm_thread_trampoline);
d339 1
a339 1
    kdoor(mvm_switch_threads)(outtcb->vmthread,intcb->vmthread);
d377 1
a377 1
    if (!entry)	/* i.e. self-initializing MVM root thread */
d449 1
a449 1
kdoor(mvm_post_statediagram)(&(obj)->__mvm_trace_block,state)
d454 1
a454 1
kdoor(mvm_post_statediagram)(&(obj)->__mvm_trace_block,state); \
@


1.11
log
@More MVM traces
@
text
@d88 3
a90 1
	    void (*entry)(void *));
d92 1
a92 1
void mvm_init_tracing(void);
d113 2
a114 1
struct XenoThread *mvm_spawn_thread(xnarchtcb_t *tcb,
d205 3
a207 3
#define MODULE_DESCRIPTION(s)
#define MODULE_LICENSE(s)
#define MODULE_AUTHOR(s)
d209 1
a209 1
#define MODULE_PARM_DESC(var,desc)
a242 2
    mvm_init_tracing();

d257 9
a265 1
int main (int argc, char *argv[]) {
d267 7
d281 14
a294 1
    err = mvm_run(argc,argv,mvm_root);
a320 1

d416 1
a416 1
    tcb->vmthread = mvm_spawn_thread(tcb,name);
d432 3
a434 1
#define xnarch_announce_tick() /* Nullified */
@


1.10
log
@Add initial support for using MVM's state diagrams
@
text
@d90 1
a90 1
void mvm_init_tracer(void);
d137 5
d240 1
a240 1
    mvm_init_tracer();
d441 12
@


1.9
log
@Map printk() to printf()
@
text
@d44 1
d90 2
d132 5
d235 2
a406 8
void mvm_new_statediagram(void *handle,
			  const char *name,
			  const char *group,
			  const char *const *sarray);

void mvm_post_statediagram(void *handle,
			   int state);

d417 1
a417 2
#define xntrace_declare_states(sarray) \
mvm_declare_states(sarray)
d419 1
a419 2
#define xntrace_new_statediagram(handle,name,group,sarray) \
mvm_new_statediagram(handle,name,group,sarray)
d421 15
a435 2
#define xntrace_post_statediagram(handle,state) \
mvm_post_statediagram(handle,state)
@


1.8
log
@Fix MVM debug stepping
@
text
@d61 1
@


1.7
log
@MVM baseline
@
text
@d52 1
a52 1
    /* The following fields are unused by the minute-VM,
d110 2
d345 1
d348 6
a353 6
static inline void xnarch_init_stack (xnarchtcb_t *tcb,
				      void (*entry)(void *),
				      void *cookie,
				      int imask,
				      struct xnthread *thread,
				      char *name)
d363 6
@


1.6
log
@Partial sync
@
text
@d390 1
a390 1
			  const char *sarray);
@


1.5
log
@MVM updates
@
text
@d387 8
d404 9
@


1.4
log
@Update MVM support
@
text
@d52 2
d55 2
a56 2
    int *sp;			/* Saved stack pointer - unused */
    int *stackbase;		/* Stack space - unused */
d232 1
d234 1
a234 1
    mvm_cleanup_application();
d238 1
a238 1
int main (int argc, char *argv[])
a239 1
{
d249 1
a249 2
    if (!err)
	mvm_cleanup_nanokernel();
@


1.3
log
@Change MVM support file
@
text
@d62 14
a85 2
void mvm_join_threads(void);

d110 2
a111 2
void mvm_switch_threads(struct XenoThread *out,
			struct XenoThread *in);
d120 3
a122 1
void mvm_fatal(const char *format, ...);
a216 5
    err = mvm_init_nanokernel();

    if (err)
	mvm_fatal("init_nanokernel() failed, err=%x\n",err);

d220 1
a220 1
	mvm_fatal("init_interface() failed, err=%x\n",err);
d225 1
a225 1
	mvm_fatal("init_application() failed, err=%x\n",err);
d227 2
a228 1
    mvm_join_threads();
d230 1
a231 3
    mvm_cleanup_interface();
    mvm_cleanup_nanokernel();

d235 14
a248 1
int main (int argc, char *argv[]) {
d250 1
a250 1
    return mvm_run(argc,argv,mvm_root);
d319 1
a319 1
    mvm_switch_threads(outtcb->vmthread,intcb->vmthread);
@


1.2
log
@Add Minute VM support file
@
text
@d68 3
a70 1
int mvm_run(int argc, char *argv[], void (*entry)(void));
d93 1
a93 3
struct XenoThread *mvm_spawn_thread(void (*entry)(void *cookie),
				    void *cookie,
				    struct xnthread *kthread,
d198 1
a198 1
void mvm_root (void)
a322 8
static void mvm_thread_trampoline (void *cookie)

{
    xnarchtcb_t *tcb = (xnarchtcb_t *)cookie;
    xnpod_welcome_thread(tcb->kthread);
    tcb->entry(tcb->cookie);
}

d341 1
a341 4
    tcb->vmthread = mvm_spawn_thread(mvm_thread_trampoline,
				     tcb,
				     thread,
				     name);
@


1.1
log
@Fix Tcl deps
@
text
@d36 1
a36 1
#define XNARCH_DEFAULT_TICK       0
d96 2
d223 2
d344 2
d347 1
d352 1
a352 1
				     NULL);
@

Results 1 - 1
Help - FTP Sites List - Software Dir.
Searching half a billion files worldwide
© 1997-2008 IT MARUHN