📄 ser-kernel.inc
字号:
;****************************************************************************;* *;* ser-kernel.inc *;* *;* Serial communication API *;* *;* *;* *;*(C) 2003 Ullrich von Bassewitz *;* R鰉erstrasse 52 *;* D-70794 Filderstadt *;*EMail: uz@cc65.org *;* *;* *;*This software is provided 'as-is', without any expressed or implied *;*warranty. In no event will the authors be held liable for any damages *;*arising from the use of this software. *;* *;*Permission is granted to anyone to use this software for any purpose, *;*including commercial applications, and to alter it and redistribute it *;*freely, subject to the following restrictions: *;* *;*1. The origin of this software must not be misrepresented; you must not *;* claim that you wrote the original software. If you use this software *;* in a product, an acknowledgment in the product documentation would be *;* appreciated but is not required. *;*2. Altered source versions must be plainly marked as such, and must not *;* be misrepresented as being the original software. *;*3. This notice may not be removed or altered from any source *;* distribution. *;* *;****************************************************************************;------------------------------------------------------------------------------; The driver header.struct SER_HDR ID .byte 3 ; Contains 0x73, 0x65, 0x72 ("ser") VERSION .byte 1 ; Interface version JUMPTAB .struct INSTALL .word ; INSTALL routine UNINSTALL .word ; UNINSTALL routine OPEN .word ; OPEN routine CLOSE .word ; CLOSE routine GET .word ; GET routine PUT .word ; PUT routine STATUS .word ; STATUS routine IOCTL .word ; IOCTL routine IRQ .word ; IRQ routine .endstruct.endstruct;------------------------------------------------------------------------------; The SER API version, stored SER_HDR::VERSIONSER_API_VERSION = $00;------------------------------------------------------------------------------; ser_params.struct SER_PARAMS BAUDRATE .byte ; Baudrate DATABITS .byte ; Number of data bits STOPBITS .byte ; Number of stop bits PARITY .byte ; Parity setting HANDSHAKE .byte ; Type of handshake to use.endstruct;------------------------------------------------------------------------------; Serial parameters; BaudrateSER_BAUD_45_5 = $00SER_BAUD_50 = $01SER_BAUD_75 = $02SER_BAUD_110 = $03SER_BAUD_134_5 = $04SER_BAUD_150 = $05SER_BAUD_300 = $06SER_BAUD_600 = $07SER_BAUD_1200 = $08SER_BAUD_1800 = $09SER_BAUD_2400 = $0ASER_BAUD_3600 = $0BSER_BAUD_4800 = $0CSER_BAUD_7200 = $0DSER_BAUD_9600 = $0ESER_BAUD_19200 = $0FSER_BAUD_38400 = $10SER_BAUD_57600 = $11SER_BAUD_115200 = $12SER_BAUD_230400 = $13; Data bit settingsSER_BITS_5 = $00SER_BITS_6 = $01SER_BITS_7 = $02SER_BITS_8 = $03; Stop bit settingsSER_STOP_1 = $00SER_STOP_2 = $01; ParitySER_PAR_NONE = $00SER_PAR_ODD = $01SER_PAR_EVEN = $02SER_PAR_MARK = $03SER_PAR_SPACE = $04; HandshakeSER_HS_NONE = $00 ; No handshakeSER_HS_HW = $01 ; Hardware (RTS/CTS) handshakeSER_HS_SW = $02 ; Software handshake; Bit masks to mask out things from the status returned by rs232_statusSER_STATUS_PE = $01 ; Parity errorSER_STATUS_FE = $02 ; Framing errorSER_STATUS_OE = $04 ; Overrun errorSER_STATUS_DCD = $20 ; NOT data carrier detectSER_STATUS_DSR = $40 ; NOT data set ready;------------------------------------------------------------------------------; Variables .global _ser_drv ; Pointer to driver;------------------------------------------------------------------------------; Driver entry points .global ser_install .global ser_uninstall .global ser_open .global ser_close .global ser_get .global ser_put .global ser_status .global ser_ioctl .global ser_irq;------------------------------------------------------------------------------; ASM functions .global _ser_unload .global _ser_install .global _ser_uninstall .global _ser_open .global _ser_close .global _ser_get .global _ser_put .global _ser_status .global _ser_ioctl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -