]> git.sur5r.net Git - cc65/blob - asminc/ser-kernel.inc
Fixed several address size issues
[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 ; The driver header
38
39 .struct SER_HDR
40         ID      .byte   3       ; Contains 0x73, 0x65, 0x72 ("ser")
41         VERSION .byte   1       ; Interface version
42         JUMPTAB .struct 
43             INSTALL     .word   ; INSTALL routine
44             UNINSTALL   .word   ; UNINSTALL routine
45             OPEN        .word   ; OPEN routine
46             CLOSE       .word   ; CLOSE routine
47             GET         .word   ; GET routine
48             PUT         .word   ; PUT routine
49             STATUS      .word   ; STATUS routine
50             IOCTL       .word   ; IOCTL routine
51         .endstruct
52 .endstruct
53
54
55 ;------------------------------------------------------------------------------
56 ; ser_params
57
58 .struct SER_PARAMS
59         BAUDRATE        .byte           ; Baudrate
60         DATABITS        .byte           ; Number of data bits
61         STOPBITS        .byte           ; Number of stop bits
62         PARITY          .byte           ; Parity setting
63         HANDSHAKE       .byte           ; Type of handshake to use
64 .endstruct
65
66 ;------------------------------------------------------------------------------
67 ; Serial parameters
68
69 ; Baudrate
70 SER_BAUD_45_5           =       $00
71 SER_BAUD_50             =       $01
72 SER_BAUD_75             =       $02
73 SER_BAUD_110            =       $03
74 SER_BAUD_134_5          =       $04
75 SER_BAUD_150            =       $05
76 SER_BAUD_300            =       $06
77 SER_BAUD_600            =       $07
78 SER_BAUD_1200           =       $08
79 SER_BAUD_1800           =       $09
80 SER_BAUD_2400           =       $0A
81 SER_BAUD_3600           =       $0B
82 SER_BAUD_4800           =       $0C
83 SER_BAUD_7200           =       $0D
84 SER_BAUD_9600           =       $0E
85 SER_BAUD_19200          =       $0F
86 SER_BAUD_38400          =       $10
87 SER_BAUD_57600          =       $11
88 SER_BAUD_115200         =       $12
89 SER_BAUD_230400         =       $13
90
91 ; Data bit settings
92 SER_BITS_5              =       $00
93 SER_BITS_6              =       $01
94 SER_BITS_7              =       $02
95 SER_BITS_8              =       $03
96
97 ; Stop bit settings
98 SER_STOP_1              =       $00
99 SER_STOP_2              =       $01
100
101 ; Parity
102 SER_PAR_NONE            =       $00
103 SER_PAR_ODD             =       $01
104 SER_PAR_EVEN            =       $02
105 SER_PAR_MARK            =       $03
106 SER_PAR_SPACE           =       $04
107
108 ; Handshake
109 SER_HS_NONE             =       $00    ; No handshake
110 SER_HS_HW               =       $01    ; Hardware (RTS/CTS) handshake
111 SER_HS_SW               =       $02    ; Software handshake
112
113 ; Bit masks to mask out things from the status returned by rs232_status
114 SER_STATUS_PE           =       $01     ; Parity error
115 SER_STATUS_FE           =       $02     ; Framing error
116 SER_STATUS_OE           =       $04     ; Overrun error
117 SER_STATUS_DCD          =       $20     ; NOT data carrier detect
118 SER_STATUS_DSR          =       $40     ; NOT data set ready
119
120 ;------------------------------------------------------------------------------
121 ; Variables
122
123         .global _ser_drv                         ; Pointer to driver
124
125 ;------------------------------------------------------------------------------
126 ; Driver entry points
127
128         .global ser_install
129         .global ser_uninstall
130         .global ser_open
131         .global ser_close
132         .global ser_get
133         .global ser_put
134         .global ser_status
135         .global ser_ioctl
136
137
138 ;------------------------------------------------------------------------------
139 ; ASM functions
140
141         .global _ser_unload
142         .global _ser_install
143         .global _ser_uninstall
144         .global _ser_open
145         .global _ser_close
146         .global _ser_get
147         .global _ser_put
148         .global _ser_status
149         .global _ser_ioctl
150
151