macro.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2008 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  17. * MA 02111-1307 USA
  18. */
  19. #ifndef __MACRO_H__
  20. #define __MACRO_H__
  21. #ifdef __ASSEMBLY__
  22. .macro write32, addr, data
  23. mov.l \addr ,r1
  24. mov.l \data ,r0
  25. mov.l r0, @r1
  26. .endm
  27. .macro write16, addr, data
  28. mov.l \addr ,r1
  29. mov.w \data ,r0
  30. mov.w r0, @r1
  31. .endm
  32. .macro write8, addr, data
  33. mov.l \addr ,r1
  34. mov.l \data ,r0
  35. mov.b r0, @r1
  36. .endm
  37. .macro wait_timer, time
  38. mov.l \time ,r3
  39. 1:
  40. nop
  41. tst r3, r3
  42. bf/s 1b
  43. dt r3
  44. .endm
  45. #endif /* __ASSEMBLY__ */
  46. #endif /* __MACRO_H__ */