Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Apr 2006 23:28:07 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 95462 for review
Message-ID:  <200604172328.k3HNS7kp047186@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95462

Change 95462 by imp@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604172328.k3HNS7kp047186>