Jo Engine  9
Jo Sega Saturn Engine
time.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2017, 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 */
35 #ifndef __JO_TIME_H__
36 # define __JO_TIME_H__
37 
38 # define JO_TIME_CKS_32_MODE (1)
39 # define JO_TIME_M_CKS (3)
40 
41 typedef enum
42 {
44  RegisterHighFRC = 0xfffffe12,
46  RegisterLowFRC = 0xfffffe13,
48  RegisterTCR = 0xfffffe16,
50 
51 static __jo_force_inline void jo_time_poke_byte(jo_time_memory_address addr, unsigned char data)
52 {
53  (*(volatile unsigned char *)(addr)) = data;
54 }
56 {
57  return (*(volatile unsigned char *)(addr));
58 }
60 {
61  return (*(volatile unsigned int*)0x6000324);
62 }
64 {
66 }
67 static __jo_force_inline void jo_time_set_frc(unsigned char reg)
68 {
71 }
72 
76 unsigned int jo_get_ticks(void);
77 
78 #endif /* !__JO_TIME_H__ */
79 
80 /*
81 ** END OF FILE
82 */
static __jo_force_inline int jo_time_get_frc(void)
Definition: time.h:63
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: conf.h:154
static __jo_force_inline unsigned int jo_time_get_sys_clock_value(void)
Definition: time.h:59
TCR register.
Definition: time.h:48
unsigned int jo_get_ticks(void)
get ticks count
FRC L register.
Definition: time.h:46
static __jo_force_inline void jo_time_poke_byte(jo_time_memory_address addr, unsigned char data)
Definition: time.h:51
static __jo_force_inline void jo_time_set_frc(unsigned char reg)
Definition: time.h:67
jo_time_memory_address
Definition: time.h:41
static __jo_force_inline unsigned char jo_time_peek_byte(jo_time_memory_address addr)
Definition: time.h:55
FRC H register.
Definition: time.h:44