From 17c7b6c3fdc48301e50d22cc6138ede16bd1be24 Mon Sep 17 00:00:00 2001 From: nbd Date: Thu, 6 Sep 2007 16:27:37 +0000 Subject: strip the kernel version suffix from target directories, except for brcm-2.4 (the -2.4 will be included in the board name here). CONFIG_LINUX__ becomes CONFIG_TARGET_, same for profiles. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8653 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- target/linux/at91/image/dfboot/src/com.c | 368 +++++++++++++++++++++++++++++++ 1 file changed, 368 insertions(+) create mode 100644 target/linux/at91/image/dfboot/src/com.c (limited to 'target/linux/at91/image/dfboot/src/com.c') diff --git a/target/linux/at91/image/dfboot/src/com.c b/target/linux/at91/image/dfboot/src/com.c new file mode 100644 index 0000000000..aacfb55558 --- /dev/null +++ b/target/linux/at91/image/dfboot/src/com.c @@ -0,0 +1,368 @@ +/*---------------------------------------------------------------------------- + * ATMEL Microcontroller Software Support - ROUSSET - + *---------------------------------------------------------------------------- + * The software is delivered "AS IS" without warranty or condition of any + * kind, either express, implied or statutory. This includes without + * limitation any warranty or condition with respect to merchantability or + * fitness for any particular purpose, or against the infringements of + * intellectual property rights of others. + *---------------------------------------------------------------------------- + * File Name : com.c + * Object : + * Creation : HIi 03/27/2003 + * + *---------------------------------------------------------------------------- + */ +#include "AT91RM9200.h" +#include "lib_AT91RM9200.h" +#include "config.h" +#include "com.h" +#include "stdio.h" + +static char erase_seq[] = "\b \b"; /* erase sequence */ + +#define MAX_UARTS 1 + +//unsigned int usa[2] = {(unsigned int)AT91C_BASE_DBGU, (unsigned int)AT91C_ALTERNATE_USART}; +unsigned int usa[1] = {(unsigned int)AT91C_BASE_DBGU}; +unsigned int us; +int port_detected; + +void at91_init_uarts(void) +{ + int i; + + port_detected = 0; + AT91F_DBGU_CfgPIO(); + AT91F_US0_CfgPIO(); + AT91F_US0_CfgPMC(); + + for(i=0; i 16) + return 0; + c = (type & ZEROPAD) ? '0' : ' '; + sign = 0; + + if(type & SIGN && num < 0) + { + sign = '-'; + num = -num; + size--; + } + + i = 0; + if(num == 0) + tmp[i++] = digits[0]; + else while(num != 0) + tmp[i++] = digits[do_div(num, base)]; + + if(i > precision) + precision = i; + size -= precision; + + if(!(type&(ZEROPAD+LEFT))) + while(size-->0) + putc(' '); + + if(sign) + putc(sign); + + if (!(type & LEFT)) + while (size-- > 0) + putc(c); + + while (i < precision--) + putc('0'); + + while (i-- > 0) + putc(tmp[i]); + + while (size-- > 0) + putc(' ');; + + return 1; +} + +int hvfprintf(const char *fmt, va_list va) +{ + char *s; + + do { + if(*fmt == '%') { + bool done = false; + + int type = 0; + int precision = 0; + + do { + fmt++; + switch(*fmt) { + case '0' : + if(!precision) + type |= ZEROPAD; + case '1' : + case '2' : + case '3' : + case '4' : + case '5' : + case '6' : + case '7' : + case '8' : + case '9' : + precision = precision * 10 + (*fmt - '0'); + break; + case '.' : + break; + case 's' : + s = va_arg(va, char *); + if(!s) + puts(""); + else + puts(s); + done = true; + break; + case 'c' : + putc(va_arg(va, int)); + done = true; + break; + case 'd' : + number(va_arg(va, int), 10, 0, precision, type); + done = true; + break; + case 'x' : + case 'X' : + number(va_arg(va, int), 16, 0, precision, type); + done = true; + break; + case '%' : + putc(*fmt); + done = true; + default: + putc('%'); + putc(*fmt); + done = true; + break; + } + } while(!done); + } else if(*fmt == '\\') { + fmt++; + if(*fmt == 'r') { + putc('\r'); + } else if(*fmt == 'n') { + putc('\n'); + } + } else { + putc(*fmt); + } + fmt++; + } while(*fmt != 0); + + return 0; +} + +int printf(const char *fmt, ...) +{ + va_list ap; + int i; + + va_start(ap, fmt); + i = hvfprintf(fmt, ap); + va_end(ap); + + return i; +} -- cgit v1.2.3