feat(inventory): Phase 1 - scan and validate UPC barcodes #1

Open
lyrathorpe wants to merge 54 commits from feat/inventory-phase1-scan into main
24 changed files with 165913 additions and 0 deletions
Showing only changes of commit 1e371910a0 - Show all commits
+1189
View File
File diff suppressed because it is too large Load Diff
+411
View File
@@ -0,0 +1,411 @@
/*
A4TEST.C - Testing the functionality ASIC4 Example
Interface Board device driver A4Exif.ldd
A comprehensive test program which checks
I/O request functionality of A4Exif.ldd
Written by Mal, January 31, 1995
*/
#include <plib.h>
#include <p_keyb.h>
#define BUFLEN 1
#define MAXBUF 8
#define SERREAD_TIMEOUT 20L
#define FLASH_TIME 1L
GLREF_D TEXT *DatCommandPtr;
GLREF_D VOID *winHandle;
LOCAL_D VOID *serH; /* serial channel handle */
LOCAL_D VOID *timH; /* timer channel handle */
LOCAL_D WORD serReadStat; /* serial channel status word */
LOCAL_D WORD timStat; /* timer channel status word */
LOCAL_D WORD keyStat; /* console channel status word */
LOCAL_D P_CON_KBREC kbrec;
LOCAL_D TEXT buf[40];
LOCAL_D UBYTE wowbuf[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
LOCAL_D TEXT *head="LED: ";
LOCAL_C VOID PrintHeader(VOID)
/* Prints the title at the start of the program */
{
p_printf("*********************");
p_printf("Welcome to the ASIC 4");
p_printf("Example IF board test");
p_printf("program");
p_printf("*********************");
p_printf(".....\n");
p_getch();
}
LOCAL_C VOID PrintInstructions(VOID)
{
p_printf("Type in the test number");
p_printf(" 0 => Alternate flash");
p_printf(" 1 => Asynchronous read");
p_printf(" 2 => Sense");
p_printf(" 3 => Set");
p_printf(" 4 => Memory");
p_printf(" q => Quit");
p_printf(" .....");
}
LOCAL_C VOID LoadLdd(VOID)
/* Loads the LDD A4Exif.ldd from anywhere and exits on failure */
{
TEXT filename[128];
INT ret;
p_printf("\nLOADLDD=>");
p_fparse("A4EXIF.LDD",DatCommandPtr,&filename[0],NULL);
if ((ret=p_loadldd(&filename[0]))<0)
{
p_printf("A4Exif.ldd failed to load");
if (ret==E_FILE_NXIST)
{
p_printf("Device does not exist");
p_getch();
p_exit(0);
}
else if (ret==E_FILE_EXIST)
{
p_printf("Device is already loaded");
p_getch();
}
else if (ret==E_GEN_NOMEMORY)
{
p_printf("Not enough memory available");
p_getch();
p_exit(0);
}
else
{
p_printf("Unknown error %d on p_loadldd",ret);
p_getch();
p_exit(0);
}
}
else
{
p_printf("Successfully loaded A4Exif.ldd\n");
p_getch();
}
}
LOCAL_C VOID UnloadLdd(VOID)
/* Removes the LDD A4Exif.ldd */
{
INT ret;
p_printf("\nUNLOADLDD=>");
if ((ret=p_devdel("LED",E_LDD))!=0)
{
p_printf("A4Exif.ldd failed to unload");
if (ret==E_FILE_DEVICE)
p_printf("The device driver is not loaded");
else if (ret==E_GEN_INUSE)
p_printf("Driver is open and cannot be deleted");
else
p_printf("Unknown error %d on p_devdel",ret);
p_getch();
}
else
{
p_printf("Successfully deleted A4Exif.ldd");
p_getch();
}
}
LOCAL_C VOID OpenPort(VOID)
/*Opens a serial port of the A4Example IF on the host machine*/
{
INT ret, seropen;
p_printf("\nOPENPORT=>");
DoAgain:
p_printf("Type in the serial\r\nport to open");
p_printf("eg A => port A");
p_printf(".....\n");
ret=p_toupper(p_getch());
*(head+4)=ret;
p_printf("%s",head);
p_sleep(5L);
if ((seropen=p_open(&serH,head,-1))<0)
{/* Failed to open */
p_atos(&buf[0],"p_open on port %c has failed",ret);
p_printf("%s\n<p_open ret=%d>",&buf[0],seropen);
p_errs(buf,seropen);
p_printf("%s\n",&buf[0]);
p_getch();
goto DoAgain;
}
else
{/* Succeeded in opening */
p_atos(&buf[0],"Successfully opened port %c",ret);
p_printf("%s",&buf[0]);
p_printf(".....\n");
p_getch();
}
}
LOCAL_C VOID ClosePort(VOID)
{
INT ret;
p_printf("\nCLOSEPORT=>");
if ((ret=p_close(serH))!=0)
p_printf("Error in closing port");
else
p_printf("Successfully closed port");
p_getch();
}
LOCAL_C VOID SensePort(VOID)
{
UBYTE A1,A2;
p_printf("\nSENSEPORT=>");
p_iow(serH,P_FSENSE,&A1,&A2);
p_printf("Status byte: 0x%x",A1);
p_printf("LED byte: 0x%x",A2);
p_getch();
}
LOCAL_C INT SetPort(VOID)
{
UBYTE key;
p_printf("\nSETPORT=>");
p_printf("Type a key");
p_printf("ESCAPE to exit\r\n");
if ((key=p_getch())==E_KEY_ESCAPE)
{
key=0x00;
p_iow(serH,P_FSET,&key);
return(-1);
}
else
{
p_printf("Output byte is 0x%x",key);
p_iow(serH,P_FSET,&key);
return(0);
}
}
LOCAL_C VOID OpenTimer(VOID)
{
if (p_open(&timH,"TIM:",-1)<0)
{/* Error in opening timer */
p_printf("Cannot open timer channel\n");
p_getch();
}
}
LOCAL_C VOID QueueTimer(ULONG timeouttime)
{
p_ioc4(timH,P_FRELATIVE,&timStat,&timeouttime);
}
LOCAL_C VOID CancelTimer(VOID)
{
p_iow(timH,P_FCANCEL);
p_waitstat(&timStat);
}
LOCAL_C VOID QueueSerRead(UBYTE *statusptr,UBYTE *ledptr)
{
p_ioc5(serH,P_FREAD,&serReadStat,statusptr,ledptr);
}
LOCAL_C VOID CancelSerRead(VOID)
{
p_iow(serH,P_FCANCEL);
p_waitstat(&serReadStat);
}
LOCAL_C VOID QueueKeypress(P_CON_KBREC *keybrec)
{
p_ioc4(winHandle,P_FREAD,&keyStat,keybrec);
}
LOCAL_C VOID AsynchRead(VOID)
{
UBYTE b_led;
UBYTE b_status;
p_printf("ASYNCH READ\r\n");
OpenTimer();
QueueTimer(SERREAD_TIMEOUT);
QueueSerRead(&b_status,&b_led);
QueueKeypress(&kbrec);
FOREVER
{
p_iowait();
if (keyStat!=E_FILE_PENDING)
{/* Keypress received */
p_printf("KEYPRESS");
if (kbrec.keycode==E_KEY_ESCAPE)
{
CancelSerRead();
CancelTimer();
b_led=0x00;
p_iow(serH,P_FWRITE,&b_led);
break;
}
else
{
/* Do nothing - requeue keypress */
QueueKeypress(&kbrec);
continue;
}
}
else if (serReadStat!=E_FILE_PENDING)
{
p_printf("SERIAL READ COMPLETED");
CancelTimer();
p_printf("Status byte is => 0x%x",b_status);
p_printf("LED byte is => 0x%x",b_led);
QueueTimer(SERREAD_TIMEOUT);
QueueSerRead(&b_status,&b_led);
continue;
}
else if (timStat!=E_FILE_PENDING)
{
p_printf("TIMEOUT");
CancelSerRead();
QueueSerRead(&b_status,&b_led);
QueueTimer(SERREAD_TIMEOUT);
continue;
}
else
{/* Error - missing status word so fatal error */
p_printf("***Stray status word***");
break;
}
}
p_close(timH);
}
LOCAL_C VOID AlternateFlash(VOID)
{
UBYTE b_led;
INT i=0;
p_printf("ALTERNATE FLASH\r\n");
p_printf("Hit ESCAPE to exit");
OpenTimer();
QueueTimer(FLASH_TIME);
QueueKeypress(&kbrec);
FOREVER
{
p_iowait();
if (keyStat!=E_FILE_PENDING)
{/* Keypress received */
if (kbrec.keycode==E_KEY_ESCAPE)
{
CancelTimer();
b_led=0x00;
p_iow(serH,P_FWRITE,&b_led);
break;
}
else
{
/* Do nothing - requeue keypress */
QueueKeypress(&kbrec);
continue;
}
}
else if (timStat!=E_FILE_PENDING)
{/* Timer finished */
if (i<MAXBUF)
{
p_iow(serH,P_FSET,&wowbuf[i]);
i++;
}
else
{
i=0;
p_iow(serH,P_FSET,&wowbuf[i]);
}
QueueTimer(FLASH_TIME);
continue;
}
else
{/* Missing status word so fatal error */
p_printf("***Stray status error***");
break;
}
}
p_close(timH);
}
LOCAL_C VOID CheckMemory(TEXT *str)
{
VOID *Heap;
INT fbytes;
fbytes=p_allspc(&Heap);
p_print("\n\t%s\r\n",str);
p_print("Free Heap Memory =>\r\n\t%x bytes\r\n",fbytes);
p_print("Free Segments =>\r\n\t%d\r\n",p_sgfree());
p_getch();
}
LOCAL_C VOID MemoryTest(VOID)
{
CheckMemory("OpenPort");
ClosePort();
CheckMemory("ClosedPort");
UnloadLdd();
CheckMemory("UnoadedLdd");
LoadLdd();
CheckMemory("LoadLdd");
OpenPort();
CheckMemory("OpenPort");
p_printf("End of Memory Test");
}
GLDEF_C VOID main(VOID)
/*
*/
{
INT ret,set=0;
PrintHeader();
LoadLdd();
OpenPort();
Start:
PrintInstructions();
if ((ret=p_getch())=='0')
AlternateFlash();
else if (ret=='1')
AsynchRead();
else if (ret=='2')
SensePort();
else if (ret=='3')
{
while (set>=0)
set=SetPort();
set=0;
}
else if (ret=='4')
MemoryTest();
else if (ret=='q')
{
ClosePort();
UnloadLdd();
p_exit(0);
}
else
goto Start;
goto Start;
}
+6
View File
@@ -0,0 +1,6 @@
#system epoc img
#set epocinit=iplib
#model small jpi
#compile a4test
#link a4test
+15
View File
@@ -0,0 +1,15 @@
.xlist
; Include file - EPOC.INC
; Epoc/Os standard include file
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
;
EPOC_INC equ 1
;
include ..\inc\epocdef.inc
include ..\inc\epocmac.inc
include ..\inc\epocpan.inc
.list
+284
View File
@@ -0,0 +1,284 @@
.xlist
; Include file - EPOCLIB.INC
; Epoc/Os plib standard include file.
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
;
EPOCLIB_INC equ 1
;
_TANDW = 0
ifdef LATTICE
CodeSeg macro
pgroup group prog
PGROUP equ <pgroup>
prog segment byte public 'prog'
assume cs:pgroup
endm
EndCodeSeg macro
prog ends
endm
DataSeg macro
dgroup group data,udata
DGROUP equ <dgroup>
data segment word public 'data'
assume ds:dgroup,es:dgroup,ss:dgroup
endm
EndDataSeg macro
data ends
endm
UDataSeg macro
udata segment word public 'data'
endm
EndUDataSeg macro
udata ends
endm
GLREF_D MACRO NAME,TYPE
EXTRN NAME:TYPE
ENDM
GLDEF_D MACRO NAME,TYPE
PUBLIC NAME
NAME label TYPE
ENDM
GLREF_C MACRO NAME
EXTRN NAME:NEAR
ENDM
endif
;
ifdef TURBOC
_TANDW = 1
CodeSeg macro
PGROUP group _TEXT
pgroup equ <PGROUP>
_TEXT segment byte public 'CODE'
assume cs:PGROUP
endm
EndCodeSeg macro
_TEXT ends
endm
DataSeg macro
DGROUP group _DATA,_BSS
dgroup equ <DGROUP>
_DATA segment word public 'DATA'
assume ds:DGROUP,es:DGROUP,ss:DGROUP
endm
EndDataSeg macro
_DATA ends
endm
UDataSeg macro
_BSS segment word public 'BSS'
endm
EndUDataSeg macro
_BSS ends
endm
GLREF_D MACRO NAME,TYPE
EXTRN _&NAME:TYPE
NAME EQU _&NAME
ENDM
GLDEF_D MACRO NAME,TYPE
PUBLIC _&NAME
_&NAME label TYPE
NAME EQU _&NAME
ENDM
GLREF_C MACRO NAME
EXTRN _&NAME:NEAR
NAME EQU _&NAME
ENDM
endif
ifdef WATCOMC
REG_PARAM equ 1
ifdef _MSC
_TANDW = 1
endif
CodeSeg macro
PGROUP group _TEXT
pgroup equ <PGROUP>
_TEXT segment byte public 'CODE'
assume cs:PGROUP
endm
EndCodeSeg macro
_TEXT ends
endm
DataSeg macro
DGROUP group _DATA,_BSS
dgroup equ <DGROUP>
_DATA segment word public 'DATA'
assume ds:DGROUP,es:DGROUP,ss:DGROUP
endm
EndDataSeg macro
_DATA ends
endm
UDataSeg macro
_BSS segment word public 'BSS'
endm
EndUDataSeg macro
_BSS ends
endm
GLREF_D MACRO NAME,TYPE
EXTRN NAME&_:TYPE
NAME EQU NAME&_
ENDM
GLDEF_D MACRO NAME,TYPE
PUBLIC NAME&_
NAME&_ label TYPE
NAME EQU NAME&_
ENDM
GLREF_C MACRO NAME
EXTRN NAME&_:NEAR
NAME EQU NAME&_
ENDM
endif
ifdef JPIC
REG_PARAM equ 1
ifdef _MSC
_TANDW = 1
endif
CodeSeg macro
_TEXT segment byte public 'CODE'
assume cs:_TEXT
endm
EndCodeSeg macro
_TEXT ends
endm
DataSeg macro
DGROUP group _DATA,_BSS
dgroup equ <DGROUP>
_DATA segment word public 'DATA'
assume ds:DGROUP,es:DGROUP,ss:DGROUP
endm
EndDataSeg macro
_DATA ends
endm
UDataSeg macro
_BSS segment word public 'BSS'
endm
EndUDataSeg macro
_BSS ends
endm
GLREF_D MACRO NAME,TYPE
EXTRN _&NAME:TYPE
NAME EQU _&NAME
ENDM
GLDEF_D MACRO NAME,TYPE
PUBLIC _&NAME
_&NAME label TYPE
NAME EQU _&NAME
ENDM
GLREF_C MACRO NAME
EXTRN _&NAME:NEAR
NAME EQU _&NAME
ENDM
endif
;
LOCAL_D MACRO NAME,TYPE
NAME label TYPE
ENDM
;
ProcBegin macro _Name,_Type,_Registers
ifdef TURBOC
ProcBeginBody _&_Name,_Type,_Registers
endif
ifdef JPIC
ProcBeginBody _&_Name,_Type,_Registers
endif
ifdef WATCOMC
ProcBeginBody _Name&_,_Type,_Registers
_Name EQU _Name&_
endif
ifdef LATTICE
ProcBeginBody _Name,_Type,_Registers
endif
endm
ProcBegin@ macro _Name,_Type,_Registers
ProcBeginBody _Name,_Type,_Registers
endm
ProcBeginBody macro _Name,_Type,_Registers
_DI = 0
_SI = 0
if _TANDW
ifnb <_Registers>
irpc _flags,_Registers
ifidni <_flags>,<D>
_DI = 1
endif
ifidni <_flags>,<S>
_SI = 1
endif
endm
endif
endif
;
ProcEnd macro _flag
ifb <_flag>
if _DI
pop di
endif
if _SI
pop si
endif
if _TANDW
ifidni <_Type>,<bp>
pop bp
endif
endif
ifdef LATTICE
ifidni <_Type>,<bp>
pop bp
endif
endif
ret
endif
&_Name endp
endm
;
public _Name
ifidni <_Type>,<far>
_Name proc far
else
_Name proc near
endif
ifidni <_Type>,<bp>
if _TANDW
push bp
mov bp, sp
endif
ifdef LATTICE
push bp
mov bp, sp
endif
Arg1 equ <[bp+4]>
Arg2 equ <[bp+6]>
Arg3 equ <[bp+8]>
Arg4 equ <[bp+10]>
Arg5 equ <[bp+12]>
Arg6 equ <[bp+14]>
Arg7 equ <[bp+16]>
Arg8 equ <[bp+18]>
endif
ifidni <_Type>,<bx>
if _TANDW
mov bx, sp
endif
ifdef LATTICE
mov bx, sp
endif
Arg1 equ <[bx+2]>
Arg2 equ <[bx+4]>
Arg3 equ <[bx+6]>
Arg4 equ <[bx+8]>
Arg5 equ <[bx+10]>
Arg6 equ <[bx+12]>
Arg7 equ <[bx+14]>
Arg8 equ <[bx+16]>
endif
if _SI
push si
endif
if _DI
push di
endif
endm
;
.list
+297
View File
@@ -0,0 +1,297 @@
.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
; 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
+86
View File
@@ -0,0 +1,86 @@
.xlist
; Include file - EPOCSIBO.INC
; Epoc/Os SIBO specific include file
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
;
EPOCSIBO_INC equ 1
;
SupplyEnt struc
MainBatteryReading dw ?
LithiumBatteryReading dw ?
MainsPresent dw ?
SupplyEnt ends
;
SupplyWarningsEnt struc
MainBatteryWarning dw ?
LithiumBatteryWarning dw ?
MainBatteryMaxValue dw ?
LithiumBatteryMaxValue dw ?
SupplyWarningsEnt ends
;
MainBatZero equ 0
MainBatVeryLow equ 1
MainBatLow equ 2
MainBatGood equ 3
;
SupplySoundWarning equ 0001h
SupplyFlashWarning equ 0002h
SupplySystemTimeChanged equ 0004h
;
SupplyInfoEnt struc
SuMainBatLevel db ?
SuMainBatStatus db ?
SuBackupBatLevel db ?
SuDcLevel db ?
SuWarningFlags dw ?
SuInsertionDate dd ?
SuTicksInUseBattery dd ?
SuTicksInUseDc dd ?
SuMilliampTicks dd ?
SupplyInfoEnt ends
;
SsdUnitInfo struc
SsdUnitStatus db ?
SsdUnitType db ?
SsdUnitDevices db ?
SsdUnitAsicType db ?
SsdUnitChanged db ?
SsdUnitReadCmd db ?
SsdUnitTotalSectors dw ?
SsdUnitMask dw ?
SsdUnitSectorsPerDevice dw ?
SsdUnitSpare db ?
SsdUnitShift db ?
SsdUnitDoReadCmd dw ?
SsdUnitInfo ends
;
SsdData struc
SsdUnitInfoBuffer SsdUnitInfo 4 dup(<>)
SsdDoorStatus db ?
SsdDoorDelay db ?
SsdPakCritical db ?
SsdDoorOpened db ?
SsdOldFrcVector dd ?
SsdFrcFlag dw ?
SsdPakChannel db ?
SsdWriteFlag db ?
SsdFlashCount dw ?
SsdFlashVector dw ?
SsdFlashAddress dw ?
SsdFlashOffset dw ?
SsdFlashMaxProgramPulses dw ?
SsdSaveStack dw ?
SsdNeedSerialResume db ?
SsdBackTo4 db ?
SsdA9DoorNmiEnabled db ?
SsdSpare db ?
SsdFlashProgram dw ?
SsdNewPddSpareBuffer db 400h dup (?)
SsdData ends
;
.list
+125
View File
@@ -0,0 +1,125 @@
.xlist
; Include file - OSPACK.INC
; Epoc/Os Sibo packs include file.
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 CJ Final release
; 2.50A 24/01/93 NSM Changed to support S3B/C
;
DoorOpen equ 001h
DoorClosed equ 000h
;
; ASIC4 STRUCTURES AND REGISTER BITS
; ==================================
;
ASIC5TYPE equ 0
ASIC4TYPE equ 1
;
ASIC4R struc
A4Data db ?
A4Portb db ?
A4IncAddress db ?
A4Address db ?
A4Dum4 db ?
A4Dum5 db ?
A4Dum6 db ?
A4Control db ?
ASIC4R ends
;
A4PortbMode equ A4IncAddress
A4InfoR equ A4Portb
A4CsSetupW equ A4Portb
A4XInfo record A4MXPeriph:1,A4MXType:1,A4MXDevices:1,A4MXBlocks:1, \
A4MXCheat:1,A4MXExtra:2,A4MXLowBat:1
;
A4SpecialMode equ 2
A4NormalMode equ 0
;
A4LBO equ 080h ; Enable low battery check
SetVppOn equ 010h ; Enable VPP bit in A4CONTROL
SetVppOff equ 000h ; Disable VPP
VppOnDelay equ 5 ; i.e. 5ms.
BatteryDelay equ 1 ; 1 ms
;
; INTEL FLASH EPROM COMMANDS
; ==========================
;
ReadCmd equ 0 ; Set into read mode when VPP is on
EraseCmd equ 020h ; Start erase cycle
EraseVerifyCmd equ 0a0h ; Erase verify byte
ProgramCmd equ 040h ; Start program cycle
ProgramVerifyCmd equ 0c0h ; Program verify byte
MaxProgramPulses equ 25 ; Number of programs per byte
MaxErasePulses equ 1000 ; Number of erase cycles
EraseDelay equ 10 ; Erase program delay 10mS
;
; INTEL TYPE2 FLASH EPROM COMMANDS
; ================================
;
Type2ReadCmd equ 0FFh ; Read byte with VPP on
Type2EraseCmd equ 0D0h ; Start erase cycle
Type2EraseSetup equ 020h ; Erase verify byte
Type2ProgramCmd equ 040h ; Start program cycle
Type2ClearStatus equ 050h ; Clear status byte
Type2ReadStatus equ 070h ; Read status byte
Type2MaxProgramPulses equ 1 ; Number of programs per byte
Type2ProgramTimeout equ 150 ; 150 frames at 3.2 us is >450 us.
Type2EraseTimeout equ 321 ; 320 ticks is 10 seconds.
; Status Register Format
Type2StatusBusy equ 80h
Type2EraseSuspended equ 40h
Type2EraseSuccess equ 20h
Type2WriteSuccess equ 10h
Type2VPPFail equ 08h
;
if HandHeld
if Corporate or S3c
Max01Units equ 2
else
Max01Units equ 3
endif
else
Max01Units equ 4
endif
;
; DATA STRUCTURES
; ===============
;
InfoRec record PackType:3,NumberOfChips:2,BlocksPerChip:3
;
TypeRam equ 0
TypeIntelFlash equ 1
Type2IntelFlash equ 2
TypeUnknown equ 3
TypeRom equ 6
TypeWriteProtected equ 7
;
UnitShiftNumber equ 4 ; 2^UnitShift must equal size of UnitInfo
;
UnitInfo struc ; This must be an whole power of 2
UnitStatus db ?
UnitType db ?
UnitDevices db ?
UnitAsicType db ?
UnitChanged db ?
UnitReadCmd db ?
UnitTotalSectors dw ?
UnitMask dw ?
UnitSectorsPerDevice dw ?
UnitSpare db ?
UnitShift db ?
UnitDoReadCmd dw ?
UnitInfo ends
;
UnitBufferInBxFromBl macro
xor bh, bh
rept UnitShiftNumber
shl bx, 1
endm
add bx, offset OsDataGroup:OsUnitInfoBuffer
endm
;
.list
+620
View File
@@ -0,0 +1,620 @@
.xlist
; Include file - OSSIBO.INC
; Epoc/Os Sibo include file.
; Copyright (c) Psion PLC 1989-90.
;
; VER DATE BY DESCRIPTION
; ----- -------- ---- -----------
; 2.00F 30/09/90 NSM Final release
;
NoNullFrames equ 1
;
if Asic1
A1Ent struc
A1Dummy dw ?
A1Control dw ?
A1LcdSize dw ?
A1LcdControl dw ?
A1InterruptMask dw ?
A1NonSpecificEoi dw ?
A1TimerEoi dw ?
A1FrcEoi dw ?
A1ResetWatchDog dw ?
A1FrcControl dw ?
A1ProtectionOn dw ?
A1ProtectionUpper dw ?
A1ProtectionLower dw ?
A1SoundLsw dw ?
A1SoundMsw dw ?
A1SoundControl dw ?
A1Ent ends
;
A1Status equ A1Control
A1ProtectionOff equ A1ProtectionOn
A1InterruptStatus equ A1LcdControl
;
A1StatusR record LcdData:2,Rtc4Hz:1,SldMsw:1,ComboBusy:1,Rtc32Hz:1,ExternalNmi:1,WatchDogNmi:1,SldTx:1,A1SldEnable:1,LcdEnable:1,Ram512:1,Ram128:1,FrcSource:1,TickRate:1,FrcMode:1
A1LcdSizeR record LcdMLineEnable:1,LcdNumberOfPixels:5,LcdEndOfFrame:10
A1LcdControlR record LcdMode:2,LcdMLineRate:5,LcdRate:5
A1InterruptMaskR record SldTransmit:1,SldReceive:1,FrcExpired:1,Asic2Int:1,ExpIntLeftA:1,ExpIntRightB:1,Mains:1,Timer:1
ExpAddressLeftA equ 0200h
ExpAddressRightB equ 0100h
ExpChannelLeftA equ SelectChannel6
ExpChannelRightB equ SelectChannel5
;
; Asic1 dependent constants
;
ResetWatchDog equ A1ResetWatchDog
;
A2Ent struc
A2Dummy db 080h dup(?)
A2Index dw ?
A2Control dw ?
A2Control1 dw ?
A2Control2 dw ?
A2Control3 dw ?
A2SerialData dw ?
A2SerialControl dw ?
A2ChannelControl dw ?
A2Ent ends
;
A2External equ A2Control1
A2InterruptStatus equ A2Control2
A2Status equ A2Control3
A2KeyData equ A2SerialControl
A2SlaveData equ A2ChannelControl
A2IControl0 equ 0
A2IControl1 equ 1
A2IWrite equ 2
A2IDDR equ 3
;
A2InterruptStatusR record SlaveDataOverrun:1,SlaveDataControl:1,SlaveDataValid:1,ExpansionInterrupt:1,DoorInterrupt:1
A2StatusR record A2RevId:1,A2XExt:1,A2Sdis:1,SerialBusy:1,SerialClockState:1,A1ResetFlag:1,WakeUp:1,A1OnKey:1
A2Control1R record SerialClockRate:2,KeyScan:4
A2Control2R record ClockEnable7:1,ClockEnable6:1,ClockEnable5:1,BuzzerMode:1,BuzzerVolume:1,BuzzerToggle:1,XySwitch:1,DigitizerEnable:1
A2Control3R record ElEnable:1,VhControl:1,ExpansionEnable:1,DoorEnable:1,SerialEnable:1,A2SldEnable:1,Ps34Acknowledge:1,SerialNull:1
A2ChannelControlR record MultiplexEnable:1,ChannelSelect:3,Pack4Enable:1,Pack3Enable:1,Pack2Enable:1,Pack1Enable:1
;
ClockRateSlow equ 2
ClockRateMedium equ 0
ClockRateFast equ 3
SelectChannel0 equ (4 shl ChannelSelect)
SelectChannel1 equ (mask Pack1Enable)
SelectChannel2 equ (mask Pack2Enable)
SelectChannel3 equ (mask Pack3Enable)
SelectChannel4 equ (mask Pack4Enable)
SelectChannel5 equ (5 shl ChannelSelect)
SelectChannel6 equ (6 shl ChannelSelect)
SelectChannel7 equ (7 shl ChannelSelect)
;
SCONTOUT macro
out A2SerialControl, al
endm
;
SDATAOUT macro
out A2SerialData, al
endm
;
SDATAIN macro
in al, A2SerialData
endm
;
SBUSY macro
wait
endm
;
SREAD macro _REG
mov al, SerialReadSingle or _REG
out A2SerialControl, al
nop
SBUSY
in al, A2SerialData
endm
;
SREADM macro _REG
mov al, SerialReadMulti or _REG
out A2SerialControl, al
nop
SBUSY
in al, A2SerialData
endm
;
SWRITE macro _REG,_VAL
mov al, SerialWriteSingle or _REG
out A2SerialControl, al
SBUSY
mov al, _VAL
out A2SerialData, al
endm
;
SWRITEM macro _REG,_VAL
mov al, SerialWriteMulti or _REG
out A2SerialControl, al
SBUSY
mov al, _VAL
out A2SerialData, al
endm
;
SETSPEED macro _SPEED
pushf
cli
mov al, OsA2Control1
and al, not mask SerialClockRate
ifidni <_SPEED>,<FAST>
or al, ClockRateFast shl SerialClockRate
endif
ifidni <_SPEED>,<NORMAL>
or al, ClockRateMedium shl SerialClockRate
endif
ifidni <_SPEED>,<SLOW>
or al, ClockRateSlow shl SerialClockRate
endif
mov OsA2Control1, al
out A2Control1, al
popf
endm
;
if LapTop
XPUSHFCLI macro
pushf
cli
endm
XPOPF macro
popf
endm
else
XPUSHFCLI macro
endm
XPOPF macro
endm
endif
;
XNOP macro
endm
;
@HwNullFrame macro
call OsHwNullFrame
endm
;
A3Ent struc
A3Adc db ?
A3Control1 db ?
A3Setup db ?
A3Control2 db ?
A3Dummy1 db 3 dup (?)
A3Control3 db ?
A3Dummy2 db 5 dup (?)
A3Status db ?
A3Dummy3 db ?
A3Ent ends
;
A3AdcLsbR record InvertedBit:1,OtherBits:7
A3AdcMsbR record Polarity:1,Overrange:1,AdcBits:4
A3Control1R record Vcc5Enable:1,Vcc4Enable:1,Vcc3Enable:1,DtoaBits:5
A3Control2R record AnalogueMultiplex:2,VhSoftStart:1,Vee2SoftStart:1,Vee1SoftStart:1,VhEnable:1,Vee2Enable:1,Vee1Enable:1
A3Control3R record AdcReadHighEnable:1,OffEnable:1,xDummy1:1
Ps34ControlR record Ps34Vcc3:1,xDummy2:1,Ps34Vcc4:1,xDummy3:1,Ps34Vcc5:1,xDummy4:3
;
AdcDigitizer equ 0
AdcVh equ 1
AdcMainBattery equ 2
AdcLithiumBattery equ 3
A3SetupValue equ 2
A3SelectId equ (SerialSelect or Asic5NormalId)
A3InfoByte equ 080h
;
Vee1SoftStartDelay equ (30*128)
Vee2SoftStartDelay equ (30*128)
VhSoftStartDelay equ (100*128)
Vee1OffDelay equ (100*128)
Vee2OffDelay equ (100*128)
VhOffDelay equ (100*128)
Vcc3Delay equ (25*128)
Vcc4Delay equ (25*128)
Vcc5Delay equ (25*128)
Vcc4OffFrames equ (25)
Vcc1_4To5Delay equ (3) ; Pan only in ms.
Vcc1_4to5OffFrames equ (20) ; Gives 392 frames = 6.0 ms
Vcc1_4to5OnTime equ 4 ; Gives 4 ms
;
PS34R_ADC equ 0
PS34R_STATUS equ 1
PS34W_CONTROL equ 0
PS34W_DTOA equ 1
PS34W_OFF equ 0eh
;
PS34STATR record pPowerFail:1,pColdStart:1,pVhready:1,pPenup:1,pNc:1,pAdmsb:3
PS34CONTR record pVcc3:1,pVee1:1,pVcc4:1,pVee2:1,pVcc5:1,pVh:1,pVhpower:2
PS34DTOAR record pNcc:1,pAdcsel:2,pDac:5
;
ADCSEL_ADCIN equ 0
ADCSEL_VIN equ 1
ADCSEL_VH equ 2
ADCSEL_VBATT equ 3
;
VHP1TO8 equ 0
VHP1TO4 equ 1
VHP1TO2 equ 2
VHP1TO1 equ 3
;
PPowerControl equ 0100h
PPowerControlR record PVcc5Enable:1,PSoundEnable:1,PVee1Enable:1,PDropVoltage:1,PDac:4
PPia record PSoundVol:2,PClearCold:1,PDcPresent:1,PColdFlag:1,PLithiumWarn:1,PVinWarn:1
PSoundControl equ 0200h
endif
;
A3StatusR record PowerFail:1,ColdStart:1
AIntfR record ResetFlag:1,DummyWakeUp:1,OnKey:1
if Asic1
if ((mask ResetFlag) ne (mask A1ResetFlag)) or \
((mask OnKey) ne (mask A1OnKey))
.err Reset or OnKey flags are not equal
endif
endif
;
SerialWriteSingle equ 10000000b
SerialWriteMulti equ 10010000b
SerialReadSingle equ 11000000b
SerialReadMulti equ 11010000b
SerialReset equ 00000000b
SerialSelect equ 01000000b
;
Asic4Id equ 006h
Asic5PackId equ 002h
Asic5NormalId equ 003h
Asic6Id equ 004h
Asic8Id equ 005h
Asic2SlaveId equ 01fh
;
; Asic5 info byte structure
;
A5InfoByteR record A5TTL:1,A5Modem:1,A5MultiDrop:1,A5Barcode:1,A5Other:2,A5Parallel:1,A5Rs232:1
A5OtherRom equ (1 shl A5Other)
A5OtherMCRTTL equ (3 shl A5Other)
A5MCR equ (2 shl A5Other)
;
if Consumer
if S3b
DefaultLcdContrast equ 9
else
DefaultLcdContrast equ 7
endif
else
if S3c
DefaultLcdContrast equ 9
else
DefaultLcdContrast equ 15
endif
endif
;
InterruptBase equ 078h
;
if Asic9
KeyPollColumns equ 8
else
KeyPollColumns equ 10
endif
KeyInitialDelay equ 24
if Consumer or S3c
KeyRepeatDelay equ 2
else
KeyRepeatDelay equ 4
endif
PenUpDelay equ 16
MouseDownDelay equ 8
KeySettleDelay equ 24
KeyCntrlMask equ 00000001b
KeyLeftShiftMask equ 00000010b
KeyPsionMask equ 00000100b
KeyCapsMask equ 00001000b
KeyRightShiftMask equ 00010000b
DigitizerRowMask equ 00010000b
PsionScanCode equ 6
CapsScanCode equ 5
PsionUpScanCode equ 65
;
PostRomTest equ 010h
PostSystemRamTest equ 020h
PostVideoRamTest equ 030h
PostComplete equ 0f0h
if Consumer or S3c
PostPort equ 0h
else
PostPort equ 01ffh
endif
;
if HandHeld
VideoRamSegment equ 00040h
VideoRamBase equ 00000h
if Corporate
VideoRamWords equ 00320h
else
if S3b
VideoRamWords equ 02580h
else
if S3c
VideoRamWords equ 00C80h
else
VideoRamWords equ 00500h
endif
endif
endif
else
VideoRamSegment equ 0b800h
VideoRamBase equ 00000h
VideoRamWords equ 04000h
endif
;
CalSeg equ 0fffeh
CalEnt struc
CalVsupCLsw dw ?
CalVsupCMsw dw ?
CalVsupM dw ?
CalVlthCLsw dw ?
CalVlthCMsw dw ?
CalVlthM dw ?
CalType dw ?
CalEnt ends
;
CHKeyDataR record CHInSled:1,CHMains:1,CHDummy:2
;
IntBXHw equ -2
;
if Asic9
A9WControlRW equ 0002h
A9RControl record A9MFrc2Is512KHzOr1KHz:1,A9MFrc2PreScale:1,\
A9MFrc1Is512KHzOr1Hz:1,A9MFrc1PreScale:1,\
A9MSoundEnable:1,A9MLcdEnable:1,\
A9MLowBatNMIEnable:1,A9MDoorNMIEnable:1,\
A9MZeroIsGrayMode:1,A9MArmStandBy:1,\
A9MDisableDMADivide:1,A9MRamDeviceSize:2,\
A9MDisableMemWait:1,A9MDisableIoWait:1,\
A9MDisableClockDivide:1
A9VRam256KBits equ (0 shl A9MRamDeviceSize)
A9VRam1MBits equ (1 shl A9MRamDeviceSize)
A9VRam4MBits equ (2 shl A9MRamDeviceSize)
A9VRam16MBits equ (3 shl A9MRamDeviceSize)
A9XRamDeviceSizeMask equ (3 shl A9MRamDeviceSize)
A9WStatusR equ 0004h
A9RStatus record A9MCold:1,A9MPowerFail:1,\
A9MReset:1,A9MNoBattery:1,\
A9MFifoFull:1,A9MSlaveOverrun:1,\
A9MSlaveControlFrame:1,A9MSlaveDataValid:1,\
A9MKeyboard:1,A9MSlaveClock:1,\
A9MMainsPresent:1,A9MDoorSwitch:1,\
A9MLowBatNMI:1,A9MDoorNMI:1,\
A9MProtectedModeNMI:1,A9MWatchDogNMI:1
A9MLcdType equ 8
A9XLcdType equ 0000111100000000b
A9WLcdSizeW equ 0004h
A9RLcdSize record A9MLcdLineLength:5,A9MLcdNumberOfPixels:11
A9WLcdControlW equ 0006h
A9RLcdControl record A9MLcdMode:2,A9MLcdACLineRate:5,A9MLcdPixelRate:5
A9VSinglePage1 equ (0 shl A9MLcdMode)
A9VSinglePage2 equ (1 shl A9MLcdMode)
A9VSinglePage1And2 equ (2 shl A9MLcdMode)
A9VDualPage1And2 equ (3 shl A9MLcdMode)
A9BInterruptStatusR equ 0006h
A9BInterruptMaskRW equ 0008h
A9RInterrupts record A9MFrc2:1,A9MFrc1:1,\
A9MExpIntB:1,A9MExpIntA:1,A9MExpIntC:1,\
A9MSlave:1,A9MTimer:1,A9MSound:1
A9BNmiClearW equ 0009h
A9BNonSpecificEoiW equ 000ah
A9BStartFlagClearW equ 000bh
A9BTimerEoiW equ 000ch
A9BSerialSlaveEoiW equ 000dh
A9BFrc1EoiW equ 000eh
A9BFrc2EoiW equ 000fh
A9WResetWatchDogW equ 0010h
A9WFrc1DataRW equ 0012h
A9BProtectionOnW equ 0014h
A9BProtectionOffR equ 0014h
A9BProtectionOffW equ 0015h
A9WProtectionUpperW equ 0016h
A9WProtectionLowerW equ 0018h
A9BSoundDataRW equ 001ah
A9BSoundEoiW equ 001ch
A9WFrc2DataRW equ 001eh
A9WPortABDataRW equ 0020h
if S3b
A9RPortABData record A9MKeyId0:1,A9MSleepDoorNmiDisabled:1,\
A9MBatLevel2:1,A9MBatLevel1:1,A9MLiBatLevel:1,\
A9MKeyRow:11
endif
if S3c
A9RPortABData record A9MKeyIdX2:1,A9MNiCdDetect:1,\
A9MBatLevel2:1,A9MBatLevel1:1,A9MLiBatLevel:1,\
A9MKeyIdX1:1,A9MKeyIdX0:0,A9MKeyRowX8:1,\
A9MCradle:1,A9MKeyRowX:7
endif
A9BPortADataRW equ 0020h
A9BPortBDataRW equ 0021h
A9WPortABDDRRW equ 0022h
A9VPortABDDR equ 0000000000000000b
A9BPortADDRRW equ 0022h
A9BPortBDDRRW equ 0023h
A9WPortCDDataRW equ 0024h
if S3b
A9RPortCDData record A9MVccPacksEnable:1,A9MCodecEnable:1,\
A9MVccLcdEnable:1,A9MLcdPanelEnable:1,\
A9MLcdContrast:4,A9MVolume:2,\
A9MReproEnable:1,A9MAltDoorNMIEnable:1,\
A9MAmplifierEnable:1,A9MKeyIdEnable:1,\
A9MKeyId2:1,A9MKeyId1:1
A9VVolumeLow equ (mask A9MVolume)
A9VPortCDData equ 0000111100000000b
A9VPortCDDDR equ not (1111000011111100b)
endif
if S3c
A9RPortCDData record A9MVccPacksEnable:1,A9MCodecEnable:1,\
A9MVccLcdEnable:1,A9MLcdPanelEnable:1,\
A9MLcdContrast:4,A9MVolume:2,\
A9MReproEnable:1,A9MAltDoorNMIEnable:1,\
A9MAmplifierEnable:1,A9MKeyIdEnable:1,\
A9MBuzVolX:1,A9MBacklightEnableX:1
A9VVolumeLow equ (mask A9MVolume)
A9VPortCDData equ 0000111100000000b
A9VPortCDDDR equ not (1111000011111111b)
endif
A9BPortCDataRW equ 0024h
A9BPortDDataRW equ 0025h
A9WPortCDDDRRW equ 0026h
A9BPortCDDRRW equ 0026h
A9BPortDDDRRW equ 0027h
A9BPageSelect6000RW equ 0028h
A9BPageSelect7000RW equ 0029h
A9BPageSelect8000RW equ 002ah
A9BPageSelect9000RW equ 002bh
A9WControlExtraRW equ 002ch
A9RControlExtraRW record A9MSlaveIntEnable:1,A9MClkDiv:2,\
A9MClockEnable5:1,A9MClockEnable4:1,\
A9MClockEnable3:1,A9MClockEnable2:1,\
A9MClockEnable1:1,A9MSoundDir:1,\
A9MExonDisable:1,A9MBuzzFromFrc1OrTog:1,\
A9MBuzzTog:1,A9MKeyCol:4
A9VKeyColHigh equ 0
A9VKeyColLow equ 1
A9VKeyCol0 equ 8
A9VClkDiv1 equ (3 shl A9MClkDiv)
A9VClkDiv2 equ (2 shl A9MClkDiv)
A9VClkDiv3 equ (1 shl A9MClkDiv)
A9VClkDiv4 equ (0 shl A9MClkDiv)
A9WPumpControlRW equ 002eh
A9RPumpControl record A9MVhPumpDc:4,A9MVhPumpBat:4,\
A9MLcdPump:4,A9MPump2:4
A9VVhPumpBat equ (14 shl A9MVhPumpBat)
A9VVhPumpBatSoft equ (4 shl A9MVhPumpBat)
A9VVhPumpBatMedium equ (8 shl A9MVhPumpBat)
A9VVhPumpDC equ (2 shl A9MVhPumpDc)
A9VVhPumpDCSoft equ (1 shl A9MVhPumpDc)
A9VLcdPump equ (7 shl A9MLcdPump)
A9VLcdPumpSoft equ (1 shl A9MLcdPump)
A9VPacksPumpSoft equ (15 shl A9MPump2)
A9VVhPumpDelay equ 100 ; Milliseconds
A9VLcdPumpDelay equ 5 ; Milliseconds
A9VCC3OnDelay equ 1 ; Milliseconds
A9VCCPacksDelay equ 20 ; Milliseconds
A9VCC2Delay equ 10 ; Milliseconds
A9WRtcLSWRW equ 0080h
A9WRtcMSWRW equ 0082h
A9WNullFrameW equ 0084h
A9BSlaveDataR equ 0088h
A9BSerialDataRW equ 008ah
A9BSerialControlW equ 008ch
A9BChannelSelectRW equ 008eh
A9RChannelSelect record A9MMultiplexEnable:1,A9MSerialClockRate:2,\
A9MPack5Enable:1,A9MPack4Enable:1,\
A9MPack3Enable:1,A9MPack2Enable:1,\
A9MPack1Enable:1
A9VSClkRateMedium equ (0 shl A9MSerialClockRate)
A9VSClkRateSpecial equ (1 shl A9MSerialClockRate)
A9VSClkRateSlow equ (2 shl A9MSerialClockRate)
A9VSClkRateFast equ (3 shl A9MSerialClockRate)
;
; Asic9 Dependent constants
;
ResetWatchDog equ A9WResetWatchDogW
SelectChannel1 equ (mask A9MPack1Enable)
SelectChannel2 equ (mask A9MPack2Enable)
SelectChannel3 equ (mask A9MPack3Enable)
SelectChannel4 equ (mask A9MPack4Enable)
SelectChannel5 equ (mask A9MPack5Enable)
;
; Current usage values
;
IdleCurrent equ 23
RunCurrent equ 51
Asic5SerialCurrent equ 54
Flash1ProgramCurrent equ 76
Flash2ProgramCurrent equ 99
Flash1EraseCurrent equ 94
Flash2EraseCurrent equ 129
;
; We add 26 because most of the work is under the NULL process.
; The value is 26 and not 28 because 10% of the time we are
; under the sound server.
;
SoundCurrentPlayV3 equ (25+20)
SoundCurrentPlayV2 equ (30+20)
SoundCurrentPlayV1 equ (55+20)
SoundCurrentPlayV0 equ (120+20)
;
; The value here must never equal one of the play values.
; It won't anyway in practise so this is not a big deal.
;
SoundCurrentRecord equ 5
;
SCONTOUT macro
out A9BSerialControlW, al
endm
;
SDATAOUT macro
out A9BSerialDataRW, al
endm
;
SDATAIN macro
in al, A9BSerialDataRW
endm
;
SBUSY macro
endm
;
SREAD macro _REG
mov al, SerialReadSingle or _REG
out A9BSerialControlW, al
in al, A9BSerialDataRW
endm
;
SREADM macro _REG
mov al, SerialReadMulti or _REG
out A9BSerialControlW, al
in al, A9BSerialDataRW
endm
;
SWRITE macro _REG,_VAL
mov al, SerialWriteSingle or _REG
out A9BSerialControlW, al
mov al, _VAL
out A9BSerialDataRW, al
endm
;
SWRITEM macro _REG,_VAL
mov al, SerialWriteMulti or _REG
out A9BSerialControlW, al
mov al, _VAL
out A9BSerialDataRW, al
endm
;
SETSPEED macro _SPEED
pushf
cli
in al, A9BChannelSelectRW
and al, not (mask A9MSerialClockRate)
ifidni <_SPEED>,<FAST>
or al, A9VSClkRateFast
endif
ifidni <_SPEED>,<NORMAL>
or al, A9VSClkRateMedium
endif
ifidni <_SPEED>,<SLOW>
or al, A9VSClkRateSlow
endif
out A9BChannelSelectRW, al
popf
endm
;
XPUSHFCLI macro
endm
XPOPF macro
endm
XNOP macro
endm
;
@HwNullFrame macro
out A9WNullFrameW, ax
endm
endif
;
.list
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
@@ -0,0 +1,834 @@
{
"identifier": "psion-sibo-c-sdk",
"format-version": "2",
"archive-hocr-tools-version": "1.1.54",
"confidence": 87,
"pages": [
{
"leafNum": 0,
"confidence": null,
"pageNumber": "",
"pageProb": null,
"wordConf": null
},
{
"leafNum": 1,
"confidence": null,
"pageNumber": "",
"pageProb": null,
"wordConf": null
},
{
"leafNum": 2,
"confidence": null,
"pageNumber": "",
"pageProb": null,
"wordConf": null
},
{
"leafNum": 3,
"confidence": null,
"pageNumber": "",
"pageProb": null,
"wordConf": null
},
{
"leafNum": 4,
"confidence": 81,
"pageNumber": "2",
"pageProb": 71,
"wordConf": 96
},
{
"leafNum": 5,
"confidence": 97,
"pageNumber": "3",
"pageProb": 87,
"wordConf": 96
},
{
"leafNum": 6,
"confidence": 81,
"pageNumber": "4",
"pageProb": 71,
"wordConf": 95
},
{
"leafNum": 7,
"confidence": 97,
"pageNumber": "5",
"pageProb": 87,
"wordConf": 96
},
{
"leafNum": 8,
"confidence": 81,
"pageNumber": "6",
"pageProb": 71,
"wordConf": 96
},
{
"leafNum": 9,
"confidence": 97,
"pageNumber": "7",
"pageProb": 87,
"wordConf": 96
},
{
"leafNum": 10,
"confidence": 81,
"pageNumber": "8",
"pageProb": 71,
"wordConf": 96
},
{
"leafNum": 11,
"confidence": 97,
"pageNumber": "9",
"pageProb": 87,
"wordConf": 96
},
{
"leafNum": 12,
"confidence": 79,
"pageNumber": "10",
"pageProb": 69,
"wordConf": 95
},
{
"leafNum": 13,
"confidence": 96,
"pageNumber": "11",
"pageProb": 86,
"wordConf": 87
},
{
"leafNum": 14,
"confidence": 78,
"pageNumber": "12",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 15,
"confidence": 96,
"pageNumber": "13",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 16,
"confidence": 78,
"pageNumber": "14",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 17,
"confidence": 96,
"pageNumber": "15",
"pageProb": 86,
"wordConf": 93
},
{
"leafNum": 18,
"confidence": 87,
"pageNumber": "16",
"pageProb": 77,
"wordConf": 96
},
{
"leafNum": 19,
"confidence": 96,
"pageNumber": "17",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 20,
"confidence": 79,
"pageNumber": "18",
"pageProb": 69,
"wordConf": 96
},
{
"leafNum": 21,
"confidence": 96,
"pageNumber": "19",
"pageProb": 86,
"wordConf": 97
},
{
"leafNum": 22,
"confidence": 78,
"pageNumber": "20",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 23,
"confidence": 96,
"pageNumber": "21",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 24,
"confidence": 86,
"pageNumber": "22",
"pageProb": 76,
"wordConf": 96
},
{
"leafNum": 25,
"confidence": 96,
"pageNumber": "23",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 26,
"confidence": 78,
"pageNumber": "24",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 27,
"confidence": 96,
"pageNumber": "25",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 28,
"confidence": 78,
"pageNumber": "26",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 29,
"confidence": 96,
"pageNumber": "27",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 30,
"confidence": 78,
"pageNumber": "28",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 31,
"confidence": 96,
"pageNumber": "29",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 32,
"confidence": 78,
"pageNumber": "30",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 33,
"confidence": 96,
"pageNumber": "31",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 34,
"confidence": 78,
"pageNumber": "32",
"pageProb": 68,
"wordConf": 97
},
{
"leafNum": 35,
"confidence": 96,
"pageNumber": "33",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 36,
"confidence": 78,
"pageNumber": "34",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 37,
"confidence": 96,
"pageNumber": "35",
"pageProb": 86,
"wordConf": 95
},
{
"leafNum": 38,
"confidence": 78,
"pageNumber": "36",
"pageProb": 68,
"wordConf": 95
},
{
"leafNum": 39,
"confidence": 96,
"pageNumber": "37",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 40,
"confidence": 78,
"pageNumber": "38",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 41,
"confidence": 96,
"pageNumber": "39",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 42,
"confidence": 78,
"pageNumber": "40",
"pageProb": 68,
"wordConf": 95
},
{
"leafNum": 43,
"confidence": 96,
"pageNumber": "41",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 44,
"confidence": 78,
"pageNumber": "42",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 45,
"confidence": 96,
"pageNumber": "43",
"pageProb": 86,
"wordConf": 95
},
{
"leafNum": 46,
"confidence": 78,
"pageNumber": "44",
"pageProb": 68,
"wordConf": 95
},
{
"leafNum": 47,
"confidence": 96,
"pageNumber": "45",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 48,
"confidence": 78,
"pageNumber": "46",
"pageProb": 68,
"wordConf": 95
},
{
"leafNum": 49,
"confidence": 96,
"pageNumber": "47",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 50,
"confidence": 78,
"pageNumber": "48",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 51,
"confidence": 96,
"pageNumber": "49",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 52,
"confidence": 78,
"pageNumber": "50",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 53,
"confidence": 96,
"pageNumber": "51",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 54,
"confidence": 78,
"pageNumber": "52",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 55,
"confidence": 96,
"pageNumber": "53",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 56,
"confidence": 78,
"pageNumber": "54",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 57,
"confidence": 96,
"pageNumber": "55",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 58,
"confidence": 78,
"pageNumber": "56",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 59,
"confidence": 96,
"pageNumber": "57",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 60,
"confidence": 78,
"pageNumber": "58",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 61,
"confidence": 96,
"pageNumber": "59",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 62,
"confidence": 78,
"pageNumber": "60",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 63,
"confidence": 96,
"pageNumber": "61",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 64,
"confidence": 78,
"pageNumber": "62",
"pageProb": 68,
"wordConf": 97
},
{
"leafNum": 65,
"confidence": 96,
"pageNumber": "63",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 66,
"confidence": 78,
"pageNumber": "64",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 67,
"confidence": 96,
"pageNumber": "65",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 68,
"confidence": 78,
"pageNumber": "66",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 69,
"confidence": 96,
"pageNumber": "67",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 70,
"confidence": 78,
"pageNumber": "68",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 71,
"confidence": 96,
"pageNumber": "69",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 72,
"confidence": 78,
"pageNumber": "70",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 73,
"confidence": 96,
"pageNumber": "71",
"pageProb": 86,
"wordConf": 95
},
{
"leafNum": 74,
"confidence": 78,
"pageNumber": "72",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 75,
"confidence": 96,
"pageNumber": "73",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 76,
"confidence": 78,
"pageNumber": "74",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 77,
"confidence": 96,
"pageNumber": "75",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 78,
"confidence": 78,
"pageNumber": "76",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 79,
"confidence": 96,
"pageNumber": "77",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 80,
"confidence": 78,
"pageNumber": "78",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 81,
"confidence": 96,
"pageNumber": "79",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 82,
"confidence": 78,
"pageNumber": "80",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 83,
"confidence": 96,
"pageNumber": "81",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 84,
"confidence": 78,
"pageNumber": "82",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 85,
"confidence": 96,
"pageNumber": "83",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 86,
"confidence": 78,
"pageNumber": "84",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 87,
"confidence": 96,
"pageNumber": "85",
"pageProb": 86,
"wordConf": 95
},
{
"leafNum": 88,
"confidence": 78,
"pageNumber": "86",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 89,
"confidence": 96,
"pageNumber": "87",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 90,
"confidence": 78,
"pageNumber": "88",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 91,
"confidence": 96,
"pageNumber": "89",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 92,
"confidence": 78,
"pageNumber": "90",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 93,
"confidence": 96,
"pageNumber": "91",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 94,
"confidence": 78,
"pageNumber": "92",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 95,
"confidence": 96,
"pageNumber": "93",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 96,
"confidence": 78,
"pageNumber": "94",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 97,
"confidence": 96,
"pageNumber": "95",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 98,
"confidence": 78,
"pageNumber": "96",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 99,
"confidence": 96,
"pageNumber": "97",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 100,
"confidence": 78,
"pageNumber": "98",
"pageProb": 68,
"wordConf": 96
},
{
"leafNum": 101,
"confidence": 96,
"pageNumber": "99",
"pageProb": 86,
"wordConf": 96
},
{
"leafNum": 102,
"confidence": 76,
"pageNumber": "100",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 103,
"confidence": 95,
"pageNumber": "101",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 104,
"confidence": 76,
"pageNumber": "102",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 105,
"confidence": 95,
"pageNumber": "103",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 106,
"confidence": 76,
"pageNumber": "104",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 107,
"confidence": 95,
"pageNumber": "105",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 108,
"confidence": 76,
"pageNumber": "106",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 109,
"confidence": 95,
"pageNumber": "107",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 110,
"confidence": 76,
"pageNumber": "108",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 111,
"confidence": 95,
"pageNumber": "109",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 112,
"confidence": 76,
"pageNumber": "110",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 113,
"confidence": 95,
"pageNumber": "111",
"pageProb": 85,
"wordConf": 95
},
{
"leafNum": 114,
"confidence": 76,
"pageNumber": "112",
"pageProb": 66,
"wordConf": 96
},
{
"leafNum": 115,
"confidence": 95,
"pageNumber": "113",
"pageProb": 85,
"wordConf": 96
},
{
"leafNum": 116,
"confidence": 75,
"pageNumber": "114",
"pageProb": 65,
"wordConf": 95
},
{
"leafNum": 117,
"confidence": 95,
"pageNumber": "115",
"pageProb": 85,
"wordConf": 95
}
]
}
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
Copyright (c) Psion PLC (1995)
26th May 1995
CONTENTS OF FILES ON DISK
=========================
readme.txt
ASSEMBLER INCLUDE FILES
epoc.inc
epocser.inc
epoclib.inc
epocsibo.inc
ossibo.inc
ospack.inc
C FILES
a4test.c ;Fully comprehensive test program for A4EXIF.LDD
a4test.pr ;TopSpeed Project file for the above test program
ASM FILES
a4exif.asm ;Source code file for A4EXIF.LDD
sys$as5.asm ;Source code file for SYS$AS5.PDD
tmpsaldd.asm ;Standard stand-alone LDD template
tmpa4ldd.asm ;Template LDD for ASIC4/5-based peripherals
+1023
View File
File diff suppressed because it is too large Load Diff
+808
View File
@@ -0,0 +1,808 @@
title NAME.LDD device driver for S3/S3a/S3c/S3../HC
subttl Copyright PSION PLC November 1995
name NAME
; VERSION DATE DESCRIPTION
; ------- -------- ---------------
; 1.0 12/01/95 Template Asic4/5 LDD
; Written by Jason Robinson January 1995
BUILDSB equ 1
Asic4Type =0
Asic5Type =0
NeedTheInterrupt =0
NeedClocking =0
StartChannelInOpen =0
include ..\inc\epoc.inc
include ..\inc\epocser.inc
include ..\inc\epoclib.inc
include ..\inc\epocsibo.inc
include ..\srcs\ossibo.inc
include ..\srcs\ospack.inc
WeSupportS3Only equ Lcd240X80
WeSupportS3aOnly equ Lcd480X160
WeSupportS3cOnly equ Lcd240X100
WeSupportHCOnly equ Lcd160X80
if Consumer
NumberOfChannels equ 1
if Asic9
TheMachineWeSupport equ WeSupportS3aOnly
else
TheMachineWeSupport equ WeSupportS3Only
endif
else
NumberOfChannels equ 3
if Asic9
TheMachineWeSupport equ WeSupportS3cOnly
else
TheMachineWeSupport equ WeSupportHCOnly
endif
endif
A4PERIPH_MASK equ 0f0h
TheInfoByteThatWeWant equ 1
TmpltEnt struc
TmpltEntOpen db ? ; Channel open flag
TmpltChannelStarted db ? ; Channel should be running
TmpltHwChannel dw ? ; The harware we want
TmpltStructPtr dw ? ; Ptr to CB in Apps DS
TmpltTckHandle dw ? ; Tick Handle
TmpltChannelRunning db ? ; Can channel really run
TmpltInterruptMask db ? ; InterruptMask
TmpltChannel db ? ; Channel
if NeedTheInterrupt
TmpltInterruptNumber db ? ; Interrupt Number
TmpltInterruptVector dw ? ; Were to Jump To
if Asic5Type and NeedClocking
TmpltA5Clocking db ? ; Asic5 baud rate clocking
TmpltSpare db ?
endif
else
TmpltSpare db ?
endif
TmpltEnt ends
TmpltStruct struc
Tmpltblk ChanEnt <> ; I/O control block
TmpltEntPtr dw ? ; Ptr to our CS CB
TmpltStruct ends
dgroup group stack
assume ds:dgroup,es:dgroup,ss:dgroup
CodeSeg
ProcBegin@ TmpltLDD
; ===================
dw LDDSignature
db 'HSB',0,0,0,0,0
dw (TableEnd-TableStart)/2
TableStart:
dw TmpltInstall
dw TmpltRemove
dw TmpltHold
dw TmpltResume
dw TmpltReset
dw TmpltUnits
dw TmpltOpen
dw TmpltStrategy
MonitorVector:
dw MonitorInt
TableEnd:
if Consumer
if Asic9
SetupTable db mask A9MSlave,SelectChannel5
db (mask A9MClockEnable5 shr 8),HwIrq2Revector
if NeedTheInterrupt
dw offset Interrupt0
endif
else
SetupTable db mask Asic2Int,SelectChannel7
db (mask ClockEnable7 shr 8),HwIrq4Revector
if NeedTheInterrupt
dw offset Interrupt0
endif
endif
else
if Asic9
SetupTable db mask A9MExpIntA,SelectChannel3
db (mask A9MClockEnable3 shr 8),HwIrq4Revector
if NeedTheInterrupt
dw offset Interrupt0
endif
db mask A9MExpIntB,SelectChannel4
db (mask A9MClockEnable4 shr 8),HwIrq5Revector
if NeedTheInterrupt
dw offset Interrupt1
endif
db mask A9MSlave,SelectChannel5
db (mask A9MClockEnable5 shr 8),HwIrq2Revector
if NeedTheInterrupt
dw offset Interrupt2
endif
else
SetupTable db mask ExpIntLeftA,ExpChannelLeftA
db (mask ClockEnable6 shr 8),HwIrq3Revector
if NeedTheInterrupt
dw offset Interrupt0
endif
db mask ExpIntRightB,ExpChannelRightB
db (mask ClockEnable5 shr 8),HwIrq2Revector
if NeedTheInterrupt
dw offset Interrupt1
endif
db mask Asic2Int,SelectChannel7
db (mask ClockEnable7 shr 8),HwIrq4Revector
if NeedTheInterrupt
dw offset Interrupt2
endif
endif
endif
CsHeldFlag db 0 ; Ldd under a hold?
MachineType db 0
if Consumer
Channel0 TmpltEnt <>
else
Channel0 TmpltEnt <>
Channel1 TmpltEnt <>
Channel2 TmpltEnt <>
endif
ProcEnd noret
ProcBegin@ TmpltInstall,far
; ===========================
; Install the driver
; Exit with carry clear for okay
GenLcdType ; Do we only run on
mov MachineType,al ; particular machines?
cmp al,TheMachineWeSupport
jne CannotInstallOnThisMachine
pushf
cli
push ds
mov ax, cs
mov ds, ax
mov CsHeldFlag, 0 ; Initialise all
mov cx, NumberOfChannels ; the variables
mov di, offset Channel0
mov si, offset SetupTable
ResetAllChannelsLoop:
mov [di].TmpltEntOpen, 0
lodsb
mov [di].TmpltInterruptMask, al
lodsb
mov [di].TmpltChannel, al
lodsb
if NeedClocking
mov [di].TmpltA5Clocking, al
endif
lodsb
if NeedTheInterrupt
mov [di].TmpltInterruptNumber, al
lodsw
mov [di].TmpltInterruptVector, ax
endif
add di,size TmpltEnt
loop ResetAllChannelsLoop
pop ds
popf
FinishedOkay:
clc
ret
CannotInstallOnThisMachine:
mov ax,NotSupportedErr
stc
ret
ProcEnd noret
ProcBegin@ TmpltRemove,far
; ==========================
; Remove the driver
; Exit with carry clear for okay
; Exit with carry set if channel still open
mov cx,NumberOfChannels
mov di,offset Channel0
xor ax,ax
CheckAllChannelsClosedLoop:
cmp cs:[di].TmpltEntOpen,al
jne WeHaveAnOpenChannelSoFail
add di,size TmpltEnt
loop CheckAllChannelsClosedLoop
jmp FinishedOkay
WeHaveAnOpenChannelSoFail:
mov ax,InUseErr
stc
ret
ProcEnd noret
ProcBegin@ TmpltUnits,far
; =========================
; Return the Number of channels that can be opened in AX
mov ax,NumberOfChannels ; We have ? channels
ret
ProcEnd noret
ProcBegin@ TmpltReset,far
; =========================
; Reset the open channel
mov di,cx
cmp cs:[di].TmpltEntOpen,0 ; Somethings gone
je NotOpenToReset ; wrong with the
mov ah,DevHoldPowerDown ; application that
call StopTheChannel ; opened us.
call FreeHardware ; Stop interupts and
mov cs:[di].TmpltEntOpen,0 ; free the channel
NotOpenToReset:
ret
ProcEnd noret
ProcBegin@ TmpltHold,far
; ========================
; Hold the channels
; Hold reason in AH
mov cx,1
xchg cl,CsHeldFlag ; Stop any interrupts
cmp cl,0 ; Mark channel as
jne AlreadyHeld ; under a normal hold
DoHold:
mov cx,NumberOfChannels
mov di,offset Channel0
HoldAllTheChannelsLoop:
cmp cs:[di].TmpltEntOpen,0
je DontHoldBecauseNotOpen
cmp cs:[di].TmpltChannelStarted,0
je DontHoldBecauseNotOpen
push ax
push cx
call StopTheChannel
pop cx
pop ax
DontHoldBecauseNotOpen:
add di,size TmpltEnt
loop HoldAllTheChannelsLoop
AlreadyHeld:
ret
ProcEnd noret
ProcBegin@ TmpltResume,far
; ==========================
; Resume the channel
xor cx,cx ; Be warned during an
xchg cl,CsHeldFlag ; on/off the power to
cmp cl,0 ; ASIC4 is not restored
je AlreadyResumed ; until after this
GenDataSegment ; A resume is pointless
HwGetSsdData ; if there is still no
mov bx,ax ; power to the port
cmp es:[bx].SsdDoorStatus,DoorOpen ; Leave the resume
je DoorsAreOpen ; to the tick
DoResume:
mov cx,NumberOfChannels
mov di,offset Channel0 ; Right hardware?
ResumeAllTheChannelsLoop: ; Else restart
cmp cs:[di].TmpltEntOpen,0 ; interrupts
je DontResumeBecauseNotOpen
cmp cs:[di].TmpltChannelStarted,0
je DontResumeBecauseNotOpen
push cx
call StartTheChannel
pop cx
DontResumeBecauseNotOpen:
add di,size TmpltEnt
loop ResumeAllTheChannelsLoop
AlreadyResumed:
ret
DoorsAreOpen:
mov CsHeldFlag,2
ret
ProcEnd noret
ProcBegin@ TmpltOpen,far
; ========================
; Open the channel
; DS,ES,SS Applications data space
; Handle in DX
cld
pushf
cli
call FindFreeChannel
jnc GotFreeChannel
popf
LockedError:
mov ax,LockedErr
stc
ret
AllErrorsExitHere:
push ax
HeapFreeCell
pop ax
FreeTckAndChannel:
push ax
call FreeHardware
pop ax
FreeTckAndExit:
push ax
mov bx,cs:[di].TmpltTckHandle
IoClose
pop ax
CloseThenFree:
mov cs:[di].TmpltEntOpen,0
stc
ret
GotFreeChannel:
mov cs:[di].TmpltEntOpen,1
mov cs:[di].TmpltChannelStarted,0
mov cs:[di].TmpltChannelRunning,0
popf
xor ax,ax
push ax
mov ax,((':' shl 8)+'K')
push ax
mov ax,(('C' shl 8)+'T')
push ax
mov bx,sp
IoOpen
jnc GotATickChannel
add sp,6
mov ax,LockedErr
jmp CloseThenFree
GotATickChannel:
add sp,6
mov cs:[di].TmpltTckHandle,ax
push dx
mov bx,ax
mov ax,IoFuncStart
mov cx,1
push cx ; Frequency 1 tick
push di ; Data is our CS CB
push dx ; Our device handle
mov cx,(MonitorVector-TableStart)/2 ; Vector to call
push cx
mov cx,sp
IoWithWait
add sp,8
pop dx
call GetHardware
jc FreeTckAndExit
mov cx,(size TmpltStruct) ; Get ourselfs a CB
HeapAllocateCell ; In the applications
jc FreeTckAndChannel ; Data space
mov bx,ax
mov [bx].Tmpltblk.ChanNext,bx
mov [bx].Tmpltblk.ChanSignature,IoChanSignature
mov [bx].Tmpltblk.ChanLibHandle,dx
mov [bx].TmpltEntPtr,di
push bx
mov bx,dx
mov cx,di
IoRequestReset
pop bx
if StartChannelInOpen
call StartChannelFromOpen
endif
xor ax,ax
ret
ProcEnd noret
StrategyVectorTable label word
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset TmpltClose
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
ProcBegin@ TmpltStrategy,far
; ============================
; BX is our control block
; SI points to the parameters
; DS,ES Applications data space
mov ax,[si].RqFunction
mov dx,[si].RqA1Ptr
cmp ax,IoFuncSuperFrame
ja StrategyDefault
shl ax,1
mov di,ax
push StrategyVectorTable[di]
mov di,[bx].TmpltEntPtr
retn
StrategyDefault:
IoRoot
ret
ExitStrategyOkay:
xor ax,ax
ExitStrategy:
mov di,[si].RqStatusPtr
mov word ptr [di],ax
cmp ax,PendingErr
je JustExit
IoSignal
JustExit:
xor ax,ax
ret
ProcEnd noret
ProcBegin@ TmpltClose,far
; =========================
; Close a channel
; DI CS control block
; BX DS control block
; SI points to aurguments on stack
; DX Argument one pointer
mov ah,DevHoldPowerDown
call StopTheChannel
call FreeHardware
mov cs:[di].TmpltChannelStarted,0
push bx
mov bx,[bx].Tmpltblk.ChanLibHandle
mov cx,di
IoRequestResetCancel
pop bx
HeapFreeCell
mov bx,cs:[di].TmpltTckHandle
IoClose
mov cs:[di].TmpltEntOpen,0
jmp short ExitStrategyOkay
ProcEnd noret
ProcBegin@ StartTheChannel
; ==========================
; Start the Channel Running
; Assume channel set up and interrupts off
cmp cs:[di].TmpltChannelRunning,0
jne ChannelAlreadyRunning
if Asic5Type and NeedClocking
if Asic9
in ax, A9WControlExtraRW ; Start the S3s clock
or ah, [bx].TmpltA5Clocking ; Generator
out A9WControlExtraRW, ax
else
mov al, [bx].TmpltA5Clocking
HwSetA2Control2Bits
endif
endif
if NeedTheInterrupt
mov al, cs:[di].TmpltInterruptNumber ; Load the address of
mov cx, cs ; the appropriate
mov bx, cs:[di].TmpltInterruptVector ; interrupt routine
GenSetRevector ; into the correct vector
if Asic9
in al,A9BInterruptMaskRW ; Set the mask
or al,cs:[di].TmpltInterruptMask ; to enable Interrupts
out A9BInterruptMaskRW,al
else
in al, A1InterruptMask
or al,cs:[di].TmpltInterruptMask
out A1InterruptMask, al
endif
endif
mov cs:[di].TmpltChannelRunning,1
ChannelAlreadyRunning:
ret
ProcEnd noret
ProcBegin@ StopTheChannel
; =========================
; Stop the Channel Running
; Assume channel set up and interrupts off
; Stop reason in AH
cmp byte ptr cs:[di].TmpltChannelRunning,0
je ChannelAlreadyStopped
if NeedTheInterrupt
mov ah,cs:[di].TmpltInterruptMask
not ah
if Asic9
in al,A9BInterruptMaskRW ; Stop Interrupts
and al,ah ; By clearing the
out A9BInterruptMaskRW,al ; Mask and resetting
else ; The Vector
in al, A1InterruptMask
and al,ah
out A1InterruptMask, al
endif
mov al, cs:[di].TmpltInterruptNumber
GenResetRevector
endif
if Asic5Type and NeedClocking
if Asic9
mov cl, [bx].TmpltA5Clocking ; Turn off baud rate
not cl ; clocking from the
in ax, A9WControlExtraRW ; S3/3a
and ah, cl
out A9WControlExtraRW, ax
else
mov al, [bx].TmpltA5Clocking
HwClearA2Control2Bits
endif
endif
mov cs:[di].TmpltChannelRunning,0
ChannelAlreadyStopped:
ret
ProcEnd noret
if StartChannelInOpen
ProcBegin@ StartChannelFromOpen
; ===============================
pushf
cli
mov cs:[di].TmpltChannelStarted,1
mov al,cs:[di].TmpltChannel
HwSelectChannel
push ax
call StartTheChannel
pop ax
HwSelectChannel
popf
ret
ProcEnd noret
endif
ProcBegin@ GetHardware
; ======================
mov al, cs:[di].TmpltInterruptMask
HwGetChannel
jc ChannelNotAvailable
pushf
cli
mov al,cs:[di].TmpltChannel
HwSelectChannel
push ax
call CheckForHardware
pop ax
jc NoHardwareFreeTheChannel
HwSelectChannel
popf
clc
ret
NoHardwareFreeTheChannel:
HwSelectChannel
popf
mov al, cs:[di].TmpltInterruptMask
HwFreeChannel
ChannelNotAvailable:
stc
ret
ProcEnd noret
ProcBegin@ FreeHardware
; =======================
mov al, cs:[di].TmpltInterruptMask
HwFreeChannel
ret
ProcEnd noret
ProcBegin@ FindFreeChannel
; ==========================
mov si,[si].OpenNamePtr
mov al,[si+1]
CharToFoldedChar
cmp al,'A'
jb CantGetThatChannel
sub al,'A'
cmp al,NumberOfChannels
jae CantGetThatChannel
xor ah,ah
push dx
mov dx,size TmpltEnt
mul dx
pop dx
mov di,ax
add di,offset Channel0
cmp cs:[di].TmpltEntOpen,0
je FoundAFreeChannel
CantGetThatChannel:
stc
ret
FoundAFreeChannel:
clc
ret
ProcEnd noret
ProcBegin@ CheckForHardware
; ===========================
; Assume Interrupts are off
; Correct channel should be selected
; Out: clc - got correct hardware
; stc - wrong or no hardware
if Asic5Type
HwNullFrame ; Check that the
mov al,(SerialSelect or Asic5NormalId) ; Harware is there
SBUSY ; And that it is what
SCONTOUT ; It should be
XNOP ; First look for An
SBUSY ; ASIC5 at the other
SDATAIN ; End of the link
test al,al
je ConnectionFailed
GotConnection:
popf
clc
ret
ConnectionFailed:
mov al, SerialSelect or Asic4Id ; Asic4 Id
SBUSY
SCONTOUT
XNOP
SBUSY
SDATAIN
test al, al
jne ConnectionFailedExit
else
HwNullFrame
mov al,(SerialSelect or Asic4Id)
SBUSY ; First look for An
SCONTOUT ; ASIC4 at the other
XNOP ; End of the link
SBUSY
SDATAIN
test al, al
je ConnectionFailed
mov al,SerialReadSingle or A4InfoR ; Now see if we have
SBUSY ; The right card
SCONTOUT
XNOP ; Allows the busy signal to come through for the wait
SBUSY
SDATAIN
and al,A4PERIPH_MASK
cmp al,TheInfoByteThatWeWant
jne ConnectionFailedExit
clc
ret
ConnectionFailed:
mov al,(SerialSelect or Asic5NormalId) ; Select as an
SBUSY ; Asic5 peripheral
SCONTOUT
XNOP
SDATAIN
test al,al
jne ConnectionFailedExit
endif
mov al, SerialSelect or Asic8Id ; Modem chip Id
SBUSY
SCONTOUT
XNOP
SBUSY
SDATAIN
test al, al
jne ConnectionFailedExit
mov al, SerialSelect or Asic5PackId ; Asic5pack Id
SBUSY
SCONTOUT
XNOP
SBUSY
SDATAIN
ConnectionFailedExit:
stc
ret
ProcEnd noret
ProcBegin@ MonitorInt,far
; =========================
; Called on every tick
; Issues pack door hold and resumes
; In: Door state in SI
cmp si,DoorOpen
je TheDoorIsOpenSoCantDoAnything
cmp CsHeldFlag,2
je NeedToDoTheResume
ret
NeedToDoTheResume:
mov CsHeldFlag,0
jmp DoResume
TheDoorIsOpenSoCantDoAnything:
cmp CsHeldFlag,0
jne DontNeedToHold
mov CsHeldFlag,2
mov ah,DevHoldPowerFail
jmp DoHold
DontNeedToHold:
ret
ProcEnd noret
if NeedTheInterrupt
ife Consumer
ProcBegin@ Interrupt2,far
; =========================
mov di,offset Channel2
mov ax,PortCActive
jmp ComInt
ProcEnd noret
ProcBegin@ Interrupt1,far
; =========================
mov di,offset Channel1
mov ax,PortBActive
jmp ComInt
ProcEnd noret
endif
ProcBegin@ Interrupt0,far
; =========================
mov di,offset Channel0
mov ax,PortAActive
; FALLTHROUGH to ComInt
ProcEnd noret
ProcBegin@ ComInt,far
; =====================
if Asic9
out A9BNonSpecificEoiW,al
else
out A1NonSpecificEoi, al
endif
clc
ret
ProcEnd noret
endif
EndCodeSeg
stack segment stack para 'data'
stack ends
end TmpltLDD
+531
View File
@@ -0,0 +1,531 @@
title NAME.LDD device driver for S3/S3a/S3c/S3../HC
subttl Copyright PSION PLC November 1995
name NAME
; VERSION DATE DESCRIPTION
; ------- -------- ---------------
; 1.0 12/01/95 Template LDD
; Written by Jason Robinson January 1995
BUILDSB equ 1
include ..\inc\epoc.inc
include ..\inc\epocser.inc
include ..\inc\epoclib.inc
include ..\inc\epocsibo.inc
include ..\srcs\ossibo.inc
include ..\srcs\ospack.inc
OpenSpecificChannel =0
MachineSpecific =0
PeripheralTypeDriver =0
TickRequired =0
NumberOfChannels equ 1
WeSupportS3Only equ Lcd240X80
WeSupportS3aOnly equ Lcd480X160
WeSupportS3cOnly equ Lcd240X100
WeSupportHCOnly equ Lcd160X80
TheMachineWeSupport equ WeSupportS3aOnly
TmpltEnt struc
TmpltEntOpen db ? ; Channel open flag
TmpltChannelStarted db ? ; Channel should be running
TmpltChannelRunning db ? ; Can channel really run
TmpltSpare db ?
TmpltHwChannel dw ? ; The harware we want
TmpltStructPtr dw ? ; Ptr to CB in Apps DS
if PeripheralTypeDriver or TickRequired
TmpltTckHandle dw ? ; Tick Handle
endif
TmpltEnt ends
TmpltStruct struc
Tmpltblk ChanEnt <> ; I/O control block
TmpltEntPtr dw ? ; Ptr to our CS CB
TmpltStruct ends
dgroup group stack
assume ds:dgroup,es:dgroup,ss:dgroup
CodeSeg
ProcBegin@ TmpltLDD
; ===================
dw LDDSignature
db 'HSB',0,0,0,0,0
dw (TableEnd-TableStart)/2
TableStart:
dw TmpltInstall
dw TmpltRemove
dw TmpltHold
dw TmpltResume
dw TmpltReset
dw TmpltUnits
dw TmpltOpen
dw TmpltStrategy
if PeripheralTypeDriver or TickRequired
MonitorVector:
dw MonitorInt
endif
TableEnd:
CsHeldFlag db 0 ; Ldd under a hold?
MachineType db 0
Channel0 TmpltEnt <>
ProcEnd noret
ProcBegin@ TmpltInstall,far
; ===========================
; Install the driver
; Exit with carry clear for okay
if MachineSpecific
GenLcdType ; Do we only run on
mov MachineType,al ; particular machines?
cmp al,TheMachineWeSupport
jne CannotInstallOnThisMachine
endif
mov CsHeldFlag,0 ; Initialise all
mov cx,NumberOfChannels ; the variables
mov di,offset Channel0
xor ax,ax
ResetAllChannelsLoop:
mov cs:[di].TmpltEntOpen,al
add di,size TmpltEnt
loop ResetAllChannelsLoop
FinishedOkay:
clc
ret
CannotInstallOnThisMachine:
mov ax,NotSupportedErr
stc
ret
ProcEnd noret
ProcBegin@ TmpltRemove,far
; ==========================
; Remove the driver
; Exit with carry clear for okay
; Exit with carry set if channel still open
mov cx,NumberOfChannels
mov di,offset Channel0
xor ax,ax
CheckAllChannelsClosedLoop:
cmp cs:[di].TmpltEntOpen,al
jne WeHaveAnOpenChannelSoFail
add di,size TmpltEnt
loop CheckAllChannelsClosedLoop
jmp FinishedOkay
WeHaveAnOpenChannelSoFail:
mov ax,InUseErr
stc
ret
ProcEnd noret
ProcBegin@ TmpltUnits,far
; =========================
; Return the Number of channels that can be opened in AX
mov ax,NumberOfChannels ; We have ? channels
ret
ProcEnd noret
ProcBegin@ TmpltReset,far
; =========================
; Reset the open channel
mov di,cx
cmp cs:[di].TmpltEntOpen,0 ; Somethings gone
je NotOpenToReset ; wrong with the
mov ah,DevHoldPowerDown ; application that
call StopTheChannel ; opened us.
call FreeHardware ; Stop interupts and
mov cs:[di].TmpltEntOpen,0 ; free the channel
NotOpenToReset:
ret
ProcEnd noret
ProcBegin@ TmpltHold,far
; ========================
; Hold the channels
; Hold reason in AH
mov cx,1
xchg cl,CsHeldFlag ; Stop any interrupts
cmp cl,0 ; Mark channel as
jne AlreadyHeld ; under a normal hold
DoHold:
mov cx,NumberOfChannels
mov di,offset Channel0
HoldAllTheChannelsLoop:
cmp cs:[di].TmpltEntOpen,0
je DontHoldBecauseNotOpen
cmp cs:[di].TmpltChannelStarted,0
je DontHoldBecauseNotOpen
push ax
push cx
call StopTheChannel
pop cx
pop ax
DontHoldBecauseNotOpen:
add di,size TmpltEnt
loop HoldAllTheChannelsLoop
AlreadyHeld:
ret
ProcEnd noret
ProcBegin@ TmpltResume,far
; ==========================
; Resume the channel
xor cx,cx ; Be warned during an
xchg cl,CsHeldFlag ; on/off the power to
cmp cl,0 ; ASIC4 is not restored
je AlreadyResumed ; until after this
if PeripheralTypeDriver
GenDataSegment ; A resume is pointless
HwGetSsdData ; if there is still no
mov bx,ax ; power to the port
cmp es:[bx].SsdDoorStatus,DoorOpen ; Leave the resume
je DoorsAreOpen ; to the tick
endif
DoResume:
mov cx,NumberOfChannels
mov di,offset Channel0 ; Right hardware?
ResumeAllTheChannelsLoop: ; Else restart
cmp cs:[di].TmpltEntOpen,0 ; interrupts
je DontResumeBecauseNotOpen
cmp cs:[di].TmpltChannelStarted,0
je DontResumeBecauseNotOpen
push cx
call StartTheChannel
pop cx
DontResumeBecauseNotOpen:
add di,size TmpltEnt
loop ResumeAllTheChannelsLoop
AlreadyResumed:
ret
if PeripheralTypeDriver
DoorsAreOpen:
mov CsHeldFlag,2
ret
endif
ProcEnd noret
ProcBegin@ TmpltOpen,far
; ========================
; Open the channel
; DS,ES,SS Applications data space
; Handle in DX
cld
pushf
cli
call FindFreeChannel
jnc GotFreeChannel
popf
LockedError:
mov ax,LockedErr
stc
ret
AllErrorsExitHere:
push ax
HeapFreeCell
pop ax
FreeTckAndChannel:
push ax
call FreeHardware
pop ax
FreeTckAndExit:
if PeripheralTypeDriver or TickRequired
push ax
mov bx,cs:[di].TmpltTckHandle
IoClose
pop ax
endif
CloseThenFree:
mov cs:[di].TmpltEntOpen,0
stc
ret
GotFreeChannel:
mov cs:[di].TmpltEntOpen,1
mov cs:[di].TmpltChannelStarted,0
mov cs:[di].TmpltChannelRunning,0
popf
if PeripheralTypeDriver or TickRequired
xor ax,ax
push ax
mov ax,((':' shl 8)+'K')
push ax
mov ax,(('C' shl 8)+'T')
push ax
mov bx,sp
IoOpen
jnc GotATickChannel
add sp,6
mov ax,LockedErr
jmp CloseThenFree
GotATickChannel:
add sp,6
mov cs:[di].TmpltTckHandle,ax
push dx
mov bx,ax
mov ax,IoFuncStart
mov cx,1
push cx ; Frequency 1 tick
push di ; Data is our CS CB
push dx ; Our device handle
mov cx,(MonitorVector-TableStart)/2 ; Vector to call
push cx
mov cx,sp
IoWithWait
add sp,8
pop dx
endif
call GetHardware
jc FreeTckAndExit
mov cx,(size TmpltStruct) ; Get ourselfs a CB
HeapAllocateCell ; In the applications
jc FreeTckAndChannel ; Data space
mov bx,ax
mov [bx].Tmpltblk.ChanNext,bx
mov [bx].Tmpltblk.ChanSignature,IoChanSignature
mov [bx].Tmpltblk.ChanLibHandle,dx
mov [bx].TmpltEntPtr,di
push bx
mov bx,dx
mov cx,di
IoRequestReset
pop bx
xor ax,ax
ret
ProcEnd noret
StrategyVectorTable label word
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset TmpltClose
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
dw offset StrategyDefault
ProcBegin@ TmpltStrategy,far
; ============================
; BX is our control block
; SI points to the parameters
; DS,ES Applications data space
mov ax,[si].RqFunction
mov dx,[si].RqA1Ptr
cmp ax,IoFuncSuperFrame
ja StrategyDefault
shl ax,1
mov di,ax
push StrategyVectorTable[di]
mov di,[bx].TmpltEntPtr
retn
StrategyDefault:
IoRoot
ret
ExitStrategyOkay:
xor ax,ax
ExitStrategy:
mov di,[si].RqStatusPtr
mov word ptr [di],ax
cmp ax,PendingErr
je JustExit
IoSignal
JustExit:
xor ax,ax
ret
ProcEnd noret
ProcBegin@ TmpltClose,far
; =========================
; Close a channel
; DI CS control block
; BX DS control block
; SI points to aurguments on stack
; DX Argument one pointer
mov ah,DevHoldPowerDown
call StopTheChannel
call FreeHardware
push bx
mov bx,[bx].Tmpltblk.ChanLibHandle
mov cx,di
IoRequestResetCancel
pop bx
HeapFreeCell
if PeripheralTypeDriver or TickRequired
mov bx,cs:[di].TmpltTckHandle
IoClose
endif
mov cs:[di].TmpltEntOpen,0
jmp short ExitStrategyOkay
ProcEnd noret
ProcBegin@ StartTheChannel
; ==========================
; Start the Channel Running
cmp byte ptr cs:[di].TmpltChannelRunning,0
jne ChannelAlreadyRunning
mov cs:[di].TmpltChannelRunning,1
ChannelAlreadyRunning:
clc
ret
ProcEnd noret
ProcBegin@ StopTheChannel
; =========================
; Stop the Channel Running
cmp byte ptr cs:[di].TmpltChannelRunning,0
je ChannelAlreadyStopped
mov cs:[di].TmpltChannelRunning,0
ChannelAlreadyStopped:
clc
ret
ProcEnd noret
ProcBegin@ GetHardware
; ======================
clc
ret
ProcEnd noret
ProcBegin@ FreeHardware
; =======================
clc
ret
ProcEnd noret
If OpenSpecificChannel
ProcBegin@ FindFreeChannel
; ==========================
; Called from Open
; Must preserve DX,SI
; Channel out in DI or carry set if failure
mov si,[si].OpenNamePtr
mov al,[si+1]
CharToFoldedChar
cmp al,'A'
jb CantGetThatChannel
sub al,'A'
cmp al,NumberOfChannels
jae CantGetThatChannel
xor ah,ah
push dx
mov dx,size TmpltEnt
mul dx
pop dx
mov di,ax
add di,offset Channel0
cmp cs:[di].TmpltEntOpen,0
je FoundAFreeChannel
CantGetThatChannel:
stc
ret
FoundAFreeChannel:
clc
ret
ProcEnd noret
else
ProcBegin@ FindFreeChannel
; ==========================
mov cx,NumberOfChannels
mov di,offset Channel0
HuntAllChannelsLoop:
cmp cs:[di].TmpltEntOpen,0
je FoundAFreeChannel
add di,size TmpltEnt
loop HuntAllChannelsLoop
stc
ret
FoundAFreeChannel:
clc
ret
ProcEnd noret
endif
if PeripheralTypeDriver or TickRequired
ProcBegin@ MonitorInt,far
; =========================
if PeripheralTypeDriver
; Called on every tick
; Issues pack door hold and resumes
; In: Door state in SI
cmp si,DoorOpen
je TheDoorIsOpenSoCantDoAnything
cmp CsHeldFlag,2
je NeedToDoTheResume
ret
NeedToDoTheResume:
mov CsHeldFlag,0
jmp DoResume
TheDoorIsOpenSoCantDoAnything:
cmp CsHeldFlag,0
jne DontNeedToHold
mov CsHeldFlag,2
mov ah,DevHoldPowerFail
jmp DoHold
DontNeedToHold:
endif
ret
ProcEnd noret
endif
EndCodeSeg
stack segment stack para 'data'
stack ends
end TmpltLDD