mxc_nb_setup.c

来自「i.mx31 3DS平台Nandboot引导程序源码」· C语言 代码 · 共 110 行

C
110
字号
//==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.// Copyright (C) 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####/*! * @file mxc_nb_setup.c *  * @brief Kernel tags source file for NANDBoot to configure command * line parameters to kernel. * * @ingroup NANDboot */#include "mxc_nb_setup.h"#include "mxc_nb_uart.h"/*! * Tag parameters */static struct tag *params = (struct tag *)CMDLINE_ADDR;/*! * To store cmdline parameters  */static char cmdline[MAX_STRLEN];/*! * This is initialization of  the kernel tagged list */void mxcnb_setup_taglist(void){                int i = 0;        mxcnb_outstring("-->New command line option: \n");        i = (int)mxcnb_getstring(cmdline);        mxcnb_putdata('\n');        if (i > 0) {                mxcnb_outstring("\nCommand entered is: ");                mxcnb_outstring(cmdline);                mxcnb_outstring("\n");        } else {                mxcnb_outstring("\nCommand line options not entered ");                return;        }        /* Set up parameters to pass to kernel */        /*  CORE tag must be present & first */        params->hdr.size = (sizeof(struct tag_core) +                 sizeof(struct tag_header))/sizeof(U32);        params->hdr.tag = ATAG_CORE;        params->u.core.flags = 0;        params->u.core.pagesize = 0;        params->u.core.rootdev = 0;        params = (struct tag *)((long *)params + params->hdr.size);         /* Fill in the details of the memory layout */        params->hdr.size = (sizeof(struct tag_mem32) +                 sizeof(struct tag_header))/sizeof(U32);        params->hdr.tag = ATAG_MEM;        params->u.mem.start = SDRAM_BASE_ADDR;        params->u.mem.size  = SDRAM_SIZE;        params = (struct tag *)((long *)params + params->hdr.size);        /* Fill for CMDline */        params->hdr.size = (ROUNDUP(strlen(cmdline)) +                 sizeof(struct tag_header))/sizeof(U32);        params->hdr.tag = ATAG_CMDLINE;        strcpy(params->u.cmdline.cmdline, cmdline);        mxcnb_outstring(params->u.cmdline.cmdline);        params = (struct tag *)((long *)params + params->hdr.size);        mxcnb_outstring(params);        /* Mark end of parameter list  */        params->hdr.size = 0;        params->hdr.tag = ATAG_NONE;        mxcnb_outstring(params);} 

⌨️ 快捷键说明

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