dreamcast/example/serial_transfer.cpp
Zack Buhman 0deedb9858 serial_transfer: increase serial line speed to 312500 bps
Interestingly, this did not cause a perceptible improvement in the
overall data transfer rate.
2024-03-04 16:44:03 +08:00

30 lines
643 B
C++

#include <cstdint>
#include "sh7091/sh7091.hpp"
#include "sh7091/sh7091_bits.hpp"
#include "sh7091/serial.hpp"
#include "serial_load.hpp"
extern uint32_t __bss_link_start __asm("__bss_link_start");
extern uint32_t __bss_link_end __asm("__bss_link_end");
void main()
{
serial::init(4);
load_init();
while (1) {
using namespace scif;
while ((sh7091.SCIF.SCFSR2 & scfsr2::tdfe::bit_mask) == 0) {
// wait
}
while ((scfdr2::receive_data_bytes(sh7091.SCIF.SCFDR2)) > 0) {
uint8_t c = sh7091.SCIF.SCFRDR2;
load_recv(c);
}
sh7091.SCIF.SCFSR2 = sh7091.SCIF.SCFSR2 & (~scfsr2::rdf::bit_mask);
}
}