-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsio.h
More file actions
159 lines (128 loc) · 2.33 KB
/
sio.h
File metadata and controls
159 lines (128 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
** SCCS ID: @(#)sio.h 1.2 4/14/15
**
** File: sio.h
**
** Author: Warren R. Carithers
**
** Contributor:
**
** Description: SIO definitions
*/
#ifndef _SIO_H_
#define _SIO_H_
/*
** General (C and/or assembly) definitions
*/
// sio interrupt settings
#define SIO_TX 0x01
#define SIO_RX 0x02
#define SIO_BOTH (SIO_TX | SIO_RX)
#ifndef __SP_ASM__
#include "queue.h"
/*
** Start of C-only definitions
*/
/*
** PUBLIC GLOBAL VARIABLES
*/
/*
** PUBLIC FUNCTIONS
*/
/*
** _sio_modinit()
**
** Initialize the UART chip.
*/
void _sio_modinit( void );
/*
** _sio_enable()
**
** enable/disable SIO interrupts
**
** usage: old = _sio_enable( which )
**
** enables interrupts according to the 'which' parameter
**
** returns the prior settings
*/
uint8_t _sio_enable( uint8_t which );
/*
** _sio_disable()
**
** disable/disable SIO interrupts
**
** usage: old = _sio_disable( which )
**
** disables interrupts according to the 'which' parameter
**
** returns the prior settings
*/
uint8_t _sio_disable( uint8_t which );
/*
** _sio_input_queue()
**
** get the input queue length
**
** usage: num = _sio_input_queue()
**
** returns the count of characters still in the input queue
*/
int _sio_input_queue( void );
/*
** _sio_readc()
**
** get the next input character
**
** usage: ch = _sio_readc()
**
** returns the next character, or -1 if no character is available
*/
int _sio_readc( void );
/*
** _sio_reads()
**
** get an input line, up to a specific number of characters
**
** usage: num = _sio_reads(buffer,length)
**
** returns the number of characters put into the buffer, or 0 if no
** characters are available
*/
int _sio_reads( char *buffer, int length );
/*
** _sio_writec( ch )
**
** write a character to the serial output
**
** usage: _sio_writec( ch )
*/
void _sio_writec( int ch );
/*
** _sio_writes( ch )
**
** write a buffer of characters to the serial output
**
** usage: n = _sio_writes( char *buffer, int length )
**
** returns the count of bytes transferred
*/
int _sio_writes( char *buffer, int length );
/*
** _sio_puts( buf )
**
** write a NUL-terminated buffer of characters to the serial output
**
** usage: n = _sio_puts( char *buffer );
**
** returns the count of bytes transferred
*/
int _sio_puts( char *buffer );
/*
** _sio_dump()
**
** dump the contents of the SIO buffers
*/
void _sio_dump( void );
#endif
#endif