Class UART6
- java.lang.Object
-
- org.deepjava.runtime.mpc5200.driver.UART6
-
-
Field Summary
Fields Modifier and Type Field Description static byte
EVEN_PARITY
static int
FRAME_ERR
static int
IDLE_LINE_DET
static UARTInputStream
in
static int
LENGTH_NEG_ERR
static byte
NO_PARITY
static int
NOISE_ERR
static int
NULL_POINTER_ERR
static byte
ODD_PARITY
static int
OFFSET_NEG_ERR
static UARTOutputStream
out
static int
OVERRUN_ERR
static int
PARITY_ERR
-
Fields inherited from interface org.deepjava.runtime.mpc5200.Impc5200
BBCMCR, CANBTR0, CANBTR1, CANCTL0, CANCTL1, CANIDAC, CANIDAR0, CANIDAR1, CANIDAR2, CANIDAR3, CANIDAR4, CANIDAR5, CANIDAR6, CANIDAR7, CANIDMR0, CANIDMR1, CANIDMR2, CANIDMR3, CANIDMR4, CANIDMR5, CANIDMR6, CANIDMR7, CANRFLG, CANRIER, CANRXERR, CANRXFG, CANTAAK, CANTARQ, CANTBSEL, CANTFLG, CANTIER, CANTXDLR, CANTXDSR0, CANTXDSR1, CANTXDSR2, CANTXDSR3, CANTXDSR4, CANTXDSR5, CANTXDSR6, CANTXDSR7, CANTXERR, CANTXFG, CANTXIR0, CANTXIR1, CANTXIR2, CANTXIR3, CANTXTBPR, CDMCER, CDMPSC1MCLKCR, CDMPSC2MCLKCR, CDMPSC3MCLKCR, CDMPSC6MCLKCR, CS0CR, CS0START, CS0STOP, CS1CR, CS1START, CS1STOP, CS2CR, CS2START, CS2STOP, CS3CR, CS3START, CS3STOP, CS4CR, CS4START, CS4STOP, CS5CR, CS5START, CS5STOP, CS6CR, CS7CR, CSBCR, CSCR, CSSR, DPDR, excpCodeSize, GPSPCR, GPWDDR, GPWER, GPWIN, GPWOUT, HID0, HID1, HID2, ICTCPMIMR, ICTLBESR, ICTLCISAR, ICTLEER, ICTLIRQIELR, ICTLMIEAR, ICTLMIPR1, ICTLMIPR2, ICTLMISAR, ICTLPIEAR, ICTLPIMR, ICTLPISAR, ICTLPPR1, ICTLPPR2, ICTLPPR3, ICTLSER, IPBICR, L2U_GRA, L2U_MCR, MBAR, MemBaseAddr, MI_GRA, MSCAN1Base, MSCAN2Base, PSC1Base, PSC2Base, PSC3Base, PSC4Base, PSC5Base, PSC6Base, PSCCCR, PSCCR, PSCCSR, PSCCTLR, PSCCTUR, PSCMR1, PSCMR2, PSCRFCNTL, PSCRFNUM, PSCRxBuf, PSCSICR, PSCSR, PSCTFCNTL, PSCTFNUM, PSCTFSTAT, PSCTxBuf, PVR, SDRAMCR, SDRAMCR1, SDRAMCR2, SDRAMCS0, SDRAMCS1, SDRAMMR, SDRAMSCDR, SPR1008, SPR1009, SPR1011, SPR286, SPR287, SPR528, SPR536, SPR560, SPR568, SPR630, SRAM_BaseAddr, SRAM_Size, SRR1init, SVR, sysTabBaseAddr, XLBACR
-
Fields inherited from interface org.deepjava.runtime.ppc32.Ippc32
CR, CTR, DAR, DEC, DSISR, FPR0, FPR1, FPR10, FPR11, FPR12, FPR13, FPR14, FPR15, FPR16, FPR17, FPR18, FPR19, FPR2, FPR20, FPR21, FPR22, FPR23, FPR24, FPR25, FPR26, FPR27, FPR28, FPR29, FPR3, FPR30, FPR31, FPR4, FPR5, FPR6, FPR7, FPR8, FPR9, FPSCR, LR, MSR, R0, R1, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R2, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R3, R30, R31, R4, R5, R6, R7, R8, R9, SPR1, SPR18, SPR19, SPR22, SPR26, SPR268, SPR269, SPR27, SPR272, SPR273, SPR274, SPR275, SPR8, SPR9, SPRG0, SPRG1, SPRG2, SPRG3, SRR0, SRR1, TBLread, TBUread, XER
-
-
Constructor Summary
Constructors Constructor Description UART6()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
availToRead()
Returns the number of bytes available in the receive fifo.static int
availToWrite()
Returns the number of free bytes available in the transmit fifo.static int
read()
Reads one byte from the receive fifo.static int
read(byte[] buffer)
Reads the given number of bytes from the UART6.static int
read(byte[] buffer, int off, int count)
Reads the given number of bytes from the UART6.static void
start(int baudRate, short parity, short data)
Initialize and start the UART 6.static void
write(byte b)
Writes a given byte into the transmit buffer.static int
write(byte[] buffer)
Writes a given number of bytes into the transmit fifo.static int
write(byte[] buffer, int off, int count)
Writes a given number of bytes into the transmit fifo.
-
-
-
Field Detail
-
out
public static UARTOutputStream out
-
in
public static UARTInputStream in
-
NO_PARITY
public static final byte NO_PARITY
- See Also:
- Constant Field Values
-
ODD_PARITY
public static final byte ODD_PARITY
- See Also:
- Constant Field Values
-
EVEN_PARITY
public static final byte EVEN_PARITY
- See Also:
- Constant Field Values
-
IDLE_LINE_DET
public static final int IDLE_LINE_DET
- See Also:
- Constant Field Values
-
OVERRUN_ERR
public static final int OVERRUN_ERR
- See Also:
- Constant Field Values
-
NOISE_ERR
public static final int NOISE_ERR
- See Also:
- Constant Field Values
-
FRAME_ERR
public static final int FRAME_ERR
- See Also:
- Constant Field Values
-
PARITY_ERR
public static final int PARITY_ERR
- See Also:
- Constant Field Values
-
LENGTH_NEG_ERR
public static final int LENGTH_NEG_ERR
- See Also:
- Constant Field Values
-
OFFSET_NEG_ERR
public static final int OFFSET_NEG_ERR
- See Also:
- Constant Field Values
-
NULL_POINTER_ERR
public static final int NULL_POINTER_ERR
- See Also:
- Constant Field Values
-
-
Method Detail
-
start
public static void start(int baudRate, short parity, short data)
Initialize and start the UART 6.
This method has to be called before using the UART6! The number of stop bits can't be set. There is always one stop bit!
- Parameters:
baudRate
- The baud rate. Allowed Range: 64 to 500'000 bits/s.parity
- Parity bits configuration. Possible values:NO_PARITY
,ODD_PARITY
orEVEN_PARITY
.data
- Number of data bits. Allowed values are 5 to 8 bits.
-
write
public static void write(byte b) throws IOException
Writes a given byte into the transmit buffer. A call of this method is not blocking! That means the byte is lost if the buffer is already full!- Parameters:
b
- Byte to write.- Throws:
IOException
- if an error occurs while writing to this stream.
-
write
public static int write(byte[] buffer) throws IOException
Writes a given number of bytes into the transmit fifo. A call of this method is not blocking! There will only as many bytes written, which are free in the fifo.- Parameters:
buffer
- Array of bytes to send.- Returns:
- the number of bytes written.
- Throws:
IOException
- if an error occurs while writing to this stream.
-
write
public static int write(byte[] buffer, int off, int count) throws IOException
Writes a given number of bytes into the transmit fifo. A call of this method is not blocking! There will only as many bytes written, which are free in the fifo.- Parameters:
buffer
- Array of bytes to send.off
- Offset to the data which should be sent.count
- Number of bytes to send.- Returns:
- the number of bytes written.
- Throws:
IOException
- if an error occurs while writing to this stream.NullPointerException
- ifbuffer
is null.IndexOutOfBoundsException
- ifoff < 0
orcount < 0
, or ifoff + count
is bigger than the length ofbuffer
.
-
availToWrite
public static int availToWrite()
Returns the number of free bytes available in the transmit fifo. It is possible, to send the returned number of bytes in one nonblocking transfer.- Returns:
- the available free bytes in the transmit fifo.
-
availToRead
public static int availToRead()
Returns the number of bytes available in the receive fifo.- Returns:
- number of bytes in the receive fifo.
-
read
public static int read() throws IOException
Reads one byte from the receive fifo. A call of this method is not blocking!- Returns:
- byte read.
- Throws:
IOException
- if no byte available.
-
read
public static int read(byte[] buffer) throws IOException
Reads the given number of bytes from the UART6. A call of this method is not blocking!- Parameters:
buffer
- Byte array to write the received data.- Returns:
- the number of bytes read.
- Throws:
IOException
- if no data available.
-
read
public static int read(byte[] buffer, int off, int count) throws IOException
Reads the given number of bytes from the UART6. A call of this method is not blocking!- Parameters:
buffer
- Byte aray to write the received data.off
- Offset in the array to start writing the data.count
- Length (number of bytes) to read.- Returns:
- the number of bytes read.
- Throws:
IOException
- if an error occurs while reading from this stream.NullPointerException
- ifbuffer
is null.IndexOutOfBoundsException
- ifoff < 0
orcount < 0
, or ifoff + count
is bigger than the length ofbuffer
.
-
-