| 1 |
24 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//// ////
|
| 3 |
|
|
//// Copyright (C) 2015 Authors and OPENCORES.ORG ////
|
| 4 |
|
|
//// ////
|
| 5 |
|
|
//// This source file may be used and distributed without ////
|
| 6 |
|
|
//// restriction provided that this copyright statement is not ////
|
| 7 |
|
|
//// removed from the file and that any derivative work contains ////
|
| 8 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
| 9 |
|
|
//// ////
|
| 10 |
|
|
//// This source file is free software; you can redistribute it ////
|
| 11 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
| 12 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
| 13 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
| 14 |
|
|
//// later version. ////
|
| 15 |
|
|
//// ////
|
| 16 |
|
|
//// This source is distributed in the hope that it will be ////
|
| 17 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
| 18 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
| 19 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
| 20 |
|
|
//// details. ////
|
| 21 |
|
|
//// ////
|
| 22 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
| 23 |
|
|
//// Public License along with this source; if not, download it ////
|
| 24 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
| 25 |
|
|
//// ////
|
| 26 |
|
|
//////////////////////////////////////////////////////////////////////
|
| 27 |
22 |
qaztronic |
|
| 28 |
|
|
#ifndef _UBOOT_LIB_H_
|
| 29 |
|
|
#define _UBOOT_LIB_H_
|
| 30 |
|
|
|
| 31 |
|
|
#include <stdint.h>
|
| 32 |
|
|
#include <inttypes.h>
|
| 33 |
|
|
#include "types.h"
|
| 34 |
|
|
|
| 35 |
|
|
#include <string.h>
|
| 36 |
|
|
#include <stdlib.h>
|
| 37 |
|
|
#include <stdio.h>
|
| 38 |
|
|
#include <ctype.h>
|
| 39 |
|
|
|
| 40 |
|
|
#undef CONFIG_ARCH_MAP_SYSMEM
|
| 41 |
|
|
#include "mapmem.h"
|
| 42 |
|
|
|
| 43 |
|
|
#include "sys_cmd.h"
|
| 44 |
|
|
|
| 45 |
|
|
|
| 46 |
|
|
/*
|
| 47 |
|
|
* Error codes that commands return to cmd_process(). We use the standard 0
|
| 48 |
|
|
* and 1 for success and failure, but add one more case - failure with a
|
| 49 |
|
|
* request to call cmd_usage(). But the cmd_process() function handles
|
| 50 |
|
|
* CMD_RET_USAGE itself and after calling cmd_usage() it will return 1.
|
| 51 |
|
|
* This is just a convenience for commands to avoid them having to call
|
| 52 |
|
|
* cmd_usage() all over the place.
|
| 53 |
|
|
*/
|
| 54 |
|
|
enum command_ret_t {
|
| 55 |
|
|
CMD_RET_SUCCESS, /* 0 = Success */
|
| 56 |
|
|
CMD_RET_FAILURE, /* 1 = Failure */
|
| 57 |
|
|
CMD_RET_USAGE = -1, /* Failure, please report 'usage' error */
|
| 58 |
|
|
};
|
| 59 |
|
|
|
| 60 |
|
|
typedef int cmd_tbl_t;
|
| 61 |
|
|
|
| 62 |
|
|
/* sysv */
|
| 63 |
|
|
typedef unsigned char unchar;
|
| 64 |
|
|
typedef unsigned short ushort;
|
| 65 |
|
|
typedef unsigned int uint;
|
| 66 |
|
|
typedef unsigned long ulong;
|
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
/*
|
| 70 |
|
|
* Command Flags:
|
| 71 |
|
|
*/
|
| 72 |
|
|
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
|
| 73 |
|
|
#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
|
| 74 |
|
|
#define CMD_FLAG_ENV 0x0004 /* command is from the environment */
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
#define __maybe_unused __attribute__((unused))
|
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
/*-----------------------------------------------------------*/
|
| 81 |
|
|
#undef CONFIG_SYS_SUPPORT_64BIT_DATA
|
| 82 |
|
|
|
| 83 |
|
|
|
| 84 |
|
|
|
| 85 |
|
|
/*-----------------------------------------------------------*/
|
| 86 |
|
|
extern int cmd_get_data_size(const char * arg, int default_size);
|
| 87 |
|
|
extern unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
|
| 88 |
|
|
extern int print_buffer(ulong addr, const void *data, uint width, uint count, uint linelen);
|
| 89 |
|
|
|
| 90 |
|
|
|
| 91 |
|
|
#endif // _UBOOT_LIB_H_
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
|
| 95 |
|
|
|