Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 538 → Rev 714

/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