1/*
2 * Copyright 2012, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PLATFORM_DEBUG_H_
6#define _PLATFORM_DEBUG_H_
7
8#define DEBUG_DELAY_SHORT		200
9#define DEBUG_DELAY_MEDIUM		500
10#define DEBUG_DELAY_LONG		1000
11
12void debug_delay(int time);
13void debug_set_led(bool on);
14
15void debug_toggle_led(int count, int delay = DEBUG_DELAY_MEDIUM);
16	// Toggles the led count times with the delay for both on and off time.
17
18void debug_blink_number(int number);
19	// Implements a blink pattern to output arbitrary numbers:
20	//
21	//	1.	Led turns off and stays off for a long delay.
22	//	2.	Led blinks x times with a short delay, where x is the current
23	//		decimal place + 1 (so 0 values are easier to see).
24	//	3.	Led stays off for a long delay to indicate the move to the next
25	//		decimal place and step 2. is repeated until all the rest of the
26	//		number is 0.
27	//	4.	The led turns on and stays on with a long delay to indicate finish.
28	//	5.	Led state is reset to the original value.
29	//
30	// The lowest decimal is output first, so the number will be reversed. As an
31	// example the number 205 would be blinked as follows:
32	//		long off (start indicator), 6 blinks (indicating 5),
33	//		long off (moving to next decimal), 1 blink (indicating 0)
34	//		long off (moving to next decimal), 3 blinks (indicating 2)
35	//		long on (finish indicator)
36
37void debug_halt();
38	// Stalls execution in an endless loop.
39
40void debug_assert(bool condition);
41	// Flashes the led 20 times rapidly and stalls execution if the condition
42	// isn't met.
43
44#endif // _PLATFORM_DEBUG_H_
45
46