Intel XScale PXA255 引导Linux的Redboot 版bootloader源代码!

源代码在线查看: context.c

软件大小: 3825 K
上传用户: jaysdy1117
关键词: bootloader Redboot XScale Intel
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*=================================================================				//				//        context.c				//				//        HAL Thread context handling test				//				//==========================================================================				//####COPYRIGHTBEGIN####				//                                                                          				// -------------------------------------------                              				// The contents of this file are subject to the Red Hat eCos Public License 				// Version 1.1 (the "License"); you may not use this file except in         				// compliance with the License.  You may obtain a copy of the License at    				// http://www.redhat.com/                                                   				//                                                                          				// Software distributed under the License is distributed on an "AS IS"      				// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the 				// License for the specific language governing rights and limitations under 				// the License.                                                             				//                                                                          				// The Original Code is eCos - Embedded Configurable Operating System,      				// released September 30, 1998.                                             				//                                                                          				// The Initial Developer of the Original Code is Red Hat.                   				// Portions created by Red Hat are                                          				// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.                             				// All Rights Reserved.                                                     				// -------------------------------------------                              				//                                                                          				//####COPYRIGHTEND####				//==========================================================================				//#####DESCRIPTIONBEGIN####				//				// Author(s):     nickg				// Contributors:  nickg				// Date:          1998-10-07				//####DESCRIPTIONEND####				*/								#include 								#include 								#include 								#include 				#include 								#define CYG_TRACE_USER_BOOL 1								// -------------------------------------------------------------------------								#define THREADS         4				#define STACKSIZE       (2*1024)								char stack[THREADS][STACKSIZE];								CYG_ADDRWORD sp[THREADS];								cyg_count32 switches = 0;								// -------------------------------------------------------------------------								void entry0( CYG_ADDRWORD arg )				{				    CYG_TRACE1B("Thread %d started\n", arg );								    while( switches < 1000 )				    {				        HAL_THREAD_SWITCH_CONTEXT( &sp[arg], &sp[(arg+1) % THREADS] );								        CYG_TRACE1B("Thread %d resumed\n", arg );								        switches++;				    }								    CYG_TEST_PASS_FINISH("HAL Context test");				    				}								// -------------------------------------------------------------------------								void context_main(void)				{				    int i;				    				    CYG_TEST_INIT();								    // Init all thread contexts:				    				    for( i = 0 ; i < THREADS; i++ )				    {				        sp[i] = (CYG_ADDRWORD)stack[i]+STACKSIZE;				        				        HAL_THREAD_INIT_CONTEXT( sp[i], i, entry0, i*0x01010000 );				    }								    // Load the first thread.				    				    HAL_THREAD_LOAD_CONTEXT( &sp[0] );				}								// -------------------------------------------------------------------------								externC void				cyg_start( void )				{				    context_main();				}								// -------------------------------------------------------------------------				/* EOF context.c */							

相关资源