Subversion Repositories shark

Rev

Rev 1655 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/*
2
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *               Gerardo Lamastra <gerardo@sssup.it>
6
 *
7
 * Authors     : Massimiliano Giorgi <massy@hartik.sssup.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://hartik.sssup.it
15
 */
16
 
17
/*
18
 * Copyright (C) 2000 Massimiliano Giorgi
19
 *
20
 * This program is free software; you can redistribute it and/or modify
21
 * it under the terms of the GNU General Public License as published by
22
 * the Free Software Foundation; either version 2 of the License, or
23
 * (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
33
 *
34
 */
35
 
36
/*
37
 * CVS :        $Id: dfixed.c,v 1.1.1.1 2004-05-24 18:03:44 giacomo Exp $
38
 *
39
 * File:        $File$
40
 * Revision:    $Revision: 1.1.1.1 $
41
 * Last update: $Date: 2004-05-24 18:03:44 $
42
 */
43
 
44
/*
45
 * Example of tracer initialization.
46
 */
47
 
48
#include <ll/i386/cons.h>
49
 
50
#include <kernel/func.h>
51
#include <tracer.h>
52
 
53
#include <fs/bdevinit.h>
54
#include <fs/fsinit.h>
55
#include <fs/bdev.h>
56
 
57
#include <drivers/keyb.h>
58
 
59
#include <trace.h>
60
#include <queues.h>
61
 
62
#include <sys/mount.h>
63
#include <stddef.h>
64
 
65
 
66
void mytracer_prologue(void)
67
{
68
  int myqueue;
69
  TRC_PARMS p;
70
  TRC_FIXED_PARMS f;
71
 
72
  trc_default_parms(p);
73
  trc_def_path(p,"");
74
 
75
  trc_fixed_default_parms(f);
76
  trc_fixed_def_filename(f,"fixed");
77
 
78
  /* Tracer Initialization */
79
  /* the first functions to call... parameters can be passed */
80
  TRC_init_phase1(&p);
81
 
82
  /* all the tracer queue types must be registered */
83
  trc_register_dosfs_fixed_queue();
84
 
85
  /* then, we create all the queues we need */
86
  myqueue = trc_create_queue(TRC_DOSFS_FIXED_QUEUE,&f);
87
 
88
  /* Then, we say that events must be sent to a particular queue */
89
  trc_trace_class(TRC_CLASS_SYSTEM);
90
  trc_assign_class_to_queue(TRC_CLASS_SYSTEM, myqueue);
91
}
92
 
93
void mytracer_epilogue(void)
94
{
95
  TRC_init_phase2();
96
}
97
 
98
void ctrlc_exit(KEY_EVT *k)
99
{
100
  sys_end();
101
}
102
 
103
void *mytask(void *arg)
104
{
105
  int i;
106
 
107
  for(i=0; i<10; i++) {
108
    cprintf("%d ", i);
109
    task_endcycle();
110
  }
111
 
112
  return 0;
113
}
114
 
115
int main(int argc,char *argv[])
116
{
117
  SOFT_TASK_MODEL mp;
118
 
119
  PID pid;
120
 
121
  soft_task_default_model(mp);
122
  soft_task_def_met(mp, 10000);
123
  soft_task_def_period(mp,50000);
124
  soft_task_def_usemath(mp);
125
 
126
  cprintf("\nHello, world!\n");
127
 
128
  pid = task_create("mytask", mytask, &mp, NULL);
129
 
130
  if (pid != NIL) task_activate(pid);
131
 
132
  return 0;
133
}