debug-macro.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* arch/arm/plat-samsung/include/plat/debug-macro.S
  2. *
  3. * Copyright 2005, 2007 Simtec Electronics
  4. * http://armlinux.simtec.co.uk/
  5. * Ben Dooks <ben@simtec.co.uk>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <plat/regs-serial.h>
  12. /* The S5PV210/S5PC110 implementations are as belows. */
  13. .macro fifo_level_s5pv210 rd, rx
  14. ldr \rd, [\rx, # S3C2410_UFSTAT]
  15. and \rd, \rd, #S5PV210_UFSTAT_TXMASK
  16. .endm
  17. .macro fifo_full_s5pv210 rd, rx
  18. ldr \rd, [\rx, # S3C2410_UFSTAT]
  19. tst \rd, #S5PV210_UFSTAT_TXFULL
  20. .endm
  21. /* The S3C2440 implementations are used by default as they are the
  22. * most widely re-used */
  23. .macro fifo_level_s3c2440 rd, rx
  24. ldr \rd, [\rx, # S3C2410_UFSTAT]
  25. and \rd, \rd, #S3C2440_UFSTAT_TXMASK
  26. .endm
  27. #ifndef fifo_level
  28. #define fifo_level fifo_level_s3c2440
  29. #endif
  30. .macro fifo_full_s3c2440 rd, rx
  31. ldr \rd, [\rx, # S3C2410_UFSTAT]
  32. tst \rd, #S3C2440_UFSTAT_TXFULL
  33. .endm
  34. #ifndef fifo_full
  35. #define fifo_full fifo_full_s3c2440
  36. #endif
  37. .macro senduart,rd,rx
  38. strb \rd, [\rx, # S3C2410_UTXH]
  39. .endm
  40. .macro busyuart, rd, rx
  41. ldr \rd, [\rx, # S3C2410_UFCON]
  42. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  43. beq 1001f @
  44. @ FIFO enabled...
  45. 1003:
  46. fifo_full \rd, \rx
  47. bne 1003b
  48. b 1002f
  49. 1001:
  50. @ busy waiting for non fifo
  51. ldr \rd, [\rx, # S3C2410_UTRSTAT]
  52. tst \rd, #S3C2410_UTRSTAT_TXFE
  53. beq 1001b
  54. 1002: @ exit busyuart
  55. .endm
  56. .macro waituart,rd,rx
  57. ldr \rd, [\rx, # S3C2410_UFCON]
  58. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  59. beq 1001f @
  60. @ FIFO enabled...
  61. 1003:
  62. fifo_level \rd, \rx
  63. teq \rd, #0
  64. bne 1003b
  65. b 1002f
  66. 1001:
  67. @ idle waiting for non fifo
  68. ldr \rd, [\rx, # S3C2410_UTRSTAT]
  69. tst \rd, #S3C2410_UTRSTAT_TXFE
  70. beq 1001b
  71. 1002: @ exit busyuart
  72. .endm