⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 redboot.h

📁 eCos操作系统源码
💻 H
📖 第 1 页 / 共 2 页
字号:
//==========================================================================////      redboot.h////      Standard interfaces for RedBoot////==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.// Copyright (C) 2002, 2003, 2004 Gary Thomas//// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.// at http://sources.redhat.com/ecos/ecos-license/// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):    gthomas// Contributors: gthomas, tkoeller// Date:         2000-07-14// Purpose:      // Description:  //              // This code is part of RedBoot (tm).////####DESCRIPTIONEND####////==========================================================================#ifndef _REDBOOT_H_#define _REDBOOT_H_#include <pkgconf/redboot.h>#include <pkgconf/hal.h>#include <cyg/hal/hal_if.h>#include <cyg/hal/hal_tables.h>#include <cyg/infra/diag.h>#include <cyg/crc/crc.h>#include <string.h>#ifdef CYGPKG_REDBOOT_NETWORKING#include <net/net.h>#include <net/bootp.h>// Determine an IP address for this node, using BOOTPextern int __bootp_find_local_ip(bootp_header_t *info);#endif#ifdef DEFINE_VARS#define EXTERN#else#define EXTERN extern#endif// Global variablesEXTERN int argc;#define MAX_ARGV 16EXTERN char *argv[MAX_ARGV];EXTERN unsigned char *ram_start, *ram_end;EXTERN struct _mem_segment {    unsigned char *start, *end;} mem_segments[CYGBLD_REDBOOT_MAX_MEM_SEGMENTS];#define NO_MEMORY (unsigned char *)0xFFFFFFFFEXTERN bool valid_address(unsigned char *addr);EXTERN void cyg_plf_memory_segment(int seg, unsigned char **start, unsigned char **end);EXTERN unsigned char *workspace_start, *workspace_end;EXTERN unsigned long workspace_size;// Data squirreled away after a load operationEXTERN unsigned long entry_address;EXTERN unsigned long load_address;EXTERN unsigned long load_address_end;#ifdef CYGPKG_REDBOOT_ANY_CONSOLEEXTERN bool console_selected;#endifEXTERN bool console_echo;EXTERN bool gdb_active;#if CYGNUM_REDBOOT_CMD_LINE_EDITING != 0EXTERN bool cmd_history;#endif#ifdef CYGPKG_REDBOOT_NETWORKINGEXTERN bool have_net, use_bootp;EXTERN bootp_header_t my_bootp_info;EXTERN int gdb_port;EXTERN bool net_debug;#endif#ifdef CYGFUN_REDBOOT_BOOT_SCRIPTEXTERN unsigned char *script;EXTERN int script_timeout;#ifdef CYGSEM_REDBOOT_VARIABLE_BAUD_RATEEXTERN int console_baud_rate;#endif#endif#ifdef CYGOPT_REDBOOT_FIS_ZLIB_COMMON_BUFFEREXTERN unsigned char *fis_zlib_common_buffer;#endif#ifdef CYGSEM_REDBOOT_PLF_STARTUPEXTERN void cyg_plf_redboot_startup(void);#endif// Prototypestypedef int _printf_fun(const char *fmt, ...);externC int  strcasecmp(const char *s1, const char *s2);externC int  strncasecmp(const char *s1, const char *s2, size_t len);externC void mon_write_char(char c);externC bool verify_action(char *fmt, ...);externC bool verify_action_with_timeout(int timeout, char *fmt, ...);// Read a single line of input from the console, possibly with timeoutexternC int  _rb_gets(char *line, int len, int timeout);// Just like _rb_gets(), except that the line buffer is assumed to contain// valid input data.  This provides an easy mechanism for edit-in-place.externC int  _rb_gets_preloaded(char *line, int len, int timeout);// Result codes from 'gets()'#define _GETS_TIMEOUT -1#define _GETS_CTRLC   -2#define _GETS_GDB      0#define _GETS_OK       1// Test for ^C on the console.  This function should only be used if any// other console input can be discarded, e.g. while performing some long// computation, waiting for the network, etc.  Returns 'true' if ^C typed.externC bool _rb_break(int timeout);// "console" selectionexternC int  start_console(void);externC void end_console(int old_console);// Alias functions#ifdef CYGSEM_REDBOOT_FLASH_ALIASESexternC char *flash_lookup_alias(char *alias, char *alias_buf);#endifexternC void expand_aliases(char *line, int len);//// Stream I/O support//typedef struct {    char *filename;    int   mode;    int   chan;#ifdef CYGPKG_REDBOOT_NETWORKING    struct sockaddr_in *server;#endif} connection_info_t;typedef struct {    int   (*open)(connection_info_t *info, int *err);        void  (*close)(int *err);        void  (*terminate)(bool abort, int (*getc)(void));        int   (*read)(char *buf, int size, int *err);        char *(*error)(int err);} getc_io_funcs_t;#define GETC_IO_FUNCS(_label_, _open_, _close_, _terminate_, _read_, _error_)   \getc_io_funcs_t _label_ = {                                                     \    _open_, _close_, _terminate_, _read_, _error_                               \};struct load_io_entry {    char            *name;    getc_io_funcs_t *funcs;        bool             can_verbose;    bool             need_filename;    int              mode;} CYG_HAL_TABLE_TYPE;#define _RedBoot_load(_name_,_funcs_,_verbose_,_filename_,_mode_)       \struct load_io_entry _load_tab_##_funcs_##_name_                        \   CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_load,_funcs_##_name) =         \     { #_name_, &_funcs_, _verbose_, _filename_, _mode_ }; #define RedBoot_load(_name_,_funcs_,_verbose_,_filename_, _mode_)       \   _RedBoot_load(_name_,_funcs_,_verbose_,_filename_,_mode_) #ifdef CYGPKG_COMPRESS_ZLIB// Decompression supporttypedef struct _pipe {    unsigned char* in_buf;              // only changed by producer    int in_avail;                       // only changed by producer    unsigned char* out_buf;             // only changed by consumer (init by producer)    int out_size;                       // only changed by consumer (init by producer)    int out_max;                        // set by producer    const char* msg;                    // message from consumer    void* priv;                         // handler's data} _pipe_t;typedef int _decompress_fun_init(_pipe_t*);typedef int _decompress_fun_inflate(_pipe_t*);typedef int _decompress_fun_close(_pipe_t*, int);externC _decompress_fun_init* _dc_init;externC _decompress_fun_inflate* _dc_inflate;externC _decompress_fun_close* _dc_close;#endif // CYGPKG_COMPRESS_ZLIB// CLI support functionsexternC bool parse_num(char *s, unsigned long *val, char **es, char *delim);externC bool parse_bool(char *s, bool *val);typedef void cmd_fun(int argc, char *argv[]);struct cmd {    char    *str;    char    *help;    char    *usage;    cmd_fun *fun;    struct cmd *sub_cmds, *sub_cmds_end;} CYG_HAL_TABLE_TYPE;externC struct cmd *cmd_search(struct cmd *tab, struct cmd *tabend, char *arg);externC void        cmd_usage(struct cmd *tab, struct cmd *tabend, char *prefix);#define RedBoot_cmd(_s_,_h_,_u_,_f_) cmd_entry(_s_,_h_,_u_,_f_,0,0,RedBoot_commands)#define RedBoot_nested_cmd(_s_,_h_,_u_,_f_,_subs_,_sube_) cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,RedBoot_commands)#define _cmd_entry(_s_,_h_,_u_,_f_,_subs_,_sube_,_n_)                                   \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -