Download USB HOST CONTROLLER FOR A MICROCONTROLLER

Transcript
}
// ***********************************************************************
// VNC1L - Waiting for PROMPT
// If there is an error, return the error number
// Return: 0 = Prompt received
//
xx = error number from vnc_rd_answer function
// ***********************************************************************
unsigned char vnc_prompt_check(void)
{
unsigned char status_1, status_2;
status_1 = vnc_rd_answer(PROMPT_AND_ERROR_CHECK);
if (status_1 == 1) return 0; // Prompt was received, no previous error, command was
executed
// Error occurred, now just waiting for prompt, but confirming error
status_2 = vnc_rd_answer(PROMPT_CHECK);
if (status_2 == 1) return status_1;
return status_2;
// no Prompt, Timeout
}
// ***********************************************************************
// VNC1L - Creating a text file on a USB drive
// Maximum file length: 64 kByte
// Parameters: file_name : address of file_name
//
file_content : address of text block to be written
//
option
: File 0 = new or 1 = append content
// Return: status
: error number (0 = OK)
// ***********************************************************************
unsigned char vnc_wr_txtfile(char *file_name, char *file_content, char option)
{
unsigned int vnc_i
= 0;
unsigned int file_length = 0;
unsigned int file_CR = 0; // carriage return
char *file_ptr;
unsigned char wr_steps
= 0;
unsigned char status = 0;
// calculate number of bytes
file_ptr = file_content;
53