PERFORCE change 95462 for review
Warner Losh
imp at FreeBSD.org
Mon Apr 17 23:28:11 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95462
Change 95462 by imp at imp_hammer on 2006/04/17 23:27:40
split up lib.c, change putc to putchar, implement simple printf
(which may be too big, but 380 bytes doesn't seem too bad).
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.c#6 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/env_vars.c#5 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/bootiic/loader_prompt.c#6 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/getc.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#4 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/printf.c#1 add
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/putchar.c#2 edit
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/xmodem.c#2 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/debug_io.c#6 (text+ko) ====
@@ -35,7 +35,7 @@
if (!buffer)
return;
while(*buffer != '\0')
- putc(*buffer++);
+ putchar(*buffer++);
}
/*
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/env_vars.c#5 (text+ko) ====
@@ -147,7 +147,7 @@
DebugPrintHex(2, i);
DebugPrint(" : ");
for (j = 0; j < MAX_INPUT_SIZE; ++j) {
- putc(boot_commands[i][j]);
+ putchar(boot_commands[i][j]);
if (!(boot_commands[i][j]))
break;
}
==== //depot/projects/arm/src/sys/boot/arm/at91/bootiic/loader_prompt.c#6 (text+ko) ====
@@ -398,7 +398,7 @@
inputBuffer[buffCount] = p_char;
++buffCount;
- putc(p_char);
+ putchar(p_char);
}
} else if (buffCount) {
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/getc.c#2 (text) ====
@@ -39,21 +39,6 @@
#include "lib.h"
/*
- * void putc(int ch)
- * Writes a character to the DBGU port. It assumes that DBGU has
- * already been initialized.
- */
-void
-putc(int ch)
-{
- AT91PS_USART pUSART = (AT91PS_USART)AT91C_BASE_DBGU;
-
- while (!(pUSART->US_CSR & AT91C_US_TXRDY))
- continue;
- pUSART->US_THR = (ch & 0xFF);
-}
-
-/*
* int getc(int seconds)
*
* Reads a character from the DBGU port, if one is available within about
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/lib.h#4 (text) ====
@@ -28,7 +28,8 @@
#define ARM_BOOT_LIB_H
int getc(int);
-void putc(int);
+void putchar(int);
int xmodem_rx(char *dst);
+void printf(const char *fmt,...);
#endif
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/putchar.c#2 (text) ====
@@ -39,12 +39,12 @@
#include "lib.h"
/*
- * void putc(int ch)
+ * void putchar(int ch)
* Writes a character to the DBGU port. It assumes that DBGU has
* already been initialized.
*/
void
-putc(int ch)
+putchar(int ch)
{
AT91PS_USART pUSART = (AT91PS_USART)AT91C_BASE_DBGU;
@@ -52,26 +52,3 @@
continue;
pUSART->US_THR = (ch & 0xFF);
}
-
-/*
- * int getc(int seconds)
- *
- * Reads a character from the DBGU port, if one is available within about
- * seconds seconds. It assumes that DBGU has already been initialized.
- */
-int
-getc(int seconds)
-{
- AT91PS_USART pUSART = (AT91PS_USART)AT91C_BASE_DBGU;
- unsigned thisSecond;
-
- thisSecond = GetSeconds();
- seconds = thisSecond + seconds;
-
- while (thisSecond <= seconds) {
- if ((pUSART->US_CSR & AT91C_US_RXRDY))
- return (pUSART->US_RHR & 0xFF);
- thisSecond = GetSeconds();
- }
- return (-1);
-}
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/xmodem.c#2 (text) ====
@@ -81,11 +81,11 @@
goto err;
if (((ch = getc(1)) == -1) || ((ch & 0xff) != (chk & 0xFF)))
goto err;
- putc(ACK);
+ putchar(ACK);
return (1);
err:;
- putc(CAN);
+ putchar(CAN);
// We should allow for resend, but we don't.
return (0);
}
@@ -107,11 +107,11 @@
while (1) {
if (starting)
- putc('C');
+ putchar('C');
if (((ch = getc(1)) == -1) || (ch != SOH && ch != EOT))
continue;
if (ch == EOT) {
- putc(ACK);
+ putchar(ACK);
return (dest - startAddress);
}
starting = 0;
More information about the p4-projects
mailing list