/demos/branches/xen/network/notify.c |
File deleted |
|
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/network/talk.c |
=================================================================== |
--- demos/branches/xen/network/talk.c (revision 1684) |
+++ demos/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: demos/branches/xen/network/makefile |
=================================================================== |
--- demos/branches/xen/network/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/network/DatagramSender.java |
=================================================================== |
--- demos/branches/xen/network/DatagramSender.java (revision 1684) |
+++ demos/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++); |
- } |
- |
- } |
-} |
- |
- |
- |
/demos/branches/xen/network/DatagramSender.java |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/network/initfile.c |
=================================================================== |
--- demos/branches/xen/network/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/mesademo/initfile.c |
=================================================================== |
--- demos/branches/xen/mesademo/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/mesademo/mesademo.c |
=================================================================== |
--- demos/branches/xen/mesademo/mesademo.c (revision 1684) |
+++ demos/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: demos/branches/xen/mesademo/readme.txt |
=================================================================== |
--- demos/branches/xen/mesademo/readme.txt (revision 1684) |
+++ demos/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: demos/branches/xen/mesademo/makefile |
=================================================================== |
--- demos/branches/xen/mesademo/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/makefile |
=================================================================== |
--- demos/branches/xen/pse51/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest1.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest1.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest2.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest2.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest3.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest3.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/pinit.c |
=================================================================== |
--- demos/branches/xen/pse51/pinit.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest4.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest4.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest5.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest5.c (revision 1684) |
+++ demos/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: demos/branches/xen/pse51/ptest6.c |
=================================================================== |
--- demos/branches/xen/pse51/ptest6.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_dio.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_dio.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/readme |
=================================================================== |
--- demos/branches/xen/pci6025e/readme (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/makefile |
=================================================================== |
--- demos/branches/xen/pci6025e/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_bms.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_bms.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/wave.c |
=================================================================== |
--- demos/branches/xen/pci6025e/wave.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/initfile.c |
=================================================================== |
--- demos/branches/xen/pci6025e/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_mes.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_mes.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_ec.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_ec.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_dac.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_dac.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_ppi.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_ppi.c (revision 1684) |
+++ demos/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: demos/branches/xen/pci6025e/test_bec.c |
=================================================================== |
--- demos/branches/xen/pci6025e/test_bec.c (revision 1684) |
+++ demos/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: demos/branches/xen/mix/mix.dat |
=================================================================== |
--- demos/branches/xen/mix/mix.dat (revision 1684) |
+++ demos/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: demos/branches/xen/mix/initfile.c |
=================================================================== |
--- demos/branches/xen/mix/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/mix/readme |
=================================================================== |
--- demos/branches/xen/mix/readme (revision 1684) |
+++ demos/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: demos/branches/xen/mix/makefile |
=================================================================== |
--- demos/branches/xen/mix/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/mix/mix.c |
=================================================================== |
--- demos/branches/xen/mix/mix.c (revision 1684) |
+++ demos/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: demos/branches/xen/servo/README |
=================================================================== |
--- demos/branches/xen/servo/README (revision 1684) |
+++ demos/branches/xen/servo/README (nonexistent) |
@@ -1,2 +0,0 @@ |
-TODO |
- |
Index: demos/branches/xen/servo/makefile |
=================================================================== |
--- demos/branches/xen/servo/makefile (revision 1684) |
+++ demos/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__" |
/demos/branches/xen/servo/makefile |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/servo/load.c |
=================================================================== |
--- demos/branches/xen/servo/load.c (revision 1684) |
+++ demos/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: demos/branches/xen/servo/initfile.c |
=================================================================== |
--- demos/branches/xen/servo/initfile.c (revision 1684) |
+++ demos/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; |
- |
-} |
/demos/branches/xen/servo/initfile.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/input/initkey.c |
=================================================================== |
--- demos/branches/xen/input/initkey.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/makefile |
=================================================================== |
--- demos/branches/xen/input/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/input/initcur.c |
=================================================================== |
--- demos/branches/xen/input/initcur.c (revision 1684) |
+++ demos/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; |
-} |
/demos/branches/xen/input/initcur.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/input/input.c |
=================================================================== |
--- demos/branches/xen/input/input.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/initspk.c |
=================================================================== |
--- demos/branches/xen/input/initspk.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/joy.c |
=================================================================== |
--- demos/branches/xen/input/joy.c (revision 1684) |
+++ demos/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; |
-} |
/demos/branches/xen/input/joy.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/input/speak.c |
=================================================================== |
--- demos/branches/xen/input/speak.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/initfile.c |
=================================================================== |
--- demos/branches/xen/input/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/initjoy.c |
=================================================================== |
--- demos/branches/xen/input/initjoy.c (revision 1684) |
+++ demos/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; |
-} |
/demos/branches/xen/input/initjoy.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/input/key.c |
=================================================================== |
--- demos/branches/xen/input/key.c (revision 1684) |
+++ demos/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: demos/branches/xen/input/mouse.c |
=================================================================== |
--- demos/branches/xen/input/mouse.c (revision 1684) |
+++ demos/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; |
-} |
/demos/branches/xen/input/mouse.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/dynademo/data.bin |
=================================================================== |
--- demos/branches/xen/dynademo/data.bin (revision 1684) |
+++ demos/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: demos/branches/xen/dynademo/app.c |
=================================================================== |
--- demos/branches/xen/dynademo/app.c (revision 1684) |
+++ demos/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: demos/branches/xen/dynademo/os.c |
=================================================================== |
--- demos/branches/xen/dynademo/os.c (revision 1684) |
+++ demos/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: demos/branches/xen/dynademo/make_app.mk |
=================================================================== |
--- demos/branches/xen/dynademo/make_app.mk (revision 1684) |
+++ demos/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: demos/branches/xen/dynademo/make_os.mk |
=================================================================== |
--- demos/branches/xen/dynademo/make_os.mk (revision 1684) |
+++ demos/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: demos/branches/xen/dynademo/readme.txt |
=================================================================== |
--- demos/branches/xen/dynademo/readme.txt (revision 1684) |
+++ demos/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: demos/branches/xen/cpufreq/initfile.c |
=================================================================== |
--- demos/branches/xen/cpufreq/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/cpufreq/cpufreq.c |
=================================================================== |
--- demos/branches/xen/cpufreq/cpufreq.c (revision 1684) |
+++ demos/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; |
-} |
/demos/branches/xen/cpufreq/cpufreq.c |
Property changes: |
Deleted: svn:executable |
## -1 +0,0 ## |
-* |
\ No newline at end of property |
Index: demos/branches/xen/cpufreq/makefile |
=================================================================== |
--- demos/branches/xen/cpufreq/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/mesatex/readme.txt |
=================================================================== |
--- demos/branches/xen/mesatex/readme.txt (revision 1684) |
+++ demos/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: demos/branches/xen/mesatex/makefile |
=================================================================== |
--- demos/branches/xen/mesatex/makefile (revision 1684) |
+++ demos/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: demos/branches/xen/mesatex/initfile.c |
=================================================================== |
--- demos/branches/xen/mesatex/initfile.c (revision 1684) |
+++ demos/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: demos/branches/xen/mesatex/mesatex.c |
=================================================================== |
--- demos/branches/xen/mesatex/mesatex.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/ecp.c |
=================================================================== |
--- demos/branches/xen/jumpball/ecp.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/jetctrl.c |
=================================================================== |
--- demos/branches/xen/jumpball/jetctrl.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/demo.h |
=================================================================== |
--- demos/branches/xen/jumpball/demo.h (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/readme.txt |
=================================================================== |
--- demos/branches/xen/jumpball/readme.txt (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/ball.c |
=================================================================== |
--- demos/branches/xen/jumpball/ball.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/makefile |
=================================================================== |
--- demos/branches/xen/jumpball/makefile (revision 1684) |
+++ demos/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__" |
Index: demos/branches/xen/jumpball/rrn.c |
=================================================================== |
--- demos/branches/xen/jumpball/rrn.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/rrp.c |
=================================================================== |
--- demos/branches/xen/jumpball/rrp.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/demo.c |
=================================================================== |
--- demos/branches/xen/jumpball/demo.c (revision 1684) |
+++ demos/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: demos/branches/xen/jumpball/ern.c |
=================================================================== |
--- demos/branches/xen/jumpball/ern.c (revision 1684) |
+++ demos/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: demos/branches/xen/newtrace/utils/extract.c |
=================================================================== |
--- demos/branches/xen/newtrace/utils/extract.c (revision 1684) |
+++ demos/branches/xen/newtrace/utils/extract.c (nonexistent) |
@@ -1,1131 +0,0 @@ |
- |
-/* |
- * 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 <stdio.h> |
-#include <stdlib.h> |
-#include <math.h> |
-#include <unistd.h> |
-#include <string.h> |
- |
-#define MAXCONTEXT 100 |
-#define MAXJOB 300000 |
- |
-#define INT_CTX 1 |
-#define INT_PID 9999 |
-#define PID_NO_DEF -1 |
-#define SERVER_NO_DEF -1 |
- |
-#define BACKGROUND 0 |
-#define PERIODICAL 1 |
-#define INTERRUPT 2 |
- |
-#define DRAW_NUM 1000 |
- |
-#define DISABLE_PLOT |
- |
-struct ctx_exec { |
- int ctx; |
- unsigned long long dtsc; |
- unsigned long long dnsec; |
- unsigned long long tsc_start; |
- unsigned long long nsec_start; |
-}; |
- |
-struct ctx_to_pid { |
- int ctx; |
- int pid; |
-}; |
- |
-struct ctx_server { |
- int ctx; |
- int server_id; |
- |
-}; |
- |
-struct task_event { |
- int ctx; |
- unsigned long long tsc; |
- unsigned long long nsec; |
-}; |
- |
-struct server_event { |
- int server_id; |
- unsigned long long tsc; |
- unsigned long long nsec; |
-}; |
- |
-void Error(int num, int line) { |
- printf("Finite-State machine error %d at line %d\n",num,line); |
- exit(2); |
-} |
- |
-int context_total = 0,endcycle_total = 0,job_total = 0,exec_total = 0; |
-struct ctx_exec *exec_list; |
-struct ctx_to_pid *context_list; |
-struct task_event *endcycle_list; |
-struct task_event *deadline_miss_list; |
-struct task_event *wcet_miss_list; |
-struct task_event *act_list; |
-struct ctx_exec *job_list; |
-struct ctx_server *ctx_server_list; |
- |
-int server_exec_total = 0, server_end_total=0, server_act_total=0, ctx_server_total = 0, server_total=0; |
-struct server_event *act_server_list; |
-struct server_event *server_budget_end_list; |
- |
-int deadline_miss = 0, wcet_miss = 0, act_total = 0; |
- |
-unsigned int clk_per_msec = 0; |
-unsigned int skip_clk_per_msec = 0; |
- |
-unsigned long long log_start_tsc = 0; |
-unsigned long long log_end_tsc = 0; |
-unsigned long long total_tsc = 0; |
-unsigned long long total_nsec = 0; |
- |
-/* Data for gnuplot external call */ |
-int draw_data[DRAW_NUM+1]; |
- |
-int gnuplot_clear() { |
- |
- int i; |
- |
- for (i=0;i<DRAW_NUM;i++) |
- draw_data[i] = 0; |
- |
- return 0; |
- |
-} |
- |
-int gnuplot_draw(char *title,unsigned long long max_limit,int type) { |
- |
-#ifndef DISABLE_PLOT |
- |
- FILE *gnuplot_data, *gnuplot_command; |
- char temp_name[30]; |
- int i,pid,*current_mem; |
- |
- current_mem = malloc(sizeof(int)*(DRAW_NUM+1)); |
- memcpy(current_mem,draw_data,sizeof(int)*(DRAW_NUM+1)); |
- |
- pid = fork(); |
- if (pid == 0) { |
- |
- srand(getpid()); |
- |
- sprintf(temp_name,"/tmp/pwcet%d",rand()%10000); |
- |
- gnuplot_data = fopen(temp_name,"w"); |
- gnuplot_command = popen("gnuplot -persist","w"); |
- |
- for (i=0;i<DRAW_NUM;i++) |
- fprintf(gnuplot_data,"%f\t%f\n",(double)i * (double)max_limit / (double)DRAW_NUM / 1000.0,(float)(current_mem[i])); |
- |
- fflush(gnuplot_data); |
- fclose(gnuplot_data); |
- |
- fprintf(gnuplot_command,"set xlabel \"Time [us]\"\n"); |
- if (type == 0) { |
- fprintf(gnuplot_command,"set ylabel \"Frequency [#]\"\n"); |
- |
- fprintf(gnuplot_command,"plot \"%s\" using 1:2 title \"%s\" with lines\n",temp_name,title); |
- fflush(gnuplot_command); |
- } else { |
- fprintf(gnuplot_command,"set ylabel \"Time [us]\"\n"); |
- |
- fprintf(gnuplot_command,"plot \"%s\" using 1:2 title \"%s\" with lines\n",temp_name,title); |
- fflush(gnuplot_command); |
- } |
- |
- pclose(gnuplot_command); |
- exit(0); |
- |
- } |
- |
-#endif |
- |
- return 0; |
- |
-} |
- |
-int stats_from_execs(int ctx_num, unsigned long long *tot_nsec, |
- unsigned long long *min_nsec, |
- unsigned long long *mean_nsec, |
- unsigned long long *max_nsec, |
- unsigned long long *first_nsec, |
- int *number) { |
- |
- unsigned long long temp_nsec; |
- int k,i; |
- |
- temp_nsec = 0; |
- *max_nsec = 0; |
- *mean_nsec = 0; |
- *min_nsec = 0xFFFFFFFF; |
- *first_nsec = 0; |
- k = 0; |
- for (i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
- if (*first_nsec == 0) *first_nsec = exec_list[i].nsec_start; |
- if (exec_list[i].dnsec > *max_nsec) *max_nsec = exec_list[i].dnsec; |
- if (exec_list[i].dnsec < *min_nsec) *min_nsec = exec_list[i].dnsec; |
- temp_nsec += exec_list[i].dnsec; |
- k++; |
- } |
- |
- *number = k; |
- *tot_nsec = temp_nsec; |
- if (k != 0) *mean_nsec = temp_nsec / k; |
- |
- return 0; |
- |
-} |
- |
-int stats_from_jobs(int ctx_num, unsigned long long *tot_nsec, |
- unsigned long long *min_nsec, |
- unsigned long long *mean_nsec, |
- unsigned long long *max_nsec, |
- unsigned long long *first_nsec, |
- int *number) { |
- |
- unsigned long long temp_nsec; |
- int k,i; |
- |
- temp_nsec = 0; |
- *max_nsec = 0; |
- *mean_nsec = 0; |
- *min_nsec = 0xFFFFFFFF; |
- *first_nsec = 0; |
- k = 0; |
- for (i=0;i<job_total;i++) |
- if (job_list[i].ctx == context_list[ctx_num].ctx) { |
- if (*first_nsec == 0) *first_nsec = job_list[i].nsec_start; |
- if (job_list[i].dnsec > *max_nsec) *max_nsec = job_list[i].dnsec; |
- if (job_list[i].dnsec < *min_nsec) *min_nsec = job_list[i].dnsec; |
- temp_nsec += job_list[i].dnsec; |
- k++; |
- } |
- |
- *number = k; |
- *tot_nsec = temp_nsec; |
- if (k != 0) *mean_nsec = temp_nsec / k; |
- |
- return 0; |
- |
-} |
- |
-int arr_stats_from_execs(int ctx_num, unsigned long long *min_nsec, |
- unsigned long long *mean_nsec, |
- unsigned long long *max_nsec) { |
- |
- unsigned long long last_start,temp_nsec,delta_start; |
- int i,k; |
- |
- last_start = 0; |
- temp_nsec = 0; |
- *max_nsec = 0; |
- *min_nsec = 0xFFFFFFFF; |
- *mean_nsec = 0; |
- k = 0; |
- for (i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
- if (last_start == 0) { |
- last_start = exec_list[i].nsec_start; |
- } else { |
- delta_start = exec_list[i].nsec_start - last_start; |
- if (delta_start > *max_nsec) *max_nsec = delta_start; |
- if (delta_start < *min_nsec) *min_nsec = delta_start; |
- temp_nsec += delta_start; |
- k++; |
- last_start = exec_list[i].nsec_start; |
- } |
- } |
- |
- if (k != 0) *mean_nsec = temp_nsec / k; |
- |
- return 0; |
- |
-} |
- |
-int arr_stats_from_jobs(int ctx_num, unsigned long long *min_nsec, |
- unsigned long long *mean_nsec, |
- unsigned long long *max_nsec) { |
- |
- unsigned long long last_start,temp_nsec,delta_start; |
- int i,k; |
- |
- last_start = 0; |
- temp_nsec = 0; |
- *max_nsec = 0; |
- *min_nsec = 0xFFFFFFFF; |
- *mean_nsec = 0; |
- k = 0; |
- for (i=0;i<job_total;i++) |
- if (job_list[i].ctx == context_list[ctx_num].ctx) { |
- if (last_start == 0) { |
- last_start = job_list[i].nsec_start; |
- } else { |
- delta_start = job_list[i].nsec_start - last_start; |
- if (delta_start > *max_nsec) *max_nsec = delta_start; |
- if (delta_start < *min_nsec) *min_nsec = delta_start; |
- temp_nsec += delta_start; |
- k++; |
- last_start = job_list[i].nsec_start; |
- } |
- } |
- |
- if (k != 0) *mean_nsec = temp_nsec / k; |
- |
- return 0; |
- |
-} |
- |
-int plot_exec_demand_function(int ctx_num, char *pidstr) { |
- |
- unsigned long long max_limit; |
- char tmpstr[50]; |
- int i; |
- |
- gnuplot_clear(); |
- |
- max_limit = total_nsec; |
- |
- for (i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
- int h1,h2,h3; |
- |
- h1 = exec_list[i].nsec_start * DRAW_NUM / max_limit; |
- h2 = (exec_list[i].nsec_start+exec_list[i].dnsec) * DRAW_NUM / max_limit; |
- for (h3=h1;h3<h2;h3++) |
- if (h3 <= DRAW_NUM) draw_data[h3] += exec_list[i].dnsec/1000*(h3-h1)/(h2-h1); |
- for (h3=h2;h3<=DRAW_NUM;h3++) |
- if (h3 <= DRAW_NUM) draw_data[h3] += exec_list[i].dnsec/1000; |
- |
- } |
- |
- sprintf(tmpstr,"Ctx [%d:%s] Demand-Function",context_list[ctx_num].ctx,pidstr); |
- gnuplot_draw(tmpstr,max_limit,1); |
- |
- return 0; |
- |
-} |
- |
-int plot_exec_c_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
- |
- unsigned long long max_limit; |
- char tmpstr[50]; |
- int i,h; |
- |
- if (max_nsec == 0) return 0; |
- |
- gnuplot_clear(); |
- |
- max_limit = max_nsec; |
- |
- for (i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
- h = exec_list[i].dnsec * DRAW_NUM / max_limit; |
- if (h <= DRAW_NUM) draw_data[h]++; |
- } |
- |
- sprintf(tmpstr,"Ctx [%d:%s] Exec C-dist",context_list[ctx_num].ctx,pidstr); |
- gnuplot_draw(tmpstr,max_limit,0); |
- |
- return 0; |
- |
-} |
- |
-int plot_job_c_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
- |
- unsigned long long max_limit; |
- char tmpstr[50]; |
- int i,h; |
- |
- if (max_nsec == 0) return 0; |
- |
- gnuplot_clear(); |
- |
- max_limit = max_nsec; |
- |
- for (i=0;i<job_total;i++) |
- if (job_list[i].ctx == context_list[ctx_num].ctx) { |
- h = job_list[i].dnsec * DRAW_NUM / max_limit; |
- if (h <= DRAW_NUM) draw_data[h]++; |
- } |
- |
- sprintf(tmpstr,"Ctx [%d:%s] Job C-dist",context_list[ctx_num].ctx,pidstr); |
- gnuplot_draw(tmpstr,max_limit,0); |
- |
- return 0; |
- |
-} |
- |
-int plot_exec_arr_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
- |
- unsigned long long max_limit,last_start,delta_start; |
- char tmpstr[50]; |
- int i,h; |
- |
- if (max_nsec == 0) return 0; |
- |
- gnuplot_clear(); |
- |
- max_limit = max_nsec; |
- |
- last_start = 0; |
- for (i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == context_list[ctx_num].ctx) { |
- if (last_start == 0) { |
- last_start = exec_list[i].nsec_start; |
- } else { |
- delta_start = exec_list[i].nsec_start - last_start; |
- |
- h = delta_start * DRAW_NUM / max_limit; |
- if (h <= DRAW_NUM) draw_data[h]++; |
- |
- last_start = exec_list[i].nsec_start; |
- } |
- } |
- |
- sprintf(tmpstr,"Ctx [%d:%s] Exec Arr.Delta",context_list[ctx_num].ctx,pidstr); |
- gnuplot_draw(tmpstr,max_limit,0); |
- |
- return 0; |
- |
-} |
- |
-int plot_job_arr_distrib(int ctx_num, unsigned long long max_nsec, char *pidstr) { |
- |
- unsigned long long max_limit,last_start,delta_start; |
- char tmpstr[50]; |
- int i,h; |
- |
- if (max_nsec == 0) return 0; |
- |
- gnuplot_clear(); |
- |
- max_limit = max_nsec; |
- |
- last_start = 0; |
- for (i=0;i<job_total;i++) |
- if (job_list[i].ctx == context_list[ctx_num].ctx) { |
- if (last_start == 0) { |
- last_start = job_list[i].nsec_start; |
- } else { |
- delta_start = job_list[i].nsec_start - last_start; |
- |
- h = delta_start * DRAW_NUM / max_limit; |
- if (h <= DRAW_NUM) draw_data[h]++; |
- |
- last_start = job_list[i].nsec_start; |
- } |
- } |
- |
- sprintf(tmpstr,"Ctx [%d:%s] Job Arr.Delta",context_list[ctx_num].ctx,pidstr); |
- gnuplot_draw(tmpstr,max_limit,0); |
- |
- return 0; |
- |
-} |
- |
-int create_lists(char *filename) { |
- |
- FILE *input_file; |
- |
- int type,par1,par2,k,i,state; |
- |
- int current_context = 0; |
- int current_exec = 0; |
- int current_endcycle = 0; |
- |
- int kill_delta = 0; |
- |
- unsigned long long last_tsc, tsc; |
- unsigned long long current_nsec = 0; |
- |
- input_file = fopen(filename,"r"); |
- |
- /* Memory alloc */ |
- exec_list = malloc(sizeof(struct ctx_exec) * MAXJOB); |
- context_list = malloc(sizeof(struct ctx_to_pid) * MAXCONTEXT); |
- ctx_server_list = malloc(sizeof(struct ctx_server) * MAXCONTEXT); |
- |
- endcycle_list = malloc(sizeof(struct task_event) * MAXJOB); |
- deadline_miss_list = malloc(sizeof(struct task_event) * MAXJOB); |
- wcet_miss_list = malloc(sizeof(struct task_event) * MAXJOB); |
- act_list = malloc(sizeof(struct task_event) * MAXJOB); |
- |
- act_server_list = malloc(sizeof(struct server_event) * MAXJOB ); |
- server_budget_end_list = malloc(sizeof(struct server_event) * MAXJOB); |
- |
- |
- /* Finite-State machine |
- * |
- * FS-Machine states: |
- |
- 0 - Start |
- 1 - Context running |
- 2 - Interrupt running |
- |
- 10 - End |
- |
- */ |
- |
- for(i=0;i<MAXCONTEXT;i++) { |
- context_list[i].ctx = 0; |
- context_list[i].pid = PID_NO_DEF; |
- } |
- |
- for(i=0; i<MAXCONTEXT; i++) { |
- ctx_server_list[i].ctx=0; |
- ctx_server_list[i].server_id=SERVER_NO_DEF; |
- |
- } |
- |
- /* The start context + interrupt context */ |
- context_total = 2; |
- current_context = 0; |
- last_tsc = 0; |
- context_list[0].ctx = 0; |
- context_list[0].pid = PID_NO_DEF; |
- context_list[1].ctx = INT_CTX; |
- context_list[1].pid = INT_PID; |
- |
- state = 0; |
- |
- k = 0; |
- while(!feof(input_file)) { |
- |
- fscanf(input_file,"%d %llu",&type,&tsc); |
- k++; |
- |
- switch (type) { |
- |
- case 1: |
- |
- /* No par */ |
- break; |
- |
- case 2: |
- case 3: |
- case 4: |
- case 6: |
- case 7: |
- case 8: |
- case 10: |
- case 11: |
- case 12: |
- case 13: |
- case 14: |
- case 15: |
- /* 1 par */ |
- fscanf(input_file,"%d",&par1); |
- break; |
- |
- case 5: |
- case 9: |
- case 0: |
- case 16: |
- case 17: |
- case 20: |
- case 21: |
- |
- /* 2 par */ |
- fscanf(input_file,"%d %d",&par1,&par2); |
- break; |
- |
- } |
- |
- switch (type) { |
- |
- case 0: |
- if (state != 0) Error(1,k); |
- printf("EVT:Log starts at [%12llu]\n",tsc); |
- last_tsc = tsc; |
- log_start_tsc = tsc; |
- current_nsec = 0; |
- |
- if (par1 == 0) Error(11,k); |
- if (par2 == 0) Error(12,k); |
- |
- current_context = par1; |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- if (i == context_total) { |
- context_list[context_total].ctx = par1; |
- context_total++; |
- } |
- |
- clk_per_msec = par2; |
- |
- exec_list[current_exec].tsc_start = tsc; |
- exec_list[current_exec].nsec_start = current_nsec; |
- state = 1; |
- break; |
- |
- case 1: |
- printf("EVT:Log ends at [%12llu]\n",tsc); |
- exec_list[current_exec].dtsc = tsc - last_tsc; |
- exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
- current_nsec += exec_list[current_exec].dnsec; |
- exec_list[current_exec].ctx = current_context; |
- current_exec++; |
- last_tsc = tsc; |
- log_end_tsc = tsc; |
- total_nsec = current_nsec; |
- state = 10; |
- break; |
- |
- /* Int start */ |
- case 2: |
- if (state == 0) Error(2,k); |
- exec_list[current_exec].dtsc = tsc - last_tsc; |
- exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
- current_nsec += exec_list[current_exec].dnsec; |
- exec_list[current_exec].ctx = current_context; |
- current_exec++; |
- last_tsc = tsc; |
- current_context = INT_CTX; |
- exec_list[current_exec].tsc_start = tsc - log_start_tsc; |
- exec_list[current_exec].nsec_start = current_nsec; |
- state = 2; |
- break; |
- |
- /* Int end */ |
- case 3: |
- if (state != 2) Error(3,k); |
- exec_list[current_exec].dtsc = tsc - last_tsc; |
- exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
- current_nsec += exec_list[current_exec].dnsec; |
- exec_list[current_exec].ctx = current_context; |
- current_exec++; |
- last_tsc = tsc; |
- if (par1 > 16) { |
- current_context = par1; |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- if (i == context_total) { |
- context_list[context_total].ctx = par1; |
- context_total++; |
- } |
- } |
- |
- exec_list[current_exec].tsc_start = tsc; |
- exec_list[current_exec].nsec_start = current_nsec; |
- state = 1; |
- break; |
- |
- /* Change ctx */ |
- case 4: |
- |
- exec_list[current_exec].dtsc = tsc - last_tsc; |
- exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
- current_nsec += exec_list[current_exec].dnsec; |
- exec_list[current_exec].ctx = current_context; |
- current_exec++; |
- last_tsc = tsc; |
- current_context = par1; |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- if (i == context_total) { |
- context_list[context_total].ctx = par1; |
- context_total++; |
- } |
- |
- exec_list[current_exec].tsc_start = tsc; |
- exec_list[current_exec].nsec_start = current_nsec; |
- state = 1; |
- break; |
- |
- /* Task create */ |
- case 5: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) { |
- context_list[i].pid = par2; |
- break; |
- } |
- if (i == context_total) { |
- context_list[context_total].ctx = par1; |
- context_list[context_total].pid = par2; |
- context_total++; |
- } |
- |
- break; |
- |
- /* Task kill */ |
- case 7: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- if (i == context_total) Error(5,k); |
- else { |
- |
- kill_delta += 1000; |
- |
- for (k=0;k<current_endcycle;k++) |
- if (endcycle_list[k].ctx == par1) |
- endcycle_list[k].ctx += kill_delta; |
- for (k=0;k<current_exec;k++) |
- if (exec_list[k].ctx == par1) |
- exec_list[k].ctx += kill_delta; |
- context_list[context_total].ctx = context_list[i].ctx + kill_delta; |
- context_list[context_total].pid = context_list[i].pid; |
- context_total++; |
- |
- if (current_context == par1) current_context += kill_delta; |
- |
- } |
- |
- break; |
- |
- /* Task endcycle */ |
- case 8: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- if (i == context_total) Error(4,k); |
- |
- endcycle_list[current_endcycle].ctx = par1; |
- endcycle_list[current_endcycle].tsc = tsc; |
- endcycle_list[current_endcycle].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
- current_endcycle++; |
- |
- break; |
- |
- /* Task activate */ |
- case 6: |
- |
- act_list[act_total].ctx = par1; |
- act_list[act_total].tsc = tsc; |
- act_list[act_total].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
- act_total++; |
- |
- break; |
- /* Server Create */ |
- case 16: |
- for (i=0;i<ctx_server_total;i++) |
- if (par1 == ctx_server_list[i].ctx) { |
- ctx_server_list[i].server_id = par2; |
- break; |
- } |
- if (i == ctx_server_total) { |
- ctx_server_list[ctx_server_total].ctx = par1; |
- ctx_server_list[ctx_server_total].server_id = par2; |
- ctx_server_total++; |
- } |
- printf("(%d, %d, %d)", ctx_server_total, par1, par2); |
- break; |
- |
- /* Deadline miss */ |
- case 20: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- //if (i == context_total) Error(4,k); |
- |
- deadline_miss_list[deadline_miss].ctx = par1; |
- deadline_miss_list[deadline_miss].tsc = tsc; |
- deadline_miss_list[deadline_miss].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
- deadline_miss++; |
- |
- break; |
- |
- /* Wcet miss */ |
- case 21: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) break; |
- //if (i == context_total) Error(4,k); |
- |
- wcet_miss_list[wcet_miss].ctx = par1; |
- wcet_miss_list[wcet_miss].tsc = tsc; |
- wcet_miss_list[wcet_miss].nsec = current_nsec + (tsc-last_tsc) * 1000000 / clk_per_msec; |
- wcet_miss++; |
- |
- break; |
- |
- /* Task id */ |
- case 9: |
- |
- for (i=0;i<context_total;i++) |
- if (par1 == context_list[i].ctx) { |
- context_list[i].pid = par2; |
- break; |
- } |
- if (i == context_total) { |
- context_list[context_total].ctx = par1; |
- context_list[context_total].pid = par2; |
- context_total++; |
- } |
- |
- break; |
- |
- case 10: |
- |
- exec_list[current_exec].dtsc = tsc - last_tsc; |
- exec_list[current_exec].dnsec = exec_list[current_exec].dtsc * 1000000 / clk_per_msec; |
- current_nsec += exec_list[current_exec].dnsec; |
- exec_list[current_exec].ctx = current_context; |
- current_exec++; |
- last_tsc = tsc; |
- |
- exec_list[current_exec].tsc_start = tsc; |
- exec_list[current_exec].nsec_start = current_nsec; |
- |
- if (!skip_clk_per_msec) clk_per_msec = par1; |
- |
- break; |
- |
- } |
- |
- if (current_exec == MAXJOB-1) { |
- printf("Too many execs...\n"); |
- exit(3); |
- } |
- |
- if (current_endcycle == MAXJOB-1 || act_total == MAXJOB-1 |
- || deadline_miss == MAXJOB-1 || wcet_miss == MAXJOB-1) { |
- printf("Too many jobs...\n"); |
- exit(4); |
- } |
- |
- if (state == 10) break; |
- |
- } |
- |
- endcycle_total = current_endcycle; |
- exec_total = current_exec; |
- |
- return k; |
- |
-} |
- |
-int task_events(int num, int *act, int *dlinemiss, int *wcetmiss) { |
- |
- unsigned long long i; |
- int tmp = 0; |
- |
- *act = 0; |
- *dlinemiss = 0; |
- *wcetmiss = 0; |
- |
- tmp = 0; |
- for (i=0;i<act_total;i++) |
- if (act_list[i].ctx == context_list[num].ctx) tmp++; |
- *act = tmp; |
- tmp = 0; |
- for (i=0;i<deadline_miss;i++) |
- if (deadline_miss_list[i].ctx == context_list[num].ctx) tmp++; |
- *dlinemiss = tmp; |
- tmp = 0; |
- for (i=0;i<wcet_miss;i++) |
- if (wcet_miss_list[i].ctx == context_list[num].ctx) tmp++; |
- *wcetmiss = tmp; |
- |
- return 0; |
- |
-} |
- |
-int create_job_list() { |
- |
- int current_job = 0, h, i, k; |
- int temp_ctx; |
- unsigned long long temp_nsec, endcycle_start_nsec; |
- unsigned long long temp_tsc, endcycle_end_nsec; |
- |
- job_list = malloc(sizeof(struct ctx_exec) * MAXJOB); |
- |
- for (k=0;k<context_total;k++) { |
- |
- temp_ctx = context_list[k].ctx; |
- endcycle_start_nsec = 0; |
- |
- for (h=0;h<endcycle_total;h++) { |
- |
- if (endcycle_list[h].ctx == temp_ctx) { |
- |
- if (endcycle_start_nsec == 0) |
- endcycle_start_nsec = 0; |
- |
- endcycle_end_nsec = endcycle_list[h].nsec; |
- temp_nsec = 0; |
- temp_tsc = 0; |
- |
- job_list[current_job].nsec_start = 0; |
- |
- for(i=0;i<exec_total;i++) |
- if (exec_list[i].ctx == temp_ctx) { |
- if (exec_list[i].nsec_start < endcycle_end_nsec && |
- exec_list[i].nsec_start >= endcycle_start_nsec) { |
- if (job_list[current_job].nsec_start == 0) |
- job_list[current_job].nsec_start = exec_list[i].nsec_start; |
- temp_nsec += exec_list[i].dnsec; |
- temp_tsc += exec_list[i].dtsc; |
- } |
- } |
- |
- job_list[current_job].dtsc = temp_tsc; |
- job_list[current_job].dnsec = temp_nsec; |
- job_list[current_job].ctx = temp_ctx; |
- current_job++; |
- |
- endcycle_start_nsec = endcycle_end_nsec; |
- |
- } |
- |
- } |
- |
- } |
- |
- job_total = current_job; |
- |
- return 0; |
- |
-} |
- |
-int elaborate_statistics(int num, int task_type) { |
- |
- char pidstr[10]; |
- char serverstr[10]; |
- unsigned long long tot_nsec,mean_nsec,max_nsec,min_nsec,first_nsec; |
- int number,act,dlinemiss,wcetmiss; |
- int i=0; |
- |
- switch (context_list[num].pid) { |
- case PID_NO_DEF: |
- sprintf(pidstr,"NODEF"); |
- break; |
- case INT_PID: |
- sprintf(pidstr," INT"); |
- break; |
- default: |
- sprintf(pidstr,"%5d",context_list[num].pid); |
- break; |
- } |
- |
- for (i=0; i<ctx_server_total; i++) { |
- if (ctx_server_list[i].ctx==context_list[num].ctx) { |
- sprintf(serverstr,"%5d", ctx_server_list[i].server_id); |
- break; |
- } |
- } |
- |
- if (i==ctx_server_total) |
- sprintf(serverstr, "NODEF"); |
- |
- |
- if (task_type == BACKGROUND) { |
- |
- printf("Background Task CTX [%5d] PID [%s] SERVER [%s]\n",context_list[num].ctx,pidstr, serverstr); |
- |
- stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
- |
- if (number > 0) { |
- |
- printf(" Total Execution [%12llu ns]\n",tot_nsec); |
- printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
- printf(" after first exec [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
- printf(" Execs Number [%12d ]\n",number); |
- printf(" Min Exec [%12llu ns]\n",min_nsec); |
- printf(" Mean Exec [%12llu ns]\n",mean_nsec); |
- printf(" Max Exec [%12llu ns]\n\n",max_nsec); |
- |
- plot_exec_demand_function(num,pidstr); |
- |
- } else { |
- |
- printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
- |
- } |
- |
- } |
- |
- if (task_type == INTERRUPT) { |
- |
- printf("Interrupts\n"); |
- |
- stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
- |
- if (number > 0) { |
- |
- printf(" Total Execution [%12llu ns]\n",tot_nsec); |
- printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
- printf(" after first int [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
- printf(" Interrupts Number [%12d ]\n",number); |
- printf(" Min Interrupt [%12llu ns]\n",min_nsec); |
- printf(" Mean Interrupt [%12llu ns]\n",mean_nsec); |
- printf(" Max Interrupt [%12llu ns]\n\n",max_nsec); |
- |
- plot_exec_demand_function(num,pidstr); |
- |
- plot_exec_c_distrib(num,max_nsec,pidstr); |
- |
- arr_stats_from_execs(num,&min_nsec,&mean_nsec,&max_nsec); |
- |
- if (max_nsec > 0) { |
- |
- printf(" Min Arr. Delta [%12llu ns]\n",min_nsec); |
- printf(" Mean Arr. Delta [%12llu ns]\n",mean_nsec); |
- printf(" Max Arr. Delta [%12llu ns]\n\n",max_nsec); |
- |
- plot_exec_arr_distrib(num,max_nsec,pidstr); |
- |
- } |
- |
- } else { |
- |
- printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
- |
- } |
- |
- } |
- |
- if (task_type == PERIODICAL) { |
- |
- printf("Periodical Task CTX [%5d] PID [%s] SERVER [%s]\n",context_list[num].ctx,pidstr,serverstr); |
- |
- stats_from_execs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
- |
- if (number > 0) { |
- |
- printf(" Total Execution [%12llu ns]\n",tot_nsec); |
- printf(" Mean CPU Bandwidth [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec)*100.0,'%'); |
- printf(" after first exec [%11f%c ]\n",(double)(tot_nsec)/(double)(total_nsec-first_nsec)*100.0,'%'); |
- printf(" Execs Number [%12d ]\n",number); |
- printf(" Min Exec [%12llu ns]\n",min_nsec); |
- printf(" Mean Exec [%12llu ns]\n",mean_nsec); |
- printf(" Max Exec [%12llu ns]\n\n",max_nsec); |
- |
- plot_exec_demand_function(num,pidstr); |
- |
- stats_from_jobs(num,&tot_nsec,&min_nsec,&mean_nsec,&max_nsec,&first_nsec,&number); |
- |
- printf(" Total Job Exec [%12llu ns]\n",tot_nsec); |
- printf(" Jobs Number [%12d ]\n",number); |
- printf(" Min Job [%12llu ns]\n",min_nsec); |
- printf(" Mean Job [%12llu ns]\n",mean_nsec); |
- printf(" Max Job [%12llu ns]\n\n",max_nsec); |
- |
- task_events(num,&act,&dlinemiss,&wcetmiss); |
- |
- printf(" Activations [%12d ]\n",act); |
- printf(" Deadline Miss [%12d ]\n",dlinemiss); |
- printf(" Wcet Miss [%12d ]\n\n",wcetmiss); |
- |
- plot_job_c_distrib(num,max_nsec,pidstr); |
- |
- arr_stats_from_jobs(num,&min_nsec,&mean_nsec,&max_nsec); |
- |
- if (max_nsec > 0) { |
- |
- printf(" Min Arr. Delta [%12llu ns]\n",min_nsec); |
- printf(" Mean Arr. Delta [%12llu ns]\n",mean_nsec); |
- printf(" Max Arr. Delta [%12llu ns]\n\n",max_nsec); |
- |
- plot_job_arr_distrib(num,max_nsec,pidstr); |
- |
- } |
- |
- } else { |
- |
- printf(" Total Execution [%12llu ns]\n\n",tot_nsec); |
- |
- } |
- |
- } |
- |
- return 0; |
- |
-} |
- |
-int main(int argc, char *argv[]) { |
- |
- int events_total,k,i; |
- int task_type; |
- |
- unsigned long long temp_nsec; |
- |
- srand(getpid()); |
- |
- if (argc < 2) { |
- printf("%s: Enter the input file name \"%s filename.pwc [clk_per_msec]\"\n",argv[0],argv[0]); |
- exit(1); |
- } |
- |
- printf("\n"); |
- |
- if (argc == 3) { |
- skip_clk_per_msec = 1; |
- clk_per_msec = atoi(argv[2]); |
- printf("Clk/msec = %u\n\n",clk_per_msec); |
- } |
- |
- events_total = create_lists(argv[1]); |
- |
- total_tsc = log_end_tsc - log_start_tsc; |
- |
- printf("\nTotal dTSC [%12llu] ns [%12llu]\n", total_tsc, total_nsec); |
- printf("Events [%12d]\n",events_total); |
- printf("Execs [%12d]\n",exec_total); |
- printf("EndCycles [%12d]\n",endcycle_total); |
- printf("Dline miss [%12d]\n",deadline_miss); |
- printf("WCET miss [%12d]\n",wcet_miss); |
- |
- printf("\nPreemption Removing.... \n"); |
- |
- /* Remove preemption from the computation time */ |
- create_job_list(); |
- |
- temp_nsec = 0; |
- for (i=0;i<job_total;i++) |
- temp_nsec += job_list[i].dnsec; |
- |
- printf("Total nsec of jobs [%12llu]\n",temp_nsec); |
- |
- temp_nsec = 0; |
- for (i=0;i<exec_total;i++) |
- temp_nsec += exec_list[i].dnsec; |
- |
- printf("Total nsec of exec [%12llu]\n",temp_nsec); |
- printf("Total nsec considering last clk/msec [%12llu]\n",total_tsc*1000000/clk_per_msec); |
- |
- printf("\nCompute Task Statistics.... \n\n"); |
- |
- for (i=0;i<context_total;i++) { |
- |
- task_type = BACKGROUND; |
- |
- if (context_list[i].ctx == INT_CTX) task_type = INTERRUPT; |
- |
- for (k=0;k<job_total;k++) |
- if (job_list[k].ctx == context_list[i].ctx) { |
- task_type = PERIODICAL; |
- break; |
- } |
- |
- elaborate_statistics(i,task_type); |
- |
- } |
- |
- return 0; |
- |
-} |
- |
Index: demos/branches/xen/newtrace/utils/example_results |
=================================================================== |
--- demos/branches/xen/newtrace/utils/example_results (revision 1684) |
+++ demos/branches/xen/newtrace/utils/example_results (nonexistent) |
@@ -1,382 +0,0 @@ |
-This is an example file from "extract" utility, |
-some comments are added to make it clearer. |
- |
-Jumpball demo (ecp) statistics |
- |
-Clk/msec = 2202900 (CPU Athlon 64 3200+) |
- |
-EVT:Log starts at [147140694139] |
-EVT:Log ends at [196093930505] |
- |
-Total dTSC [ 48953236366] ns [ 22222113928] |
-Events [ 144915] |
-Execs [ 131127] |
-EndCycles [ 13759] |
- |
-Preemption Removing.... |
- |
-Total nsec of jobs [ 3604781671] |
-Total nsec of exec [ 22222113928] |
-Total nsec considering last clk/msec [ 22222178204] |
- |
-Compute Task Statistics.... |
- |
-Interrupts |
- Total Execution [ 29399348 ns] |
- Mean CPU Bandwidth [ 0.132298% ] |
- after first int [ 0.132298% ] |
- Interrupts Number [ 45842 ] |
- Min Interrupt [ 189 ns] |
- Mean Interrupt [ 641 ns] |
- Max Interrupt [ 13056 ns] |
- |
- Min Arr. Delta [ 1881 ns] |
- Mean Arr. Delta [ 484763 ns] |
- Max Arr. Delta [ 10000131 ns] |
- |
-- System Interrupts: All the hardware interrupts |
- |
-Periodical Task CTX [ 256] PID [ 9] |
- Total Execution [ 276253550 ns] |
- Mean CPU Bandwidth [ 1.243147% ] |
- after first exec [ 1.630252% ] |
- Execs Number [ 9335 ] |
- Min Exec [ 240 ns] |
- Mean Exec [ 29593 ns] |
- Max Exec [ 91661 ns] |
- |
- Total Job Exec [ 276253550 ns] |
- Jobs Number [ 1695 ] |
- Min Job [ 162239 ns] |
- Mean Job [ 162981 ns] |
- Max Job [ 164505 ns] |
- |
- Min Arr. Delta [ 4411818 ns] |
- Mean Arr. Delta [ 9999965 ns] |
- Max Arr. Delta [ 15588054 ns] |
- |
-- Task 9 "palla0": Soft Task. The CTX 256 was at the beginning assigned |
-to the "main" task. After the task death, the context was free until the |
-new "palla0" task was created. "main" task context number is converted to |
-1256 to make independent statistics. |
- |
-Background Task CTX [ 264] PID [ 1] |
- Total Execution [ 18583350900 ns] |
- Mean CPU Bandwidth [ 83.625487% ] |
- after first exec [ 83.669980% ] |
- Execs Number [ 16908 ] |
- Min Exec [ 515 ns] |
- Mean Exec [ 1099086 ns] |
- Max Exec [ 9836143 ns] |
- |
-- Task 1 "dummy": The dummy task, it represents the system |
-idle time, near 83% as mean value |
- |
-Background Task CTX [ 272] PID [ 2] |
- Total Execution [ 926 ns] |
- Mean CPU Bandwidth [ 0.000004% ] |
- after first exec [ 100.000000% ] |
- Execs Number [ 1 ] |
- Min Exec [ 926 ns] |
- Mean Exec [ 926 ns] |
- Max Exec [ 926 ns] |
- |
-- Task 2 "shutdown task": Shutting down the system. It closes |
-the tracer too (this is the reason of only 3 us exec time). |
- |
-Periodical Task CTX [ 280] PID [ 3] |
- Total Execution [ 1445626 ns] |
- Mean CPU Bandwidth [ 0.006505% ] |
- after first exec [ 0.006512% ] |
- Execs Number [ 461 ] |
- Min Exec [ 2583 ns] |
- Mean Exec [ 3135 ns] |
- Max Exec [ 4206 ns] |
- |
- Total Job Exec [ 1445626 ns] |
- Jobs Number [ 461 ] |
- Min Job [ 2583 ns] |
- Mean Job [ 3135 ns] |
- Max Job [ 4206 ns] |
- |
- Min Arr. Delta [ 2021387 ns] |
- Mean Arr. Delta [ 48260445 ns] |
- Max Arr. Delta [ 50010461 ns] |
- |
-- Task 3 "interrupt server": The interrupt context |
- |
-Periodical Task CTX [ 288] PID [ 4] |
- Total Execution [ 59506 ns] |
- Mean CPU Bandwidth [ 0.000268% ] |
- after first exec [ 0.000351% ] |
- Execs Number [ 43 ] |
- Min Exec [ 566 ns] |
- Mean Exec [ 1383 ns] |
- Max Exec [ 5850 ns] |
- |
- Total Job Exec [ 59506 ns] |
- Jobs Number [ 17 ] |
- Min Job [ 1217 ns] |
- Mean Job [ 3500 ns] |
- Max Job [ 9358 ns] |
- |
- Min Arr. Delta [ 65650086 ns] |
- Mean Arr. Delta [ 1059090305 ns] |
- Max Arr. Delta [ 7168628909 ns] |
- |
-- Task 4 "key task": The task for keyboard handler |
- |
-Periodical Task CTX [ 296] PID [ 5] |
- Total Execution [ 1201275196 ns] |
- Mean CPU Bandwidth [ 5.405765% ] |
- after first exec [ 5.406917% ] |
- Execs Number [ 825 ] |
- Min Exec [ 11133 ns] |
- Mean Exec [ 1456091 ns] |
- Max Exec [ 4500554 ns] |
- |
- Total Job Exec [ 1201275196 ns] |
- Jobs Number [ 223 ] |
- Min Job [ 5296076 ns] |
- Mean Job [ 5386884 ns] |
- Max Job [ 5515636 ns] |
- |
- Min Arr. Delta [ 99757430 ns] |
- Mean Arr. Delta [ 100006689 ns] |
- Max Arr. Delta [ 101061945 ns] |
- |
-- Task 5 "jetctrl" : Soft task |
- |
-Periodical Task CTX [ 304] PID [ 6] |
- Total Execution [ 4254996 ns] |
- Mean CPU Bandwidth [ 0.019148% ] |
- after first exec [ 0.019156% ] |
- Execs Number [ 446 ] |
- Min Exec [ 1111 ns] |
- Mean Exec [ 9540 ns] |
- Max Exec [ 18912 ns] |
- |
- Total Job Exec [ 4254996 ns] |
- Jobs Number [ 223 ] |
- Min Job [ 18971 ns] |
- Mean Job [ 19080 ns] |
- Max Job [ 21052 ns] |
- |
- Min Arr. Delta [ 95501610 ns] |
- Mean Arr. Delta [ 99979413 ns] |
- Max Arr. Delta [ 102456106 ns] |
- |
-- Task 6 "jetdummy" : Soft Task |
- |
-Periodical Task CTX [ 312] PID [ 7] |
- Total Execution [ 341582118 ns] |
- Mean CPU Bandwidth [ 1.537127% ] |
- after first exec [ 1.537767% ] |
- Execs Number [ 936 ] |
- Min Exec [ 520 ns] |
- Mean Exec [ 364938 ns] |
- Max Exec [ 1300811 ns] |
- |
- Total Job Exec [ 341582118 ns] |
- Jobs Number [ 223 ] |
- Min Job [ 1530776 ns] |
- Mean Job [ 1531758 ns] |
- Max Job [ 1533632 ns] |
- |
- Min Arr. Delta [ 95494710 ns] |
- Mean Arr. Delta [ 99979490 ns] |
- Max Arr. Delta [ 102948741 ns] |
- |
-- Task 7 "jetslice": Soft Task |
- |
-Periodical Task CTX [ 320] PID [ 8] |
- Total Execution [ 361875645 ns] |
- Mean CPU Bandwidth [ 1.628448% ] |
- after first exec [ 1.628782% ] |
- Execs Number [ 6750 ] |
- Min Exec [ 2540 ns] |
- Mean Exec [ 53611 ns] |
- Max Exec [ 92451 ns] |
- |
- Total Job Exec [ 361875645 ns] |
- Jobs Number [ 2222 ] |
- Min Job [ 162349 ns] |
- Mean Job [ 162860 ns] |
- Max Job [ 166904 ns] |
- |
- Min Arr. Delta [ 9989352 ns] |
- Mean Arr. Delta [ 9999971 ns] |
- Max Arr. Delta [ 10010719 ns] |
- |
-- Task 8 "pallaEDF": Hard Task |
- |
-Background Task CTX [ 1256] PID [ 0] |
- Total Execution [ 4573409 ns] |
- Mean CPU Bandwidth [ 0.020580% ] |
- after first exec [ 0.020580% ] |
- Execs Number [ 6 ] |
- Min Exec [ 7166 ns] |
- Mean Exec [ 762234 ns] |
- Max Exec [ 2000656 ns] |
- |
-- Task 0 "main": Main task was killed, so the original context |
-number 256 became 1256 |
- |
-Periodical Task CTX [ 328] PID [ 10] |
- Total Execution [ 270267226 ns] |
- Mean CPU Bandwidth [ 1.216208% ] |
- after first exec [ 1.629184% ] |
- Execs Number [ 8846 ] |
- Min Exec [ 241 ns] |
- Mean Exec [ 30552 ns] |
- Max Exec [ 91592 ns] |
- |
- Total Job Exec [ 270267226 ns] |
- Jobs Number [ 1659 ] |
- Min Job [ 162232 ns] |
- Mean Job [ 162909 ns] |
- Max Job [ 164270 ns] |
- |
- Min Arr. Delta [ 9988124 ns] |
- Mean Arr. Delta [ 9999982 ns] |
- Max Arr. Delta [ 10032718 ns] |
- |
-- Task 10 "palla1": Soft Task |
- |
-Periodical Task CTX [ 336] PID [ 11] |
- Total Execution [ 264105857 ns] |
- Mean CPU Bandwidth [ 1.188482% ] |
- after first exec [ 1.630505% ] |
- Execs Number [ 8949 ] |
- Min Exec [ 239 ns] |
- Mean Exec [ 29512 ns] |
- Max Exec [ 91573 ns] |
- |
- Total Job Exec [ 264105857 ns] |
- Jobs Number [ 1620 ] |
- Min Job [ 162271 ns] |
- Mean Job [ 163028 ns] |
- Max Job [ 164299 ns] |
- |
- Min Arr. Delta [ 9989381 ns] |
- Mean Arr. Delta [ 9999964 ns] |
- Max Arr. Delta [ 10010620 ns] |
- |
-- Task 11 "palla2": Soft Task |
- |
-Periodical Task CTX [ 344] PID [ 12] |
- Total Execution [ 257971822 ns] |
- Mean CPU Bandwidth [ 1.160879% ] |
- after first exec [ 1.634880% ] |
- Execs Number [ 10631 ] |
- Min Exec [ 238 ns] |
- Mean Exec [ 24265 ns] |
- Max Exec [ 63831 ns] |
- |
- Total Job Exec [ 257971822 ns] |
- Jobs Number [ 1578 ] |
- Min Job [ 162684 ns] |
- Mean Job [ 163480 ns] |
- Max Job [ 164782 ns] |
- |
- Min Arr. Delta [ 9989399 ns] |
- Mean Arr. Delta [ 9999963 ns] |
- Max Arr. Delta [ 10010599 ns] |
- |
-- Task 12 "palla3": Soft Task |
- |
-Periodical Task CTX [ 352] PID [ 13] |
- Total Execution [ 250406676 ns] |
- Mean CPU Bandwidth [ 1.126836% ] |
- after first exec [ 1.630586% ] |
- Execs Number [ 8461 ] |
- Min Exec [ 240 ns] |
- Mean Exec [ 29595 ns] |
- Max Exec [ 91753 ns] |
- |
- Total Job Exec [ 250406676 ns] |
- Jobs Number [ 1536 ] |
- Min Job [ 162225 ns] |
- Mean Job [ 163025 ns] |
- Max Job [ 164557 ns] |
- |
- Min Arr. Delta [ 3184436 ns] |
- Mean Arr. Delta [ 9999970 ns] |
- Max Arr. Delta [ 16815492 ns] |
- |
-- Task 13 "palla4": Soft Task |
- |
-Periodical Task CTX [ 360] PID [ 14] |
- Total Execution [ 132048658 ns] |
- Mean CPU Bandwidth [ 0.594222% ] |
- after first exec [ 1.631180% ] |
- Execs Number [ 4462 ] |
- Min Exec [ 244 ns] |
- Mean Exec [ 29594 ns] |
- Max Exec [ 91702 ns] |
- |
- Total Job Exec [ 132048658 ns] |
- Jobs Number [ 810 ] |
- Min Job [ 162240 ns] |
- Mean Job [ 163023 ns] |
- Max Job [ 164337 ns] |
- |
- Min Arr. Delta [ 4934088 ns] |
- Mean Arr. Delta [ 9999968 ns] |
- Max Arr. Delta [ 15066505 ns] |
- |
-- Task 14 "palla5": Soft Task |
- |
-Periodical Task CTX [ 368] PID [ 15] |
- Total Execution [ 125033245 ns] |
- Mean CPU Bandwidth [ 0.562652% ] |
- after first exec [ 1.632032% ] |
- Execs Number [ 4239 ] |
- Min Exec [ 242 ns] |
- Mean Exec [ 29495 ns] |
- Max Exec [ 91828 ns] |
- |
- Total Job Exec [ 125033245 ns] |
- Jobs Number [ 767 ] |
- Min Job [ 162266 ns] |
- Mean Job [ 163015 ns] |
- Max Job [ 164284 ns] |
- |
- Min Arr. Delta [ 9187114 ns] |
- Mean Arr. Delta [ 9999969 ns] |
- Max Arr. Delta [ 10802835 ns] |
- |
-- Task 15 "palla6": Soft Task |
- |
-Periodical Task CTX [ 376] PID [ 16] |
- Total Execution [ 118201550 ns] |
- Mean CPU Bandwidth [ 0.531910% ] |
- after first exec [ 1.631159% ] |
- Execs Number [ 3985 ] |
- Min Exec [ 244 ns] |
- Mean Exec [ 29661 ns] |
- Max Exec [ 91622 ns] |
- |
- Total Job Exec [ 118201550 ns] |
- Jobs Number [ 725 ] |
- Min Job [ 162270 ns] |
- Mean Job [ 163036 ns] |
- Max Job [ 164089 ns] |
- |
- Min Arr. Delta [ 7797571 ns] |
- Mean Arr. Delta [ 9999955 ns] |
- Max Arr. Delta [ 12192001 ns] |
- |
-- Task 16 "palla7": Soft Task |
- |
-Background Task CTX [ 248] PID [NODEF] |
- Total Execution [ 7674 ns] |
- Mean CPU Bandwidth [ 0.000035% ] |
- after first exec [ 72.711768% ] |
- Execs Number [ 1 ] |
- Min Exec [ 7674 ns] |
- Mean Exec [ 7674 ns] |
- Max Exec [ 7674 ns] |
- |
-- Global context: the kernel context |
- |
Index: demos/branches/xen/newtrace/utils/list.c |
=================================================================== |
--- demos/branches/xen/newtrace/utils/list.c (revision 1684) |
+++ demos/branches/xen/newtrace/utils/list.c (nonexistent) |
@@ -1,112 +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> |
- * |
- * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
- * |
- * http://www.sssup.it |
- * http://retis.sssup.it |
- * http://shark.sssup.it |
- * http://robot.unipv.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 <stdio.h> |
-#include <unistd.h> |
-#include <stdlib.h> |
-#include <string.h> |
- |
-#define READ_BUFFER 2000 |
-#define DELTA_BUFFER 100 |
- |
-int main(int argc, char *argv[]) |
-{ |
- |
- char buffer[READ_BUFFER+DELTA_BUFFER]; |
- void *p, *last; |
- int n,delta,size; |
- |
- unsigned long long tsc_value; |
- |
- unsigned long long ev = 0; |
- |
- FILE *input_file; |
- |
- if (argc < 2) { |
- printf("%s: Enter the input file name [%s filename]\n",argv[0],argv[0]); |
- exit(1); |
- } |
- |
- input_file = fopen(argv[1],"rb"); |
- |
- last = buffer + READ_BUFFER; |
- |
- while(!feof(input_file)) { |
- |
- //move remaining byte |
- delta = (unsigned int)(buffer) + READ_BUFFER - (unsigned int)(last); |
- if (delta > 0) memcpy(buffer,last,delta); |
- |
- n = fread(buffer+delta,1,READ_BUFFER+10,input_file); |
- fseek(input_file,-(delta+10),SEEK_CUR); |
- |
- p = buffer; |
- |
- while ((unsigned int)(p) + 16 <= (unsigned int)(buffer + READ_BUFFER) && |
- (unsigned int)(p) + 16 <= (unsigned int)(buffer + n + delta)) { |
- |
- printf("%08d Type = %02x ",(unsigned int)ev,*(unsigned short int *)(p)); |
- |
- tsc_value = (unsigned long long)(*(unsigned int *)(p+4)) << 32; |
- tsc_value += (unsigned long long)(*(unsigned int *)(p+8)); |
- |
- printf("TSC = %llu (%08x:%08x)",tsc_value, *(unsigned int *)(p+4),*(unsigned int *)(p+8)); |
- |
- size = 16; |
- |
- printf(" Par1 = %11d",*(unsigned short int *)(p+2)); |
- printf(" Par2 = %11d\n",*(unsigned int *)(p+12)); |
- |
- ev++; |
- |
- p += 16; |
- |
- if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
- |
- last = p; |
- |
- } |
- |
- if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
- |
- } |
- |
- fclose(input_file); |
- |
- return 0; |
- |
-} |
- |
Index: demos/branches/xen/newtrace/utils/pwcet_gen.c |
=================================================================== |
--- demos/branches/xen/newtrace/utils/pwcet_gen.c (revision 1684) |
+++ demos/branches/xen/newtrace/utils/pwcet_gen.c (nonexistent) |
@@ -1,275 +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 <stdio.h> |
-#include <unistd.h> |
-#include <stdlib.h> |
-#include <string.h> |
- |
-#include <FTrace.h> |
- |
-#define READ_BUFFER 2000 |
-#define DELTA_BUFFER 100 |
- |
-int main(int argc, char *argv[]) |
-{ |
- |
- char buffer[READ_BUFFER+DELTA_BUFFER]; |
- void *p, *last; |
- int n,delta,size,tsc; |
- |
- unsigned long long ev = 0, tsc_value; |
- |
- FILE *input_file; |
- |
- if (argc < 2) { |
- printf("%s: Enter the input file name [%s filename]\n",argv[0],argv[0]); |
- exit(1); |
- } |
- |
- input_file = fopen(argv[1],"rb"); |
- |
- last = buffer + READ_BUFFER; |
- |
- while(!feof(input_file)) { |
- |
- //move remaining byte |
- delta = (unsigned int)(buffer) + READ_BUFFER - (unsigned int)(last); |
- if (delta > 0) memcpy(buffer,last,delta); |
- |
- n = fread(buffer+delta,1,READ_BUFFER+10,input_file); |
- fseek(input_file,-(delta+10),SEEK_CUR); |
- |
- p = buffer; |
- /* |
- // specific server events |
- #define FTrace_EVT_server_create 0x08 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_replenish 0x18 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_exhaust 0x28 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_reclaiming 0x38 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_remove 0x48 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_active 0x58 // Par1 [empty] Par2 [server] |
- #define FTrace_EVT_server_using_rec 0x68 // Par1 [reclaiming] Par2 [server] |
- */ |
- |
- while ((unsigned int)(p) + 16 <= (unsigned int)(buffer + READ_BUFFER) && |
- (unsigned int)(p) + 16 <= (unsigned int)(buffer + n + delta)) { |
- |
- tsc = 0; |
- |
- switch (*(unsigned short int *)(p) & 0x00FF) { |
- |
- case FTrace_EVT_ipoint: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- tsc = 1; |
- break; |
- |
- /* Tracer start */ |
- case FTrace_EVT_trace_start: |
- printf("0 "); |
- tsc = 1; |
- break; |
- |
- /* Tracer stop */ |
- case FTrace_EVT_trace_stop: |
- printf("1 "); |
- tsc = 1; |
- break; |
- |
- /* Interrupt start (int num) */ |
- case FTrace_EVT_timer_wakeup_start: |
- case FTrace_EVT_interrupt_start: |
- printf("2 "); |
- tsc = 1; |
- break; |
- |
- /* Interrupt Stop (int num, or context num is int 3) */ |
- case FTrace_EVT_timer_wakeup_end: |
- case FTrace_EVT_interrupt_end: |
- printf("3 "); |
- tsc = 1; |
- break; |
- |
- /* Context to (context num) */ |
- case FTrace_EVT_context_switch: |
- printf("4 "); |
- tsc = 1; |
- break; |
- |
- /* Task Create (context num, pid num) */ |
- case FTrace_EVT_task_create: |
- printf("5 "); |
- tsc = 1; |
- break; |
- |
- /* Task Activate (context num) */ |
- case FTrace_EVT_task_activate: |
- printf("6 "); |
- tsc = 1; |
- break; |
- |
- /* Task End (context num) */ |
- case FTrace_EVT_task_end: |
- printf("7 "); |
- tsc = 1; |
- break; |
- |
- /* Task End-Cycle (context num) */ |
- case FTrace_EVT_task_end_cycle: |
- printf("8 "); |
- tsc = 1; |
- break; |
- |
- /* Task Context - PID declaration */ |
- case FTrace_EVT_id: |
- printf("9 "); |
- tsc = 1; |
- break; |
- |
- case FTrace_EVT_cycles_per_msec: |
- printf("10 "); |
- tsc = 1; |
- break; |
- // specific server events |
- |
- case FTrace_EVT_server_active: |
- printf("16 "); |
- tsc=1; |
- break; |
- |
- case FTrace_EVT_task_deadline_miss: |
- printf("20 "); |
- tsc = 1; |
- break; |
- |
- case FTrace_EVT_task_wcet_violation: |
- printf("21 "); |
- tsc = 1; |
- break; |
- |
- } |
- |
- tsc_value = (unsigned long long)(*(unsigned int *)(p+4)) << 32; |
- tsc_value += (unsigned long long)(*(unsigned int *)(p+8)); |
- |
- if (tsc == 1) { |
- |
- printf("%llu ",tsc_value); |
- |
- switch (*(unsigned short int *)(p) & 0x00FF) { |
- |
- case FTrace_EVT_trace_start: |
- printf("%d %d ",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_interrupt_start: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_timer_wakeup_start: |
- printf("%d ",0); |
- break; |
- |
- case FTrace_EVT_timer_wakeup_end: |
- case FTrace_EVT_interrupt_end: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_context_switch: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_task_create: |
- printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_task_deadline_miss: |
- printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_task_wcet_violation: |
- printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_task_activate: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_task_end_cycle: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_task_end: |
- printf("%d ",*(unsigned short int *)(p+2)); |
- break; |
- |
- case FTrace_EVT_id: |
- printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_cycles_per_msec: |
- printf("%d ",*(unsigned int *)(p+12)); |
- break; |
- |
- case FTrace_EVT_server_active: |
- printf("%d %d",*(unsigned short int *)(p+2),*(unsigned int *)(p+12)); |
- break; |
- } |
- |
- printf("\n"); |
- |
- } |
- |
- size = 16; |
- |
- ev++; |
- |
- p += 16; |
- |
- if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
- |
- last = p; |
- |
- } |
- |
- if ((unsigned int)(p) + 10 > (unsigned int)(buffer + n + delta)) break; |
- |
- } |
- |
- fclose(input_file); |
- |
- return 0; |
- |
-} |
- |
Index: demos/branches/xen/newtrace/utils/README |
=================================================================== |
--- demos/branches/xen/newtrace/utils/README (revision 1684) |
+++ demos/branches/xen/newtrace/utils/README (nonexistent) |
@@ -1,19 +0,0 @@ |
-Utility usage: |
- |
-1) udpdump: ./udpdump dumptest |
- |
- - It receives all the UDP tracer packets, |
- saving them inside the "dumptest" file |
- |
-2) pwcet_gen: ./pwcet_gen dumptest > dumptest.pwc |
- |
- - It converts the binary file to a text |
- version with only significative tracer events |
- |
-3) extract: ./extract dumptest.pwc |
- |
- - It shows all the recorded tasks main |
- statistics, usign also "gnuplot" to display |
- execution time distributions, inter-arrival times, |
- and task demand functions. |
- |
Index: demos/branches/xen/newtrace/utils/makefile |
=================================================================== |
--- demos/branches/xen/newtrace/utils/makefile (revision 1684) |
+++ demos/branches/xen/newtrace/utils/makefile (nonexistent) |
@@ -1,36 +0,0 @@ |
-# |
-# util_linux -> compiles the tracer utilities under Linux |
-# |
- |
-ifndef BASE |
-BASE=../../.. |
-endif |
- |
-.PHONY: util_dos util_linux clean |
- |
-all: |
- @echo Targets: util_dos util_linux clean |
- @echo Note: udpdump and list are available only under linux |
- |
-util_linux: udpdump list pwcet_gen extract |
- |
-udpdump: udpdump.c |
- gcc -Wimplicit-function-declaration -Wall -ggdb\ |
- -I$(BASE)/tracer/include -I$(BASE)/oslib udpdump.c -o udpdump |
- |
-list: list.c |
- gcc -Wimplicit-function-declaration -Wall -ggdb\ |
- -I$(BASE)/tracer/include -I$(BASE)/oslib list.c -o list |
- |
-pwcet_gen: pwcet_gen.c |
- gcc -Wimplicit-function-declaration -Wall -ggdb\ |
- -I$(BASE)/tracer/include -I$(BASE)/oslib pwcet_gen.c -o pwcet_gen |
- |
-extract: extract.c |
- gcc -Wimplicit-function-declaration -Wall -ggdb -lm\ |
- -I$(BASE)/tracer/include -I$(BASE)/oslib extract.c -o extract |
- |
-clean: |
- rm -rf *.o udpdump list pwcet_gen extract |
- |
- |
Index: demos/branches/xen/newtrace/utils/test |
=================================================================== |
--- demos/branches/xen/newtrace/utils/test (revision 1684) |
+++ demos/branches/xen/newtrace/utils/test (nonexistent) |
@@ -1,919 +0,0 @@ |
- ®'¿¨{ ` Á(¿¨ ` *¿¨ ` ?+¿¨ ` ,¿¨ ` À-¿¨ ( Á¨ ( !Á¨ ,Á¨ W8Á¨ ( $:Á¨ BÁ¨ ( OÁ¨( SÁ¨ ( ÂXÁ¨ Á¨ ËïÁ¨ b ( õÁ¨ ,ùÁ¨ 0ûÁ¨ Ä Â¨ B HV¨ =d¨ Ih¨ 'j¨ + 4tø¨ iø¨ ø¨ Íø¨ ; Yø¨ ¶ø¨ b ؽø¨ PÁø¨ lÂø¨ + -ù¨ Û1ù¨ B4ù¨ ( n5ù¨ ( "8ù¨( ï:ù¨ ; ( |
->ù¨ èù¨ >ù¨ b ( àù¨ ¯ù¨ Çù¨ + 0© ; ¦0© + =1© Ô?1© B1© ( >C1© ( ÈE1©( uG1© ; ( {I1© ¶1© Ù 1© b ( £1© ä1© Ð¥1© + Oi© ÂQi© Ti© ( (Ui© ( Wi©( Yi© ; ( ÿZi© §¯i© ¥±i© b ( ɳi© µi© ¶i© + %c¡© Xe¡© g¡© ( °h¡© ( k¡©( l¡© ; ( n¡© á© öÄ¡© b ( Ç¡© ÌÈ¡© ÙÉ¡© + uÙ© MwÙ© yÙ© ( ¸zÙ© ( }Ù©( ~Ù© ; ( Ù© DÕÙ© 5×Ù© b ( ½ØÙ© rÚÙ© ÛÙ© + Ϫ Òª Ôª ïÖª ; Úª ¡ãª b .çª Ñèª àéª + ˪ ,ª oª ( £ª ( ª( Áª ; ( ôª §éª ìëª b ( síª 2ïª Aðª + èHª ; ¥êHª + >Iª Iª ÖIª ( ú Iª ( £Iª( 7¥Iª ; ( 1§Iª üIª þIª b ( F Jª Jª
-Jª + 3®ª p°ª IJª ( 볪 ( K¶ª( Í·ª ; ( ¾¹ª 3ª %ª b ( Iª |
-ª ª + 6À¹ª h¹ª Ĺª ( ¸Å¹ª ( ȹª( ɹª ; ( ˹ª & ºª "ºª b ( ;$ºª ò%ºª ÿ&ºª + Óñª ÑÕñª 'Øñª ( CÙñª ( Ûñª( Ýñª ; (
-ßñª 3òª 5òª b ( 7òª Æ8òª Õ9òª + ü+)« ¹.)« å0)« ³3)« ; Ñ6)« Q@)« b C)« ?E)« NF)« + úå)« [è)« Cë)« ( Wì)« ( °î)«( ^ð)« ; ( ò)« JH*« °J*« b ( 8L*« ýM*« O*« + êCa« ; Fa« + øa« Øúa« ýa« ( :þa« ( b«( (b« ; ( ,b« ÍXb« ÌZb« b ( ü\b« ±^b« Í_b« + R« « ׫ ( è« ( H«( É« ; ( º« <l« -n« b ( Qp« r« s« + ?Ò« m Ò« ¡"Ò« ( ¹#Ò« ( &Ò«( 'Ò« ; ( )Ò« ÷}Ò« éÒ« b (
-Ò« ÃÒ« ÐÒ« + e1 |
-¬ ¦3 |
-¬ í5 |
-¬ ( ø6 |
-¬ ( K9 |
-¬( Ì: |
-¬ ; ( Î< |
-¬ t |
-¬ h |
-¬ b ( ð |
-¬ § |
-¬ ¶ |
-¬ + IA¬ |
-A¬ A¬ ×A¬ ; øA¬ aA¬ b ©¢A¬ X¤A¬ g¥A¬ + °CB¬
-FB¬ lHB¬ ( IB¬ ( õKB¬( ¤MB¬ ; ( ÃOB¬ +¥B¬ n§B¬ b ( ç¨B¬ ¦ªB¬ µ«B¬ + £y¬ ; ,¦y¬ + ÆVz¬ Yz¬ C[z¬ ( Z\z¬ ( ¸^z¬( U`z¬ ; ( Zbz¬ .·z¬ S¹z¬ b ( y»z¬ 3½z¬ O¾z¬ + hi²¬ °k²¬ n²¬ ( 8o²¬ ( ×q²¬( is²¬ ; ( Zu²¬ ¥É²¬ Ó˲¬ b ( β¬ µÏ²¬ Äв¬ + `}ê¬ ê¬ ×ê¬ ( ûê¬ ( ~
ê¬( ê¬ ; ( õê¬ QÝê¬ Gßê¬ b ( káê¬ "ãê¬ /äê¬ + X" " à" ( ü" ( O"( Ñ" ; ( Æ" ï" ñ" b ( ºò" lô" {õ" + ôèY ±ëY ÉíY ðY ; ³óY #ýY b i Z Z Z + Ü¢Z >¥Z §Z ( ¨¨Z ( «Z( ¬Z ; ( ήZ [ {[ b ( þ[ à [ Ò |
-[ + $ ; Ç + ѵ ¸ Pº ( g» ( º½( U¿ ; ( [Á á Ý b ( Ç ã + ïÇÊ 0ÊÊ tÌÊ (
ÍÊ ( åÏÊ( fÑÊ ; ( YÓÊ §'Ë )Ë b ( Þ+Ë -Ë .Ë + Û® IÝ® }ß® ( à® ( öâ®( wä® ; ( hæ® :® <® b ( Ó>® @® A® + î:® Qð:® ò:® ( £ó:® ( öõ:®( w÷:® ; ( yù:® ÔM;® ÅO;® b ( lQ;® S;® .T;® + 7Fr® ÿHr® Kr® ÖMr® ; õPr® ¿[r® b _r® ¨`r® ·ar® + s® {s® Ás® ( ës® ( Js®( ë s® ; ( s® Aas®
cs® b ( es® Çfs® Ögs® + /^ª® ; Ò`ª® + Ü«® !«® d«® ( «® ( Ü«®( w«® ; ( q«® )s«® -u«® b ( bw«® y«® )z«® + &ã® ê(ã® 3+ã® ( Z,ã® ( º.ã®( <0ã® ; ( -2ã® ã® ã® b ( Ìã® yã® ã® + 8¯ Ì:¯ =¯ ( >¯ ( {@¯( þA¯ ; ( óC¯ n¯ _¯ b ( ¢¯ Y¯ f¯ + ÜKS¯ NS¯ dPS¯ ( QS¯ ( ÓSS¯( UUS¯ ; ( FWS¯ ЫS¯ ÄS¯ b ( k¯S¯ ±S¯ ,²S¯ + 4¤¯ õ¦¯
-©¯ ᫯ ; ý®¯ ¹¯ b ȼ¯ k¾¯ z¿¯ + '^¯ `¯ Øb¯ ( ìc¯ ( Ef¯( ág¯ ; ( j¯ ¿¯ çÁ¯ b ( yï >ů MƯ + ¼Â¯ ; 3¿Â¯ + =qï ~sï ¼uï ( Óvï ( &yï( Ázï ; ( Ç|ï hÑï gÓï b ( Õï Q×ï mØï + |û¯ ½
û¯ û¯ ( û¯ ( rû¯( óû¯ ; ( æû¯ [ãû¯ Låû¯ b ( çû¯ Féû¯ Uêû¯ + É3° ÷3° +3° ( C3° ( ¤3°( % 3° ; ( ¢3° ö3° tø3° b ( ·ú3° sü3° ý3° + ð©k° 1¬k° x®k° ( ¯k° ( Ö±k°( W³k° ; ( Yµk° å l° Öl° b ( }
-l° 0l° ?l° + H£° £° £° Ò £° ; ñ£° Z£° b £° C£° R£° + ¼£° m¾£° ³À£° ( ÝÁ£° ( <Ä£°( ÝÅ£° ; ( êÇ£° ᤰ % ¤° b ( ¨!¤° g#¤° v$¤° + ÏÛ° ; rÛ° + |ÏÛ° ÁÑÛ° ÔÛ° ( )ÕÛ° ( |×Û°( ÙÛ° ; ( ÛÛ° å/Ü° æ1Ü° b ( 4Ü° Õ5Ü° â6Ü° + øá± 5ä± ~æ± ( ¥ç± ( ê±( ë± ; ( xí± èA± ÚC± b ( F± ÏG± ÞH± + VõK± ÷K± ÆùK± ( ÞúK± ( =ýK±( ¿þK± ; ( ´ L± EUL± 6WL± b ( yYL± 0[L± =\L± + H±
± б ( ì± ( ?±( Á± ; ( ²± <g± 0i± b ( ×j± l± m± + a»± Îc»± æe»± ¼h»± ; Úk»± Ku»± b x»± 4z»± C{»± + ¼± d¼± ´¼± ( È ¼± ( !#¼±( ½$¼± ; ( ê&¼± M|¼± ³~¼± b ( E¼± |
-¼± ¼± + \yó± ; ÿ{ó± + .ô± J0ô± 2ô± ( 3ô± ( ò5ô±( 7ô± ; ( 9ô± 4ô± 3ô± b ( hô± ô± 9ô± + H@,² B,² ÍD,² ( ÞE,² ( >H,²( ¿I,² ; ( ²K,² 2 ,² #¢,² b ( f¤,² ¦,² ,§,² + 5Rd² cTd² Vd² ( ¯Wd² ( Zd²( [d² ; ( ]d² î±d² à³d² b ( #¶d² Ù·d² æ¸d² + \e² g² äi² ( ïj² ( Bm²( Ãn² ; ( Åp² QŲ BDz b ( éȲ ʲ «Ë² + $¿Ó² áÁÓ² íÃÓ² ®ÆÓ² ; ÍÉÓ² 1ÓÓ² b wÖÓ² ØÓ² )ÙÓ² + öxÔ² S{Ô² }Ô² ( Ã~Ô² ( "Ô²( ÃÔ² ; ( éÔ² rÚÔ² ºÜÔ² b ( =ÞÔ² üßÔ² áÔ² + m׳ ; Ú³ + ¬³ ñ³ 4³ ( Y³ ( ¬³( G³ ; ( A³ $ë³ (í³ b ( ]ï³ ñ³ $ò³ + £D³ à D³ )£D³ ( P¤D³ ( °¦D³( 2¨D³ ; ( #ªD³ þD³ E³ b ( ÂE³ oE³ ~E³ + °|³ ²|³ ú´|³ ( ¶|³ ( q¸|³( ó¹|³ ; ( ä»|³ _}³ P}³ b ( }³ J}³ W}³ + Íô³ |
-Æ´³ UÈ´³ ( qÉ´³ ( ÄË´³( FÍ´³ ; ( ;Ï´³ Æ#µ³ º%µ³ b ( a'µ³ )µ³ "*µ³ + ì³ \ ì³ "ì³ V%ì³ ; t(ì³ ß1ì³ b %5ì³ È6ì³ ×7ì³ + -Öì³ Øì³ áÚì³ ( õÛì³ ( NÞì³( êßì³ ; ( âì³ 7í³ þ9í³ b ( ;í³ U=í³ d>í³ + 6$´ ; º8$´ + Té$´ ë$´ Óí$´ ( êî$´ ( =ñ$´( Øò$´ ; ( äô$´
I%´ K%´ b ( ¶M%´ kO%´ P%´ + û\´ Ôý\´ ]´ ( )]´ ( ]´( |
-]´ ; ( ý]´ }[]´ n]]´ b ( ±_]´ ha]´ wb]´ + ë´ ´ M´ ( e´ ( Ä´( E´ ; ( 8´ ¤n´ p´ b ( Ùr´ t´ u´ + "Í´ S$Í´ &Í´ ( ¥'Í´ ( ø)Í´( y+Í´ ; ( {-Í´ Í´ øÍ´ b (
Í´ RÍ´ aÍ´ + jzµ '}µ 3µ ôµ ;
µ |µ b µ eµ tµ + ;4µ 6µ Õ8µ ( ÿ9µ ( ^<µ( ÿ=µ ; ( @µ µ õ b ( Fµ µ µ + m<µ ; <µ + G=µ eI=µ ¨K=µ ( ÍL=µ ( O=µ( »P=µ ; ( µR=µ §=µ ©=µ b ( ¿«=µ y=µ ®=µ + Yuµ Ù[uµ "^uµ ( I_uµ ( ©auµ( +cuµ ; ( euµ ¹uµ »uµ b ( ƽuµ x¿uµ Àuµ + ÿlµ 1oµ iqµ ( rµ ( àtµ( bvµ ; ( Wxµ é̵ Úε b ( ѵ ÔÒµ áÓµ + Wåµ åµ ßåµ ( û
åµ ( Nåµ( Ðåµ ; ( Ååµ Pàåµ Dâåµ b ( ëãåµ ååµ ¬æåµ + ´Ø¶ qÛ¶ ݶ `ච; ~㶠èì¶ b .ð¶ Ññ¶ àò¶ + §¶ ¶ X¶ ( l¶ ( Ŷ( a¶ ; ( ¶ åó¶ Jö¶ b ( Ü÷¶ ¡ù¶ °ú¶ + ôðT¶ ; óT¶ + ¡¥U¶ â§U¶ ªU¶ ( 7«U¶ ( U¶( %¯U¶ ; ( +±U¶ ÍV¶ ÉV¶ b ( þ V¶ ³V¶ ÏV¶ + Û·¶ º¶ `¼¶ ( q½¶ ( Ñ¿¶( RÁ¶ ; ( Eö Ŷ ¶¶ b ( ù¶ °¶ ¿¶ + 3ËŶ aÍŶ ÏŶ ( ÐŶ ( ÓŶ( ÔŶ ; ( ÖŶ ì*ƶ Þ,ƶ b ( !/ƶ ×0ƶ ä1ƶ + ZÞý¶ àý¶ ââý¶ ( íãý¶ ( @æý¶( Áçý¶ ; ( Ãéý¶ O>þ¶ @@þ¶ b ( çAþ¶ Cþ¶ ©Dþ¶ + ²65· o95· ;5· P>5· ; qA5· ÅJ5· b N5· ¨O5· ·P5· + ð5· öò5· <õ5· ( fö5· ( Åø5·( fú5· ; ( ü5· R6· GT6· b ( ÊU6· W6· X6· + òNm· ; Qm· + n· än· 'n· ( L n· ( n·( :
-n· ; ( 4n· dn· fn· b ( Phn· |
-jn· kn· + +¦· h¦· ±¦· ( ئ· ( 8¦·( º¦· ; ( «!¦· v¦· x¦· b ( Jz¦· ÷{¦· }¦· + )Þ· µ+Þ· í-Þ· ( /Þ· ( d1Þ·( æ2Þ· ; ( ×4Þ· WÞ· HÞ· b ( Þ· BÞ· OÞ· + Z;¸ =¸ â?¸ ( þ@¸ ( QC¸( ÓD¸ ; ( ÄF¸ N¸ B¸ b ( é¸ ¸ ª¡¸ + #M¸ æM¸ þM¸ ÌM¸ ; ìM¸ #ªM¸ b iM¸ ¯M¸ °M¸ + ON¸ vQN¸ ÍSN¸ ( áTN¸ ( :WN¸( ÖXN¸ ; ( [N¸ °N¸ õ²N¸ b ( ´N¸ L¶N¸ [·N¸ +
¸ ; B°
¸ + Ü`¸ c¸ [e¸ ( rf¸ ( Åh¸( `j¸ ; ( fl¸ Á¸ ø b ( ;Ÿ ðƸ ȸ + t¾¸ Çv¾¸ y¾¸ ( z¾¸ ( ||¾¸( ý}¾¸ ; ( 𾸠`Ô¾¸ QÖ¾¸ b ( ؾ¸ KÚ¾¸ ZÛ¾¸ + cö¸ ö¸ Åö¸ ( Ýö¸ ( >ö¸( ¿ö¸ ; ( °ö¸ æö¸
-èö¸ b ( Pêö¸ ìö¸ íö¸ + .¹ Ê.¹ .¹ ( .¹ ( o¡.¹( ð¢.¹ ; ( ò¤.¹ ~ù.¹ oû.¹ b ( ý.¹ Íþ.¹ Üÿ.¹ + Róe¹ öe¹ øe¹ Üúe¹ ; ûýe¹ df¹ b ª |
-f¹ Mf¹ \
-f¹ + #f¹ w¯f¹ ½±f¹ ( ç²f¹ ( Fµf¹( ç¶f¹ ; ( ð¸f¹ gg¹ «g¹ b ( .g¹ íg¹ üg¹ + U¹ ; ø
-¹ + À¹ G¹ Ĺ ( ¯Å¹ ( ȹ( ɹ ; ( ˹ k ¹ l"¹ b ( ¡$¹ [&¹ h'¹ + ~ÒÖ¹ »ÔÖ¹ ×Ö¹ ( +ØÖ¹ ( ÚÖ¹(
-ÜÖ¹ ; ( þÝÖ¹ n2×¹ `4×¹ b ( £6×¹ U8×¹ d9×¹ + qäº £æº Ûèº ( óéº ( Rìº( Ôíº ; ( Éïº [Dº LFº b ( Hº FJº SKº + É÷Fº úFº QüFº ( mýFº ( ÀÿFº( BGº ; ( 7Gº ÂWGº ¶YGº b ( ][Gº ]Gº ^Gº + Q~º TT~º lV~º 9Y~º ; U\~º ¿e~º b i~º ¨j~º ·k~º + |
-º oº ƺ ( Úº ( 3º( Ϻ ; ( º Wkº ¼mº b ( Noº qº "rº + ×i¶º ; zl¶º + ·º T·º !·º ( ©"·º ( ü$·º( &·º ; ( (·º ?}·º ;·º b ( p·º %·º A·º + ¸0ïº ù2ïº =5ïº ( N6ïº ( ®8ïº( /:ïº ; ( "<ïº ¢ïº ïº b ( Öïº ïº ïº + ¥B'» ÓD'» G'» ( H'» ( J'»( L'» ; ( òM'» ^¢'» P¤'» b ( ¦'» E¨'» R©'» + ÌU_»
-X_» TZ_» ( _[_» ( ²]_»( 3__» ; ( 5a_» Áµ_» ²·_» b ( Y¹_» »_» ¼_» + ¯» U²» u´» 6·» ; Yº» ¼Ã» b Ç» ¥È» ´É» + h» nj» ´l» ( Þm» ( =p»( Þq» ; ( t» É» ÊË» b ( MÍ» Ï» л + åÇλ ; Êλ + !{Ï» f}Ï» ©Ï» ( ÎÏ» ( !Ï»( ¼Ï» ; ( ¶Ï» ÛÏ» £ÝÏ» b ( ØßÏ» áÏ» âÏ» + ³¼ ð¼ 9¼ ( `¼ ( À¼( B¼ ; ( 3¼ í¼ ï¼ b ( Øñ¼
ó¼ ô¼ + ¡?¼ C£?¼ {¥?¼ ( ¦?¼ ( ò¨?¼( tª?¼ ; ( i¬?¼ å @¼ Ö@¼ b ( @¼ Ð@¼ Ý@¼ + S´w¼ ¶w¼ Û¸w¼ ( ÷¹w¼ ( J¼w¼( ̽w¼ ; ( Á¿w¼ Lx¼ @x¼ b ( çx¼ x¼ ¨x¼ + °¯¼ m¯¼
¯¼ R¯¼ ; n¯¼ ä ¯¼ b *$¯¼ Í%¯¼ Ü&¯¼ + Ư¼ ùȯ¼ P˯¼ ( d̯¼ ( ½Î¯¼( YЯ¼ ; ( Ò¯¼ (°¼ g*°¼ b ( ù+°¼ ¾-°¼ Í.°¼ + %ç¼ ; ´'ç¼ + ¾Ùç¼ ÿÛç¼ =Þç¼ ( Tßç¼ ( §áç¼( Bãç¼ ; ( Håç¼ ê9è¼ æ;è¼ b ( >è¼ Ð?è¼ ì@è¼ + øë½ 9î½ }ð½ ( ñ½ ( îó½( oõ½ ; ( b÷½ ÒK ½ ÃM ½ b ( P ½ ¾Q ½ ÍR ½ + @ÿW½ nX½ ¢X½ ( ºX½ ( X½( X½ ; ( |
-X½ ø^X½ ê`X½ b ( -cX½ ãdX½ ðeX½ + f½ §½ î½ ( ù½ ( L½( ͽ ; ( Ͻ [r½ St½ b ( úu½ ²w½ Áx½ + Äjǽ mǽ oǽ Xrǽ ; wuǽ á~ǽ b 'ǽ Êǽ Ùǽ + $Ƚ ô&Ƚ :)Ƚ ( d*Ƚ ( Ã,Ƚ( d.Ƚ ; ( m0Ƚ ä
Ƚ (Ƚ b ( «È½ jȽ yȽ + Òÿ½ ; u
ÿ½ + 7 ¾ Ä9 ¾ < |
---|