Jo Engine
2026.11.1
Jo Sega Saturn Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
jo_engine
jo
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
# ifdef JO_COMPILE_WITH_SERIAL_SUPPORT
39
40
// serial registers
41
#define SERIAL_REG_SMR (*(volatile unsigned char*)(0xFFFFFE00))
// serial mode register
42
#define SERIAL_REG_BRR (*(volatile unsigned char*)(0xFFFFFE01))
// bit rate register
43
#define SERIAL_REG_SCR (*(volatile unsigned char*)(0xFFFFFE02))
// serial control register
44
#define SERIAL_REG_TDR (*(volatile unsigned char*)(0xFFFFFE03))
// transmit data register
45
#define SERIAL_REG_SSR (*(volatile unsigned char*)(0xFFFFFE04))
// serial status register
46
#define SERIAL_REG_RDR (*(volatile unsigned char*)(0xFFFFFE05))
// receive data register
47
48
// serial register bit fields
49
#define SERIAL_BIT_TDRE (1<<7)
50
#define SERIAL_BIT_RDRF (1<<6)
51
52
#define SERIAL_BIT_TE (1<<5)
53
#define SERIAL_BIT_RE (1<<4)
54
55
#define ORER (1<<5)
56
#define FER (1<<4)
57
#define PER (1<<3)
58
59
// prototype for serial error callbacks
60
typedef
void (*jo_serial_error_callback)(void);
61
62
void
jo_serial_async_init(
void
);
63
void
jo_serial_register_error_callbacks(jo_serial_error_callback orer, jo_serial_error_callback fer, jo_serial_error_callback per);
64
int
jo_serial_send_byte(
unsigned
char
data);
65
int
jo_serial_recv_byte(
unsigned
char
* data);
66
67
#endif
/* !JO_COMPILE_WITH_SERIAL_SUPPORT */
68
69
#endif
/* !__JO_SERIAL_H__ */
70
71
/*
72
** END OF FILE
73
*/
Generated by
1.18.0