Subversion Repositories shark

Rev

Rev 3 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * 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: pxc.h,v 1.2 2003-03-13 13:38:28 pj Exp $

 File:        $File$
 Revision:    $Revision: 1.2 $
 Last update: $Date: 2003-03-13 13:38:28 $
 ------------

**/


/*
 * Copyright (C) 2000 Danilo Dealberti and Claudio Melita
 *
 * 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
 *
 */


/*
 Nome File : PXC.H
 Autore : Danilo Dealberti
          Claudio Melita
 Data : 16-11-1999
 Descrizione : Header file per il controllo del frame grabber PXC200 della
               ImageNation
 
*/

/*
 Note :
 Il seguente modulo permette Š in grado di supportare ogni frame grabber
 dotato del controllore single-chip Bt848/Bt848A/Bt849 della BrookTree (ora
 Conexant)
 Per variare la risoluzione di acquisizione o il formato dei dati in ingresso
 vanno variati i parametri contenuti nel seguente modulo , il quale Š
 specifico per immagini di 384x288 pixel codificate a 8 livelli di grigio
 Le modifiche possono essere effettuate consultando il manuale di descrizione del
 chip Bt848 disponibile al sito www.Conexant.com
*/


#ifndef F_G_PXC
#define F_G_PXC

#include <kernel/types.h>
#include <modules/cabs.h>

#include "ll/sys/cdefs.h"

__BEGIN_DECLS

// Definizione degli indirizzi di comando della scheda , relativamente
// a quelli direttamente impiegati

#define PXC_DSTATUS 0x000
#define PXC_IOFORM 0x004
#define PXC_E_CROP 0x00c
#define PXC_O_CROP 0x08c
#define PXC_E_VDELAY_LO 0x010
#define PXC_O_VDELAY_LO 0x090
#define PXC_E_VACTIVE_LO 0x014
#define PXC_O_VACTIVE_LO 0x094
#define PXC_E_HDELAY_LO 0x018
#define PXC_O_HDELAY_LO 0x098
#define PXC_E_HACTIVE_LO 0x01c
#define PXC_O_HACTIVE_LO 0x09c
#define PXC_E_HSCALE_HI 0x020
#define PXC_O_HSCALE_HI 0x0a0
#define PXC_E_HSCALE_LO 0x024
#define PXC_O_HSCALE_LO 0x0a4
#define PXC_E_VSCALE_HI 0x04c
#define PXC_O_VSCALE_HI 0x0cc
#define PXC_E_VSCALE_LO 0x050
#define PXC_O_VSCALE_LO 0x0d0
#define PXC_ADELAY 0x060
#define PXC_BDELAY 0x064
#define PXC_COLOR_FMT 0x0d4
#define PXC_CAP_CTL 0x0dc
#define PXC_INT_STAT 0x100
#define PXC_INT_MASK 0x104
#define PXC_RISC_STRT_ADD 0x114
#define PXC_GPIO_DMA_CTL 0x10c


// Definizione delle macro per realizzare le istruzioni RISC
// Codici operativi
#define PXC_WRITE (((DWORD)0x01) << 28)
#define PXC_WRITE123 (((DWORD)0x09) << 28)
#define PXC_WRITE1S23 (((DWORD)0x0b) << 28)
#define PXC_WRITEC (((DWORD)0x05) << 28)
#define PXC_SKIP (((DWORD)0x02) << 28)
#define PXC_SKIP123 (((DWORD)0x0a) << 28)
#define PXC_JUMP (((DWORD)0x07) << 28)
#define PXC_SYNC (((DWORD)0x08) << 28)

// Usati per settare l' interruzione e per indicare come la stessa
// istruzione di deve sincronizzare con l' inizio di riga e la fine di
// riga
#define PXC_SET_IRQ (((DWORD) 0x01) << 24)
#define PXC_SET_SOL (((DWORD) 0x01) << 27)
#define PXC_SET_EOL (((DWORD) 0x01) << 26)
#define PXC_FM1 ((DWORD) 0x06)
#define PXC_FM3 ((DWORD) 0x0e)
#define PXC_VRO ((DWORD) 0x0c)
#define PXC_VRE ((DWORD) 0x04)




#define PXC_MAXX 384
#define PXC_MAXY 288

#define PXC_MAX_LISTENERS 20 // Al massimo 20 task possono essere
                             // risvegliati dal frame grabber



#define PXC_FRAME_TIME 20000 // Un frame ogni 20 msec

// Prototipi delle funzioni interessate e strutture dati
typedef struct {
 PID proc;
 int DRel; /* Frame rate di attivazione dei task;
              esso e' scorrelato dal periodo del task;
              1 significa che il task e' sempre attivato. */

} PXC_Node;



typedef struct {
 PXC_Node Elementi[PXC_MAX_LISTENERS];
 int Top;
} PXC_Listeners;


// Prototipi

TIME PXC_Initiate(int number);
     /*
      Inizializza il frame grabber e ritorna il periodo di attivazione del
      Server(che in sostanza non esiste, Š solo una fast di attivazione)
     */


void PXC_Start(void) ;
     /* Attivazione del processo di cattura */

void PXC_Close(void);
     /* Chiusura dell' applicazione con rimozione del frame grabber dal
     bus PCI
     */


int PXC_Push_Listener(PID l, int rate);
                    // Aggiunge un processo che si deve risvegliare
                    // con la telecamera; rate indica ogni quanto deve
                    // essere attivato tale task.
                    // 1 = successo , 0 = insuccesso

int PXC_Pop_Listener(void);
                    // Rimuove il processo affiorante
                    // 1 successo , 0 = pila vuota
     

CAB PXC_GetCab(void);


__END_DECLS
#endif