Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1684 → Rev 1683

/demos/branches/xen/newtrace/instr/bezier_i.c
File deleted
/demos/branches/xen/newtrace/instr/makefile
File deleted
/demos/branches/xen/newtrace/instr/instr.c
File deleted
/demos/branches/xen/newtrace/instr/bezier.c
File deleted
/demos/branches/xen/newtrace/instr/initfile.c
File deleted
/demos/branches/xen/newtrace/utils/test.pwc
File deleted
/demos/branches/xen/newtrace/utils/extract.c
File deleted
/demos/branches/xen/newtrace/utils/example_results
File deleted
/demos/branches/xen/newtrace/utils/list.c
File deleted
/demos/branches/xen/newtrace/utils/pwcet_gen.c
File deleted
/demos/branches/xen/newtrace/utils/README
File deleted
/demos/branches/xen/newtrace/utils/makefile
File deleted
/demos/branches/xen/newtrace/utils/test
File deleted
\ No newline at end of file
/demos/branches/xen/newtrace/utils/udpdump.c
File deleted
/demos/branches/xen/newtrace/initfile/initfile.c
File deleted
/demos/branches/xen/newtrace/udp/initfile.c
File deleted
/demos/branches/xen/newtrace/udp/udptrace.c
File deleted
/demos/branches/xen/newtrace/udp/makefile
File deleted
/demos/branches/xen/newtrace/nosave/initfile.c
File deleted
/demos/branches/xen/newtrace/nosave/nosave.c
File deleted
/demos/branches/xen/newtrace/nosave/makefile
File deleted
/demos/branches/xen/newtrace/readme
File deleted
/demos/branches/xen/newtrace/makefile
File deleted
/demos/branches/xen/base/aster2.c
File deleted
/demos/branches/xen/base/aster3.c
File deleted
/demos/branches/xen/base/mdemo.c
File deleted
/demos/branches/xen/base/aster4.c
File deleted
/demos/branches/xen/base/isemdemo.c
File deleted
/demos/branches/xen/base/aster5.c
File deleted
/demos/branches/xen/base/hello.c
File deleted
/demos/branches/xen/base/aster6.c
File deleted
/demos/branches/xen/base/aster7.c
File deleted
/demos/branches/xen/base/aster8.c
File deleted
/demos/branches/xen/base/cabs.c
File deleted
/demos/branches/xen/base/imdemo.c
File deleted
/demos/branches/xen/base/ihello.c
File deleted
/demos/branches/xen/base/initgraph.c
File deleted
/demos/branches/xen/base/fly.c
File deleted
/demos/branches/xen/base/time.c
File deleted
/demos/branches/xen/base/intsem.c
File deleted
/demos/branches/xen/base/initfile.c
File deleted
/demos/branches/xen/base/pcdemo.c
File deleted
/demos/branches/xen/base/iaster1.c
File deleted
/demos/branches/xen/base/srpdemo.c
File deleted
/demos/branches/xen/base/iaster3.c
File deleted
/demos/branches/xen/base/ego.c
File deleted
/demos/branches/xen/base/iaster4.c
File deleted
/demos/branches/xen/base/preempt.c
File deleted
/demos/branches/xen/base/readme
File deleted
/demos/branches/xen/base/iaster6.c
File deleted
/demos/branches/xen/base/pidemo.c
File deleted
/demos/branches/xen/base/iaster7.c
File deleted
/demos/branches/xen/base/aster.c
File deleted
/demos/branches/xen/base/iaster8.c
File deleted
/demos/branches/xen/base/pcidemo.c
File deleted
/demos/branches/xen/base/sig.c
File deleted
/demos/branches/xen/base/condtest.c
File deleted
/demos/branches/xen/base/ipcidemo.c
File deleted
/demos/branches/xen/base/semdemo.c
File deleted
/demos/branches/xen/base/makefile
File deleted
/demos/branches/xen/base/cabs.dat
File deleted
/demos/branches/xen/base/aster1.c
File deleted
/demos/branches/xen/base/jointest.c
File deleted
/demos/branches/xen/helloworld/makefile
File deleted
/demos/branches/xen/helloworld/initfile.c
File deleted
/demos/branches/xen/helloworld/hello.c
File deleted
/demos/branches/xen/readme.txt
File deleted
/demos/branches/xen/shutdown/readme.txt
File deleted
/demos/branches/xen/shutdown/shutdown.c
File deleted
/demos/branches/xen/shutdown/ishut.c
File deleted
/demos/branches/xen/shutdown/makefile
File deleted
/demos/branches/xen/advtimer/initfile.c
File deleted
/demos/branches/xen/advtimer/readme.txt
File deleted
/demos/branches/xen/advtimer/advtimer.c
File deleted
/demos/branches/xen/advtimer/makefile
File deleted
/demos/branches/xen/tftptest/makefile
File deleted
/demos/branches/xen/tftptest/tftptest.c
File deleted
/demos/branches/xen/tftptest/initfile.c
File deleted
/demos/branches/xen/makefile
File deleted
/demos/branches/xen/dosfs/dosfs.c
File deleted
/demos/branches/xen/dosfs/myfile.txt
File deleted
/demos/branches/xen/dosfs/initfile.c
File deleted
/demos/branches/xen/dosfs/readme.txt
File deleted
/demos/branches/xen/dosfs/makefile
File deleted
/demos/branches/xen/orbit/makefile
File deleted
/demos/branches/xen/orbit/orbit.c
File deleted
/demos/branches/xen/orbit/initfile.c
File deleted
/demos/branches/xen/orbit/orbit.dat
File deleted
/demos/branches/xen/bttvdemo/initfile.c
File deleted
/demos/branches/xen/bttvdemo/readme.txt
File deleted
/demos/branches/xen/bttvdemo/makefile
File deleted
/demos/branches/xen/bttvdemo/bttv.c
File deleted
/demos/branches/xen/bca/scenario.c
File deleted
/demos/branches/xen/bca/initfile.c
File deleted
/demos/branches/xen/bca/missile.c
File deleted
/demos/branches/xen/bca/bca_lib.c
File deleted
/demos/branches/xen/bca/readme
File deleted
/demos/branches/xen/bca/bca_raw/aereo2_h.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/esplo2.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/esplo3.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/bca.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/esplo4.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/missile1.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/esplo5.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/missile2.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/sfondo.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/aereo1.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/cannon.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/aereo2.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/aereo1_h.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/cannon_h.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/bca_raw/esplo1.raw
File deleted
\ No newline at end of file
/demos/branches/xen/bca/fab_lib.c
File deleted
/demos/branches/xen/bca/control.c
File deleted
/demos/branches/xen/bca/cannone.c
File deleted
/demos/branches/xen/bca/esplo.c
File deleted
/demos/branches/xen/bca/bca.c
File deleted
/demos/branches/xen/bca/bca.h
File deleted
/demos/branches/xen/bca/aereo.c
File deleted
/demos/branches/xen/bca/dummy.c
File deleted
/demos/branches/xen/bca/makefile
File deleted
/demos/branches/xen/bca/fab_lib/fab_msg.h
File deleted
/demos/branches/xen/bca/fab_lib/fab_grx.sys
File deleted
/demos/branches/xen/bca/fab_lib/fab_tool.h
File deleted
/demos/branches/xen/bca/fab_lib/fab_grx.h
File deleted
/demos/branches/xen/bca/fab_lib/fab_show.h
File deleted
/demos/branches/xen/astro/rock.c
File deleted
/demos/branches/xen/astro/asteroid.h
File deleted
/demos/branches/xen/astro/initfile.c
File deleted
/demos/branches/xen/astro/astro.c
File deleted
/demos/branches/xen/astro/asteroid.c
File deleted
/demos/branches/xen/astro/stat.c
File deleted
/demos/branches/xen/astro/makefile
File deleted
/demos/branches/xen/network/net.c
File deleted
/demos/branches/xen/network/notify.c
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/network/talk.c
===================================================================
--- branches/xen/network/talk.c (revision 1684)
+++ branches/xen/network/talk.c (nonexistent)
@@ -1,217 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- * Copyright (C) 2000 Luca Abeni, 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
- *
- *
- * CVS : $Id: aster1.c,v 1.1 2002/10/28 08:13:37 pj Exp
-
- This is the talkdx.c Hartik's example.
-
- File: Talk.C
- Revision: 1.00
- Author: Luca Abeni
-
-
- Simple Netlib demo: nothing of seriously real-time, only another Unix
- Talk clone.
- Read it to see how the UDP/IP layers of the networ library work.
-
-*/
-
-#include <kernel/kern.h>
-#include <string.h>
-
-#include <drivers/crtwin.h>
-#include <drivers/shark_keyb26.h>
-
-#include <drivers/udpip.h>
-
-
-WIN dbg;
-BYTE esc = FALSE;
-
-char talk_myipaddr[20];
-char talk_toipaddr[20];
-
-/*
- This non real-time task reads UDP packets from the network and writes
- them in a window
-*/
-TASK scrittore(void)
-{
- char str[2000];
- UDP_ADDR from, local;
- WIN displ;
- int s,n;
-
- /* Connect on the local port #100 */
- local.s_port = 100;
- s = udp_bind(&local, NULL);
-
- /* Open the window */
- win_init(&displ,0,0,79,6);
- win_frame(&displ,BLACK,WHITE,"Remote",2);
-
- while (1) {
- /* Clear the buffer for receiving the packet...*/
- memset(str, 0, 1999);
- /*...and receive the packet (block until a packet arrives */
- n = udp_recvfrom(s, str, &from);
- win_puts(&displ, str);
- }
-}
-
-/*
- This non real-time task reads strings from the keyoard and sends them
- to the remote host
-*/
-TASK write(void)
-{
- WIN wr;
- UDP_ADDR to,local;
- char str[80],tmp[5],ch;
- int s;
- IP_ADDR bindlist[5];
-
- win_init(&wr,0,7,79,6);
- win_frame(&wr,BLACK,WHITE,"Local",2);
-
- /* Create a socket for transitting */
- ip_str2addr(talk_myipaddr,&(local.s_addr));
- local.s_port = 101;
-
- /*
- If we want the address of the remote host in the ARP table before
- begginning the transmission (to eliminate a possible source of
- unpredictability), we can use the bindlist, otherwise we set the
- second parameter of udp_bind to NULL
- */
- ip_str2addr(talk_toipaddr,&(bindlist[0]));
- memset(&(bindlist[1]), 0, sizeof(IP_ADDR));
- s = udp_bind(&local, /*bindlist*/NULL);
-
- ip_str2addr(talk_toipaddr,&(to.s_addr));
- to.s_port = 100;
- sprintf(str,"Local IP address %d.%d.%d.%d\n", local.s_addr.ad[0],
- local.s_addr.ad[1], local.s_addr.ad[2],
- local.s_addr.ad[3]);
- win_puts(&dbg,str);
- sprintf(str,"Talk to %d.%d.%d.%d ",to.s_addr.ad[0],to.s_addr.ad[1],
- to.s_addr.ad[2],to.s_addr.ad[3]);
- win_puts(&dbg,str);
- while (1) {
- /* Get the string...*/
- while((ch = keyb_getch(BLOCK)) != 13) {
- sprintf(tmp,"%c",ch);
- strcat(str,tmp);
- win_puts(&wr,tmp);
- }
- strcat(str,"\n");
- win_puts(&wr,"\n");
- /*...and send it!!! */
- udp_sendto(s,str,strlen(str)+2,&to);
- str[0] = 0;
- }
-}
-
-/* This function is called when the user presses CTRL-C (stops the systems) */
-void esci(KEY_EVT *k)
-{
- esc = TRUE;
- exit(1);
-}
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
-
- struct net_model m = net_base;
-
- NRT_TASK_MODEL m_nrt;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,esci,FALSE);
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,esci,FALSE);
-
- clear();
- cprintf(" S.Ha.R.K. Talk! Ver. 1.10\n");
-
- if (argc != 3) {
- cprintf("S.Ha.R.K. Talk usage: talk fromIP toIP\n");
- return 0;
- }
-
- strcpy(talk_myipaddr, argv[1]);
- strcpy(talk_toipaddr, argv[2]);
-
- /* We want a task for TX mutual exclusion */
- net_setmode(m, TXTASK);
- /* We use UDP/IP stack */
- net_setudpip(m, talk_myipaddr, "255.255.255.255");
- /* OK: let's start the NetLib! */
- if (net_init(&m) == 1) {
- cprintf("Net Init OK...\n");
- } else {
- cprintf("Net Init Failed...\n");
- exit(300);
- }
-
-
- //dump_irq();
-
- cprintf("\n\n\n\tPress ENTER\n");
- while (!esc) {
- keyb_getcode(&k,BLOCK);
- if (k.ascii == 13) esc = TRUE;
- }
-
- esc = FALSE;
- clear();
- win_init(&dbg,0,20,60,3);
- win_frame(&dbg,BLACK,WHITE,"Debug",2);
-
- /* Start the sender and receiver tasks...*/
- nrt_task_default_model(m_nrt);
- task_activate(task_create("aaa",scrittore,&m_nrt,NULL));
- task_activate(task_create("bbb",write,&m_nrt,NULL));
-
- return 0;
-}
Index: branches/xen/network/makefile
===================================================================
--- branches/xen/network/makefile (revision 1684)
+++ branches/xen/network/makefile (nonexistent)
@@ -1,21 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = net talk
-
-include $(BASE)/config/example.mk
-
-net:
- make -f $(SUBMAKE) BASE=$(BASE) APP=net INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__"
-
-talk:
- make -f $(SUBMAKE) BASE=$(BASE) APP=talk INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__"
-
-notify:
- make -f $(SUBMAKE) BASE=$(BASE) APP=notify INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__PCI__ __LINUXC26__ __INPUT__ __NET__"
Index: branches/xen/network/DatagramSender.java
===================================================================
--- branches/xen/network/DatagramSender.java (revision 1684)
+++ branches/xen/network/DatagramSender.java (nonexistent)
@@ -1,35 +0,0 @@
-import java.net.*;
-import java.util.*;
-
-public class DatagramSender {
- public static void main(String argv[]) throws Exception {
- long i = 0;
- DatagramSocket sender = new DatagramSocket();
- InetAddress IP = InetAddress.getByName("192.168.121.2");
- String line=("Inviato");
- byte[] buffer = new byte[255];
- byte[] buffer1 ;
- DatagramPacket packetr;
-
- while ( true ) {
- //DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
- //System.out.println("In attesa di messaggi...");
- //receiver.receive(packet);
- //String message = new String(packet.getData(), packet.getOffset(), packet.getLength());
- //System.out.println("Messaggio ricevuto dall'host " + packet.getAddress() + " su porta " + packet.getPort() + ": " + message+" "+ i++);
- line="Inviato"+i;
- buffer1 = line.getBytes();
- packetr = new DatagramPacket(buffer1, buffer1.length, IP, 100);
- sender.send(packetr);
- if(i++ % 10==0)
- System.out.println("Inviato"+i);
- Thread.sleep(508,0);
-
- //System.out.println(message+" "+ i++);
- }
-
- }
-}
-
-
-
/branches/xen/network/DatagramSender.java
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/network/initfile.c
===================================================================
--- branches/xen/network/initfile.c (revision 1684)
+++ branches/xen/network/initfile.c (nonexistent)
@@ -1,162 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
- 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");
- 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");
- exit(1);
- }
-
-}
-
-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;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: branches/xen/mesademo/mesademo.c
===================================================================
--- branches/xen/mesademo/mesademo.c (revision 1684)
+++ branches/xen/mesademo/mesademo.c (nonexistent)
@@ -1,386 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.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
- */
-
-/*
- * 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/log.h>
-#include <kernel/kern.h>
-#include <math.h>
-#include <stdlib.h>
-
-#include <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#include <GL/osmesa.h>
-#include <GL/glut.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-#define WIDTH 640
-#define HEIGHT 430
-#define BYTES_PP 2 //BytesPerPixel
-
-OSMesaContext ctx;
-
-extern void *video_memory;
-
-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 = 100000;
-unsigned long int PERIOD_DISEGNA = 100000;
-
-unsigned long int WCET_REFRESH, WCET_DISEGNA;
-
-TASK refesh(void);
-TASK disegna(void);
-
-PID refresh_PID, disegna_PID;
-
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- }
- glEnd();
-
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-
-}
-
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static void draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-
- glFinish();
-
-}
-
-static void gl_init()
-{
-
- static GLfloat red[4] = {1.0, 0.0, 0.0, 1.0};
- static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
- static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
- static GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0};
- static GLfloat h = (GLfloat) HEIGHT / (GLfloat) WIDTH;
-
- //Create the OSMesa Context
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL);
-
- //Make Current Context
- OSMesaMakeCurrent(ctx, rgb_565_buf, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-
- glViewport(0, 0, (GLint) WIDTH, (GLint) HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- exit(0);
-
-}
-
-TASK refresh(void)
-{
-
- while(1) {
-
- task_testcancel();
- memcpy((video_buf+40*WIDTH*2), rgb_565_buf, RGB565MEM);
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-
-TASK disegna(void)
-{
-
- char text[100];
- TIME disegna_TIME, refresh_TIME;
-
- while(1) {
-
- task_testcancel();
-
- jet_gettable(refresh_PID, &refresh_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- angle += 1.0;
-
- draw();
-
- sprintf(text,"Hard Task Refresh PER:%6d us EX:%6d us",(int)PERIOD_REFRESH,(int)refresh_TIME);
- grx_text(text,10,5,color16(0,0,255),0);
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME);
- grx_text(text,10,15,color16(0,0,255),0);
-
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-int main (int argc, char *argv[])
-{
-
- HARD_TASK_MODEL ht_refresh, ht_disegna;
-
- WCET_REFRESH =((long int) PERIOD_REFRESH * (0.30));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.55));
-
- hard_task_default_model(ht_refresh);
- hard_task_def_wcet(ht_refresh,WCET_REFRESH);
- hard_task_def_mit(ht_refresh,PERIOD_REFRESH);
- hard_task_def_usemath(ht_refresh);
- hard_task_def_group(ht_refresh,1);
- hard_task_def_ctrl_jet(ht_refresh);
-
- refresh_PID = task_create("refresh", refresh, &ht_refresh, NULL);
- if (refresh_PID == -1) {
- exit(0);
- }
-
- hard_task_default_model(ht_disegna);
- hard_task_def_mit(ht_disegna,PERIOD_DISEGNA);
- hard_task_def_wcet(ht_disegna,WCET_DISEGNA);
- hard_task_def_group(ht_disegna,1);
- hard_task_def_ctrl_jet(ht_disegna);
- hard_task_def_usemath(ht_disegna);
- hard_task_def_stack(ht_disegna,30000); //VERY IMPORTANT FOR glCallList !!
-
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL);
- if (disegna_PID == -1) {
- exit(0);
- }
-
- {
- KEY_EVT k;
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
- }
-
- rgb_565_buf = malloc(RGB565MEM);
- video_buf = (unsigned char *)video_memory;
-
- gl_init();
-
- memset(rgb_565_buf, 0, RGB565MEM);
-
- group_activate(1);
-
- return 0;
-
-}
Index: branches/xen/mesademo/readme.txt
===================================================================
--- branches/xen/mesademo/readme.txt (revision 1684)
+++ branches/xen/mesademo/readme.txt (nonexistent)
@@ -1,25 +0,0 @@
---------------------------------------
-MESA Demo (gears)
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is a simple test demo for the MESA (5.0)
-libraries, the low level graphic drivers is
-the Linux 2.6 Frame Buffer Driver
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-MESADEMO.C The MESA Demo
-
---------------------------------------
-
Index: branches/xen/mesademo/makefile
===================================================================
--- branches/xen/mesademo/makefile (revision 1684)
+++ branches/xen/mesademo/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = mesademo
-
-include $(BASE)/config/example.mk
-
-mesademo:
- make -f $(SUBMAKE) APP=mesademo INIT= OTHEROBJS="initfile.o" SHARKOPT="__OSMESA__ __LINUXC26__ __PCI__ __INPUT__ __FB__"
-
Index: branches/xen/mesademo/initfile.c
===================================================================
--- branches/xen/mesademo/initfile.c (revision 1684)
+++ branches/xen/mesademo/initfile.c (nonexistent)
@@ -1,202 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.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 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(0);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(0);
- }
-
- 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");
-
- return NULL;
-
-}
-
-
Index: branches/xen/pse51/makefile
===================================================================
--- branches/xen/pse51/makefile (revision 1684)
+++ branches/xen/pse51/makefile (nonexistent)
@@ -1,26 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS+= ptest1 ptest2 ptest3 ptest4 ptest5 ptest6
-
-include $(BASE)/config/example.mk
-
-ptest1:
- make -f $(SUBMAKE) APP=ptest1 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-ptest2:
- make -f $(SUBMAKE) APP=ptest2 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-ptest3:
- make -f $(SUBMAKE) APP=ptest3 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-ptest4:
- make -f $(SUBMAKE) APP=ptest4 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-ptest5:
- make -f $(SUBMAKE) APP=ptest5 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-ptest6:
- make -f $(SUBMAKE) APP=ptest6 INIT= OTHEROBJS="pinit.o" SHARKOPT=
-
Index: branches/xen/pse51/ptest1.c
===================================================================
--- branches/xen/pse51/ptest1.c (revision 1684)
+++ branches/xen/pse51/ptest1.c (nonexistent)
@@ -1,206 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest1.c,v 1.4 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 1:
-
- the main task create 4 tasks, J1, J2, J3, J4
- at t = 0.2 sec. it raise a signal to J1
- at t = 0.4 sec. it raise a signal to J2
- at t = 0.8 sec. it kill J4
-
- J1: it simply calls sigwait
-
- J2: it simply calls sigwaitinfo
-
- J3: it simply calls sigtimedwait with a timeout of 0.5 sec.
-
- J4: it simply calls sigtimedwait with a -long- timeout
- (J4 will be killed by main)
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-#include <signal.h>
-
-#include <kernel/kern.h>
-
-void *J1(void *arg)
-{
- int sig, err;
- sigset_t mask;
-
- cprintf("J1 starts and call sigwait(31)\n");
-
- sigemptyset(&mask);
- sigaddset(&mask,31);
- err = sigwait(&mask,&sig);
-
- cprintf("J1 exit from sigwait(), err=%d, sig=%d\n", err, sig);
-
- return 0;
-}
-
-void *J2(void *arg)
-{
- int err;
- siginfo_t info;
- sigset_t mask;
-
- cprintf("J2 starts and call sigwaitinfo(30)\n");
-
- sigemptyset(&mask);
- sigaddset(&mask,30);
- err = sigwaitinfo(&mask,&info);
-
- cprintf("J2 exit from sigwaitinfo(), err=%d, signo=%d code=%d value=%d\n",
- err, info.si_signo, info.si_code, info.si_value.sival_int);
-
- return 0;
-}
-
-void *J3(void *arg)
-{
- int err;
- siginfo_t info;
- sigset_t mask;
- struct timespec t;
-
- cprintf("J3 starts and call sigtimedwait(29)\n");
-
- sigemptyset(&mask);
- sigaddset(&mask,29);
- t.tv_sec = 0;
- t.tv_nsec = 300000000;
- err = sigtimedwait(&mask,&info,&t);
-
- cprintf("J3 exit from sigtimedwait(), err=%d, signo=%d code=%d value=%d\n",
- err, info.si_signo, info.si_code, info.si_value.sival_int);
-
- return 0;
-}
-
-void uscitaJ4(void *arg)
-{
- cprintf("J4: AAAARRRRGGGHHH!!! killed by someone...\n");
-}
-
-void *J4(void *arg)
-{
- int err;
- siginfo_t info;
- sigset_t mask;
- struct timespec t;
-
- cprintf("J4 starts and call sigtimedwait(28)\n");
-
- sigemptyset(&mask);
- sigaddset(&mask,28);
- t.tv_sec = 10;
- t.tv_nsec = 0;
-
- pthread_cleanup_push(uscitaJ4,NULL);
- err = sigtimedwait(&mask,&info,&t);
- pthread_cleanup_pop(0);
-
- cprintf("J4 exit from sigtimedwait(), err=%d, signo=%d code=%d value=%d\n",
- err, info.si_signo, info.si_code, info.si_value.sival_int);
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- int err;
- sigset_t mask;
- pthread_t j1, j2, j3, j4;
- union sigval value;
-
-
- /* main blocks signals for all the tasks */
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- cprintf("main: creating J1\n");
- err = pthread_create(&j1, NULL, J1, NULL);
- if (err) cprintf("Error creating J1\n");
-
- cprintf("main: creating J2\n");
- err = pthread_create(&j2, NULL, J2, NULL);
- if (err) cprintf("Error creating J2\n");
-
- cprintf("main: creating J3\n");
- err = pthread_create(&j3, NULL, J3, NULL);
- if (err) cprintf("Error creating J3\n");
-
- cprintf("main: creating J4\n");
- err = pthread_create(&j4, NULL, J4, NULL);
- if (err) cprintf("Error creating J4\n");
-
- cprintf("main: waiting 0.2 sec\n");
- while (sys_gettime(NULL) < 200000);
-
- cprintf("main: kill(31), then wait until t=0.4 sec \n");
- kill(0, 31);
-
- while (sys_gettime(NULL) < 400000);
- cprintf("main: sigqueue(30), then wait until t=0.8 sec \n");
- value.sival_int = 300;
- sigqueue(0, 30, value);
-
- while (sys_gettime(NULL) < 800000);
- cprintf("main: kill(J4)\n");
- pthread_cancel(j4);
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pse51/ptest2.c
===================================================================
--- branches/xen/pse51/ptest2.c (revision 1684)
+++ branches/xen/pse51/ptest2.c (nonexistent)
@@ -1,135 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest2.c,v 1.4 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 2:
-
- pthread_once + thread_specific_data
-
- the main task:
- creates a key
- creates 2 tasks, J1, J2
- at t = 0.4 sec. it kills J1 and J2
-
- J1 and J2 will set and check the thread specific data
- and when the die, a destructor is called (twice, because the value
- is not set to null...)
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-
-#include <kernel/kern.h>
-
-pthread_key_t prova_key;
-
-pthread_once_t once = PTHREAD_ONCE_INIT;
-
-void once_init()
-{
- cprintf("ONCE: (pid=%d)\n", exec_shadow);
-}
-
-void destr_key(void *arg)
-{
- cprintf("J (pid=%d) destructor called with value %d\n", exec_shadow,(int)arg);
- pthread_setspecific(prova_key,(void *)((int)arg/100));
-}
-
-void print_test()
-{
- int val;
-
- val = (int)pthread_getspecific(prova_key);
- cprintf("J (pid=%d) printtest value=%d\n", exec_shadow, val);
-}
-
-void *J(void *arg)
-{
- pthread_once(&once, once_init);
- cprintf("J (pid=%d) starts and call setspecific\n", exec_shadow);
- pthread_setspecific(prova_key,arg);
- print_test();
- cprintf("J (pid=%d) exits\n", exec_shadow);
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- int err;
- pthread_t j1, j2;
-
- cprintf("main: creating prova_key\n");
- pthread_key_create(&prova_key, destr_key);
-
- cprintf("main: provakey =%d\n", prova_key);
-
- cprintf("main: creating J1\n");
- err = pthread_create(&j1, NULL, J, (void *)1414);
- if (err) cprintf("Error creating J1\n");
- cprintf("main: J1 has PID %d\n",j1);
-
- cprintf("main: creating J2\n");
- err = pthread_create(&j2, NULL, J, (void *)3141);
- if (err) cprintf("Error creating J2\n");
- cprintf("main: J2 has PID %d\n",j2);
-
- cprintf("main: waiting 0.4 sec\n");
- while (sys_gettime(NULL) < 400000);
-
- cprintf("main: kill J1 and J2\n");
- pthread_cancel(j1);
- pthread_cancel(j2);
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pse51/ptest3.c
===================================================================
--- branches/xen/pse51/ptest3.c (revision 1684)
+++ branches/xen/pse51/ptest3.c (nonexistent)
@@ -1,213 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest3.c,v 1.4 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 3:
-
- timers...
- it creates two periodic timers that queues signals, a periodic timer
- that create tasks and an one-shot timer.
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-#include <time.h>
-
-#include <kernel/kern.h>
-
-int count25 = 0, count26 = 0;
-
-void signal_handler(int signo, siginfo_t *info, void *extra)
-{
- switch (signo) {
- case 25:
- count25++;
- break;
- case 26:
- count26++;
- break;
- }
-
- cprintf("Signal %d code=%s value=%d task=%d count25=%d count26=%d time=%ldusec\n",
- info->si_signo,
- (info->si_code == SI_TIMER) ? "Timer" : "Other",
- info->si_value.sival_int,
- info->si_task,
- count25,
- count26,
- sys_gettime(NULL));
-}
-
-void task_timer(union sigval value)
-{
- cprintf("task_timer: value = %d, time = %ldusec\n",
- value.sival_int, sys_gettime(NULL));
-}
-
-int main(int argc, char **argv)
-{
- int err;
- timer_t timer1, timer2, timer3;
- struct itimerspec timeout1, timeout2, timeout3, nulltimeout;
- struct sigaction sig_act;
- struct sigevent ev25, ev26, evtask;
- pthread_attr_t task_attr;
- struct sched_param task_param;
-
- sig_act.sa_sigaction = (void *) signal_handler;
- sig_act.sa_flags = SA_SIGINFO;
- sigemptyset(&sig_act.sa_mask);
-
- sigaction(25, &sig_act, NULL);
- sigaction(26, &sig_act, NULL);
-
- // set ev25, ev26, evtask
- ev25.sigev_notify = SIGEV_SIGNAL;
- ev25.sigev_signo = 25;
- ev25.sigev_value.sival_int = 555;
-
- ev26.sigev_notify = SIGEV_SIGNAL;
- ev26.sigev_signo = 26;
- ev26.sigev_value.sival_int = 666;
-
- evtask.sigev_notify = SIGEV_THREAD;
- evtask.sigev_value.sival_int = 777;
- evtask.sigev_notify_function = task_timer;
- evtask.sigev_notify_attributes = &task_attr;
-
- pthread_attr_init(&task_attr);
- pthread_attr_setdetachstate(&task_attr, PTHREAD_CREATE_DETACHED);
- pthread_attr_setschedpolicy(&task_attr, SCHED_FIFO);
- task_param.sched_priority = 10;
- pthread_attr_setschedparam(&task_attr, &task_param);
-
- // set timeout1, timeout2, nulltimeout
- timeout1.it_interval.tv_sec = 0;
- timeout1.it_interval.tv_nsec = 500000000;
- timeout1.it_value.tv_sec = 3;
- timeout1.it_value.tv_nsec = 0;
-
- timeout2.it_interval.tv_sec = 0;
- timeout2.it_interval.tv_nsec = 200000000;
- timeout2.it_value.tv_sec = 7;
- timeout2.it_value.tv_nsec = 0;
-
- timeout3.it_interval.tv_sec = 0;
- timeout3.it_interval.tv_nsec = 300000000;
- timeout3.it_value.tv_sec = 5;
- timeout3.it_value.tv_nsec = 0;
-
- NULL_TIMESPEC(&nulltimeout.it_value);
- NULL_TIMESPEC(&nulltimeout.it_interval);
-
- // create the timers
- err = timer_create(CLOCK_REALTIME, &ev25, &timer1);
- if (err == -1) { cprintf("main: unable to create timer 1\n"); }
-
- err = timer_create(CLOCK_REALTIME, &ev26, &timer2);
- if (err == -1) { cprintf("main: unable to create timer 2\n"); }
-
- err = timer_create(CLOCK_REALTIME, &evtask, &timer3);
- if (err == -1) { cprintf("main: unable to create timer 3\n"); }
-
- // arm the timers
- err = timer_settime(timer1, TIMER_ABSTIME, &timeout1, NULL);
- if (err == -1) { cprintf("main: unable to set timer 1\n"); }
-
- err = timer_settime(timer2, 0, &timeout2, NULL);
- if (err == -1) { cprintf("main: unable to set timer 2\n"); }
-
- err = timer_settime(timer3, TIMER_ABSTIME, &timeout3, NULL);
- if (err == -1) { cprintf("main: unable to set timer 3\n"); }
-
- cprintf("main: waiting signals...\n");
- while (sys_gettime(NULL) < 8500000) {
- //kern_deliver_pending_signals();
- }
-
- cprintf("main: disarm the timer2\n");
- err = timer_settime(timer2, 0, &nulltimeout, &timeout2);
- if (err == -1) { cprintf("main: unable to disarm timer 2\n"); }
-
- cprintf("main: timer2 disarmed, itvalue=%ld.%ld\n",
- timeout2.it_value.tv_sec,timeout2.it_value.tv_nsec/1000);
-
- while (sys_gettime(NULL) < 10000000) {
- //kern_deliver_pending_signals();
- }
-
- cprintf("main: disarm the timer1\n");
- err = timer_settime(timer1, TIMER_ABSTIME, &nulltimeout, &timeout1);
- if (err == -1) { cprintf("main: unable to disarm timer 1\n"); }
-
- cprintf("main: timer1 disarmed, itvalue=%ld.%ld\n",
- timeout1.it_value.tv_sec,timeout1.it_value.tv_nsec/1000);
-
- while (sys_gettime(NULL) < 12000000) {
- //kern_deliver_pending_signals();
- }
-
- cprintf("main: arm timer1\n");
- timeout1.it_interval.tv_sec = 0;
- timeout1.it_interval.tv_nsec = 0;
- timeout1.it_value.tv_sec = 13;
- timeout1.it_value.tv_nsec = 0;
- err = timer_settime(timer1, TIMER_ABSTIME, &timeout1, NULL);
- if (err == -1) { cprintf("main: unable to arm timer 1\n"); }
-
- while (sys_gettime(NULL) < 14000000) {
- //kern_deliver_pending_signals();
- }
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pse51/pinit.c
===================================================================
--- branches/xen/pse51/pinit.c (revision 1684)
+++ branches/xen/pse51/pinit.c (nonexistent)
@@ -1,104 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: pinit.c,v 1.4 2005-02-25 11:05:44 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2005-02-25 11:05:44 $
- ------------
-
- This is a minimal initialization file for the PSE51 profile.
-
- It initializes the POSIX scheduler, the Hartik Ports and the Keyboard driver.
-
-**/
-
-/*
- * 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 "posix/posix/posix.h"
-#include "dummy/dummy/dummy.h"
-
-#include "pi/pi/pi.h"
-#include "pc/pc/pc.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include "pthread.h"
-#include "time.h"
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- POSIX_register_level(RRTICK, POSIX_MAIN_YES, mb, 32);
- dummy_register_level();
-
- PI_register_module();
- PC_register_module();
-
- SEM_register_module();
-
- /* for the Pthread library */
- PTHREAD_register_module(0, 0, 1);
-
- /* for the real time clock extensions */
- TIMER_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: branches/xen/pse51/ptest4.c
===================================================================
--- branches/xen/pse51/ptest4.c (revision 1684)
+++ branches/xen/pse51/ptest4.c (nonexistent)
@@ -1,137 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest4.c,v 1.4 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.4 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 4:
-
- the main task create 3 tasks, J1, J2, J3
- at t = 1 sec. it raise a signal to J1
- at t = 2 sec. it kills J2
-
- J1,J2,J3: it simply calls nanosleep
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-#include <signal.h>
-#include <time.h>
-
-#include <kernel/kern.h>
-
-void uscitaJ(void *arg)
-{
- cprintf("J: (pid=%d) AAAARRRRGGGHHH!!! killed by someone...\n", exec_shadow);
-}
-
-void *J(void *arg)
-{
- struct timespec t1, t2;
- int err;
-
- cprintf("J (pid=%d) starts and call nanosleep\n",exec_shadow);
-
- t1.tv_sec = 3;
- t1.tv_nsec = 0;
- NULL_TIMESPEC(&t2);
- pthread_cleanup_push(uscitaJ,NULL);
- err = nanosleep(&t1, &t2);
- pthread_cleanup_pop(0);
-
- cprintf("J (pid=%d) ending, nanosleep returns errno=%d, t2=%ld.%ld\n",
- exec_shadow, err, t2.tv_sec, t2.tv_nsec/1000);
-
- return 0;
-}
-
-void signal_handler(int signo, siginfo_t *info, void *extra)
-{
- cprintf("SIGNAL HANDLER: pid=%d\n",exec_shadow);
-}
-
-
-int main(int argc, char **argv)
-{
- int err;
- pthread_t j1, j2, j3;
- struct sigaction sig_act;
-
- sig_act.sa_sigaction = (void *) signal_handler;
- sig_act.sa_flags = SA_SIGINFO;
- sigemptyset(&sig_act.sa_mask);
-
- sigaction(31, &sig_act, NULL);
-
- cprintf("main: creating J1\n");
- err = pthread_create(&j1, NULL, J, NULL);
- if (err) cprintf("Error creating J1\n");
-
- cprintf("main: creating J2\n");
- err = pthread_create(&j2, NULL, J, NULL);
- if (err) cprintf("Error creating J2\n");
-
- cprintf("main: creating J3\n");
- err = pthread_create(&j3, NULL, J, NULL);
- if (err) cprintf("Error creating J3\n");
-
- cprintf("main: waiting 1 sec\n");
- while (sys_gettime(NULL) < 1000000);
-
- cprintf("main: pthread_kill on j1, then wait until t=2 sec \n");
- pthread_kill(j1, 31);
-
- while (sys_gettime(NULL) < 2000000);
- cprintf("main: pthread_cancel(J2)\n");
- pthread_cancel(j2);
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pse51/ptest5.c
===================================================================
--- branches/xen/pse51/ptest5.c (revision 1684)
+++ branches/xen/pse51/ptest5.c (nonexistent)
@@ -1,92 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest5.c,v 1.3 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 5:
- an alarm test
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <kernel/kern.h>
-
-void signal_handler(int signo, siginfo_t *info, void *extra)
-{
- cprintf("SIGNAL HANDLER: pid=%d\n",exec_shadow);
-}
-
-int main(int argc, char **argv)
-{
- struct sigaction sig_act;
-
- sig_act.sa_sigaction = (void *) signal_handler;
- sig_act.sa_flags = SA_SIGINFO;
- sigemptyset(&sig_act.sa_mask);
-
- sigaction(SIGALRM, &sig_act, NULL);
-
- cprintf("main: alarm(5), waiting t=2 sec\n");
- alarm(5);
-
- while (sys_gettime(NULL) < 2000000);
-
- cprintf("main: alarm(3) return %d, waiting t=6 sec\n",alarm(3));
-
- pause();
-// while (sys_gettime(NULL) < 6000000);
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pse51/ptest6.c
===================================================================
--- branches/xen/pse51/ptest6.c (revision 1684)
+++ branches/xen/pse51/ptest6.c (nonexistent)
@@ -1,286 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ptest6.c,v 1.3 2005-01-08 14:36:11 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.3 $
- Last update: $Date: 2005-01-08 14:36:11 $
- ------------
-
- Posix test 6:
-
- message queues
-
- main thread:
- set a sigevent to sigev_thread on a mailbox (that creates thread 2)
- creates thread 1
- waits t=3.5 sec.
- pthread_cancel(T4)
-
- thread 1:
- send a msg to the mailbox (the event fires and thread 2 is created)
-
- thread 2:
- receive the msg sent by thread 1
- set the event to a signal
- creates thread 3 and 4
- waits t = 1 sec
- send another msg
-
- thread 3:
- receive the msg sent by 2 (it blocks!)
- waits t = 2 sec
- send 5 msgs (with different priorities!!!
-
- thread 4:
- receives 5 msgs every 0.5 sec.
- then receive another message that never will arrive...
-
- non standard function used:
- cprintf
- sys_gettime
- keyboard stuffs
-
-**/
-
-/*
- * 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 <sys/types.h>
-#include <pthread.h>
-#include <mqueue.h>
-
-#include <kernel/kern.h>
-
-struct sigevent ev25, evtask;
-pthread_attr_t task_attr;
-struct sched_param task_param;
-mqd_t mq;
-pthread_t T1,T2,T3,T4,T5;
-
-#define MESSAGE_LENGTH 100
-
-void *t1(void *arg)
-{
- cprintf("T1: started, sending a message\n");
- if (mq_send(mq,"Donald Duck",12,1))
- { cprintf("T1: mq_send returns errno %d\n",errno); return 0; }
-
- cprintf("T1: ending...\n");
- return 0;
-}
-
-void *t4(void *arg);
-void *t3(void *arg);
-
-void t2(union sigval value)
-{
- ssize_t x;
- char buf[MESSAGE_LENGTH];
- int prio;
-
- cprintf("T2: value = %d, receiving a message\n", value.sival_int);
-
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
-
- cprintf("T2: received message: length=%ld, prio=%d, text=°%s°, notify...\n",
- x,prio,buf);
-
- if (mq_notify(mq, &ev25))
- { cprintf("T2: mq_notify returns errno %d\n",errno); exit(1); }
-
- cprintf("T2: waiting t = 1 sec.\n");
- while (sys_gettime(NULL)<1000000);
- cprintf("T2: 1 sec. reached, sending another message and creating T3 and T4, \n");
-
- if (mq_send(mq,"Mickey Mouse",13,1))
- { cprintf("T2: mq_send returns errno %d\n",errno); exit(1); }
-
- pthread_create(&T3, NULL, t3, NULL);
- pthread_create(&T4, NULL, t4, NULL);
-
- cprintf("T2: ending...\n");
-}
-
-void *t3(void *arg)
-{
- ssize_t x;
- char buf[MESSAGE_LENGTH];
- int prio;
-
- cprintf("T3: waiting a message...\n");
-
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
-
- // mickey mouse
- cprintf("T3: received message: length=%ld, prio=%d, text=°%s°\n",
- x,prio,buf);
-
- cprintf("T3: waiting t = 1.5 sec.\n");
- while (sys_gettime(NULL)<1500000);
- cprintf("T3: 2 sec. reached, sending 5 messages\n");
-
- if (mq_send(mq,"Goofy",6,1))
- { cprintf("T3: mq_send1 returns errno %d\n",errno); exit(1); }
- cprintf("Û");
-
- if (mq_send(mq,"Minnie",7,1))
- { cprintf("T3: mq_send2 returns errno %d\n",errno); exit(1); }
- cprintf("Û");
-
- if (mq_send(mq,"Pluto",6,2)) // NB: different priority!!!
- { cprintf("T3: mq_send3 returns errno %d\n",errno); exit(1); }
- cprintf("Û");
-
- if (mq_send(mq,"Rocker Duck",12,2)) // NB: different priority!!!
- { cprintf("T3: mq_send4 returns errno %d\n",errno); exit(1); }
- cprintf("Û");
-
- if (mq_send(mq,"Oncle Scroodge",15,2)) // NB: different priority!!!
- { cprintf("T3: mq_send5 returns errno %d\n",errno); exit(1); }
- cprintf("Û");
-
- cprintf("T3: ending...\n");
-
- return 0;
-}
-
-void t4exit(void *arg)
-{
- cprintf("T4: AAAARRRRGGGHHH!!! killed by someone...\n");
-}
-
-void *t4(void *arg)
-{
- ssize_t x;
- char buf[MESSAGE_LENGTH];
- int prio;
-
- cprintf("T4: waiting t = 2.2 sec.\n");
-
- while (sys_gettime(NULL)<2200000);
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
-
- while (sys_gettime(NULL)<2400000);
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
- while (sys_gettime(NULL)<2600000);
-
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
- while (sys_gettime(NULL)<2800000);
-
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
- while (sys_gettime(NULL)<3000000);
-
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
-
- pthread_cleanup_push(t4exit,NULL);
- x = mq_receive(mq,buf,MESSAGE_LENGTH,&prio);
- cprintf("T4: received message: length=%ld, prio=%d, text=°%s°\n",x,prio,buf);
- pthread_cleanup_pop(0);
-
- return 0;
-}
-
-void signal_handler(int signo, siginfo_t *info, void *extra)
-{
- cprintf("Signal %d code=%s value=%d task=%d time=%ldusec\n",
- info->si_signo,
- (info->si_code == SI_TIMER) ? "Timer" : "Other",
- info->si_value.sival_int,
- info->si_task,
- sys_gettime(NULL));
-}
-
-int main(int argc, char **argv)
-{
-// int err;
- struct sigaction sig_act;
- struct mq_attr attr;
-
- sig_act.sa_sigaction = (void *) signal_handler;
- sig_act.sa_flags = SA_SIGINFO;
- sigemptyset(&sig_act.sa_mask);
- sigaction(25, &sig_act, NULL);
-
- // set ev25, evtask
- ev25.sigev_notify = SIGEV_SIGNAL;
- ev25.sigev_signo = 25;
- ev25.sigev_value.sival_int = 555;
-
- evtask.sigev_notify = SIGEV_THREAD;
- evtask.sigev_value.sival_int = 777;
- evtask.sigev_notify_function = t2;
- evtask.sigev_notify_attributes = &task_attr;
-
- // set pthread attributes
- pthread_attr_init(&task_attr);
- pthread_attr_setdetachstate(&task_attr, PTHREAD_CREATE_DETACHED);
- pthread_attr_setschedpolicy(&task_attr, SCHED_FIFO);
- task_param.sched_priority = 10;
- pthread_attr_setschedparam(&task_attr, &task_param);
-
- // set mqueue attributes
- attr.mq_flags = 0;
- attr.mq_maxmsg = 3;
- attr.mq_msgsize = MESSAGE_LENGTH;
-
- // create the message queue
- if ((mq = mq_open("mq", O_CREAT|O_RDWR, 0, &attr)) == -1)
- { cprintf("main: mq_open returns errno %d\n",errno); return 0; }
-
- if (mq_notify(mq, &evtask))
- { cprintf("main: mq_notify returns errno %d\n",errno); return 0; }
-
- cprintf("main: created mq, creating T1...\n");
-
- pthread_create(&T1, NULL, t1, NULL);
-
- cprintf("main: waiting t= 3.5 sec., then kill T4...\n");
-
- while (sys_gettime(NULL)<3500000);
-
- pthread_cancel(T4);
-
- cprintf("main: ending...\n");
-
- return 0;
-}
Index: branches/xen/pci6025e/test_dio.c
===================================================================
--- branches/xen/pci6025e/test_dio.c (revision 1684)
+++ branches/xen/pci6025e/test_dio.c (nonexistent)
@@ -1,171 +0,0 @@
-/*****************************************************************************
-* Filename: Test_dio.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 22/03/2001 *
-* Last update: 22/03/2001 *
-* Description: Test STC digital lines (8 lines) *
-*----------------------------------------------------------------------------*
-* Notes: Configure DIO 4 5 6 7 in input and DIO 0 1 2 3 in output *
-* Two way to test this 8 lines: *
-* 1) Connect 4 LEDs to output lines and check LEDs lights *
-* themselves in counting order. Connect input lines to Vcc *
-* or GND and check on video that STC has readed the right *
-* nibble *
-* 2) Connect 4 output lines with 4 input lines and check on *
-* video that the nibble readed by STC change in counting *
-* order *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#include <drivers/pci6025e/dio_ppi.h>
-
-BYTE system = 0;
-
-void close_event(void *);
-TASK test_DIO(int dummy);
-void exit_fun(KEY_EVT *);
-void draw_screen(void);
-
-int main(int argc, char **argv)
-{
- HARD_TASK_MODEL m;
- KEY_EVT k;
- PID pid_m;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, exit_fun, FALSE);
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, exit_fun, FALSE);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m, 90000);
- hard_task_def_mit(m, 250000);
- pid_m = task_create("TEST DIO", test_DIO, &m, NULL);
- if(pid_m == NIL){
- system = 10;
- exit(1);
- }
-
- //Look for a National board on PCI bus
- if(!reMap()){
- system = 21;
- exit(1);
- }
-
- //Start configuring DIO module
- DIO_init();
-
- draw_screen();
-
- task_activate(pid_m);
-
- return 0;
-}
-
-void draw_screen(void)
-{
- grx_rect(5, 5, 405, 130, rgb16(255, 0, 0));
- grx_rect(4, 4, 406, 131, rgb16(0,255,255));
- grx_rect(3, 3, 407, 132, rgb16(255, 0, 0));
- grx_rect(15, 45, 195, 100, rgb16(255, 0, 0));
- grx_rect(215, 45, 395, 100, rgb16(0, 255, 0));
- grx_text("Test of PCI6025E DIO function",
- 9, 7, rgb16(0, 255, 0), rgb16(0, 0, 0));
- grx_text("DIO 4-5-6-7 are configured in input mode",
- 9, 20, rgb16(255, 70, 70), rgb16(0, 0, 0));
- grx_text("DIO 0-1-2-3 are configured in output mode",
- 9, 28, rgb16(255, 70, 70), rgb16(0, 0, 0));
- grx_text("Output bits", 35, 50, rgb16(200, 0, 0), rgb16(0, 0, 0));
- grx_text("input bits", 235, 50, rgb16(30,255,30), rgb16(0, 0, 0));
- grx_text("CTRL + C to exit", 9, 115, rgb16(255,255,0), rgb16(0,0,0));
-}
-
-/*
-* At each activation this task change output value of lowest digitals line
-* and read value on highest digital lines, showing them at video
-*/
-TASK test_DIO(int dummy)
-{
- BYTE out_val = 0x00,
- in_val = 0;
- int i;
- char buf[10];
-
- //DIO 0..3 configured as output
- //DIO 4..7 configured as input
- DIO_setup(0x0F);
-
- while(1){
- DIO_write(out_val); //sends out value
- in_val = DIO_read() >> 4; //reads value
-
- for(i=3; i>=0; i--){
- if( (out_val>>i)%2 )
- grx_text("1", 25+10*(3-i), 75, rgb16(255,0,0), rgb16(0,0,0));
- else
- grx_text("0", 25+10*(3-i), 75, rgb16(255,0,0), rgb16(0,0,0));
- if( (in_val>>i)%2 )
- grx_text("1", 225+10*(3-i), 75, rgb16(0,255,0), rgb16(0,0,0));
- else
- grx_text("0", 225+10*(3-i), 75, rgb16(0,255,0), rgb16(0,0,0));
- }
- sprintf(buf, "%03d", out_val);
- grx_text(buf, 80, 75, rgb16(255,0,0), rgb16(0,0,0));
- sprintf(buf, "%03d", in_val);
- grx_text(buf, 280, 75, rgb16(0,255,0), rgb16(0,0,0));
-
- out_val = (out_val+1)%16;
- task_endcycle();
- }
-}
-
-void close_event(void *arg)
-{
- switch(system){
- case 0: sys_shutdown_message("Regular end\n"); break;
- case 10:sys_shutdown_message("Cannot create task TEST DIO\n"); break;
- case 21:sys_shutdown_message("No National board on PC\n"); break;
- case 30:sys_shutdown_message("Cannot start graphic envirorment\n"); break;
- default: sys_shutdown_message("Unknown exit\n"); break;
- }
-}
-
-void exit_fun(KEY_EVT *k)
-{
- system = 0;
-
- close_event(NULL);
-
- exit(1);
-}
-
Index: branches/xen/pci6025e/readme
===================================================================
--- branches/xen/pci6025e/readme (revision 1684)
+++ branches/xen/pci6025e/readme (nonexistent)
@@ -1,7 +0,0 @@
-These are the demos available for the National Instruments PCI6025e boards.
-
-These demos and the PCI driver have been made by
-Marco Ziglioli (zi_mar@libero.it). Please send any comments to:
-zi_mar@libero.it or to shark-help@gandalf.sssup.it.
-
-Paolo
Index: branches/xen/pci6025e/makefile
===================================================================
--- branches/xen/pci6025e/makefile (revision 1684)
+++ branches/xen/pci6025e/makefile (nonexistent)
@@ -1,32 +0,0 @@
-#
-#
-# PCI6025E Examples and Test programs
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= test_dac wave test_dio test_ppi test_ec test_bec test_mes test_bms
-
-include $(BASE)/config/example.mk
-
-test_dac:
- make -f $(SUBMAKE) APP=test_dac OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-wave:
- make -f $(SUBMAKE) APP=wave OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_dio:
- make -f $(SUBMAKE) APP=test_dio OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_ppi:
- make -f $(SUBMAKE) APP=test_ppi OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_ec:
- make -f $(SUBMAKE) APP=test_ec OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_bec:
- make -f $(SUBMAKE) APP=test_bec OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_mes:
- make -f $(SUBMAKE) APP=test_mes OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-test_bms:
- make -f $(SUBMAKE) APP=test_bms OTHEROBJS=initfile.o SHARKOPT="__LINUXC26__ __PCI__ __6025E__ __INPUT__ __FB__"
-
Index: branches/xen/pci6025e/test_bms.c
===================================================================
--- branches/xen/pci6025e/test_bms.c (revision 1684)
+++ branches/xen/pci6025e/test_bms.c (nonexistent)
@@ -1,262 +0,0 @@
-/*****************************************************************************
-* Filename: test_bms.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 27/06/2001 *
-* Description: Test program for buffered period and semiperiod measurement *
-* capacity of National PCI6025E board *
-*----------------------------------------------------------------------------*
-* Notes: FOUT are enable and avaiable on pin 50 to provide 1 Mhz frequency *
-* You should connect source 0 (PIN 41) and source 1 (pin 45) to this *
-* freq source. Gate 0 (pin 42) and gate 1 (pin 44) must be connected *
-* rispectivly to DIO7 (pin 32) and DIO6 (pin 30). *
-* Use 'g' button to activate gate_action_task which generate a square *
-* wave with a freq of 0.5 Hz and Duty cycle of 75%. *
-* 's' button should show counters countent but gate_action_task *
-* when active shows counters content automatically so 's' button isn't*
-* useful. *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#include <drivers/pci6025e/timer.h>
-#include <drivers/pci6025e/dio_ppi.h>
-
-#define SHOW_MET 30000
-#define SHOW_WCET 50000
-#define SHOW_PERIOD 1000000
-
-#define GATE_MET 2000
-#define GATE_WCET 5000
-#define GATE_PERIOD 2000000
-
-#define GATE_ACTION_P 500000
-#define GATE_ACTION_W 10000
-
-#define black rgb16(0, 0, 0)
-
-void endFun(KEY_EVT *);
-void gateEvent(KEY_EVT *);
-void showEvent(KEY_EVT *);
-
-void closeEvent(void *);
-
-void drawInterface(void);
-
-TASK show_val_body(int);
-TASK gate_action_body(int);
-
-BYTE sys = 0;
-PID show_val_pid, gate_action_pid;
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- SOFT_TASK_MODEL show_val_mod;
- HARD_TASK_MODEL gate_action_model;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endFun, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endFun, FALSE);
-
- k.flag = 0;
- k.scan = KEY_G;
- k.ascii = 'g';
- k.status = KEY_PRESSED;
- keyb_hook(k, gateEvent, FALSE);
-
- k.scan = KEY_S;
- k.ascii = 's';
- k.status = KEY_PRESSED;
- keyb_hook(k, showEvent, FALSE);
-
- if(!reMap()){
- sys = 11;
- exit(1);
- }
-
- soft_task_default_model(show_val_mod);
- soft_task_def_aperiodic(show_val_mod);
- soft_task_def_level(show_val_mod, 2);
- soft_task_def_met(show_val_mod, SHOW_MET);
- soft_task_def_wcet(show_val_mod, SHOW_WCET);
- soft_task_def_period(show_val_mod, SHOW_PERIOD);
- if( (show_val_pid = task_create("Show task", show_val_body, &show_val_mod, NULL))
- == NIL ){
- sys = 20;
- exit(1);
- }
-
- hard_task_default_model(gate_action_model);
- hard_task_def_mit(gate_action_model, GATE_ACTION_P);
- hard_task_def_wcet(gate_action_model, GATE_ACTION_W);
- if( (gate_action_pid = task_create("Gate Action", gate_action_body, &gate_action_model, NULL))
- == NIL ){
- sys = 22;
- exit(1);
- }
-
- drawInterface();
-
- DIO_init();
- DIO_setup(0xFF);
- DIO_write(0x00);
-
- //All PFI configured as input
- PFIprogramming(0x0000);
-
- //Fout provide 1MHz: timebase = 20MHz; divided by 2; on FOUT pin also divided by 10
- setIntClock(0, 1, 10);
-
- //Reset both counters
- TIM_reset(2);
-
- //C0 measures period on PFI3 with gate from PFI 4 driven by DIO7
- TIM_bufferedTimeMeasurement(C0, 0x04, 0x45, 0, 0);
-
- //C1 measures semiperiod on PFI 6 with gate from PFI 5 driven by FIO6
- TIM_bufferedTimeMeasurement(C1, 0x87, 0x46, 1, 0);
-
- //arm both counters
- TIM_arm(2);
-
- return 0;
-}
-
-void endFun(KEY_EVT *k)
-{
- closeEvent(NULL);
-
- exit(1);
-}
-
-void showEvent(KEY_EVT *k)
-{
- task_activate(show_val_pid);
-}
-
-void gateEvent(KEY_EVT *k)
-{
- task_activate(gate_action_pid);
-}
-
-void drawInterface(void)
-{
- grx_rect(1, 1, 799, 129, rgb16(105, 0, 0));
- grx_rect(2, 2, 798, 128, rgb16(155, 0, 0));
- grx_rect(3, 3, 797, 127, rgb16(205, 0, 0));
- grx_rect(4, 4, 796, 126, rgb16(255, 0, 0));
-
- grx_text("Test program for Buffered Period and Semiperiod measure through PCI6025E timers",
- 7, 10, rgb16(50, 255, 50), black);
-
- grx_text("This program counting rise edges on counters source (PFI3 & PFI6) between two rising",
- 7, 25, rgb16(0, 255, 255), black);
- grx_text("edges on gate (PFI 42) and beetwen each gate edge (PFI44).FOUT is enabled and",
- 7, 33, rgb16(0, 255, 255), black);
- grx_text("provides a frequency of 1 MHz", 7, 41, rgb16(0, 255, 255), black);
- grx_text("Instruction:",7, 53, rgb16(255, 0, 0), black);
- grx_text("Use 's' to see counters value",
- 7, 61, rgb16(0, 255, 255), black);
- grx_text("Use 'g' to enbale automatic tasks which generate square wave with freq of 0.5Hz",
- 7, 68, rgb16(0, 255, 255), black);
-
- grx_text("And duty cycle of 75%. Counter 0 must be loaded with about 2E6 ticks and counter 1",
- 7, 75, rgb16(0, 255, 255), black);
- grx_text("must be loaded alternativly with about 1.5E6 and 0.5E6 ticks",
- 7, 83, rgb16(0, 255, 255), black);
-
- grx_text("Please connect DIO7 (pin 32) to PFI4 (pin 42) and DIO6 (pin 30) to PFI5 (pin 44)",
- 7, 95, rgb16(0, 255, 0), black);
- grx_text("CTRL-C for Exit", 7, 110, rgb16(200, 200, 0), black);
-
- grx_rect(1, 147, 355, 183, rgb16(0, 105, 0));
- grx_rect(2, 148, 354, 182, rgb16(0, 155, 0));
- grx_rect(3, 149, 353, 181, rgb16(0, 205, 0));
- grx_rect(4, 150, 352, 180, rgb16(0, 255, 0));
- grx_text("Period", 7, 155, rgb16(255, 255, 0), black);
-
- grx_rect(455, 147, 799, 183, rgb16(0, 105, 0));
- grx_rect(456, 148, 798, 182, rgb16(0, 155, 0));
- grx_rect(457, 149, 797, 181, rgb16(0, 205, 0));
- grx_rect(458, 150, 796, 180, rgb16(0, 255, 0));
- grx_text("Semiperiod", 461, 155, rgb16(255, 0, 255), black);
-}
-
-TASK show_val_body(int dummy)
-{
- DWORD val;
- char buf[40];
-
- while(1){
- val = TIM_readHWSaveReg(C0);
- sprintf(buf,"C0 %07ld", val);
- grx_text(buf, 7, 165, rgb16(255, 0, 0), rgb16(0, 0, 0));
- val = TIM_readHWSaveReg(C1);
- sprintf(buf,"C1 %07ld", val);
- grx_text(buf, 461, 165, rgb16(0, 255, 0), rgb16(0, 0, 0));
-
- task_endcycle();
- }
-}
-
-TASK gate_action_body(int dummy)
-{
- int i;
- i = 0;
-
- while(1){
- if( (i%4)==0 ) DIO_write(0xC0);
- if( (i%4)==3 ) DIO_write(0x00);
-
- i++;
-
- task_activate(show_val_pid);
-
- task_endcycle();
- }
-}
-
-void closeEvent(void *arg)
-{
- TIM_disarm(2);
- switch(sys){
- case 0: sys_shutdown_message("Ok\n"); break;
- case 10: sys_shutdown_message("No PCI\n"); break;
- case 11: sys_shutdown_message("No National Board\n"); break;
- case 20: sys_shutdown_message("task <show val> down\n"); break;
- case 22: sys_shutdown_message("task <gate action> down\n"); break;
- case 30: sys_shutdown_message("Cannot initialize grx\n"); break;
- case 31: sys_shutdown_message("Resolution 800x600x16 not supported\n"); break;
- case 32: sys_shutdown_message("Cannot sets up graphic envirorment\n"); break;
- default: sys_shutdown_message("????????????\n"); break;
- }
-}
Index: branches/xen/pci6025e/wave.c
===================================================================
--- branches/xen/pci6025e/wave.c (revision 1684)
+++ branches/xen/pci6025e/wave.c (nonexistent)
@@ -1,312 +0,0 @@
-/*****************************************************************************
-* Filename: wave.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 12/06/2001 *
-* Description: Little test program for Analog Output section of PCI6025E *
-*----------------------------------------------------------------------------*
-* Notes: Connect an oscilloscope to DACs output pins (20 & 21) and *
-* watch the waveforms. *
-* and decrise voltage *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#include <sem/sem/sem.h>
-
-#include <drivers/pci6025e/dac.h>
-
-#define MAX_VAL 500
-
-#define WAVE_PERIOD 1000
-#define WAVE_WCET 200
-#define GRAPH_PERIOD 1000
-#define GRAPH_WCET 550
-
-#define TASK_GROUP 1
-
-#define DAC0_CONV 0.1
-#define DAC1_CONV 0.05
-
-#define INC 40
-
-void createWaves(void);
-void drawInterface(void);
-
-void endfun(KEY_EVT *);
-void close_event(void *);
-
-TASK wave_body(int);
-TASK video_body(int);
-
-WORD wave0[MAX_VAL], wave1[MAX_VAL];
-int black = rgb16(0,0,0),
- white = rgb16(255, 255, 255);
-
-BYTE sys = 0;
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- HARD_TASK_MODEL wave0, wave1;
- HARD_TASK_MODEL video;
- PID wave0_pid, wave1_pid, video_pid;
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- k.flag = CNTL_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- hard_task_default_model(wave0);
- hard_task_def_wcet(wave0, WAVE_WCET);
- hard_task_def_mit(wave0, WAVE_PERIOD);
- hard_task_def_arg(wave0, 0);
- hard_task_def_group(wave0, TASK_GROUP);
- if( (wave0_pid = task_create("Wave 0", wave_body, &wave0, NULL)) == NIL ){
- sys = 10;
- exit(1);
- }
-
- hard_task_default_model(wave1);
- hard_task_def_wcet(wave1, WAVE_WCET);
- hard_task_def_mit(wave1, WAVE_PERIOD);
- hard_task_def_arg(wave1, (void *)1);
- hard_task_def_group(wave1, TASK_GROUP);
- if( (wave1_pid = task_create("Wave 1", wave_body, &wave1, NULL)) == NIL ){
- sys = 11;
- exit(1);
- }
-
- hard_task_default_model(video);
- hard_task_def_wcet(video, GRAPH_WCET);
- hard_task_def_mit(video, GRAPH_PERIOD);
- hard_task_def_group(video, TASK_GROUP);
- if( (video_pid = task_create("Video task", video_body, &video, NULL))
- == NIL ){
- sys = 12;
- exit(1);
- }
-
- if(!reMap()){
- sys = 21;
- exit(1);
- }
-
- createWaves();
- drawInterface();
- //Analog output section set up
- DAC_Init();
-
- /*
- *AI_TIMEBASE div by 2; OUT_TIMEBASE div by 2; single DAC mode
- *TMRDACWR = 3 OUT_TIMEBASE period; FIFO flags polarity active low
- *TMRDACWR disabled; DMA PIO control = FIFO DATA interface mode
- *UPDATE signal timebase = AO_UPDATE pulse width
- *UPDATE pulsewidth = 3-3.5 OUT_TIMEBASE period
- *UPDATE signal polarity = HIGH Z
- */
- DAC_boardInit(0x02, 0x4000);
-
- /*
- *LDAC0 source = UPDATE
- *DAC0 update immediately
- *LDAC1 source = UPDATE
- *DAC1 update immediately
- */
- DAC_LDACSourceUpdate(0x00);
- //End of Analog output section setup
-
-
- group_activate(TASK_GROUP);
-
- return 0;
-}
-
-void endfun(KEY_EVT *k)
-{
- close_event(NULL);
-
- exit(1);
-}
-
-void close_event(void *arg)
-{
- switch(sys){
- case 0: sys_shutdown_message("Regular End!\n"); break;
- case 10: sys_shutdown_message("Cannot create <wave 0> task!\n"); break;
- case 11: sys_shutdown_message("Cannot create <wave 1> task!\n"); break;
- case 12: sys_shutdown_message("Cannot create <video> task!\n"); break;
- case 20: sys_shutdown_message("No PCI bus found!\n"); break;
- case 21: sys_shutdown_message("No NATIONAL PCI E-Series board found on PCI bus!\n");
- break;
- case 30: sys_shutdown_message("Cannot start graphic envirorment!\n"); break;
- case 31: sys_shutdown_message("800x600x16 video mode not supported!\n");
- default: sys_shutdown_message("Unknown exit event!\n"); break;
- }
-}
-
-/*
-* Wave's samples generation
-*/
-void createWaves(void)
-{
- int i;
- int value0, value1;
- BYTE direction;
-
- /* Wave0
- * * * * * * * *
- ** ** ** ** ** ** ** **
- * ** * * ** ** ** ** ** *
- * * ** * * * * * *
- --------------------------...
-
- Wave 1
- * *
- * * * *
- * * * *
- * * * *
- -------*-------*-------*--...
- * * *
- * * *
- * *
- * */
-
- value0 = 0;
- value1 = 0;
- direction = 0;
- for(i=0; i<MAX_VAL; i++){
- wave0[i] = (value0 & 0x0FFF);
- wave1[i] = (value1 & 0x0FFF);
-
- value0 = (value0 + INC) % 2000;
- if(!direction) value1 += INC;
- else value1 -= INC;
-
- if(value1 >= 2000) direction = 1;
- if(value1 <= -2000) direction = 0;
- }
-}
-
-void drawInterface(void)
-{
- int i;
-
- grx_rect(1, 1, 799, 69, rgb16(105, 0, 105));
- grx_rect(2, 2, 798, 68, rgb16(155, 0, 155));
- grx_rect(3, 3, 797, 67, rgb16(205, 0, 205));
- grx_rect(4, 4, 796, 66, rgb16(255, 0, 255));
-
- grx_text("Test program for Analog output section of PCI6025E",
- 7, 10, rgb16(50, 255, 50), black);
- grx_text("DAC0 and DAC1 should generate saw-toothed wave and triangular wave",
- 7, 33, rgb16(0, 255, 255), black);
- grx_text("Use an oscilloscope to test this software",
- 7, 40, rgb16(0, 255, 255), black);
-
- grx_text("CTRL-C for Exit", 7, 55, rgb16(200, 200, 0), black);
-
- grx_text("DAC 0", 100, 92, rgb16(200, 200, 0), black);
- grx_rect(1, 100, 799, 325, rgb16(0, 105, 0));
- grx_rect(2, 101, 798, 324, rgb16(0, 155, 0));
- grx_rect(3, 102, 797, 323, rgb16(0, 205, 0));
- grx_rect(4, 103, 796, 322, rgb16(0, 255, 0));
- grx_line(19, 115, 19, 320, white);
- grx_line(14, 315, 530, 315, white);
-
- grx_text("DAC 1", 100, 362, rgb16(200, 200, 0), black);
- grx_rect(1, 370, 799, 595, rgb16(105, 0, 0));
- grx_rect(2, 371, 798, 594, rgb16(155, 0, 0));
- grx_rect(3, 372, 797, 593, rgb16(205, 0, 0));
- grx_rect(4, 373, 796, 592, rgb16(255, 0, 0));
- grx_line(19, 385, 19, 585, white);
- grx_line(14, 485, 530, 485, white);
-
- for(i=22; i<530; i+=2){
- //DAC0
- grx_plot(i, 115, white);
- grx_plot(i, 215, white);
- //DAC1
- grx_plot(i, 385, white);
- grx_plot(i, 435, white);
- grx_plot(i, 535, white);
- grx_plot(i, 585, white);
- }
-
- grx_text("5 V", 540, 211, rgb16(0, 255, 0), black);
- grx_text("10 V", 540, 111, rgb16(0, 255, 0), black);
- grx_text("+5 V", 540, 431, rgb16(0, 255, 0), black);
- grx_text("+10 V", 540, 381, rgb16(0, 255, 0), black);
- grx_text("-5 V", 540, 531, rgb16(255, 0, 0), black);
- grx_text("-10 V", 540, 581, rgb16(255, 0 , 0), black);
-}
-
-/*
-* Sends out waves' samples
-*/
-TASK wave_body(int wv)
-{
- int i = 0;
- while(1){
- if(wv)
- DAC_output(DAC1, wave1[i]);
- else
- DAC_output(DAC0, wave0[i]);
-
- i = (i + 1) % 500;
- task_endcycle();
- }
-}
-
-/*
-* Shows wave on screen
-*/
-TASK video_body(int dummy)
-{
- int i = 0;
- int n_tmp = 0, o_tmp;
- //char buf[10];
-
- while(1){
- o_tmp = n_tmp;
- if( (wave1[i] & 0x0800) != 0 ) n_tmp = wave1[i]-0x0FFF;
- else n_tmp = wave1[i];
-
- if(i>0){
- grx_line(19+i, 314-wave0[i-1]*DAC0_CONV,
- 20+i, 314-wave0[i]*DAC0_CONV, rgb16(255, 255, 0));
- grx_line(19+i, 485-o_tmp*DAC1_CONV,
- 20+i, 485-n_tmp*DAC1_CONV, rgb16(0, 255, 255));
- }
-
- i = (i + 1) % 500;
- task_endcycle();
- }
-}
Index: branches/xen/pci6025e/initfile.c
===================================================================
--- branches/xen/pci6025e/initfile.c (revision 1684)
+++ branches/xen/pci6025e/initfile.c (nonexistent)
@@ -1,198 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.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 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- FB26_use_grx(FRAME_BUFFER_DEVICE);
-
- FB26_setmode(FRAME_BUFFER_DEVICE,"800x600-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");
-
- return NULL;
-
-}
Index: branches/xen/pci6025e/test_mes.c
===================================================================
--- branches/xen/pci6025e/test_mes.c (revision 1684)
+++ branches/xen/pci6025e/test_mes.c (nonexistent)
@@ -1,278 +0,0 @@
-/*****************************************************************************
-* Filename: test_mes.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 25/06/2001 *
-* Description: Test file for single period and pulsewidth measurement feature*
-* of PCI6025E timers/counters *
-*----------------------------------------------------------------------------*
-* Notes: board is configured to provide a frequency of 1 MHZ through its FOUT*
-* pin (50). PFI3 (41) and PFI6 (45) are configured like source pins *
-* counter 0 and counter 1. PFI4 (42) and PFI 5(44) are the gates for *
-* the two counters. Please connect DIO7(32) to PFI4 and DIO6(30) to *
-* PFI 5. *
-* With 'g' key a task is started which generate a square wave on DIO7 *
-* with a period of 2 secs. With 'h' key the same square wave is *
-* generated on DIO6. *
-* When measurement is performed data are stored into Hardware Save *
-* Registers: use key 's' to show this values *
-*****************************************************************************/
-
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#include <drivers/pci6025e/timer.h>
-#include <drivers/pci6025e/dio_ppi.h>
-
-#define TASK_MET 20000
-#define TASK_WCET 50000
-#define TASK_PERIOD 100000
-
-#define PERIOD 1000000
-
-void endFun(KEY_EVT *);
-void gateEvent(KEY_EVT *);
-
-void drawInterface(void);
-void closeEvent(void *);
-
-TASK show_body(int);
-TASK gate_body(int);
-
-BYTE sys = 0;
-PID c0_gate_pid, c1_gate_pid, show_pid;
-int black = rgb16(0, 0, 0);
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- SOFT_TASK_MODEL show_model;
- HARD_TASK_MODEL gating;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endFun, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endFun, FALSE);
-
- k.flag = 0;
- k.scan = KEY_G;
- k.ascii = 'g';
- k.status = KEY_PRESSED;
- keyb_hook(k, gateEvent, FALSE);
-
- k.scan = KEY_H;
- k.ascii = 'h';
- k.status = KEY_PRESSED;
- keyb_hook(k, gateEvent, FALSE);
-
- k.scan = KEY_S;
- k.ascii = 's';
- k.status = KEY_PRESSED;
- keyb_hook(k, gateEvent, FALSE);
-
- if(!reMap()){
- sys = 11;
- exit(1);
- }
-
- soft_task_default_model(show_model);
- soft_task_def_level(show_model, 2);
- soft_task_def_met(show_model, TASK_MET);
- soft_task_def_wcet(show_model, TASK_WCET);
- soft_task_def_aperiodic(show_model);
- soft_task_def_period(show_model, TASK_PERIOD);
- if( (show_pid = task_create("Show task", show_body, &show_model, NULL))
- == NIL ){
- sys = 20;
- exit(1);
- }
-
- hard_task_default_model(gating);
- hard_task_def_mit(gating, PERIOD);
- hard_task_def_wcet(gating, 20000);
- hard_task_def_arg(gating, C0);
- if( (c0_gate_pid = task_create("C0 Gate task", gate_body, &gating, NULL)) == NIL ){
- sys = 21;
- exit(1);
- }
-
- hard_task_def_arg(gating, (void *)C1);
- if( (c1_gate_pid = task_create("C1 Gate task", gate_body, &gating, NULL)) == NIL ){
- sys = 22;
- exit(1);
- }
-
- drawInterface();
- //Enable DIO to manage gates
- DIO_init();
- DIO_setup(0xFF);
- DIO_write(0x00);
-
- //All PFI configured as input
- PFIprogramming(0x0000);
- //Fout provide 1MHz: timebase = 20MHz; divided by 2; on FOUT pin also divided by 10
- setIntClock(0, 1, 10);
-
- //Reset both counters
- TIM_reset(2);
-
- //Source PFI3(41); Gate PFI 4(42); Measure period
- TIM_timeMeasurement(C0, 0x04, 0x45, 0, 0x00, 0);
-
- //Source PFI6(45); Gate PFI 5(44); Measure pulsewidth
- TIM_timeMeasurement(C1, 0x87, 0x46, 1, 0x00, 0);
-
- //Arm both counter
- TIM_arm(2);
-
- return 0;
-}
-
-TASK show_body(int dummy)
-{
- DWORD val;
- char buf[20];
-
- while(1){
- val = TIM_readHWSaveReg(C0);
- sprintf(buf, "%ld", val);
- grx_text(buf, 600, 471, rgb16(0, 255, 0), black);
- val = TIM_readHWSaveReg(C1);
- sprintf(buf, "%ld", val);
- grx_text(buf, 200, 471, rgb16(255, 0, 0), black);
-
- task_endcycle();
- }
-}
-
-TASK gate_body(int counter)
-{
- BYTE out;
-
- if(counter == C0) out = 0x80;
- else out = 0x40;
-
- while(1){
- DIO_write(out);
- if(counter == C0){
- if(out) out = 0x00;
- else out = 0x80;
- } else {
- if(out) out = 0x40;
- else out = 0x00;
- }
-
- task_endcycle();
- }
-}
-
-void drawInterface(void)
-{
- grx_rect(1, 1, 799, 120, rgb16(105, 0, 0));
- grx_rect(2, 2, 798, 119, rgb16(155, 0, 0));
- grx_rect(3, 3, 797, 118, rgb16(205, 0, 0));
- grx_rect(4, 4, 796, 117, rgb16(255, 0, 0));
-
- grx_text("Test program for single period and pulsewidth measurement features",
- 7, 10, rgb16(200, 200, 0), black);
-
- grx_text("This program measures single period and pulsewidth of a square wave",
- 7, 20, rgb16(0, 255, 0), black);
- grx_text("with frequency of 0.5 Hz", 7, 28, rgb16(0, 255, 0), black);
- grx_text("Please connect PFI3 & PFI6 (41 & 45) to FOUT pin (50) or to 1Mhz frequency source",
- 7, 40, rgb16(255, 0, 0), black);
- grx_text("Connect also DIO7 (32) to PFI4 (42) and DIO6 to PFI5 (44)",
- 7, 48, rgb16(255, 0, 0), black);
- grx_text("Commands:", 7, 60, rgb16(0, 120, 0), black);
- grx_text("Use 'g' to start wave generation on DIO7",
- 7, 70, rgb16(0, 255, 255), black);
- grx_text("Use 'h' to start wave generation on DIO6",
- 7, 78, rgb16(0, 255, 255), black);
- grx_text("Use 's' to show Hardware Save Registers content",
- 7, 86, rgb16(0, 255, 255), black);
- grx_text("CTRL-C to exit", 7, 105, rgb16(255, 255, 0), black);
-
- grx_rect(197, 127, 603, 423, rgb16(0, 255, 0));
- grx_rect(198, 128, 602, 422, rgb16(0, 205, 0));
- grx_rect(199, 129, 601, 421, rgb16(0, 155, 0));
- grx_rect(200, 130, 600, 420, rgb16(0, 105, 0));
- grx_line(215, 405, 215, 150, rgb16(255, 255, 255));
- grx_line(210, 400, 580, 400, rgb16(255, 255, 255));
- grx_line(220, 395, 220, 170, rgb16(0, 0, 255));
- grx_line(220, 170, 390, 170, rgb16(0, 0, 255));
- grx_line(390, 170, 390, 395, rgb16(0, 0, 255));
- grx_line(390, 395, 560, 395, rgb16(0, 0, 255));
- grx_line(220, 150, 560, 150, rgb16(0, 255, 0));
- grx_line(220, 155, 390, 155, rgb16(255, 0, 0));
-
- grx_rect(1, 450, 390, 503, rgb16(105, 0, 0));
- grx_rect(2, 451, 389, 502, rgb16(155, 0, 0));
- grx_rect(3, 452, 388, 501, rgb16(205, 0, 0));
- grx_rect(4, 453, 387, 500, rgb16(255, 0, 0));
- grx_text("Pulsewidth: [us]", 7, 471, rgb16(255, 0, 0), black);
-
- grx_rect(410, 450, 799, 503, rgb16(105, 0, 0));
- grx_rect(411, 451, 798, 502, rgb16(155, 0, 0));
- grx_rect(412, 452, 797, 501, rgb16(205, 0, 0));
- grx_rect(413, 453, 796, 500, rgb16(255, 0, 0));
- grx_text("Period: [us]", 416, 471, rgb16(0, 255, 0), black);
-}
-
-void endFun(KEY_EVT *k)
-{
- closeEvent(NULL);
-
- exit(1);
-}
-
-void gateEvent(KEY_EVT *k)
-{
- if(k->scan == KEY_G) task_activate(c0_gate_pid);
- if(k->scan == KEY_H) task_activate(c1_gate_pid);
- if(k->scan == KEY_S) task_activate(show_pid);
-}
-
-void closeEvent(void *arg)
-{
- TIM_disarm(2);
-
- switch(sys){
- case 0: sys_shutdown_message("OK\n"); break;
- case 10: sys_shutdown_message("No PCI bus found\n"); break;
- case 11: sys_shutdown_message("No NATIONAL board found\n"); break;
- case 20: sys_shutdown_message("task <show value> down!!\n"); break;
- case 21: sys_shutdown_message("task <C0 gate manage> down!!!\n"); break;
- case 22: sys_shutdown_message("task <C1 gate manage> down!!!\n"); break;
- case 30: sys_shutdown_message("Cannot init graphic envirorment\n"); break;
- case 31: sys_shutdown_message("graphic mode 800x600x16 not supported\n"); break;
- default: sys_shutdown_message("???????????????\n"); break;
- }
-}
Index: branches/xen/pci6025e/test_ec.c
===================================================================
--- branches/xen/pci6025e/test_ec.c (revision 1684)
+++ branches/xen/pci6025e/test_ec.c (nonexistent)
@@ -1,392 +0,0 @@
-/*****************************************************************************
-* Filename: test_ec.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 20/06/2001 *
-* Description: Test program for gated event counting using PCI6025E board *
-*----------------------------------------------------------------------------*
-* Notes: FOUT are enabled to provide a frequency of 6250 Hz. You could *
-* connect PFI3 (pin 41) and PFI6 (pin 45) to this source for counting *
-* edges. Gated counting are enabled and PFI4 (pin 42) is gate pin for *
-* counter 0 and PFI5 (pin 44) is gate pin for counter 0. DIO 7 and 6 *
-* are als configured to switch between 0 and 5 V. Connect DIO 7 to *
-* gate 0 and DIO 6 to gate 1. Use 'g' (counter 0) and 'h' (counter 1) *
-* to change DIO lines value. On left area of the screen you should *
-* see counter while counting and on the right area you should lock *
-* counter values by pressing 's' key. *
-* Notice that line parameters are enabled and accept inital value *
-* for the two counters. If they aren't specified or they are wrong *
-* counters start from 0x00FFFFFF (counter 0 which counts down) and *
-* 0x00000000 (counter 1 which counts up). *
-* Last time addiction: TC Interrupts and Gate interrupts are enabled *
-* Bottom squares indicates when an interrupt is *
-* raised *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#include <drivers/pci6025e/timer.h>
-#include <drivers/pci6025e/dio_ppi.h>
-
-#ifndef INT_NO
- #define INT_NO NIDevice_info[0].InterruptLevel
-#endif
-
-BYTE sys = 0;
-
-PID show_aper_pid;
-BYTE out = 0x00;
-
-int black = rgb16(0, 0, 0),
- white = rgb16(255, 255, 255);
-
-void endfun(KEY_EVT *);
-void close_event(void *);
-void show_evt(KEY_EVT *k);
-void gate_change(KEY_EVT *k);
-
-void drawInterface(void);
-
-void int_evt(int intno);
-
-TASK show_per(int);
-TASK show_aper(int);
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- SOFT_TASK_MODEL show_per_mod, show_aper_mod;
- PID show_per_pid;
- int result;
- DWORD init_val_c0, init_val_c1;
-
- if(argc >= 3){
- if( (result = sscanf(argv[1], "%ld", &init_val_c0)) != 1)
- init_val_c0 = 0x00FFFFFF;
- if( (result = sscanf(argv[2], "%ld", &init_val_c1)) != 1)
- init_val_c1 = 0x00000000;
- }
- if(argc == 2){
- if( (result = sscanf(argv[1], "%ld", &init_val_c0)) != 1)
- init_val_c0 = 0x00FFFFFF;
- init_val_c1 = 0x00000000;
- }
- if(argc == 1){
- init_val_c0 = 0x00FFFFFF;
- init_val_c1 = 0x00000000;
- }
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- soft_task_default_model(show_aper_mod);
- soft_task_def_aperiodic(show_aper_mod);
- soft_task_def_level(show_aper_mod, 2);
- soft_task_def_period(show_aper_mod, 250000);
- soft_task_def_met(show_aper_mod, 30000);
- soft_task_def_wcet(show_aper_mod, 60000);
- if( (show_aper_pid = task_create("Show aperiodic task", show_aper, &show_aper_mod, NULL)) == NIL ){
- sys = 10;
- exit(1);
- }
-
- k.flag = 0;
- k.scan = KEY_S;
- k.ascii = 's';
- k.status = KEY_PRESSED;
- keyb_hook(k, show_evt, FALSE);
-
- k.flag = 0;
- k.scan = KEY_G;
- k.ascii = 'g';
- k.status = KEY_PRESSED;
- keyb_hook(k, gate_change, FALSE);
-
- k.scan = KEY_H;
- k.ascii = 'h';
- k.status = KEY_PRESSED;
- keyb_hook(k, gate_change, FALSE);
-
- soft_task_default_model(show_per_mod);
- soft_task_def_level(show_per_mod, 2);
- soft_task_def_met(show_per_mod, 1000);
- soft_task_def_period(show_per_mod, 10000);
- if( (show_per_pid = task_create("Show periodic task", show_per, &show_per_mod, NULL)) == NIL){
- sys = 11;
- exit(1);
- }
-
- if(!reMap()){
- sys = 21;
- exit(1);
- }
-
- drawInterface();
-
- //Init DIO lines used to manage counters gates
- DIO_init();
- DIO_setup(0xFF);
- DIO_write(out);
-
- //All PFI are configured as input
- PFIprogramming(0x0000);
- //FOUT enable; Slow TIMEBASE, divided by two; divided by 16 on FOUT pin
- setIntClock(1, 1, 0);
-
- TIM_reset(2); //Reset both two counters
-
- //Source PFI3(41); Gate PFI 4(42); Down counting; counts rising edge;
- TIM_eventCounting(C0, 0x04, 0x45, 0x03, init_val_c0);
-
- //Source PFI6(45); Gate PFI 5(44); Up counting; counts rising edge;
- TIM_eventCounting(C1, 0x87, 0x46, 0x03, init_val_c1);
-
- //Set up interrupt group A and B enabling and programming to assert a request
- //both on line 2 and 3 respectively
- INT_setup(0x0A, 0x0B);
- INT_personalize(0x03); //Interrupt request polarity low; IRQ driven on line 0 and 1
-
- handler_set(INT_NO, int_evt, FALSE, show_aper_pid, NULL);
-
- TIM_arm(2); //Arm both two counters
-
- task_activate(show_per_pid);
-
- return 0;
-}
-
-void drawInterface(void)
-{
- grx_rect(1, 1, 799, 99, rgb16(105, 0, 0));
- grx_rect(2, 2, 798, 98, rgb16(155, 0, 0));
- grx_rect(3, 3, 797, 97, rgb16(205, 0, 0));
- grx_rect(4, 4, 796, 96, rgb16(255, 0, 0));
-
- grx_text("Test program for Gated Event Counting capacity of PCI6025E timers",
- 7, 10, rgb16(50, 255, 50), black);
-
- grx_text("This program counting rise edges on counters source (PFI3 & PFI6) when releted gates",
- 7, 25, rgb16(0, 255, 255), black);
- grx_text("(PFI 42 & 44) are enabled. Frequency Out (FOUT) is enabled and provides a frequency of 6250 Hz",
- 7, 33, rgb16(0, 255, 255), black);
-
- grx_text("Instruction:",7, 43, rgb16(255, 0, 0), black);
- grx_text("Use 's' to lock counters value in right squares",
- 7, 51, rgb16(0, 255, 255), black);
- grx_text("Use 'g' to block or to release alternativly counter 0 (see top-left square)",
- 7, 58, rgb16(0, 255, 255), black);
-
- grx_text("Use 'h' to block or to release alternativly counter 1 (see bottom-left square)",
- 7, 65, rgb16(0, 255, 255), black);
-
- grx_text("Please connect DIO7 (pin 32) to PFI4 (pin 42) and DIO6 (pin 30) to PFI5 (pin 44)",
- 7, 78, rgb16(0, 255, 0), black);
- grx_text("CTRL-C for Exit", 7, 88, rgb16(200, 200, 0), black);
-
- grx_rect(1, 110, 355, 170, rgb16(0, 105, 0));
- grx_rect(2, 111, 354, 169, rgb16(0, 155, 0));
- grx_rect(3, 112, 353, 168, rgb16(0, 205, 0));
- grx_rect(4, 113, 352, 167, rgb16(0, 255, 0));
- grx_text("Counter 0 evolution", 7, 120, rgb16(255, 255, 0), black);
-
- grx_rect(455, 110, 799, 170, rgb16(0, 105, 0));
- grx_rect(456, 111, 798, 169, rgb16(0, 155, 0));
- grx_rect(457, 112, 797, 168, rgb16(0, 205, 0));
- grx_rect(458, 113, 796, 167, rgb16(0, 255, 0));
- grx_text("Counter 0 locked value", 461, 120, rgb16(255, 0, 255), black);
-
- grx_rect(360, 110, 450, 170, rgb16(0, 105, 0));
- grx_rect(361, 111, 449, 169, rgb16(0, 155, 0));
- grx_rect(362, 112, 448, 168, rgb16(0, 205, 0));
- grx_rect(363, 113, 447, 167, rgb16(0, 255, 0));
- grx_text("Gate0", 367, 120, rgb16(200, 255, 200), black);
- grx_text("0 V", 367, 145, rgb16(255, 0, 0), black);
-
- grx_rect(1, 190, 355, 260, rgb16(85, 85, 255));
- grx_rect(2, 191, 354, 259, rgb16(135, 135, 255));
- grx_rect(3, 192, 353, 258, rgb16(190, 190, 255));
- grx_rect(4, 193, 352, 257, rgb16(230, 239, 255));
- grx_text("Counter 1 evolution", 7, 200, white, black);
-
- grx_rect(455, 190, 799, 260, rgb16(85, 85, 255));
- grx_rect(456, 191, 798, 259, rgb16(135, 135, 255));
- grx_rect(457, 192, 797, 258, rgb16(190, 190, 255));
- grx_rect(458, 193, 796, 257, rgb16(230, 230, 255));
- grx_text("Counter 1 locked value", 461, 200, white, black);
-
- grx_rect(360, 190, 450, 260, rgb16(85, 85, 255));
- grx_rect(361, 191, 449, 259, rgb16(135, 135, 255));
- grx_rect(362, 192, 448, 258, rgb16(190, 190, 255));
- grx_rect(363, 193, 447, 257, rgb16(230, 230, 255));
- grx_text("Gate1", 367, 200, rgb16(255, 200, 255), black);
- grx_text("0 V", 367, 225, rgb16(255, 0, 0), black);
-
- grx_text("Counter 0 Interrupt events", 7, 340, rgb16(255, 200, 100), black);
- grx_text("Counter 1 Interrupt events", 461, 340, rgb16(255, 200, 100), black);
- grx_rect(1, 350, 355, 400, rgb16(105, 0, 0));
- grx_rect(2, 351, 354, 399, rgb16(155, 0, 0));
- grx_rect(3, 352, 353, 398, rgb16(205, 0, 0));
- grx_rect(4, 353, 352, 397, rgb16(255, 0, 0));
- grx_rect(455, 350, 799, 400, rgb16(105, 0, 0));
- grx_rect(456, 351, 798, 399, rgb16(155, 0, 0));
- grx_rect(457, 352, 797, 398, rgb16(205, 0, 0));
- grx_rect(458, 353, 796, 397, rgb16(255, 0, 0));
-}
-
-
-TASK show_per(int none)
-{
- DWORD val;
- char buf[30];
-
- while(1){
- val = TIM_readCounter(C0); //Read counter 0 value
- sprintf(buf, "HEX: %08lx DEC: %08ld", val ,val);
- grx_text(buf, 7, 145, rgb16(255, 0, 0), black);
-
- val = TIM_readCounter(C1); //Read counter 1 value
- sprintf(buf, "HEX: %08lx DEC: %08ld", val ,val);
- grx_text(buf, 7, 225, rgb16(255, 0, 0), black);
-
- task_endcycle();
- }
-}
-
-TASK show_aper(int dummy)
-{
- DWORD val;
- char buf[30];
-
- while(1){
- val = TIM_readCounter(C0);
- sprintf(buf, "HEX: %08lx DEC: %08ld", val, val);
- grx_text(buf, 461, 145, rgb16(80, 80, 255), black);
-
- val = TIM_readCounter(C1);
- sprintf(buf, "HEX: %08lx DEC: %08ld", val, val);
- grx_text(buf, 461, 225, rgb16(80, 80, 255), black);
-
- task_endcycle();
- }
-}
-
-void endfun(KEY_EVT *k)
-{
- close_event(NULL);
-
- exit(1);
-}
-
-void show_evt(KEY_EVT *k)
-{
- task_activate(show_aper_pid);
-}
-
-void gate_change(KEY_EVT *k)
-{
- if(k->ascii == 'g'){
- if( (out & 0x80) != 0){
- out &= 0x7F;
- grx_text("0 V", 367, 145, rgb16(255, 0, 0), black);
- } else {
- out |= 0x80;
- grx_text("5 V", 367, 145, rgb16(0, 255, 0), black);
- }
- } else {
- if( (out & 0x40) != 0){
- out &= 0xBF;
- grx_text("0 V", 367, 225, rgb16(255, 0, 0), black);
- } else {
- out |= 0x40;
- grx_text("5 V", 367, 225, rgb16(0, 255, 0), black);
- }
- }
-
- DIO_write(out);
-}
-
-void close_event(void *arg)
-{
- TIM_disarm(2); //Disable both two counters
- handler_remove(INT_NO);
-
- switch(sys){
- case 0: sys_shutdown_message("OK\n"); break;
- case 10: sys_shutdown_message("Task <show aperiodic> down\n"); break;
- case 11: sys_shutdown_message("Task <show periodic> down\n"); break;
- case 20: sys_shutdown_message("No PCI bus\n"); break;
- case 21: sys_shutdown_message("No National board on PCI bus\n"); break;
- case 30: sys_shutdown_message("No graphic can be initialized\n"); break;
- case 31: sys_shutdown_message("This graphic mode cannot be supported\n"); break;
- default: sys_shutdown_message("???????????\n"); break;
- }
-}
-
-void int_evt(int intno)
-{
- WORD status;
-
- status = DAQ_STC_Windowed_Mode_Read(AI_STATUS_1);
- if( (status & 0x8000) != 0){
- if( (status & 0x0008) != 0){
- grx_text("INT Group A raised! G0 Rolls over", 7, 360, rgb16(0, 255, 0), black);
- set(interrupt_a_ack, 14);
- DAQ_STC_Windowed_Mode_Write(INTERRUPT_A_ACK, interrupt_a_ack);
- clr(interrupt_a_ack, 14);
- }
- if( (status & 0x0004) != 0){
- grx_text("INT Group A raised! G0 gate pressed", 7, 380, rgb16(0, 255, 0), black);
- set(interrupt_a_ack, 15);
- DAQ_STC_Windowed_Mode_Write(INTERRUPT_A_ACK, interrupt_a_ack);
- clr(interrupt_a_ack, 15);
- }
- return;
- }
-
- status = DAQ_STC_Windowed_Mode_Read(AO_STATUS_1);
- if( (status & 0x8000) != 0){
- if( (status & 0x0008) != 0){
- grx_text("INT Group B raised! G1 Rolls over", 461, 360, rgb16(0, 255, 0), black);
- set(interrupt_b_ack, 14);
- DAQ_STC_Windowed_Mode_Write(INTERRUPT_B_ACK, interrupt_b_ack);
- clr(interrupt_b_ack, 14);
- }
- if( (status & 0x0004) != 0){
- grx_text("INT Group B raised! G1 gate pressed", 461, 380, rgb16(0, 255, 0), black);
- set(interrupt_b_ack, 15);
- DAQ_STC_Windowed_Mode_Write(INTERRUPT_B_ACK, interrupt_b_ack);
- clr(interrupt_b_ack, 15);
- }
- return;
- }
-}
-/* End of file: Test_ec.c */
Index: branches/xen/pci6025e/test_dac.c
===================================================================
--- branches/xen/pci6025e/test_dac.c (revision 1684)
+++ branches/xen/pci6025e/test_dac.c (nonexistent)
@@ -1,352 +0,0 @@
-/*****************************************************************************
-* Filename: test_dac.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 12/06/2001 *
-* Description: Little test program for Analog Output section of PCI6025E *
-*----------------------------------------------------------------------------*
-* Notes: Connect a multimeter to DAC1 output (pin 21) and watch *
-* tension value. Use '+' and '-' on numeric pad to increase *
-* and decrise voltage *
-* With this program it's possible to point out possible *
-* offset errors. To correct them no software are written but *
-* in National board package there's the program to calibrate *
-* the board. Otherwise you can see how much is the offset *
-* and you can compensate it through software value *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#include <drivers/pci6025e/dac.h>
-
-#define TASK_VOLT_PERIOD 150E3
-#define TASK_VOLT_WCET 080E3
-#define TASK_DAC_PERIOD 050E3
-#define TASK_DAC_WCET 020E3
-
-#define CONV 10/2048
-
-#define TASK_GROUP 1
-
-WORD dac0_value = 0,
- dac1_value = 0;
-
-BYTE sys = 0;
-BYTE dac = 0;
-
-//some colors
-int black = rgb16(0, 0, 0),
- white = rgb16(255, 255, 255);
-
-void drawInterface(void);
-void endfun(KEY_EVT *);
-void inc(KEY_EVT *);
-void dec(KEY_EVT *);
-void change_dac(KEY_EVT *);
-void close_event(void *);
-TASK Voltage_body(int);
-TASK DAC_Check_body(int);
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- HARD_TASK_MODEL m, d;
- PID pid_m, pid_d;
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- k.flag = CNTL_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- k.flag = 0;
- k.scan = 78;
- k.ascii = 43;
- k.status = KEY_PRESSED;
- keyb_hook(k, inc, FALSE);
-
- k.flag = 0;
- k.scan = 74;
- k.ascii = 45;
- k.status = KEY_PRESSED;
- keyb_hook(k, dec, FALSE);
-
- k.flag = 0;
- k.scan = KEY_V;
- k.ascii = 'v';
- k.status = KEY_PRESSED;
- keyb_hook(k, change_dac, FALSE);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m, TASK_VOLT_WCET);
- hard_task_def_mit(m, TASK_VOLT_PERIOD);
- hard_task_def_group(m, TASK_GROUP);
- pid_m = task_create("Voltage", Voltage_body, &m, NULL);
- if(pid_m == NIL){
- sys = 30;
- exit(1);
- }
-
- hard_task_default_model(d);
- hard_task_def_wcet(d, TASK_DAC_WCET);
- hard_task_def_mit(d, TASK_DAC_PERIOD);
- hard_task_def_group(d, TASK_GROUP);
- pid_d = task_create("DAC Check", DAC_Check_body, &d, NULL);
- if(pid_d == NIL){
- sys = 31;
- exit(1);
- }
-
- //Check if a NI board is on PCI bus
- if(!reMap()){
- sys = 11;
- exit(1);
- }
-
- drawInterface();
-
- //Analog output section set up
- DAC_Init();
-
- /*
- *AI_TIMEBASE div by 2; OUT_TIMEBASE div by 2; single DAC mode
- *TMRDACWR = 3 OUT_TIMEBASE period; FIFO flags polarity active low
- *TMRDACWR disabled; DMA PIO control = FIFO DATA interface mode
- *UPDATE signal timebase = AO_UPDATE pulse width
- *UPDATE pulsewidth = 3-3.5 OUT_TIMEBASE period
- *UPDATE signal polarity = HIGH Z
- */
- DAC_boardInit(0x02, 0x4000);
- /*
- *LDAC0 source = UPDATE
- *DAC0 update immediately
- *LDAC1 source = UPDATE
- *DAC1 update immediately
- */
- DAC_LDACSourceUpdate(0x00);
- //End of Analog output section setup
-
- group_activate(TASK_GROUP);
-
- return 0;
-}
-
-/*
-* Every time operator select a new value to send to a DAc this TASK makes
-* actions needed to perform the operation
-*/
-TASK Voltage_body(int dac_work)
-{
- WORD old0_value, old1_value;
- char buf[6];
- float volt;
-
- old0_value = dac0_value;
- old1_value = dac1_value;
- while(1){
- if(dac){
- if(dac1_value != old1_value){
- DAC_output(DAC1, dac1_value);
- old1_value = dac1_value;
- sprintf(buf, "%04d", dac1_value);
- grx_text(buf, 70, 120, rgb16(180, 0, 0), rgb16(255,255,140));
- sprintf(buf, "%04x", dac1_value);
- grx_text(buf, 300, 120, rgb16(180, 0, 0), rgb16(255,255,140));
- if( (dac1_value & 0x0800) == 0 )
- volt = (float)dac1_value * (float)CONV;
- else
- volt = (float)(dac1_value-0x0FFF) * (float)CONV;
- sprintf(buf, "%05.2f", volt);
- grx_text(buf, 70, 177, rgb16(180, 40, 180), black);
- }
- } else {
- if(dac0_value != old0_value){
- DAC_output(DAC0, dac0_value);
- old0_value = dac0_value;
- sprintf(buf, "%04d", dac0_value);
- grx_text(buf, 521, 120, rgb16(180, 0, 0), rgb16(255,255,140));
- sprintf(buf, "%04x", dac0_value);
- grx_text(buf, 754, 120, rgb16(180, 0, 0), rgb16(255,255,140));
- if( (dac0_value & 0x0800) == 0 )
- volt = (float)dac0_value * (float)CONV;
- else
- volt = (float)(dac0_value-0x0FFF) * (float)CONV;
- sprintf(buf, "%05.2f", volt);
- grx_text(buf, 521, 177, rgb16(180, 40, 180), black);
- }
- }
- task_endcycle();
- }
-}
-
-/*
-* This TASK show which is the DAC active
-*/
-TASK DAC_Check_body(int dummy)
-{
- BYTE old = dac;
- char buf[8];
-
- while(1){
- if(dac != old){
- old = dac;
- sprintf(buf, "DAC %d", dac);
- grx_text(buf, 385, 90, rgb16(255*dac, 255*(1-dac), 0), black);
- }
- task_endcycle();
- }
-}
-
-void drawInterface(void)
-{
- grx_rect(1, 1, 799, 69, rgb16(105, 0, 0));
- grx_rect(2, 2, 798, 68, rgb16(155, 0, 0));
- grx_rect(3, 3, 797, 67, rgb16(205, 0, 0));
- grx_rect(4, 4, 796, 66, rgb16(255, 0, 0));
-
- grx_text("Test program for Analog output section of PCI6025E",
- 7, 10, rgb16(50, 255, 50), black);
- grx_text("Use '+' and '-' on numeric pad to change tension",
- 7, 25, rgb16(0, 255, 255), black);
- grx_text("Connect a tester to DAC1 output (pin21) or to DAC0 output (pin20)",
- 7, 33, rgb16(0, 255, 255), black);
- grx_text("Use 'v' to alternate change active DAC",
- 7, 40, rgb16(0, 255, 255), black);
-
- grx_text("CTRL-C for Exit", 7, 55, rgb16(200, 200, 0), black);
-
- grx_rect(1, 80, 355, 150, rgb16(0, 105, 0));
- grx_rect(2, 81, 354, 149, rgb16(0, 155, 0));
- grx_rect(3, 82, 353, 148, rgb16(0, 205, 0));
- grx_rect(4, 83, 352, 147, rgb16(0, 255, 0));
-
- grx_rect(1, 160, 355, 199, rgb16(0, 105, 0));
- grx_rect(2, 161, 354, 198, rgb16(0, 155, 0));
- grx_rect(3, 162, 353, 197, rgb16(0, 205, 0));
- grx_rect(4, 163, 352, 196, rgb16(0, 255, 0));
-
- grx_rect(455, 80, 799, 150, rgb16(105, 105, 0));
- grx_rect(456, 81, 798, 149, rgb16(155, 155, 0));
- grx_rect(457, 82, 797, 148, rgb16(205, 205, 0));
- grx_rect(458, 83, 796, 147, rgb16(255, 255, 0));
-
- grx_rect(455, 160, 799, 199, rgb16(105, 105, 0));
- grx_rect(456, 161, 798, 198, rgb16(155, 155, 0));
- grx_rect(457, 162, 797, 197, rgb16(205, 205, 0));
- grx_rect(458, 163, 796, 196, rgb16(255, 255, 0));
-
- grx_rect(360, 80, 450, 105, rgb16(85, 85, 255));
- grx_rect(361, 81, 449, 104, rgb16(125, 125, 255));
- grx_rect(362, 82, 448, 103, rgb16(175, 175, 255));
- grx_rect(363, 83, 447, 102, rgb16(225, 225, 255));
-
- grx_rect(153, 93, 195, 103, rgb16(255, 0, 0));
- grx_text("DAC 1", 155, 95, rgb16(255, 170, 170), black);
-
- grx_rect(607, 93, 649, 103, rgb16(255, 0, 0));
- grx_text("DAC 0", 609, 95, rgb16(255, 255, 210), black);
-
- grx_text("Decimal", 7, 120, rgb16(120, 120, 255), black);
- grx_text("Hexadecimal", 200, 120, rgb16(120, 120, 255), black);
- grx_text("Tension", 7, 177, rgb16(120, 120, 255), black);
-
- grx_text("Decimal", 461, 120, rgb16(255, 120, 120), black);
- grx_text("Hexadecimal", 654, 120, rgb16(255, 120, 120), black);
- grx_text("Tension", 461, 177, rgb16(255, 120, 120), black);
-}
-
-void close_event(void *arg)
-{
- switch(sys){
- case 0 : sys_shutdown_message("Regular End\n"); break;
- case 1 : sys_shutdown_message("End fun invoked\n"); break;
- case 10: sys_shutdown_message("Pci bus not found\n"); break;
- case 11: sys_shutdown_message("No National board found\n"); break;
- case 20: sys_shutdown_message("Cannot initialize graphic envirorment\n"); break;
- case 21: sys_shutdown_message("Cannot start envirorment in 800x600x16\n"); break;
- case 30: sys_shutdown_message("Cannot create task <voltage>\n"); break;
- case 31: sys_shutdown_message("Canot create task <DAC Check>\n"); break;
- case 40: sys_shutdown_message("Break on clock end event\n"); break;
- default: sys_shutdown_message("Unkwon exit event\n"); break;
- }
-}
-
-void endfun(KEY_EVT *k)
-{
-
- close_event(NULL);
-
- exit(1);
-}
-
-/*
-* Capture correct key event and increase output tension of active DAC
-*/
-void inc(KEY_EVT *k)
-{
- if(dac){
- if( (dac1_value & 0x0800) == 0 && dac1_value > 0x07FF )
- dac1_value = 0;
- else
- dac1_value++;
- } else {
- if( (dac0_value & 0x0800) == 0 && dac0_value > 0x07FF )
- dac0_value = 0;
- else
- dac0_value++;
- }
-}
-
-/*
-* Same as above but decrease tension
-*/
-void dec(KEY_EVT *k)
-{
- if(dac){
- if(dac1_value < 1)
- dac1_value = 0x0FFF;
- else
- dac1_value -= 1;
- } else {
- if(dac0_value < 1)
- dac0_value = 0x0FFF;
- else
- dac0_value -= 1;
- }
-}
-
-/*
-* Capture correct key event and change active DAC
-*/
-void change_dac(KEY_EVT *k)
-{
- if(dac) dac = 0;
- else dac = 1;
-}
-
Index: branches/xen/pci6025e/test_ppi.c
===================================================================
--- branches/xen/pci6025e/test_ppi.c (revision 1684)
+++ branches/xen/pci6025e/test_ppi.c (nonexistent)
@@ -1,177 +0,0 @@
-/*****************************************************************************
-* Filename: Test_ppi.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 22/05/2001 *
-* Description: Test PPI82C55MSM on NI DAQ PCI6025E *
-*----------------------------------------------------------------------------*
-* Notes: Configures port A and port C in input and port B in output *
-* Test 1: *
-* Now connect port B to port A and watch on video value changes *
-* in counting order. After connect port B to port C and watch *
-* the same events on port C *
-* Test 2: *
-* Connect 8 LEDs on port B and port A and port C lines to Vcc or*
-* GND. Now run this test and watch 8 diode changing in counting *
-* mode and on screen port A and port C values displayed *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#include <drivers/pci6025e/dio_ppi.h>
-
-void exit_fun(KEY_EVT *);
-TASK test_ppi(int);
-void close_event(void *);
-void draw_screen(void);
-
-BYTE system = 0;
-
-int main(int argc, char **argv)
-{
- HARD_TASK_MODEL m;
- KEY_EVT k;
- PID pid_m;
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, exit_fun, FALSE);
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, exit_fun, FALSE);
-
- hard_task_default_model(m);
- hard_task_def_wcet(m, 90000);
- hard_task_def_mit(m, 250000);
- pid_m = task_create("TEST PPI", test_ppi, &m, NULL);
- if(pid_m == NIL){
- system = 10;
- exit(1);
- }
-
- //Look for a National board on PCI bus
- if(!reMap()){
- system = 21;
- exit(1);
- }
-
- //Start configuring DIO module
- PPI_init();
-
- draw_screen();
-
- task_activate(pid_m);
-
- return 0;
-}
-
-void draw_screen(void)
-{
- grx_rect(5, 5, 610, 130, rgb16(255, 0, 0));
- grx_rect(4, 4, 611, 131, rgb16(0,255,255));
- grx_rect(3, 3, 612, 132, rgb16(255, 0, 0));
- grx_rect(15, 45, 195, 100, rgb16(255, 0, 0));
- grx_rect(215, 45, 395, 100, rgb16(0, 255, 0));
- grx_rect(415, 45, 595, 100, rgb16(200, 200, 255));
- grx_text("Test of PPI82C55MSM function (Hosted on PCI6025E)",
- 9, 7, rgb16(0, 255, 0), rgb16(0, 0, 0));
- grx_text("PORT A and PORT C are configured in input mode",
- 9, 20, rgb16(255, 70, 70), rgb16(0, 0, 0));
- grx_text("PORT B is configured in output mode",
- 9, 28, rgb16(255, 70, 70), rgb16(0, 0, 0));
- grx_text("PORT B (Output)", 35, 50, rgb16(200, 0, 0), rgb16(0, 0, 0));
- grx_text("PORT A (Input)", 235, 50, rgb16(30,255,30), rgb16(0, 0, 0));
- grx_text("PORT C (Input)", 435, 50, rgb16(200,200,255), rgb16(0, 0, 0));
- grx_text("CTRL + C to exit", 9, 115, rgb16(255,255,0), rgb16(0,0,0));
-}
-
-/*
-* At each activation this task sends out value on port B and reads values from
-* port A and C
-*/
-TASK test_ppi(int dummy)
-{
- BYTE val, pA, pC;
- int i;
- char buf[10];
-
- PPI_config(0x99); //Mode 0 for all; Port A, Port C input; Port B output
- val = 0;
- while(1){
- PPI_write(PPI_PORT_B, val); //sends out value
- pA = PPI_read(PPI_PORT_A); //reads from port A
- pC = PPI_read(PPI_PORT_C); //reads from port C
-
- for(i=7; i>=0; i--){
- if( (val>>i)%2 )
- grx_text("1", 25+10*(7-i), 75, rgb16(255,0,0), rgb16(0,0,0));
- else
- grx_text("0", 25+10*(7-i), 75, rgb16(255,0,0), rgb16(0,0,0));
- if( (pA>>i)%2 )
- grx_text("1", 225+10*(7-i), 75, rgb16(0,255,0), rgb16(0,0,0));
- else
- grx_text("0", 225+10*(7-i), 75, rgb16(0,255,0), rgb16(0,0,0));
- if( (pC>>i)%2 )
- grx_text("1", 425+10*(7-i), 75, rgb16(200,200,255), rgb16(0,0,0));
- else
- grx_text("0", 425+10*(7-i), 75, rgb16(200,200,255), rgb16(0,0,0));
- }
- sprintf(buf, "%03d", val);
- grx_text(buf, 140, 75, rgb16(255,0,0), rgb16(0,0,0));
- sprintf(buf, "%03d", pA);
- grx_text(buf, 340, 75, rgb16(0,255,0), rgb16(0,0,0));
- sprintf(buf, "%03d", pC);
- grx_text(buf, 540, 75, rgb16(200,200,255), rgb16(0,0,0));
- val++;
- task_endcycle();
- }
-}
-
-void close_event(void *arg)
-{
- switch(system){
- case 0: sys_shutdown_message("Regular end\n"); break;
- case 10:sys_shutdown_message("Cannot create task 'TEST PPI'\n"); break;
- case 20:sys_shutdown_message("Pci bus don't find\n"); break;
- case 21:sys_shutdown_message("No National board on PC\n"); break;
- case 30:sys_shutdown_message("Cannot start graphic envirorment\n"); break;
- default: sys_shutdown_message("Unknown exit\n"); break;
- }
-}
-
-void exit_fun(KEY_EVT *k)
-{
- system = 0;
-
- close_event(NULL);
-
- exit(1);
-}
-
-/*end of file: test_ppi.c*/
Index: branches/xen/pci6025e/test_bec.c
===================================================================
--- branches/xen/pci6025e/test_bec.c (revision 1684)
+++ branches/xen/pci6025e/test_bec.c (nonexistent)
@@ -1,324 +0,0 @@
-/*****************************************************************************
-* Filename: test_bec.c *
-* Author: Marco Ziglioli (Doctor Stein) *
-* Date: 20/06/2001 *
-* Description: Test program for buffered gated event counting using PCI6025E *
-* board *
-*----------------------------------------------------------------------------*
-* Notes: FOUT are enabled to provide a frequency of 6250 Hz. You could *
-* connect PFI3 (pin 41) and PFI6 (pin 45) to this source for counting *
-* edges. Gated counting are enabled and PFI4 (pin 42) is gate pin for *
-* counter 0 and PFI5 (pin 44) is gate pin for counter 0. DIO 7 and 6 *
-* are als configured to switch between 0 and 5 V. Connect DIO 7 to *
-* gate 0 and DIO 6 to gate 1. Use 'g' (counter 0) and 'h' (counter 1) *
-* to change DIO lines value. On left area of the screen you should *
-* see counter while counting and on the right area you should lock *
-* counter values by pressing 's' key. *
-* Notice that line parameters are enabled and accept inital value *
-* for the two counters. If they aren't specified or they are wrong *
-* counters start from 0x00FFFFFF (counter 0 which counts down) and *
-* 0x00000000 (counter 1 which counts up). *
-*****************************************************************************/
-
-/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
- *
- * Copyright (C) 2001 Marco Ziglioli
- *
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_fb26.h>
-
-#include <drivers/pci6025e/timer.h>
-#include <drivers/pci6025e/dio_ppi.h>
-
-BYTE sys = 0;
-
-PID show_aper_pid;
-BYTE out = 0x00;
-
-int black = rgb16(0, 0, 0),
- white = rgb16(255, 255, 255);
-
-void endfun(KEY_EVT *);
-void close_event(void *);
-void show_evt(KEY_EVT *k);
-void gate_change(KEY_EVT *k);
-
-void drawInterface(void);
-
-TASK show_per(int);
-TASK show_aper(int);
-
-int main(int argc, char **argv)
-{
- KEY_EVT k;
- SOFT_TASK_MODEL show_per_mod, show_aper_mod;
- PID show_per_pid;
- int result;
- DWORD init_val_c0, init_val_c1;
-
- if(argc >= 3){
- if( (result = sscanf(argv[1], "%ld", &init_val_c0)) != 1)
- init_val_c0 = 0x00FFFFFF;
- if( (result = sscanf(argv[2], "%ld", &init_val_c1)) != 1)
- init_val_c1 = 0x00000000;
- }
- if(argc == 2){
- if( (result = sscanf(argv[1], "%ld", &init_val_c0)) != 1)
- init_val_c0 = 0x00FFFFFF;
- init_val_c1 = 0x00000000;
- }
- if(argc == 1){
- init_val_c0 = 0x00FFFFFF;
- init_val_c1 = 0x00000000;
- }
-
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, endfun, FALSE);
-
- soft_task_default_model(show_aper_mod);
- soft_task_def_aperiodic(show_aper_mod);
- soft_task_def_level(show_aper_mod, 2);
- soft_task_def_period(show_aper_mod, 250000);
- soft_task_def_met(show_aper_mod, 30000);
- soft_task_def_wcet(show_aper_mod, 60000);
- if( (show_aper_pid = task_create("Show aperiodic task", show_aper, &show_aper_mod, NULL)) == NIL ){
- sys = 10;
- exit(1);
- }
-
- k.flag = 0;
- k.scan = KEY_S;
- k.ascii = 's';
- k.status = KEY_PRESSED;
- keyb_hook(k, show_evt, FALSE);
-
- k.flag = 0;
- k.scan = KEY_G;
- k.ascii = 'g';
- k.status = KEY_PRESSED;
- keyb_hook(k, gate_change, FALSE);
-
- k.scan = KEY_H;
- k.ascii = 'h';
- k.status = KEY_PRESSED;
- keyb_hook(k, gate_change, FALSE);
-
- soft_task_default_model(show_per_mod);
- soft_task_def_level(show_per_mod, 2);
- soft_task_def_met(show_per_mod, 1000);
- soft_task_def_period(show_per_mod, 10000);
- if( (show_per_pid = task_create("Show periodic task", show_per, &show_per_mod, NULL)) == NIL){
- sys = 11;
- exit(1);
- }
-
- if(!reMap()){
- sys = 21;
- exit(1);
- }
-
- drawInterface();
-
- DIO_init();
- DIO_setup(0xFF);
- DIO_write(out);
-
- PFIprogramming(0x0000);
- setIntClock(1, 1, 0);
- TIM_reset(2); //Reset both two counters
-
-
- //Source PFI3(41); Gate PFI 4(42); Down counting; counts rising edge;
- TIM_bufferedEventCounting(C0, 0x04, 0x45, 0x01, init_val_c0);
-
- //Source PFI6(45); Gate PFI 5(44); Up counting; counts rising edge;
- TIM_bufferedEventCounting(C1, 0x87, 0x46, 0x00, init_val_c1);
-
- TIM_arm(2); //Arm both two counters
-
- task_activate(show_per_pid);
-
- return 0;
-}
-
-void drawInterface(void)
-{
- grx_rect(1, 1, 799, 99, rgb16(105, 0, 0));
- grx_rect(2, 2, 798, 98, rgb16(155, 0, 0));
- grx_rect(3, 3, 797, 97, rgb16(205, 0, 0));
- grx_rect(4, 4, 796, 96, rgb16(255, 0, 0));
-
- grx_text("Test program for Buffered Event Counting capacity of PCI6025E timers",
- 7, 10, rgb16(50, 255, 50), black);
-
- grx_text("This program counting rise edges on counters source (PFI3 & PFI6)",
- 7, 18, rgb16(0, 255, 255), black);
- grx_text("Counter 1 will be resetted every gate falling edge",
- 7, 26, rgb16(0, 255, 255), black);
- grx_text("(PFI 42 & 44) are enabled. Frequency Out (FOUT) is enabled and provides a frequency of 6250 Hz",
- 7, 34, rgb16(0, 255, 255), black);
-
- grx_text("Instruction:",7, 43, rgb16(255, 0, 0), black);
- grx_text("Use 's' to watch contents of Hardware save registers updated every time gate goes down",
- 7, 51, rgb16(0, 255, 255), black);
- grx_text("Use 'g' to generate an event on counter 0 gate (see top-left square)",
- 7, 58, rgb16(0, 255, 255), black);
-
- grx_text("Use 'h' to generate an event on counter 1 gate (see bottom-left square)",
- 7, 65, rgb16(0, 255, 255), black);
-
- grx_text("Please connect DIO7 (pin 32) to PFI4 (pin 42) and DIO6 (pin 30) to PFI5 (pin 44)",
- 7, 78, rgb16(0, 255, 0), black);
- grx_text("CTRL-C for Exit", 7, 88, rgb16(200, 200, 0), black);
-
- grx_rect(1, 110, 355, 170, rgb16(0, 105, 0));
- grx_rect(2, 111, 354, 169, rgb16(0, 155, 0));
- grx_rect(3, 112, 353, 168, rgb16(0, 205, 0));
- grx_rect(4, 113, 352, 167, rgb16(0, 255, 0));
- grx_text("Counter 0 evolution", 7, 120, rgb16(255, 255, 0), black);
-
- grx_rect(455, 110, 799, 170, rgb16(0, 105, 0));
- grx_rect(456, 111, 798, 169, rgb16(0, 155, 0));
- grx_rect(457, 112, 797, 168, rgb16(0, 205, 0));
- grx_rect(458, 113, 796, 167, rgb16(0, 255, 0));
- grx_text("Counter 0 locked value", 461, 120, rgb16(255, 0, 255), black);
-
- grx_rect(360, 110, 450, 170, rgb16(0, 105, 0));
- grx_rect(361, 111, 449, 169, rgb16(0, 155, 0));
- grx_rect(362, 112, 448, 168, rgb16(0, 205, 0));
- grx_rect(363, 113, 447, 167, rgb16(0, 255, 0));
- grx_text("Gate0", 367, 120, rgb16(200, 255, 200), black);
- grx_text("0 V", 367, 145, rgb16(255, 0, 0), black);
-
- grx_rect(1, 190, 355, 260, rgb16(85, 85, 255));
- grx_rect(2, 191, 354, 259, rgb16(135, 135, 255));
- grx_rect(3, 192, 353, 258, rgb16(190, 190, 255));
- grx_rect(4, 193, 352, 257, rgb16(230, 239, 255));
- grx_text("Counter 1 evolution", 7, 200, white, black);
-
- grx_rect(455, 190, 799, 260, rgb16(85, 85, 255));
- grx_rect(456, 191, 798, 259, rgb16(135, 135, 255));
- grx_rect(457, 192, 797, 258, rgb16(190, 190, 255));
- grx_rect(458, 193, 796, 257, rgb16(230, 230, 255));
- grx_text("Counter 1 locked value", 461, 200, white, black);
-
- grx_rect(360, 190, 450, 260, rgb16(85, 85, 255));
- grx_rect(361, 191, 449, 259, rgb16(135, 135, 255));
- grx_rect(362, 192, 448, 258, rgb16(190, 190, 255));
- grx_rect(363, 193, 447, 257, rgb16(230, 230, 255));
- grx_text("Gate1", 367, 200, rgb16(255, 200, 255), black);
- grx_text("0 V", 367, 225, rgb16(255, 0, 0), black);
-}
-
-TASK show_per(int none)
-{
- DWORD val;
- char buf[30];
-
- while(1){
- val = TIM_readCounter(C0); //Read from Hardware Save Register
- sprintf(buf, "HEX: %08lx DEC: %08ld", val ,val);
- grx_text(buf, 7, 145, rgb16(255, 0, 0), black);
-
- val = TIM_readCounter(C1); //Read from Hardware Save Register
- sprintf(buf, "HEX: %08lx DEC: %08ld", val ,val);
- grx_text(buf, 7, 225, rgb16(255, 0, 0), black);
-
- task_endcycle();
- }
-}
-
-TASK show_aper(int dummy)
-{
- DWORD val;
- char buf[30];
-
- while(1){
- val = TIM_readHWSaveReg(C0); //Read from Hardware Save Register
- sprintf(buf, "HEX: %08lx DEC: %08ld", val, val);
- grx_text(buf, 461, 145, rgb16(80, 80, 255), black);
-
- val = TIM_readHWSaveReg(C1); //Read from Hardware Save Register
- sprintf(buf, "HEX: %08lx DEC: %08ld", val, val);
- grx_text(buf, 461, 225, rgb16(80, 80, 255), black);
-
- task_endcycle();
- }
-}
-
-void endfun(KEY_EVT *k)
-{
- close_event(NULL);
-
- exit(1);
-}
-
-void show_evt(KEY_EVT *k)
-{
- task_activate(show_aper_pid);
-}
-
-void gate_change(KEY_EVT *k)
-{
- if(k->ascii == 'g'){
- if( (out & 0x80) != 0){
- out &= 0x7F;
- grx_text("0 V", 367, 145, rgb16(255, 0, 0), black);
- } else {
- out |= 0x80;
- grx_text("5 V", 367, 145, rgb16(0, 255, 0), black);
- }
- } else {
- if( (out & 0x40) != 0){
- out &= 0xBF;
- grx_text("0 V", 367, 225, rgb16(255, 0, 0), black);
- } else {
- out |= 0x40;
- grx_text("5 V", 367, 225, rgb16(0, 255, 0), black);
- }
- }
-
- DIO_write(out);
-}
-
-void close_event(void *arg)
-{
- TIM_disarm(2); //Disable both two counters
-
- switch(sys){
- case 0: sys_shutdown_message("OK\n"); break;
- case 10: sys_shutdown_message("Task <show aperiodic> down\n"); break;
- case 11: sys_shutdown_message("Task <show periodic> down\n"); break;
- case 20: sys_shutdown_message("No PCI bus\n"); break;
- case 21: sys_shutdown_message("No National board on PCI bus\n"); break;
- case 30: sys_shutdown_message("No graphic can be initialized\n"); break;
- case 31: sys_shutdown_message("This graphic mode cannot be supported\n"); break;
- default: sys_shutdown_message("???????????\n"); break;
- }
-}
-/* End of file: Test_bec.c */
Index: branches/xen/mix/readme
===================================================================
--- branches/xen/mix/readme (revision 1684)
+++ branches/xen/mix/readme (nonexistent)
@@ -1,7 +0,0 @@
-MIX
----
-
-This simple applications is a pout-pourri of simple graphic tasks
-that does different things with different timing constraints...
-
-Paolo
\ No newline at end of file
Index: branches/xen/mix/makefile
===================================================================
--- branches/xen/mix/makefile (revision 1684)
+++ branches/xen/mix/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= mix
-
-include $(BASE)/config/example.mk
-
-mix:
- make -f $(SUBMAKE) APP=mix INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
Index: branches/xen/mix/mix.c
===================================================================
--- branches/xen/mix/mix.c (revision 1684)
+++ branches/xen/mix/mix.c (nonexistent)
@@ -1,766 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/*
- ------------
- CVS : $Id: mix.c,v 1.7 2005-01-08 14:33:10 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.7 $
- Last update: $Date: 2005-01-08 14:33:10 $
- ------------
-*/
-
-/*
- * Copyright (C) 2000 Giorgio Buttazzo and 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
- *
- */
-
-/*--------------------------------------------------------------*/
-/* DEMO with 9 INDEPENDENT TASKS */
-/*--------------------------------------------------------------*/
-
-#include <kernel/kern.h>
-
-#include <drivers/shark_fb26.h>
-#include <drivers/shark_keyb26.h>
-
-#include <semaphore.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#define PIG 3.1415
-#define DURATA 10000 /* counter duration in tick */
-
-#define LW 200 /* window length */
-#define HW 150 /* window height */
-#define HLOAD 30 /* Y level for the max load */
-#define LLOAD (HW-HLOAD-5) /* length for the max load */
-
-#define XWL 10 /* left X of LEFT window */
-#define XWM 220 /* left X of MIDDLE window */
-#define XWR 430 /* left X RIGHT window */
-
-#define YWH 5 /* top Y of HIGH window */
-#define YWM 165 /* top Y of MIDDLE window */
-#define YWL 325 /* top Y of LOW window */
-
-int flen = 0; /* file length */
-int fine = 0; /* ending flag */
-
-sem_t mx_mat, mx_grf; /* mutex semaphores */
-
-int wcet[10]; /* array of task wcets */
-int period[10]; /* array of task periods */
-double load(long); /* load evaluation function */
-
-PID ptas;
-char talk[5][25] = {" SHARK Demonstration ",
- " RETIS Lab -- Scuola ",
- " Superiore S. Anna ",
- " HARD REAL-TIME DEMO ",
- " June 5, 2001 "};
-
-char fbuf[1000] = "\
-TASK NAME PERIOD WCET\n\
-------------------------------------------\n\
-task1 watch: 1000000 200\n\
-task2 tasto: 2000 200\n\
-task3 palla: 2000 200\n\
-task4 mosca: 20000 200\n\
-task5 infor: 20000 300\n\
-task6 ruota: 5000 400\n\
-task7 color: 2000 200\n\
-task8 pendo: 5000 400\n\
-------------------------------------------\n";
-
-extern int vga16color[16];
-
-/*------------------------------------------------------*/
-/* file reading */
-/*------------------------------------------------------*/
-
-void read_file(void)
-{
- int err;
- DOS_FILE *fp;
-
- fp = DOS_fopen("mix.dat","r");
-
- if (!fp) {
- err = DOS_error();
- cprintf("Error %d opening myfile.txt...\n", err);
- flen = 0;
- return;
- }
-
- flen = DOS_fread(&fbuf, 1, 1000, fp);
- cprintf("Read %d bytes from file\n", flen);
- DOS_fclose(fp);
-}
-
-/*------------------------------------------------------*/
-/* get data from buffer */
-/*------------------------------------------------------*/
-
-void get_par(void)
-{
- int x = 0;
- int i;
-
- flen = strlen(fbuf);
-
- for (i=1; i<=8; i++) {
- while ((fbuf[x] != ':') && (x < flen)) x++;
- x++;
- sscanf(&fbuf[x], "%d %d", &period[i], &wcet[i]);
- }
-}
-
-/*--------------------------------------------------------------*/
-
-void finish1()
-{
- exit(1);
-}
-
-/*--------------------------------------------------------------*/
-
-void finish2()
-{
- fine = 1;
-}
-
-/****************************************************************/
-/* PROCESSO OROLOGIO */
-/****************************************************************/
-
-#define LLAN 40 /* length of watch stick */
-
-TASK watch()
-{
- int x0 = XWL + LW/2;
- int y0 = YWH + HW/2;
- int grad;
- int xg, yg;
- int xt, yt, d;
- int sec, min;
- char s[5];
- double rad, x, y;
-
- xg = x0;
- yg = y0 - LLAN;
- xt = XWL + 78;
- yt = YWH + 12;
- sec = min = 0;
-
- while (1) {
- sec = (sec + 1) % 60;
- if (sec == 0) min++;
- grad = 90 - sec * 6;
- rad = (double)grad * PIG / 180.;
-
- sem_wait(&mx_mat);
- x = (double)x0 + (double)LLAN * cos(rad);
- y = (double)y0 - (double)LLAN * sin(rad);
- sem_post(&mx_mat);
-
- sem_wait(&mx_grf);
- grx_line(x0, y0, xg, yg, vga16color[0]);
- sem_post(&mx_grf);
-
- xg = x;
- yg = y;
-
- sem_wait(&mx_grf);
- grx_line(x0, y0, xg, yg, vga16color[14]);
- sem_post(&mx_grf);
-
- sem_wait(&mx_grf);
- grx_text("0 :0 ", xt, yt, vga16color[14], vga16color[0]);
- sprintf(s, "%d", min);
- grx_text(s, xt+8, yt, vga16color[14], vga16color[0]);
- sprintf(s, "%d", sec);
- if (sec > 9) d = 24; else d = 32;
- grx_text(s, xt+d, yt, vga16color[14], vga16color[0]);
- sem_post(&mx_grf);
-
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO DI RIEMPIMENTO */
-/****************************************************************/
-
-#define CIMA (YWH+5) /* fondo del recipiente */
-#define FONDO (YWH+HW-5) /* cima del recipiente */
-#define LREC (XWM+75) /* lato sinistro recipiente */
-#define DREC 50 /* diametro del recipiente */
-
-TASK tasto()
-{
- int x, y;
- int x0; /* coord. sinistra recipiente */
- int col, cliq, bkg;
- int i;
- int liv; /* livello del liquido */
-
- cliq = 9;
- bkg = 14;
- x0 = LREC;
- x = x0 + DREC/2;
- y = CIMA;
- liv = FONDO;
-
- while (1) {
-
- col = cliq;
- for (i=0; i<2; i++) { /* disegna goccia */
- while (y < liv) {
- sem_wait(&mx_grf);
- grx_plot(x,y,vga16color[col]);
- sem_post(&mx_grf);
- y++;
- }
- y = CIMA;
- col = bkg;
- }
-
- liv--;
- sem_wait(&mx_grf);
- grx_line(x0+1, liv, x0+DREC-1, liv, vga16color[cliq]);
- sem_post(&mx_grf);
-
- if (liv <= CIMA+1) { /* swap colors */
- i = bkg; bkg = cliq; cliq = i;
- liv = FONDO;
- }
-
- task_endcycle();
- }
-}
-
-/****************************************************************/
-
-void kboar()
-{
- task_activate(ptas);
-}
-
-/****************************************************************/
-/* PROCESSO PALLA */
-/****************************************************************/
-
-#define VMIN 11. /* velocitÂ… minima per suono */
-#define LP 3 /* lato della pallina */
-
-TASK palla()
-{
- int ox, oy; /* vecchia posizione pallina */
- int x0; /* posizione iniziale pallina */
- int xmin, xmax;
- int base, top;
- int xg, yg; /* coordinate grafiche pallina */
- double x, y; /* coordinate pallina */
- double G = 9.8;
- double vx, vy, v0; /* velocitÂ… della pallina */
- double t, tx; /* variabile temporale */
- double dt; /* incremento temporale */
- double arg; /* variabile di appoggio */
-
- xmin = XWR+LP+1;
- xmax = XWR+LW-LP-1;
- base = YWH+HW-LP-1;
- top = HW-10-LP;
- x = ox = x0 = xmin;
- y = oy = top;
- arg = 2.*G*(double)top;
- vy = v0 = sqrt(arg);
- vx = 15.;
- tx = 0.0;
- t = vy / G;
- dt = .02;
-
- while (1) {
- x = x0 + vx*tx;
- y = base - vy*t + .5*G*t*t;
- if (y >= base) {
- t = 0.0;
- vy = v0;
- y = base - vy*t + .5*G*t*t;
- }
- if (x >= xmax) {
- tx = 0.0;
- x0 = xmax;
- vx = -vx;
- x = x0 + vx*tx;
- }
- if (x <= xmin) {
- tx = 0.0;
- x0 = xmin;
- vx = -vx;
- x = x0 + vx*tx;
- }
- xg = x; yg = y;
- sem_wait(&mx_grf);
- grx_disc(ox,oy,LP,vga16color[0]);
- grx_disc(xg,yg,LP,vga16color[10]);
- sem_post(&mx_grf);
- oy = yg; ox = xg;
- t += dt;
- tx += dt;
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO MOSCA */
-/****************************************************************/
-
-TASK mosca()
-{
- int x, y, Ax, Ay, h;
- int x0, y0, tet;
- int xmax,ymax;
- double A, B;
- double r;
- double rnd;
-
- xmax = LW/2-1; ymax = HW/2-1;
- x = 0; y = 0; tet = 0;
- x0 = XWL+LW/2; y0 = YWM+HW/2;
- A = 5.; B = 30.;
-
- while (1) {
-
- rnd = (rand()%100)/100.; /* rnd = [0,1] */
- h = (2. * B * rnd) - B; /* h = [-B,B] */
- tet = tet + h;
-
- if (tet > 360) tet = tet - 360;
- if (tet < 0) tet = tet + 360;
- r = tet * PIG / 180.;
-
- sem_wait(&mx_mat);
- Ax = (double)(A * cos(r));
- Ay = (double)(A * sin(r));
- sem_post(&mx_mat);
- x = x + Ax;
- y = y + Ay;
-
- if ((x >= xmax) || (x <= -xmax) ||
- (y >= ymax) || (y <= -ymax)) {
- x = x - Ax;
- y = y - Ay;
- tet = tet - 180;
- if (tet > 360) tet = tet - 360;
- if (tet < 0) tet = tet + 360;
- r = tet * PIG / 180.;
- sem_wait(&mx_mat);
- Ax = (double)(A * cos(r));
- Ay = (double)(A * sin(r));
- sem_post(&mx_mat);
- x = x + Ax;
- y = y + Ay;
- }
- sem_wait(&mx_grf);
- grx_plot(x+x0, y+y0, vga16color[10]);
- sem_post(&mx_grf);
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO INFORMAZIONI */
-/****************************************************************/
-
-TASK infor()
-{
- char s[2];
- int x, y;
- int r;
- int i = 0;
- int leng;
- int col = 0;
-
- r = 0;
- x = XWM + 16;
- y = YWM + 40;
- s[1] = 0;
-
- leng = 0;
- while (talk[0][leng] != 0) leng++;
-
- while (1) {
- s[0] = talk[r][i];
- sem_wait(&mx_grf);
- grx_text(s,x+i*8,y+r*8,vga16color[col+10],vga16color[1]);
- sem_post(&mx_grf);
- i++;
- if (i == leng) {
- i = 0;
- r = (r + 1) % 5;
- if (r == 0) col = (col + 1) % 6;
- }
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO RUOTA */
-/****************************************************************/
-
-TASK ruota()
-{
- int x0 = XWR + LW/2;
- int y0 = YWM + HW/2;
- int grad = 90;
- int xg, yg;
- double rad, x, y;
-
- xg = x0;
- yg = y0 + LLAN;
-
- while (1) {
-
- rad = (double)grad * PIG / 180.;
-
- sem_wait(&mx_mat);
- x = (double)x0 + (double)LLAN * cos(rad);
- y = (double)y0 + (double)LLAN * sin(rad);
- sem_post(&mx_mat);
-
- sem_wait(&mx_grf);
- grx_disc(xg, yg, 4, vga16color[0]);
- sem_post(&mx_grf);
-
- xg = x; yg = y;
-
- sem_wait(&mx_grf);
- grx_disc(xg, yg, 4, vga16color[13]);
- sem_post(&mx_grf);
-
- grad = (grad + 1) % 360;
-
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO COLORI */
-/****************************************************************/
-
-TASK color()
-{
- int xx0 = XWL+5;
- int yy0 = YWL+5;
- int n, col;
- int x, y;
-
- x = 0; y = 0;
-
- while (1) {
- n = 19. * ((rand()%100)/100.);
- x = xx0 + n * 10;
- n = 14. * ((rand()%100)/100.);
- y = yy0 + n * 10;
- col = 16. * ((rand()%100)/100.);
-
- /* xg = xx0 + x;
- yg = yy0 + y;
- x = (x + 10)%(LW-10);
- y = (y + 10)%(HW-10);
- */
- sem_wait(&mx_grf);
- grx_box(x, y, x+9, y+9, vga16color[col]);
- sem_post(&mx_grf);
-
- task_endcycle();
- }
-}
-
-/****************************************************************/
-/* PROCESSO PENDOLO */
-/****************************************************************/
-
-TASK pendo()
-{
- int x0 = XWM+LW/2;
- int y0 = YWL+10;
- int xg, yg;
- int col = 11;
- double x, y, teta;
- double v, a, dt;
- double g, l;
-
- g = 9.8;
- l = 80.;
- dt = 0.1;
- teta = 40. * PIG / 180.;
- v = 0.;
- sem_wait(&mx_mat);
- x = l * sin((double)teta);
- y = l * cos((double)teta);
- a = -(g/l) * sin((double)teta);
- sem_post(&mx_mat);
- xg = x0 + x;
- yg = y0 + y;
-
- while (1) {
-
- v += a * dt;
- teta += v * dt;
- sem_wait(&mx_mat);
- x = l * sin((double)teta);
- y = l * cos((double)teta);
- a = -(g/l) * sin((double)teta);
- sem_post(&mx_mat);
-
- sem_wait(&mx_grf);
- grx_line(x0, y0, xg, yg, vga16color[0]);
- grx_circle(xg, yg, 5, vga16color[0]);
- grx_disc(xg, yg, 4, vga16color[0]);
- sem_post(&mx_grf);
-
- xg = x0+x; yg = y0+y;
-
- sem_wait(&mx_grf);
- grx_line(x0, y0, xg, yg, vga16color[col]);
- grx_circle(xg, yg, 5, vga16color[col+2]);
- grx_disc(xg, yg, 4, vga16color[col+1]);
- sem_post(&mx_grf);
-
- task_endcycle();
- }
-}
-
-/****************************** gener ******************************/
-
-TASK gener()
-{
- HARD_TASK_MODEL m;
- SOFT_TASK_MODEL am;
- PID pid;
-
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[1]);
- hard_task_def_mit (m, period[1]);
- hard_task_def_usemath (m);
- pid = task_create("watch", watch, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- soft_task_default_model(am);
- soft_task_def_met (am, wcet[2]);
- soft_task_def_period (am, period[2]);
- soft_task_def_aperiodic(am);
- soft_task_def_usemath (am);
- ptas = task_create("tasto", tasto, &am, NULL);
- task_activate(ptas);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[3]);
- hard_task_def_mit (m, period[3]);
- hard_task_def_usemath (m);
- pid = task_create("palla", palla, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[4]);
- hard_task_def_mit (m, period[4]);
- hard_task_def_usemath (m);
- pid = task_create("mosca", mosca, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[5]);
- hard_task_def_mit (m, period[5]);
- hard_task_def_usemath (m);
- pid = task_create("infor", infor, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[6]);
- hard_task_def_mit (m, period[6]);
- hard_task_def_usemath (m);
- pid = task_create("ruota", ruota, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[7]);
- hard_task_def_mit (m, period[7]);
- hard_task_def_usemath (m);
- pid = task_create("color", color, &m, NULL);
- task_activate(pid);
- keyb_getch(BLOCK);
- //---------------------------------------------
- hard_task_default_model(m);
- hard_task_def_wcet (m, wcet[8]);
- hard_task_def_mit (m, period[8]);
- hard_task_def_usemath (m);
- pid = task_create("pendo", pendo, &m, NULL);
- task_activate(pid);
- //---------------------------------------------
-
- return NULL;
-}
-
-/****************************** MAIN ******************************/
-
-int main()
-{
- char s[20]; /* carattere letto da tastiera */
- int x0, y0;
- int x, y;
- TIME t1, count; /* contatori valutazione carico */
- double car; /* valore del carico corrente */
- TIME seme;
- PID pid;
- NRT_TASK_MODEL m2;
- KEY_EVT eva, evx, evs;
-
- /* set the keyboard handler */
- eva.ascii = 'a';
- eva.scan = KEY_A;
- eva.flag = 0;
- eva.status = KEY_PRESSED;
- keyb_hook(eva,kboar,FALSE);
-
- evx.ascii = 'x';
- evx.scan = KEY_X;
- evx.flag = ALTL_BIT;
- evx.status = KEY_PRESSED;
- keyb_hook(evx,finish1,FALSE);
-
- evs.ascii = ESC;
- evs.scan = KEY_ESC;
- evs.flag = 0;
- evs.status = KEY_PRESSED;
- keyb_hook(evs,finish2,FALSE);
-
- sem_init(&mx_mat,0,1);
- sem_init(&mx_grf,0,1);
-
- seme = sys_gettime(NULL);
- srand(seme);
-
- get_par();
-
- grx_rect(XWL,YWH,XWL+LW,YWH+HW,vga16color[14]);
- grx_rect(XWM,YWH,XWM+LW,YWH+HW,vga16color[14]);
- grx_rect(XWR,YWH,XWR+LW,YWH+HW,vga16color[14]);
-
- grx_rect(XWL,YWM,XWL+LW,YWM+HW,vga16color[14]);
- grx_rect(XWM,YWM,XWM+LW,YWM+HW,vga16color[14]);
- grx_rect(XWR,YWM,XWR+LW,YWM+HW,vga16color[14]);
-
- grx_rect(XWL,YWL,XWL+LW,YWL+HW,vga16color[14]);
- grx_rect(XWM,YWL,XWM+LW,YWL+HW,vga16color[14]);
- grx_rect(XWR,YWL,XWR+LW,YWL+HW,vga16color[14]);
-
- x0 = XWL + LW/2;
- y0 = YWH + HW/2;
- grx_circle(x0, y0, LLAN+3, vga16color[12]);
- grx_rect(XWL+74, YWH+7, XWL+120, YWH+22, vga16color[12]);
-
- x0 = LREC;
- grx_line(x0, CIMA, x0, FONDO, vga16color[15]);
- grx_line(x0+DREC, CIMA, x0+DREC, FONDO, vga16color[15]);
- grx_line(x0, FONDO, x0+DREC, FONDO, vga16color[15]);
- grx_box(x0+1, CIMA, x0+DREC-1, FONDO-1, vga16color[14]);
- grx_text("Press A", XWM+16, YWH+48, vga16color[10], vga16color[0]);
- grx_text("to fill", XWM+16, YWH+64, vga16color[10], vga16color[0]);
-
- grx_text("Press:", XWM+18, YWM+HW-50, vga16color[10], vga16color[0]);
- grx_text("ESC to exit", XWM+18, YWM+HW-40, vga16color[10], vga16color[0]);
- grx_text("SPACE to create", XWM+18, YWM+HW-30, vga16color[10], vga16color[0]);
-
- x0 = XWR + LW/2;
- y0 = YWM + HW/2;
- grx_circle(x0, y0, LLAN/3, vga16color[14]);
- grx_disc(x0, y0, LLAN/3-1, vga16color[12]);
-
- x0 = XWR+5;
- y0 = YWL+HW-5;
- grx_line(x0, YWL+HLOAD, x0+LW-10, YWL+HLOAD, vga16color[12]);
- grx_text("SYSTEM WORKLOAD:", x0+5, YWL+HLOAD-10, vga16color[10], vga16color[0]);
-
- count = 0;
- t1 = sys_gettime(NULL);
- do count++; while (sys_gettime(NULL) < (t1 + DURATA));
-
- nrt_task_default_model(m2);
- pid = task_create("gener", gener, &m2, NULL);
- task_activate(pid);
-
- x = 0;
- while (!fine) {
- car = load(count);
- y = (double)LLOAD*car;
- sem_wait(&mx_grf);
- grx_line(x0+x, y0-LLOAD+1, x0+x, y0, vga16color[0]);
- grx_line(x0+x, y0-y, x0+x, y0, vga16color[15]);
- grx_text(" ", x0+LW-60, YWL+HLOAD-10, vga16color[0], vga16color[0]);
- sprintf(s, "%.3f", car);
- grx_text(s, x0+LW-50, YWL+HLOAD-10, vga16color[15], vga16color[0]);
- sem_post(&mx_grf);
- x = (x + 1) % (LW-10);
- }
-
- exit(1);
-
- return 0;
-}
-
-/****************************************************************/
-
-double load(long n)
-{
- TIME i, t1;
- double carico;
-
- i = 0;
- t1 = sys_gettime(NULL);
- do i++; while (sys_gettime(NULL) < (t1 + DURATA));
- carico = 1. - (double)i / (double)n;
- return(carico);
-}
-
-/****************************************************************/
Index: branches/xen/mix/mix.dat
===================================================================
--- branches/xen/mix/mix.dat (revision 1684)
+++ branches/xen/mix/mix.dat (nonexistent)
@@ -1,12 +0,0 @@
-TASK NAME PERIOD WCET
-------------------------------------------
-task1 watch: 1000000 200
-task2 tasto: 2000 200
-task3 palla: 2000 200
-task4 mosca: 20000 200
-task5 infor: 20000 300
-task6 ruota: 5000 400
-task7 color: 2000 200
-task8 pendo: 5000 400
-------------------------------------------
-
Index: branches/xen/mix/initfile.c
===================================================================
--- branches/xen/mix/initfile.c (revision 1684)
+++ branches/xen/mix/initfile.c (nonexistent)
@@ -1,200 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.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 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- //read_file();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
Index: branches/xen/servo/initfile.c
===================================================================
--- branches/xen/servo/initfile.c (revision 1684)
+++ branches/xen/servo/initfile.c (nonexistent)
@@ -1,172 +0,0 @@
-/*
- * Project: S.Ha.R.K
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * Authors:
- * ...
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.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
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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");
-
- return NULL;
-
-}
/branches/xen/servo/initfile.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/servo/README
===================================================================
--- branches/xen/servo/README (revision 1684)
+++ branches/xen/servo/README (nonexistent)
@@ -1,2 +0,0 @@
-TODO
-
Index: branches/xen/servo/makefile
===================================================================
--- branches/xen/servo/makefile (revision 1684)
+++ branches/xen/servo/makefile (nonexistent)
@@ -1,15 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = load
-
-include $(BASE)/config/example.mk
-
-load:
- make -f $(SUBMAKE) APP=load INIT= OTHEROBJS="initfile.o" OTHERINCL= SHARKOPT="__LINUXC26__ __INPUT__ __SERVO__"
/branches/xen/servo/makefile
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/servo/load.c
===================================================================
--- branches/xen/servo/load.c (revision 1684)
+++ branches/xen/servo/load.c (nonexistent)
@@ -1,76 +0,0 @@
-/*
- * Project: S.Ha.R.K
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://hartik.sssup.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 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 "drivers/shark_keyb26.h"
-#include "unistd.h"
-
-#include "servo.h"
-
-#define N_SEND 10000
-
-int main () {
-
- int res, i = 0, k;
-
- srand(sys_gettime(NULL));
-
- cprintf("(Open Com2)");
- res = servo_open(COM2, 19200);
- cprintf("(Res = %d)",res);
-
- cprintf("(Servo Turn On 0)");
- res = servo_turn_on(COM2, 0);
- cprintf("(Res = %d)",res);
-
- while(i < N_SEND) {
-
- cprintf("(Cycle = %d)",i);
-
- k = rand() % 180 - 90;
-
- cprintf("(Set Servo 0 %d)",k);
- res = servo_set_angle_sec(COM2, 0, ANGLE2SEC(k,0,0));
- cprintf("(Res = %d)",res);
-
- udelay(100000);
-
- i++;
-
- }
-
- servo_close(COM2);
-
- exit(0);
-
- return 0;
-
-}
-
Index: branches/xen/input/initcur.c
===================================================================
--- branches/xen/input/initcur.c (revision 1684)
+++ branches/xen/input/initcur.c (nonexistent)
@@ -1,164 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- MOUSE26_close();
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
- MOUSE_PARMS mparms = BASE_MOUSE;
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- /*keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- MOUSE26_init(&mparms);
-
- return 0;
-
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-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");
- exit(1);
- }
-
-}
-
-#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 __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
/branches/xen/input/initcur.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/input/input.c
===================================================================
--- branches/xen/input/input.c (revision 1684)
+++ branches/xen/input/input.c (nonexistent)
@@ -1,452 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * 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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_fb26.h>
-
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-#include <drivers/shark_joy26.h>
-
-#define RGB_BLACK rgb16( 0, 0, 0)
-#define RGB_GRAY rgb16(127,127,127)
-#define RGB_WHITE rgb16(255,255,255)
-#define RGB_RED rgb16(255, 0, 0)
-#define RGB_GREEN rgb16( 0,255, 0)
-#define RGB_BLUE rgb16( 0, 0,255)
-#define RGB_YELLOW rgb16(255,255, 0)
-#define RGB_MAGENTA rgb16(255, 0,255)
-#define RGB_CYAN rgb16( 0,255,255)
-#define RGB_D_RED rgb16(127, 0, 0)
-#define RGB_D_GREEN rgb16( 0,127, 0)
-#define RGB_D_BLUE rgb16( 0, 0,127)
-#define RGB_D_YELLOW rgb16(127,127, 0)
-#define RGB_D_MAGENTA rgb16(127, 0,127)
-#define RGB_D_CYAN rgb16( 0,127,127)
-
-void my_sysend(KEY_EVT *e)
-{
- exit(0);
-}
-
-void no_note(KEY_EVT *e)
-{
- speaker_sound(0, 0);
-}
-
-void my_note(KEY_EVT *e)
-{
- switch (e->scan) {
- case KEY_Q:
- speaker_sound(262, 0); /* DO */
- break;
- case KEY_W:
- speaker_sound(277, 0); /* DO# */
- break;
- case KEY_E:
- speaker_sound(294, 0); /* RE */
- break;
- case KEY_R:
- speaker_sound(311, 0); /* RE# */
- break;
- case KEY_T:
- speaker_sound(330, 0); /* MI */
- break;
- case KEY_Y:
- speaker_sound(349, 0); /* FA */
- break;
- case KEY_U:
- speaker_sound(370, 0); /* FA# */
- break;
- case KEY_I:
- speaker_sound(392, 0); /* SOL */
- break;
- case KEY_O:
- speaker_sound(415, 0); /* SOL# */
- break;
- case KEY_P:
- speaker_sound(440, 0); /* LA */
- break;
- case KEY_BRL:
- speaker_sound(466, 0); /* LA# */
- break;
- case KEY_BRR:
- speaker_sound(494, 0); /* SI */
- break;
- }
-}
-
-TASK my_getjoy(void *arg)
-{
- int a0, a1, a2, a3, btn;
- char st[20];
-
- while (1) {
- joy_getstatus(&a0, &a1, &a2, &a3, &btn);
-
- sprintf(st, "X Axis : %6d ", a0);
- grx_text(st, 100, 64, RGB_CYAN, RGB_BLACK);
- sprintf(st, "Y Axis : %6d ", a1);
- grx_text(st, 100, 114, RGB_CYAN, RGB_BLACK);
- sprintf(st, "Buttons: %2x ", btn);
- grx_text(st, 100, 164, RGB_CYAN, RGB_BLACK);
-
- task_endcycle();
- if (btn == 0xF)
- my_sysend(NULL);
- }
-}
-
-TASK my_getch(void *arg)
-{
-#define MYNCHAR 25
-
- BYTE ch;
- int i = 0;
- char st[20];
-
- while (1) {
- ch = keyb_getch(NON_BLOCK);
- if (ch) {
- if (ch == BACKSPACE) { //backspace
- i--;
- //ch = 0x20;
- }
- if (ch == ENTER) { //enter
- i = ((i / MYNCHAR) + 1) * MYNCHAR - 1;
- ch = 0x20;
- }
- sprintf(st, "%c", ch);
- grx_text(st, 340 + 10 * (i%MYNCHAR), 25 + 20 * (i/MYNCHAR), RGB_BLUE, RGB_BLACK);
-
- if (ch == BACKSPACE) //backspace
- i--;
- if (++i >= MYNCHAR * 9) {
- i = 0;
- grx_box(315, 15, 623, 223, RGB_BLACK);
- }
- }
-
- task_endcycle();
- }
-}
-
-void my_mouse(MOUSE_EVT *e)
-{
- char st[20];
- char pressed = 0;
-
- sprintf(st, "X Axis : %3d (%4d)", e->x, e->dx);
- grx_text(st, 100, 280, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Y Axis : %3d (%4d)", e->y, e->dy);
- grx_text(st, 100, 320, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Z Axis : %3d (%4d)", e->z, e->dz);
- grx_text(st, 100, 360, RGB_YELLOW, RGB_BLACK);
- sprintf(st, "Buttons: %6x ", (int)e->buttons);
- grx_text(st, 100, 400, RGB_YELLOW, RGB_BLACK);
-
- if ((e->x > 377) && (e->x < 401) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(277, 0); /* DO# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 407) && (e->x < 431) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(311, 0); /* RE# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 467) && (e->x < 491) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(370, 0); /* FA# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 497) && (e->x < 521) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(415, 0); /* SOL# */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 527) && (e->x < 551) && (e->y > 300) && (e->y < 360) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(466, 0); /* LA# */
- pressed = 1;
- }
- return;
- }
-
- if ((e->x > 360) && (e->x < 388) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)){
- if (!pressed) {
- speaker_sound(262, 0); /* DO */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 390) && (e->x < 418) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(294, 0); /* RE */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 420) && (e->x < 448) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(330, 0); /* MI */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 450) && (e->x < 478) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(349, 0); /* FA */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 480) && (e->x < 508) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(392, 0); /* SOL */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 510) && (e->x < 538) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(440, 0); /* LA */
- pressed = 1;
- }
- return;
- }
- if ((e->x > 540) && (e->x < 568) && (e->y > 300) && (e->y < 400) && (e->buttons == MOUSE_LBUTTON)) {
- if (!pressed) {
- speaker_sound(494, 0); /* SI */
- pressed = 1;
- }
- return;
- }
-
- speaker_sound(0, 0);
- pressed = 0;
-}
-
-void graph_init(void)
-{
- grx_rect( 4, 4, 634, 474, RGB_WHITE);
- grx_rect( 14, 14, 304, 224, RGB_YELLOW);
- grx_rect(314, 14, 624, 224, RGB_RED);
- grx_rect( 14, 234, 304, 464, RGB_GREEN);
- grx_rect(314, 234, 624, 464, RGB_BLUE);
-
- /* Draw Teyboard */
- grx_box(360, 300, 388, 400, RGB_WHITE); /* DO */
- grx_box(390, 300, 418, 400, RGB_WHITE); /* RE */
- grx_box(420, 300, 448, 400, RGB_WHITE); /* MI */
- grx_box(450, 300, 478, 400, RGB_WHITE); /* FA */
- grx_box(480, 300, 508, 400, RGB_WHITE); /* SOL */
- grx_box(510, 300, 538, 400, RGB_WHITE); /* LA */
- grx_box(540, 300, 568, 400, RGB_WHITE); /* SI */
-
- grx_box(377, 301, 401, 360, RGB_BLACK); /* DO# */
- grx_box(407, 301, 431, 360, RGB_BLACK); /* RE# */
- grx_box(467, 301, 491, 360, RGB_BLACK); /* FA# */
- grx_box(497, 301, 521, 360, RGB_BLACK); /* SOL# */
- grx_box(527, 301, 551, 360, RGB_BLACK); /* LA# */
-}
-
-void start_sound(void)
-{
- KEY_EVT ev;
-
- speaker_sound(440, 400);
- while ( (sys_gettime(NULL)/1000) < 1000);
-
- ev.ascii = 'q';
- ev.scan = KEY_Q;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'w';
- ev.scan = KEY_W;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'e';
- ev.scan = KEY_E;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'r';
- ev.scan = KEY_R;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 't';
- ev.scan = KEY_T;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'y';
- ev.scan = KEY_Y;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'u';
- ev.scan = KEY_U;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'i';
- ev.scan = KEY_I;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'o';
- ev.scan = KEY_O;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = '[';
- ev.scan = KEY_BRL;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = ']';
- ev.scan = KEY_BRR;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysend, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysend, FALSE);
-
- graph_init();
-
- mouse_grxlimits(639, 479);
- mouse_setposition(319, 239, 0);
- mouse_hook(my_mouse);
- mouse_grxcursor(ENABLE, 2);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Key_Print", my_getch, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Key_Print>\n");
- exit(1);
- } else
- task_activate(pid);
-
- if (JOY26_installed()) {
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Joy_Print>\n");
- exit(1);
- } else
- task_activate(pid);
- }
-
- start_sound();
- return 0;
-}
Index: branches/xen/input/initspk.c
===================================================================
--- branches/xen/input/initspk.c (revision 1684)
+++ branches/xen/input/initspk.c (nonexistent)
@@ -1,156 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- KEYB26_close();
- SPEAK26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- /*keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- SPEAK26_init();
- return 0;
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-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");
- exit(1);
- }
-
-}
-
-#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 __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: branches/xen/input/joy.c
===================================================================
--- branches/xen/input/joy.c (revision 1684)
+++ branches/xen/input/joy.c (nonexistent)
@@ -1,76 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * 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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_joy26.h>
-
-TASK my_getjoy(void *arg) {
-
- int a0, a1, a2, a3, btn;
-
- while (1) {
- joy_getstatus(&a0, &a1, &a2, &a3, &btn);
- cprintf("(%6d %6d) %2x\n", a0, a1, btn);
- task_endcycle();
- if (btn == 0xF)
- exit(1);
- }
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- if (!JOY26_installed()) {
- cprintf("No Joystick found.");
- exit(1);
- }
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,10000);
- soft_task_def_usemath(mp);
- pid = task_create("Joy_Print", my_getjoy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Joy_Print>\n");
- exit(1);
- } else
- task_activate(pid);
-
- return 0;
-}
/branches/xen/input/joy.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/input/speak.c
===================================================================
--- branches/xen/input/speak.c (revision 1684)
+++ branches/xen/input/speak.c (nonexistent)
@@ -1,208 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * 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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-void my_sysclose(KEY_EVT *e)
-{
- speaker_sound(0, 0);
-
- kern_printf("S.Ha.R.K. closed.\n\n");
- exit(0);
-}
-
-void no_note(KEY_EVT *e){
- speaker_sound(0, 0);
-}
-
-void my_note(KEY_EVT *e){
-
- switch (e->scan) {
- case KEY_Q:
- speaker_sound(262, 0);
- break;
- case KEY_W:
- speaker_sound(277, 0);
- break;
- case KEY_E:
- speaker_sound(294, 0);
- break;
- case KEY_R:
- speaker_sound(311, 0);
- break;
- case KEY_T:
- speaker_sound(330, 0);
- break;
- case KEY_Y:
- speaker_sound(349, 0);
- break;
- case KEY_U:
- speaker_sound(370, 0);
- break;
- case KEY_I:
- speaker_sound(392, 0);
- break;
- case KEY_O:
- speaker_sound(415, 0);
- break;
- case KEY_P:
- speaker_sound(440, 0);
- break;
- case KEY_BRL:
- speaker_sound(466, 0);
- break;
- case KEY_BRR:
- speaker_sound(494, 0);
- break;
- }
-}
-
-int main(int argc, char **argv)
-{
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- speaker_sound(440, 400);
- while ( (sys_gettime(NULL)/1000) < 1000);
-
- ev.ascii = 'q';
- ev.scan = KEY_Q;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'w';
- ev.scan = KEY_W;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'e';
- ev.scan = KEY_E;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'r';
- ev.scan = KEY_R;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 't';
- ev.scan = KEY_T;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'y';
- ev.scan = KEY_Y;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'u';
- ev.scan = KEY_U;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'i';
- ev.scan = KEY_I;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'o';
- ev.scan = KEY_O;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = '[';
- ev.scan = KEY_BRL;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- ev.ascii = ']';
- ev.scan = KEY_BRR;
- ev.flag = 0;
- ev.status = KEY_PRESSED;
- keyb_hook(ev, my_note, FALSE);
- ev.status = KEY_RELEASED;
- keyb_hook(ev, no_note, FALSE);
-
- while(1);
- return 0;
-}
Index: branches/xen/input/initfile.c
===================================================================
--- branches/xen/input/initfile.c (revision 1684)
+++ branches/xen/input/initfile.c (nonexistent)
@@ -1,217 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_spk26.h>
-#include <drivers/shark_joy26.h>
-
-#include <drivers/shark_fb26.h>
-
-#define FRAME_BUFFER_DEVICE 0
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(1);
- }
-}
-
-int device_drivers_init()
-{
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
- MOUSE_PARMS mparms = BASE_MOUSE;
-
- LINUXC26_register_module(TRUE);
-
- PCI26_init();
-
- INPUT26_init();
-
- /* keyb_def_map(kparms, KEYMAP_IT);*/
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- mouse_def_threshold(mparms, 5);
- mouse_def_xmin(mparms, 0);
- mouse_def_ymin(mparms, 0);
- mouse_def_xmax(mparms, 639);
- mouse_def_ymax(mparms, 479);
- MOUSE26_init(&mparms);
-
- SPEAK26_init();
-
- JOY26_init();
-
- FB26_init();
- res = FB26_open(FRAME_BUFFER_DEVICE);
- if (res) {
- cprintf("Error: Cannot open graphical mode\n");
- MOUSE26_close();
- SPEAK26_close();
- JOY26_close();
- KEYB26_close();
- INPUT26_close();
- exit(1);
- }
-
- FB26_use_grx(FRAME_BUFFER_DEVICE);
- FB26_setmode(FRAME_BUFFER_DEVICE,"640x480-16");
-
- return 0;
-}
-
-int device_drivers_close() {
-
- mouse_grxcursor(DISABLE, 0);
-
- FB26_close(FRAME_BUFFER_DEVICE);
-
- MOUSE26_close();
- SPEAK26_close();
- JOY26_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");
-
- return NULL;
-}
Index: branches/xen/input/initjoy.c
===================================================================
--- branches/xen/input/initjoy.c (revision 1684)
+++ branches/xen/input/initjoy.c (nonexistent)
@@ -1,149 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors:
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_joy26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-PID shutdown_task_PID = 1;
-
-TIME __kernel_register_levels__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- JOY26_close();
- INPUT26_close();
-
- return 0;
-}
-
-int device_drivers_init() {
-
- LINUXC26_register_module(TRUE);
- INPUT26_init();
-
- JOY26_init();
-
- return 0;
-
-}
-
-TASK shutdown_task_body(void *arg) {
-
- device_drivers_close();
- sys_shutdown_message("-- S.Ha.R.K. Closed --\n");
- return NULL;
-}
-
-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");
- exit(1);
- }
-
-}
-
-#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 __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
/branches/xen/input/initjoy.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/input/key.c
===================================================================
--- branches/xen/input/key.c (revision 1684)
+++ branches/xen/input/key.c (nonexistent)
@@ -1,135 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * 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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_keyb26.h>
-
-//#define SHOW_EVT
-
-void my_sysclose(KEY_EVT *e)
-{
- kern_printf("S.Ha.R.K. closed.\n\n");
- exit(0);
-}
-
-TASK my_get(void *arg) {
-#ifdef SHOW_EVT
- int status;
- KEY_EVT ev;
-#else
- BYTE ch;
-#endif
-
- while (1) {
-#ifdef SHOW_EVT
- status = keyb_getcode(&ev, NON_BLOCK);
- if (status == TRUE)
- cprintf("[%c %d %d %d]\n", ev.ascii, ev.scan, ev.status, ev.flag);
-#else
- ch = keyb_getch(NON_BLOCK);
- if (ch)
- cprintf("%c", ch);
-#endif
- task_endcycle();
- }
-}
-
-void my_pause(KEY_EVT *e){
-
- TIME t;
-
- cprintf("Start Pause.\n");
- keyb_disable();
- cprintf("Keyboard Disabled.\n");
- t = sys_gettime(NULL);
- while ( ( (sys_gettime(NULL) -t) / 1000) < 5000);
- keyb_enable();
- cprintf("Keyboard Enabled.\n");
-}
-
-void my_test(KEY_EVT *e){
- cprintf("<test>\n");
-}
-
-void my_arrow(KEY_EVT *e){
- cprintf("<arrow>\n");
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
-
- KEY_EVT ev;
-
- ev.ascii = 'p';
- ev.scan = KEY_P;
- ev.status = KEY_PRESSED;
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_pause, FALSE);
-
- set_keyevt(&ev, 'a', KEY_A, 0, KEY_PRESSED|KEY_REPEATED);
- keyb_hook(ev, my_test, FALSE);
-
- set_keyevt(&ev, 0, EXT_UP, 0, KEY_PRESSED);
- keyb_hook(ev, my_arrow, FALSE);
-
- set_keyevt(&ev, 'b', KEY_B, CNTL_BIT, KEY_PRESSED);
- keyb_hook(ev, my_test, TRUE);
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,1000);
- soft_task_def_usemath(mp);
- pid = task_create("Keyb_Print", my_get, &mp, NULL);
- if (pid == NIL) {
- perror("Could not create task <Keyb_Print>");
- exit(1);
- } else
- task_activate(pid);
-
- return 0;
-}
Index: branches/xen/input/mouse.c
===================================================================
--- branches/xen/input/mouse.c (revision 1684)
+++ branches/xen/input/mouse.c (nonexistent)
@@ -1,95 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * 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
- */
-
-/*
- * 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 <kernel/func.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <drivers/shark_mouse26.h>
-#include <drivers/shark_keyb26.h>
-#include <drivers/shark_spk26.h>
-
-void my_sysclose(KEY_EVT *e)
-{
- mouse_txtcursor(DISABLE);
-
- exit(0);
-}
-
-TASK my_putxy(void *arg) {
-
- int x, y, z;
- unsigned long btn;
-
- clear();
-
- while (1) {
- mouse_getposition(&x, &y, &z, &btn);
- place(10, 10);
- cprintf("X: %2d - Y: %2d - Z: %3d - Btn: %4d\n", x, y, z, (int)btn);
-
- task_endcycle();
- }
-}
-
-int main(int argc, char **argv)
-{
- SOFT_TASK_MODEL mp;
- PID pid;
- KEY_EVT ev;
-
- ev.ascii = 'c';
- ev.scan = KEY_C;
- ev.status = KEY_PRESSED;
- ev.flag = CNTL_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
- ev.flag = CNTR_BIT;
- keyb_hook(ev, my_sysclose, FALSE);
-
- mouse_txtcursor(ENABLE);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_met(mp,700);
- soft_task_def_period(mp,1000);
- soft_task_def_usemath(mp);
- pid = task_create("Mouse_Print", my_putxy, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <Mouse_Print>\n");
- my_sysclose(NULL);
- } else
- task_activate(pid);
-
- return 0;
-}
/branches/xen/input/mouse.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/input/initkey.c
===================================================================
--- branches/xen/input/initkey.c (revision 1684)
+++ branches/xen/input/initkey.c (nonexistent)
@@ -1,154 +0,0 @@
-/*
- * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- * Gerardo Lamastra <gerardo@sssup.it>
- *
- * Authors :
- * Mauro Marinoni <mauro.marinoni@unipv.it>
- * Tullio Facchinetti <tullio.facchinetti@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://hartik.sssup.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 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 "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- return TICK;
-}
-
-int device_drivers_close() {
-
- KEYB26_close();
- INPUT26_close();
-
- return 0;
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
- 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");
- 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");
- exit(1);
- }
-
-}
-
-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;
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
Index: branches/xen/input/makefile
===================================================================
--- branches/xen/input/makefile (revision 1684)
+++ branches/xen/input/makefile (nonexistent)
@@ -1,28 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= input speak key mouse joy
-
-include $(BASE)/config/example.mk
-
-input:
- make -f $(SUBMAKE) APP=input INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__ __FB__"
-
-speak:
- make -f $(SUBMAKE) APP=speak INIT= OTHEROBJS="initspk.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-key:
- make -f $(SUBMAKE) APP=key INIT= OTHEROBJS="initkey.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-mouse:
- make -f $(SUBMAKE) APP=mouse INIT= OTHEROBJS="initcur.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
-joy:
- make -f $(SUBMAKE) APP=joy INIT= OTHEROBJS="initjoy.o" SHARKOPT="__INPUT__ __LINUXC26__ __PCI__"
-
Index: branches/xen/dynademo/readme.txt
===================================================================
--- branches/xen/dynademo/readme.txt (revision 1684)
+++ branches/xen/dynademo/readme.txt (nonexistent)
@@ -1,83 +0,0 @@
----------------------------------------------
-Dynalink Demo.
----------------------------------------------
-This is the Dynalink for S.H.A.R.K demo.
-Source files are in /shark/projects/dynademo
-The SHARK kernel and the user application
-are compiled seperatly by;
-
-make_os.mk
-make_app.mk
-
-The resulting OS kernel file is a default
-SHARK mutliboot compliant ELF executable.
-The resluting user Application is an ELF object file.
-
-Also included is a small test data.bin file
-to illustrate the use of extra data module parsing through GRUB.
-
-The idea is to boot the SHARK kernel through GRUB,
-and parsing the User Application plus any needed
-data files as 'boot modules'.
-GRUB usage example:
-
-# For booting SHARK image from HD
-title S.H.A.R.K + Boot Modules from HD 0,0
-kernel (hd0,0)/boot/os mount root=/dev/hda1
-module (hd0,0)/boot/sh_app.bin
-module (hd0,0)/boot/data.bin
-
-This could be a possible solution to get by
-certain GPL restrictions since no GPL code
-resides in the user application.
-The user application is dynamicly linked
-after the kernel is loaded.
-
-Another advantage is that we have a simple
-way of loading data files without the need for
-an IDE-driver plus Filesystem.
-Good enough for a few embedded solutions.
-
--------------------------------------------------------------
-Dynalink code
--------------------------------------------------------------
-The Dynalinker is based on Luca Abenia's code
-as used in the FD32 project.
-Source files are in /shark/dynalink
-The Dynalink makefile produces libdynalink.a
-which is compiled into the kernel by adding SHARKOPT =" __DYNALINK__"
-
-Also not that I added a section to config.mk as
-you can see in the included config.mk
-
-# added for dynalink [lex]
-ifndef DYNALINK
-LINK_OPT = -Bstatic -Ttext $(MEM_START) -s -nostartfiles -nostdlib -L$(LIB_PATH) -L$(OSLIB_PATH)
-else
-LINK_OPT = -Bstatic
-endif
-
-Operation:
-The Dynalinker supports only ELF objects.
-Everything else is loaded and treated as Data objects.
-
-After the SHARK kernel is booted it will execute main()
-which sole purpose here is to process all parsed
-boot modules, link any valid ELF objects
-and put the results in a dynalink_module_list struct.
-This struct is then used to run the actual User Application
-and to hold info about possible data files in memory
-that the User Application can use.
-
-The dynalinker uses a syscall_table to export/import the symbols.
-(review dynalink.c)
-Not all SHARK/Library functions needs to be exported!
-This is of course just an example.
-
-
-/Lex Nahumury 5:41 19-7-06
-
-
-
-
-
Index: branches/xen/dynademo/data.bin
===================================================================
--- branches/xen/dynademo/data.bin (revision 1684)
+++ branches/xen/dynademo/data.bin (nonexistent)
@@ -1,11 +0,0 @@
-//////////////////////////////////////////////////////////////////////
-/////////////// User Application running /////////////////////////////
-
-Dynalink demo.
-
-An ELF object (which is running now) and a data file
-(which you read now) are parsed as 'boot modules'
-to the S.H.A.R.K kernel by GRUB.
-
-Press a key to continue with this lame application.....:)
-//////////////////////////////////////////////////////////////////////
\ No newline at end of file
Index: branches/xen/dynademo/app.c
===================================================================
--- branches/xen/dynademo/app.c (revision 1684)
+++ branches/xen/dynademo/app.c (nonexistent)
@@ -1,188 +0,0 @@
-///////////////////////////////////////////////////
-// app.c -Lex Nahumury 2006
-//
-// This would be the Closed Source User Application part.
-// The ELF object itself contains no GPL code.
-// The references to GPL code are resolved
-// by the Dynamic Linker after the kernel has loaded.
-//
-//////////////////////////////////////////////////
-
-/*
-Usage example:
-
-# For booting SHARK image from HD
-title S.H.A.R.K + Boot Modules from HD 0,0
-kernel (hd0,0)/boot/os mount root=/dev/hda1
-module (hd0,0)/boot/sh_app.bin
-module (hd0,0)/boot/data.bin
-
-*/
-
-#include "kernel/kern.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ll/i386/cons.h"
-
-#include <drivers/shark_keyb26.h>
-#include "../../ports/dynalink/dynalink.h"
-
-extern void call_shutdown_task(void *arg);
-extern DWORD get_tick();
-
-struct params
-{
- int task_nr;
- int row;
- int count;
- int cycles;
-};
-
-
-TASK periodic_task(void *arg)
-{
- int ani=0;
- char c[2];
- struct params* p = (struct params*)(arg);
- int row = p->row;
- char txt[4];
- p->count=0;
-
- while(p->count < p->cycles)
- {
- switch(ani)
- {
- case 0:
- ani=1; sprintf(c,"%s", "\\");
- break;
- case 1:
- ani=2; sprintf(c,"/");
- break;
- case 2:
- ani=0; sprintf(c,"-");
- break;
- }
- puts_xy(12,row,YELLOW, c );
-
- ++p->count;
- sprintf(txt,"%02d", p->count);
- puts_xy(8,row,YELLOW, txt);
-
- task_endcycle();
- }
-
- cprintf("Task #%d end.\n", p->task_nr);
- if(p->task_nr==4) call_shutdown_task(0);
- return 0;
-};
-
-
-// This is the main user application entry point.
-int main_module_entry(void* arg)
-{
- struct dynalink_module_list* dml = (struct dynalink_module_list*)arg;
-
- // make char pointer to text data module,..
- char* txt = (char*)(dml->dat[0].start);
-
- // ... and print out it's data content
- cprintf("%s", txt);
-
- keyb_getch(BLOCK);
- clear();
-
- SOFT_TASK_MODEL msoft;
- PID p1,p2,p3,p4;
-
- int yrow = 1;
- puts_xy(0,yrow, 7,"Task#1:[ ]");
- puts_xy(0,yrow+1,7,"Task#2:[ ]");
- puts_xy(0,yrow+2,7,"Task#3:[ ]");
- puts_xy(0,yrow+3,7,"Task#4:[ ]");
-
- place(0,7);
-
- // Init shared soft task model
- soft_task_default_model(msoft);
- soft_task_def_met(msoft,10000);
- soft_task_def_group(msoft, 1);
- soft_task_def_periodic(msoft);
- soft_task_def_level(msoft, 2);
-
- int cycles = 4;
-
- // init Task 1
- float task_periode = 1.0; // 1sec
- int tick = get_tick(); // 1000 usec = 1 ms
- int per = (int)( task_periode *1000.0 * tick);
- struct params pp1;
- pp1.task_nr = 1;
- pp1.row = yrow;
- pp1.cycles = cycles;
- soft_task_def_period(msoft, per); // set period
- soft_task_def_arg(msoft, (void*)(&pp1) ); // set arguments
- p1 = task_create("save", periodic_task, &msoft, NULL);
- if (p1 == NIL)
- {
- sys_shutdown_message("Can't create task1 ...\n");
- exit(1);
- }
-
- // init Task 2
- task_periode = task_periode*0.5; // twice as fast as task1
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp2;
- pp2.task_nr = 2;
- pp2.row = yrow+1;
- pp2.cycles = cycles*2;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp2) );
- p2 = task_create("skip", periodic_task, &msoft, NULL);
- if (p2 == NIL)
- {
- sys_shutdown_message("Can't create task2...\n");
- exit(1);
- }
-
- // init Task 3
- task_periode = task_periode*0.5; // twice as fast as previous task
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp3;
- pp3.task_nr = 3;
- pp3.row = yrow+2;
- pp3.cycles = cycles*4;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp3) );
- p3 = task_create("skip", periodic_task, &msoft, NULL);
- if(p3 == NIL)
- {
- sys_shutdown_message("Can't create task3...\n");
- exit(1);
- }
-
- // init Task 4
- task_periode = task_periode*0.5; // twice as fast as previous task
- tick = get_tick(); // 1000 usec = 1 ms
- per = (int)( task_periode *1000.0 * tick);
- struct params pp4;
- pp4.task_nr = 4;
- pp4.row = yrow+3;
- pp4.cycles = cycles*8;
- soft_task_def_period(msoft, per);
- soft_task_def_arg(msoft, (void*)(&pp4) );
- p4 = task_create("skip", periodic_task, &msoft, NULL);
- if(p4 == NIL)
- {
- sys_shutdown_message("Can't create task4...\n");
- exit(1);
- }
-
- group_activate(1);
-
- return 0;
-};
Index: branches/xen/dynademo/os.c
===================================================================
--- branches/xen/dynademo/os.c (revision 1684)
+++ branches/xen/dynademo/os.c (nonexistent)
@@ -1,201 +0,0 @@
-//////////////////////////////////////////////////////////////
-// os.c -Lex Nahumury 2006
-//
-// This is the OpenSource SHARK OS/kernel part.
-// It will dynamicly link the main application ELF object
-// through 'Dynalink'.
-//
-//////////////////////////////////////////////////////////////
-#include "kernel/kern.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include "ll/i386/cons.h"
-
-#include "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-#include "intdrive/intdrive/intdrive.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include <drivers/shark_linuxc26.h>
-#include <drivers/shark_pci26.h>
-#include <drivers/shark_input26.h>
-#include <drivers/shark_keyb26.h>
-
-// DYNALINK
-#include <dynalink.h>
-
-// some shark pci forward declaration stuff
-extern int pci20to26_find_class(unsigned int class_code, int index, BYTE *bus, BYTE *dev);
-extern int pci20to26_read_config_byte(unsigned int bus, unsigned int dev, int where, BYTE *val);
-extern int pci20to26_read_config_word(unsigned int bus, unsigned int dev, int where, WORD *val);
-extern int pci20to26_read_config_dword(unsigned int bus, unsigned int dev, int where, DWORD *val);
-extern int pci20to26_write_config_byte(unsigned int bus, unsigned int dev, int where, BYTE val);
-extern int pci20to26_write_config_word(unsigned int bus, unsigned int dev, int where, WORD val);
-extern int pci20to26_write_config_dword(unsigned int bus, unsigned int dev, int where, DWORD val);
-
-
-#define TICK 1000 // 1ms
-#define RRTICK 100000 // 100ms
-
-/*+ IntDrive Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#define INTDRIVE_FLAG 0
-
-#define NSEC_PER_SEC (1000000000L)
-#define SHUTDOWN_TIMEOUT_SEC 0.5 // seconds
-
-// prototypes
-void call_shutdown_task(void *arg);
-int device_drivers_init();
-int device_drivers_close();
-void set_shutdown_task();
-TASK shutdown_task_body(void *arg);
-
-// user application function pointer prototype
-int (*main_app_entry)(void* arg);
-
-
-// vars
-static struct multiboot_info *mb = 0;
-static struct dynalink_module_list dml;
-PID shutdown_task_PID = -1;
-
-
-// user app calls this to retrieve tick
-DWORD get_tick()
-{
- return TICK;
-};
-
-TASK shutdown_task_body(void *arg)
-{
- device_drivers_close();
- sys_shutdown_message("-- OS Closed --\n");
- return NULL;
-};
-
-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");
- exit(1);
- }
-};
-
-
-void call_shutdown_task(void *arg)
-{
- struct timespec t;
- sys_gettime(&t);
- t.tv_nsec += NSEC_PER_SEC * SHUTDOWN_TIMEOUT_SEC;
- kern_event_post(&t,(void *)((void *)sys_abort_shutdown),(void *)0);
- task_activate(shutdown_task_PID);
-};
-
-
-TIME __kernel_register_levels__(void *arg)
-{
- mb = (struct multiboot_info *)arg;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
-
- return TICK;
-};
-
-TASK __init__(void *arg)
-{
- mb = (struct multiboot_info *)arg;
-
- //HARTPORT_init();
- set_shutdown_task();
- device_drivers_init();
-
- sys_atrunlevel( call_shutdown_task,
- NULL,
- RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-};
-
-
-int main(int argc, char **argv)
-{
- // Any modules passed to kernel by GRUB?
- if(!mb->mods_count)
- {
- printk("No modules passed at all! Bye..\n");
- exit(1);
- }
-
- // Process the modules through 'dynalink'
- dynalink_modules(mb, &dml, "_module_entry");
- if(dml.num_apps == 0)
- {
- printk("No Application modules found! Bye..\n");
- exit(1);
- }
-
- // Run first found user application function
- // and pass the dynalink_module_list..
- DWORD dynadr = dml.app[0].dyn_entry;
- if(dynadr)
- {
- main_app_entry = (void*)dynadr;
- main_app_entry(&dml);
- }
- else
- {
- printk("No Application modules found! Bye..\n");
- exit(1);
- }
-return 0;
-};
-
-
-int device_drivers_init()
-{
- LINUXC26_register_module(TRUE);
- //PCI26_init();
- INPUT26_init();
-
- KEYB_PARMS kparms = BASE_KEYB;
- keyb_def_ctrlC(kparms, NULL);
- KEYB26_init(&kparms);
-
- return 0;
-};
-
-int device_drivers_close()
-{
- KEYB26_close();
- INPUT26_close();
- return 0;
-};
-
-
Index: branches/xen/dynademo/make_app.mk
===================================================================
--- branches/xen/dynademo/make_app.mk (revision 1684)
+++ branches/xen/dynademo/make_app.mk (nonexistent)
@@ -1,35 +0,0 @@
-# This will make one single object file from multiple sources [Lex.N]
-
-DYNALINK=1
-ifndef BASE
-BASE=../..
-endif
-
-include $(BASE)/config/config.mk
-
-OTHERINCL += -I$(BASE)/drivers/linuxc26/include -I./include -I.
-OTHERINCL += -I$(BASE)/drivers/pci/include
-OTHERINCL += -I$(BASE)/drivers/input/include
-
-# add all sources here..
-OBJS = app.o
-
-all: sh_app.o
- $(MV) sh_app.o sh_app.bin
-
-
-clean :
- $(RM) *.o
-
-sh_app.o: $(OBJS)
- $(LD) $(LINK_OPT) $(OBJS) -r -s -o sh_app.o
-
-
-# Common rules
-%.o : %.c
- $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -c $<
-%.s : %.c
- $(REDIR) $(CC) $(C_OPT) $(C_OUTPUT) -S $<
-%.o : %.s
- $(CC) $(ASM_OPT) -c $<
-
Index: branches/xen/dynademo/make_os.mk
===================================================================
--- branches/xen/dynademo/make_os.mk (revision 1684)
+++ branches/xen/dynademo/make_os.mk (nonexistent)
@@ -1,19 +0,0 @@
-#
-
-ifndef BASE
-BASE=../..
-endif
-
-PROGS = os
-
-include $(BASE)/config/config.mk
-include $(BASE)/config/example.mk
-
-$(PROGS):
- make -f $(SUBMAKE) APP=$(PROGS) \
- INIT= \
- OTHEROBJS= \
- OTHERINCL= \
- SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __DYNALINK__"
-
-
Index: branches/xen/cpufreq/makefile
===================================================================
--- branches/xen/cpufreq/makefile (revision 1684)
+++ branches/xen/cpufreq/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= cpufreq
-
-include $(BASE)/config/example.mk
-
-cpufreq:
- make -f $(SUBMAKE) APP=cpufreq INIT= OTHEROBJS="initfile.o" SHARKOPT="__INPUT__ __CPU__ __LINUXC26__ __PCI__"
-
Index: branches/xen/cpufreq/initfile.c
===================================================================
--- branches/xen/cpufreq/initfile.c (revision 1684)
+++ branches/xen/cpufreq/initfile.c (nonexistent)
@@ -1,186 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.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 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "drivers/shark_linuxc26.h"
-#include "drivers/shark_input26.h"
-#include "drivers/shark_keyb26.h"
-
-#include <drivers/shark_cpu26.h>
-
-/*+ sysyem tick in us +*/
-#define TICK 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ IntDrive Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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);
-
- //sys_set_reboot(EXIT_MODE_HALT);
-
- __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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- CPU26_init();
-
- CPU26_DVS_init();
-
- INPUT26_init();
-
- keyb_def_ctrlC(kparms, NULL);
-
- KEYB26_init(&kparms);
-
- return 0;
-
-}
-
-int device_drivers_close() {
-
- //CPU26_DVS_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");
-
- return NULL;
-
-}
-
Index: branches/xen/cpufreq/cpufreq.c
===================================================================
--- branches/xen/cpufreq/cpufreq.c (revision 1684)
+++ branches/xen/cpufreq/cpufreq.c (nonexistent)
@@ -1,75 +0,0 @@
-
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
- *
- * Authors : Mauro Marinoni
- * Giacomo Guidi <giacomo@gandalf.sssup.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
- */
-
-/*
- * 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 <drivers/shark_keyb26.h>
-#include <drivers/shark_cpu26.h>
-
-void endfunc(KEY_EVT *e)
-{
- exit(0);
-}
-
-int main(int argc, char **argv)
-{
- int val, num;
- char buf[1000];
-
- CPU26_showinfo();
-
- val = CPU26_get_min_frequency();
- cprintf("Min freq: %d\n", val);
-
- val = CPU26_get_max_frequency();
- cprintf("Max freq: %d\n", val);
-
- val = CPU26_get_cur_frequency();
- cprintf("Current freq: %d\n", val);
-
- num = CPU26_show_frequencies(buf);
- if (num>0)
- cprintf("Allowed frequencys: %s\n", buf);
- num = CPU26_get_frequencies(cpu26_freqs);
-
- if (num>0) {
- CPU26_set_frequency(cpu26_freqs[0], DVS_RELATION_L);
- val = CPU26_get_cur_frequency();
- cprintf("Actual freq: %d\n", val);
- }
-
- endfunc(NULL);
-
- return 0;
-}
/branches/xen/cpufreq/cpufreq.c
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: branches/xen/mesatex/initfile.c
===================================================================
--- branches/xen/mesatex/initfile.c (revision 1684)
+++ branches/xen/mesatex/initfile.c (nonexistent)
@@ -1,202 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Giacomo Guidi <giacomo@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.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 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "hardcbs/hardcbs/hardcbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 10000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- HCBS_register_level(HCBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- /* 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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
-
-
Index: branches/xen/mesatex/mesatex.c
===================================================================
--- branches/xen/mesatex/mesatex.c (revision 1684)
+++ branches/xen/mesatex/mesatex.c (nonexistent)
@@ -1,391 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.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
- */
-
-/*
- * 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 <GL/osmesa.h>
-#include <GL/glut.h>
-
-#include <math.h>
-#include <stdlib.h>
-#include <assert.h>
-#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
-
-#define WIDTH 640
-#define HEIGHT 430
-#define BYTES_PP 2 //BytesPerPixel
-
-OSMesaContext ctx;
-
-static GLuint TexObj[2];
-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)
-# define TEXTURE_OBJECT 1
-# define glBindTexture(A,B) glBindTextureEXT(A,B)
-# define glGenTextures(A,B) glGenTexturesEXT(A,B)
-# define glDeleteTextures(A,B) glDeleteTexturesEXT(A,B)
-#endif
-
-unsigned char *rgb_565_buf = NULL; //RGB 16 bpp Buffer
-unsigned char *video_buf = NULL; //Video Buffer
-
-unsigned long int RGB565MEM = WIDTH * HEIGHT * BYTES_PP; // Total video mem
-
-unsigned long int PERIOD_REFRESH = 30000;
-unsigned long int PERIOD_DISEGNA = 30000;
-
-unsigned long int WCET_REFRESH, WCET_DISEGNA;
-
-TASK refesh(void);
-TASK disegna(void);
-
-PID refresh_PID, disegna_PID;
-
-static void draw( void )
-{
- glDepthFunc(GL_EQUAL);
- /* glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );*/
- glClear( GL_COLOR_BUFFER_BIT );
-
- glColor3f( 1.0, 1.0, 1.0 );
-
- /* draw first polygon */
- glPushMatrix();
- glTranslatef( -1.0, 0.0, 0.0 );
- glRotatef( Angle, 0.0, 0.0, 1.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
-#endif
- }
- else {
- glCallList( TexObj[0] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
- /* draw second polygon */
- glPushMatrix();
- glTranslatef( 1.0, 0.0, 0.0 );
- glRotatef( Angle-90.0, 0.0, 1.0, 0.0 );
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
-#endif
- }
- else {
- glCallList( TexObj[1] );
- }
- glBegin( GL_POLYGON );
- glTexCoord2f( 0.0, 0.0 ); glVertex2f( -1.0, -1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex2f( 1.0, -1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex2f( 1.0, 1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex2f( -1.0, 1.0 );
- glEnd();
- glPopMatrix();
-
-}
-
-static void gl_init()
-{
-
- static int twidth=8, theight=8;
- static GLubyte tex1[] = {
- 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0 };
-
- static GLubyte tex2[] = {
- 0, 0, 0, 2, 2, 2, 0, 0,
- 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 2, 0, 0, 0, 0,
- 0, 0, 0, 0, 2, 0, 0, 0,
- 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 2, 2, 2, 0, 0, 0 };
-
- GLubyte tex[64][3];
- GLint i, j;
-
- //Create the OSMesa Context
- ctx = OSMesaCreateContext(OSMESA_RGB_565, NULL);
-
- //Make Current Context
- OSMesaMakeCurrent(ctx, rgb_565_buf, GL_UNSIGNED_SHORT_5_6_5, WIDTH, HEIGHT);
-
- UseObj = GL_TRUE;
-
- glDisable( GL_DITHER );
-
- /* Setup texturing */
- glEnable( GL_TEXTURE_2D );
- glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
- glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
-
- /* generate texture object IDs */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glGenTextures( 2, TexObj );
-#endif
- }
- else {
- TexObj[0] = glGenLists(2);
- TexObj[1] = TexObj[0]+1;
- }
-
- /* setup first texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[0] );
- assert(glIsTexture(TexObj[0]));
-#endif
- }
- else {
- glNewList( TexObj[0], GL_COMPILE );
- }
- /* red on white */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex1[(theight-i-1)*twidth+j]) {
- tex[p][0] = 255; tex[p][1] = 0; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 255; tex[p][1] = 255; tex[p][2] = 255;
- }
- }
- }
-
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end of texture object */
-
- /* setup second texture object */
- if (UseObj) {
-#ifdef TEXTURE_OBJECT
- glBindTexture( GL_TEXTURE_2D, TexObj[1] );
- assert(glIsTexture(TexObj[1]));
-#endif
- assert(!glIsTexture(TexObj[1] + 999));
- }
- else {
- glNewList( TexObj[1], GL_COMPILE );
- }
- /* green on blue */
- for (i=0;i<theight;i++) {
- for (j=0;j<twidth;j++) {
- int p = i*twidth+j;
- if (tex2[(theight-i-1)*twidth+j]) {
- tex[p][0] = 0; tex[p][1] = 255; tex[p][2] = 0;
- }
- else {
- tex[p][0] = 0; tex[p][1] = 0; tex[p][2] = 255;
- }
- }
- }
- glTexImage2D( GL_TEXTURE_2D, 0, 3, twidth, theight, 0,
- GL_RGB, GL_UNSIGNED_BYTE, tex );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- if (!UseObj) {
- glEndList();
- }
- /* end texture object */
-
- glViewport(0, 0, (GLint)WIDTH, (GLint)HEIGHT);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- /* glOrtho( -3.0, 3.0, -3.0, 3.0, -10.0, 10.0 );*/
- glFrustum( -2.0, 2.0, 2.0, -2.0, 6.0, 20.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -8.0 );
-
-}
-
-void program_end(void *arg)
-{
-
- OSMesaDestroyContext(ctx);
- free(rgb_565_buf);
-
- exit(0);
-
-}
-
-void program_key_end(KEY_EVT *k)
-{
-
- exit(0);
-
-}
-
-TASK refresh(void)
-{
-
- while(1) {
-
- memcpy((video_buf+40*WIDTH*2), rgb_565_buf, RGB565MEM);
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-
-TASK disegna(void)
-{
-
- char text[100];
- TIME disegna_TIME, refresh_TIME;
-
- while(1) {
-
- jet_gettable(refresh_PID, &refresh_TIME, 1);
- jet_gettable(disegna_PID, &disegna_TIME, 1);
-
- Angle += 2.0;
-
- draw();
-
- sprintf(text,"Hard Task Refresh PER:%6d us EX:%6d us",(int)PERIOD_REFRESH,(int)refresh_TIME);
- grx_text(text,10,5,rgb16(0,0,255),0);
- sprintf(text,"Hard Task Draw PER:%6d us EX:%6d us",(int)PERIOD_DISEGNA,(int)disegna_TIME);
- grx_text(text,10,15,rgb16(0,0,255),0);
-
- task_endcycle();
-
- }
-
- exit(0);
-
-}
-
-int main (int argc, char *argv[])
-{
-
- HARD_TASK_MODEL ht_refresh, ht_disegna;
-
- clear();
-
- WCET_REFRESH =((long int) PERIOD_REFRESH * (0.45));
- WCET_DISEGNA =((long int) PERIOD_DISEGNA * (0.45));
-
- hard_task_default_model(ht_refresh);
- hard_task_def_wcet(ht_refresh,WCET_REFRESH);
- hard_task_def_mit(ht_refresh,PERIOD_REFRESH);
- hard_task_def_usemath(ht_refresh);
- hard_task_def_group(ht_refresh,1);
- hard_task_def_ctrl_jet(ht_refresh);
-
- refresh_PID = task_create("refresh", refresh, &ht_refresh, NULL);
- if (refresh_PID == -1) {
- exit(4);
- }
-
- hard_task_default_model(ht_disegna);
- hard_task_def_mit(ht_disegna,PERIOD_DISEGNA);
- hard_task_def_wcet(ht_disegna,WCET_DISEGNA);
- hard_task_def_group(ht_disegna,1);
- hard_task_def_ctrl_jet(ht_disegna);
- hard_task_def_usemath(ht_disegna);
- hard_task_def_stack(ht_disegna,30000);
-
- disegna_PID = task_create("disegna", disegna, &ht_disegna, NULL);
- if (disegna_PID == -1) {
- exit(4);
- }
-
- {
- KEY_EVT k;
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
-
- k.flag = CNTR_BIT;
- k.status = KEY_PRESSED;
- keyb_hook(k, program_key_end, FALSE);
- }
-
- rgb_565_buf = malloc(RGB565MEM);
-
- gl_init();
-
- video_buf = (unsigned char *)video_memory;
- //video_buf = (unsigned char *)malloc(640*480*2);
-
- memset(rgb_565_buf, 0, RGB565MEM);
-
- group_activate(1);
-
- return 0;
-
-}
Index: branches/xen/mesatex/readme.txt
===================================================================
--- branches/xen/mesatex/readme.txt (revision 1684)
+++ branches/xen/mesatex/readme.txt (nonexistent)
@@ -1,44 +0,0 @@
---------------------------------------
-MESA Demo (tex)
-
-by
-
-Giacomo Guidi <giacomo@gandalf.sssup.it>
-
-Last update 17/03/2003
---------------------------------------
-
-This is a simple test demo for the MESA (5.0)
-libraries, the low level graphic drivers is
-the SVGA (from the SVGAlib)
-
-See drivers/svga/readme for supported cards
-
---------------------------------------
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application
-README.TXT This file
-INITFILE.C The init file
-MESATEX.C The MESA Demo
-
---------------------------------------
-
-- To specify your card change the line
-
-#define CARD <driver name>
-
-- The demo calls the grx and off-screen Mesa functions.
-The resolution must be 16 bitsperpixel (64K colors) and
-the graphic access mode must be linear.
-
-- There are two buffers
-
- The video buffer (video_buf)
- The virtual buffer (rgb_565_buf)
-
- copy_videomem_16to16 links these buffers
-
-
-
Index: branches/xen/mesatex/makefile
===================================================================
--- branches/xen/mesatex/makefile (revision 1684)
+++ branches/xen/mesatex/makefile (nonexistent)
@@ -1,16 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS = mesatex
-
-include $(BASE)/config/example.mk
-
-mesatex:
- make -f $(SUBMAKE) APP=mesatex INIT= OTHEROBJS="initfile.o" SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__ __OSMESA__"
-
Index: branches/xen/jumpball/rrn.c
===================================================================
--- branches/xen/jumpball/rrn.c (revision 1684)
+++ branches/xen/jumpball/rrn.c (nonexistent)
@@ -1,218 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: rrn.c,v 1.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "nop/nop/nop.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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_Q, INTDRIVE_U, INTDRIVE_FLAG);
- RR_register_level(RRTICK, RR_MAIN_NO, mb); // this module remains empty!!!
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: branches/xen/jumpball/rrp.c
===================================================================
--- branches/xen/jumpball/rrp.c (revision 1684)
+++ branches/xen/jumpball/rrp.c (nonexistent)
@@ -1,218 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: rrp.c,v 1.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "pi/pi/pi.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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_Q, INTDRIVE_U, INTDRIVE_FLAG);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_SOFT);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- PI_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: branches/xen/jumpball/demo.c
===================================================================
--- branches/xen/jumpball/demo.c (revision 1684)
+++ branches/xen/jumpball/demo.c (nonexistent)
@@ -1,198 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: demo.c,v 1.8 2005-01-08 14:35:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2005-01-08 14:35:17 $
- ------------
-**/
-
-/*
- * Copyright (C) 2000-2003 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 "demo.h"
-#include <kernel/func.h>
-#include <string.h>
-#include <stdlib.h>
-
-/* useful colors... */
-int white;
-int black;
-int red;
-int gray;
-
-void app_mutex_init(mutex_t *m);
-
-static void version( void )
-{
- cprintf( "S.Ha.R.K. Jumpball Demo 1.0\n" );
- cprintf( "---------------------------\n" );
- cprintf( "by Paolo Gai 1999-2001\n" );
- cprintf( " <pj@sssup.it>\n" );
- cprintf( "---------------------------\n" );
-}
-
-int myrand(int x)
-{
- return rand()%x;
-}
-
-void reverse(char s[])
-{
- int c, i, j;
-
- for (i = 0, j = strlen(s)-1; i<j; i++, j--)
- {
- c = s[i];
- s[i] = s[j];
- s[j] = c;
- }
-}
-
-char * itoa(int n, char *s)
-{
- int i, sign;
-
- if ((sign = n) < 0)
- n = -n;
-
- i = 0;
-
- do
- {
- s[i++] = n % 10 + '0';
- } while ((n /= 10) > 0);
-
- if (sign < 0)
- s[i++] = '-';
-
- s[i] = 0;
-
- reverse(s);
-
- return s;
-}
-
-
-void scenario()
-{
- grx_text("S.Ha.R.K. Jumpball Demo 1.0", 0, 0, rgb16(0,255,0), black );
- grx_text(" by Paolo Gai 1999-2001" , 0, 8, rgb16(0,255,0), black );
- grx_text(" pj@sssup.it" , 0,16, rgb16(0,255,0), black );
-
- grx_text("Ctrl-C, Ctrr-C, Enter: exit" ,320, 0, gray, black );
- grx_text("Alt-C : void statistics" ,320, 8, gray, black );
- grx_text("Space : create noise ball",320,16, gray, black );
- grx_text("Backspace : kill noise balls" ,320,24, gray, black );
-
-
- #ifdef JET_ON
- scenario_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- scenario_ball();
- #endif
-}
-
-void endfun(KEY_EVT *k)
-{
- exit(0);
-}
-
-void zerofun(KEY_EVT *k)
-{
- int i;
- for (i=0; i<MAX_PROC; i++) jet_delstat(i);
-}
-
-int main(int argc, char **argv)
-{
-
- KEY_EVT k;
-
- version();
-
- srand(4);
-
- k.flag = CNTR_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
- k.flag = CNTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
- k.flag = ALTL_BIT;
- k.scan = KEY_C;
- k.ascii = 'c';
- k.status = KEY_PRESSED;
- keyb_hook(k,zerofun,FALSE);
- k.flag = 0;
- k.scan = KEY_ENT;
- k.ascii = 13;
- k.status = KEY_PRESSED;
- keyb_hook(k,endfun,FALSE);
-
- /* init the graphic mutex */
- app_mutex_init(&mutex);
-
- /* useful colors ... */
- white = rgb16(255,255,255);
- black = rgb16(0,0,0);
- red = rgb16(255,0,0);
- gray = rgb16(128,128,128);
-
- scenario();
-
- #ifdef JET_ON
- init_jetcontrol();
- #endif
-
- #ifdef BALL_ON
- init_ball();
- #endif
-
- group_activate(1);
-
- return 0;
-}
-
-
Index: branches/xen/jumpball/ern.c
===================================================================
--- branches/xen/jumpball/ern.c (revision 1684)
+++ branches/xen/jumpball/ern.c (nonexistent)
@@ -1,220 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ern.c,v 1.10 2006-07-05 08:27:27 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.10 $
- Last update: $Date: 2006-07-05 08:27:27 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "rr/rr/rr.h"
-#include "rrsoft/rrsoft/rrsoft.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "nop/nop/nop.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- RRSOFT_register_level(RRTICK, RR_MAIN_NO, mb, RRSOFT_ONLY_HARD|RRSOFT_ONLY_SOFT);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
-
- CABS_register_module();
-
- NOP_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- NOP_mutexattr_t attr;
-
- NOP_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
-
Index: branches/xen/jumpball/ecp.c
===================================================================
--- branches/xen/jumpball/ecp.c (revision 1684)
+++ branches/xen/jumpball/ecp.c (nonexistent)
@@ -1,216 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * Tullio Facchinetti <tullio.facchinetti@unipv.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ecp.c,v 1.9 2006-03-09 14:17:03 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.9 $
- Last update: $Date: 2006-03-09 14:17:03 $
- ------------
-**/
-
-/*
- * Copyright (C) 2003 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 "intdrive/intdrive/intdrive.h"
-#include "edf/edf/edf.h"
-#include "cbs/cbs/cbs.h"
-#include "rr/rr/rr.h"
-#include "dummy/dummy/dummy.h"
-
-#include "sem/sem/sem.h"
-#include "hartport/hartport/hartport.h"
-#include "cabs/cabs/cabs.h"
-
-#include "pi/pi/pi.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 0
-
-/*+ RR tick in us +*/
-#define RRTICK 2000
-
-/*+ Interrupt Server +*/
-#define INTDRIVE_Q 1000
-#define INTDRIVE_U 0.1*MAX_BANDWIDTH
-#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;
- LEVEL EDF_level;
-
- INTDRIVE_register_level(INTDRIVE_Q, INTDRIVE_Q, INTDRIVE_U, INTDRIVE_FLAG);
- EDF_level = EDF_register_level(EDF_ENABLE_ALL);
- CBS_register_level(CBS_ENABLE_ALL, EDF_level);
- RR_register_level(RRTICK, RR_MAIN_YES, mb);
- dummy_register_level();
-
- SEM_register_module();
- CABS_register_module();
- PI_register_module();
-
- return TICK;
-}
-
-TASK __init__(void *arg)
-{
- struct multiboot_info *mb = (struct multiboot_info *)arg;
-
- HARTPORT_init();
-
- set_shutdown_task();
-
- device_drivers_init();
-
- sys_atrunlevel(call_shutdown_task, NULL, RUNLEVEL_SHUTDOWN);
-
- __call_main__(mb);
-
- return (void *)0;
-}
-
-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");
- exit(1);
- }
-
-}
-
-int device_drivers_init() {
-
- int res;
- KEYB_PARMS kparms = BASE_KEYB;
-
- LINUXC26_register_module(TRUE);
-
- 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();
- exit(1);
- }
-
- 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");
-
- return NULL;
-
-}
-
-void app_mutex_init(mutex_t *m)
-{
- PI_mutexattr_t attr;
-
- PI_mutexattr_default(attr);
-
- mutex_init(m, &attr);
-}
Index: branches/xen/jumpball/jetctrl.c
===================================================================
--- branches/xen/jumpball/jetctrl.c (revision 1684)
+++ branches/xen/jumpball/jetctrl.c (nonexistent)
@@ -1,236 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: jetctrl.c,v 1.5 2005-01-08 14:35:17 pj Exp $
-
- File: $File$
- Revision: $Revision: 1.5 $
- Last update: $Date: 2005-01-08 14:35:17 $
- ------------
-**/
-
-/*
- * 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
- *
- */
-
-
-// JetControl
-
-#include "demo.h"
-#include "kernel/func.h"
-
-TASK jetdummy_task(void *arg)
-{
- TIME now_dummy, last_dummy, diff_dummy, slice;
- struct timespec now, last, diff;
- int x = 0;
- int height;
-
- NULL_TIMESPEC(&last);
- last_dummy = 0;
- for (;;) {
- task_nopreempt();
- jet_getstat(DUMMY_PID, NULL, NULL, NULL, &now_dummy);
- sys_gettime(&now);
- task_preempt();
-
- SUBTIMESPEC(&now, &last, &diff);
- slice = diff.tv_sec * 1000000 + diff.tv_nsec/1000;
- diff_dummy = now_dummy - last_dummy;
-
- height = (int)(JET_DUMMY_HEIGHT*((float)diff_dummy)/((float)slice));
-
- TIMESPEC_ASSIGN(&last, &now);
- last_dummy = now_dummy;
-
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y,
- JET_DUMMY_X+x,JET_DUMMY_Y+height ,black);
- grx_line(JET_DUMMY_X+x,JET_DUMMY_Y+height,
- JET_DUMMY_X+x,JET_DUMMY_Y+JET_DUMMY_HEIGHT,white);
- grx_line(JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y,
- JET_DUMMY_X+(x+1)%JET_DUMMY_WIDTH,JET_DUMMY_Y+JET_DUMMY_HEIGHT,255);
-
- x = (x+1)%JET_DUMMY_WIDTH;
-
- task_endcycle();
- }
-}
-
-
-TASK jetctrl_task(void *arg)
-{
- char st[50];
- TIME sum, max;
- int n;
-
- PID i;
- int printed = 0;
-
- for (;;) {
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, &max, &n, NULL) != -1) {
- if (!n) n=1;
- sprintf(st, "%6d %6d %10s", (int)sum/n, (int)max, proc_table[i].name);
- grx_text(st, 384, JET_Y_NAME+16+printed*8, gray, black);
- printed++;
- }
- }
- while (printed<JET_NTASK) {
- grx_text(" ",
- 384, JET_Y_NAME+16+printed*8, gray, black);
- printed++;
- }
- task_endcycle();
- }
-}
-
-TASK jetslide_task(void *arg)
-{
- TIME sum, curr, max;
-
- TIME total[JET_NTASK];
- int slides[JET_NTASK];
-
- PID i;
- int printed = 0;
-
- for (;;) {
- // Fill the total array in a nonpreemptive section
- task_nopreempt();
- for (i=2, printed=0; i<MAX_PROC && printed<JET_NTASK; i++) {
- if (jet_getstat(i, &sum, NULL, NULL, &curr) != -1) {
- total[printed] = sum+curr;
- printed++;
- }
- }
- task_preempt();
-
- while (printed < JET_NTASK)
- total[printed++] = 0;
-
- // Compute the Max elapsed time
- max = 0;
- for (i=0; i<JET_NTASK; i++)
- if (total[i] > max) max = total[i];
- if (!max) max = 1;
-
- // Compute the slides width
- for (i=0; i<JET_NTASK; i++)
- slides[i] = (int)( (((float)total[i])/max) * JET_SLIDE_WIDTH);
-
- // print the data
- for (i=0; i<JET_NTASK; i++) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+slides[i], JET_Y_NAME+23+i*8, gray);
- grx_box(JET_SLIDE_X+slides[i], JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+23+i*8, black);
- }
-
- while (i<JET_NTASK) {
- grx_box(JET_SLIDE_X, JET_Y_NAME+16+i*8,
- JET_SLIDE_X+JET_SLIDE_WIDTH, JET_Y_NAME+20+i*8, black);
- i++;
- }
- task_endcycle();
- }
-}
-
-
-void scenario_jetcontrol(void)
-{
- grx_text("System load" , 384, 45, rgb16(0,0,255), black);
- grx_line(384,55,639,55,red);
-
- grx_text(" Mean Max Name Slide", 384, JET_Y_NAME, gray, black);
- grx_line(384,JET_Y_NAME+10,639,JET_Y_NAME+10,gray);
-
- grx_rect(JET_DUMMY_X-1, JET_DUMMY_Y-1,
- JET_DUMMY_X+JET_DUMMY_WIDTH, JET_DUMMY_Y+JET_DUMMY_HEIGHT+1, gray);
-
- grx_text("100%", JET_DUMMY_X-40, JET_DUMMY_Y, gray, black);
- grx_text(" 0%", JET_DUMMY_X-40, JET_DUMMY_Y+JET_DUMMY_HEIGHT-8, gray, black);
-
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y, JET_DUMMY_X-5, JET_DUMMY_Y, gray);
- grx_line(JET_DUMMY_X-1, JET_DUMMY_Y+JET_DUMMY_HEIGHT, JET_DUMMY_X-5, JET_DUMMY_Y+JET_DUMMY_HEIGHT, gray);
-}
-
-void init_jetcontrol(void)
-{
- SOFT_TASK_MODEL m3, m4, m5;
-
- PID p3, p4, p5;
-
- soft_task_default_model(m3);
- soft_task_def_level(m3,2);
- soft_task_def_period(m3, PERIOD_JETCTRL);
- soft_task_def_met(m3, WCET_JETCTRL);
- soft_task_def_ctrl_jet(m3);
- soft_task_def_group(m3, 1);
- p3 = task_create("jctrl", jetctrl_task, &m3, NULL);
- if (p3 == -1) {
- sys_shutdown_message("Could not create task <jetctrl> errno=%d",
- errno);
- exit(1);
- }
-
- soft_task_default_model(m4);
- soft_task_def_level(m4,2);
- soft_task_def_period(m4, PERIOD_JETDUMMY);
- soft_task_def_met(m4, WCET_JETDUMMY);
- soft_task_def_group(m4, 1);
- soft_task_def_usemath(m4);
- soft_task_def_ctrl_jet(m4);
- p4 = task_create("jdmy", jetdummy_task, &m4, NULL);
- if (p4 == -1) {
- sys_shutdown_message("Could not create task <jetdummy> errno=%d",
- errno);
- exit(1);
- }
-
- soft_task_default_model(m5);
- soft_task_def_level(m5,2);
- soft_task_def_period(m5, PERIOD_JETSLIDE);
- soft_task_def_met(m5, WCET_JETSLIDE);
- soft_task_def_group(m5, 1);
- soft_task_def_usemath(m5);
- soft_task_def_ctrl_jet(m5);
- p5 = task_create("jsli", jetslide_task, &m5, NULL);
- if (p5 == -1) {
- sys_shutdown_message("Could not create task <jetslide> errno=%d",
- errno);
- exit(1);
- }
-}
-
Index: branches/xen/jumpball/demo.h
===================================================================
--- branches/xen/jumpball/demo.h (revision 1684)
+++ branches/xen/jumpball/demo.h (nonexistent)
@@ -1,190 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: demo.h,v 1.8 2006-06-27 09:27:15 tullio Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2006-06-27 09:27:15 $
- ------------
-**/
-
-/*
- * 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 <ll/ll.h>
-#include <kernel/types.h>
-#include <kernel/descr.h>
-#include <math.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
-
-/* Subparts */
-#define JET_ON
-#define BALL_ON
-
-
-/* CPU Speed Selection
- --------------------------------------------------------------------
- 1700 - Pentium 4 1.7 GHz
- 1300 - Centrino 1.3 GHz
- 400 - Pentium 2 400 MHz
- 133 - Pentium 1 133 MHz
-*/
-#define CPU 400
-
-/*
- *
- * WCET, Periods and Models
- *
- */
-
-#if CPU==133
-#define WCET_JETCTRL 10000
-#define WCET_JETDUMMY 300
-#define WCET_JETSLIDE 2000
-#define WCET_BALL 250
-#define WCET_HARD_BALL 1000
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==400
-#define WCET_JETCTRL 7500
-#define WCET_JETDUMMY 400
-#define WCET_JETSLIDE 2100
-#define WCET_BALL 250
-#define WCET_HARD_BALL 480
-#define BALL_DELAY 10000
-#endif
-
-#if CPU==1300
-#define WCET_JETCTRL 4500
-#define WCET_JETDUMMY 200
-#define WCET_JETSLIDE 1300
-#define WCET_BALL 250
-#define WCET_HARD_BALL 650
-#define BALL_DELAY 100000
-#endif
-
-#if CPU==1700
-#define WCET_JETCTRL 4500
-#define WCET_JETDUMMY 100
-#define WCET_JETSLIDE 1300
-#define WCET_BALL 250
-#define WCET_HARD_BALL 410
-#define BALL_DELAY 100000
-#endif
-
-#define PERIOD_JETCTRL 100000
-#define PERIOD_JETDUMMY 100000
-#define PERIOD_JETSLIDE 100000
-#define PERIOD_BALL 10000
-
-/*
- *
- * Global Stuffs
- *
- */
-
-extern PID shutdown_task_PID;
-
-/* graphic mutex... */
-extern mutex_t mutex;
-
-/* useful colors... */
-extern int white;
-extern int black;
-extern int red;
-extern int gray;
-
-void init_jetcontrol();
-void init_ball(void);
-void scenario_jetcontrol();
-void scenario_ball();
-char *itoa(int n, char *s);
-int myrand(int x);
-
-/*
- *
- * JETCONTROL stuffs
- *
- */
-
-#define JET_NTASK 35
-#define JET_Y_NAME 170
-
-/*
- *
- * ATTENTION: the following PID MUST match
- * with the one assigned by Shark to the
- * Dummy task during dummy module creation.
- *
- */
-#define DUMMY_PID 2
-
-#define JET_DUMMY_WIDTH 210
-#define JET_DUMMY_HEIGHT 80
-
-/* the point (x, y) is the top left corner */
-#define JET_DUMMY_X 428
-#define JET_DUMMY_Y 65
-
-#define JET_SLIDE_WIDTH 50
-#define JET_SLIDE_X 576
-
-/*
- *
- * BALL stuffs
- *
- */
-
-// x and y corners are specified whithout consider a border of 3 pixels
-#define BALL_Y 450 /* position of the floor */
-#define BALL_HEIGHT 385 /* initial height of the ball */
-#define BALL_XMIN 10 /* min position X of the ball */
-#define BALL_XMAX 370 /* max position X of the ball */
-#define BALL_VELX 5. /* horizontal ball velocity */
-#define BALL_VYMIN 11. /* min ground speed */
-#define BALL_MAX_P 60 /* max number of balls */
-
-#define BALL_GROUP 2 /* task group of the balls */
Index: branches/xen/jumpball/readme.txt
===================================================================
--- branches/xen/jumpball/readme.txt (revision 1684)
+++ branches/xen/jumpball/readme.txt (nonexistent)
@@ -1,94 +0,0 @@
-----------------------------------
-Jumping Balls demo
-
-by
-
-Paolo Gai 1999-2001 - pj@sssup.it
-
-----------------------------------
-
-This demo was created to show some S.Ha.R.K. functionalities in the course
-of Informatica Industriale , University of Pavia, Italy.
-
-The demo is composed by an application (derived by the template application
-distributed on the web site) and two init files.
-
-The demo is composed by:
-
-MAKEFILE The makefile used to compile the application;
- demo is the rule to compile the application with a CBS scheduler
- demo2 is the rule to compile the application with a RR scheduler
-README.TXT This file
-DEMO.H Some constants used into the demo
-ECP.C, ERN.C, RRP.C, RRN.C Various initfiles
-INITFIL2.C The EDF initfile
-INITFILE.C A makefile that cover either EDF+CBS and RR
-BALL.C The Jumping balls part of the demo
-DEMO.C The main() function and some other utility function
-JETCTRL.C The JET part of the demo
-
-The demo works as follows:
-- It works at 640x480 16 bit colors
-- on the left, there is the jumping ball arena, on the rigth there is the
- statistics about the tasks into the system.
-
-- the tasks are guaranteed using CBS and EDF. The wcet and mean execution
- time on my portable after a few minutes are (us):
-
- JetCtrl 7400 max 7500 CBS met
- JetDummy 135 max 200 CBS met
- JetSlide 2100 max 2100 CBS met
- Balls 276 max 380 EDF wcet for hard ball,100 CBS met for soft ones
-
- The system should go overloaded with 40 soft balls.
-
-- The idea is the following:
- - first, an edf guaranteed ball is created.
- - then, create a set of soft ball using space. since their met is < than the
- real met, they posticipate the deadlines.
- - if they are killed, they remain for some seconds in the zombie state
- - if a set of soft ball arde created (i.e., 10), and after a while all the
- others are created, the bandwidth is fully used, and the task posticipate
- their deadlines. the first set of tasks stops jumping when the bandwidth
- is full utilized by the newest balls until all the tasks have similar
- deadlines.
- - Note on the left the slides that represents the relative ratio
- between the tasks.
- - Note that in overload conditions the EDF task is still guaranteed
- - Note that PI is used with EDF, also if no theory says that it is good:
- - S.Ha.R.K. allows that, it is the user that have to choose if that is
- a non-sense
- - PI is independent from the implemnentation of the scheduling modules
- - if the second init file is used, RR is used instead of EDF+CBS.
- - In overload condition RR perform differently from EDF+CBS, giving to
- each task an equal fraction of bandwidth
-
- - note also:
- - the redefinition of the standard exception handler
- - the redefinition of the keys and the initialization of the keyboard
- - the myend exit function
- - the main() that terminates
- - the two parts (ball and jet) can be excluded using a #define
-
-If You have any question, please contact the author...
-
-Update (2003/12/19):
-Just some more notes...
-I usually show the four demos in the following order:
-
-(first of all, tune the demo depending on how fast your notebook is; see demo.h)
-
-ECP - EDF with CBS and PI... the white EDF ball still work also in overload; CBS balls just slow down but they still get their guaranteed bandwidth
-
-RRP - Round Robin with Priority inheritance ... the EDF ball is at the same level of the others, all slow down...
-
-RRN - 2 levels of Round Robin, without Priority inheritance ... when
-there is overload, the white ball works ok, but the other have an impredicible
-behavior (they execute many instances in one RR period)
-
-ERN - EDF, RR, no priority inheritance - the white ball misses his deadline
-just when there is an overload (all the other balls are queued on the same
-semaphore, so the blocking time increase, and when there is overload the EDF
-task misses also if it has not consumed his bandwidth). Note that it happens
-also if the EDF task consume just a few microseconds... Real time does not
-means "fast" :-)
Index: branches/xen/jumpball/ball.c
===================================================================
--- branches/xen/jumpball/ball.c (revision 1684)
+++ branches/xen/jumpball/ball.c (nonexistent)
@@ -1,246 +0,0 @@
-/*
- * Project: S.Ha.R.K.
- *
- * Coordinators:
- * Giorgio Buttazzo <giorgio@sssup.it>
- * Paolo Gai <pj@gandalf.sssup.it>
- *
- * Authors :
- * Paolo Gai <pj@gandalf.sssup.it>
- * (see the web pages for full authors list)
- *
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
- *
- * http://www.sssup.it
- * http://retis.sssup.it
- * http://shark.sssup.it
- */
-
-/**
- ------------
- CVS : $Id: ball.c,v 1.8 2005-05-10 17:21:17 mauro Exp $
-
- File: $File$
- Revision: $Revision: 1.8 $
- Last update: $Date: 2005-05-10 17:21:17 $
- ------------
-**/
-
-/*
- * 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
- *
- */
-
-/*--------------------------------------------------------------*/
-/* SIMULATION OF JUMPING BALLS */
-/*--------------------------------------------------------------*/
-
-#include "demo.h"
-#include <kernel/func.h>
-#include <stdlib.h>
-
-#define R 8 /* dimension of a ball */
-#define G 9.8 /* acceleration of gravity */
-
-static int ballexit = 0;
-static int npc = 0; /* number of tasks created */
-
-/*--------------------------------------------------------------*/
-/* Delay function for jumping balls */
-/*--------------------------------------------------------------*/
-
-void my_delay(void)
-{
- int xxx;
- for (xxx=0; xxx<BALL_DELAY; xxx++);
-}
-
-/*--------------------------------------------------------------*/
-/* Periodic task for ball simulation */
-/*--------------------------------------------------------------*/
-
-TASK palla(int i)
-{
-int x, y; /* coordinate grafiche pallina */
-int ox, oy; /* vecchia posizione pallina */
-int x0, y0; /* posizione iniziale X pallina */
-float vx, vy; /* velocitÂ… della pallina */
-float vy0; /* velocita' pallina al primo rimbalzo */
-float ty, tx; /* variabile temporale */
-float dt; /* incremento temporale */
-
- y = oy = y0 = BALL_HEIGHT;
- x = ox = x0 = BALL_XMIN;
-
- vy0= sqrt(2. * G * (float)BALL_HEIGHT);
- vy = 0;
- vx = BALL_VELX + myrand(9);
- tx = 0;
- ty = 0;
- dt = ((float)PERIOD_BALL)/100000;
-
- while (1) {
- y = y0 + vy*ty - .5*G*ty*ty;
- x = x0 + vx * tx;
-
- if (y < 0) {
- y = 0;
-
- if (vy == 0.0)
- vy = vy0;
- else if (vy < BALL_VYMIN)
- vy = vy0 * (1.0 - myrand(50)/100.0);
- else
- vy = 0.9 * vy;
-
- ty = 0.0;
- y0 = 0;
- }
-
- if (x > BALL_XMAX) {
- tx = 0.0;
- x0 = BALL_XMAX;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- if (x < BALL_XMIN) {
- tx = 0.0;
- x0 = BALL_XMIN;
- vx = -vx;
- x = x0 + vx * tx;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, 0);
- ox = x;
- oy = BALL_Y - y;
- mutex_unlock(&mutex);
-
- if (ballexit && i!=0xFFFF) {
- npc--;
- return 0;
- }
-
- mutex_lock(&mutex);
- grx_disc(ox, oy, R, i);
- mutex_unlock(&mutex);
-
- my_delay();
-
- ty += dt;
- tx += dt;
- task_endcycle();
- }
-}
-
-void killball(KEY_EVT *k)
-{
- ballexit = 1;
-}
-
-void ballfun(KEY_EVT *k)
-{
- SOFT_TASK_MODEL mp;
- int r,g,b;
- PID pid;
- char palla_str[]="palla ";
-
- if (npc == BALL_MAX_P) return;
-
- ballexit = 0;
-
- r = 64 + myrand(190);
- g = 64 + myrand(190);
- b = 64 + myrand(190);
-
- itoa(npc,palla_str+5);
-
- soft_task_default_model(mp);
- soft_task_def_level(mp,2);
- soft_task_def_ctrl_jet(mp);
- soft_task_def_arg(mp, (void *)rgb16(r,g,b));
- soft_task_def_group(mp, BALL_GROUP);
- soft_task_def_met(mp, WCET_BALL);
- soft_task_def_period(mp,PERIOD_BALL);
- soft_task_def_usemath(mp);
- pid = task_create(palla_str, palla, &mp, NULL);
-
- if (pid != NIL) {
- task_activate(pid);
- npc++;
- }
-}
-
-void hardball()
-{
- HARD_TASK_MODEL mp;
- int r,g,b;
- PID pid;
-
- r = 255;
- g = 255;
- b = 255;
-
- hard_task_default_model(mp);
- hard_task_def_ctrl_jet(mp);
- hard_task_def_arg(mp, (void *)rgb16(r,g,b));
- hard_task_def_wcet(mp, WCET_HARD_BALL);
- hard_task_def_mit(mp,PERIOD_BALL);
- hard_task_def_usemath(mp);
- pid = task_create("pallaEDF", palla, &mp, NULL);
- if (pid == NIL) {
- sys_shutdown_message("Could not create task <pallaEDF>");
- exit(1);
- }
- else
- task_activate(pid);
-}
-
-
-/*--------------------------------------------------------------*/
-/* MAIN process */
-/*--------------------------------------------------------------*/
-
-void scenario_ball()
-{
- grx_text("Noise", 0, 45 /*BALL_Y-BALL_HEIGHT-15*/, rgb16(0,0,255), black);
- grx_line(0,55,383,55,red);
- grx_rect(BALL_XMIN-R-1, BALL_Y-BALL_HEIGHT-R-1,
- BALL_XMAX+R+1, BALL_Y+R+1, rgb16(0,200,0));
-}
-
-void init_ball(void)
-{
- KEY_EVT k;
-
- hardball();
-
- k.flag = 0;
- k.scan = KEY_SPC;
- k.ascii = ' ';
- k.status = KEY_PRESSED;
- keyb_hook(k,ballfun,FALSE);
-
- k.flag = 0;
- k.scan = KEY_BKS;
- k.ascii = 0;
- k.status = KEY_PRESSED;
- keyb_hook(k,killball,FALSE);
-}
-
-/*--------------------------------------------------------------*/
Index: branches/xen/jumpball/makefile
===================================================================
--- branches/xen/jumpball/makefile (revision 1684)
+++ branches/xen/jumpball/makefile (nonexistent)
@@ -1,24 +0,0 @@
-#
-#
-#
-
-ifndef BASE
-BASE=../..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= ecp ern rrp rrn
-
-include $(BASE)/config/example.mk
-
-ecp:
- make -f $(SUBMAKE) APP=ecp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-ern:
- make -f $(SUBMAKE) APP=ern INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-rrp:
- make -f $(SUBMAKE) APP=rrp INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"
-
-rrn:
- make -f $(SUBMAKE) APP=rrn INIT= OTHEROBJS="demo.o ball.o jetctrl.o" OTHERINCL= SHARKOPT="__LINUXC26__ __PCI__ __INPUT__ __FB__"