]> git.sur5r.net Git - cc65/blob - asminc/ser-kernel.inc
Made the code that logs indirect-goto referals be a little more efficient.
[cc65] / asminc / ser-kernel.inc
1 ;****************************************************************************
2 ;*                                                                          *
3 ;*                              ser-kernel.inc                              *
4 ;*                                                                          *
5 ;*                        Serial communication API                          *
6 ;*                                                                          *
7 ;*                                                                          *
8 ;*                                                                          *
9 ;*(C) 2003-2006, 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 ; The driver header
38
39 .struct SER_HDR
40         ID      .byte   3       ; Contains 0x73, 0x65, 0x72 ("ser")
41         VERSION .byte   1       ; Interface version
42         LIBREF  .addr           ; Library reference
43         JUMPTAB .struct
44             SER_INSTALL   .addr   ; SER_INSTALL routine
45             SER_UNINSTALL .addr   ; SER_UNINSTALL routine
46             SER_OPEN      .addr   ; SER_OPEN routine
47             SER_CLOSE     .addr   ; SER_CLOSE routine
48             SER_GET       .addr   ; SER_GET routine
49             SER_PUT       .addr   ; SER_PUT routine
50             SER_STATUS    .addr   ; SER_STATUS routine
51             SER_IOCTL     .addr   ; SER_IOCTL routine
52             SER_IRQ       .addr   ; SER_IRQ routine
53         .endstruct
54 .endstruct
55
56
57 ;------------------------------------------------------------------------------
58 ; The SER API version, stored SER_HDR::VERSION
59
60 SER_API_VERSION         = $02
61
62 ;------------------------------------------------------------------------------
63 ; ser_params
64
65 .struct SER_PARAMS
66         BAUDRATE        .byte           ; Baudrate
67         DATABITS        .byte           ; Number of data bits
68         STOPBITS        .byte           ; Number of stop bits
69         PARITY          .byte           ; Parity setting
70         HANDSHAKE       .byte           ; Type of handshake to use
71 .endstruct
72
73 ;------------------------------------------------------------------------------
74 ; Serial parameters
75
76 ; Baudrate
77 SER_BAUD_45_5           =       $00
78 SER_BAUD_50             =       $01
79 SER_BAUD_75             =       $02
80 SER_BAUD_110            =       $03
81 SER_BAUD_134_5          =       $04
82 SER_BAUD_150            =       $05
83 SER_BAUD_300            =       $06
84 SER_BAUD_600            =       $07
85 SER_BAUD_1200           =       $08
86 SER_BAUD_1800           =       $09
87 SER_BAUD_2400           =       $0A
88 SER_BAUD_3600           =       $0B
89 SER_BAUD_4800           =       $0C
90 SER_BAUD_7200           =       $0D
91 SER_BAUD_9600           =       $0E
92 SER_BAUD_19200          =       $0F
93 SER_BAUD_38400          =       $10
94 SER_BAUD_57600          =       $11
95 SER_BAUD_115200         =       $12
96 SER_BAUD_230400         =       $13
97 SER_BAUD_31250          =       $14
98 SER_BAUD_62500          =       $15
99 SER_BAUD_56_875         =       $16
100
101 ; Data bit settings
102 SER_BITS_5              =       $00
103 SER_BITS_6              =       $01
104 SER_BITS_7              =       $02
105 SER_BITS_8              =       $03
106
107 ; Stop bit settings
108 SER_STOP_1              =       $00
109 SER_STOP_2              =       $01
110
111 ; Parity
112 SER_PAR_NONE            =       $00
113 SER_PAR_ODD             =       $01
114 SER_PAR_EVEN            =       $02
115 SER_PAR_MARK            =       $03
116 SER_PAR_SPACE           =       $04
117
118 ; Handshake
119 SER_HS_NONE             =       $00    ; No handshake
120 SER_HS_HW               =       $01    ; Hardware (RTS/CTS) handshake
121 SER_HS_SW               =       $02    ; Software handshake
122
123 ; Bit masks to mask out things from the status returned by ser_status
124 SER_STATUS_PE           =       $01     ; Parity error
125 SER_STATUS_FE           =       $02     ; Framing error
126 SER_STATUS_OE           =       $04     ; Overrun error
127 SER_STATUS_DCD          =       $20     ; NOT data carrier detect
128 SER_STATUS_DSR          =       $40     ; NOT data set ready
129
130 ;------------------------------------------------------------------------------
131 ; Variables
132
133         .global _ser_drv                         ; Pointer to driver
134
135 ;------------------------------------------------------------------------------
136 ; Driver entry points
137
138         .global ser_install
139         .global ser_uninstall
140         .global ser_open
141         .global ser_close
142         .global ser_get
143         .global ser_put
144         .global ser_status
145         .global ser_ioctl
146         .global ser_irq
147
148 ;------------------------------------------------------------------------------
149 ; C callable functions
150
151         .global _ser_load_driver
152         .global _ser_unload
153         .global _ser_install
154         .global _ser_uninstall
155         .global _ser_open
156         .global _ser_close
157         .global _ser_get
158         .global _ser_put
159         .global _ser_status
160         .global _ser_ioctl
161
162         .global _ser_clear_ptr