factory.c

来自「AT91所有开发板的资料 AT91所有开发板的资料」· C语言 代码 · 共 82 行

C
82
字号
/* -*-C-*- * * $Revision: 1.3 $ *   $Author: mechavar $ *     $Date: 2000/05/01 19:37:08 $ * * Copyright (c) 2000 ARM, INC. * All Rights Reserved. * *   Project: BootStrap Loader * *    */#include "uhal.h"#define RX_DONE(p)	(RX_DATA(GET_STATUS(p)))#define RESP_DELAY	(10 * 1000)	/* approximately how many loops to					   test for receive ready, for 9600					   baud */unsigned wait_forRX( unsigned port ){   int i = RESP_DELAY;   while ( i-- > 0 )   {      if ( 0 != RX_DONE(port) )      {	 return( GET_CHAR(port) );      }   }   return( 0xFEEDBEEF );}/* Check that a loop back cable connects com0 to com1. This constitutes the   UART testing. If the loopback cable is detected, return TRUE. */int bsl_FactoryTestRequired( void ){   unsigned ret;   while ( 0 == (GET_STATUS(UART0_BASE) & USRTxEmpty) )   {      ;   }   PUT_CHAR( UART0_BASE, 0x1F );   ret = wait_forRX( UART1_BASE );   if ( ret != 0x1F )   {      return( FALSE );   }   while ( 0 == (GET_STATUS(UART1_BASE) & USRTxEmpty) )   {      ;   }   PUT_CHAR( UART1_BASE, 0x1E );   ret = wait_forRX( UART0_BASE );   if ( ret != 0x1E )   {      return( FALSE );   }   return( TRUE );}/* First check the SRAM and the flash integrity. Then set up to respond to the   user interrupt switch. This function will not return. */void bsl_DoFactoryTest( void ){   dispMode( 2 );		/* set the 7 segment display */   ScanModules( 0 );   BootModules( 2 );		/* special do-factory-test flag */}

⌨️ 快捷键说明

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