mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
71 lines
2.4 KiB
Common Lisp
Vendored
Generated
71 lines
2.4 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for function dma-buffer-add-buckets
|
|
;; WARN: Return type mismatch pointer vs (inline-array dma-bucket).
|
|
(defun dma-buffer-add-buckets ((dma-buf dma-buffer) (bucket-count int))
|
|
"Initialize an array of dma-buckets in a DMA buffer."
|
|
(let ((v0-0 (-> dma-buf base)))
|
|
(let ((v1-0 (the-as object v0-0)))
|
|
(dotimes (a2-0 bucket-count)
|
|
(set! (-> (the-as dma-bucket v1-0) tag)
|
|
(new 'static 'dma-tag :id (dma-tag-id next) :addr (the-as int (&+ (the-as pointer v1-0) 16)))
|
|
)
|
|
(set! (-> (the-as dma-bucket v1-0) last) (the-as (pointer dma-tag) v1-0))
|
|
(set! v1-0 (&+ (the-as pointer v1-0) 16))
|
|
)
|
|
(set! (-> dma-buf base) (the-as pointer v1-0))
|
|
)
|
|
(the-as (inline-array dma-bucket) v0-0)
|
|
)
|
|
)
|
|
|
|
;; definition for function dma-buffer-patch-buckets
|
|
;; WARN: Return type mismatch object vs (inline-array dma-bucket).
|
|
(defun dma-buffer-patch-buckets ((arg0 (inline-array dma-bucket)) (arg1 int))
|
|
"Patch together DMA buckets after they have been filled."
|
|
(when (nonzero? arg0)
|
|
(dotimes (v1-1 arg1)
|
|
(cond
|
|
((= (the-as object arg0) (-> arg0 0 last))
|
|
(set! (-> arg0 0 tag) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
|
(set! (-> arg0 0 clear) (the-as uint 0))
|
|
0
|
|
)
|
|
(else
|
|
(set! (-> arg0 0 last 0 addr) (the-as int (-> arg0 1)))
|
|
(cond
|
|
((or *display-profile* *stats-profile-bars*)
|
|
(set! (-> (the-as dma-packet arg0) vif0) (new 'static 'vif-tag :cmd (vif-cmd mark) :imm v1-1))
|
|
(set! (-> (the-as dma-packet arg0) vif1) (new 'static 'vif-tag :irq #x1))
|
|
)
|
|
(else
|
|
(set! (-> arg0 0 clear) (the-as uint 0))
|
|
0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! arg0 (the-as (inline-array dma-bucket) (-> arg0 1)))
|
|
)
|
|
)
|
|
(the-as (inline-array dma-bucket) arg0)
|
|
)
|
|
|
|
;; definition for function dma-bucket-insert-tag
|
|
(defun dma-bucket-insert-tag ((buckets (inline-array dma-bucket))
|
|
(bucket bucket-id)
|
|
(start-tag pointer)
|
|
(end-tag-to-patch (pointer dma-tag))
|
|
)
|
|
"Add a dma chain to the bucket."
|
|
(let ((v1-1 (-> buckets bucket)))
|
|
(set! (-> (the-as dma-bucket (-> v1-1 last)) next) (the-as uint start-tag))
|
|
(set! (-> v1-1 last) end-tag-to-patch)
|
|
)
|
|
start-tag
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|