Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 713 → Rev 714

/shark/trunk/drivers/serial/include/drivers/scomirq.h
0,0 → 1,91
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
 
/*
* Copyright (C) 2000 Michele Cirinei
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
 
/*
CVS : $Id: scomirq.h,v 1.1 2004-06-01 14:08:28 giacomo Exp $
 
scomirq.h:
 
Layer for IRQ Serial Communication.
 
*/
#ifndef __SCOMIRQ_H__
#define __SCOMIRQ_H__
 
#include <drivers/scom.h>
 
#define bit0 (1 << 0)
#define bit1 (1 << 1)
#define bit2 (1 << 2)
#define bit3 (1 << 3)
#define bit4 (1 << 4)
#define bit5 (1 << 5)
#define bit6 (1 << 6)
#define bit7 (1 << 7)
 
#define RBRF_IRQ bit0
#define THRE_IRQ bit1
#define LSR_IRQ bit2
#define ALL_IRQ (RBRF_IRQ | THRE_IRQ | LSR_IRQ)
 
#define COM_OK 0
#define COM_ERROR 1
 
/****************************
Variables
****************************/
struct SCom_Access_Type{
void (*request)(unsigned port, BYTE len, BYTE *data);
void (*confirm)(unsigned port, BYTE msg_id);
void (*indication)(unsigned port, BYTE data);
};
 
extern struct SCom_Access_Type SCom_Access;
 
/*****************************
* Functions
*****************************/
void com_end(unsigned port);
 
void com_irq_enable(unsigned port, unsigned irq);
 
void com_irq_disable(unsigned port, unsigned irq);
 
void com_init(unsigned port, DWORD speed, BYTE parity, BYTE len, BYTE stop);
 
void com_set_functions(void (*confirm)(unsigned port, BYTE msg_status),void (*indication)(unsigned port, BYTE data));
 
#endif
/shark/trunk/drivers/serial/include/drivers/scom.h
18,17 → 18,6
* http://shark.sssup.it
*/
 
/**
------------
CVS : $Id: scom.h,v 1.1 2004-03-29 18:31:42 mauro Exp $
 
File: $File$
Revision: $Revision: 1.1 $
Last update: $Date: 2004-03-29 18:31:42 $
------------
 
**/
 
/*
* Copyright (C) 2000 Gerardo Lamastra
*
48,23 → 37,9
*
*/
 
/* Project: HARTIK 3.0 */
/* Description: Hard Real TIme Kernel for 386 & higher machines */
/* Author: Gerardo Lamastra */
/* Date: 9/5/96 */
 
/* File: SCOM.H */
/* Revision: 2.0 */
 
#ifndef __SCOM_H__
#define __SCOM_H__
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <modules/sem.h>
 
/* Number of available COM links */
#define COM_LINKS 4
 
110,46 → 85,11
#define bit_on(v,b) v |= (b)
#define bit_off(v,b) v &= (~(b))
 
/* The descriptor of a serial link */
/* Each array entry is associated to a COM port */
/* The control field is used to specify which kind of interrupts */
/* are going to be served; the status field tracks if the entry */
/* is curretly used & if the shared fast handler is linked */
/* The semaphores are opened if you use an asyncronous server */
/* with the link */
 
extern struct COM_LINK {
/* These fields are for general use */
BYTE status;
BYTE control;
BYTE request;
BYTE msk;
PID server;
sem_t mutex;
sem_t tx_sem;
sem_t rx_sem;
BYTE *tx_buf;
BYTE *rx_buf;
unsigned tx_len,rx_len;
unsigned tx_cnt,rx_cnt;
} com_link[COM_LINKS];
 
/* Available servers */
TASK duplexServer(int port);
TASK rxServer(int port);
 
int com_open(unsigned int port,DWORD speed,BYTE parity,BYTE len,BYTE stop);
int com_server(unsigned int port,unsigned int control,PID server);
int com_close(unsigned int port);
unsigned com_read(unsigned int port,unsigned int reg);
unsigned com_receive(unsigned int port);
void com_write(unsigned int port,unsigned int reg,unsigned int value);
void com_send(unsigned int port,BYTE b);
void com_AsyncSend(int port,void *buf,unsigned int len);
void com_AsyncReceive(int port,void *buf,unsigned int len);
 
#ifdef __cplusplus
};
#endif
 
#endif