Package drivers.ser
Class InputBuffer
java.lang.Object
drivers.ser.InputBuffer
This is a buffer that is filled in from the serial port and then input to SMSQE.
This is a buffer, not a queue.
The head of the queue is that element which would be removed by a call to remove() or poll().
In a FIFO queue, all new elements are inserted at the tail of the queue.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
fetchLine
(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch) Fetch multiple bytes until a LF (0xA) is found.int
fetchMultipleBytes
(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch) Fetch multiple bytes.int
testOrGetByte
(com.fazecast.jSerialComm.SerialPort serPort, boolean get) return Tests to see whether there is a byte available.If yes, returns this byte (as +ve int) , but does not take it out of the buffer.
-
Constructor Details
-
InputBuffer
public InputBuffer(int psize)
-
-
Method Details
-
clearBuffer
public void clearBuffer() -
testOrGetByte
public int testOrGetByte(com.fazecast.jSerialComm.SerialPort serPort, boolean get) return Tests to see whether there is a byte available.If yes, returns this byte (as +ve int) , but does not take it out of the buffer.- Parameters:
serPort
- serial port for this bufferget
-- Returns:
- the byte as +ive int, or -SMSQE error codes (nc or eof) if there is no byte available.
-
fetchMultipleBytes
public int fetchMultipleBytes(com.fazecast.jSerialComm.SerialPort serPort, MC68000Cpu cpu, int totalToFetch) Fetch multiple bytes.- Parameters:
serPort
- serial port whence to get bytescpu
-totalToFetch
- total number of bytes (still) to fetch.- Returns:
- SMSQE error code.
-
fetchLine
Fetch multiple bytes until a LF (0xA) is found. If it is preceded by a LF, remove LF.- Parameters:
serPort
- serial port whence to get bytescpu
-totalToFetch
- total number of bytes (still) to fetch.- Returns:
- SMSQE error code.
-