Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
 *
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
 *               Gerardo Lamastra <gerardo@sssup.it>
 *
 * Authors     : Massimiliano Giorgi <massy@hartik.sssup.it>
 * (see authors.txt for full list of hartik's authors)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://hartik.sssup.it
 */


/*
 * Copyright (C) 2000 Massimiliano Giorgi
 *
 * 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
 *
 */


/*
 * CVS :        $Id: dfixed.c,v 1.1.1.1 2004-05-24 18:03:44 giacomo Exp $
 *
 * File:        $File$
 * Revision:    $Revision: 1.1.1.1 $
 * Last update: $Date: 2004-05-24 18:03:44 $
 */


/*
 * Example of tracer initialization.
 */


#include <ll/i386/cons.h>

#include <kernel/func.h>
#include <tracer.h>

#include <fs/bdevinit.h>
#include <fs/fsinit.h>
#include <fs/bdev.h>

#include <drivers/keyb.h>

#include <trace.h>
#include <queues.h>

#include <sys/mount.h>
#include <stddef.h>


void mytracer_prologue(void)
{
  int myqueue;
  TRC_PARMS p;
  TRC_FIXED_PARMS f;

  trc_default_parms(p);
  trc_def_path(p,"");

  trc_fixed_default_parms(f);
  trc_fixed_def_filename(f,"fixed");

  /* Tracer Initialization */
  /* the first functions to call... parameters can be passed */
  TRC_init_phase1(&p);

  /* all the tracer queue types must be registered */
  trc_register_dosfs_fixed_queue();

  /* then, we create all the queues we need */
  myqueue = trc_create_queue(TRC_DOSFS_FIXED_QUEUE,&f);

  /* Then, we say that events must be sent to a particular queue */
  trc_trace_class(TRC_CLASS_SYSTEM);
  trc_assign_class_to_queue(TRC_CLASS_SYSTEM, myqueue);
}

void mytracer_epilogue(void)
{
  TRC_init_phase2();
}

void ctrlc_exit(KEY_EVT *k)
{
  sys_end();
}

void *mytask(void *arg)
{
  int i;

  for(i=0; i<10; i++) {
    cprintf("%d ", i);
    task_endcycle();
  }

  return 0;
}

int main(int argc,char *argv[])
{
  SOFT_TASK_MODEL mp;

  PID pid;

  soft_task_default_model(mp);
  soft_task_def_met(mp, 10000);
  soft_task_def_period(mp,50000);
  soft_task_def_usemath(mp);

  cprintf("\nHello, world!\n");

  pid = task_create("mytask", mytask, &mp, NULL);

  if (pid != NIL) task_activate(pid);

  return 0;
}