debug-macro.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* linux/include/asm-arm/plat-s3c/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 <asm/plat-s3c/regs-serial.h>
  12. /* The S3C2440 implementations are used by default as they are the
  13. * most widely re-used */
  14. .macro fifo_level_s3c2440 rd, rx
  15. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  16. and \rd, \rd, #S3C2440_UFSTAT_TXMASK
  17. .endm
  18. #ifndef fifo_level
  19. #define fifo_level fifo_level_s3c2410
  20. #endif
  21. .macro fifo_full_s3c2440 rd, rx
  22. ldr \rd, [ \rx, # S3C2410_UFSTAT ]
  23. tst \rd, #S3C2440_UFSTAT_TXFULL
  24. .endm
  25. #ifndef fifo_full
  26. #define fifo_full fifo_full_s3c2440
  27. #endif
  28. .macro senduart,rd,rx
  29. strb \rd, [\rx, # S3C2410_UTXH ]
  30. .endm
  31. .macro busyuart, rd, rx
  32. ldr \rd, [ \rx, # S3C2410_UFCON ]
  33. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  34. beq 1001f @
  35. @ FIFO enabled...
  36. 1003:
  37. fifo_full \rd, \rx
  38. bne 1003b
  39. b 1002f
  40. 1001:
  41. @ busy waiting for non fifo
  42. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  43. tst \rd, #S3C2410_UTRSTAT_TXFE
  44. beq 1001b
  45. 1002: @ exit busyuart
  46. .endm
  47. .macro waituart,rd,rx
  48. ldr \rd, [ \rx, # S3C2410_UFCON ]
  49. tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
  50. beq 1001f @
  51. @ FIFO enabled...
  52. 1003:
  53. fifo_level \rd, \rx
  54. teq \rd, #0
  55. bne 1003b
  56. b 1002f
  57. 1001:
  58. @ idle waiting for non fifo
  59. ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
  60. tst \rd, #S3C2410_UTRSTAT_TXFE
  61. beq 1001b
  62. 1002: @ exit busyuart
  63. .endm