/demos/trunk/servo/load.c |
---|
1,5 → 1,5 |
#include "kernel/kern.h" |
#include "drivers/keyb.h" |
#include "drivers/shark_keyb26.h" |
#include "servo.h" |
/demos/trunk/servo/initfile.c |
---|
1,51 → 1,37 |
/* |
* Project: S.Ha.R.K. |
* Project: S.Ha.R.K |
* |
* Coordinators: |
* Giorgio Buttazzo <giorgio@sssup.it> |
* Paolo Gai <pj@gandalf.sssup.it> |
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
* |
* Authors : |
* Giacomo Guidi <giacomo@gandalf.sssup.it> |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
* |
* http://www.sssup.it |
* http://retis.sssup.it |
* http://shark.sssup.it |
* http://hartik.sssup.it |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
* |
*/ |
#include "kernel/kern.h" |
#include "modules/edf.h" |
#include "modules/cbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
#include "modules/intdrive.h" |
#include "modules/sem.h" |
#include "modules/hartport.h" |
#include "modules/cabs.h" |
#include "drivers/keyb.h" |
#include "modules/pi.h" |
#include "modules/pc.h" |
#include "modules/srp.h" |
#include "modules/npp.h" |
#include "modules/nop.h" |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_keyb26.h> |
#define FRAME_BUFFER_DEVICE 0 |
/*+ sysyem tick in us +*/ |
#define TICK 0 |
52,18 → 38,36 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
/*+ Interrupt Server +*/ |
#define INTDRIVE_Q 1000 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAG 0 |
void call_shutdown_task(void *arg); |
int device_drivers_init(); |
int device_drivers_close(); |
void set_shutdown_task(); |
TASK shutdown_task_body(void *arg); |
PID shutdown_task_PID = -1; |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
EDF_register_level(EDF_ENABLE_ALL); |
CBS_register_level(CBS_ENABLE_ALL, 0); |
CBS_register_level(CBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
SEM_register_module(); |
CABS_register_module(); |
PI_register_module(); |
PC_register_module(); |
NPP_register_module(); |
SRP_register_module(); |
NOP_register_module(); |
return TICK; |
} |
74,10 → 78,87 |
HARTPORT_init(); |
KEYB_init(NULL); |
/* Create the shutdown task. It will be activated at RUNLEVEL |
SHUTDOWN */ |
set_shutdown_task(); |
/* Init the drivers */ |
device_drivers_init(); |
/* Set the shutdown task activation */ |
sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
__call_main__(mb); |
return (void *)0; |
} |
void set_shutdown_task() { |
/* WARNING: the shutdown task is a background thread. It cannot execute |
if the system is overloaded */ |
NRT_TASK_MODEL nrt; |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
if (shutdown_task_PID == NIL) { |
sys_shutdown_message("Error: Cannot create shutdown task\n"); |
sys_end(); |
} |
} |
int device_drivers_init() { |
KEYB_PARMS kparms = BASE_KEYB; |
LINUXC26_register_module(); |
INPUT26_init(); |
keyb_def_ctrlC(kparms, NULL); |
KEYB26_init(&kparms); |
return 0; |
} |
int device_drivers_close() { |
KEYB26_close(); |
INPUT26_close(); |
return 0; |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void call_shutdown_task(void *arg) |
{ |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |
TASK shutdown_task_body(void *arg) { |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
return NULL; |
} |
/demos/trunk/servo/makefile |
---|
12,4 → 12,4 |
include $(BASE)/config/example.mk |
load: |
make -f $(SUBMAKE) APP=load INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __SERVO__" |
make -f $(SUBMAKE) APP=load INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __INPUT__ __SERVO__" |
/demos/trunk/mesatex/initfile.c |
---|
6,7 → 6,7 |
* Paolo Gai <pj@gandalf.sssup.it> |
* |
* Authors : |
* Paolo Gai <pj@gandalf.sssup.it> |
* Giacomo Guidi <giacomo@gandalf.sssup.it> |
* (see the web pages for full authors list) |
* |
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
17,38 → 17,6 |
*/ |
/* |
------------ |
CVS : $Id: initfile.c,v 1.2 2003-04-28 11:14:08 giacomo Exp $ |
File: $File$ |
Revision: $Revision: 1.2 $ |
Last update: $Date: 2003-04-28 11:14:08 $ |
------------ |
System initialization file |
This file contains the 2 functions needed to initialize the system. |
These functions register the following levels: |
an EDF (Earliest Deadline First) level |
a RR (Round Robin) level |
a CBS (Costant Bandwidth Server) level |
a Dummy level |
It can accept these task models: |
HARD_TASK_MODEL (wcet+mit) at level 0 |
SOFT_TASK_MODEL (met, period) at level 1 |
NRT_TASK_MODEL at level 2 |
This file is similar to the configuration of kernel/init/hartik3.c |
TICK is set to 0 (one-shot timer is used) |
*/ |
/* |
* Copyright (C) 2000 Paolo Gai |
* |
* 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 |
67,8 → 35,9 |
*/ |
#include "kernel/kern.h" |
#include "modules/intdrive.h" |
#include "modules/edf.h" |
#include "modules/cbs.h" |
#include "modules/hardcbs.h" |
#include "modules/rr.h" |
#include "modules/dummy.h" |
76,21 → 45,40 |
#include "modules/hartport.h" |
#include "modules/cabs.h" |
#include "drivers/keyb.h" |
#include <drivers/shark_linuxc26.h> |
#include <drivers/shark_pci26.h> |
#include <drivers/shark_input26.h> |
#include <drivers/shark_keyb26.h> |
#include <drivers/shark_fb26.h> |
#define FRAME_BUFFER_DEVICE 0 |
/*+ sysyem tick in us +*/ |
#define TICK 1000 |
#define TICK 0 |
/*+ RR tick in us +*/ |
#define RRTICK 10000 |
/*+ Interrupt Server +*/ |
#define INTDRIVE_Q 1000 |
#define INTDRIVE_T 10000 |
#define INTDRIVE_FLAG 0 |
void call_shutdown_task(void *arg); |
int device_drivers_init(); |
int device_drivers_close(); |
void set_shutdown_task(); |
TASK shutdown_task_body(void *arg); |
PID shutdown_task_PID = -1; |
TIME __kernel_register_levels__(void *arg) |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
INTDRIVE_register_level(INTDRIVE_Q,INTDRIVE_T,INTDRIVE_FLAG); |
EDF_register_level(EDF_ENABLE_ALL); |
CBS_register_level(CBS_ENABLE_ALL, 0); |
HCBS_register_level(HCBS_ENABLE_ALL, 1); |
RR_register_level(RRTICK, RR_MAIN_YES, mb); |
dummy_register_level(); |
105,15 → 93,110 |
{ |
struct multiboot_info *mb = (struct multiboot_info *)arg; |
KEYB_PARMS kparms = BASE_KEYB; |
HARTPORT_init(); |
keyb_def_ctrlC(kparms, NULL); |
KEYB_init(&kparms); |
/* Create the shutdown task. It will be activated at RUNLEVEL |
SHUTDOWN */ |
set_shutdown_task(); |
/* Init the drivers */ |
device_drivers_init(); |
/* Set the shutdown task activation */ |
sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN); |
__call_main__(mb); |
return (void *)0; |
} |
void set_shutdown_task() { |
/* WARNING: the shutdown task is a background thread. It cannot execute |
if the system is overloaded */ |
NRT_TASK_MODEL nrt; |
nrt_task_default_model(nrt); |
nrt_task_def_system(nrt); |
shutdown_task_PID = task_create("Shutdown Task",shutdown_task_body,&nrt,NULL); |
if (shutdown_task_PID == NIL) { |
sys_shutdown_message("Error: Cannot create shutdown task\n"); |
sys_end(); |
} |
} |
int device_drivers_init() { |
int res; |
KEYB_PARMS kparms = BASE_KEYB; |
LINUXC26_register_module(); |
PCI26_init(); |
INPUT26_init(); |
keyb_def_ctrlC(kparms, NULL); |
KEYB26_init(&kparms); |
FB26_init(); |
res = FB26_open(FRAME_BUFFER_DEVICE); |
if (res) { |
cprintf("Error: Cannot open graphical mode\n"); |
KEYB26_close(); |
INPUT26_close(); |
sys_end(); |
} |
FB26_use_grx(FRAME_BUFFER_DEVICE); |
FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16"); |
return 0; |
} |
int device_drivers_close() { |
FB26_close(FRAME_BUFFER_DEVICE); |
KEYB26_close(); |
INPUT26_close(); |
return 0; |
} |
#define SHUTDOWN_TIMEOUT_SEC 3 |
void call_shutdown_task(void *arg) |
{ |
struct timespec t; |
sys_gettime(&t); |
t.tv_sec += SHUTDOWN_TIMEOUT_SEC; |
/* Emergency timeout to exit from RUNLEVEL_SHUTDOWN */ |
kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0); |
task_activate(shutdown_task_PID); |
} |
TASK shutdown_task_body(void *arg) { |
device_drivers_close(); |
sys_shutdown_message("-- S.Ha.R.K. Closed --\n"); |
sys_abort_shutdown(0); |
return NULL; |
} |
/demos/trunk/mesatex/mesatex.c |
---|
16,9 → 16,6 |
* http://shark.sssup.it |
*/ |
#include <drivers/glib.h> |
#include <drivers/keyb.h> |
#include <GL/osmesa.h> |
#include <GL/glut.h> |
28,6 → 25,9 |
#include <kernel/log.h> |
#include <kernel/kern.h> |
#include <drivers/shark_fb26.h> |
#include <drivers/shark_keyb26.h> |
#ifndef M_PI |
#define M_PI 3.14159265 |
#endif |
42,6 → 42,8 |
static GLfloat Angle = 0.0f; |
static GLboolean UseObj = GL_FALSE; |
extern void *video_memory; |
#if defined(GL_VERSION_1_1) || defined(GL_VERSION_1_2) |
# define TEXTURE_OBJECT 1 |
#elif defined(GL_EXT_texture_object) |
54,7 → 56,6 |
unsigned char *rgb_565_buf = NULL; //RGB 16 bpp Buffer |
unsigned char *video_buf = NULL; //Video Buffer |
unsigned long int VMEMLONG = WIDTH * HEIGHT * BYTES_PP / 4; // Used by copy_videomem_16to16 |
unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem |
unsigned long int PERIOD_REFRESH = 30000; |
117,7 → 118,6 |
} |
static void gl_init() |
{ |
250,27 → 250,6 |
} |
static int screen() |
{ |
extern DWORD flbaddr; |
/* graphic card Initialization */ |
if (grx_init() < 1) { |
sys_abort(1); |
} |
if (grx_open(640, 480, 16) < 0) { |
cprintf("GRX Err\n"); |
sys_abort(1); |
} |
video_buf = (unsigned char *)flbaddr; |
return 0; |
} |
void program_end(void *arg) |
{ |
277,8 → 256,6 |
OSMesaDestroyContext(ctx); |
free(rgb_565_buf); |
grx_close(); |
sys_end(); |
} |
338,8 → 315,6 |
HARD_TASK_MODEL ht_refresh, ht_disegna; |
sys_atrunlevel(program_end,NULL, RUNLEVEL_BEFORE_EXIT); |
clear(); |
WCET_REFRESH =((long int) PERIOD_REFRESH * (0.45)); |
377,7 → 352,8 |
k.flag = ALTL_BIT; |
k.scan = KEY_C; |
k.ascii = 'c'; |
keyb_hook(k,program_key_end); |
k.status = KEY_PRESSED; |
keyb_hook(k,program_key_end,FALSE); |
} |
rgb_565_buf = malloc(RGB565MEM); |
384,10 → 360,8 |
gl_init(); |
if (screen()) { |
printk(KERN_INFO "Graphical initialization failed !!\n"); |
sys_end(); |
} |
video_buf = (unsigned char *)video_memory; |
//video_buf = (unsigned char *)malloc(640*480*2); |
memset(rgb_565_buf, 0, RGB565MEM); |
/demos/trunk/mesatex/makefile |
---|
12,5 → 12,5 |
include $(BASE)/config/example.mk |
mesatex: |
make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__OSMESA__ __OLDCHAR__ __GRX__" |
make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__ __OSMESA__" |
/demos/trunk/makefile |
---|
3,11 → 3,8 |
ifeq ($(findstring NEW,$(TRACER)) , NEW) |
TRC = newtrace |
endif |
ifeq ($(findstring OLD,$(TRACER)) , OLD) |
TRC = tracer |
endif |
dirs := $(filter-out CVS cvs bttvdemo rtw base_cpp makefile readme.txt tracer newtrace README.TXT, $(wildcard *)) |
dirs := $(filter-out CVS cvs makefile readme.txt newtrace README.TXT, $(wildcard *)) |
dirs += $(TRC) |
p_all := $(addprefix prefixall_, $(dirs)) |
p_install := $(addprefix prefixinstall_, $(dirs)) |