//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2015 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2015 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// from http://www.opencores.org/lgpl.shtml ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
#ifndef _UBOOT_LIB_H_
|
#ifndef _UBOOT_LIB_H_
|
#define _UBOOT_LIB_H_
|
#define _UBOOT_LIB_H_
|
|
|
#include <stdint.h>
|
#include <stdint.h>
|
#include <inttypes.h>
|
#include <inttypes.h>
|
#include "types.h"
|
#include "types.h"
|
|
|
#include <string.h>
|
#include <string.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <ctype.h>
|
#include <ctype.h>
|
|
|
|
#include "xil_printf.h"
|
|
|
#undef CONFIG_ARCH_MAP_SYSMEM
|
#undef CONFIG_ARCH_MAP_SYSMEM
|
#include "mapmem.h"
|
#include "mapmem.h"
|
|
|
#include "sys_cmd.h"
|
#include "sys_cmd.h"
|
|
|
|
|
/*
|
/*
|
* Error codes that commands return to cmd_process(). We use the standard 0
|
* Error codes that commands return to cmd_process(). We use the standard 0
|
* and 1 for success and failure, but add one more case - failure with a
|
* and 1 for success and failure, but add one more case - failure with a
|
* request to call cmd_usage(). But the cmd_process() function handles
|
* request to call cmd_usage(). But the cmd_process() function handles
|
* CMD_RET_USAGE itself and after calling cmd_usage() it will return 1.
|
* CMD_RET_USAGE itself and after calling cmd_usage() it will return 1.
|
* This is just a convenience for commands to avoid them having to call
|
* This is just a convenience for commands to avoid them having to call
|
* cmd_usage() all over the place.
|
* cmd_usage() all over the place.
|
*/
|
*/
|
enum command_ret_t {
|
enum command_ret_t {
|
CMD_RET_SUCCESS, /* 0 = Success */
|
CMD_RET_SUCCESS, /* 0 = Success */
|
CMD_RET_FAILURE, /* 1 = Failure */
|
CMD_RET_FAILURE, /* 1 = Failure */
|
CMD_RET_USAGE = -1, /* Failure, please report 'usage' error */
|
CMD_RET_USAGE = -1, /* Failure, please report 'usage' error */
|
};
|
};
|
|
|
typedef int cmd_tbl_t;
|
typedef int cmd_tbl_t;
|
|
|
/* sysv */
|
/* sysv */
|
typedef unsigned char unchar;
|
typedef unsigned char unchar;
|
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
typedef unsigned int uint;
|
typedef unsigned int uint;
|
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
|
|
|
|
/*
|
/*
|
* Command Flags:
|
* Command Flags:
|
*/
|
*/
|
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
|
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
|
#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
|
#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
|
#define CMD_FLAG_ENV 0x0004 /* command is from the environment */
|
#define CMD_FLAG_ENV 0x0004 /* command is from the environment */
|
|
|
|
|
#define __maybe_unused __attribute__((unused))
|
#define __maybe_unused __attribute__((unused))
|
|
|
|
|
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
#undef CONFIG_SYS_SUPPORT_64BIT_DATA
|
#undef CONFIG_SYS_SUPPORT_64BIT_DATA
|
|
|
|
|
|
|
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
extern int cmd_get_data_size(const char * arg, int default_size);
|
extern int cmd_get_data_size(const char * arg, int default_size);
|
extern unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
|
extern unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
|
extern int print_buffer(ulong addr, const void *data, uint width, uint count, uint linelen);
|
extern int print_buffer(ulong addr, const void *data, uint width, uint count, uint linelen);
|
|
|
|
|
#endif // _UBOOT_LIB_H_
|
#endif // _UBOOT_LIB_H_
|
|
|
|
|
|
|
|
|
|
|