tbidspram.S 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * tbidspram.S
  3. *
  4. * Copyright (C) 2009, 2012 Imagination Technologies.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it under
  7. * the terms of the GNU General Public License version 2 as published by the
  8. * Free Software Foundation.
  9. *
  10. * Explicit state save and restore routines forming part of the thread binary
  11. * interface for META processors
  12. */
  13. .file "tbidspram.S"
  14. /* These aren't generally useful to a user so for now, they arent publically available */
  15. #define _TBIECH_DSPRAM_DUA_S 8
  16. #define _TBIECH_DSPRAM_DUA_BITS 0x7f00
  17. #define _TBIECH_DSPRAM_DUB_S 0
  18. #define _TBIECH_DSPRAM_DUB_BITS 0x007f
  19. /*
  20. * void *__TBIDspramSaveA( short DspramSizes, void *pExt )
  21. */
  22. .text
  23. .balign 4
  24. .global ___TBIDspramSaveA
  25. .type ___TBIDspramSaveA,function
  26. ___TBIDspramSaveA:
  27. SETL [A0StP++], D0.5, D1.5
  28. MOV A0.3, D0Ar2
  29. /* D1Ar1 - Dspram Sizes
  30. * A0.4 - Pointer to buffer
  31. */
  32. /* Save the specified amount of dspram DUA */
  33. DL MOV D0AR.0, #0
  34. LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S
  35. AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S)
  36. SUB TXRPT, D1Ar1, #1
  37. $L1:
  38. DL MOV D0Re0, [D0AR.0++]
  39. DL MOV D0Ar6, [D0AR.0++]
  40. DL MOV D0Ar4, [D0AR.0++]
  41. DL MOV D0.5, [D0AR.0++]
  42. MSETL [A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5
  43. BR $L1
  44. GETL D0.5, D1.5, [--A0StP]
  45. MOV PC, D1RtP
  46. .size ___TBIDspramSaveA,.-___TBIDspramSaveA
  47. /*
  48. * void *__TBIDspramSaveB( short DspramSizes, void *pExt )
  49. */
  50. .balign 4
  51. .global ___TBIDspramSaveB
  52. .type ___TBIDspramSaveB,function
  53. ___TBIDspramSaveB:
  54. SETL [A0StP++], D0.5, D1.5
  55. MOV A0.3, D0Ar2
  56. /* D1Ar1 - Dspram Sizes
  57. * A0.3 - Pointer to buffer
  58. */
  59. /* Save the specified amount of dspram DUA */
  60. DL MOV D0BR.0, #0
  61. LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S
  62. AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S)
  63. SUB TXRPT, D1Ar1, #1
  64. $L2:
  65. DL MOV D0Re0, [D0BR.0++]
  66. DL MOV D0Ar6, [D0BR.0++]
  67. DL MOV D0Ar4, [D0BR.0++]
  68. DL MOV D0.5, [D0BR.0++]
  69. MSETL [A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5
  70. BR $L2
  71. GETL D0.5, D1.5, [--A0StP]
  72. MOV PC, D1RtP
  73. .size ___TBIDspramSaveB,.-___TBIDspramSaveB
  74. /*
  75. * void *__TBIDspramRestoreA( short DspramSizes, void *pExt )
  76. */
  77. .balign 4
  78. .global ___TBIDspramRestoreA
  79. .type ___TBIDspramRestoreA,function
  80. ___TBIDspramRestoreA:
  81. SETL [A0StP++], D0.5, D1.5
  82. MOV A0.3, D0Ar2
  83. /* D1Ar1 - Dspram Sizes
  84. * A0.3 - Pointer to buffer
  85. */
  86. /* Restore the specified amount of dspram DUA */
  87. DL MOV D0AW.0, #0
  88. LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S
  89. AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S)
  90. SUB TXRPT, D1Ar1, #1
  91. $L3:
  92. MGETL D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++]
  93. DL MOV [D0AW.0++], D0Re0
  94. DL MOV [D0AW.0++], D0Ar6
  95. DL MOV [D0AW.0++], D0Ar4
  96. DL MOV [D0AW.0++], D0.5
  97. BR $L3
  98. GETL D0.5, D1.5, [--A0StP]
  99. MOV PC, D1RtP
  100. .size ___TBIDspramRestoreA,.-___TBIDspramRestoreA
  101. /*
  102. * void *__TBIDspramRestoreB( short DspramSizes, void *pExt )
  103. */
  104. .balign 4
  105. .global ___TBIDspramRestoreB
  106. .type ___TBIDspramRestoreB,function
  107. ___TBIDspramRestoreB:
  108. SETL [A0StP++], D0.5, D1.5
  109. MOV A0.3, D0Ar2
  110. /* D1Ar1 - Dspram Sizes
  111. * A0.3 - Pointer to buffer
  112. */
  113. /* Restore the specified amount of dspram DUA */
  114. DL MOV D0BW.0, #0
  115. LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S
  116. AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S)
  117. SUB TXRPT, D1Ar1, #1
  118. $L4:
  119. MGETL D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++]
  120. DL MOV [D0BW.0++], D0Re0
  121. DL MOV [D0BW.0++], D0Ar6
  122. DL MOV [D0BW.0++], D0Ar4
  123. DL MOV [D0BW.0++], D0.5
  124. BR $L4
  125. GETL D0.5, D1.5, [--A0StP]
  126. MOV PC, D1RtP
  127. .size ___TBIDspramRestoreB,.-___TBIDspramRestoreB
  128. /*
  129. * End of tbidspram.S
  130. */