Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1090 → Rev 1091

/demos/trunk/bca/initfile.c
1,137 → 1,137
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: initfile.c,v 1.1 2002-10-01 10:25:01 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: initfile.h *
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: inizializza i moduli di scheduling e *
* di risorse per il programma SHaRK *
* "(B)ase(C)ontr(A)rea", il cui task *
* main e' nel file bca.c. *
* *
******************************************************/
 
#define PI
 
// *** Librerie S.Ha.R.K ***
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/cbs.h"
#include "modules/rr.h"
#include "modules/dummy.h"
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "drivers/keyb.h"
// *** Librerie Standard C ***
// *** Librerie FAB ***
// *** Librerie BCA ***
#include"BCA.h"
 
/*+ system tick in us +*/
#define TICK 1000
 
/*+ RR tick in us +*/
#define RRTICK 10000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
EDF_register_level(EDF_ENABLE_ALL);
CBS_register_level(CBS_ENABLE_ALL, 0);
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
SEM_register_module();
CABS_register_module();
PI_register_module();
NOP_register_module();
 
kern_init_bca();
 
// periodic timer
return TICK;
// one-shot timer
// return 0
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
KEYB_PARMS kparms = BASE_KEYB;
 
HARTPORT_init();
 
keyb_def_ctrlC(kparms, NULL);
KEYB_init(&kparms);
 
__call_main__(mb);
 
return (void *)0;
}
 
#ifdef PI
int app_mutex_init(mutex_t *m)
{
PI_mutexattr_t attr;
 
PI_mutexattr_default(attr);
 
return mutex_init(m, &attr);
}
#else
int app_mutex_init(mutex_t *m)
{
NOP_mutexattr_t attr;
 
NOP_mutexattr_default(attr);
 
return mutex_init(m, &attr);
}
#endif
 
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: initfile.c,v 1.2 2002-10-01 10:33:51 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: initfile.h *
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: inizializza i moduli di scheduling e *
* di risorse per il programma SHaRK *
* "(B)ase(C)ontr(A)rea", il cui task *
* main e' nel file bca.c. *
* *
******************************************************/
 
#define PI
 
// *** Librerie S.Ha.R.K ***
#include "kernel/kern.h"
#include "modules/edf.h"
#include "modules/cbs.h"
#include "modules/rr.h"
#include "modules/dummy.h"
#include "modules/sem.h"
#include "modules/hartport.h"
#include "modules/cabs.h"
#include "drivers/keyb.h"
// *** Librerie Standard C ***
// *** Librerie FAB ***
// *** Librerie BCA ***
#include"bca.h"
 
/*+ system tick in us +*/
#define TICK 1000
 
/*+ RR tick in us +*/
#define RRTICK 10000
 
TIME __kernel_register_levels__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
EDF_register_level(EDF_ENABLE_ALL);
CBS_register_level(CBS_ENABLE_ALL, 0);
RR_register_level(RRTICK, RR_MAIN_YES, mb);
dummy_register_level();
 
SEM_register_module();
CABS_register_module();
PI_register_module();
NOP_register_module();
 
kern_init_bca();
 
// periodic timer
return TICK;
// one-shot timer
// return 0
}
 
TASK __init__(void *arg)
{
struct multiboot_info *mb = (struct multiboot_info *)arg;
 
KEYB_PARMS kparms = BASE_KEYB;
 
HARTPORT_init();
 
keyb_def_ctrlC(kparms, NULL);
KEYB_init(&kparms);
 
__call_main__(mb);
 
return (void *)0;
}
 
#ifdef PI
int app_mutex_init(mutex_t *m)
{
PI_mutexattr_t attr;
 
PI_mutexattr_default(attr);
 
return mutex_init(m, &attr);
}
#else
int app_mutex_init(mutex_t *m)
{
NOP_mutexattr_t attr;
 
NOP_mutexattr_default(attr);
 
return mutex_init(m, &attr);
}
#endif
 
/demos/trunk/bca/bca_lib.c
1,413 → 1,413
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca_lib.c,v 1.1 2002-10-01 10:25:00 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: BCA_LIB.c *
* libreria: BCA_LIB *
* creato da: Fabio CALABRESE *
* *
****************************************************/
 
#ifndef __BCA_LIB_c__
#define __BCA_LIB_c__
//-------------------BEGIN---------------------------
 
// *** Librerie S.Ha.R.K ***
#include<kernel/kern.h>
#include<drivers/glib.h>
#include<drivers/gd.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"FAB_LIB/FAB_msg.h"
// *** Librerie BCA ***
#include"BCA.h"
 
extern char * titolo[10]={" UNIVERSITA' DEGLI \0",
" STUDI DI \0",
" PAVIA \0",
"Progetto S.Ha.R.K.\0",
" 'BaseContrAerea' \0",
"-------------------\0",
" PAVIA 2002 \0",
"by Fabio CALABRESE \0",
"<fabiocalabrese77 \0",
" @yahoo.it>\0"};
 
void kern_alloc_images(); // richiede DISABLED_INTERUPTS
void kern_free_images(); // richiede DISABLED_INTERUPTS
void kern_load_images(); // solo in __kernel_register_levels__()
 
