Jo Engine 2026.11.6
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35#ifndef __JO_SERIAL_H__
36# define __JO_SERIAL_H__
37
38// serial registers
39#define SERIAL_REG_SMR (*(volatile unsigned char*)(0xFFFFFE00)) // serial mode register
40#define SERIAL_REG_BRR (*(volatile unsigned char*)(0xFFFFFE01)) // bit rate register
41#define SERIAL_REG_SCR (*(volatile unsigned char*)(0xFFFFFE02)) // serial control register
42#define SERIAL_REG_TDR (*(volatile unsigned char*)(0xFFFFFE03)) // transmit data register
43#define SERIAL_REG_SSR (*(volatile unsigned char*)(0xFFFFFE04)) // serial status register
44#define SERIAL_REG_RDR (*(volatile unsigned char*)(0xFFFFFE05)) // receive data register
45
46// serial register bit fields
47#define SERIAL_BIT_TDRE (1<<7)
48#define SERIAL_BIT_RDRF (1<<6)
49
50#define SERIAL_BIT_TE (1<<5)
51#define SERIAL_BIT_RE (1<<4)
52
53#define ORER (1<<5)
54#define FER (1<<4)
55#define PER (1<<3)
56
57// prototype for serial error callbacks
58typedef void (*jo_serial_error_callback)(void);
59
62int jo_serial_send_byte(unsigned char data);
63int jo_serial_recv_byte(unsigned char* data);
64
65#endif /* !__JO_SERIAL_H__ */
66
67/*
68** END OF FILE
69*/
void * data
Definition entity.h:19
int jo_serial_recv_byte(unsigned char *data)
void jo_serial_register_error_callbacks(jo_serial_error_callback orer, jo_serial_error_callback fer, jo_serial_error_callback per)
int jo_serial_send_byte(unsigned char data)
void jo_serial_async_init(void)
void(*) jo_serial_error_callback(void)
Definition serial.h:58