📄 ui.c
字号:
mprintf( LIGHTGREEN, CONTINUE, " toggle 0x%02X\r\n", (epp->toggle) );
mprintf( LIGHTGREEN, CONTINUE, " speed 0x%02X\r\n", (epp->speed) );
mprintf( LIGHTGREEN, CONTINUE, " direction 0x%02X\r\n", (epp->direction) );
mprintf( LIGHTGREEN, CONTINUE, " tr_type 0x%02X\r\n", (epp->tr_type) );
mprintf( LIGHTGREEN, CONTINUE, " transfer_type 0x%02X\r\n", (epp->transfer_type) );
mprintf( LIGHTGREEN, CONTINUE, " endpoint_descriptor pointer ep-index[ %d ] %p\r\n", i, &(epp->endpoint_descriptor) );
mprintf( LIGHTGREEN, CONTINUE, " bLength 0x%02X\r\n", (epp->endpoint_descriptor).bLength );
mprintf( LIGHTGREEN, CONTINUE, " bDescriptorType 0x%02X\r\n", (epp->endpoint_descriptor).bDescriptorType );
mprintf( LIGHTGREEN, CONTINUE, " bEndpointAddress 0x%02X\r\n", (epp->endpoint_descriptor).bEndpointAddress );
mprintf( LIGHTGREEN, CONTINUE, " bmAttributes 0x%02X\r\n", (epp->endpoint_descriptor).bmAttributes );
mprintf( LIGHTGREEN, CONTINUE, " wMaxPacketSize 0x%04X\r\n", (epp->endpoint_descriptor).wMaxPacketSize );
mprintf( LIGHTGREEN, CONTINUE, " bInterval 0x%02X\r\n", (epp->endpoint_descriptor).bInterval );
mprintf( LIGHTGREEN, CONTINUE, "press key to see more.\r" );
key_wait();
mprintf( LIGHTGREEN, CONTINUE, "p\r" );
}
}
}
unsigned char get_music_number( void )
{
unsigned char selection;
int i;
if ( !(*g_sing_file_str[ 2 ]) )
return ( 0 );
clrscr();
mprintf( LIGHTGREEN, CONTINUE, "\r\n" );
mprintf( LIGHTGREEN, CONTINUE, "\r\n" );
mprintf( LIGHTGREEN, CONTINUE, " AudioTest started\r\n" );
mprintf( YELLOW, CONTINUE, "\r\n\r\n music file list :\r\n" );
mprintf( YELLOW, CONTINUE, " ^^^^^^^^^^^^^^^^^\r\n" );
for ( i = 0; i < MAX_NUM_OF_AUDIO_FILES; i++ )
{
if ( !(*g_sing_file_str[i]) )
break;
mprintf( YELLOW, CONTINUE, " [%d] : \"%s\"\r\n", i, g_sing_file_str[i] );
}
mprintf( YELLOW, CONTINUE, " your selection : [ ]\r" );
selection = key_wait();
if ( selection == 0x0D )
selection = '0';
selection -= '0';
if ( !(selection < i) )
return ( 0xFF );
mprintf( YELLOW, CONTINUE, " your selection : [%d]\r\n\r\n", selection );
return ( selection );
}
void help_messsage( void )
{
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Help info:\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Help (1/3):\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " * Key operations... for user interaction \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ? : Help Help key to see this help \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " h : Help Help key to see this help \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " q : Quit Quit program [esc] key has same function \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " You need to hit [y] key after [q] key \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " a : Audio test Starts to play music from file \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Stops audio while music playing \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " p : Printer test Start/Stop printing \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " d : Dump registers Dump 1161-HostController registers \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " v : Version Version information \r\n" );
mprintf( YELLOW, CONTINUE, "\r\n\r\n press key to continue... (ESC for cancel)\r" );
if ( 0x1b == key_wait() & 0xFF )
return;
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Help (2/3):\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " * Switches... can be used at launching the program from command line \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " -b : Defines the 1161's base address in (ISA) I/O space \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " A hexadecimal value must follow after this switch. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " If this address is not correct, Kenobi2 will report \"the 1161 \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " chip is not found\". \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " default = 290 (hexadecimal) \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " -h : Defines IRQ number host controller (INT1). \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " A decimal value must follow after this switch. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " If this number is notset correctly, you may not get 1161 \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " status line on the screen and no 1mS periodic pulse can be \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " found on INT1 signal line. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " default = 10 (decimal) \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " -a : Defines the source of music. File name with path. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " The path should be written like UNIX ('/' path delimiters) \r\n" );
mprintf( YELLOW, CONTINUE, "\r\n\r\n press key to continue... (ESC for cancel)\r" );
if ( 0x1b == key_wait() & 0xFF )
return;
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Help (3/3):\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " -l : Audio file list can be used with switch. The list file is \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " in text format. File name with path will be defined. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Audio file list may contain the File name with path in \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " each lines, '!' or '#' characters can be used as a comment \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " identifier at line head. \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Example1 : > Kenobi2 -b 300 -h 3 -a ../music/dig_it.wav [Return] \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Use ISA I/O base address 300h \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " IRQ3 is used for HostController \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Music source is \"../music/dig_it.wav\" \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Example2 : > Kenobi2 -l ./songs/songs.lst [Return] \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Default ISA I/O base address 290h \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Default IRQ setting = 10 for HostController \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " \"./songs/songs.lst\" is a music file list \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " The file must contain the list of files. \r\n" );
mprintf( YELLOW, CONTINUE, "\r\n\r\n help end.\r\n\r\n" );
}
void version_info( void )
{
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Version info:\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
mprintf( WHITE, CONTINUE, " Kenobi2\r\n" );
mprintf( WHITE, CONTINUE, " version %s (%s, %s)", VERSION_NUMBER, __DATE__, __TIME__ );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Akifumi OKANO \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " +81-3-3740-4668 \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " akifumi.okano@philips.com \r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Computing Segment / BL-Connectivity \r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Philips Semiconductors Tokyo 2001 \r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
}
void environment_info( void )
{
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Environment info:\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^^^^^^^\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ISA I/O base address : 0x%03X\r\n", g_ISA_base_address );
mprintf( LIGHTGRAY, CONTINUE, " IRQ number for host controller : %d\r\n", g_host_IRQ_num );
mprintf( LIGHTGRAY, CONTINUE, "\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Default music file : \"%s\"\r\n", g_sing_file_str[ 0 ] );
mprintf( LIGHTGRAY, CONTINUE, " Default music list file : \"%s\"\r\n", g_sing_list_file_str );
mprintf( LIGHTGRAY, CONTINUE, "\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " Default printer file directory : \"%s\"\r\n", g_printer_default_file_path );
mprintf( LIGHTGRAY, CONTINUE, "\r\n\r\n" );
}
void port_device_info( void )
{
device_instance *dvi_ptr;
int i;
clrscr();
mprintf( LIGHTGRAY, CONTINUE, " Port-Device info:\r\n" );
mprintf( LIGHTGRAY, CONTINUE, " ^^^^^^^^^^^^^^^^^\r\n" );
for ( i = 1; i <= NUMBER_OF_ROOT_HUB_PORT; i++ ) // Port number starts from 1
{
dvi_ptr = device_on_port( i );
if ( dvi_ptr )
{
mprintf( LIGHTGRAY, CONTINUE, " Device @ port%d (USB address %d)\r\n", i, dvi_ptr->address );
show_device_string_descriptors( dvi_ptr );
}
else
{
mprintf( LIGHTGRAY, CONTINUE, " Device @ port%d is unconnected.\r\n", i );
mprintf( LIGHTGRAY, CONTINUE, "\r\n", i );
}
mprintf( LIGHTGRAY, CONTINUE, "\r\n" );
}
}
unsigned char key_polling_timing( void )
{
unsigned char flag;
flag = key_polling_flag;
key_polling_flag = 0;
return( flag );
}
int key_wait( void )
{
while ( 1 )
{
if ( key_polling_timing() )
if ( bioskey( 1 ) )
break;
}
return ( bioskey( 0 ) );
}
void wait_ms( unsigned long timeout )
{
unsigned long timelimit;
timelimit = g_sof_counter + timeout;
while ( g_sof_counter < timelimit )
;
}
char *get_string_from_console( char *s, int length, unsigned char input_color, char *prompt_string, unsigned char prompt_color, char *suffix )
{
// a pointer "file_list" will gives you a warning at build time
// it is reserved for future use, so please ignore it
char *cs_ptr;
int curs;
int key;
int i;
if ( suffix == 0 )
strcpy( suffix, "" );
strcpy( s, g_printer_default_file_path );
curs = strlen( s );
mprintf( prompt_color, CONTINUE, "\r%s", prompt_string );
mprintf( input_color, CONTINUE, "%s", s );
while ( 0x0D != ((key = key_wait()) & 0xFF ))
{
if ( key & 0xFF )
{
key &= 0xFF;
if ( isprint( key ) )
{
if ( curs < (length - 1) )
{
mprintf( input_color, CONTINUE, "%c", (char)key );
*(s + curs++) = (char)key;
}
else
{
mprintf( RED, CONTINUE, "!!" );
}
}
else if ( 0x1B == key ) // case of [ESC]
{
*s = 0xFF;
return ( s );
}
else if ( 0x08 == key )
{
curs -= (0 < curs) ? 1 : 0;
*(s + curs) = 0;
mprintf( prompt_color, CONTINUE, "\r%s", prompt_string );
mprintf( input_color, CONTINUE, "%s \r", s );
mprintf( prompt_color, CONTINUE, "%s", prompt_string );
mprintf( input_color, CONTINUE, "%s", s );
}
else
{
}
}
else
{
//
// Under construction
//
key >>= 8;
if ( (key != 0x48) && (key != 0x50) )
continue;
}
}
*(s + curs) = 0;
cs_ptr = strrchr( s, '/' );
cs_ptr = cs_ptr ? cs_ptr : s;
if ( !strchr( cs_ptr, '.' ) )
strcat( s, suffix );
return ( s );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -