|
| ULONG | openserial (UBYTE *name, ULONG unit, ULONG baud, ULONG flag) |
| | OpenSerial(device$,unit#,baud,io_serflags) - open a unit of a serial device (_openserial).
|
| void | writebyte (UWORD unit, UBYTE byte) |
| | WriteSerial unit#,byte - write one byte (_writebyte).
|
| void | writestring2 (UWORD unit, ULONG data) |
| | WriteSerialString unit#,address - write a null terminated string (_writestring2).
|
| void | writestring3 (UWORD unit, ULONG data, UWORD flags, const ULONG *lens) |
| | WriteSerialString unit#,string,flags - write a string (_writestring3).
|
| ULONG | readobyte (UWORD unit) |
| | ReadSerial(unit#) - read one byte without waiting (_readobyte).
|
| ULONG | readbyte (UWORD unit, UWORD flags) |
| | ReadSerial(unit#,flags) - read one byte (_readbyte).
|
| ULONG | readstring (UWORD unit, const UBYTE *sbuf) |
| | ReadSerialString(unit#) - read everything waiting as a string (_readstring).
|
| void | closeserial (UWORD unit) |
| | CloseSerial unit# - close a unit (_closeserial).
|
| void | serialbuffer (UWORD unit, ULONG len) |
| | SetSerialBuffer unit#,bufferlength - set io_RBufLen (_serialbuffer).
|
| void | seriallens (UWORD unit, UBYTE rlen, UBYTE wlen, UBYTE stop) |
| | SetSerialLens unit#,readlen,writelen,stopbits - set the bit lengths and stop bits (_seriallens).
|
| void | serialsetparams (UWORD unit) |
| | SetSerialParams unit# - SDCMD_SETPARAMS with the request's current values (_serialsetparams).
|
| void | checkevent (void) |
| void | readmem (UWORD unit, ULONG addr, ULONG len) |
| | ReadSerialMem unit#,Address,Length - read into memory (_readmem).
|
| void | writemem (UWORD unit, ULONG addr, ULONG len) |
| | WriteSerialMem unit#,Address,Length - write memory (_writemem).
|
| void | closeallio (void) |
| | Library finit (_closeallio): AbortIO, WaitIO, CloseDevice and FreeSignal for every unit still open (both halves' signals).
|
| static struct serio * | slot (UWORD unit, int shift, UWORD add) |
| static void | noser (void) |
| static void | freesig (struct serio *s) |
| static void | initport (struct serio *s) |
| static void | memio (UWORD unit, UWORD add, UWORD cmd, ULONG addr, ULONG len) |
| static struct serio * | paramslot (UWORD unit) |
| static void | setparams (struct serio *s) |
| static ULONG | checkevent_c (UWORD unit, const ULONG *sigs) |
| | SerialEvent(unit#) - which of the unit's signals came (_checkevent).
|
| | BLITZ_ALIAS (checkevent, checkevent_c) |
| void closeserial |
( |
UWORD | unit | ) |
|
CloseSerial unit# - close a unit (_closeserial).
AbortIO and WaitIO of both halves' requests, CloseDevice through the read half's request, both signals freed. Nothing happens for a unit that is not open.
Fixed (#252): the slot is unit*256 (the original computed unit*128: CloseSerial 1 closed the device through unit 0's write request and freed unit 1's read signal). Fixed (#258): the original called AbortIO without WaitIO for the read request and left the write request alone (a pending SendIO write stayed pending after the close).
- Parameters
-
| ULONG openserial |
( |
UBYTE * | name, |
|
|
ULONG | unit, |
|
|
ULONG | baud, |
|
|
ULONG | flag ) |
OpenSerial(device$,unit#,baud,io_serflags) - open a unit of a serial device (_openserial).
Sets up the read half (port, signal, IOExtSer), opens the device with the serflags, sets the baud rate and flags (SDCMD_SETPARAMS), copies the 128 bytes to the write half and gives that its own port and signal.
Fixed (#260): a unit that is open is left alone, the result is 0 (the original set up the read half again and, when OpenDevice failed with exclusive access, cleared it: the open device was never closed, also not at the end of the program). Fixed (#259): if the write half's AllocSignal failed, the original left the device open and the write half with its request pointer; the device is closed and both halves are cleared now.
- Parameters
-
| name | d0: the device name |
| unit | d1: the unit (the slot is unit*256, word arithmetic) |
| baud | d2: the baud rate |
| flag | d3: io_SerFlags |
- Returns
- d0: the address of the unit's read half, 0 on failure or if the unit is open
| ULONG readbyte |
( |
UWORD | unit, |
|
|
UWORD | flags ) |
ReadSerial(unit#,flags) - read one byte (_readbyte).
Without the wait flag SDCMD_QUERY first: -1 if nothing is waiting; then CMD_READ of one byte, DoIO.
With bit 0 or bit 1 of the flags the query is skipped and the read waits for a byte. Fixed (#255): the original tested bit 1 (value 2) only, the help names flag 1, which did not wait. DIFF: a3 is not changed (the original leaves it on its one byte buffer rb1 inside the library).
Errors: "Serial Device Not Open" (TRAP #0, #262; returns 0).
- Parameters
-
| unit | d0.w: the unit |
| flags | d1.w: 1 (the help) or 2 (the original's flag) = wait |
- Returns
- d0: the byte, -1 if nothing is waiting
| void readmem |
( |
UWORD | unit, |
|
|
ULONG | addr, |
|
|
ULONG | len ) |
ReadSerialMem unit#,Address,Length - read into memory (_readmem).
CMD_READ through the read half, DoIO. Fixed (#253): the original read through the WRITE request (+128), whose parameters SetSerialParams does not set (EOF mode had no effect).
Errors: "Serial Device Not Open" (TRAP #0, #262).
- Parameters
-
| unit | d0.w: the unit |
| addr | d1: the address |
| len | d2: the length in bytes |
| ULONG readstring |
( |
UWORD | unit, |
|
|
const UBYTE * | sbuf ) |
ReadSerialString(unit#) - read everything waiting as a string (_readstring).
SDCMD_QUERY, then CMD_READ of io_Actual bytes to a3 (the string buffer), which is advanced over them, at most as many as fit in front of the end of the buffer with the 0 behind them; the rest stays waiting. Fixed (#256): the original did not limit the number of bytes and wrote behind the buffer. No terminating 0 (not a bug: the compiler appends clr.b (a3)+ itself where it passes a string on, blitz2.s:8767 sbtolong, #257).
Errors: "Serial Device Not Open" (TRAP #0, #262; returns 0).
- Parameters
-
| unit | d0.w: the unit |
| sbuf | a0: strings1lib's init value, the string buffer (memlib globalloc: its block length, size + 8, at -4) |
- Returns
- d0: the number of bytes (string length), 0 if nothing is waiting
| void seriallens |
( |
UWORD | unit, |
|
|
UBYTE | rlen, |
|
|
UBYTE | wlen, |
|
|
UBYTE | stop ) |
SetSerialLens unit#,readlen,writelen,stopbits - set the bit lengths and stop bits (_seriallens).
SDCMD_SETPARAMS, DoIO. Fixed (#252): the slot is unit*256 (the original computed unit*128).
Errors: "Serial Device Not Open" (TRAP #0, #262).
- Parameters
-
| unit | d0.w: the unit |
| rlen | d1.b: io_ReadLen |
| wlen | d2.b: io_WriteLen |
| stop | d3.b: io_StopBits |
| void writebyte |
( |
UWORD | unit, |
|
|
UBYTE | byte ) |
WriteSerial unit#,byte - write one byte (_writebyte).
CMD_WRITE of one byte through the write half, DoIO.
Errors: "Serial Device Not Open" (TRAP #0, also without the debugger; the C version returns if the trap does, #262).
- Parameters
-
| unit | d0.w: the unit |
| byte | d1.b: the byte |
| void writestring2 |
( |
UWORD | unit, |
|
|
ULONG | data ) |
WriteSerialString unit#,address - write a null terminated string (_writestring2).
MOVEQ #0,d2 then _writestring3 (the length popped there is not used with flags 0, so it is not read here): SendIO with length -1, not waited for. The two argument form takes a long (an address), as in the original.
Errors: "Serial Device Not Open" (TRAP #0, #262).
- Parameters
-
| unit | d0.w: the unit |
| data | d1: the address of the string |
| void writestring3 |
( |
UWORD | unit, |
|
|
ULONG | data, |
|
|
UWORD | flags, |
|
|
const ULONG * | lens ) |
WriteSerialString unit#,string,flags - write a string (_writestring3).
CMD_WRITE through the write half. Flags as in the help: bit 0 (1) = DoIO, else SendIO, not waited for; bit 1 (2) = TrueString, the length of the string, else -1 (null terminated).
Fixed (#254): the original selected TrueString and DoIO both with bit 1 and never tested bit 0.
Errors: "Serial Device Not Open" (TRAP #0, #262).
- Parameters
-
| unit | d0.w: the unit |
| data | d1: the string |
| flags | d2.w: the flags (1 = DoIO, 2 = TrueString) |
| lens | a2: the argument stack, -4(a2) = the string's length |