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 |
27 |
qaztronic |
#include "xil_printf.h"
|
41 |
|
|
|
42 |
22 |
qaztronic |
#undef CONFIG_ARCH_MAP_SYSMEM
|
43 |
|
|
#include "mapmem.h"
|
44 |
|
|
|
45 |
|
|
#include "sys_cmd.h"
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
/*
|
49 |
|
|
* Error codes that commands return to cmd_process(). We use the standard 0
|
50 |
|
|
* and 1 for success and failure, but add one more case - failure with a
|
51 |
|
|
* request to call cmd_usage(). But the cmd_process() function handles
|
52 |
|
|
* CMD_RET_USAGE itself and after calling cmd_usage() it will return 1.
|
53 |
|
|
* This is just a convenience for commands to avoid them having to call
|
54 |
|
|
* cmd_usage() all over the place.
|
55 |
|
|
*/
|
56 |
|
|
enum command_ret_t {
|
57 |
|
|
CMD_RET_SUCCESS, /* 0 = Success */
|
58 |
|
|
CMD_RET_FAILURE, /* 1 = Failure */
|
59 |
|
|
CMD_RET_USAGE = -1, /* Failure, please report 'usage' error */
|
60 |
|
|
};
|
61 |
|
|
|
62 |
|
|
typedef int cmd_tbl_t;
|
63 |
|
|
|
64 |
|
|
/* sysv */
|
65 |
|
|
typedef unsigned char unchar;
|
66 |
|
|
typedef unsigned short ushort;
|
67 |
|
|
typedef unsigned int uint;
|
68 |
|
|
typedef unsigned long ulong;
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
/*
|
72 |
|
|
* Command Flags:
|
73 |
|
|
*/
|
74 |
|
|
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
|
75 |
|
|
#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
|
76 |
|
|
#define CMD_FLAG_ENV 0x0004 /* command is from the environment */
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
#define __maybe_unused __attribute__((unused))
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
/*-----------------------------------------------------------*/
|
83 |
|
|
#undef CONFIG_SYS_SUPPORT_64BIT_DATA
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
/*-----------------------------------------------------------*/
|
88 |
|
|
extern int cmd_get_data_size(const char * arg, int default_size);
|
89 |
|
|
extern unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
|
90 |
|
|
extern int print_buffer(ulong addr, const void *data, uint width, uint count, uint linelen);
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
#endif // _UBOOT_LIB_H_
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|