@ -12,6 +12,7 @@
# include <config.h>
# include <command.h>
# include <asm/blackfin.h>
# include <asm/gpio.h>
/* Using sw10-PF5 as the hotkey */
int post_hotkeys_pressed ( void )
@ -20,14 +21,13 @@ int post_hotkeys_pressed(void)
int i ;
unsigned short value ;
* pPORTF_FER & = ~ PF5 ;
* pPORTFIO_DIR & = ~ PF5 ;
* pPORTFIO_INEN | = PF5 ;
gpio_request ( GPIO_PF5 , " post " ) ;
gpio_direction_input ( GPIO_PF5 ) ;
printf ( " ########Press SW10 to enter Memory POST########: %2d " , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = * pPORTFIO & PF5 ;
value = gpio_get_value ( GPIO_PF5 ) ;
if ( value ! = 0 ) {
break ;
}
@ -43,6 +43,8 @@ int post_hotkeys_pressed(void)
printf ( " Hotkey has been pressed, Enter POST . . . . . . \n " ) ;
return 1 ;
}
gpio_free ( GPIO_PF5 ) ;
}
int uart_post_test ( int flags )
@ -106,34 +108,24 @@ int flash_post_test(int flags)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int led_post_test ( int flags )
{
* pPORTF_FER & = ~ ( PF6 | PF7 | PF8 | PF9 | PF10 | PF11 ) ;
* pPORTFIO_DIR | = PF6 | PF7 | PF8 | PF9 | PF10 | PF11 ;
* pPORTFIO_INEN & = ~ ( PF6 | PF7 | PF8 | PF9 | PF10 | PF11 ) ;
* pPORTFIO & = ~ ( PF6 | PF7 | PF8 | PF9 | PF10 | PF11 ) ;
udelay ( 1000000 ) ;
printf ( " LED1 on " ) ;
* pPORTFIO | = PF6 ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
printf ( " LED2 on " ) ;
* pPORTFIO | = PF7 ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
printf ( " LED3 on " ) ;
* pPORTFIO | = PF8 ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
printf ( " LED4 on " ) ;
* pPORTFIO | = PF9 ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
printf ( " LED5 on " ) ;
* pPORTFIO | = PF10 ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
printf ( " lED6 on " ) ;
* pPORTFIO | = PF11 ;
printf ( " \b \b \b \b \b \b \b " ) ;
unsigned int leds [ ] = {
GPIO_PF6 , GPIO_PF7 , GPIO_PF8 ,
GPIO_PF9 , GPIO_PF10 , GPIO_PF11 ,
} ;
int i ;
for ( i = 0 ; i < ARRAY_SIZE ( leds ) ; + + i ) {
gpio_request ( leds [ i ] , " post " ) ;
gpio_direction_output ( leds [ i ] , 0 ) ;
printf ( " LED%i on " , i + 1 ) ;
gpio_set_value ( leds [ i ] , 1 ) ;
udelay ( 1000000 ) ;
printf ( " \b \b \b \b \b \b \b " ) ;
gpio_free ( leds [ i ] ) ;
}
return 0 ;
}
@ -143,88 +135,40 @@ int led_post_test(int flags)
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int button_post_test ( int flags )
{
unsigned int buttons [ ] = {
GPIO_PF2 , GPIO_PF3 , GPIO_PF4 , GPIO_PF5 ,
} ;
unsigned int sws [ ] = { 13 , 12 , 11 , 10 , } ;
int i , delay = 5 ;
unsigned short value = 0 ;
int result = 0 ;
* pPORTF_FER & = ~ ( PF5 | PF4 | PF3 | PF2 ) ;
* pPORTFIO_DIR & = ~ ( PF5 | PF4 | PF3 | PF2 ) ;
* pPORTFIO_INEN | = ( PF5 | PF4 | PF3 | PF2 ) ;
for ( i = 0 ; i < ARRAY_SIZE ( buttons ) ; + + i ) {
gpio_request ( buttons [ i ] , " post " ) ;
gpio_direction_input ( buttons [ i ] ) ;
printf ( " \n --------Press SW10: %2d " , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = * pPORTFIO & PF5 ;
if ( value ! = 0 ) {
break ;
delay = 5 ;
printf ( " \n --------Press SW%i: %2d " , sws [ i ] , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = gpio_get_value ( buttons [ i ] ) ;
if ( value ! = 0 )
break ;
udelay ( 10000 ) ;
}
udelay ( 10000 ) ;
printf ( " \b \b \b %2d " , delay ) ;
}
printf ( " \b \b \b %2d " , delay ) ;
}
if ( value ! = 0 )
printf ( " \b \b OK " ) ;
else {
result = - 1 ;
printf ( " \b \b failed " ) ;
}
delay = 5 ;
printf ( " \n --------Press SW11: %2d " , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = * pPORTFIO & PF4 ;
if ( value ! = 0 ) {
break ;
}
udelay ( 10000 ) ;
if ( value ! = 0 )
puts ( " \b \b OK " ) ;
else {
result = - 1 ;
puts ( " \b \b failed " ) ;
}
printf ( " \b \b \b %2d " , delay ) ;
}
if ( value ! = 0 )
printf ( " \b \b OK " ) ;
else {
result = - 1 ;
printf ( " \b \b failed " ) ;
}
delay = 5 ;
printf ( " \n --------Press SW12: %2d " , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = * pPORTFIO & PF3 ;
if ( value ! = 0 ) {
break ;
}
udelay ( 10000 ) ;
}
printf ( " \b \b \b %2d " , delay ) ;
}
if ( value ! = 0 )
printf ( " \b \b OK " ) ;
else {
result = - 1 ;
printf ( " \b \b failed " ) ;
gpio_free ( buttons [ i ] ) ;
}
delay = 5 ;
printf ( " \n --------Press SW13: %2d " , delay ) ;
while ( delay - - ) {
for ( i = 0 ; i < 100 ; i + + ) {
value = * pPORTFIO & PF2 ;
if ( value ! = 0 ) {
break ;
}
udelay ( 10000 ) ;
}
printf ( " \b \b \b %2d " , delay ) ;
}
if ( value ! = 0 )
printf ( " \b \b OK " ) ;
else {
result = - 1 ;
printf ( " \b \b failed " ) ;
}
printf ( " \n " ) ;
puts ( " \n " ) ;
return result ;
}