Linux Audio

Check our new training course

Loading...
v4.6
  1/*
  2 *  linux/arch/arm/kernel/debug.S
  3 *
  4 *  Copyright (C) 1994-1999 Russell King
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 as
  8 * published by the Free Software Foundation.
  9 *
 10 *  32-bit debugging code
 11 */
 12#include <linux/linkage.h>
 13#include <asm/assembler.h>
 14
 15		.text
 16
 17/*
 18 * Some debugging routines (useful if you've got MM problems and
 19 * printk isn't working).  For DEBUGGING ONLY!!!  Do not leave
 20 * references to these in a production kernel!
 21 */
 22
 23#if !defined(CONFIG_DEBUG_SEMIHOSTING)
 24#include CONFIG_DEBUG_LL_INCLUDE
 25#endif
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 26
 27#ifdef CONFIG_MMU
 28		.macro	addruart_current, rx, tmp1, tmp2
 29		addruart	\tmp1, \tmp2, \rx
 30		mrc		p15, 0, \rx, c1, c0
 31		tst		\rx, #1
 32		moveq		\rx, \tmp1
 33		movne		\rx, \tmp2
 34		.endm
 35
 36#else /* !CONFIG_MMU */
 37		.macro	addruart_current, rx, tmp1, tmp2
 38		addruart	\rx, \tmp1, \tmp2
 39		.endm
 40
 41#endif /* CONFIG_MMU */
 42
 43/*
 44 * Useful debugging routines
 45 */
 46ENTRY(printhex8)
 47		mov	r1, #8
 48		b	printhex
 49ENDPROC(printhex8)
 50
 51ENTRY(printhex4)
 52		mov	r1, #4
 53		b	printhex
 54ENDPROC(printhex4)
 55
 56ENTRY(printhex2)
 57		mov	r1, #2
 58printhex:	adr	r2, hexbuf
 59		add	r3, r2, r1
 60		mov	r1, #0
 61		strb	r1, [r3]
 621:		and	r1, r0, #15
 63		mov	r0, r0, lsr #4
 64		cmp	r1, #10
 65		addlt	r1, r1, #'0'
 66		addge	r1, r1, #'a' - 10
 67		strb	r1, [r3, #-1]!
 68		teq	r3, r2
 69		bne	1b
 70		mov	r0, r2
 71		b	printascii
 72ENDPROC(printhex2)
 73
 74hexbuf:		.space 16
 75
 76		.ltorg
 77
 78#ifndef CONFIG_DEBUG_SEMIHOSTING
 79
 80ENTRY(printascii)
 81		addruart_current r3, r1, r2
 82		b	2f
 831:		waituart r2, r3
 84		senduart r1, r3
 85		busyuart r2, r3
 86		teq	r1, #'\n'
 87		moveq	r1, #'\r'
 88		beq	1b
 892:		teq	r0, #0
 90		ldrneb	r1, [r0], #1
 91		teqne	r1, #0
 92		bne	1b
 93		ret	lr
 94ENDPROC(printascii)
 95
 96ENTRY(printch)
 97		addruart_current r3, r1, r2
 98		mov	r1, r0
 99		mov	r0, #0
100		b	1b
101ENDPROC(printch)
102
103#ifdef CONFIG_MMU
104ENTRY(debug_ll_addr)
105		addruart r2, r3, ip
106		str	r2, [r0]
107		str	r3, [r1]
108		ret	lr
109ENDPROC(debug_ll_addr)
110#endif
111
112#else
113
114ENTRY(printascii)
115		mov	r1, r0
116		mov	r0, #0x04		@ SYS_WRITE0
117	ARM(	svc	#0x123456	)
118	THUMB(	svc	#0xab		)
119		ret	lr
120ENDPROC(printascii)
121
122ENTRY(printch)
123		adr	r1, hexbuf
124		strb	r0, [r1]
125		mov	r0, #0x03		@ SYS_WRITEC
126	ARM(	svc	#0x123456	)
127	THUMB(	svc	#0xab		)
128		ret	lr
129ENDPROC(printch)
130
131ENTRY(debug_ll_addr)
132		mov	r2, #0
133		str	r2, [r0]
134		str	r2, [r1]
135		ret	lr
136ENDPROC(debug_ll_addr)
137
138#endif
v3.5.6
  1/*
  2 *  linux/arch/arm/kernel/debug.S
  3 *
  4 *  Copyright (C) 1994-1999 Russell King
  5 *
  6 * This program is free software; you can redistribute it and/or modify
  7 * it under the terms of the GNU General Public License version 2 as
  8 * published by the Free Software Foundation.
  9 *
 10 *  32-bit debugging code
 11 */
 12#include <linux/linkage.h>
 13#include <asm/assembler.h>
 14
 15		.text
 16
 17/*
 18 * Some debugging routines (useful if you've got MM problems and
 19 * printk isn't working).  For DEBUGGING ONLY!!!  Do not leave
 20 * references to these in a production kernel!
 21 */
 22
 23#if defined(CONFIG_DEBUG_ICEDCC)
 24		@@ debug using ARM EmbeddedICE DCC channel
 25
 26		.macro	addruart, rp, rv, tmp
 27		.endm
 28
 29#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
 30
 31		.macro	senduart, rd, rx
 32		mcr	p14, 0, \rd, c0, c5, 0
 33		.endm
 34
 35		.macro	busyuart, rd, rx
 361001:
 37		mrc	p14, 0, \rx, c0, c1, 0
 38		tst	\rx, #0x20000000
 39		beq	1001b
 40		.endm
 41
 42		.macro	waituart, rd, rx
 43		mov	\rd, #0x2000000
 441001:
 45		subs	\rd, \rd, #1
 46		bmi	1002f
 47		mrc	p14, 0, \rx, c0, c1, 0
 48		tst	\rx, #0x20000000
 49		bne	1001b
 501002:
 51		.endm
 52
 53#elif defined(CONFIG_CPU_XSCALE)
 54
 55		.macro	senduart, rd, rx
 56		mcr	p14, 0, \rd, c8, c0, 0
 57		.endm
 58
 59		.macro	busyuart, rd, rx
 601001:
 61		mrc	p14, 0, \rx, c14, c0, 0
 62		tst	\rx, #0x10000000
 63		beq	1001b
 64		.endm
 65
 66		.macro	waituart, rd, rx
 67		mov	\rd, #0x10000000
 681001:
 69		subs	\rd, \rd, #1
 70		bmi	1002f
 71		mrc	p14, 0, \rx, c14, c0, 0
 72		tst	\rx, #0x10000000
 73		bne	1001b
 741002:
 75		.endm
 76
 77#else
 78
 79		.macro	senduart, rd, rx
 80		mcr	p14, 0, \rd, c1, c0, 0
 81		.endm
 82
 83		.macro	busyuart, rd, rx
 841001:
 85		mrc	p14, 0, \rx, c0, c0, 0
 86		tst	\rx, #2
 87		beq	1001b
 88
 89		.endm
 90
 91		.macro	waituart, rd, rx
 92		mov	\rd, #0x2000000
 931001:
 94		subs	\rd, \rd, #1
 95		bmi	1002f
 96		mrc	p14, 0, \rx, c0, c0, 0
 97		tst	\rx, #2
 98		bne	1001b
 991002:
100		.endm
101
102#endif	/* CONFIG_CPU_V6 */
103
104#elif !defined(CONFIG_DEBUG_SEMIHOSTING)
105#include <mach/debug-macro.S>
106#endif	/* CONFIG_DEBUG_ICEDCC */
107
108#ifdef CONFIG_MMU
109		.macro	addruart_current, rx, tmp1, tmp2
110		addruart	\tmp1, \tmp2, \rx
111		mrc		p15, 0, \rx, c1, c0
112		tst		\rx, #1
113		moveq		\rx, \tmp1
114		movne		\rx, \tmp2
115		.endm
116
117#else /* !CONFIG_MMU */
118		.macro	addruart_current, rx, tmp1, tmp2
119		addruart	\rx, \tmp1
120		.endm
121
122#endif /* CONFIG_MMU */
123
124/*
125 * Useful debugging routines
126 */
127ENTRY(printhex8)
128		mov	r1, #8
129		b	printhex
130ENDPROC(printhex8)
131
132ENTRY(printhex4)
133		mov	r1, #4
134		b	printhex
135ENDPROC(printhex4)
136
137ENTRY(printhex2)
138		mov	r1, #2
139printhex:	adr	r2, hexbuf
140		add	r3, r2, r1
141		mov	r1, #0
142		strb	r1, [r3]
1431:		and	r1, r0, #15
144		mov	r0, r0, lsr #4
145		cmp	r1, #10
146		addlt	r1, r1, #'0'
147		addge	r1, r1, #'a' - 10
148		strb	r1, [r3, #-1]!
149		teq	r3, r2
150		bne	1b
151		mov	r0, r2
152		b	printascii
153ENDPROC(printhex2)
154
155hexbuf:		.space 16
156
157		.ltorg
158
159#ifndef CONFIG_DEBUG_SEMIHOSTING
160
161ENTRY(printascii)
162		addruart_current r3, r1, r2
163		b	2f
1641:		waituart r2, r3
165		senduart r1, r3
166		busyuart r2, r3
167		teq	r1, #'\n'
168		moveq	r1, #'\r'
169		beq	1b
1702:		teq	r0, #0
171		ldrneb	r1, [r0], #1
172		teqne	r1, #0
173		bne	1b
174		mov	pc, lr
175ENDPROC(printascii)
176
177ENTRY(printch)
178		addruart_current r3, r1, r2
179		mov	r1, r0
180		mov	r0, #0
181		b	1b
182ENDPROC(printch)
183
 
 
 
 
 
 
 
 
 
184#else
185
186ENTRY(printascii)
187		mov	r1, r0
188		mov	r0, #0x04		@ SYS_WRITE0
189	ARM(	svc	#0x123456	)
190	THUMB(	svc	#0xab		)
191		mov	pc, lr
192ENDPROC(printascii)
193
194ENTRY(printch)
195		adr	r1, hexbuf
196		strb	r0, [r1]
197		mov	r0, #0x03		@ SYS_WRITEC
198	ARM(	svc	#0x123456	)
199	THUMB(	svc	#0xab		)
200		mov	pc, lr
201ENDPROC(printch)
 
 
 
 
 
 
 
202
203#endif