1157873Simp/*- 2157873Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3157873Simp * 4157873Simp * Redistribution and use in source and binary forms, with or without 5157873Simp * modification, are permitted provided that the following conditions 6157873Simp * are met: 7157873Simp * 1. Redistributions of source code must retain the above copyright 8157873Simp * notice, this list of conditions and the following disclaimer. 9157873Simp * 2. Redistributions in binary form must reproduce the above copyright 10157873Simp * notice, this list of conditions and the following disclaimer in the 11157873Simp * documentation and/or other materials provided with the distribution. 12157873Simp * 13157873Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14157873Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15157873Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16157873Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17157873Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18157873Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19157873Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20157873Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21157873Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22157873Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23157873Simp * 24157873Simp * $FreeBSD$ 25157873Simp */ 26157873Simp 27157873Simp#ifndef ARM_BOOT_LIB_H 28157873Simp#define ARM_BOOT_LIB_H 29157873Simp 30157873Simpint getc(int); 31157873Simpvoid putchar(int); 32163533Simpvoid xputchar(int); 33157873Simpvoid printf(const char *fmt,...); 34157873Simp 35157873Simp/* The following function write eeprom at ee_addr using data */ 36157873Simp/* from data_add for size bytes. */ 37172991Scognetint ReadEEPROM(unsigned eeoff, unsigned char *data_addr, unsigned size); 38161195Simpvoid WriteEEPROM(unsigned eeoff, char *data_addr, unsigned size); 39157873Simpvoid InitEEPROM(void); 40157873Simp 41157873Simp/* XMODEM protocol */ 42157873Simpint xmodem_rx(char *dst); 43157873Simp 44161195Simp/* */ 45161195Simpvoid start_wdog(int n); 46161195Simpvoid reset(void); 47161195Simp 48161195Simp/* Delay us */ 49161195Simpvoid Delay(int us); 50161195Simp 51161195Simp#define ToASCII(x) ((x > 9) ? (x + 'A' - 0xa) : (x + '0')) 52161195Simp 53161195Simpint p_IsWhiteSpace(char cValue); 54161195Simpunsigned p_HexCharValue(char cValue); 55161195Simpunsigned p_ASCIIToHex(const char *buf); 56161195Simpunsigned p_ASCIIToDec(const char *buf); 57161195Simp 58161195Simpvoid p_memset(char *buffer, char value, int size); 59161195Simpint p_strlen(const char *buffer); 60163533Simpchar *strcpy(char *to, const char *from); 61163533Simpvoid memcpy(void *to, const void *from, unsigned size); 62161195Simpint p_memcmp(const char *to, const char *from, unsigned size); 63163533Simpint strcmp(const char *to, const char *from); 64161195Simp 65157873Simp#endif 66