xref: /haiku/src/add-ons/kernel/debugger/laplinkll/laplinkll.h (revision ed6250c95736c0b55da79d6e9dd01369532260c0)
1*ed6250c9SFrançois Revol /*
2*ed6250c9SFrançois Revol  * Copyright 2008, Haiku, Inc. All Rights Reserved.
3*ed6250c9SFrançois Revol  * Distributed under the terms of the MIT License.
4*ed6250c9SFrançois Revol  *
5*ed6250c9SFrançois Revol  * Authors:
6*ed6250c9SFrançois Revol  *		François Revol, revol@free.fr
7*ed6250c9SFrançois Revol  *
8*ed6250c9SFrançois Revol  * Copyright 2005, François Revol.
9*ed6250c9SFrançois Revol  */
10*ed6250c9SFrançois Revol 
11*ed6250c9SFrançois Revol /*
12*ed6250c9SFrançois Revol 	Description: Implements a tty on top of the parallel port,
13*ed6250c9SFrançois Revol 				 using PLIP-like byte-by-byte protocol.
14*ed6250c9SFrançois Revol 				 Low level stuff.
15*ed6250c9SFrançois Revol */
16*ed6250c9SFrançois Revol 
17*ed6250c9SFrançois Revol 
18*ed6250c9SFrançois Revol // LPT1
19*ed6250c9SFrançois Revol #define LPTBASE 0x378
20*ed6250c9SFrançois Revol #define LPTIRQ 7
21*ed6250c9SFrançois Revol #define LPTDONGLE "/dev/misc/dongle/parallel1"
22*ed6250c9SFrançois Revol #define LPTSPIN 30
23*ed6250c9SFrançois Revol #define LPTSOFTRIES 1000
24*ed6250c9SFrançois Revol #define LPTNIBTRIES 100
25*ed6250c9SFrançois Revol #define LAPLINK_MAX_FRAME 512
26*ed6250c9SFrançois Revol 
27*ed6250c9SFrançois Revol typedef struct laplink_state {
28*ed6250c9SFrançois Revol 	int32 port;
29*ed6250c9SFrançois Revol 	int32 irq;
30*ed6250c9SFrançois Revol 
31*ed6250c9SFrançois Revol 	uint8 rstate;
32*ed6250c9SFrançois Revol 	uint8 wstate;
33*ed6250c9SFrançois Revol } laplink_state;
34*ed6250c9SFrançois Revol 
35*ed6250c9SFrançois Revol // framing
36*ed6250c9SFrançois Revol extern status_t ll_send_sof(laplink_state *st);
37*ed6250c9SFrançois Revol extern status_t ll_check_sof(laplink_state *st);
38*ed6250c9SFrançois Revol extern status_t ll_ack_sof(laplink_state *st);
39*ed6250c9SFrançois Revol extern status_t ll_send_eof(laplink_state *st);
40*ed6250c9SFrançois Revol 
41*ed6250c9SFrançois Revol // nibbles
42*ed6250c9SFrançois Revol extern status_t ll_send_lnibble(laplink_state *st, uint8 v);
43*ed6250c9SFrançois Revol extern status_t ll_send_mnibble(laplink_state *st, uint8 v);
44*ed6250c9SFrançois Revol extern status_t ll_wait_lnibble(laplink_state *st, uint8 *v);
45*ed6250c9SFrançois Revol extern status_t ll_wait_mnibble(laplink_state *st, uint8 *v);
46*ed6250c9SFrançois Revol 
47*ed6250c9SFrançois Revol // byte mode
48*ed6250c9SFrançois Revol extern status_t ll_send_byte(laplink_state *st, uint8 v);
49*ed6250c9SFrançois Revol extern status_t ll_check_byte(laplink_state *st, uint8 *v);
50*ed6250c9SFrançois Revol extern status_t ll_wait_byte(laplink_state *st, uint8 *v);
51*ed6250c9SFrançois Revol 
52*ed6250c9SFrançois Revol // frame mode
53*ed6250c9SFrançois Revol extern status_t ll_send_frame(laplink_state *st, const uint8 *buff, size_t *len);
54*ed6250c9SFrançois Revol extern status_t ll_check_frame(laplink_state *st, uint8 *buff, size_t *len);
55*ed6250c9SFrançois Revol extern status_t ll_wait_frame(laplink_state *st, uint8 *buff, size_t *len);
56*ed6250c9SFrançois Revol 
57*ed6250c9SFrançois Revol 
58