KallistiOS
##version##
|
Serial port functionality. More...
Go to the source code of this file.
Functions | |
void | scif_set_parameters (int baud, int fifo) |
Set serial parameters. More... | |
int | scif_set_irq_usage (int on) |
Enable or disable SCIF IRQ usage. More... | |
int | scif_detected () |
Is the SCIF port detected? Of course it is! More... | |
int | scif_init () |
Initialize the SCIF port. More... | |
int | scif_shutdown () |
Shutdown the SCIF port. More... | |
int | scif_read () |
Read a single character from the SCIF port. More... | |
int | scif_write (int c) |
Write a single character to the SCIF port. More... | |
int | scif_flush () |
Flush any FIFO'd bytes out of the buffer. More... | |
int | scif_write_buffer (const uint8 *data, int len, int xlat) |
Write a whole buffer of data to the SCIF port. More... | |
int | scif_read_buffer (uint8 *data, int len) |
Read a buffer of data from the SCIF port. More... | |
int | scif_spi_init (void) |
Initialize the SCIF port for use of an SPI peripheral. More... | |
int | scif_spi_shutdown (void) |
Shut down SPI card support over the SCIF port. More... | |
void | scif_spi_set_cs (int v) |
Set or clear the SPI /CS line. More... | |
uint8 | scif_spi_rw_byte (uint8 b) |
Read and write one byte from the SPI port. More... | |
uint8 | scif_spi_slow_rw_byte (uint8 b) |
Read and write one byte from the SPI device, slowly. More... | |
void | scif_spi_write_byte (uint8 b) |
Write a byte to the SPI device. More... | |
uint8 | scif_spi_read_byte (void) |
Read a byte from the SPI device. More... | |
Variables | |
dbgio_handler_t | dbgio_scif |
SCIF debug I/O handler. Do not modify! More... | |
Serial port functionality.
This file deals with raw access to the serial port on the Dreamcast.
int scif_detected | ( | ) |
Is the SCIF port detected? Of course it is!
int scif_flush | ( | ) |
Flush any FIFO'd bytes out of the buffer.
This function sends any bytes that have been queued up for transmission but have not left yet in FIFO mode.
0 | On success. |
-1 | If the SCIF port is disabled (errno set to EIO). |
int scif_init | ( | ) |
Initialize the SCIF port.
This function initializes the SCIF port to a sane state. If dcload-serial is in use, this is effectively a no-op.
0 | On success (no error conditions defined). |
int scif_read | ( | ) |
Read a single character from the SCIF port.
int scif_read_buffer | ( | uint8 * | data, |
int | len | ||
) |
Read a buffer of data from the SCIF port.
This function reads a whole buffer of data from the SCIF port, blocking until it has been filled.
data | The buffer to read into. |
len | The number of bytes to read. |
int scif_set_irq_usage | ( | int | on | ) |
Enable or disable SCIF IRQ usage.
on | 1 to enable IRQ usage, 0 for polled I/O. |
0 | On success (no error conditions defined). |
void scif_set_parameters | ( | int | baud, |
int | fifo | ||
) |
Set serial parameters.
baud | The bitrate to set. |
fifo | 1 to enable FIFO mode. |
int scif_shutdown | ( | ) |
Shutdown the SCIF port.
This function disables SCIF IRQs, if they were enabled and cleans up.
0 | On success (no error conditions defined). |
int scif_spi_init | ( | void | ) |
Initialize the SCIF port for use of an SPI peripheral.
This function initializes the SCIF port for accessing the an SPI peripheral that has been connected to the serial port. The design of the SCIF->SPI wiring follows the wiring of the SD card adapter which is (at least now) somewhat commonly available online and is the same as the one designed by jj1odm.
0 | On success. |
-1 | On error (if dcload-serial is detected). |
uint8 scif_spi_read_byte | ( | void | ) |
Read a byte from the SPI device.
This function reads a byte from the SPI device, one bit at a time. The timing follows that of the scif_spi_rw_byte() function.
Read and write one byte from the SPI port.
This function writes one byte and reads one back from the SPI device simultaneously.
b | The byte to write out to the port. |
void scif_spi_set_cs | ( | int | v | ) |
Set or clear the SPI /CS line.
This function sets or clears the /CS line (connected to the RTS line of the SCIF port).
v | Non-zero to output 1 on the line, zero to output 0. |
int scif_spi_shutdown | ( | void | ) |
Shut down SPI card support over the SCIF port.
This function shuts down SPI support on the SCIF port. If you want to get regular usage of the port back, you must call scif_init() after shutting down SPI support.
0 | On success (no errors defined). |
Read and write one byte from the SPI device, slowly.
This function does the same thing as the scif_sd_rw_byte() function, but with a 1.5usec delay between asserting the CLK line and reading back the bit and a 1.5usec delay between clearing the CLK line and writing the next bit out.
This ends up working out to a clock of about 333khz, or so.
b | The byte to write out to the port. |
void scif_spi_write_byte | ( | uint8 | b | ) |
Write a byte to the SPI device.
This function writes out the specified byte to the SPI device, one bit at a time. The timing follows that of the scif_spi_rw_byte() function.
b | The byte to write out to the port. |
int scif_write | ( | int | c | ) |
Write a single character to the SCIF port.
c | The character to write (only the low 8-bits are written). |
1 | On success. |
-1 | If the SCIF port is disabled (errno set to EIO). |
int scif_write_buffer | ( | const uint8 * | data, |
int | len, | ||
int | xlat | ||
) |
Write a whole buffer of data to the SCIF port.
This function writes a whole buffer of data to the SCIF port, optionally making all newlines into carriage return + newline pairs.
data | The buffer to write. |
len | The length of the buffer, in bytes. |
xlat | If set to 1, all newlines will be written as CRLF. |
dbgio_handler_t dbgio_scif |
SCIF debug I/O handler. Do not modify!