void kern_alloc_borders(); // richiede DISABLED_INTERUPTS
void kern_free_borders(); // richiede DISABLED_INTERUPTS
void kern_set_border(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_frames(); // richiede DISABLED_INTERUPTS
void kern_free_frames(); // richiede DISABLED_INTERUPTS
void kern_set_frames(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_ballframes(); // richiede DISABLED_INTERUPTS
void kern_free_ballframes(); // richiede DISABLED_INTERUPTS
void kern_set_ballframes(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_task_tables(); // richiede DISABLED_INTERUPTS
void kern_free_task_tables(); // richiede DISABLED_INTERUPTS
void kern_set_task_tables(); // consigliato in __kernel_register-levels__()
 
// *** Corpo delle funzioni in CA.h *** //
void kern_init_bca()
{
FAB_clr();
FAB_show_sched_modules();
 
kern_alloc_task_tables();
kern_set_task_tables();
 
kern_alloc_borders();
kern_set_borders();
kern_alloc_images();
kern_load_images();
kern_alloc_frames();
kern_set_frames();
kern_alloc_ballframes();
kern_set_ballframes();
}
 
void kern_alloc_task_tables()
{
int test=0,j;
 
FAB_print("TASKS'TABLES","allocazione...");
for (j=0; j<AEREO_N_MAX; j++) {
aereo_table[j].image=FAB_image_alloc(AEREO_LX,AEREO_LY);
if(aereo_table[j].image==NULL) test=1;
}
FAB_msg(test,NULL,"fatto","almeno un elemento della tabella non allocato");
}
void kern_free_task_tables()
{ int j;
 
for (j=0; j<AEREO_N_MAX; j++) {
FAB_image_free(aereo_table[j].image);
}
}
void kern_set_task_tables()
{ int j;
 
FAB_print(NULL,"settaggio...");
for (j=0; j<AEREO_N_MAX; j++) {
aereo_table[j].status = 0;
aereo_table[j].killing = 0;
aereo_table[j].image->trasparent = 1;
aereo_table[j].image->trasparent_col = AEREO_TRASPARENT_COL;
}
 
FAB_print(NULL,"fatto");
}
 
 
void kern_alloc_ballframes()
{
int test=0,j;
 
FAB_print("FAB_BALLFRAMEs","allocazione...");
ballframe_radar = FAB_ballframe_alloc();
if (ballframe_radar==NULL) test=1;
for (j=0; j<3; j++) {
ballframe_lucerossa[j] = FAB_ballframe_alloc();
if (ballframe_lucerossa[j]==NULL) test=1;
}
FAB_msg(test,NULL,"fatto","almeno un ballframe non allocato");
}
void kern_free_ballframes()
{ int j;
 
FAB_ballframe_free(ballframe_radar);
for (j=0; j<3; j++)
FAB_ballframe_free(ballframe_lucerossa[j]);
}
void kern_set_ballframes()
{ int j;
 
FAB_print(NULL,"settaggio...");
FAB_ballframe_border_set(ballframe_radar,border_verde7,7,
FRAME_MISURE_LINE_COLOR);
FAB_ballframe_color_set(ballframe_radar,0,FAB_blue);
for(j=0; j<3; j++) {
FAB_ballframe_border_set(ballframe_lucerossa[j],border_verde7,7,
FRAME_MISURE_LINE_COLOR);
FAB_ballframe_color_set(ballframe_lucerossa[j],0,FAB_red);
}
FAB_print(NULL,"fatto");
}
 
void kern_alloc_frames()
{
int test=0;
 
FAB_print("FAB_FRAMEs","allocazione...");
frame_bca = FAB_frame_alloc();
if (frame_bca==NULL) test=1;
frame_misure_oriz = FAB_frame_alloc();
if (frame_misure_oriz==NULL) test=1;
frame_misure_vert = FAB_frame_alloc();
if (frame_misure_vert==NULL) test=1;
frame_titolo = FAB_frame_alloc();
if (frame_titolo==NULL) test=1;
frame_comandi = FAB_frame_alloc();
if (frame_comandi==NULL) test=1;
frame_control = FAB_frame_alloc();
if (frame_control==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un frame non allocato");
}
void kern_free_frames()
{
FAB_frame_free(frame_bca);
FAB_frame_free(frame_misure_oriz);
FAB_frame_free(frame_misure_vert);
FAB_frame_free(frame_titolo);
FAB_frame_free(frame_comandi);
FAB_frame_free(frame_control);
 
}
 
void kern_set_frames()
{
FAB_print(NULL,"settaggio...");
FAB_frame_border_set(frame_bca,border_blu7,7,FAB_rgb(255,0,0));
FAB_frame_color_set(frame_bca,0,image_bca,FAB_green);
FAB_frame_border_set(frame_misure_oriz,border_verde7,7,FRAME_MISURE_LINE_COLOR);
FAB_frame_color_set(frame_misure_oriz,0,NULL,FRAME_MISURE_BACK_COLOR);
FAB_frame_border_set(frame_misure_vert,border_verde7,7,FRAME_MISURE_LINE_COLOR);
FAB_frame_color_set(frame_misure_vert,0,NULL,FRAME_MISURE_BACK_COLOR);
FAB_frame_border_set(frame_titolo,border_bianco7,7,FAB_white);
FAB_frame_color_set(frame_titolo,0,NULL,FRAME_TITOLO_BACK_COLOR1);
FAB_frame_border_set(frame_comandi,border_giallo7,7,FAB_yellow);
FAB_frame_color_set(frame_comandi,0,NULL,FRAME_COMANDI_BACK_COLOR1);
FAB_frame_border_set(frame_control,border_verde7,7,FAB_green);
FAB_frame_color_set(frame_control,0,NULL,FRAME_CONTROL_BACK_COLOR);
 
FAB_print(NULL,"fatto");
}
 
void kern_alloc_borders()
{
int test=0;
 
FAB_print("FAB_BORDERs","allocazione...");
border_blu7 = FAB_border_alloc(7);
if (border_blu7==NULL) test=1;
border_verde7 = FAB_border_alloc(7);
if (border_verde7==NULL) test=1;
border_rosso7 = FAB_border_alloc(7);
if (border_rosso7==NULL) test=1;
border_bianco7 = FAB_border_alloc(7);
if (border_bianco7==NULL) test=1;
border_giallo7 = FAB_border_alloc(7);
if (border_giallo7==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un bordo non allocato");
}
void kern_free_borders()
{
FAB_border_free(border_blu7);
FAB_border_free(border_verde7);
FAB_border_free(border_rosso7);
FAB_border_free(border_bianco7);
FAB_border_free(border_giallo7);
}
 
void kern_set_borders()
{
FAB_print(NULL,"settaggio...");
border_blu7->buf[0]=FAB_rgb( 0, 0, 50);
border_blu7->buf[1]=FAB_rgb( 0, 50,200);
border_blu7->buf[2]=FAB_rgb( 50,100,255);
border_blu7->buf[3]=FAB_rgb(100,150,255);
border_blu7->buf[4]=FAB_rgb( 50,100,255);
border_blu7->buf[5]=FAB_rgb( 0, 50,200);
border_blu7->buf[6]=FAB_rgb( 0, 0, 50);
 
border_verde7->buf[0]=FAB_rgb( 0, 50, 0);
border_verde7->buf[1]=FAB_rgb( 0,100, 50);
border_verde7->buf[2]=FAB_rgb( 50,255,100);
border_verde7->buf[3]=FAB_rgb(100,255,150);
border_verde7->buf[4]=FAB_rgb( 50,255,100);
border_verde7->buf[5]=FAB_rgb( 0,100, 50);
border_verde7->buf[6]=FAB_rgb( 0, 50, 0);
 
border_rosso7->buf[0]=FAB_rgb( 50, 0, 0);
border_rosso7->buf[1]=FAB_rgb(200, 25, 25);
border_rosso7->buf[2]=FAB_rgb(255, 75, 75);
border_rosso7->buf[3]=FAB_rgb(255,125,125);
border_rosso7->buf[4]=FAB_rgb(255, 75, 75);
border_rosso7->buf[5]=FAB_rgb(200, 25, 25);
border_rosso7->buf[6]=FAB_rgb( 50, 0, 0);
 
border_bianco7->buf[0]=FAB_rgb( 25, 25, 25);
border_bianco7->buf[1]=FAB_rgb( 75, 75, 75);
border_bianco7->buf[2]=FAB_rgb(125,125,125);
border_bianco7->buf[3]=FAB_rgb(255,255,255);
border_bianco7->buf[4]=FAB_rgb(125,125,125);
border_bianco7->buf[5]=FAB_rgb( 75, 75, 75);
border_bianco7->buf[6]=FAB_rgb( 25, 25, 25);
 
border_giallo7->buf[0]=FAB_rgb( 25, 25, 0);
border_giallo7->buf[1]=FAB_rgb(115,115, 25);
border_giallo7->buf[2]=FAB_rgb(170,170, 75);
border_giallo7->buf[3]=FAB_rgb(255,255,100);
border_giallo7->buf[4]=FAB_rgb(170,170, 75);
border_giallo7->buf[5]=FAB_rgb(115,115, 25);
border_giallo7->buf[6]=FAB_rgb( 25, 25, 0);
 
FAB_print(NULL,"fatto");
}
 
void kern_alloc_images()
{
int j,test=0;
 
FAB_print("FAB_IMAGEs","allocazione...");
 
image_missile[0] = FAB_image_alloc(MISSILE_LX,MISSILE_LY);
if (image_missile[0]==NULL) test=1;
image_missile[1] = FAB_image_alloc(MISSILE_LX,MISSILE_LY);
if (image_missile[1]==NULL) test=1;
 
for (j=0; j<2; j++) {
image_cannone[j] = FAB_image_alloc(CANNONE_LX,CANNONE_LY);
if (image_cannone[j]==NULL) test=1;
}
 
for (j=0; j<4; j++) {
image_aereo[j] = FAB_image_alloc(AEREO_LX,AEREO_LY);
if (image_aereo[j]==NULL) test=1;
}
 
for (j=0; j<5; j++) {
image_esplo[j] = FAB_image_alloc(ESPLO_LX,ESPLO_LY);
if (image_esplo[j]==NULL) test=1;
}
 
image_sfondo = FAB_image_alloc(96,96);
if (image_sfondo==NULL) test=1;
 
image_bca = FAB_image_alloc(500,500);
if (image_bca==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un'immagine non allocata");
}
void kern_free_images()
{
int j;
 
FAB_image_free(image_missile[0]);
FAB_image_free(image_missile[1]);
for (j=0; j<2; j++) FAB_image_free(image_cannone[j]);
for (j=0; j<4; j++) FAB_image_free(image_aereo[j]);
for (j=0; j<5; j++) FAB_image_free(image_esplo[j]);
FAB_image_free(image_sfondo);
FAB_image_free(image_bca);
}
 
void kern_load_images()
{ int test=0;
 
FAB_print(NULL,"caricamento dai file...");
 
FAB_print(NULL," [missile1.raw]...");
if(FAB_image_load(image_missile[0],"BCA_raw/missile1.raw")==-1) test=1;
FAB_image_trasparent_set(image_missile[0],MISSILE_TRASPARENT_COL);
FAB_print(NULL," [missile2.raw]...");
if(FAB_image_load(image_missile[1],"BCA_raw/missile2.raw")==-1) test=1;
FAB_image_trasparent_set(image_missile[1],MISSILE_TRASPARENT_COL);
 
FAB_print(NULL," [aereo1.raw]...");
if(FAB_image_load(image_aereo[0],"BCA_raw/aereo1.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[0],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo2.raw]...");
if(FAB_image_load(image_aereo[1],"BCA_raw/aereo2.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[1],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo1_h.raw]...");
if(FAB_image_load(image_aereo[2],"BCA_raw/aereo1_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[2],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo2_h.raw]...");
if(FAB_image_load(image_aereo[3],"BCA_raw/aereo2_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[3],AEREO_TRASPARENT_COL);
 
FAB_print(NULL," [cannon.raw]...");
if(FAB_image_load(image_cannone[0],"BCA_raw/cannon.raw")==-1) test=1;
FAB_image_trasparent_set(image_cannone[0],CANNONE_TRASPARENT_COL);
FAB_print(NULL," [cannon_h.raw]...");
if(FAB_image_load(image_cannone[1],"BCA_raw/cannon_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_cannone[1],CANNONE_TRASPARENT_COL);
 
FAB_print(NULL," [esplo1.raw]...");
if(FAB_image_load(image_esplo[0],"BCA_raw/esplo1.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[0],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo2.raw]...");
if(FAB_image_load(image_esplo[1],"BCA_raw/esplo2.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[1],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo3.raw]...");
if(FAB_image_load(image_esplo[2],"BCA_raw/esplo3.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[2],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo4.raw]...");
if(FAB_image_load(image_esplo[3],"BCA_raw/esplo4.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[3],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo5.raw]...");
if(FAB_image_load(image_esplo[4],"BCA_raw/esplo5.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[4],ESPLO_TRASPARENT_COL);
 
FAB_print(NULL," [sfondo.raw]...");
if(FAB_image_load(image_sfondo,"BCA_raw/sfondo.raw")==-1) test=1;
FAB_image_no_trasparent_set(image_sfondo);
 
FAB_print(NULL," [bca.raw]...");
if(FAB_image_load(image_bca,"BCA_raw/bca.raw")==-1) test=1;
FAB_image_no_trasparent_set(image_bca);
 
FAB_msg(test,NULL,"fatto","almeno un file non esiste oppure ha un formato incompatibile");
}
 
 
//----------------------END--------------------------
#endif
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca_lib.c,v 1.2 2002-10-01 10:33:51 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: BCA_LIB.c *
* libreria: BCA_LIB *
* creato da: Fabio CALABRESE *
* *
****************************************************/
 
#ifndef __BCA_LIB_c__
#define __BCA_LIB_c__
//-------------------BEGIN---------------------------
 
// *** Librerie S.Ha.R.K ***
#include<kernel/kern.h>
#include<drivers/glib.h>
#include<drivers/gd.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"fab_lib/fab_msg.h"
// *** Librerie BCA ***
#include"bca.h"
 
extern char * titolo[10]={" UNIVERSITA' DEGLI \0",
" STUDI DI \0",
" PAVIA \0",
"Progetto S.Ha.R.K.\0",
" 'BaseContrAerea' \0",
"-------------------\0",
" PAVIA 2002 \0",
"by Fabio CALABRESE \0",
"<fabiocalabrese77 \0",
" @yahoo.it>\0"};
 
void kern_alloc_images(); // richiede DISABLED_INTERUPTS
void kern_free_images(); // richiede DISABLED_INTERUPTS
void kern_load_images(); // solo in __kernel_register_levels__()
 
void kern_alloc_borders(); // richiede DISABLED_INTERUPTS
void kern_free_borders(); // richiede DISABLED_INTERUPTS
void kern_set_border(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_frames(); // richiede DISABLED_INTERUPTS
void kern_free_frames(); // richiede DISABLED_INTERUPTS
void kern_set_frames(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_ballframes(); // richiede DISABLED_INTERUPTS
void kern_free_ballframes(); // richiede DISABLED_INTERUPTS
void kern_set_ballframes(); // consigliato in __kernel_register-levels__()
 
void kern_alloc_task_tables(); // richiede DISABLED_INTERUPTS
void kern_free_task_tables(); // richiede DISABLED_INTERUPTS
void kern_set_task_tables(); // consigliato in __kernel_register-levels__()
 
// *** Corpo delle funzioni in CA.h *** //
void kern_init_bca()
{
FAB_clr();
FAB_show_sched_modules();
 
kern_alloc_task_tables();
kern_set_task_tables();
 
kern_alloc_borders();
kern_set_borders();
kern_alloc_images();
kern_load_images();
kern_alloc_frames();
kern_set_frames();
kern_alloc_ballframes();
kern_set_ballframes();
}
 
void kern_alloc_task_tables()
{
int test=0,j;
 
FAB_print("TASKS'TABLES","allocazione...");
for (j=0; j<AEREO_N_MAX; j++) {
aereo_table[j].image=FAB_image_alloc(AEREO_LX,AEREO_LY);
if(aereo_table[j].image==NULL) test=1;
}
FAB_msg(test,NULL,"fatto","almeno un elemento della tabella non allocato");
}
void kern_free_task_tables()
{ int j;
 
for (j=0; j<AEREO_N_MAX; j++) {
FAB_image_free(aereo_table[j].image);
}
}
void kern_set_task_tables()
{ int j;
 
FAB_print(NULL,"settaggio...");
for (j=0; j<AEREO_N_MAX; j++) {
aereo_table[j].status = 0;
aereo_table[j].killing = 0;
aereo_table[j].image->trasparent = 1;
aereo_table[j].image->trasparent_col = AEREO_TRASPARENT_COL;
}
 
FAB_print(NULL,"fatto");
}
 
 
void kern_alloc_ballframes()
{
int test=0,j;
 
FAB_print("FAB_BALLFRAMEs","allocazione...");
ballframe_radar = FAB_ballframe_alloc();
if (ballframe_radar==NULL) test=1;
for (j=0; j<3; j++) {
ballframe_lucerossa[j] = FAB_ballframe_alloc();
if (ballframe_lucerossa[j]==NULL) test=1;
}
FAB_msg(test,NULL,"fatto","almeno un ballframe non allocato");
}
void kern_free_ballframes()
{ int j;
 
FAB_ballframe_free(ballframe_radar);
for (j=0; j<3; j++)
FAB_ballframe_free(ballframe_lucerossa[j]);
}
void kern_set_ballframes()
{ int j;
 
FAB_print(NULL,"settaggio...");
FAB_ballframe_border_set(ballframe_radar,border_verde7,7,
FRAME_MISURE_LINE_COLOR);
FAB_ballframe_color_set(ballframe_radar,0,FAB_blue);
for(j=0; j<3; j++) {
FAB_ballframe_border_set(ballframe_lucerossa[j],border_verde7,7,
FRAME_MISURE_LINE_COLOR);
FAB_ballframe_color_set(ballframe_lucerossa[j],0,FAB_red);
}
FAB_print(NULL,"fatto");
}
 
void kern_alloc_frames()
{
int test=0;
 
FAB_print("FAB_FRAMEs","allocazione...");
frame_bca = FAB_frame_alloc();
if (frame_bca==NULL) test=1;
frame_misure_oriz = FAB_frame_alloc();
if (frame_misure_oriz==NULL) test=1;
frame_misure_vert = FAB_frame_alloc();
if (frame_misure_vert==NULL) test=1;
frame_titolo = FAB_frame_alloc();
if (frame_titolo==NULL) test=1;
frame_comandi = FAB_frame_alloc();
if (frame_comandi==NULL) test=1;
frame_control = FAB_frame_alloc();
if (frame_control==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un frame non allocato");
}
void kern_free_frames()
{
FAB_frame_free(frame_bca);
FAB_frame_free(frame_misure_oriz);
FAB_frame_free(frame_misure_vert);
FAB_frame_free(frame_titolo);
FAB_frame_free(frame_comandi);
FAB_frame_free(frame_control);
 
}
 
void kern_set_frames()
{
FAB_print(NULL,"settaggio...");
FAB_frame_border_set(frame_bca,border_blu7,7,FAB_rgb(255,0,0));
FAB_frame_color_set(frame_bca,0,image_bca,FAB_green);
FAB_frame_border_set(frame_misure_oriz,border_verde7,7,FRAME_MISURE_LINE_COLOR);
FAB_frame_color_set(frame_misure_oriz,0,NULL,FRAME_MISURE_BACK_COLOR);
FAB_frame_border_set(frame_misure_vert,border_verde7,7,FRAME_MISURE_LINE_COLOR);
FAB_frame_color_set(frame_misure_vert,0,NULL,FRAME_MISURE_BACK_COLOR);
FAB_frame_border_set(frame_titolo,border_bianco7,7,FAB_white);
FAB_frame_color_set(frame_titolo,0,NULL,FRAME_TITOLO_BACK_COLOR1);
FAB_frame_border_set(frame_comandi,border_giallo7,7,FAB_yellow);
FAB_frame_color_set(frame_comandi,0,NULL,FRAME_COMANDI_BACK_COLOR1);
FAB_frame_border_set(frame_control,border_verde7,7,FAB_green);
FAB_frame_color_set(frame_control,0,NULL,FRAME_CONTROL_BACK_COLOR);
 
FAB_print(NULL,"fatto");
}
 
void kern_alloc_borders()
{
int test=0;
 
FAB_print("FAB_BORDERs","allocazione...");
border_blu7 = FAB_border_alloc(7);
if (border_blu7==NULL) test=1;
border_verde7 = FAB_border_alloc(7);
if (border_verde7==NULL) test=1;
border_rosso7 = FAB_border_alloc(7);
if (border_rosso7==NULL) test=1;
border_bianco7 = FAB_border_alloc(7);
if (border_bianco7==NULL) test=1;
border_giallo7 = FAB_border_alloc(7);
if (border_giallo7==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un bordo non allocato");
}
void kern_free_borders()
{
FAB_border_free(border_blu7);
FAB_border_free(border_verde7);
FAB_border_free(border_rosso7);
FAB_border_free(border_bianco7);
FAB_border_free(border_giallo7);
}
 
void kern_set_borders()
{
FAB_print(NULL,"settaggio...");
border_blu7->buf[0]=FAB_rgb( 0, 0, 50);
border_blu7->buf[1]=FAB_rgb( 0, 50,200);
border_blu7->buf[2]=FAB_rgb( 50,100,255);
border_blu7->buf[3]=FAB_rgb(100,150,255);
border_blu7->buf[4]=FAB_rgb( 50,100,255);
border_blu7->buf[5]=FAB_rgb( 0, 50,200);
border_blu7->buf[6]=FAB_rgb( 0, 0, 50);
 
border_verde7->buf[0]=FAB_rgb( 0, 50, 0);
border_verde7->buf[1]=FAB_rgb( 0,100, 50);
border_verde7->buf[2]=FAB_rgb( 50,255,100);
border_verde7->buf[3]=FAB_rgb(100,255,150);
border_verde7->buf[4]=FAB_rgb( 50,255,100);
border_verde7->buf[5]=FAB_rgb( 0,100, 50);
border_verde7->buf[6]=FAB_rgb( 0, 50, 0);
 
border_rosso7->buf[0]=FAB_rgb( 50, 0, 0);
border_rosso7->buf[1]=FAB_rgb(200, 25, 25);
border_rosso7->buf[2]=FAB_rgb(255, 75, 75);
border_rosso7->buf[3]=FAB_rgb(255,125,125);
border_rosso7->buf[4]=FAB_rgb(255, 75, 75);
border_rosso7->buf[5]=FAB_rgb(200, 25, 25);
border_rosso7->buf[6]=FAB_rgb( 50, 0, 0);
 
border_bianco7->buf[0]=FAB_rgb( 25, 25, 25);
border_bianco7->buf[1]=FAB_rgb( 75, 75, 75);
border_bianco7->buf[2]=FAB_rgb(125,125,125);
border_bianco7->buf[3]=FAB_rgb(255,255,255);
border_bianco7->buf[4]=FAB_rgb(125,125,125);
border_bianco7->buf[5]=FAB_rgb( 75, 75, 75);
border_bianco7->buf[6]=FAB_rgb( 25, 25, 25);
 
border_giallo7->buf[0]=FAB_rgb( 25, 25, 0);
border_giallo7->buf[1]=FAB_rgb(115,115, 25);
border_giallo7->buf[2]=FAB_rgb(170,170, 75);
border_giallo7->buf[3]=FAB_rgb(255,255,100);
border_giallo7->buf[4]=FAB_rgb(170,170, 75);
border_giallo7->buf[5]=FAB_rgb(115,115, 25);
border_giallo7->buf[6]=FAB_rgb( 25, 25, 0);
 
FAB_print(NULL,"fatto");
}
 
void kern_alloc_images()
{
int j,test=0;
 
FAB_print("FAB_IMAGEs","allocazione...");
 
image_missile[0] = FAB_image_alloc(MISSILE_LX,MISSILE_LY);
if (image_missile[0]==NULL) test=1;
image_missile[1] = FAB_image_alloc(MISSILE_LX,MISSILE_LY);
if (image_missile[1]==NULL) test=1;
 
for (j=0; j<2; j++) {
image_cannone[j] = FAB_image_alloc(CANNONE_LX,CANNONE_LY);
if (image_cannone[j]==NULL) test=1;
}
 
for (j=0; j<4; j++) {
image_aereo[j] = FAB_image_alloc(AEREO_LX,AEREO_LY);
if (image_aereo[j]==NULL) test=1;
}
 
for (j=0; j<5; j++) {
image_esplo[j] = FAB_image_alloc(ESPLO_LX,ESPLO_LY);
if (image_esplo[j]==NULL) test=1;
}
 
image_sfondo = FAB_image_alloc(96,96);
if (image_sfondo==NULL) test=1;
 
image_bca = FAB_image_alloc(500,500);
if (image_bca==NULL) test=1;
 
FAB_msg(test,NULL,"fatto","almeno un'immagine non allocata");
}
void kern_free_images()
{
int j;
 
FAB_image_free(image_missile[0]);
FAB_image_free(image_missile[1]);
for (j=0; j<2; j++) FAB_image_free(image_cannone[j]);
for (j=0; j<4; j++) FAB_image_free(image_aereo[j]);
for (j=0; j<5; j++) FAB_image_free(image_esplo[j]);
FAB_image_free(image_sfondo);
FAB_image_free(image_bca);
}
 
void kern_load_images()
{ int test=0;
 
FAB_print(NULL,"caricamento dai file...");
 
FAB_print(NULL," [missile1.raw]...");
if(FAB_image_load(image_missile[0],"BCA_raw/missile1.raw")==-1) test=1;
FAB_image_trasparent_set(image_missile[0],MISSILE_TRASPARENT_COL);
FAB_print(NULL," [missile2.raw]...");
if(FAB_image_load(image_missile[1],"BCA_raw/missile2.raw")==-1) test=1;
FAB_image_trasparent_set(image_missile[1],MISSILE_TRASPARENT_COL);
 
FAB_print(NULL," [aereo1.raw]...");
if(FAB_image_load(image_aereo[0],"BCA_raw/aereo1.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[0],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo2.raw]...");
if(FAB_image_load(image_aereo[1],"BCA_raw/aereo2.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[1],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo1_h.raw]...");
if(FAB_image_load(image_aereo[2],"BCA_raw/aereo1_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[2],AEREO_TRASPARENT_COL);
FAB_print(NULL," [aereo2_h.raw]...");
if(FAB_image_load(image_aereo[3],"BCA_raw/aereo2_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_aereo[3],AEREO_TRASPARENT_COL);
 
FAB_print(NULL," [cannon.raw]...");
if(FAB_image_load(image_cannone[0],"BCA_raw/cannon.raw")==-1) test=1;
FAB_image_trasparent_set(image_cannone[0],CANNONE_TRASPARENT_COL);
FAB_print(NULL," [cannon_h.raw]...");
if(FAB_image_load(image_cannone[1],"BCA_raw/cannon_h.raw")==-1) test=1;
FAB_image_trasparent_set(image_cannone[1],CANNONE_TRASPARENT_COL);
 
FAB_print(NULL," [esplo1.raw]...");
if(FAB_image_load(image_esplo[0],"BCA_raw/esplo1.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[0],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo2.raw]...");
if(FAB_image_load(image_esplo[1],"BCA_raw/esplo2.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[1],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo3.raw]...");
if(FAB_image_load(image_esplo[2],"BCA_raw/esplo3.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[2],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo4.raw]...");
if(FAB_image_load(image_esplo[3],"BCA_raw/esplo4.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[3],ESPLO_TRASPARENT_COL);
FAB_print(NULL," [esplo5.raw]...");
if(FAB_image_load(image_esplo[4],"BCA_raw/esplo5.raw")==-1) test=1;
FAB_image_trasparent_set(image_esplo[4],ESPLO_TRASPARENT_COL);
 
FAB_print(NULL," [sfondo.raw]...");
if(FAB_image_load(image_sfondo,"BCA_raw/sfondo.raw")==-1) test=1;
FAB_image_no_trasparent_set(image_sfondo);
 
FAB_print(NULL," [bca.raw]...");
if(FAB_image_load(image_bca,"BCA_raw/bca.raw")==-1) test=1;
FAB_image_no_trasparent_set(image_bca);
 
FAB_msg(test,NULL,"fatto","almeno un file non esiste oppure ha un formato incompatibile");
}
 
 
//----------------------END--------------------------
#endif
/demos/trunk/bca/fab_lib.c
1,443 → 1,443
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_lib.c,v 1.1 2002-10-01 10:25:00 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_lib.c *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************/
 
#ifndef __FAB_LIB_c__
#define __FAB_LIB_c__
//-------------------BEGIN---------------------------
 
// *** Librerie di S.Ha.R.K. ***
#include<kernel/kern.h>
#include<kernel/mem.h>
#include<drivers/gd.h>
#include<drivers/glib.h>
#include<ll/sys/types.h>
#include<ll/i386/x-dos.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"FAB_LIB/FAB_msg.h"
#include"FAB_LIB/FAB_tool.h"
#include"FAB_LIB/FAB_grx.h"
 
// *** Corpo delle funzioni in FAB_msg.h *** //
 
void FAB_print(char * InitMsg, char * msg)
{ if (InitMsg!=NULL) {kern_printf("\n[%s]",(InitMsg));}
if (msg!=NULL) {kern_printf("\n %s.",msg);}
}
void __FAB_go(int test, char * OkMsg, char * ErrorMsg,int EXITflag)
{
if (OkMsg==NULL) OkMsg=FAB_EMPTY_MSG;
if (ErrorMsg==NULL) ErrorMsg=FAB_EMPTY_MSG;
 
if (!test) {kern_printf("\n OK: %s.",OkMsg);}
else {kern_printf("\n ERROR: %s!",ErrorMsg);
if (EXITflag==FAB_EXIT_YES) sys_end();
}
}
 
// *** Corpo delle funzioni in FAB_tool.h *** //
 
// nessun corpo!
 
// *** Corpo delle funzioni in FAB_show.h *** //
 
void FAB_show_sched_modules()
{ int i;
 
FAB_print("MODULI DI SCHEDULAZIONE",NULL);
kern_printf("\n (livello) (nome)");
for (i=0; i<sched_levels; i++)
{kern_printf("\n %-9d %s",i,(level_table[i])->level_name);
}
FAB_newline();
}
 
// *** Corpo delle funzioni in FAB_grx.h ***
 
FAB_BALLFRAME* FAB_ballframe_alloc()
{ FAB_BALLFRAME* frame;
 
frame=(FAB_BALLFRAME*)kern_alloc(sizeof(FAB_BALLFRAME));
if (frame==NULL) {
FAB_print(NULL,"BALLFRAME CREATING... ERROR #1");
return NULL;
}
return frame;
}
void FAB_ballframe_free(FAB_BALLFRAME * frame)
{ if (frame!=NULL)
{ kern_free(frame,sizeof(FAB_BALLFRAME));
}
}
 
FAB_FRAME* FAB_frame_alloc()
{ FAB_FRAME* frame;
 
frame=(FAB_FRAME*)kern_alloc(sizeof(FAB_FRAME));
if (frame==NULL) {
FAB_print(NULL,"FRAME CREATING... ERROR #1");
return NULL;
}
 
return frame;
}
void FAB_frame_free(FAB_FRAME * frame)
{ if (frame!=NULL)
{ kern_free(frame,sizeof(FAB_FRAME));
}
}
void FAB_ballborder_put(FAB_BORDER* border, WORD cx, WORD cy, WORD r_int)
{ int i;
 
for (i=0; i<border->dim; i++)
grx_circle(cx, cy, r_int+i, border->buf[i]);
}
void FAB_border_put(FAB_BORDER* border, WORD x0, WORD y0, WORD x1, WORD y1)
{ int i;
 
for (i=0; i<border->dim; i++)
grx_rect(x0-i, y0-i, x1+i, y1+i, border->buf[i]);
}
FAB_BORDER* FAB_border_alloc(WORD dim)
{ FAB_BORDER* border;
 
border=(FAB_BORDER*)kern_alloc(sizeof(FAB_BORDER));
if (border==NULL) {
FAB_print(NULL,"BORDER CREATING... ERROR #1");
return NULL;
}
 
border->buf=(COLOR*)kern_alloc(dim*sizeof(COLOR));
if (border->buf==NULL) {
FAB_print(NULL,"BORDER CREATING... ERROR #2");
return NULL;
}
 
border->dim = dim;
 
return border;
}
void FAB_border_free(FAB_BORDER * border)
{ if (border!=NULL)
{ kern_free(border->buf,border->dim*sizeof(COLOR));
kern_free(border,sizeof(FAB_BORDER));
}
}
void FAB_image_free(FAB_IMAGE* image)
{ if (image!=NULL)
{ kern_free(image->buf,image->lx*image->ly*sizeof(COLOR));
kern_free(image,sizeof(FAB_IMAGE));
}
}
FAB_IMAGE* FAB_image_alloc(WORD lx, WORD ly)
{ FAB_IMAGE* image;
 
image=(FAB_IMAGE*)kern_alloc(sizeof(FAB_IMAGE));
if (image==NULL) {
FAB_print(NULL,"IMAGE CREATING... ERROR #1");
return NULL;
}
 
image->buf=(COLOR*)kern_alloc(lx*ly*sizeof(COLOR));
if (image->buf==NULL) {
FAB_print(NULL,"IMAGE CREATING... ERROR #2");
return NULL;
}
FAB_image_no_trasparent_set(image);
image->lx = lx;
image->ly = ly;
 
return image;
}
int FAB_grx_open(WORD lx, WORD ly)
{ int modenum;
 
FAB_print("VIDEO",NULL);
if (grx_init()==-1) {
FAB_print(NULL,"ERRORE nell'inizializzazione!");
return -1;
}
if((modenum = grx_getmode(lx, ly, FAB_BPP))==-1) {
FAB_print(NULL,"Modalita' NON supportata!");
return -1;
}
if(grx_setmode(modenum)==-1) {
FAB_print(NULL,"ERRORE nell'apertura della modalita'video");
return -1;
}
return 0;
}
void FAB_grx_close()
{ grx_close();
}
int FAB_image_load(FAB_IMAGE* image, char* file_name)
{
DOS_FILE* file;
BYTE rgb[3];
COLOR * buf;
int i;
 
file=DOS_fopen(file_name,"r");
if (file==NULL) return -1;
 
buf = image->buf;
for (i=0; i<image->lx*image->ly; i++)
{ DOS_fread(&rgb[0],sizeof(BYTE),3,file);
*buf = FAB_rgb(rgb[0],rgb[1],rgb[2]);
buf++;
}
 
DOS_fclose(file);
return(0);
}
void FAB_image_get(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
COLOR* buf;
 
buf = image->buf;
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++) {
*buf = (COLOR) grx_getpixel(x0+x,y0+y);
buf++;
}
FAB_image_no_trasparent_set(image);
}
void FAB_image_put(FAB_IMAGE* image, WORD x0, WORD y0)
{ WORD x, y;
COLOR* buf;
 
buf = image->buf;
if (!image->trasparent) {
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++)
grx_plot(x0+x,y0+y,*buf++);
}
else {
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++) {
if (*buf!=image->trasparent_col)
grx_plot(x0+x,y0+y,*buf);
buf++;
}
}
}
void FAB_image_put_within(FAB_IMAGE* image, WORD x0, WORD y0,
WORD xx0, WORD yy0, WORD xx1, WORD yy1)
{ int step_x0_xx0;
int step_y0_yy0;
int step_xx1_x1;
int step_yy1_y1;
WORD xx, yy;
COLOR* buf;
 
step_x0_xx0 = xx0 - x0;
step_y0_yy0 = yy0 - y0;
step_xx1_x1 = (x0 + image->lx - 1) - xx1;
step_yy1_y1 = (y0 + image->ly - 1) - yy1;
 
if (step_x0_xx0 < 0) step_x0_xx0 = 0;
if (step_y0_yy0 < 0) step_y0_yy0 = 0;
if (step_xx1_x1 < 0) step_xx1_x1 = 0;
if (step_yy1_y1 < 0) step_yy1_y1 = 0;
 
buf = image->buf + step_y0_yy0*image->lx;
if (!image->trasparent) {
for(yy=step_y0_yy0; yy<image->ly-step_yy1_y1; yy++) {
buf += step_x0_xx0;
for(xx=step_x0_xx0; xx<image->lx-step_xx1_x1; xx++)
grx_plot(x0+xx,y0+yy,*buf++);
buf += step_xx1_x1;
}
}
else {
for(yy=step_y0_yy0; yy<image->ly-step_yy1_y1; yy++) {
buf += step_x0_xx0;
for(xx=step_x0_xx0; xx<image->lx-step_xx1_x1; xx++) {
if (*buf!=image->trasparent_col)
grx_plot(x0+xx,y0+yy,*buf);
buf++;
}
buf += step_xx1_x1;
}
}
}
//...funzione usata da FAB_image_fill()...
void __FAB_image_put_into(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
WORD skipped_pixels;
COLOR* buf;
 
if (lx < image->lx) skipped_pixels = image->lx - lx;
else skipped_pixels = 0;
buf = image->buf;
 
if (!image->trasparent) {
for (y=0; y<ly; y++, buf+=skipped_pixels) {
if (y > image->ly -1) break;
for (x=0; x<lx; x++, buf++) {
if (x < image->lx) grx_plot(x0+x,y0+y,*buf);
else break;
}
}
}
else {
for (y=0; y<ly; y++, buf+=skipped_pixels) {
if (y > image->ly -1) break;
for (x=0; x<lx; x++, buf++) {
if (x < image->lx) {
if (*buf!=image->trasparent_col)
grx_plot(x0+x,y0+y,*buf);
}
else break;
}
}
}
}
void FAB_image_fill(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
WORD sub_lx, sub_ly;
 
for (y=0; y<ly; y+=image->ly) {
sub_ly = ly - y; // spazio verticale disponibile
if (sub_ly > image->ly) sub_ly = image->ly;
for (x=0; x<lx; x+=image->lx) {
sub_lx = lx - x; // spazio orizzontale disponibile
if (sub_lx > image->lx) sub_lx = image->lx;
__FAB_image_put_into(image,x0+x,y0+y,sub_lx,sub_ly);
}
}
}
void FAB_frame_put(FAB_FRAME* frame, WORD x0, WORD y0, WORD lx, WORD ly)
{
WORD eff_dim;
int j;
 
//BORDO DEL FRAME
if (frame->border!=NULL) eff_dim = frame->border->dim;
else eff_dim = frame->border_dim;
frame->x0 = x0 + eff_dim;
frame->y0 = y0 + eff_dim;
frame->x1 = x0 + lx - eff_dim - 1;
frame->y1 = y0 + ly - eff_dim - 1;
if (frame->border!=NULL) {
FAB_border_put(frame->border, frame->x0-1, frame->y0-1,
frame->x1+1, frame->y1+1);
}
else {
for (j=0; j<eff_dim; j++)
grx_rect(frame->x0-1-j, frame->y0-1-j,
frame->x1+1+j, frame->y1+1+j, frame->border_col);
}
 
//PANNELLO DEL FRAME
if (!frame->trasparent) {
if (frame->image==NULL) grx_box(frame->x0, frame->y0,
frame->x1, frame->y1, frame->color);
else FAB_image_fill(frame->image,
frame->x0, frame->y0,
lx-eff_dim*2, ly-eff_dim*2);
}
}
 
void FAB_ballframe_put(FAB_BALLFRAME* frame, WORD cx, WORD cy, WORD r)
{
int j;
WORD eff_dim;
 
//BORDO DEL FRAME
if (frame->border!=NULL) eff_dim = frame->border->dim;
else eff_dim = frame->border_dim;
frame->cx = cx;
frame->cy = cy;
frame->r = r - eff_dim;
if (frame->border!=NULL) {
FAB_ballborder_put(frame->border,frame->cx,frame->cy,frame->r+1);
}
else {
for (j=0; j<eff_dim; j++)
grx_circle(frame->cx,frame->cy,frame->r+1+j,frame->border_col);
}
 
//PANNELLO DEL FRAME
if (!frame->trasparent) {
grx_disc(frame->cx,frame->cy,frame->r,frame->color);
}
}
 
void FAB_image_copy(FAB_IMAGE* orig_image, FAB_IMAGE* dest_image)
{
COLOR* orig_buf;
COLOR* dest_buf;
int j,n;
 
n = orig_image->lx * orig_image->ly;
if (n==(dest_image->lx * dest_image->ly)) {
orig_buf = orig_image->buf;
dest_buf = dest_image->buf;
for(j=0; j<n; j++) {
*dest_buf = *orig_buf;
orig_buf++;
dest_buf++;
}
}
}
void FAB_image_color_change(FAB_IMAGE* image, COLOR old_col, COLOR new_col)
{ COLOR* buf;
int j,n;
 
buf = image->buf;
n = image->lx * image->ly;
for(j=0; j<n; j++, buf++)
if (*buf==old_col)
*buf=new_col;
}
//----------------------END--------------------------
#endif
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_lib.c,v 1.2 2002-10-01 10:33:51 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_lib.c *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************/
 
#ifndef __FAB_LIB_c__
#define __FAB_LIB_c__
//-------------------BEGIN---------------------------
 
// *** Librerie di S.Ha.R.K. ***
#include<kernel/kern.h>
#include<kernel/mem.h>
#include<drivers/gd.h>
#include<drivers/glib.h>
#include<ll/sys/types.h>
#include<ll/i386/x-dos.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"fab_lib/fab_msg.h"
#include"fab_lib/fab_tool.h"
#include"fab_lib/fab_grx.h"
 
// *** Corpo delle funzioni in FAB_msg.h *** //
 
void FAB_print(char * InitMsg, char * msg)
{ if (InitMsg!=NULL) {kern_printf("\n[%s]",(InitMsg));}
if (msg!=NULL) {kern_printf("\n %s.",msg);}
}
void __FAB_go(int test, char * OkMsg, char * ErrorMsg,int EXITflag)
{
if (OkMsg==NULL) OkMsg=FAB_EMPTY_MSG;
if (ErrorMsg==NULL) ErrorMsg=FAB_EMPTY_MSG;
 
if (!test) {kern_printf("\n OK: %s.",OkMsg);}
else {kern_printf("\n ERROR: %s!",ErrorMsg);
if (EXITflag==FAB_EXIT_YES) sys_end();
}
}
 
// *** Corpo delle funzioni in FAB_tool.h *** //
 
// nessun corpo!
 
// *** Corpo delle funzioni in FAB_show.h *** //
 
void FAB_show_sched_modules()
{ int i;
 
FAB_print("MODULI DI SCHEDULAZIONE",NULL);
kern_printf("\n (livello) (nome)");
for (i=0; i<sched_levels; i++)
{kern_printf("\n %-9d %s",i,(level_table[i])->level_name);
}
FAB_newline();
}
 
// *** Corpo delle funzioni in FAB_grx.h ***
 
FAB_BALLFRAME* FAB_ballframe_alloc()
{ FAB_BALLFRAME* frame;
 
frame=(FAB_BALLFRAME*)kern_alloc(sizeof(FAB_BALLFRAME));
if (frame==NULL) {
FAB_print(NULL,"BALLFRAME CREATING... ERROR #1");
return NULL;
}
return frame;
}
void FAB_ballframe_free(FAB_BALLFRAME * frame)
{ if (frame!=NULL)
{ kern_free(frame,sizeof(FAB_BALLFRAME));
}
}
 
FAB_FRAME* FAB_frame_alloc()
{ FAB_FRAME* frame;
 
frame=(FAB_FRAME*)kern_alloc(sizeof(FAB_FRAME));
if (frame==NULL) {
FAB_print(NULL,"FRAME CREATING... ERROR #1");
return NULL;
}
 
return frame;
}
void FAB_frame_free(FAB_FRAME * frame)
{ if (frame!=NULL)
{ kern_free(frame,sizeof(FAB_FRAME));
}
}
void FAB_ballborder_put(FAB_BORDER* border, WORD cx, WORD cy, WORD r_int)
{ int i;
 
for (i=0; i<border->dim; i++)
grx_circle(cx, cy, r_int+i, border->buf[i]);
}
void FAB_border_put(FAB_BORDER* border, WORD x0, WORD y0, WORD x1, WORD y1)
{ int i;
 
for (i=0; i<border->dim; i++)
grx_rect(x0-i, y0-i, x1+i, y1+i, border->buf[i]);
}
FAB_BORDER* FAB_border_alloc(WORD dim)
{ FAB_BORDER* border;
 
border=(FAB_BORDER*)kern_alloc(sizeof(FAB_BORDER));
if (border==NULL) {
FAB_print(NULL,"BORDER CREATING... ERROR #1");
return NULL;
}
 
border->buf=(COLOR*)kern_alloc(dim*sizeof(COLOR));
if (border->buf==NULL) {
FAB_print(NULL,"BORDER CREATING... ERROR #2");
return NULL;
}
 
border->dim = dim;
 
return border;
}
void FAB_border_free(FAB_BORDER * border)
{ if (border!=NULL)
{ kern_free(border->buf,border->dim*sizeof(COLOR));
kern_free(border,sizeof(FAB_BORDER));
}
}
void FAB_image_free(FAB_IMAGE* image)
{ if (image!=NULL)
{ kern_free(image->buf,image->lx*image->ly*sizeof(COLOR));
kern_free(image,sizeof(FAB_IMAGE));
}
}
FAB_IMAGE* FAB_image_alloc(WORD lx, WORD ly)
{ FAB_IMAGE* image;
 
image=(FAB_IMAGE*)kern_alloc(sizeof(FAB_IMAGE));
if (image==NULL) {
FAB_print(NULL,"IMAGE CREATING... ERROR #1");
return NULL;
}
 
image->buf=(COLOR*)kern_alloc(lx*ly*sizeof(COLOR));
if (image->buf==NULL) {
FAB_print(NULL,"IMAGE CREATING... ERROR #2");
return NULL;
}
FAB_image_no_trasparent_set(image);
image->lx = lx;
image->ly = ly;
 
return image;
}
int FAB_grx_open(WORD lx, WORD ly)
{ int modenum;
 
FAB_print("VIDEO",NULL);
if (grx_init()==-1) {
FAB_print(NULL,"ERRORE nell'inizializzazione!");
return -1;
}
if((modenum = grx_getmode(lx, ly, FAB_BPP))==-1) {
FAB_print(NULL,"Modalita' NON supportata!");
return -1;
}
if(grx_setmode(modenum)==-1) {
FAB_print(NULL,"ERRORE nell'apertura della modalita'video");
return -1;
}
return 0;
}
void FAB_grx_close()
{ grx_close();
}
int FAB_image_load(FAB_IMAGE* image, char* file_name)
{
DOS_FILE* file;
BYTE rgb[3];
COLOR * buf;
int i;
 
file=DOS_fopen(file_name,"r");
if (file==NULL) return -1;
 
buf = image->buf;
for (i=0; i<image->lx*image->ly; i++)
{ DOS_fread(&rgb[0],sizeof(BYTE),3,file);
*buf = FAB_rgb(rgb[0],rgb[1],rgb[2]);
buf++;
}
 
DOS_fclose(file);
return(0);
}
void FAB_image_get(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
COLOR* buf;
 
buf = image->buf;
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++) {
*buf = (COLOR) grx_getpixel(x0+x,y0+y);
buf++;
}
FAB_image_no_trasparent_set(image);
}
void FAB_image_put(FAB_IMAGE* image, WORD x0, WORD y0)
{ WORD x, y;
COLOR* buf;
 
buf = image->buf;
if (!image->trasparent) {
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++)
grx_plot(x0+x,y0+y,*buf++);
}
else {
for (y=0; y<image->ly; y++)
for (x=0; x<image->lx; x++) {
if (*buf!=image->trasparent_col)
grx_plot(x0+x,y0+y,*buf);
buf++;
}
}
}
void FAB_image_put_within(FAB_IMAGE* image, WORD x0, WORD y0,
WORD xx0, WORD yy0, WORD xx1, WORD yy1)
{ int step_x0_xx0;
int step_y0_yy0;
int step_xx1_x1;
int step_yy1_y1;
WORD xx, yy;
COLOR* buf;
 
step_x0_xx0 = xx0 - x0;
step_y0_yy0 = yy0 - y0;
step_xx1_x1 = (x0 + image->lx - 1) - xx1;
step_yy1_y1 = (y0 + image->ly - 1) - yy1;
 
if (step_x0_xx0 < 0) step_x0_xx0 = 0;
if (step_y0_yy0 < 0) step_y0_yy0 = 0;
if (step_xx1_x1 < 0) step_xx1_x1 = 0;
if (step_yy1_y1 < 0) step_yy1_y1 = 0;
 
buf = image->buf + step_y0_yy0*image->lx;
if (!image->trasparent) {
for(yy=step_y0_yy0; yy<image->ly-step_yy1_y1; yy++) {
buf += step_x0_xx0;
for(xx=step_x0_xx0; xx<image->lx-step_xx1_x1; xx++)
grx_plot(x0+xx,y0+yy,*buf++);
buf += step_xx1_x1;
}
}
else {
for(yy=step_y0_yy0; yy<image->ly-step_yy1_y1; yy++) {
buf += step_x0_xx0;
for(xx=step_x0_xx0; xx<image->lx-step_xx1_x1; xx++) {
if (*buf!=image->trasparent_col)
grx_plot(x0+xx,y0+yy,*buf);
buf++;
}
buf += step_xx1_x1;
}
}
}
//...funzione usata da FAB_image_fill()...
void __FAB_image_put_into(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
WORD skipped_pixels;
COLOR* buf;
 
if (lx < image->lx) skipped_pixels = image->lx - lx;
else skipped_pixels = 0;
buf = image->buf;
 
if (!image->trasparent) {
for (y=0; y<ly; y++, buf+=skipped_pixels) {
if (y > image->ly -1) break;
for (x=0; x<lx; x++, buf++) {
if (x < image->lx) grx_plot(x0+x,y0+y,*buf);
else break;
}
}
}
else {
for (y=0; y<ly; y++, buf+=skipped_pixels) {
if (y > image->ly -1) break;
for (x=0; x<lx; x++, buf++) {
if (x < image->lx) {
if (*buf!=image->trasparent_col)
grx_plot(x0+x,y0+y,*buf);
}
else break;
}
}
}
}
void FAB_image_fill(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly)
{ WORD x, y;
WORD sub_lx, sub_ly;
 
for (y=0; y<ly; y+=image->ly) {
sub_ly = ly - y; // spazio verticale disponibile
if (sub_ly > image->ly) sub_ly = image->ly;
for (x=0; x<lx; x+=image->lx) {
sub_lx = lx - x; // spazio orizzontale disponibile
if (sub_lx > image->lx) sub_lx = image->lx;
__FAB_image_put_into(image,x0+x,y0+y,sub_lx,sub_ly);
}
}
}
void FAB_frame_put(FAB_FRAME* frame, WORD x0, WORD y0, WORD lx, WORD ly)
{
WORD eff_dim;
int j;
 
//BORDO DEL FRAME
if (frame->border!=NULL) eff_dim = frame->border->dim;
else eff_dim = frame->border_dim;
frame->x0 = x0 + eff_dim;
frame->y0 = y0 + eff_dim;
frame->x1 = x0 + lx - eff_dim - 1;
frame->y1 = y0 + ly - eff_dim - 1;
if (frame->border!=NULL) {
FAB_border_put(frame->border, frame->x0-1, frame->y0-1,
frame->x1+1, frame->y1+1);
}
else {
for (j=0; j<eff_dim; j++)
grx_rect(frame->x0-1-j, frame->y0-1-j,
frame->x1+1+j, frame->y1+1+j, frame->border_col);
}
 
//PANNELLO DEL FRAME
if (!frame->trasparent) {
if (frame->image==NULL) grx_box(frame->x0, frame->y0,
frame->x1, frame->y1, frame->color);
else FAB_image_fill(frame->image,
frame->x0, frame->y0,
lx-eff_dim*2, ly-eff_dim*2);
}
}
 
void FAB_ballframe_put(FAB_BALLFRAME* frame, WORD cx, WORD cy, WORD r)
{
int j;
WORD eff_dim;
 
//BORDO DEL FRAME
if (frame->border!=NULL) eff_dim = frame->border->dim;
else eff_dim = frame->border_dim;
frame->cx = cx;
frame->cy = cy;
frame->r = r - eff_dim;
if (frame->border!=NULL) {
FAB_ballborder_put(frame->border,frame->cx,frame->cy,frame->r+1);
}
else {
for (j=0; j<eff_dim; j++)
grx_circle(frame->cx,frame->cy,frame->r+1+j,frame->border_col);
}
 
//PANNELLO DEL FRAME
if (!frame->trasparent) {
grx_disc(frame->cx,frame->cy,frame->r,frame->color);
}
}
 
void FAB_image_copy(FAB_IMAGE* orig_image, FAB_IMAGE* dest_image)
{
COLOR* orig_buf;
COLOR* dest_buf;
int j,n;
 
n = orig_image->lx * orig_image->ly;
if (n==(dest_image->lx * dest_image->ly)) {
orig_buf = orig_image->buf;
dest_buf = dest_image->buf;
for(j=0; j<n; j++) {
*dest_buf = *orig_buf;
orig_buf++;
dest_buf++;
}
}
}
void FAB_image_color_change(FAB_IMAGE* image, COLOR old_col, COLOR new_col)
{ COLOR* buf;
int j,n;
 
buf = image->buf;
n = image->lx * image->ly;
for(j=0; j<n; j++, buf++)
if (*buf==old_col)
*buf=new_col;
}
//----------------------END--------------------------
#endif
/demos/trunk/bca/bca.c
1,224 → 1,224
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca.c,v 1.1 2002-10-01 10:25:00 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: bca.c *
* header file: bca.h *
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: e' il file in cui è descritto il task*
* main del programma S.Ha.R.K. *
* "(B)ase(C)ontr(A)rea". *
* Il codice del programma comprende *
* anche l'implementazione di altri task*
* distribuiti nei seguenti file che *
* quindi sono inclusi: *
* dummy.c *
* control.c *
* aereo.c *
* cannone.c *
* missile.c *
* esplo.c *
* Inoltre è incluso anche il file: *
* scenario.c *
* che descrive come disegnare lo *
* scenario grafico iniziale *
* *
******************************************************/
 
 
// *** Librerie S.Ha.R.K ***
#include <kernel/kern.h>
#include <drivers/keyb.h>
#include <ll/i386/cons.h>
#include <drivers/glib.h>
// *** Librerie Standard C ***
#include <stdlib.h>
// *** Librerie FAB ***
#include "FAB_LIB/FAB_msg.h"
#include "FAB_LIB/FAB_show.h"
#include "FAB_LIB/FAB_tool.h"
#include "FAB_LIB/FAB_grx.h"
// *** Librerie BCA ***
#include "BCA.h"
 
 
char * titolo[10];
 
void scenario();
void info();
#include"scenario.c"
 
PID crea_soft_dummy_radar ();
TASK dummy_radar(void *);
#include"dummy.c"
 
PID crea_soft_control();
TASK control(void *);
#include"control.c"
 
PID crea_soft_aereo_creator();
TASK aereo_creator();
PID crea_hard_aereo(int index);
PID crea_soft_aereo(int index);
TASK aereo(void * index);
#include"aereo.c"
 
PID crea_soft_cannone_creator();
TASK cannone_creator();
PID crea_hard_cannone(int index);
PID crea_soft_cannone(int index);
TASK cannone(void * index);
#include"cannone.c"
 
PID crea_hard_missile();
PID crea_soft_missile();
TASK missile();
#include"missile.c"
 
PID crea_soft_esplo();
TASK esplo(void *);
#include"esplo.c"
 
void demo_exc_handler(int signo, siginfo_t *info, void *extra)
{
struct timespec t;
 
grx_close();
 
/* Default action for an kern exception is */
kern_cli();
ll_gettime(TIME_EXACT, &t),
kern_printf("\nS.Ha.R.K. Exception raised!!!"
"\nTime (s:ns) :%d:%d"
"\nException number:%d"
"\nPID :%d\n",
t.tv_sec, t.tv_nsec, info->si_value.sival_int,
info->si_task);
sys_end();
}
 
void my_close(void *arg)
{ FAB_grx_close();
place(0,0);
info();
}
 
void end_fun(KEY_EVT* k)
{ cprintf("Ending...\n");
sys_end();
}
void incrementa_aerei_fun(KEY_EVT* k)
{ if (aereo_count<AEREO_N_MAX) aereo_count++;
}
void decrementa_aerei_fun(KEY_EVT* k)
{ if (aereo_count>AEREO_N_MIN) aereo_count--;
}
void incrementa_cannoni_fun(KEY_EVT* k)
{ if (cannone_count<CANNONE_N_MAX) cannone_count++;
}
void decrementa_cannoni_fun(KEY_EVT* k)
{ if (cannone_count>CANNONE_N_MIN) cannone_count--;
}
 
int main(int argc, char **argv)
{
PID pid;
 
KEY_EVT k;
keyb_set_map(itaMap);
 
k.flag = 0;
k.scan = KEY_ENT;
k.ascii = 13;
keyb_hook(k,end_fun);
k.flag = 0;
k.scan = KEY_1;
k.ascii = '1';
keyb_hook(k,incrementa_aerei_fun);
k.flag = 0;
k.scan = KEY_2;
k.ascii = '2';
keyb_hook(k,decrementa_aerei_fun);
k.flag = 0;
k.scan = KEY_3;
k.ascii = '3';
keyb_hook(k,incrementa_cannoni_fun);
k.flag = 0;
k.scan = KEY_4;
k.ascii = '4';
keyb_hook(k,decrementa_cannoni_fun);
 
set_exchandler_grx();
 
sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);
 
FAB_grx_open(800,600);
 
/* inizializza il mutex grafico */
app_mutex_init(&grx_mutex);
 
scenario();
 
//---init---
srand(sys_gettime(NULL));
aereo_count = AEREO_N_MIN;
cannone_count = CANNONE_N_MIN;
 
pid=crea_soft_dummy_radar();
task_activate(pid);
 
pid=crea_soft_aereo_creator();
task_activate(pid);
 
pid=crea_soft_cannone_creator();
task_activate(pid);
 
pid=crea_soft_control();
task_activate(pid);
//----------
}
 
 
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca.c,v 1.2 2002-10-01 10:33:51 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: bca.c *
* header file: bca.h *
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: e' il file in cui è descritto il task*
* main del programma S.Ha.R.K. *
* "(B)ase(C)ontr(A)rea". *
* Il codice del programma comprende *
* anche l'implementazione di altri task*
* distribuiti nei seguenti file che *
* quindi sono inclusi: *
* dummy.c *
* control.c *
* aereo.c *
* cannone.c *
* missile.c *
* esplo.c *
* Inoltre è incluso anche il file: *
* scenario.c *
* che descrive come disegnare lo *
* scenario grafico iniziale *
* *
******************************************************/
 
 
// *** Librerie S.Ha.R.K ***
#include <kernel/kern.h>
#include <drivers/keyb.h>
#include <ll/i386/cons.h>
#include <drivers/glib.h>
// *** Librerie Standard C ***
#include <stdlib.h>
// *** Librerie FAB ***
#include "fab_lib/fab_msg.h"
#include "fab_lib/fab_show.h"
#include "fab_lib/fab_tool.h"
#include "fab_lib/fab_grx.h"
// *** Librerie BCA ***
#include "bca.h"
 
 
char * titolo[10];
 
void scenario();
void info();
#include"scenario.c"
 
PID crea_soft_dummy_radar ();
TASK dummy_radar(void *);
#include"dummy.c"
 
PID crea_soft_control();
TASK control(void *);
#include"control.c"
 
PID crea_soft_aereo_creator();
TASK aereo_creator();
PID crea_hard_aereo(int index);
PID crea_soft_aereo(int index);
TASK aereo(void * index);
#include"aereo.c"
 
PID crea_soft_cannone_creator();
TASK cannone_creator();
PID crea_hard_cannone(int index);
PID crea_soft_cannone(int index);
TASK cannone(void * index);
#include"cannone.c"
 
PID crea_hard_missile();
PID crea_soft_missile();
TASK missile();
#include"missile.c"
 
PID crea_soft_esplo();
TASK esplo(void *);
#include"esplo.c"
 
void demo_exc_handler(int signo, siginfo_t *info, void *extra)
{
struct timespec t;
 
grx_close();
 
/* Default action for an kern exception is */
kern_cli();
ll_gettime(TIME_EXACT, &t),
kern_printf("\nS.Ha.R.K. Exception raised!!!"
"\nTime (s:ns) :%d:%d"
"\nException number:%d"
"\nPID :%d\n",
t.tv_sec, t.tv_nsec, info->si_value.sival_int,
info->si_task);
sys_end();
}
 
void my_close(void *arg)
{ FAB_grx_close();
place(0,0);
info();
}
 
void end_fun(KEY_EVT* k)
{ cprintf("Ending...\n");
sys_end();
}
void incrementa_aerei_fun(KEY_EVT* k)
{ if (aereo_count<AEREO_N_MAX) aereo_count++;
}
void decrementa_aerei_fun(KEY_EVT* k)
{ if (aereo_count>AEREO_N_MIN) aereo_count--;
}
void incrementa_cannoni_fun(KEY_EVT* k)
{ if (cannone_count<CANNONE_N_MAX) cannone_count++;
}
void decrementa_cannoni_fun(KEY_EVT* k)
{ if (cannone_count>CANNONE_N_MIN) cannone_count--;
}
 
int main(int argc, char **argv)
{
PID pid;
 
KEY_EVT k;
keyb_set_map(itaMap);
 
k.flag = 0;
k.scan = KEY_ENT;
k.ascii = 13;
keyb_hook(k,end_fun);
k.flag = 0;
k.scan = KEY_1;
k.ascii = '1';
keyb_hook(k,incrementa_aerei_fun);
k.flag = 0;
k.scan = KEY_2;
k.ascii = '2';
keyb_hook(k,decrementa_aerei_fun);
k.flag = 0;
k.scan = KEY_3;
k.ascii = '3';
keyb_hook(k,incrementa_cannoni_fun);
k.flag = 0;
k.scan = KEY_4;
k.ascii = '4';
keyb_hook(k,decrementa_cannoni_fun);
 
set_exchandler_grx();
 
sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);
 
FAB_grx_open(800,600);
 
/* inizializza il mutex grafico */
app_mutex_init(&grx_mutex);
 
scenario();
 
//---init---
srand(sys_gettime(NULL));
aereo_count = AEREO_N_MIN;
cannone_count = CANNONE_N_MIN;
 
pid=crea_soft_dummy_radar();
task_activate(pid);
 
pid=crea_soft_aereo_creator();
task_activate(pid);
 
pid=crea_soft_cannone_creator();
task_activate(pid);
 
pid=crea_soft_control();
task_activate(pid);
//----------
}
 
 
/demos/trunk/bca/bca.h
1,288 → 1,288
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca.h,v 1.1 2002-10-01 10:25:00 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: bca.h *
* included by: bca.c & bca_lib di cui fa da header*
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: contiene la definizione di variabili *
* e strutture globali, con un corredo *
* di macro e funzioni per la loro *
* gestione, usate nel programma SHaRK *
* "(B)ase(C)ontr(A)rea", il cui codice *
* e' scritto nel file bca.c; *
* il file bca_lib.c contiene il corpo *
* di tutte le funzioni qui dichiarate. *
* *
******************************************************/
 
#ifndef __BCA_H__
#define __BCA_H__
//----------------BEGIN------------------
 
// *** Librerie S.Ha.R.K ***
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"FAB_LIB/FAB_grx.h"
#include"FAB_LIB/FAB_tool.h"
// *** Librerie BCA ***
 
 
// ---------------------------------
// *** Elementi Grafici Generici ***
// ---------------------------------
 
// IMMAGINI:
FAB_IMAGE* image_sfondo;
FAB_IMAGE* image_bca;
FAB_IMAGE* image_aereo[4]; // 1 aereo per ogni direzione(soft e hard)
FAB_IMAGE* image_esplo[5]; // 5 immagini in sequenza simulanti
FAB_IMAGE* image_cannone[2]; // un esplosione
FAB_IMAGE* image_missile[2];
 
// BORDI:
FAB_BORDER* border_blu7;
FAB_BORDER* border_verde7;
FAB_BORDER* border_rosso7;
FAB_BORDER* border_bianco7;
FAB_BORDER* border_giallo7;
 
// FRAME:
FAB_FRAME* frame_bca;
FAB_FRAME* frame_misure_oriz;
FAB_FRAME* frame_misure_vert;
FAB_FRAME* frame_misure_vert;
FAB_FRAME* frame_titolo;
FAB_FRAME* frame_comandi;
FAB_FRAME* frame_control;
 
// BALLFRAME:
FAB_BALLFRAME* ballframe_radar;
FAB_BALLFRAME* ballframe_lucerossa[3];
 
// Base ContrAerea
#define BASE_L 1.0 // [Km]: lunghezza
#define BASE_H 2100 // [m]: altezza max di visibilita'
 
// Finestra Virtuale sullo schermo
#define FIN_X_MIN 20 // [pixel]
#define FIN_X_MAX 520-1 // [pixel]
#define FIN_Y_MIN 20 // [pixel]
#define FIN_Y_MAX 520-1 // [pixel]
// Inoltre si possono usare le seguenti + comode define
// con gli stessi valori:
#define X0 FIN_X_MIN
#define X1 FIN_X_MAX
#define Y0 FIN_Y_MIN
#define Y1 FIN_Y_MAX
// NB: non e' necessaria la proporzionalita' tra finestra
// reale(BASE_L*BASE_H) e virtuale((X1-X0)*(Y1-Y0))!
 
// Finestra Misure
#define FRAME_MISURE_LINE_COLOR FAB_green
#define FRAME_MISURE_BACK_COLOR FAB_black
#define FRAME_MISURE_ORIZ_LY 30
#define FRAME_MISURE_VERT_LX 52
 
// Finestra Titolo
#define FRAME_TITOLO_TEXT_COLOR1 FAB_yellow
#define FRAME_TITOLO_TEXT_COLOR2 FAB_white
#define FRAME_TITOLO_BACK_COLOR1 FAB_gray
#define FRAME_TITOLO_BACK_COLOR2 FAB_blue
 
// Finestra Comandi
#define FRAME_COMANDI_TEXT_COLOR1 FAB_yellow
#define FRAME_COMANDI_TEXT_COLOR2 FAB_white
#define FRAME_COMANDI_TEXT_COLOR3 FAB_red
#define FRAME_COMANDI_BACK_COLOR1 FAB_gray
#define FRAME_COMANDI_BACK_COLOR2 FAB_yellow
 
// Finestra Control
#define FRAME_CONTROL_TEXT_COLOR1 FAB_rgb( 50,255, 50)
#define FRAME_CONTROL_TEXT_COLOR2 FAB_rgb(150,255,150)
#define FRAME_CONTROL_BACK_COLOR FAB_black
 
// ---------------------------------
// *** Elementi Task Dummy_radar ***
// ---------------------------------
#define DUMMY_RADAR_GROUP 3
#define DUMMY_RADAR_PERIOD 50000
#define DUMMY_RADAR_WCET 400
#define DUMMY_RADAR_MET 200
 
// ---------------------------------
// *** Elementi Task Control ***
// ---------------------------------
#define CONTROL_PERIOD 50000
#define CONTROL_WCET 400
#define CONTROL_MET 300
 
// ---------------------------
// *** Elementi Task Esplo ***
// ---------------------------
#define ESPLO_TRASPARENT_COL FAB_white
#define ESPLO_LX 40
#define ESPLO_LY 40
 
#define ESPLO_PERIOD 80000
#define ESPLO_WCET 300
#define ESPLO_MET 100
 
// -----------------------------------
// *** Elementi Task Aereo_Creator ***
// -----------------------------------
#define AEREO_CREATOR_PERIOD 200000
#define AEREO_CREATOR_WCET 300
#define AEREO_CREATOR_MET 100
 
// -----------------------------------
// *** Elementi Task Cannone_Creator ***
// -----------------------------------
#define CANNONE_CREATOR_PERIOD 1000000
#define CANNONE_CREATOR_WCET 150
#define CANNONE_CREATOR_MET 50
 
// ---------------------------
// *** Elementi Task Aereo ***
// ---------------------------
#define AEREO_N_MAX 10
#define AEREO_N_MIN 1
 
#define AEREO_TRASPARENT_COL FAB_white
#define AEREO_BASE_COL FAB_green
#define AEREO_LX 32
#define AEREO_LY 19
#define AEREO_H_MIN 500 // [m]: altezza min di volo
#define AEREO_H_MAX 2000 // [m]: altezza max di volo (<BASE_H)
#define AEREO_L_MIN 0 // [km]: posizione 0 nella base
#define AEREO_L_MAX BASE_L // [km] posizione max nella base
#define AEREO_V_MIN 300.0 // [Km/h]: velocit… min di volo
#define AEREO_V_MAX 500.0 // [Km/h]: velocit… max di volo
#define AEREO_X_MIN X0 - AEREO_LX/2
#define AEREO_X_MAX X1 + AEREO_LX/2
 
#define AEREO_PERIOD 30000
#define AEREO_WCET 1250 //Verificato!
#define AEREO_MET 800
 
struct { BYTE status; //[0=free/1=occupato]
BYTE killing; //richiesta uscita se Š 1 altrimenti 0
PID pid;
COLOR color;
FAB_IMAGE* image;
double vel; //[km/h]
int dir; //[+1/-1]
WORD h; //[m]
double l; //[km]
WORD x, y; //[pixel]
} aereo_table[AEREO_N_MAX];
 
int aereo_count;
 
// -----------------------------
// *** Elementi Task Cannone ***
// -----------------------------
#define CANNONE_N_MAX 9
#define CANNONE_N_MIN 1
 
#define CANNONE_SENSIBILITA 200 //[m]
 
#define CANNONE_TRASPARENT_COL FAB_white
#define CANNONE_LX 33
#define CANNONE_LY 15
 
#define CANNONE_PERIOD 100000
#define CANNONE_WCET 1000
#define CANNONE_MET 100
 
struct { BYTE status; //[0=free/1=occupato]
BYTE killing; //richiesta uscita se Š 1 altrimenti 0
PID pid;
BYTE fire;
WORD x;
double missile_vel;
} cannone_table[CANNONE_N_MAX];
 
int cannone_count;
 
// -----------------------------
// *** Elementi Task Missile ***
// -----------------------------
#define MISSILE_V_MIN 300.0 //[km/h]
#define MISSILE_V_MAX 5000.0 //[km/h]
#define MISSILE_ACC_MIN 100000.0 //[km/(h*h)]
#define MISSILE_ACC_MAX 10000000.0 //[km/(h*h)]
#define MISSILE_X_MAX X1 + MISSILE_LX/2 //[pixel]
#define MISSILE_X_MIN X0 - MISSILE_LX/2 //[pixel]
#define MISSILE_Y_MAX Y1 + MISSILE_LY/2 //[pixel]
#define MISSILE_Y_MIN Y0 - MISSILE_LY/2 //[pixel]
 
#define MISSILE_TRASPARENT_COL FAB_white
 
#define MISSILE_LX 7 //[pixel]
#define MISSILE_LY 15 //[pixel]
 
#define MISSILE_PERIOD 10000
#define MISSILE_WCET 500
#define MISSILE_MET 100
 
 
 
 
 
// MUTEX:
mutex_t grx_mutex; //per l'accesso alla grafica
int app_mutex_init(mutex_t *m);
 
 
 
// FUNZIONI GESTIONE RISORSE DI MEMORIA:
void kern_init_bca();
 
 
 
//------------------END------------------
#endif
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: bca.h,v 1.2 2002-10-01 10:33:51 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: bca.h *
* included by: bca.c & bca_lib di cui fa da header*
* data: 15/09/2002 *
* creato da: Fabio CALABRESE *
* *
******************************************************
* *
* descrizione: contiene la definizione di variabili *
* e strutture globali, con un corredo *
* di macro e funzioni per la loro *
* gestione, usate nel programma SHaRK *
* "(B)ase(C)ontr(A)rea", il cui codice *
* e' scritto nel file bca.c; *
* il file bca_lib.c contiene il corpo *
* di tutte le funzioni qui dichiarate. *
* *
******************************************************/
 
#ifndef __BCA_H__
#define __BCA_H__
//----------------BEGIN------------------
 
// *** Librerie S.Ha.R.K ***
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"fab_lib/fab_grx.h"
#include"fab_lib/fab_tool.h"
// *** Librerie BCA ***
 
 
// ---------------------------------
// *** Elementi Grafici Generici ***
// ---------------------------------
 
// IMMAGINI:
FAB_IMAGE* image_sfondo;
FAB_IMAGE* image_bca;
FAB_IMAGE* image_aereo[4]; // 1 aereo per ogni direzione(soft e hard)
FAB_IMAGE* image_esplo[5]; // 5 immagini in sequenza simulanti
FAB_IMAGE* image_cannone[2]; // un esplosione
FAB_IMAGE* image_missile[2];
 
// BORDI:
FAB_BORDER* border_blu7;
FAB_BORDER* border_verde7;
FAB_BORDER* border_rosso7;
FAB_BORDER* border_bianco7;
FAB_BORDER* border_giallo7;
 
// FRAME:
FAB_FRAME* frame_bca;
FAB_FRAME* frame_misure_oriz;
FAB_FRAME* frame_misure_vert;
FAB_FRAME* frame_misure_vert;
FAB_FRAME* frame_titolo;
FAB_FRAME* frame_comandi;
FAB_FRAME* frame_control;
 
// BALLFRAME:
FAB_BALLFRAME* ballframe_radar;
FAB_BALLFRAME* ballframe_lucerossa[3];
 
// Base ContrAerea
#define BASE_L 1.0 // [Km]: lunghezza
#define BASE_H 2100 // [m]: altezza max di visibilita'
 
// Finestra Virtuale sullo schermo
#define FIN_X_MIN 20 // [pixel]
#define FIN_X_MAX 520-1 // [pixel]
#define FIN_Y_MIN 20 // [pixel]
#define FIN_Y_MAX 520-1 // [pixel]
// Inoltre si possono usare le seguenti + comode define
// con gli stessi valori:
#define X0 FIN_X_MIN
#define X1 FIN_X_MAX
#define Y0 FIN_Y_MIN
#define Y1 FIN_Y_MAX
// NB: non e' necessaria la proporzionalita' tra finestra
// reale(BASE_L*BASE_H) e virtuale((X1-X0)*(Y1-Y0))!
 
// Finestra Misure
#define FRAME_MISURE_LINE_COLOR FAB_green
#define FRAME_MISURE_BACK_COLOR FAB_black
#define FRAME_MISURE_ORIZ_LY 30
#define FRAME_MISURE_VERT_LX 52
 
// Finestra Titolo
#define FRAME_TITOLO_TEXT_COLOR1 FAB_yellow
#define FRAME_TITOLO_TEXT_COLOR2 FAB_white
#define FRAME_TITOLO_BACK_COLOR1 FAB_gray
#define FRAME_TITOLO_BACK_COLOR2 FAB_blue
 
// Finestra Comandi
#define FRAME_COMANDI_TEXT_COLOR1 FAB_yellow
#define FRAME_COMANDI_TEXT_COLOR2 FAB_white
#define FRAME_COMANDI_TEXT_COLOR3 FAB_red
#define FRAME_COMANDI_BACK_COLOR1 FAB_gray
#define FRAME_COMANDI_BACK_COLOR2 FAB_yellow
 
// Finestra Control
#define FRAME_CONTROL_TEXT_COLOR1 FAB_rgb( 50,255, 50)
#define FRAME_CONTROL_TEXT_COLOR2 FAB_rgb(150,255,150)
#define FRAME_CONTROL_BACK_COLOR FAB_black
 
// ---------------------------------
// *** Elementi Task Dummy_radar ***
// ---------------------------------
#define DUMMY_RADAR_GROUP 3
#define DUMMY_RADAR_PERIOD 50000
#define DUMMY_RADAR_WCET 400
#define DUMMY_RADAR_MET 200
 
// ---------------------------------
// *** Elementi Task Control ***
// ---------------------------------
#define CONTROL_PERIOD 50000
#define CONTROL_WCET 400
#define CONTROL_MET 300
 
// ---------------------------
// *** Elementi Task Esplo ***
// ---------------------------
#define ESPLO_TRASPARENT_COL FAB_white
#define ESPLO_LX 40
#define ESPLO_LY 40
 
#define ESPLO_PERIOD 80000
#define ESPLO_WCET 300
#define ESPLO_MET 100
 
// -----------------------------------
// *** Elementi Task Aereo_Creator ***
// -----------------------------------
#define AEREO_CREATOR_PERIOD 200000
#define AEREO_CREATOR_WCET 300
#define AEREO_CREATOR_MET 100
 
// -----------------------------------
// *** Elementi Task Cannone_Creator ***
// -----------------------------------
#define CANNONE_CREATOR_PERIOD 1000000
#define CANNONE_CREATOR_WCET 150
#define CANNONE_CREATOR_MET 50
 
// ---------------------------
// *** Elementi Task Aereo ***
// ---------------------------
#define AEREO_N_MAX 10
#define AEREO_N_MIN 1
 
#define AEREO_TRASPARENT_COL FAB_white
#define AEREO_BASE_COL FAB_green
#define AEREO_LX 32
#define AEREO_LY 19
#define AEREO_H_MIN 500 // [m]: altezza min di volo
#define AEREO_H_MAX 2000 // [m]: altezza max di volo (<BASE_H)
#define AEREO_L_MIN 0 // [km]: posizione 0 nella base
#define AEREO_L_MAX BASE_L // [km] posizione max nella base
#define AEREO_V_MIN 300.0 // [Km/h]: velocit… min di volo
#define AEREO_V_MAX 500.0 // [Km/h]: velocit… max di volo
#define AEREO_X_MIN X0 - AEREO_LX/2
#define AEREO_X_MAX X1 + AEREO_LX/2
 
#define AEREO_PERIOD 30000
#define AEREO_WCET 1250 //Verificato!
#define AEREO_MET 800
 
struct { BYTE status; //[0=free/1=occupato]
BYTE killing; //richiesta uscita se Š 1 altrimenti 0
PID pid;
COLOR color;
FAB_IMAGE* image;
double vel; //[km/h]
int dir; //[+1/-1]
WORD h; //[m]
double l; //[km]
WORD x, y; //[pixel]
} aereo_table[AEREO_N_MAX];
 
int aereo_count;
 
// -----------------------------
// *** Elementi Task Cannone ***
// -----------------------------
#define CANNONE_N_MAX 9
#define CANNONE_N_MIN 1
 
#define CANNONE_SENSIBILITA 200 //[m]
 
#define CANNONE_TRASPARENT_COL FAB_white
#define CANNONE_LX 33
#define CANNONE_LY 15
 
#define CANNONE_PERIOD 100000
#define CANNONE_WCET 1000
#define CANNONE_MET 100
 
struct { BYTE status; //[0=free/1=occupato]
BYTE killing; //richiesta uscita se Š 1 altrimenti 0
PID pid;
BYTE fire;
WORD x;
double missile_vel;
} cannone_table[CANNONE_N_MAX];
 
int cannone_count;
 
// -----------------------------
// *** Elementi Task Missile ***
// -----------------------------
#define MISSILE_V_MIN 300.0 //[km/h]
#define MISSILE_V_MAX 5000.0 //[km/h]
#define MISSILE_ACC_MIN 100000.0 //[km/(h*h)]
#define MISSILE_ACC_MAX 10000000.0 //[km/(h*h)]
#define MISSILE_X_MAX X1 + MISSILE_LX/2 //[pixel]
#define MISSILE_X_MIN X0 - MISSILE_LX/2 //[pixel]
#define MISSILE_Y_MAX Y1 + MISSILE_LY/2 //[pixel]
#define MISSILE_Y_MIN Y0 - MISSILE_LY/2 //[pixel]
 
#define MISSILE_TRASPARENT_COL FAB_white
 
#define MISSILE_LX 7 //[pixel]
#define MISSILE_LY 15 //[pixel]
 
#define MISSILE_PERIOD 10000
#define MISSILE_WCET 500
#define MISSILE_MET 100
 
 
 
 
 
// MUTEX:
mutex_t grx_mutex; //per l'accesso alla grafica
int app_mutex_init(mutex_t *m);
 
 
 
// FUNZIONI GESTIONE RISORSE DI MEMORIA:
void kern_init_bca();
 
 
 
//------------------END------------------
#endif
/demos/trunk/bca/makefile
1,17 → 1,16
#
#
#
 
ifndef BASE
-/..
-endif
-include $(BASE)/config/config.mk
-
-PROGS= bca
-
-include $(BASE)/config/example.mk
-
-bca:
- make -f $(SUBMAKE) APP=bca INIT= OTHEROBJS="initfile.o fab_lib.o bca_lib.o"
-
+#
+#
+#
+
+ifndef BASE
+BASE=../..
+endif
+include $(BASE)/config/config.mk
+
+PROGS= bca
+
+include $(BASE)/config/example.mk
+
+bca:
+ make -f $(SUBMAKE) APP=bca INIT= OTHEROBJS="initfile.o fab_lib.o bca_lib.o"
+
/demos/trunk/bca/fab_lib/fab_grx.h
1,201 → 1,201
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_grx.h,v 1.1 2002-10-01 10:25:02 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_grx.h *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************
* *
* descrizione: libreria di funzioni grafiche: *
* permette di gestire con facilita' *
* immagini, cornici, e veri e propri *
* pannelli colorati. *
* Il contesto di grafica va avviato *
* con FAB_grx_open() e alla fine *
* chiuso correttamente con la funz. *
* FAB_grx_close(). L'ambiente di *
* grafica e'impostato a 16bit per *
* default, comunque e' sempre *
* possibile scegliere la profondita' *
* di colori preferita tra 15/16/24/32*
* definendo semplicemente solo una *
* delle seguenti costanti all'inizio *
* del proprio programma che include *
* questa libreria grafica: *
* FAB_GRX_15 *
* FAB_GRX_16 (default) *
* FAB_GRX_24 *
* FAB_GRX_32 *
* *
****************************************************/
 
#ifndef __FAB_LIB_fab_grx_h__
#define __FAB_LIB_fab_grx_h__
//-------------------BEGIN---------------------------
 
// *** Librerie di S.Ha.R.K. ***
#include<kernel/kern.h>
#include<drivers/gd.h>
#include<ll/sys/types.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"FAB_grx.sys"
 
//#define FAB_GRX_15
//#define FAB_GRX_16
//#define FAB_GRX_24
//#define FAB_GRX_32
 
typedef __FAB_COLOR COLOR;
 
typedef struct {
WORD lx,ly;
COLOR * buf;
int trasparent;
COLOR trasparent_col;
} FAB_IMAGE;
 
typedef struct {
WORD dim;
COLOR * buf;
} FAB_BORDER;
 
typedef struct {
FAB_BORDER * border; //default = NULL
WORD border_dim; //default = 0
COLOR border_col;
 
BYTE trasparent; //default = 0
FAB_IMAGE * image; //default = NULL
COLOR color;
 
WORD x0,y0,x1,y1; //spigoli pannello interno
//cornice esclusa: vengono settati
//automaticamente con FAB_frame_put().
} FAB_FRAME;
typedef struct {
FAB_BORDER * border; //default = NULL
WORD border_dim; //default = 0
COLOR border_col;
 
BYTE trasparent; //default = 0
COLOR color;
 
WORD cx,cy,r; //centro e raggio del pannello
//circolare: vengono settati
//automaticamente con FAB_ballframe_put().
} FAB_BALLFRAME;
 
// -----------
// Definizioni
//----------------------
#define FAB_BPP __FAB_BPP
#define FAB_rgb(R24,G24,B24) __FAB_rgb((R24),(G24),(B24))
 
// Colori base
#define FAB_white FAB_rgb(255,255,255)
#define FAB_black FAB_rgb( 0, 0, 0)
#define FAB_red FAB_rgb(255, 0, 0)
#define FAB_green FAB_rgb( 0,255, 0)
#define FAB_blue FAB_rgb( 0, 0,255)
#define FAB_yellow FAB_rgb(255,255, 0)
#define FAB_gray FAB_rgb(100,100,100)
 
//----------------------
 
// ----------------
// Funzioni & Macro
//--------------------------------------------------
int FAB_grx_open(WORD lx, WORD ly);
void FAB_grx_close();
 
FAB_IMAGE* FAB_image_alloc(WORD lx, WORD ly); //richiede DISABLED INTERRUPTS
void FAB_image_free(FAB_IMAGE* image); //richiede DISABLED INTERRUPTS
FAB_BORDER* FAB_border_alloc(WORD dim); //richiede DISABLED INTERRUPTS
void FAB_border_free(FAB_BORDER * border);//richiede DISABLED INTERRUPTS
FAB_FRAME* FAB_frame_alloc(); //richiede DISABLED INTERRUPTS
void FAB_frame_free(FAB_FRAME * frame); //richiede DISABLED INTERRUPTS
FAB_BALLFRAME* FAB_ballframe_alloc(); //richiede DISABLED INTERRUPTS
void FAB_ballframe_free(FAB_BALLFRAME * frame);//richiede DISABLED INTERRUPTS
 
// Permette di riempire lo spazio allocato ad un FAB_IMAGE
// leggendo le sequenze rgb a 24bit da un file immagine binario.
// Un formato perfettamente compatibile Š quello
// "RAW"(con header=0 e sequenza ad ordinamento RGB-RGB-RGB...):
int FAB_image_load(FAB_IMAGE* image, char* file_name); // solo in __kernel_register_levels__()
// Per default un FAB_IMAGE non ha il colore di trasparenza:
#define FAB_image_no_trasparent_set(IMAGE) (IMAGE)->trasparent=0
#define FAB_image_trasparent_set(IMAGE,TRASPARENT_COL) (IMAGE)->trasparent=1;(IMAGE)->trasparent_col=(TRASPARENT_COL)
 
// Settaggio FAB_BORDER deve essere fatto manualmente!
// esempio:
// mio_border->buf[i] = FAB_rgb(0,100,0);
// ...
// mio_border->buf[N] = FAB_rgb(0,100,255);
// (non esiste una funzione FAB_border_set)
 
#define FAB_frame_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL);
#define FAB_frame_color_set(FRAME,TRASPARENT_FLAG,IMAGE,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->image=(IMAGE);(FRAME)->color=(COLOR);
#define FAB_ballframe_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL);
#define FAB_ballframe_color_set(FRAME,TRASPARENT_FLAG,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->color=(COLOR);
 
void FAB_ball_put(WORD cx, WORD cy, WORD r, COLOR c);
void FAB_image_get(FAB_IMAGE* image, WORD x, WORD y, WORD lx, WORD ly);
void FAB_image_put(FAB_IMAGE* image, WORD x, WORD y);
void FAB_image_put_within(FAB_IMAGE* image, WORD x0, WORD y0,
WORD xx0, WORD yy0, WORD xx1, WORD yy1);
void FAB_image_copy(FAB_IMAGE* orig_image, FAB_IMAGE* dest_image);
void FAB_image_color_change(FAB_IMAGE* image, COLOR old_col, COLOR new_col);
void FAB_image_fill(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly);
void FAB_border_put(FAB_BORDER* border, WORD x0, WORD y0, WORD x1, WORD y1);
void FAB_ballborder_put(FAB_BORDER* border, WORD cx, WORD cy, WORD r_int);
void FAB_frame_put(FAB_FRAME* frame, WORD x0, WORD y0, WORD lx, WORD ly);
void FAB_ballframe_put(FAB_BALLFRAME* frame, WORD cx, WORD cy, WORD r);
//--------------------------------------------------
 
// Altro...
 
//---------------------END---------------------------
#endif
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_grx.h,v 1.2 2002-10-01 10:33:52 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_grx.h *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************
* *
* descrizione: libreria di funzioni grafiche: *
* permette di gestire con facilita' *
* immagini, cornici, e veri e propri *
* pannelli colorati. *
* Il contesto di grafica va avviato *
* con FAB_grx_open() e alla fine *
* chiuso correttamente con la funz. *
* FAB_grx_close(). L'ambiente di *
* grafica e'impostato a 16bit per *
* default, comunque e' sempre *
* possibile scegliere la profondita' *
* di colori preferita tra 15/16/24/32*
* definendo semplicemente solo una *
* delle seguenti costanti all'inizio *
* del proprio programma che include *
* questa libreria grafica: *
* FAB_GRX_15 *
* FAB_GRX_16 (default) *
* FAB_GRX_24 *
* FAB_GRX_32 *
* *
****************************************************/
 
#ifndef __FAB_LIB_fab_grx_h__
#define __FAB_LIB_fab_grx_h__
//-------------------BEGIN---------------------------
 
// *** Librerie di S.Ha.R.K. ***
#include<kernel/kern.h>
#include<drivers/gd.h>
#include<ll/sys/types.h>
// *** Librerie Standard C ***
// *** Librerie FAB ***
#include"fab_grx.sys"
 
//#define FAB_GRX_15
//#define FAB_GRX_16
//#define FAB_GRX_24
//#define FAB_GRX_32
 
typedef __FAB_COLOR COLOR;
 
typedef struct {
WORD lx,ly;
COLOR * buf;
int trasparent;
COLOR trasparent_col;
} FAB_IMAGE;
 
typedef struct {
WORD dim;
COLOR * buf;
} FAB_BORDER;
 
typedef struct {
FAB_BORDER * border; //default = NULL
WORD border_dim; //default = 0
COLOR border_col;
 
BYTE trasparent; //default = 0
FAB_IMAGE * image; //default = NULL
COLOR color;
 
WORD x0,y0,x1,y1; //spigoli pannello interno
//cornice esclusa: vengono settati
//automaticamente con FAB_frame_put().
} FAB_FRAME;
typedef struct {
FAB_BORDER * border; //default = NULL
WORD border_dim; //default = 0
COLOR border_col;
 
BYTE trasparent; //default = 0
COLOR color;
 
WORD cx,cy,r; //centro e raggio del pannello
//circolare: vengono settati
//automaticamente con FAB_ballframe_put().
} FAB_BALLFRAME;
 
// -----------
// Definizioni
//----------------------
#define FAB_BPP __FAB_BPP
#define FAB_rgb(R24,G24,B24) __FAB_rgb((R24),(G24),(B24))
 
// Colori base
#define FAB_white FAB_rgb(255,255,255)
#define FAB_black FAB_rgb( 0, 0, 0)
#define FAB_red FAB_rgb(255, 0, 0)
#define FAB_green FAB_rgb( 0,255, 0)
#define FAB_blue FAB_rgb( 0, 0,255)
#define FAB_yellow FAB_rgb(255,255, 0)
#define FAB_gray FAB_rgb(100,100,100)
 
//----------------------
 
// ----------------
// Funzioni & Macro
//--------------------------------------------------
int FAB_grx_open(WORD lx, WORD ly);
void FAB_grx_close();
 
FAB_IMAGE* FAB_image_alloc(WORD lx, WORD ly); //richiede DISABLED INTERRUPTS
void FAB_image_free(FAB_IMAGE* image); //richiede DISABLED INTERRUPTS
FAB_BORDER* FAB_border_alloc(WORD dim); //richiede DISABLED INTERRUPTS
void FAB_border_free(FAB_BORDER * border);//richiede DISABLED INTERRUPTS
FAB_FRAME* FAB_frame_alloc(); //richiede DISABLED INTERRUPTS
void FAB_frame_free(FAB_FRAME * frame); //richiede DISABLED INTERRUPTS
FAB_BALLFRAME* FAB_ballframe_alloc(); //richiede DISABLED INTERRUPTS
void FAB_ballframe_free(FAB_BALLFRAME * frame);//richiede DISABLED INTERRUPTS
 
// Permette di riempire lo spazio allocato ad un FAB_IMAGE
// leggendo le sequenze rgb a 24bit da un file immagine binario.
// Un formato perfettamente compatibile Š quello
// "RAW"(con header=0 e sequenza ad ordinamento RGB-RGB-RGB...):
int FAB_image_load(FAB_IMAGE* image, char* file_name); // solo in __kernel_register_levels__()
// Per default un FAB_IMAGE non ha il colore di trasparenza:
#define FAB_image_no_trasparent_set(IMAGE) (IMAGE)->trasparent=0
#define FAB_image_trasparent_set(IMAGE,TRASPARENT_COL) (IMAGE)->trasparent=1;(IMAGE)->trasparent_col=(TRASPARENT_COL)
 
// Settaggio FAB_BORDER deve essere fatto manualmente!
// esempio:
// mio_border->buf[i] = FAB_rgb(0,100,0);
// ...
// mio_border->buf[N] = FAB_rgb(0,100,255);
// (non esiste una funzione FAB_border_set)
 
#define FAB_frame_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL);
#define FAB_frame_color_set(FRAME,TRASPARENT_FLAG,IMAGE,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->image=(IMAGE);(FRAME)->color=(COLOR);
#define FAB_ballframe_border_set(FRAME,BORDER,BORDER_DIM,BORDER_COL) (FRAME)->border=(BORDER);(FRAME)->border_dim=(BORDER_DIM);(FRAME)->border_col=(BORDER_COL);
#define FAB_ballframe_color_set(FRAME,TRASPARENT_FLAG,COLOR) (FRAME)->trasparent=(TRASPARENT_FLAG);(FRAME)->color=(COLOR);
 
void FAB_ball_put(WORD cx, WORD cy, WORD r, COLOR c);
void FAB_image_get(FAB_IMAGE* image, WORD x, WORD y, WORD lx, WORD ly);
void FAB_image_put(FAB_IMAGE* image, WORD x, WORD y);
void FAB_image_put_within(FAB_IMAGE* image, WORD x0, WORD y0,
WORD xx0, WORD yy0, WORD xx1, WORD yy1);
void FAB_image_copy(FAB_IMAGE* orig_image, FAB_IMAGE* dest_image);
void FAB_image_color_change(FAB_IMAGE* image, COLOR old_col, COLOR new_col);
void FAB_image_fill(FAB_IMAGE* image, WORD x0, WORD y0, WORD lx, WORD ly);
void FAB_border_put(FAB_BORDER* border, WORD x0, WORD y0, WORD x1, WORD y1);
void FAB_ballborder_put(FAB_BORDER* border, WORD cx, WORD cy, WORD r_int);
void FAB_frame_put(FAB_FRAME* frame, WORD x0, WORD y0, WORD lx, WORD ly);
void FAB_ballframe_put(FAB_BALLFRAME* frame, WORD cx, WORD cy, WORD r);
//--------------------------------------------------
 
// Altro...
 
//---------------------END---------------------------
#endif
/demos/trunk/bca/fab_lib/fab_show.h
1,83 → 1,83
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_show.h,v 1.1 2002-10-01 10:25:02 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_show.h *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************
* *
* descrizione: libreria di funzioni per stampare *
* specifiche informazioni utili *
* riguardo lo stato del sistema. *
* *
****************************************************/
 
#ifndef __FAB_LIB__FAB_show_h__
#define __FAB_LIB__FAB_show_h__
//-------------------BEGIN---------------------------
 
// *** Librerie S.Ha.R.K ***
 
// *** Librerie Standard C ***
 
// *** Librerie FAB ***
#include "FAB_msg.h"
 
// -----------
// Definizioni
//----------------------
//----------------------
 
// ----------------
// Funzioni & Macro
//-------------------------------------------------
void FAB_show_sched_modules();
//--------------------------------------------------
 
 
// Altro...
 
//----------------------END--------------------------
#endif
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@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: fab_show.h,v 1.2 2002-10-01 10:33:52 pj Exp $ */
 
/*
* Copyright (C) 2000 Fabio Calabrese <fabiocalabrese77@yahoo.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
*
*/
 
/****************************************************
* *
* file: FAB_show.h *
* libreria: FAB_LIB *
* version: 1.0 25/08/2002 *
* creato da: Fabio CALABRESE *
* *
****************************************************
* *
* descrizione: libreria di funzioni per stampare *
* specifiche informazioni utili *
* riguardo lo stato del sistema. *
* *
****************************************************/
 
#ifndef __FAB_LIB__FAB_show_h__
#define __FAB_LIB__FAB_show_h__
//-------------------BEGIN---------------------------
 
// *** Librerie S.Ha.R.K ***
 
// *** Librerie Standard C ***
 
// *** Librerie FAB ***
#include "fab_msg.h"
 
// -----------
// Definizioni
//----------------------
//----------------------
 
// ----------------
// Funzioni & Macro
//-------------------------------------------------
void FAB_show_sched_modules();
//--------------------------------------------------
 
 
// Altro...
 
//----------------------END--------------------------
#endif