;;-*-Lisp-*-
(in-package goal)

;; definition of type dma-chcr
(deftype dma-chcr (uint32)
  ((dir uint8  :offset   0 :size   1)
   (mod uint8  :offset   2 :size   2)
   (asp uint8  :offset   4 :size   2)
   (tte uint8  :offset   6 :size   1)
   (tie uint8  :offset   7 :size   1)
   (str uint8  :offset   8 :size   1)
   (tag uint16 :offset  16 :size  16)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition for method 3 of type dma-chcr
(defmethod inspect dma-chcr ((obj dma-chcr))
  (format #t "[~8x] ~A~%" obj 'dma-chcr)
  (format #t "~Tdir: ~D~%" (-> obj dir))
  (format #t "~Tmod: ~D~%" (-> obj mod))
  (format #t "~Tasp: ~D~%" (-> obj asp))
  (format #t "~Ttte: ~D~%" (-> obj tte))
  (format #t "~Ttie: ~D~%" (-> obj tie))
  (format #t "~Tstr: ~D~%" (-> obj str))
  (format #t "~Ttag: #x~X~%" (-> obj tag))
  obj
  )

;; definition of type dma-bank
(deftype dma-bank (structure)
  ((chcr dma-chcr  :offset   0)
   (madr uint32    :offset  16)
   (qwc  uint32    :offset  32)
   )
  :method-count-assert 9
  :size-assert         #x24
  :flag-assert         #x900000024
  )

;; definition for method 3 of type dma-bank
(defmethod inspect dma-bank ((obj dma-bank))
  (format #t "[~8x] ~A~%" obj 'dma-bank)
  (format #t "~Tchcr: #x~X~%" (-> obj chcr))
  (format #t "~Tmadr: #x~X~%" (-> obj madr))
  (format #t "~Tqwc: #x~X~%" (-> obj qwc))
  obj
  )

;; definition of type dma-bank-source
(deftype dma-bank-source (dma-bank)
  ((tadr uint32  :offset  48)
   )
  :method-count-assert 9
  :size-assert         #x34
  :flag-assert         #x900000034
  )

;; definition for method 3 of type dma-bank-source
(defmethod inspect dma-bank-source ((obj dma-bank-source))
  (format #t "[~8x] ~A~%" obj 'dma-bank-source)
  (format #t "~Tchcr: #x~X~%" (-> obj chcr))
  (format #t "~Tmadr: #x~X~%" (-> obj madr))
  (format #t "~Tqwc: #x~X~%" (-> obj qwc))
  (format #t "~Ttadr: #x~X~%" (-> obj tadr))
  obj
  )

;; definition of type dma-bank-vif
(deftype dma-bank-vif (dma-bank-source)
  ((as0 uint32  :offset  64)
   (as1 uint32  :offset  80)
   )
  :method-count-assert 9
  :size-assert         #x54
  :flag-assert         #x900000054
  )

;; definition for method 3 of type dma-bank-vif
(defmethod inspect dma-bank-vif ((obj dma-bank-vif))
  (format #t "[~8x] ~A~%" obj 'dma-bank-vif)
  (format #t "~Tchcr: #x~X~%" (-> obj chcr))
  (format #t "~Tmadr: #x~X~%" (-> obj madr))
  (format #t "~Tqwc: #x~X~%" (-> obj qwc))
  (format #t "~Ttadr: #x~X~%" (-> obj tadr))
  (format #t "~Tas0: #x~X~%" (-> obj as0))
  (format #t "~Tas1: #x~X~%" (-> obj as1))
  obj
  )

;; definition of type dma-bank-spr
(deftype dma-bank-spr (dma-bank-source)
  ((sadr uint32  :offset 128)
   )
  :method-count-assert 9
  :size-assert         #x84
  :flag-assert         #x900000084
  )

;; definition for method 3 of type dma-bank-spr
(defmethod inspect dma-bank-spr ((obj dma-bank-spr))
  (format #t "[~8x] ~A~%" obj 'dma-bank-spr)
  (format #t "~Tchcr: #x~X~%" (-> obj chcr))
  (format #t "~Tmadr: #x~X~%" (-> obj madr))
  (format #t "~Tqwc: #x~X~%" (-> obj qwc))
  (format #t "~Ttadr: #x~X~%" (-> obj tadr))
  (format #t "~Tsadr: #x~X~%" (-> obj sadr))
  obj
  )

;; definition of type dma-ctrl
(deftype dma-ctrl (uint32)
  ((dmae uint8 :offset   0 :size   1)
   (rele uint8 :offset   1 :size   1)
   (mfd  uint8 :offset   2 :size   2)
   (sts  uint8 :offset   4 :size   2)
   (std  uint8 :offset   6 :size   2)
   (rcyc uint8 :offset   8 :size   3)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition of type dma-enable
(deftype dma-enable (uint32)
  ((cpnd uint8 :offset  16 :size   1)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition of type dma-sqwc
(deftype dma-sqwc (uint32)
  ((sqwc uint8 :offset   0 :size   8)
   (tqwc uint8 :offset  16 :size   8)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition of type dma-bank-control
(deftype dma-bank-control (structure)
  ((ctrl    dma-ctrl  :offset   0)
   (stat    uint32    :offset  16)
   (pcr     uint32    :offset  32)
   (sqwc    dma-sqwc  :offset  48)
   (rbsr    uint32    :offset  64)
   (rbor    uint32    :offset  80)
   (stadr   uint32    :offset  96)
   (enabler uint32    :offset 5408)
   (enablew uint32    :offset 5520)
   )
  :method-count-assert 9
  :size-assert         #x1594
  :flag-assert         #x900001594
  )

;; definition for method 3 of type dma-bank-control
(defmethod inspect dma-bank-control ((obj dma-bank-control))
  (format #t "[~8x] ~A~%" obj 'dma-bank-control)
  (format #t "~Tctrl: #x~X~%" (-> obj ctrl))
  (format #t "~Tstat: #x~X~%" (-> obj stat))
  (format #t "~Tpcr: #x~X~%" (-> obj pcr))
  (format #t "~Tsqwc: #x~X~%" (-> obj sqwc))
  (format #t "~Trbsr: #x~X~%" (-> obj rbsr))
  (format #t "~Trbor: #x~X~%" (-> obj rbor))
  (format #t "~Tstadr: #x~X~%" (-> obj stadr))
  (format #t "~Tenabler: ~D~%" (-> obj enabler))
  (format #t "~Tenablew: ~D~%" (-> obj enablew))
  obj
  )

;; definition of type vu-code-block
(deftype vu-code-block (basic)
  ((name         basic   :offset-assert   4)
   (code         uint32  :offset-assert   8)
   (size         int32   :offset-assert  12)
   (dest-address uint32  :offset-assert  16)
   )
  :method-count-assert 9
  :size-assert         #x14
  :flag-assert         #x900000014
  )

;; definition for method 3 of type vu-code-block
(defmethod inspect vu-code-block ((obj vu-code-block))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tcode: #x~X~%" (-> obj code))
  (format #t "~Tsize: ~D~%" (-> obj size))
  (format #t "~Tdest-address: ~D~%" (-> obj dest-address))
  obj
  )

;; definition of type vu-stat
(deftype vu-stat (uint64)
  ()
  :method-count-assert 9
  :size-assert         #x8
  :flag-assert         #x900000008
  )

;; definition of type dma-tag
(deftype dma-tag (uint64)
  ((qwc  uint16     :offset   0 :size  16)
   (pce  uint8      :offset  26 :size   2)
   (id   dma-tag-id :offset  28 :size   3)
   (irq  uint8      :offset  31 :size   1)
   (addr uint32     :offset  32 :size  31)
   (spr  uint8      :offset  63 :size   1)
   )
  :method-count-assert 9
  :size-assert         #x8
  :flag-assert         #x900000008
  )

;; definition for method 3 of type dma-tag
(defmethod inspect dma-tag ((obj dma-tag))
  (format #t "[~8x] ~A~%" obj 'dma-tag)
  (format #t "~Tqwc: ~D~%" (-> obj qwc))
  (format #t "~Tpce: ~D~%" (-> obj pce))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tirq: ~D~%" (-> obj irq))
  (format #t "~Taddr: #x~X~%" (-> obj addr))
  (format #t "~Tspr: ~D~%" (-> obj spr))
  obj
  )

;; definition of type dma-bucket
(deftype dma-bucket (structure)
  ((tag   dma-tag            :offset-assert   0)
   (last  (pointer dma-tag)  :offset-assert   8)
   (dummy uint32             :offset-assert  12)
   (next  uint32             :offset          4)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type dma-bucket
(defmethod inspect dma-bucket ((obj dma-bucket))
  (format #t "[~8x] ~A~%" obj 'dma-bucket)
  (format #t "~Ttag: ~D~%" (-> obj tag))
  (format #t "~Tlast: #x~X~%" (-> obj last))
  (format #t "~Tdummy: ~D~%" (-> obj dummy))
  (format #t "~Tnext: #x~X~%" (-> obj next))
  obj
  )

;; definition of type vif-mask
(deftype vif-mask (uint32)
  ((m0  uint8 :offset   0 :size   2)
   (m1  uint8 :offset   2 :size   2)
   (m2  uint8 :offset   4 :size   2)
   (m3  uint8 :offset   6 :size   2)
   (m4  uint8 :offset   8 :size   2)
   (m5  uint8 :offset  10 :size   2)
   (m6  uint8 :offset  12 :size   2)
   (m7  uint8 :offset  14 :size   2)
   (m8  uint8 :offset  16 :size   2)
   (m9  uint8 :offset  18 :size   2)
   (m10 uint8 :offset  20 :size   2)
   (m11 uint8 :offset  22 :size   2)
   (m12 uint8 :offset  24 :size   2)
   (m13 uint8 :offset  26 :size   2)
   (m14 uint8 :offset  28 :size   2)
   (m15 uint8 :offset  30 :size   2)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition of type vif-stcycl-imm
(deftype vif-stcycl-imm (uint16)
  ((cl uint8 :offset   0 :size   8)
   (wl uint8 :offset   8 :size   8)
   )
  :method-count-assert 9
  :size-assert         #x2
  :flag-assert         #x900000002
  )

;; definition of type vif-unpack-imm
(deftype vif-unpack-imm (uint16)
  ((addr uint16 :offset   0 :size  10)
   (usn  uint8  :offset  14 :size   1)
   (flg  uint8  :offset  15 :size   1)
   )
  :method-count-assert 9
  :size-assert         #x2
  :flag-assert         #x900000002
  )

;; definition of type vif-tag
(deftype vif-tag (uint32)
  ((imm uint16  :offset   0 :size  16)
   (num uint8   :offset  16 :size   8)
   (cmd vif-cmd :offset  24 :size   7)
   (irq uint8   :offset  31 :size   1)
   (msk uint8   :offset  28 :size   1)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition for method 3 of type vif-tag
(defmethod inspect vif-tag ((obj vif-tag))
  (format #t "[~8x] ~A~%" obj 'vif-tag)
  (format #t "~Timm: #x~X~%" (-> obj imm))
  (format #t "~Tnum: ~D~%" (-> obj num))
  (format #t "~Tcmd: #x~X~%" (-> obj cmd))
  (format #t "~Tmsk: ~D~%" (-> obj msk))
  (format #t "~Tirq: ~D~%" (-> obj irq))
  obj
  )

;; definition for function dma-sync-fast
;; ERROR: function was not converted to expressions. Cannot decompile.

;; definition for function dma-send-no-scratch
;; ERROR: function was not converted to expressions. Cannot decompile.

;; definition for function dma-sync-with-count
;; ERROR: function was not converted to expressions. Cannot decompile.

;; definition for function dma-count-until-done
;; ERROR: function was not converted to expressions. Cannot decompile.
