mirror of
https://github.com/open-goal/jak-project
synced 2026-07-01 12:19:08 -04:00
58 lines
1.6 KiB
Common Lisp
Vendored
58 lines
1.6 KiB
Common Lisp
Vendored
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for function dma-buffer-add-buckets
|
|
;; INFO: Return type mismatch pointer vs dma-bucket.
|
|
(defun dma-buffer-add-buckets ((dma-buf dma-buffer) (count int))
|
|
(let ((v0-0 (-> dma-buf base)))
|
|
(let ((current-bucket (the-as dma-bucket v0-0)))
|
|
(dotimes (i count)
|
|
(set!
|
|
(-> current-bucket tag)
|
|
(new 'static 'dma-tag
|
|
:id (dma-tag-id next)
|
|
:addr (the-as int (&+ (the-as pointer current-bucket) 16))
|
|
)
|
|
)
|
|
(set! (-> current-bucket last) (the-as (pointer dma-tag) current-bucket))
|
|
(set!
|
|
current-bucket
|
|
(the-as dma-bucket (&+ (the-as pointer current-bucket) 16))
|
|
)
|
|
)
|
|
(set! (-> dma-buf base) (the-as pointer current-bucket))
|
|
)
|
|
(the-as dma-bucket v0-0)
|
|
)
|
|
)
|
|
|
|
;; definition for function dma-buffer-patch-buckets
|
|
(defun dma-buffer-patch-buckets ((bucket dma-bucket) (count int))
|
|
(when (nonzero? bucket)
|
|
(dotimes (i count)
|
|
(set! (-> bucket last 0 addr) (the-as int (&+ (the-as pointer bucket) 16)))
|
|
(set! (-> bucket last) (the-as (pointer dma-tag) 0))
|
|
(set! bucket (the-as dma-bucket (&+ (the-as pointer bucket) 16)))
|
|
)
|
|
)
|
|
bucket
|
|
)
|
|
|
|
;; definition for function dma-bucket-insert-tag
|
|
(defun
|
|
dma-bucket-insert-tag
|
|
((base dma-bucket)
|
|
(idx bucket-id)
|
|
(tag-start pointer)
|
|
(tag-end (pointer dma-tag))
|
|
)
|
|
(let ((bucket (the-as dma-bucket (+ (the-as uint base) (* idx 16)))))
|
|
(set! (-> (the-as dma-bucket (-> bucket last)) next) (the-as uint tag-start))
|
|
(set! (-> bucket last) tag-end)
|
|
)
|
|
tag-start
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|