added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / arm / plat-s3c / include / plat / debug-macro.S
blob3634d4e3708b05c0970667ce8647697b05ffc688
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.
12 #include <plat/regs-serial.h>
14 /* The S3C2440 implementations are used by default as they are the
15  * most widely re-used */
17         .macro fifo_level_s3c2440 rd, rx
18                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
19                 and     \rd, \rd, #S3C2440_UFSTAT_TXMASK
20         .endm
22 #ifndef fifo_level
23 #define fifo_level fifo_level_s3c2440
24 #endif
26         .macro  fifo_full_s3c2440 rd, rx
27                 ldr     \rd, [ \rx, # S3C2410_UFSTAT ]
28                 tst     \rd, #S3C2440_UFSTAT_TXFULL
29         .endm
31 #ifndef fifo_full
32 #define fifo_full fifo_full_s3c2440
33 #endif
35         .macro  senduart,rd,rx
36                 strb    \rd, [\rx, # S3C2410_UTXH ]
37         .endm
39         .macro  busyuart, rd, rx
40                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
41                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
42                 beq     1001f                           @
43                 @ FIFO enabled...
44 1003:
45                 fifo_full \rd, \rx
46                 bne     1003b
47                 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
55 1002:           @ exit busyuart
56         .endm
58         .macro  waituart,rd,rx
59                 ldr     \rd, [ \rx, # S3C2410_UFCON ]
60                 tst     \rd, #S3C2410_UFCON_FIFOMODE    @ fifo enabled?
61                 beq     1001f                           @
62                 @ FIFO enabled...
63 1003:
64                 fifo_level \rd, \rx
65                 teq     \rd, #0
66                 bne     1003b
67                 b       1002f
68 1001:
69                 @ idle waiting for non fifo
70                 ldr     \rd, [ \rx, # S3C2410_UTRSTAT ]
71                 tst     \rd, #S3C2410_UTRSTAT_TXFE
72                 beq     1001b
74 1002:           @ exit busyuart
75         .endm