]> git.sur5r.net Git - cc65/blob - asminc/ser-kernel.inc
Working on new serial API
[cc65] / asminc / ser-kernel.inc
1 ;****************************************************************************
2 ;*                                                                          *
3 ;*                              ser-kernel.inc                              *
4 ;*                                                                          *
5 ;*                        Serial communication API                          *
6 ;*                                                                          *
7 ;*                                                                          *
8 ;*                                                                          *
9 ;*(C) 2003      Ullrich von Bassewitz                                       *
10 ;*              Römerstrasse 52                                             *
11 ;*              D-70794 Filderstadt                                         *
12 ;*EMail:        uz@cc65.org                                                 *
13 ;*                                                                          *
14 ;*                                                                          *
15 ;*This software is provided 'as-is', without any expressed or implied       *
16 ;*warranty.  In no event will the authors be held liable for any damages    *
17 ;*arising from the use of this software.                                    *
18 ;*                                                                          *
19 ;*Permission is granted to anyone to use this software for any purpose,     *
20 ;*including commercial applications, and to alter it and redistribute it    *
21 ;*freely, subject to the following restrictions:                            *
22 ;*                                                                          *
23 ;*1. The origin of this software must not be misrepresented; you must not   *
24 ;*   claim that you wrote the original software. If you use this software   *
25 ;*   in a product, an acknowledgment in the product documentation would be  *
26 ;*   appreciated but is not required.                                       *
27 ;*2. Altered source versions must be plainly marked as such, and must not   *
28 ;*   be misrepresented as being the original software.                      *
29 ;*3. This notice may not be removed or altered from any source              *
30 ;*   distribution.                                                          *
31 ;*                                                                          *
32 ;****************************************************************************
33
34
35
36 ;------------------------------------------------------------------------------
37 ; Offsets into the driver header
38
39 SER_HDR_ID              = 0             ; Contains 0x73, 0x65, 0x72 ("ser")
40 SER_HDR_VERSION         = 3             ; Interface version
41
42 SER_HDR_JUMPTAB         = 4
43 SER_HDR_INSTALL         = SER_HDR_JUMPTAB+0     ; INSTALL routine
44 SER_HDR_UNINSTALL       = SER_HDR_JUMPTAB+2     ; UNINSTALL routine
45 SER_HDR_PARAMS          = SER_HDR_JUMPTAB+4     ; PARAMS routine
46 SER_HDR_GET             = SER_HDR_JUMPTAB+6     ; GET routine
47 SER_HDR_PUT             = SER_HDR_JUMPTAB+8     ; PUT routine
48 SER_HDR_PAUSE           = SER_HDR_JUMPTAB+10    ; PAUSE routine
49 SER_HDR_UNPAUSE         = SER_HDR_JUMPTAB+12    ; UNPAUSE routine
50 SER_HDR_STATUS          = SER_HDR_JUMPTAB+14    ; STATUS routine
51
52 SER_HDR_JUMPCOUNT       = 8                     ; Number of jump vectors
53
54 ;------------------------------------------------------------------------------
55 ; Offsets into the struct passed to ser_params
56
57 SER_PARAMS_BAUDRATE     =       0       ; Baudrate
58 SER_PARAMS_DATABITS     =       1       ; Number of data bits
59 SER_PARAMS_STOPBITS     =       2       ; Number of stop bits
60 SER_PARAMS_PARITY       =       3       ; Parity setting
61 SER_PARAMS_HANDSHAKE    =       4       ; Type of handshake to use
62
63 ;------------------------------------------------------------------------------
64 ; Serial parameters
65
66 ; Baudrate
67 SER_BAUD_45_5           =       $00
68 SER_BAUD_50             =       $01
69 SER_BAUD_75             =       $02
70 SER_BAUD_110            =       $03
71 SER_BAUD_134_5          =       $04
72 SER_BAUD_150            =       $05
73 SER_BAUD_300            =       $06
74 SER_BAUD_600            =       $07
75 SER_BAUD_1200           =       $08
76 SER_BAUD_1800           =       $09
77 SER_BAUD_2400           =       $0A
78 SER_BAUD_4800           =       $0B
79 SER_BAUD_9600           =       $0C
80 SER_BAUD_19200          =       $0D
81 SER_BAUD_38400          =       $0E
82 SER_BAUD_57600          =       $0F
83 SER_BAUD_115200         =       $10
84 SER_BAUD_230400         =       $11
85
86 ; Data bit settings
87 SER_BITS_5              =       $00
88 SER_BITS_6              =       $01
89 SER_BITS_7              =       $02
90 SER_BITS_8              =       $03
91
92 ; Stop bit settings
93 SER_STOP_1              =       $00
94 SER_STOP_2              =       $01
95
96 ; Parity
97 SER_PAR_NONE            =       $00
98 SER_PAR_ODD             =       $01
99 SER_PAR_EVEN            =       $02
100 SER_PAR_MARK            =       $03
101 SER_PAR_SPACE           =       $04
102
103 ; Handshake
104 SER_HS_NONE             =       $00    ; No handshake
105 SER_HS_HW               =       $01    ; Hardware (RTS/CTS) handshake
106 SER_HS_SW               =       $02    ; Software handshake
107
108 ; Bit masks to mask out things from the status returned by rs232_status
109 SER_STATUS_PE           =       $01     ; Parity error
110 SER_STATUS_FE           =       $02     ; Framing error
111 SER_STATUS_OE           =       $04     ; Overrun error
112 SER_STATUS_DCD          =       $20     ; NOT data carrier detect
113 SER_STATUS_DSR          =       $40     ; NOT data set ready
114
115 ;------------------------------------------------------------------------------
116 ; Variables
117
118         .global _ser_drv                         ; Pointer to driver
119
120 ;------------------------------------------------------------------------------
121 ; Driver entry points
122
123         .global ser_install
124         .global ser_uninstall
125         .global ser_params
126         .global ser_get
127         .global ser_put
128         .global ser_pause
129         .global ser_unpause
130         .global ser_status
131
132
133
134 ;------------------------------------------------------------------------------
135 ; ASM functions
136
137         .global _ser_unload
138         .global _ser_install
139         .global _ser_uninstall
140         .global _ser_params
141         .global _ser_get
142         .global _ser_put
143         .global _ser_pause
144         .global _ser_unpause
145         .global _ser_status
146
147
148