Пример #1
0
/*
 * Show all tasks and their states that are
 * running on the OS. */
void cmd_ps()
{
	char listBuf[512] = {0};
	sPuts( "Name\t      State Priority   Stack   Num" );
	vTaskList( listBuf );
	print_to_console( listBuf );
}
Пример #2
0
static void printbuf_dump(struct print_buf *pb)
{
    int len;

    if (!pb->buf) {
        printk("*** PRINT BUFFER NOT ALLOCATED ***");
        return;
    }

    /* Dump print buffer from char after cursor to end (if used) */

    len = pb->buf + pb->size - pb->crs - 2;
    if ((pb->buf[pb->size - 1] == 0) && (len > 0))
        print_to_console(pb->crs + 1, len);

    /* Dump print buffer from start to cursor (always) */

    len = pb->crs - pb->buf;
    print_to_console(pb->buf, len);
}
Пример #3
0
/* Display the content of the file specified. */
void cmd_cat( const char *filename )
{
	char buffer[129];
	int fd = fs_open( filename, 0, O_RDONLY ), count;

	if ( fd < 0 )
	{
		sPuts( "The file dose not exist!" );
		return;
	}

	while( ( count = fio_read( fd, buffer, sizeof(buffer) - 1 ) ) > 0 )
	{
		buffer[ count ] = '\0';
		print_to_console( buffer );
	}

	sPuts( "" );
	fio_close( fd );

	return;
}
Пример #4
0
void shellEnv()
{
	char serial_buf[ MAX_SERIAL_LEN ], ch;
	char prompt[] = "LanKuDot@FreeRTOS~$ ", newLine[] = "\n\r";
	int curr_pos, done;

	/* Infinite loop for running shell environmrnt. */
	while (1)
	{
		/* Show prompt each time waiting for user input. */
		print_to_console( prompt );

		/* Initialize the relatived variable. */
		curr_pos = 0;
		done = 0;

		do
		{
			/* Recieve a byte from the RS232 port ( this call will
			 * block ).
			 */
			ch = recieve_byte();

			/* If the byte is an end-of-line character, than finish
			 * the string and indicate we are done.
			 */
			if ( curr_pos >= MAX_SERIAL_LEN-1 || (ch == '\n') || (ch == '\r') )
			{
				serial_buf[ curr_pos ] = '\0';
				done = -1;
			}
			/* Backspace key pressed */
			else if ( ch == BACKSPACE )
			{
				/* The char is not at the begin of the line. */
				if ( curr_pos != 0 )
				{
					--curr_pos;
					/* Cover the last character with space, and shift the 
					 * cursor left. */
					print_to_console( "\b \b" );
				}
			}
			/* Function/Arrow Key pressed */
			else if ( ch == ESC )
			{
				/* Arrow Key: ESC[A ~ ESC[D 
				 * Function Key: ESC[1~ ~ ESC[6~ */
				ch = recieve_byte();

				if ( ch == '[' )
				{
					ch = recieve_byte();
					if ( ch >= '1' && ch <= '6' )
					{
						/* Discard '~' */
						recieve_byte();
					}

					continue;
				}
			}
			/* Otherwise, add the character to the response string */
			else
			{
				serial_buf[ curr_pos++ ] = ch;
				/* Display the char that just typed */
			//	print_to_console( &ch );		// Bug: Press 1, print a lot...
				fio_write( 1, &ch, 1 );
			}
		} while ( !done );	// end character recieving loop

		/* Direct to the new line */
		print_to_console( newLine );

		/* Deal with the command! */
		getCommand( serial_buf );

	}	// end infinite while loop
}	// end of function shellEnv
Пример #5
0
void sPuts( const char *str )
{
	/* Display the string with new line. */
	print_to_console( str );
	print_to_console( "\r\n" );
}
Пример #6
0
void foo(){
  std::printf("hello world\n");
  print_to_console(); // this could be printed from anything
}
Пример #7
0
void font::print ( void )
{
	print_to_console ( std_out );
}