Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1462 → Rev 1463

/demos/trunk/base/initfile.c
49,7 → 49,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID = 1;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/base/iaster4.c
70,7 → 70,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID = 1;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/base/iaster6.c
18,11 → 18,11
 
/**
------------
CVS : $Id: iaster6.c,v 1.3 2004-04-21 14:55:05 giacomo Exp $
CVS : $Id: iaster6.c,v 1.4 2004-05-24 17:20:44 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2004-04-21 14:55:05 $
Revision: $Revision: 1.4 $
Last update: $Date: 2004-05-24 17:20:44 $
------------
 
System initialization file
106,7 → 106,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID = 1;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/base/iaster7.c
18,11 → 18,11
 
/**
------------
CVS : $Id: iaster7.c,v 1.3 2004-04-21 14:55:06 giacomo Exp $
CVS : $Id: iaster7.c,v 1.4 2004-05-24 17:20:45 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2004-04-21 14:55:06 $
Revision: $Revision: 1.4 $
Last update: $Date: 2004-05-24 17:20:45 $
------------
 
System initialization file
98,7 → 98,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID = 1;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/base/iaster8.c
18,11 → 18,11
 
/**
------------
CVS : $Id: iaster8.c,v 1.3 2004-04-21 14:55:06 giacomo Exp $
CVS : $Id: iaster8.c,v 1.4 2004-05-24 17:20:45 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.3 $
Last update: $Date: 2004-04-21 14:55:06 $
Revision: $Revision: 1.4 $
Last update: $Date: 2004-05-24 17:20:45 $
------------
 
System initialization file
106,7 → 106,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID = 1;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/base/ipcidemo.c
40,7 → 40,7
void set_shutdown_task();
TASK shutdown_task_body(void *arg);
 
PID shutdown_task_PID;
PID shutdown_task_PID = -1;
 
TIME __kernel_register_levels__(void *arg)
{
/demos/trunk/tftptest/initfile.c
1,55 → 1,19
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
* Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
* Authors : Mauro Marinoni <mauro.marinoni@unipv.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://shark.sssup.it
* http://hartik.sssup.it
*/
 
/*
------------
CVS : $Id: initfile.c,v 1.1 2003-10-02 12:45:43 giacomo Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2003-10-02 12:45:43 $
------------
 
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
* the Free Software Foundation; either version 2 of the License, or
63,52 → 27,135
* 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 <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/sem.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>
 
/*+ 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;
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
EDF_register_level(EDF_ENABLE_ALL);
CBS_register_level(CBS_ENABLE_ALL, 0);
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_T, INTDRIVE_FLAG);
EDF_register_level(EDF_ENABLE_ALL);
CBS_register_level(CBS_ENABLE_ALL, 1);
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
SEM_register_module();
SEM_register_module();
 
return TICK;
return TICK;
}
 
int device_drivers_close() {
KEYB26_close();
INPUT26_close();
 
return 0;
}
 
int device_drivers_init() {
 
KEYB_PARMS kparms = BASE_KEYB;
LINUXC26_register_module();
PCI26_init();
INPUT26_init();
 
/*keyb_def_map(kparms, KEYMAP_IT);*/
keyb_def_ctrlC(kparms, NULL);
KEYB26_init(&kparms);
 
return 0;
}
 
TASK shutdown_task_body(void *arg) {
 
device_drivers_close();
sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
sys_abort_shutdown(0);
 
return NULL;
}
 
#define SHUTDOWN_TIMEOUT_SEC 3
 
void set_shutdown_task() {
 
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();
}
 
}
 
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 __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
KEYB_PARMS kparms = BASE_KEYB;
HARTPORT_init();
 
HARTPORT_init();
set_shutdown_task();
 
keyb_def_ctrlC(kparms, NULL);
keyb_def_map(kparms,itaMap);
KEYB_init(&kparms);
device_drivers_init();
 
__call_main__(mb);
sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
 
return (void *)0;
__call_main__(mb);
 
return (void *)0;
}
 
/demos/trunk/tftptest/makefile
12,5 → 12,5
include $(BASE)/config/example.mk
 
tftptest:
make -f $(SUBMAKE) APP=tftptest INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__OLDCHAR__ __TFTP__"
make -f $(SUBMAKE) APP=tftptest INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __NET__ __INPUT__ __TFTP__"
 
/demos/trunk/tftptest/tftptest.c
1,8 → 1,10
#include <string.h>
#include <kernel/func.h>
#include <kernel/kern.h>
#include <drivers/keyb.h>
 
#include <drivers/shark_keyb26.h>
#include <drivers/udpip.h>
 
#include "tftp.h"
#include "endian.h"
 
9,7 → 11,6
#include "modules/sem.h"
 
#include <kernel/kern.h>
#include <drivers/pci.h>
#include <ll/i386/hw-instr.h>
 
 
25,9 → 26,9
 
void esci(KEY_EVT *k)
{
cprintf("Exit from the program...\n");
cprintf("Ctrl-C pressed!\n");
sys_abort(500);
sys_shutdown_message("Exit from the program...\n");
sys_shutdown_message("Ctrl-C pressed!\n");
sys_end();
}
 
void augprog(KEY_EVT *k)
40,21 → 41,25
 
k.flag = CNTL_BIT;
k.scan = KEY_C;
k.status = KEY_PRESSED;
k.ascii = 'C';
keyb_hook(k, esci);
keyb_hook(k, esci,FALSE);
k.flag = CNTR_BIT;
k.scan = KEY_C;
k.ascii = 'c';
keyb_hook(k, esci);
k.status = KEY_PRESSED;
keyb_hook(k, esci,FALSE);
 
k.flag = CNTL_BIT;
k.scan = KEY_A;
k.ascii = 'A';
keyb_hook(k, augprog);
k.status = KEY_PRESSED;
keyb_hook(k, augprog,FALSE);
k.flag = CNTR_BIT;
k.scan = KEY_A;
k.ascii = 'a';
keyb_hook(k, augprog);
k.status = KEY_PRESSED;
keyb_hook(k, augprog,FALSE);
}
 
TASK test_upload(void *arg) {
212,9 → 217,6
 
tftp_close(handle, TFTP_STOP_NOW);
 
 
// wait();
 
tftp_close(handle2, TFTP_STOP_NOW);
 
cprintf("\nProgram terminated correctly.\n");
/demos/trunk/dosfs/makefile
12,5 → 12,5
include $(BASE)/config/example.mk
 
dosfs:
make -f $(SUBMAKE) APP=dosfs INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=__OLDCHAR__
make -f $(SUBMAKE) APP=dosfs INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT=