Files
sibo-playground/code/SIBOSDK/ldd/epocser.inc
T
2026-07-06 18:01:36 +01:00

299 lines
11 KiB
PHP

.xlist
; Include file - EPOCSER.INC
; Epoc/Os standard Serial Driver defines
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 JH Final release
; 2.01F 05/10/90 JH Added a define for Constant speed DTE modems
;
EPOCSER_INC equ 1
; Serial port characteristics
SerialCharEnt struc
SerialCharTbaud db ? ; transmit Baud rate selector
SerialCharRbaud db ? ; receive Baud rate selector
SerialCharFrame db ? ; number of data, parity and stop bits
SerialCharParity db ? ; parity selector
SerialCharHandshake db ? ; handshake flags
SerialCharXon db ? ; XON character
SerialCharXoff db ? ; XOFF character
SerialCharFlags db ? ; control flags
SerialCharTmask dd ? ; terminator mask
SerialCharEnt ends
; Function numbers to use to call PDD functions
SerPDDFuncOpen equ 0
SerPDDFuncClose equ 2
SerPDDFuncStart equ 4
SerPDDFuncStop equ 6
SerPDDFuncSet equ 8
SerPDDFuncSense equ 10
SerPDDFuncControl equ 12
SerPDDFuncEnquire equ 14
SerPDDFuncEnable equ 16
SerPDDFuncSetHandlerCS equ 18
;
SERPARITY_ERR equ 0ffh
SERFRAME_ERR equ 0feh
SEROVERRUN_ERR equ 0fdh
SERNOCHAR equ 0ffffh
; Baud rates
P_BAUD_50 equ 01h
P_BAUD_75 equ 02h
P_BAUD_110 equ 03h
P_BAUD_134 equ 04h
P_BAUD_150 equ 05h
P_BAUD_300 equ 06h
P_BAUD_600 equ 07h
P_BAUD_1200 equ 08h
P_BAUD_1800 equ 09h
P_BAUD_2000 equ 0Ah
P_BAUD_2400 equ 0Bh
P_BAUD_3600 equ 0Ch
P_BAUD_4800 equ 0Dh
P_BAUD_7200 equ 0Eh
P_BAUD_9600 equ 0Fh
P_BAUD_19200 equ 10h
P_BAUD_38400 equ 11h
P_BAUD_56000 equ 12h
P_BAUD_115000 equ 13h
; allocation of frame bits
P_DATA_FRM equ 0fh ; number of data bits mask
P_DATA_5 equ 0h ; 5 data bits
P_DATA_6 equ 1h ; 6 data bits
P_DATA_7 equ 2h ; 7 data bits
P_DATA_8 equ 3h ; 8 data bits
P_TWOSTOP equ 10h ; 2 stop bits if set, 1 if clear
P_PARITY equ 20h ; 1 parity bit if set, 0 if clear
; parity - ignored unless P_PARITY is set
P_PAR_EVEN equ 1h ; even parity
P_PAR_ODD equ 2h ; odd parity
P_PAR_MARK equ 3h ; mark parity
P_PAR_SPACE equ 4h ; space parity
; handshaking control
P_OBEY_XOFF equ 01h ; respond to received XOFF (and XON) if set
P_SEND_XOFF equ 02h ; send XOFF/XON to control receive buf if set
P_IGN_CTS equ 04h ; ignore the state of CTS if set
P_OBEY_DSR equ 08h ; obey the state of DSR if set
P_FAIL_DSR equ 10h ; fail if DSR goes OFF if set
P_OBEY_DCD equ 20h ; obey the state of DCD if set
P_FAIL_DCD equ 40h ; fail if DCD goes OFF if set
; flags control
P_IGNORE_PARITY equ 01h ; ignore parity errors
; For P_FCTRL function
P_SRCTRL_CTS equ 01h
P_SRCTRL_DSR equ 02h
P_SRCTRL_DCD equ 04h
P_SRCTRL_DTR equ 08h
P_SRCTRL_RTS equ 10h
P_SRDTR_ON equ 1h ; to set DTR to MARK
P_SRDTR_OFF equ 2h ; to set DTR to SPACE
; Bit masks for P_FINQ function
P_SRINQ_50 equ 0001h
P_SRINQ_75 equ 0002h
P_SRINQ_110 equ 0004h
P_SRINQ_134 equ 0008h
P_SRINQ_150 equ 0010h
P_SRINQ_300 equ 0020h
P_SRINQ_600 equ 0040h
P_SRINQ_1200 equ 0080h
P_SRINQ_1800 equ 0100h
P_SRINQ_2000 equ 0200h
P_SRINQ_2400 equ 0400h
P_SRINQ_3600 equ 0800h
P_SRINQ_4800 equ 1000h
P_SRINQ_7200 equ 2000h
P_SRINQ_9600 equ 4000h
P_SRINQ_19200 equ 8000h
; second baud rate word
P_SRINQ_38400 equ 0001h
P_SRINQ_56000 equ 0002h
; 2nd set of info
P_SRINQ_DATA5 equ 0001h ; supports 5 data bits
P_SRINQ_DATA6 equ 0002h ; supports 6 data bits
P_SRINQ_DATA7 equ 0004h ; supports 7 data bits
P_SRINQ_DATA8 equ 0008h ; supports 8 data bits
P_SRINQ_STOP2 equ 0010h ; supports 2 stop bits (as well as 1)
P_SRINQ_PAREVEN equ 0020h ; supports even parity
P_SRINQ_PARODD equ 0040h ; supports odd parity
P_SRINQ_PARMARK equ 0080h ; supports mark parity
P_SRINQ_PARSPACE equ 0100h ; supports space parity
P_SRINQ_SETDTR equ 0200h ; can set DTR
P_SRINQ_SPLIT equ 0400h ; supports split Baud rates
P_SRINQ_XONXOFF equ 0800h ; Supports soft xon/xoff characters
; CRC generator section
; The Low and High bytes of the 16 bit CRC
CrcEnt struc
CrcLow db ? ; CRC low byte
CrcHigh db ? ; CRC high byte
CrcEnt ends
;Serial Driver Media Access Control section (LLMAC)
;
P_MAXILEN equ 300 ; maximum length of information field
;Frame type codes
LA_LPDU equ 0 ; The Link Acknowledge PDU
LD_LPDU equ 1 ; The Link disconnect PDU
LR_LPDU equ 2 ; The Link Request PDU
LT_LPDU equ 3 ; The Link Data PDU
P_FRM_BROKEN equ 4 ; A broken frame
FrameEnt struc
FrameType db ? ; frame type
FrameSeq db ? ; frame sequence
FrameLen dw ? ; length of information field
FramePbuf dw ? ; ptr to data buffer
FrameEnt ends
; LLMAC layer characteristics
LlmacEnt struc
LlmacIlen dw ? ; maximum information field length
LlmacSpeed dw ? ; nominal speed in characters per second
LlmacRtint dw ? ; suggested retransmission interval
LlmacEnt ends
; LINK layer structures and defines
; IoFuncConnect service connection modes */
P_LINK_ACCP equ 0 ; want link as acceptor
P_LINK_INIT equ 1 ; want link as initiator
; Link layer states
P_LINK_IDLE equ 0 ; no connection - idle
P_LINK_IDLE_LR equ 1 ; no connection - awaiting LR
P_LINK_DATA_IDLE equ 2 ; connected - idle
P_LINK_DATA_LA equ 3 ; connected - awaiting LA
P_LINK_IDLE_LA equ 4 ; not connected - awaiting LA (or LT) to LR
;State and event log record
LinkLogEnt struc
LinkLogState db ? ; Link layer state (as defined above)
LinkLogEvent db ? ; Event that occured
LinkLogEnt ends
P_LINK_NLOG equ 32 ; Max number of debug events,states we record
P_LINK_LOG_MASK equ 0C0h
P_LINK_LOG_PANIC equ 0C0h ; panic number
P_LINK_LOG_MAC equ 0 ; MAC request or timer
P_LINK_LOG_REQ equ 80h ; User request
P_LINK_LOG_COMP equ 40h ; User completion
LinkDataEnt struc
LinkDataLlmac LlmacEnt <>
LinkDataBrokenCount dw ? ; count of broken frames
LinkDataRetranCount dw ? ; re-transmission count
LinkDataEnt ends
; Comms I/O drivers shared code header structs
; Flag defines
RQ_TIMER equ 01h ; a timer has been started
RQ_SUPER equ 02h ; a supervisory read has been started
RQ_WRITE equ 04h ; a write has been started
RQ_READ equ 08h ; a data read has been started
RQ_DISABLE_HANDLER equ 10h ; set to disable handers
RQ_ANY equ (RQ_TIMER or RQ_SUPER or RQ_WRITE or RQ_READ)
;Flag bits to indicate various features of the link layer event.
QUEUE_XMIT_LA equ 20h ; queue an LA when the transmit completes
LINK_ACTIVE equ 40h ; set between a P_FCONNECT and a disconnect
USER_DATA_PENDING equ 80h
; DONT CHANGE THE ORDER OF THIS !!
IoRequestEnt struc
IoRequestChan ChanEnt <> ; I/O control block
IoRequestWaitHandler dw ? ; wait handler vector number
IoRequestRqRead RqEnt <> ; Read request packet
IoRequestRqWrite RqEnt <> ; Write request packet
IoRequestRqSuper RqEnt <> ; Supervisorry request packet
IoRequestTimerPcb dw ? ; open Timer cb
IoRequestTimerStat dw ? ; timer completion status
IoRequestReadStat dw ? ; read completion status
IoRequestWriteStat dw ? ; write completion status
IoRequestSuperStat dw ? ; supervisory completion status
IoRequestFlags db ? ; controlling flags
IoRequestState db ? ; current internal state
IoRequestEnt ends
LnkEnt struc
LnkIoRequest IoRequestEnt <> ; I/O header
LnkLinkData LinkDataEnt <> ; Link layer data
LnkNumberLog dw ? ; current log table event no.
LnkLogTable db (size LinkLogEnt)*P_LINK_NLOG dup (?)
LnkEnt ends
; XMODEM structures and defines
; IoFuncConnect service connection modes */
P_XMDM_ACCP equ 0 ; want link as acceptor
P_XMDM_INIT equ 1 ; want link as initiator
; Xmodem link types
P_XMDM_CRCORCHECKSUM equ 0
P_XMDM_CRCMODE equ 1
P_XMDM_CHECKSUMMODE equ 2
P_YMODEM_MODE equ 3
P_YMODEM_G_MODE equ 4
P_XMDM_ONE_K equ 8000h
;Xmodem/Ymodem supported flags
P_FXMDM_SENSE equ 0ffh ; I/O function number
P_XSUP_XMODEM equ 01h ; original Xmodem checksum
P_XSUP_XMODEM_CRC equ 02h ; Xmodem with CRC
P_XSUP_ONE_K_OPTION equ 04h ; 1k frames
P_XSUP_YMODEM equ 08h ; Ymodem
P_XSUP_YMODEM_G equ 10h ; Ymodem-G
; Xmodem State defines
P_XMDM_IDLE equ P_LINK_IDLE ; idle state (no connection)
P_XMDM_CONNECT_RECEIVE equ 1 ; receive connect state
P_XMDM_CONNECT_TRANSMIT equ 2 ; Transmit connect state
P_XMDM_DATA_RECEIVE equ 3 ; receive data state
P_XMDM_DATA_TRANSMIT equ 4 ; transmit data state
P_XMDM_DATA_TRANSMIT_ACK equ 5 ; awaiting ACK to transmitted data
;State and event log record
XmdmLogEnt struc
LinkLogEnt <>
XmdmLogEnt ends
P_XMDM_NLOG equ P_LINK_NLOG ; Max number of debug events,states we record
P_XMDM_LOG_MASK equ P_LINK_LOG_MASK
P_XMDM_LOG_PANIC equ P_LINK_LOG_PANIC ; panic number
P_XMDM_LOG_REQ equ P_LINK_LOG_REQ ; User request
P_XMDM_LOG_COMP equ P_LINK_LOG_COMP ; User completion
; Modem driver info
; what options are selected
P_MDM_TONE equ 01h
P_MDM_BELL equ 02h
P_MDM_NO_MODULATION equ 04h
P_MDM_CONSTANT_SPEED equ 08h ; modem provides constant speed interface if set
; error correction types
P_MDM_ERRCORRECT_NONE equ 00h
P_MDM_ERRCORRECT equ 01h
P_MDM_ERRCORRECT_MNP equ 02h
P_MDM_ERRCORRECT_V42 equ 03h
ModemCharEnt struc
ModemCharSupport dw ? ; flags saying what supported
ModemCharOptions dw ? ; Selected options
ModemCharBaudRate dw ? ; Baud rate running at
ModemCharConnHand db ? ; Connected handshaking
ModemCharCallHand db ? ; Wait for call handshaking
ModemCharEnt ends
.list