Browse Source

Doxygenation

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
d0c9183903
2 changed files with 84 additions and 24 deletions
  1. 11
    4
      src/arch/i386/include/bochs.h
  2. 73
    20
      src/core/vsprintf.c

+ 11
- 4
src/arch/i386/include/bochs.h View File

@@ -1,9 +1,16 @@
1 1
 #ifndef BOCHS_H
2 2
 #define BOCHS_H
3 3
 
4
-/*
5
- * This file defines "bochsbp", the magic breakpoint instruction that
6
- * is incredibly useful when debugging under bochs.
4
+/** @file
5
+ *
6
+ * bochs breakpoints
7
+ *
8
+ * This file defines @c bochsbp, the magic breakpoint instruction that
9
+ * is incredibly useful when debugging under bochs.  This file should
10
+ * never be included in production code.
11
+ *
12
+ * Use the pseudo-instruction @c bochsbp in assembly code, or the
13
+ * bochsbp() function in C code.
7 14
  *
8 15
  */
9 16
 
@@ -15,7 +22,7 @@
15 22
 
16 23
 #else /* ASSEMBLY */
17 24
 
18
-/* Breakpoint for when debugging under bochs */
25
+/** Breakpoint for when debugging under bochs */
19 26
 static inline void bochsbp ( void ) {
20 27
 	__asm__ __volatile__ ( "xchgw %bx, %bx" );
21 28
 }

+ 73
- 20
src/core/vsprintf.c View File

@@ -10,27 +10,57 @@
10 10
 #define SHRT_SHIFT  ((int)((sizeof(unsigned short)*CHAR_BIT) - 4))
11 11
 #define CHAR_SHIFT  ((int)((sizeof(unsigned char)*CHAR_BIT) - 4))
12 12
 
13
-/**************************************************************************
14
-PRINTF and friends
13
+/** @file
14
+ *
15
+ * printf and friends.
16
+ *
17
+ * Etherboot's printf() functions understand the following format
18
+ * specifiers:
19
+ *
20
+ *	- Hexadecimal integers
21
+ *		- @c %[#]x	- 4 bytes int (8 hex digits, lower case)
22
+ *		- @c %[#]X	- 4 bytes int (8 hex digits, upper case)
23
+ *		- @c %[#]lx	- 8 bytes long (16 hex digits, lower case)
24
+ *		- @c %[#]lX	- 8 bytes long (16 hex digits, upper case)
25
+ *		- @c %[#]hx	- 2 bytes int (4 hex digits, lower case)
26
+ *		- @c %[#]hX	- 2 bytes int (4 hex digits, upper case)
27
+ *		- @c %[#]hhx	- 1 byte int (2 hex digits, lower case)
28
+ *		- @c %[#]hhX	- 1 byte int (2 hex digits, upper case)
29
+ *		.
30
+ *		If the optional # prefix is specified, the output will
31
+ *		be prefixed with 0x (or 0X).
32
+ *
33
+ *	- Other integers
34
+ *		- @c %d		- decimal int
35
+ *	.
36
+ *	Note that any width specification (e.g. the @c 02 in @c %02x)
37
+ *	will be accepted but ignored.
38
+ *
39
+ *	- Strings and characters
40
+ *		- @c %c		- char
41
+ *		- @c %s		- string
42
+ *		- @c %m		- error message text (i.e. strerror(errno))
43
+ *
44
+ *	- Etherboot-specific specifiers
45
+ *		- @c %@		- IP in ddd.ddd.ddd.ddd notation
46
+ *		- @c %!		- MAC address in xx:xx:xx:xx:xx:xx notation
47
+ *
48
+ */
15 49
 
16
-	Formats:
17
-		%[#]x	- 4 bytes int (8 hex digits, lower case)
18
-		%[#]X	- 4 bytes int (8 hex digits, upper case)
19
-		%[#]lx  - 8 bytes long (16 hex digits, lower case)
20
-		%[#]lX  - 8 bytes long (16 hex digits, upper case)
21
-		%[#]hx	- 2 bytes int (4 hex digits, lower case)
22
-		%[#]hX	- 2 bytes int (4 hex digits, upper case)
23
-		%[#]hhx	- 1 byte int (2 hex digits, lower case)
24
-		%[#]hhX	- 1 byte int (2 hex digits, upper case)
25
-			- optional # prefixes 0x or 0X
26
-		%d	- decimal int
27
-		%c	- char
28
-		%s	- string
29
-		%m	- string representation of the most recent error
30
-		%@	- Internet address in ddd.ddd.ddd.ddd notation
31
-		%!	- Ethernet address in xx:xx:xx:xx:xx:xx notation
32
-	Note: width specification ignored
33
-**************************************************************************/
50
+/**
51
+ * Write a formatted string to a buffer.
52
+ *
53
+ * @v buf		Buffer into which to write the string, or NULL
54
+ * @v fmt		Format string
55
+ * @v args		Arguments corresponding to the format string
56
+ * @ret len		Length of string written to buffer (if buf != NULL)
57
+ * @ret	0		(if buf == NULL)
58
+ * @err None
59
+ *
60
+ * If @c buf==NULL, then the string will be written to the console
61
+ * directly using putchar().
62
+ *
63
+ */
34 64
 static int vsprintf(char *buf, const char *fmt, va_list args)
35 65
 {
36 66
 	const char *p;
@@ -154,6 +184,20 @@ static int vsprintf(char *buf, const char *fmt, va_list args)
154 184
 	return (s - buf);
155 185
 }
156 186
 
187
+/**
188
+ * Write a formatted string to a buffer.
189
+ *
190
+ * @v buf		Buffer into which to write the string, or NULL
191
+ * @v fmt		Format string
192
+ * @v ...		Arguments corresponding to the format string
193
+ * @ret len		Length of string written to buffer (if buf != NULL)
194
+ * @ret	0		(if buf == NULL)
195
+ * @err None
196
+ *
197
+ * If @c buf==NULL, then the string will be written to the console
198
+ * directly using putchar().
199
+ *
200
+ */
157 201
 int sprintf(char *buf, const char *fmt, ...)
158 202
 {
159 203
 	va_list args;
@@ -164,6 +208,15 @@ int sprintf(char *buf, const char *fmt, ...)
164 208
 	return i;
165 209
 }
166 210
 
211
+/**
212
+ * Write a formatted string to the console.
213
+ *
214
+ * @v fmt		Format string
215
+ * @v ...		Arguments corresponding to the format string
216
+ * @ret	None
217
+ * @err None
218
+ *
219
+ */
167 220
 void printf(const char *fmt, ...)
168 221
 {
169 222
 	va_list args;

Loading…
Cancel
Save