Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
common
hardware
counters.h
Go to the documentation of this file.
1
/*
2
3
MIT License
4
5
Copyright (c) 2023 PCSX-Redux authors
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in all
15
copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
24
25
*/
26
27
#pragma once
28
29
#include <stdint.h>
30
31
struct
Counter
{
32
uint16_t
value
;
33
uint16_t
padding1
;
34
uint16_t
mode
;
35
uint16_t
padding2
;
36
uint16_t
target
;
37
uint8_t
padding
[6];
38
};
39
40
#define COUNTERS ((volatile struct Counter *)0xbf801100)
41
42
enum
{
43
TM_SYNC_EN
= 0x0001,
44
TM_RESET_TARGET
= 0x0008,
45
TM_IRQ_TARGET
= 0x0010,
46
TM_IRQ_OVERFLOW
= 0x0020,
47
TM_IRQ_REPEAT
= 0x0040,
48
TM_IRQ_TOGGLE
= 0x0080,
49
TM_CLK_EXTERNAL
= 0x0100,
50
TM_CLK_DIV8
= 0x0200,
51
TM_IRQ_REQUEST
= 0x0400,
52
TM_HIT_TARGET
= 0x0800,
53
TM_HIT_OVERFLOW
= 0x1000,
54
};
55
56
#define TM_SYNC_MODE(n) (((n) & 3) << 1)
TM_HIT_TARGET
@ TM_HIT_TARGET
Definition
counters.h:52
TM_SYNC_EN
@ TM_SYNC_EN
Definition
counters.h:43
TM_IRQ_TOGGLE
@ TM_IRQ_TOGGLE
Definition
counters.h:48
TM_CLK_DIV8
@ TM_CLK_DIV8
Definition
counters.h:50
TM_HIT_OVERFLOW
@ TM_HIT_OVERFLOW
Definition
counters.h:53
TM_IRQ_OVERFLOW
@ TM_IRQ_OVERFLOW
Definition
counters.h:46
TM_IRQ_REQUEST
@ TM_IRQ_REQUEST
Definition
counters.h:51
TM_IRQ_TARGET
@ TM_IRQ_TARGET
Definition
counters.h:45
TM_RESET_TARGET
@ TM_RESET_TARGET
Definition
counters.h:44
TM_CLK_EXTERNAL
@ TM_CLK_EXTERNAL
Definition
counters.h:49
TM_IRQ_REPEAT
@ TM_IRQ_REPEAT
Definition
counters.h:47
Counter
Definition
counters.h:31
Counter::padding
uint8_t padding[6]
Definition
counters.h:37
Counter::mode
uint16_t mode
Definition
counters.h:34
Counter::padding2
uint16_t padding2
Definition
counters.h:35
Counter::target
uint16_t target
Definition
counters.h:36
Counter::padding1
uint16_t padding1
Definition
counters.h:33
Counter::value
uint16_t value
Definition
counters.h:32
Generated by
1.9.8