/* uos.h. Microkernel header for Or1ksim
|
/* uos.h. Microkernel header for Or1ksim
|
|
|
Copyright (C) 2000 Damjan Lampret
|
Copyright (C) 2000 Damjan Lampret
|
Copyright (C) 2010 Embecosm Limited
|
Copyright (C) 2010 Embecosm Limited
|
|
|
Contributor Damjan Lampret <lampret@opencores.org>
|
Contributor Damjan Lampret <lampret@opencores.org>
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
|
|
This program is free software; you can redistribute it and/or modify it
|
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
|
under the terms of the GNU General Public License as published by the Free
|
Software Foundation; either version 3 of the License, or (at your option)
|
Software Foundation; either version 3 of the License, or (at your option)
|
any later version.
|
any later version.
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
more details.
|
more details.
|
|
|
You should have received a copy of the GNU General Public License along
|
You should have received a copy of the GNU General Public License along
|
with this program. If not, see <http: www.gnu.org/licenses/>. */
|
with this program. If not, see <http: www.gnu.org/licenses/>. */
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
This code is commented throughout for use with Doxygen.
|
This code is commented throughout for use with Doxygen.
|
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
|
|
/* This file is part of test microkernel for OpenRISC 1000. */
|
/* This file is part of test microkernel for OpenRISC 1000. */
|
|
|
/* Length of the IPC message's useful data. */
|
/* Length of the IPC message's useful data. */
|
#define MAX_MSGLEN 100
|
#define MAX_MSGLEN 100
|
|
|
/* Number of user tasks in the system. */
|
/* Number of user tasks in the system. */
|
#define MAX_TASKS 8
|
#define MAX_TASKS 8
|
|
|
/* Number of IPC messages in the system. */
|
/* Number of IPC messages in the system. */
|
#define MAX_MSGS 16
|
#define MAX_MSGS 16
|
|
|
/* Number of general purpose registers (not counting r0 and r1). */
|
/* Number of general purpose registers (not counting r0 and r1). */
|
#define GPRS 30
|
#define GPRS 30
|
|
|
/* Size of kernel and user task stacks. Size for individual task. */
|
/* Size of kernel and user task stacks. Size for individual task. */
|
#define STACK_SIZE 2048
|
#define STACK_SIZE 2048
|
|
|
/* Define this if you want kernel debug output. Note that you must
|
/* Define this if you want kernel debug output. Note that you must
|
assemble except_or32.S with KERNEL_OUTPUT defined in Makefile. This
|
assemble except_or32.S with KERNEL_OUTPUT defined in Makefile. This
|
definition is only for main uos.c. */
|
definition is only for main uos.c. */
|
#define KERNEL_OUTPUT 0
|
#define KERNEL_OUTPUT 0
|
|
|
/* Define this if you want task switch at every system call. */
|
/* Define this if you want task switch at every system call. */
|
#define KERNEL_SYSCALL_SCHED 0
|
#define KERNEL_SYSCALL_SCHED 0
|
|
|
/* System tick timer period */
|
/* System tick timer period */
|
#define TICK_PERIOD 0x500
|
#define TICK_PERIOD 0x500
|
|
|
/* Task ID type (if we would have processes then we would call it PID) */
|
/* Task ID type (if we would have processes then we would call it PID) */
|
typedef int tid_t;
|
typedef int tid_t;
|
|
|
/* System call numbers */
|
/* System call numbers */
|
#define IPC_MSGSND 1
|
#define IPC_MSGSND 1
|
#define IPC_MSGRCV 2
|
#define IPC_MSGRCV 2
|
|
|
/* Message Control Block structure */
|
/* Message Control Block structure */
|
struct mcb {
|
struct mcb {
|
char msg[MAX_MSGLEN]; /* Message's data */
|
char msg[MAX_MSGLEN]; /* Message's data */
|
int length; /* Message's length */
|
int length; /* Message's length */
|
tid_t origin; /* TID of message's origin task */
|
tid_t origin; /* TID of message's origin task */
|
struct mcb *next; /* Next message in linked list */
|
struct mcb *next; /* Next message in linked list */
|
};
|
};
|
|
|
/* Task Control Block structure */
|
/* Task Control Block structure */
|
struct tcb {
|
struct tcb {
|
struct regs {
|
struct regs {
|
unsigned long pc; /* Task's PC */
|
unsigned long pc; /* Task's PC */
|
unsigned long sp; /* Task's stack (r1)*/
|
unsigned long sp; /* Task's stack (r1)*/
|
unsigned long gprs[GPRS]; /* Task's GPRs r2-r15 */
|
unsigned long gprs[GPRS]; /* Task's GPRs r2-r15 */
|
unsigned long sr; /* Task's supervision register */
|
unsigned long sr; /* Task's supervision register */
|
} regs;
|
} regs;
|
struct mcb *waiting_msgs; /* Waiting messages */
|
struct mcb *waiting_msgs; /* Waiting messages */
|
};
|
};
|
|
|
extern void dispatch();
|
extern void dispatch();
|
/* Called by kernel_init to collect all tasks entries. */
|
/* Called by kernel_init to collect all tasks entries. */
|
extern void tasks_entries();
|
extern void tasks_entries();
|
|
|