You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
2.1 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2010 by Spencer Oliver *
  3. * spen@spen-soft.co.uk *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  19. ***************************************************************************/
  20. .text
  21. .arm
  22. .arch armv5t
  23. .section .init
  24. /*
  25. r0 source address (in)
  26. r1 target address (in)
  27. r2 word count (in)
  28. r3 result (out)
  29. */
  30. write:
  31. bic r4, r1, #3 /* word address */
  32. mov r3, #0x40 /* write command */
  33. strh r3, [r4, #0]
  34. ldrh r3, [r0], #2 /* read data */
  35. strh r3, [r1], #2 /* write data */
  36. mov r3, #0x70 /* status command */
  37. strh r3, [r4, #0]
  38. busy:
  39. ldrb r3, [r4, #0] /* status */
  40. tst r3, #0x80
  41. beq busy
  42. mov r5, #0x50 /* clear status command */
  43. strh r5, [r4, #0]
  44. mov r5, #0xFF /* read array */
  45. strh r5, [r4, #0]
  46. tst r3, #0x12
  47. bne exit
  48. subs r2, r2, #1 /* decremment word count */
  49. bne write
  50. exit:
  51. bkpt #0
  52. .end