- some more defines
- the dano version is exposed as v1.1 so drivers can use select with a simple ifdef - add copyrights from the tty driver as I'll be copying code from it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25201 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -27,7 +27,7 @@ struct ddomain {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef bool (*tty_service_func)(struct tty *, struct ddrover *, uint );
|
typedef bool (*tty_service_func)(struct tty *tty, struct ddrover *rover, uint op);
|
||||||
|
|
||||||
struct tty {
|
struct tty {
|
||||||
uint nopen;
|
uint nopen;
|
||||||
@@ -53,6 +53,32 @@ struct ttyfile {
|
|||||||
bigtime_t vtime;
|
bigtime_t vtime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// flags
|
||||||
|
#define TTYCARRIER (1 << 0)
|
||||||
|
#define TTYWRITABLE (1 << 1)
|
||||||
|
#define TTYWRITING (1 << 2)
|
||||||
|
#define TTYREADING (1 << 3)
|
||||||
|
#define TTYOSTOPPED (1 << 4)
|
||||||
|
#define TTYEXCLUSIVE (1 << 5)
|
||||||
|
#define TTYHWDCD (1 << 6)
|
||||||
|
#define TTYHWCTS (1 << 7)
|
||||||
|
#define TTYHWDSR (1 << 8)
|
||||||
|
#define TTYHWRI (1 << 9)
|
||||||
|
#define TTYFLOWFORCED (1 << 10)
|
||||||
|
|
||||||
|
// ops
|
||||||
|
#define TTYENABLE 0
|
||||||
|
#define TTYDISABLE 1
|
||||||
|
#define TTYSETMODES 2
|
||||||
|
#define TTYOSTART 3
|
||||||
|
#define TTYOSYNC 4
|
||||||
|
#define TTYISTOP 5
|
||||||
|
#define TTYIRESUME 6
|
||||||
|
#define TTYSETBREAK 7
|
||||||
|
#define TTYCLRBREAK 8
|
||||||
|
#define TTYSETDTR 9
|
||||||
|
#define TTYCLRDTR 10
|
||||||
|
#define TTYGETSIGNALS 11
|
||||||
|
|
||||||
typedef struct tty_module_info tty_module_info;
|
typedef struct tty_module_info tty_module_info;
|
||||||
|
|
||||||
@@ -79,6 +105,32 @@ struct tty_module_info {
|
|||||||
void (*ddracquire)(struct ddrover *, struct ddomain *);
|
void (*ddracquire)(struct ddrover *, struct ddomain *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// BeOS R5.1d0 has a different module with the same version...
|
||||||
|
// we exort this module as version 1.1 to allow using select from drivers
|
||||||
|
struct tty_module_info_dano {
|
||||||
|
// not a real bus manager... no rescan() !
|
||||||
|
module_info mi;
|
||||||
|
status_t (*ttyopen)(struct ttyfile *, struct ddrover *, tty_service_func);
|
||||||
|
status_t (*ttyclose)(struct ttyfile *, struct ddrover *);
|
||||||
|
status_t (*ttyfree)(struct ttyfile *, struct ddrover *);
|
||||||
|
status_t (*ttyread)(struct ttyfile *, struct ddrover *, char *, size_t *);
|
||||||
|
status_t (*ttywrite)(struct ttyfile *, struct ddrover *, const char *, size_t *);
|
||||||
|
status_t (*ttycontrol)(struct ttyfile *, struct ddrover *, ulong, void *, size_t);
|
||||||
|
|
||||||
|
status_t (*ttyselect)(struct ttyfile *, struct ddrover *, uint8, uint32, selectsync *);
|
||||||
|
status_t (*ttydeselect)(struct ttyfile *, struct ddrover *, uint8, selectsync *);
|
||||||
|
|
||||||
|
void (*ttyinit)(struct tty *, bool);
|
||||||
|
void (*ttyilock)(struct tty *, struct ddrover *, bool );
|
||||||
|
void (*ttyhwsignal)(struct tty *, struct ddrover *, int, bool);
|
||||||
|
int (*ttyin)(struct tty *, struct ddrover *, int);
|
||||||
|
int (*ttyout)(struct tty *, struct ddrover *);
|
||||||
|
struct ddrover *(*ddrstart)(struct ddrover *);
|
||||||
|
void (*ddrdone)(struct ddrover *);
|
||||||
|
void (*ddracquire)(struct ddrover *, struct ddomain *);
|
||||||
|
};
|
||||||
|
|
||||||
#define B_TTY_MODULE_NAME "bus_managers/tty/v1"
|
#define B_TTY_MODULE_NAME "bus_managers/tty/v1"
|
||||||
|
#define B_TTY_MODULE_NAME_DANO "bus_managers/tty/v1.1"
|
||||||
|
|
||||||
#endif /* _TTY_TTYLAYER_H */
|
#endif /* _TTY_TTYLAYER_H */
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel bus_managers tty ;
|
SubDir HAIKU_TOP src add-ons kernel bus_managers tty ;
|
||||||
|
|
||||||
|
UsePrivateKernelHeaders ;
|
||||||
|
UsePrivateHeaders drivers ;
|
||||||
UsePrivateHeaders kernel shared ;
|
UsePrivateHeaders kernel shared ;
|
||||||
UsePrivateHeaders [ FDirName kernel util ] ;
|
UsePrivateHeaders [ FDirName kernel util ] ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008, Haiku.
|
* Copyright 2008, François Revol, <[email protected]>.
|
||||||
|
* Copyright 2007-2008, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* François Revol <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <util/AutoLock.h>
|
||||||
|
#include <util/kernel_cpp.h>
|
||||||
|
|
||||||
|
#include <team.h>
|
||||||
|
|
||||||
|
#include <tty.h>
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <device_manager.h>
|
#include <device_manager.h>
|
||||||
#include <bus_manager.h>
|
#include <bus_manager.h>
|
||||||
#include <tty/ttylayer.h>
|
#include <tty/ttylayer.h>
|
||||||
|
|
||||||
#include "tty.h"
|
#include "tty_private.h"
|
||||||
|
|
||||||
//#define TTY_TRACE
|
//#define TTY_TRACE
|
||||||
#ifdef TTY_TRACE
|
#ifdef TTY_TRACE
|
||||||
@@ -66,6 +80,20 @@ tty_control(struct ttyfile *, struct ddrover *, ulong, void *, size_t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
tty_select(struct ttyfile *, struct ddrover *, uint8, uint32, selectsync *)
|
||||||
|
{
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
tty_deselect(struct ttyfile *, struct ddrover *, uint8, selectsync *)
|
||||||
|
{
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_init(struct tty *, bool)
|
tty_init(struct tty *, bool)
|
||||||
{
|
{
|
||||||
@@ -192,7 +220,36 @@ static struct tty_module_info sTTYModule = {
|
|||||||
&tty_ddr_acquire
|
&tty_ddr_acquire
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct tty_module_info_dano sDanoTTYModule = {
|
||||||
|
// ! this is *NOT* a real bus manager (no rescan call!)
|
||||||
|
//{
|
||||||
|
{
|
||||||
|
B_TTY_MODULE_NAME_DANO,
|
||||||
|
0, //B_KEEP_LOADED,
|
||||||
|
tty_module_std_ops
|
||||||
|
},
|
||||||
|
//NULL
|
||||||
|
//},
|
||||||
|
&tty_open,
|
||||||
|
&tty_close,
|
||||||
|
&tty_free,
|
||||||
|
&tty_read,
|
||||||
|
&tty_write,
|
||||||
|
&tty_control,
|
||||||
|
&tty_select,
|
||||||
|
&tty_deselect,
|
||||||
|
&tty_init,
|
||||||
|
&tty_ilock,
|
||||||
|
&tty_hwsignal,
|
||||||
|
&tty_in,
|
||||||
|
&tty_out,
|
||||||
|
&tty_ddr_start,
|
||||||
|
&tty_ddr_done,
|
||||||
|
&tty_ddr_acquire
|
||||||
|
};
|
||||||
|
|
||||||
module_info *modules[] = {
|
module_info *modules[] = {
|
||||||
(module_info *)&sTTYModule,
|
(module_info *)&sTTYModule,
|
||||||
|
(module_info *)&sDanoTTYModule,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008, Haiku.
|
* Copyright 2008, François Revol, <[email protected]>.
|
||||||
|
* Copyright 2007-2008, Ingo Weinhold, [email protected].
|
||||||
|
* Copyright 2004-2006, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* François Revol <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
#ifndef _TTY_H_
|
#ifndef _TTY_H_
|
||||||
#define _TTY_H_
|
#define _TTY_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user