1 |
90 |
jeremybenn |
/* uos.h. Microkernel header for Or1ksim
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2000 Damjan Lampret
|
4 |
|
|
Copyright (C) 2010 Embecosm Limited
|
5 |
|
|
|
6 |
|
|
Contributor Damjan Lampret <lampret@opencores.org>
|
7 |
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
8 |
|
|
|
9 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
10 |
|
|
|
11 |
|
|
This program is free software; you can redistribute it and/or modify it
|
12 |
|
|
under the terms of the GNU General Public License as published by the Free
|
13 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
14 |
|
|
any later version.
|
15 |
|
|
|
16 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
19 |
|
|
more details.
|
20 |
|
|
|
21 |
|
|
You should have received a copy of the GNU General Public License along
|
22 |
|
|
with this program. If not, see <http: www.gnu.org/licenses/>. */
|
23 |
|
|
|
24 |
|
|
/* ----------------------------------------------------------------------------
|
25 |
|
|
This code is commented throughout for use with Doxygen.
|
26 |
|
|
--------------------------------------------------------------------------*/
|
27 |
|
|
|
28 |
|
|
/* This file is part of test microkernel for OpenRISC 1000. */
|
29 |
|
|
|
30 |
|
|
/* Length of the IPC message's useful data. */
|
31 |
|
|
#define MAX_MSGLEN 100
|
32 |
|
|
|
33 |
|
|
/* Number of user tasks in the system. */
|
34 |
|
|
#define MAX_TASKS 8
|
35 |
|
|
|
36 |
|
|
/* Number of IPC messages in the system. */
|
37 |
|
|
#define MAX_MSGS 16
|
38 |
|
|
|
39 |
|
|
/* Number of general purpose registers (not counting r0 and r1). */
|
40 |
|
|
#define GPRS 30
|
41 |
|
|
|
42 |
|
|
/* Size of kernel and user task stacks. Size for individual task. */
|
43 |
|
|
#define STACK_SIZE 2048
|
44 |
|
|
|
45 |
|
|
/* Define this if you want kernel debug output. Note that you must
|
46 |
|
|
assemble except_or32.S with KERNEL_OUTPUT defined in Makefile. This
|
47 |
|
|
definition is only for main uos.c. */
|
48 |
|
|
#define KERNEL_OUTPUT 0
|
49 |
|
|
|
50 |
|
|
/* Define this if you want task switch at every system call. */
|
51 |
|
|
#define KERNEL_SYSCALL_SCHED 0
|
52 |
|
|
|
53 |
|
|
/* System tick timer period */
|
54 |
|
|
#define TICK_PERIOD 0x500
|
55 |
|
|
|
56 |
|
|
/* Task ID type (if we would have processes then we would call it PID) */
|
57 |
|
|
typedef int tid_t;
|
58 |
|
|
|
59 |
|
|
/* System call numbers */
|
60 |
|
|
#define IPC_MSGSND 1
|
61 |
|
|
#define IPC_MSGRCV 2
|
62 |
|
|
|
63 |
|
|
/* Message Control Block structure */
|
64 |
|
|
struct mcb {
|
65 |
|
|
char msg[MAX_MSGLEN]; /* Message's data */
|
66 |
|
|
int length; /* Message's length */
|
67 |
|
|
tid_t origin; /* TID of message's origin task */
|
68 |
|
|
struct mcb *next; /* Next message in linked list */
|
69 |
|
|
};
|
70 |
|
|
|
71 |
|
|
/* Task Control Block structure */
|
72 |
|
|
struct tcb {
|
73 |
|
|
struct regs {
|
74 |
|
|
unsigned long pc; /* Task's PC */
|
75 |
|
|
unsigned long sp; /* Task's stack (r1)*/
|
76 |
|
|
unsigned long gprs[GPRS]; /* Task's GPRs r2-r15 */
|
77 |
|
|
unsigned long sr; /* Task's supervision register */
|
78 |
|
|
} regs;
|
79 |
|
|
struct mcb *waiting_msgs; /* Waiting messages */
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
extern void dispatch();
|
83 |
|
|
/* Called by kernel_init to collect all tasks entries. */
|
84 |
|
|
extern void tasks_entries();
|