mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
Fix +1
macros to 1+
and update some timer types (#375)
* Correct `+1` macros to `1+` * update some `timer-h` types
This commit is contained in:
parent
0560136f08
commit
26accb8714
|
@ -2047,13 +2047,15 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
||||||
|
|
||||||
|
(defenum timer-clock-selection
|
||||||
|
:type uint8
|
||||||
|
(busclk 0)
|
||||||
|
(busclk/16 1)
|
||||||
|
(busclk/256 2)
|
||||||
|
(hblank 3)
|
||||||
|
)
|
||||||
(deftype timer-mode (uint32)
|
(deftype timer-mode (uint32)
|
||||||
(;; clock selection:
|
((clks timer-clock-selection :offset 0 :size 2)
|
||||||
;; 0: BUSCLK
|
|
||||||
;; 1: BUSCLK/16
|
|
||||||
;; 2: BUSCLK/256
|
|
||||||
;; 3: hblank
|
|
||||||
(clks uint8 :offset 0 :size 2)
|
|
||||||
(gate uint8 :offset 2 :size 1) ;; gate function enable
|
(gate uint8 :offset 2 :size 1) ;; gate function enable
|
||||||
(gats uint8 :offset 3 :size 1) ;; gate selection: 0 = hblank, 1 = vblank
|
(gats uint8 :offset 3 :size 1) ;; gate selection: 0 = hblank, 1 = vblank
|
||||||
;; gate mode:
|
;; gate mode:
|
||||||
|
@ -2106,7 +2108,7 @@
|
||||||
(define-extern timer-init (function timer-bank timer-mode int))
|
(define-extern timer-init (function timer-bank timer-mode int))
|
||||||
|
|
||||||
(deftype profile-frame (structure)
|
(deftype profile-frame (structure)
|
||||||
((name basic :offset-assert 0)
|
((name symbol :offset-assert 0)
|
||||||
(time-stamp uint32 :offset-assert 4)
|
(time-stamp uint32 :offset-assert 4)
|
||||||
(color rgba :offset-assert 8)
|
(color rgba :offset-assert 8)
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,15 +12,17 @@
|
||||||
(defconstant TIMER2_BANK #x10001000) ;; does NOT have HOLD register!
|
(defconstant TIMER2_BANK #x10001000) ;; does NOT have HOLD register!
|
||||||
(defconstant TIMER3_BANK #x10001800) ;; does NOT have HOLD register!
|
(defconstant TIMER3_BANK #x10001800) ;; does NOT have HOLD register!
|
||||||
|
|
||||||
|
(defenum timer-clock-selection
|
||||||
|
:type uint8
|
||||||
|
(busclk 0)
|
||||||
|
(busclk/16 1)
|
||||||
|
(busclk/256 2)
|
||||||
|
(hblank 3)
|
||||||
|
)
|
||||||
;; this matches the Tn_MODE register structure of the ps2 EE timers.
|
;; this matches the Tn_MODE register structure of the ps2 EE timers.
|
||||||
;; Only the lower 32 bits of these registers are usable, and the upper 16 hardwired to zero
|
;; Only the lower 32 bits of these registers are usable, and the upper 16 hardwired to zero
|
||||||
(deftype timer-mode (uint32)
|
(deftype timer-mode (uint32)
|
||||||
(;; clock selection:
|
((clks timer-clock-selection :offset 0 :size 2)
|
||||||
;; 0: BUSCLK
|
|
||||||
;; 1: BUSCLK/16
|
|
||||||
;; 2: BUSCLK/256
|
|
||||||
;; 3: hblank
|
|
||||||
(clks uint8 :offset 0 :size 2)
|
|
||||||
(gate uint8 :offset 2 :size 1) ;; gate function enable
|
(gate uint8 :offset 2 :size 1) ;; gate function enable
|
||||||
(gats uint8 :offset 3 :size 1) ;; gate selection: 0 = hblank, 1 = vblank
|
(gats uint8 :offset 3 :size 1) ;; gate selection: 0 = hblank, 1 = vblank
|
||||||
;; gate mode:
|
;; gate mode:
|
||||||
|
@ -83,14 +85,14 @@
|
||||||
(set! (-> timer count) 0)
|
(set! (-> timer count) 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; segfaults OpenGOAL as it does not support ps2 EE timers
|
;; needs PS2 TIMER porting
|
||||||
(#unless PC_PORT
|
(#unless PC_PORT
|
||||||
(timer-init (the-as timer-bank TIMER1_BANK) (the-as timer-mode #x82))
|
(timer-init (the-as timer-bank TIMER1_BANK) (new 'static 'timer-mode :clks (timer-clock-selection busclk/16) :cue 1))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(deftype profile-frame (structure)
|
(deftype profile-frame (structure)
|
||||||
((name basic :offset-assert 0)
|
((name symbol :offset-assert 0)
|
||||||
(time-stamp uint32 :offset-assert 4)
|
(time-stamp uint32 :offset-assert 4)
|
||||||
(color rgba :offset-assert 8)
|
(color rgba :offset-assert 8)
|
||||||
)
|
)
|
||||||
|
|
|
@ -279,7 +279,7 @@
|
||||||
`(let (( ,(first var) 0))
|
`(let (( ,(first var) 0))
|
||||||
(while (< ,(first var) ,(second var))
|
(while (< ,(first var) ,(second var))
|
||||||
,@body
|
,@body
|
||||||
(+1! ,(first var))
|
(1+! ,(first var))
|
||||||
)
|
)
|
||||||
,@(cddr var)
|
,@(cddr var)
|
||||||
)
|
)
|
||||||
|
@ -371,7 +371,7 @@
|
||||||
;; Math Macros
|
;; Math Macros
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defmacro +1 (var)
|
(defmacro 1+ (var)
|
||||||
`(+ ,var 1)
|
`(+ ,var 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@
|
||||||
`(set! ,place (+ ,place ,amount))
|
`(set! ,place (+ ,place ,amount))
|
||||||
)
|
)
|
||||||
|
|
||||||
(defmacro +1! (place)
|
(defmacro 1+! (place)
|
||||||
`(set! ,place (+ 1 ,place))
|
`(set! ,place (+ 1 ,place))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
;; definition of type profile-frame
|
;; definition of type profile-frame
|
||||||
(deftype profile-frame (structure)
|
(deftype profile-frame (structure)
|
||||||
((name basic :offset-assert 0)
|
((name symbol :offset-assert 0)
|
||||||
(time-stamp uint32 :offset-assert 4)
|
(time-stamp uint32 :offset-assert 4)
|
||||||
(color rgba :offset-assert 8)
|
(color rgba :offset-assert 8)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue