Vous êtes sur la page 1sur 72

OMAP-U-Boot-Utils

0.1 Generated by Doxygen 1.5.5


Wed Aug 27 23:33:10 2008

CONTENTS

Contents
1 2 3 4 5 6 7 8 9 OMAP U-Boot Utils pserial pusb ucmd ukermit Applications in U-Boot Utilities Known Caveats Compiling the Code OS dependent Libraries 1 1 2 3 3 4 4 4 6 7 7 7 10

10 Data Structure Index 11 File Index 12 Data Structure Documentation 13 File Documentation

1
1.1

OMAP U-Boot Utils


Introduction

This is a bunch of utilities meant to work with U-Boot [http://www.denx.de/wiki/UBoot]

1.2

Motivation:

Traditionally U-Boot has worked with terminal applications such as minicom/hyperterminal etc. However, These applications dont work out ne when we think of automating these as part of scripts or the like. Many corporations use a mixture of Operating Systems at work. Common applications functioning similarly accross host Operating Systems are sadly lacking. This bunch of utilities we hope to bridge these gaps. We can create wrappers on top of these utilities, allowing us to potentially have automated command execution driven from the host.

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

1.3

Details

1.3

Details
Compiling the Code Known Caveats OS dependent Libraries Applications in U-Boot Utilities

1.4

U-Boot Utils License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2. This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, whether express or implied; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

pserial

This Application helps download a second le as response to ASIC ID over serial port

2.1

Syntax:

pserial -p portName -f fileToDownload

Where: portName - RS232 device being used. Example: Linux: /dev/ttyS0, Windows: COM1,COM2 etc. leToDownload - le to be downloaded as response to asic id

2.2

Usage Example:

Linux: ./pserial -p /dev/ttyS0 -f ~/tmp/u-boot.bin Windows: pserial.exe -p COM1 -f z:\tmp\u-boot.bin

2.3

Files:
src/pserial.c

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

3 pusb

pusb

This Application helps download a second le as response to ASIC ID over USB

3.1

Syntax:

pusb [-v] [-d device_ID] -f input_file

Where: -v : (optional) Chitter chatter verbose -q : (optional) Ultra quiet - no outputs other than error -d device_ID: (optional) USB Device id (Uses default of 0xD009) -f input_le: input le to be transmitted to target Warning: Use sudo to get access to set_conguration

3.2

Usage Example:

Linux: sudo ./pusb -d 0xd009 -f ~/tmp/u-boot.bin

3.3

Files:
src/pusb.c

ucmd

This sends a command and expects a provided matching response from target

4.1

Syntax:

ucmd -p portName -c "command to send" -e "Expect String"

Where: portName - RS232 device being used. Example: Linux: /dev/ttyS0, Windows: COM1,COM2 etc. command to send - Command to send to uboot Expect string - String to expect from target - on match the application returns

4.2

Usage Example:

Linux: ./ucmd -p /dev/ttyS0 -c "help" -e "U-Boot>" Windows: ucmd.exe -p COM1 -c "help" -e "U-Boot>"

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

4.3

Files:

4.3

Files:
src/ucmd.c

ukermit

This Application helps download a leusing U-Boots kermit protocol over serial port

5.1

Syntax:

./ukermit -p portName -f fileToDownload [-d delay_time]

Where: portName - RS232 device being used. Example: Linux: /dev/ttyS0, Windows: COM1,COM2 etc. leToDownload - le to be downloaded delay_time - delay time in ms for ack reciept (optional) - usually used when u-boot has something to do between packets -such as write to nand/nor etc.. which takes extra time and standard serial communication apps might fail

5.2

Usage Example:

Linux: ./ukermit -p /dev/ttyS0 -f ~/tmp/u-boot.bin Windows: ukermit.exe -p COM1 -f z:\tmp\u-boot.bin

5.3

Files:
src/ukermit.c

Applications in U-Boot Utilities

U-Boot utilities provide the following apps: pserial - OMAP specic utility which downloads a le in response to ASIC ID over serial port. pusb - OMAP specic utility which downloads a le in response to ASIC ID over USB connection. ucmd - Send a command to U-Boot and wait till a specic match appears. ukermit - Download a le from host without using kermit to U-Boot.

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

7 Known Caveats

Known Caveats

The following lists the known issues with omap U-Boot utils USB2serial convertors and pserial dont like each other on Linux pusb does not yet work on windows. This is still a work in progress ukermit is cranky when used with large packets - it is disabled at the moment

Compiling the Code

Table Of Contents A) Getting ready to compile code A.1) Linux A.2) Windows A.2.1) Get the Environment: A.2.2) Additional params for building code for Windows B) Compiling the code:

8.1
8.1.1

A) Getting ready to compile code


A.1) Linux

This section explains the compilation environment needs of linux Based on which ever distribution you have, you would need gcc, make, binutils, libc, system utils such as nd, sed, uname, grep, tr etc. For documentation, youd need doxygen and graphviz, latex, pdatex, makeindex. For pusb, you will need libusb(and known to work only on Linux at the moment) You could run "apt-get install gcc" or "yum install gcc" based on debian or redhat distributions. 8.1.2 A.2) Windows

8.1.2.1 A.2.1) Get the Environment: NOTE: based on the speed of your internet connection and machine speed, these steps could take quite a while.. So dont blame me ;). I have just tried these on a 32 bit Windows XP machine, so no guarentees on 64 bit or Windows Vista,2000,95 and whatever is around.. MingW Compiler: http://www.mingw.org/
i) Download automated installer from: http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=240780 ii) Select gcc from options provided to <compiler directory> Example: C:\MinGW <compiler directory> = C:\MingW

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

8.2

B) Compiling the code:

Get compilation environment:GnuWin32 http://gnuwin32.sourceforge.net/ you can install individual packages from http://gnuwin32.sourceforge.net/packages.html OR go for the entire package by getting getGnuWin32 from http://sourceforge.net/project/showfiles.php?group_id=163416&package_id=184724 . Follow the steps provided below:
i) Run the getGNUWin32 application to download and install GNUwin32 apps ii) Select the location to install the applications to <tmp directory> Example: c:\gnuWinTemp iii) Click on windows start->run "cmd" iv) cd to C:\gnuWinTemp\GetGnuWin32\ v) If you have a net proxy to set, this would be the time to do it. e.g. for http proxy(proxy.com) running on port 80, run: set http_proxy=http://proxy.com:80 Note: NO QUOTES. Dont try set http_proxy="http://proxy.com:80". Things are a bit brain dead and takes " as part of the variable. vi) Setup the mirrors: Example: set GNUWIN32_MIRROR="voxel umn unc" (Yes with the "s) Note: if you want to see the available mirrors run notepad readme.txt vii) Run the command "download" -> This will take a while all the apps are pulled down, but, what the heck, you get all the apps :). Note: if you do not desire to install all, read the readme.txt on how to select the packages youd need to install viii) Run the command "install" -> This again could take a while ix) now open a windows explorer window (windows key+e) and move the directory <temp directory> to <app directory>. Example: C:\gnuWinTemp\GetGnuWin32\gnuwin32 to c:\gnuwin32 directory c:\gnuWinTemp can now be deleted (if you would like to save some disk space) <app directory> = c:\gnuwin32

Setup the environment variables


i) Right click on system and select "System Properties" ii) Click on "Advanced" Tab iii) Click on the "Environment Variable" button iv) Add <app directory>\bin and <compiler directory>\bin to the Path variable (it is in System variable). Example: c:\gnuwin32\bin;C:\MinGW\bin

8.1.2.2 A.2.2) Additional params for building code for Windows make,gcc are taken in windows compilation:
i) Using variables to compile Example: set COMPILER_PREFIX=C:\MingW\bin\ set APP_PREFIX=C:\gnuwin32\bin\ make

You can choose where the

ii) Edit the Makefile and change the COMPILER_PREFIX and APP_PREFIX variables to point to where the files are present.

To Compile code open a new command prompt by running "cmd" from start->run cd to the code and do a make

8.2

B) Compiling the code:

make can be invoked in the following manner:

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

9 OS dependent Libraries

Build binaries:
make

will compile all binaries except pusb.


make usb

will compile pusb.(currently only for linux) Build documentation


make docs

will generate html documentation Clean up the build


make clean

will clean out all build object les + executables


make distclean

will do what clean does + nd and destroy all temporary les and any generated documentation. By default, code builds in quiet mode, by setting variable V=1 during compile, you can get detailed build steps. Example:
make V=1

OS dependent Libraries

In general accessing OS specic system devices such as le and serial port tends to be a pain. Hence, there we dene a set of APIs which are OS independent . APIs and denes can be found here: include/serial.h - provide for OS independent APIs for applications to access serial port include/le.h - provide OS independent APIs for accessing le The corresponding OS dependent implementation is done in lib/serial_<OS>.c lib/le_<OS>.c

10
10.1

Data Structure Index


Data Structures

Here are the data structures with brief descriptions: kermit_ack_nack_type (Kermit ack packet type ) kermit_data_header_small (Kermit data packet header ) 7 8

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

11 File Index

11
11.1

File Index
File List

Here is a list of all les with brief descriptions: include/f_status.h (Header for lib for showing le transfer status ) include/le.h (Header for Generic I/O denition ) include/rev.h (Nothing other than storing a common rev information ) include/serial.h (Generic header for OS independent APIs to access serial port ) lib/f_status.c (Lib for showing le transfer status ) lib/le_posix.c (File io implementation for Linux and POSIX compliant OSes ) lib/le_win32.c (Windows API based implementation of include/le.h ) lib/serial_posix.c (Serial port operations wrapper for Linux/posix compliant OSs ) lib/serial_win32.c (Win32 based serial port operations ) src/pserial.c (Peripheral Boot downloader over UART ) src/pusb.c (Peripheral Boot downloader over USB ) src/ucmd.c (Tiny little app which sends a command to uboot and waits for a response ) src/ukermit.c (Reverse of kermit protocol implemented by uboot ) 10 12 15 15 22 24 26 29 33 41 45 51 54

12
12.1
12.1.1

Data Structure Documentation


kermit_ack_nack_type Struct Reference
Detailed Description

Kermit ack packet type. Data Fields unsigned char start


start marker

unsigned char length_norm unsigned char sequence_number unsigned char packet_type unsigned char checksum unsigned char eol
end marker

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

12.2

kermit_data_header_small Struct Reference

12.1.2 12.1.2.1

Field Documentation unsigned char kermit_ack_nack_type::start

start marker Referenced by print_ack_packet(). 12.1.2.2 unsigned char kermit_ack_nack_type::length_norm

Referenced by print_ack_packet(). 12.1.2.3 unsigned char kermit_ack_nack_type::sequence_number

Referenced by print_ack_packet(). 12.1.2.4 unsigned char kermit_ack_nack_type::packet_type

Referenced by print_ack_packet(). 12.1.2.5 unsigned char kermit_ack_nack_type::checksum

Referenced by print_ack_packet(). 12.1.2.6 unsigned char kermit_ack_nack_type::eol

end marker Referenced by print_ack_packet(). The documentation for this struct was generated from the following le: src/ukermit.c

12.2
12.2.1

kermit_data_header_small Struct Reference


Detailed Description

Kermit data packet header. Data Fields unsigned char start unsigned char length_normal unsigned char sequence_number unsigned char packet_type Field Documentation unsigned char kermit_data_header_small::start

12.2.2 12.2.2.1

Referenced by k_send_data_packet_small().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13 File Documentation

10

12.2.2.2

unsigned char kermit_data_header_small::length_normal

Referenced by k_send_data_packet_small(). 12.2.2.3 unsigned char kermit_data_header_small::sequence_number

Referenced by k_send_data_packet_small(). 12.2.2.4 unsigned char kermit_data_header_small::packet_type

Referenced by k_send_data_packet_small(). The documentation for this struct was generated from the following le: src/ukermit.c

13
13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 13.10

File Documentation
docs/app_pserial.dox File Reference docs/app_pusb.dox File Reference docs/app_ucmd.dox File Reference docs/app_ukermit.dox File Reference docs/apps.dox File Reference docs/caveat.dox File Reference docs/compile.dox File Reference docs/library.dox File Reference docs/main.dox File Reference include/f_status.h File Reference
Detailed Description

13.10.1

header for lib for showing le transfer status FileName: include/f_status.h File transfer status apis This graph shows which les directly or indirectly include this le:
include/f_status.h

src/pserial.c

src/pusb.c

src/ukermit.c

lib/f_status.c

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.10

include/f_status.h File Reference

11

Denes #dene SPECIAL_PRINT 1 #dene NORMAL_PRINT 0 Functions void f_status_init (signed long total_size, unsigned char special)
f_status_init initialize the status structures

int f_status_show (signed long cur_size)


f_status_show show current status -> to be called by apps when they desire to display

13.10.2 13.10.2.1

Dene Documentation #dene NORMAL_PRINT 0

Referenced by k_send_data(), and send_le(). 13.10.2.2 13.10.3 13.10.3.1 #dene SPECIAL_PRINT 1 Function Documentation void f_status_init (signed long total_size, unsigned char special)

f_status_init initialize the status structures Parameters: total_size - total size of the le special - display special display -> for apps interfacing with ui stuff total_size - total size of the le special - display s_special display -> for apps interfacing with ui stuff References back_buff, BACK_SPACE_CHAR, print_buff, s_special, and tsize. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_status_init send_file main main

13.10.3.2

int f_status_show (signed long cur_size)

f_status_show show current status -> to be called by apps when they desire to display

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.11

include/le.h File Reference

12

Parameters: cur_size - current size Returns: 0 - ok ,1 - not ok.. size was too large f_status_show show current status -> to be called by apps when they desire to display Parameters: cur_size - current size Returns: 0 - ok ,1 - not ok.. size was too large References back_buff, BACK_SPACE_CHAR, print_buff, s_special, and tsize. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_status_show send_file main main

13.11
13.11.1

include/le.h File Reference


Detailed Description

Header for Generic I/O denition. FileName: include/le.h The OS specic implementation should implement these APIs. This graph shows which les directly or indirectly include this le:
include/file.h

src/pserial.c

src/pusb.c

src/ukermit.c

lib/file_posix.c

lib/file_win32.c

Denes #dene FILE_ERROR -1


File Operation failed.

#dene FILE_OK 0
File Operation OK.

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.11

include/le.h File Reference

13

Functions signed long f_size (const char f_name)


f_size - returns the size of the le

signed char f_open (const char f_name)


f_open - open the le

signed char f_close (void)


f_close - close the le

signed int f_read (unsigned char buffer, unsigned int read_size)


f_read - read from le

13.11.2 13.11.2.1

Dene Documentation #dene FILE_ERROR -1

File Operation failed. Referenced by f_close(), f_open(), f_read(), and f_size(). 13.11.2.2 #dene FILE_OK 0

File Operation OK. Referenced by f_close(), f_open(), k_send_data(), and send_le(). 13.11.3 13.11.3.1 Function Documentation signed char f_close (void)

f_close - close the le Returns: pass/fail References F_ERROR, F_INFO, Fhandle, le, FILE_ERROR, FILE_OK, and NULL. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_close send_file main main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.11

include/le.h File Reference

14

13.11.3.2

signed char f_open (const char f_name)

f_open - open the le Parameters: f_name le name Returns: success/fail References F_ERROR, F_INFO, Fhandle, le, FILE_ERROR, FILE_OK, and NULL. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_open send_file main main

13.11.3.3

signed int f_read (unsigned char buffer, unsigned int read_size)

f_read - read from le Parameters: buffer buffer read_size size to read Returns: num bytes read Parameters: buffer buffer read_size size to read Returns: pass/fail References F_ERROR, F_INFO, Fhandle, le, FILE_ERROR, NULL, and TRUE. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_read send_file main main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.12

include/rev.h File Reference

15

13.11.3.4

signed long f_size (const char f_name)

f_size - returns the size of the le Parameters: f_name - name of the le including path Returns: success/fail References F_ERROR, F_INFO, Fhandle, FILE_ERROR, and NULL. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_size send_file main main

13.12
13.12.1

include/rev.h File Reference


Detailed Description

Nothing other than storing a common rev information. FileName: include/rev.h This graph shows which les directly or indirectly include this le:
include/rev.h

src/pserial.c

src/pusb.c

src/ucmd.c

src/ukermit.c

Denes #dene OMAP_UBOOT_UTILS_REVISION "\n Rev: OMAP U-boot Utils v0.1\n" 13.12.2 13.12.2.1 Dene Documentation #dene OMAP_UBOOT_UTILS_REVISION "\n Rev: OMAP U-boot Utils v0.1\n"

Referenced by help(), and usage().

13.13
13.13.1

include/serial.h File Reference


Detailed Description

Generic header for OS independent APIs to access serial port.

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

16

FileName: include/serial.h These APIs should be implemented by OS specic code This graph shows which les directly or indirectly include this le:
include/serial.h

src/pserial.c

src/ucmd.c

src/ukermit.c

lib/serial_posix.c

lib/serial_win32.c

Denes #dene SERIAL_OK 0 #dene SERIAL_FAILED -1 #dene SERIAL_TIMEDOUT -2 #dene NOPARITY 0 #dene ODDPARITY 1 #dene EVENPARITY 2 #dene ONE_STOP_BIT 0 #dene ONEPFIVE_STOP_BIT 1 #dene TWO_STOP_BIT 2

Functions signed char s_open (char port)


s_open - open a serial port

signed char s_congure (unsigned long baud_rate, unsigned char parity, unsigned char stop_bits, unsigned char data)
s_congure - congure the serial port

signed char s_close (void)


s_close - close the serial port

signed int s_read_remaining (void)


s_read_remaining - get the remaining bytes (TBD)

signed int s_read (unsigned char p_buffer, unsigned long size)


s_read - serial port read

signed int s_write (unsigned char p_buffer, unsigned long size)


s_write - write to serial port

signed int s_getc (void)


s_getc - get a character from serial port

signed int s_putc (char x)


s_putc - put a character into serial port

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

17

signed int s_ush (unsigned int rx_left, unsigned int tx_left)


Flush the serial port data.

13.13.2 13.13.2.1

Dene Documentation #dene EVENPARITY 2

Referenced by main(), and s_congure(). 13.13.2.2 #dene NOPARITY 0

Referenced by main(), and s_congure(). 13.13.2.3 #dene ODDPARITY 1

Referenced by s_congure(). 13.13.2.4 #dene ONE_STOP_BIT 0

Referenced by main(), and s_congure(). 13.13.2.5 13.13.2.6 #dene ONEPFIVE_STOP_BIT 1 #dene SERIAL_FAILED -1

Referenced by s_close(), s_congure(), s_ush(), s_open(), s_read(), s_read_remaining(), s_write(), and send_cmd(). 13.13.2.7 #dene SERIAL_OK 0

Referenced by main(), s_close(), s_congure(), s_ush(), s_open(), s_read(), s_write(), and send_cmd(). 13.13.2.8 13.13.2.9 #dene SERIAL_TIMEDOUT -2 #dene TWO_STOP_BIT 2

Referenced by s_congure(). 13.13.3 13.13.3.1 Function Documentation signed char s_close (void)

s_close - close the serial port Returns: sucess/fail

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

18

References fd, h_serial, NULL, port, R_EVENT_MASK, read_overlapped, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, T_EVENT_MASK, and write_overlapped. Referenced by main(). Here is the caller graph for this function:
s_close main

13.13.3.2 signed char s_congure (unsigned long s_baud_rate, unsigned char s_parity, unsigned char s_stop_bits, unsigned char s_data_bits) s_congure - congure the serial port Parameters: s_baud_rate -baudrate s_parity -parity s_stop_bits -num stop bits s_data_bits -data bits Returns: -success/failure References EVENPARITY, FALSE, fd, h_serial, newtio, NOPARITY, ODDPARITY, ONE_STOP_BIT, port, RX_HW_BUF_SIZE, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, TRUE, TWO_STOP_BIT, and TX_HW_BUF_SIZE. Referenced by main(). Here is the caller graph for this function:
s_configure main

13.13.3.3

signed int s_ush (unsigned int rx_bytes, unsigned int tx_bytes)

Flush the serial port data. Parameters: rx_bytes return bytes that remains(TBD) tx_bytes the bytes that are to be send(TBD) Returns: error/fail References fd, h_serial, port, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. Referenced by main().
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

19

Here is the caller graph for this function:


s_flush main

13.13.3.4

signed int s_getc (void)

s_getc - get a character from serial port Returns: character read or error s_getc - get a character from serial port Returns: character read or error References S_DEBUG, S_ERROR, S_INFO, and s_read(). Referenced by get_response(). Here is the call graph for this function:
s_getc s_read reset_comm_error

Here is the caller graph for this function:


s_getc get_response main

13.13.3.5

signed char s_open (char t_port)

s_open - open a serial port Parameters: t_port -port number Returns: success/fail References FALSE, fd, h_serial, NULL, port, read_overlapped, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, TRUE, and write_overlapped. Referenced by main(). Here is the caller graph for this function:
s_open main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

20

13.13.3.6

signed int s_putc (char x)

s_putc - put a character into serial port Parameters: x - character to write Returns: character written or error s_putc - put a character into serial port Parameters: x -character to write to serial port Returns: -written character or error References S_DEBUG, S_ERROR, S_INFO, and s_write(). Here is the call graph for this function:
s_putc s_write reset_comm_error

13.13.3.7

signed int s_read (unsigned char p_buffer, unsigned long size)

s_read - serial port read Parameters: p_buffer buffer size buffer length Returns: bytes read if ok, else SERIAL_FAILED Parameters: p_buffer buffer size buffer length Returns: success/fail References fd, h_serial, newtio, NULL, port, read_overlapped, reset_comm_error(), RX_HW_BUF_SIZE, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. Referenced by main(), s1_getpacket(), and s_getc().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.13

include/serial.h File Reference

21

Here is the call graph for this function:


s_read reset_comm_error

Here is the caller graph for this function:


main s_read s1_getpacket s_getc kermit_ack_type k_send_data main

13.13.3.8

signed int s_read_remaining (void)

s_read_remaining - get the remaining bytes (TBD) Returns: error or num bytes remaining s_read_remaining - get the remaining bytes (TBD) Returns: num bytes remaining OR error. References fd, reset_comm_error(), S_DEBUG, S_ERROR, and SERIAL_FAILED. Here is the call graph for this function:
s_read_remaining reset_comm_error

13.13.3.9

signed int s_write (unsigned char p_buffer, unsigned long size)

s_write - write to serial port Parameters: p_buffer - buffer pointer size -size of buffer Returns: bytes wrote if ok, else SERIAL_FAILED Parameters: p_buffer - buffer pointer size -size of buffer
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.14

lib/f_status.c File Reference

22

Returns: success/failure References fd, h_serial, NULL, port, R_EVENT_MASK, reset_comm_error(), S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, T_EVENT_MASK, TX_HW_BUF_SIZE, and write_overlapped. Referenced by main(), s1_sendpacket(), s_putc(), send_cmd(), and send_le(). Here is the call graph for this function:
s_write reset_comm_error

Here is the caller graph for this function:


s1_sendpacket k_send_data_packet_small k_send_data main

s_write

s_putc main send_file send_cmd main

13.14
13.14.1

lib/f_status.c File Reference


Detailed Description

lib for showing le transfer status FileName: lib/f_status.c File transfer status apis #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <f_status.h> Include dependency graph for f_status.c:
lib/f_status.c

ctype.h

stdio.h

stdlib.h

unistd.h

string.h

f_status.h

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.14

lib/f_status.c File Reference

23

Denes #dene BACK_SPACE_CHAR \b #dene PRINT_SIZE 100 Functions void f_status_init (signed long total_size, unsigned char special)
f_status_init initialize the status structures

int f_status_show (signed long cur_size)


f_status_show show current status -> to be called by apps when they desire to display

Variables static char print_buff [PRINT_SIZE] static char back_buff [PRINT_SIZE] static signed long tsize static unsigned char s_special Dene Documentation #dene BACK_SPACE_CHAR \b

13.14.2 13.14.2.1

Referenced by f_status_init(), and f_status_show(). 13.14.2.2 13.14.3 13.14.3.1 #dene PRINT_SIZE 100 Function Documentation void f_status_init (signed long total_size, unsigned char special)

f_status_init initialize the status structures Parameters: total_size - total size of the le special - display s_special display -> for apps interfacing with ui stuff References back_buff, BACK_SPACE_CHAR, print_buff, s_special, and tsize. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_status_init send_file main main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.15

lib/le_posix.c File Reference

24

13.14.3.2

int f_status_show (signed long cur_size)

f_status_show show current status -> to be called by apps when they desire to display f_status_show show current status -> to be called by apps when they desire to display Parameters: cur_size - current size Returns: 0 - ok ,1 - not ok.. size was too large References back_buff, BACK_SPACE_CHAR, print_buff, s_special, and tsize. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_status_show send_file main main

13.14.4 13.14.4.1

Variable Documentation char back_buff[PRINT_SIZE] [static]

Referenced by f_status_init(), and f_status_show(). 13.14.4.2 char print_buff[PRINT_SIZE] [static]

Referenced by f_status_init(), and f_status_show(). 13.14.4.3 unsigned char s_special [static]

Referenced by f_status_init(), and f_status_show(). 13.14.4.4 signed long tsize [static]

Referenced by f_status_init(), and f_status_show().

13.15
13.15.1

lib/le_posix.c File Reference


Detailed Description

le io implementation for Linux and POSIX compliant OSes FileName: lib/le_linux.c #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h>
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.15

lib/le_posix.c File Reference

25

#include <unistd.h> #include "file.h" Include dependency graph for le_posix.c:


lib/file_posix.c

stdlib.h

stdio.h

sys/types.h

sys/stat.h

unistd.h

file.h

Denes #dene F_ERROR(ARGS...) perror("File:System Error: ") ; fprintf(stderr,ARGS) #dene F_INFO(ARGS...) Functions signed long f_size (const char f_name)
f_size - returns the size of the le

signed char f_open (const char f_name)


f_open - open the le

signed char f_close (void)


f_close - close the le

signed int f_read (unsigned char buffer, unsigned int read_size)


f_read - read from le

Variables static FILE le 13.15.2 13.15.2.1 Dene Documentation #dene F_ERROR(ARGS...) perror("File:System Error: ") ; fprintf(stderr,ARGS)

Referenced by f_close(), f_open(), f_read(), and f_size(). 13.15.2.2 #dene F_INFO(ARGS...)

Referenced by f_close(), f_open(), f_read(), and f_size(). 13.15.3 13.15.3.1 Function Documentation signed char f_close (void)

f_close - close the le

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.15

lib/le_posix.c File Reference

26

Returns: pass/fail References F_ERROR, F_INFO, le, FILE_ERROR, FILE_OK, and NULL. 13.15.3.2 signed char f_open (const char f_name)

f_open - open the le Parameters: f_name le name Returns: success/fail References F_ERROR, F_INFO, le, FILE_ERROR, FILE_OK, and NULL. 13.15.3.3 signed int f_read (unsigned char buffer, unsigned int read_size)

f_read - read from le Parameters: buffer buffer read_size size to read Returns: num bytes read References F_ERROR, F_INFO, le, FILE_ERROR, and NULL. 13.15.3.4 signed long f_size (const char f_name)

f_size - returns the size of the le Parameters: f_name - name of the le including path Returns: success/fail References F_ERROR, F_INFO, and FILE_ERROR. 13.15.4 13.15.4.1 Variable Documentation FILE le [static]

Referenced by f_close(), f_open(), and f_read().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.16

lib/le_win32.c File Reference

27

13.16
13.16.1

lib/le_win32.c File Reference


Detailed Description

Windows API based implementation of include/le.h. FileName: lib/le_win32.c Support File operations using Win32 APIs. Compiled with MingW #include <windows.h> #include <stdlib.h> #include <stdio.h> #include "file.h" Include dependency graph for le_win32.c:
lib/file_win32.c

windows.h

stdlib.h

stdio.h

file.h

Denes #dene FALSE 0 #dene TRUE 1 #dene NULL ((void )0) #dene F_ERROR(ARGS...) fprintf(stderr,ARGS) #dene F_INFO(ARGS...)

Functions signed long f_size (const char f_name)


f_size - returns the size of the le

signed char f_open (const char f_name)


f_open - open the le

signed char f_close (void)


f_close - close the le

signed int f_read (unsigned char buffer, unsigned int read_size)


f_read - read from le

Variables static HANDLE Fhandle = INVALID_HANDLE_VALUE

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.16

lib/le_win32.c File Reference

28

13.16.2 13.16.2.1 13.16.2.2 13.16.2.3

Dene Documentation #dene F_ERROR(ARGS...) fprintf(stderr,ARGS) #dene F_INFO(ARGS...) #dene FALSE 0

Referenced by s_congure(), and s_open(). 13.16.2.4 #dene NULL ((void )0)

Referenced by f_close(), f_open(), f_read(), f_size(), k_send_data_packet_small(), main(), s_close(), s_open(), s_read(), s_write(), send_cmd(), and usb_sleep(). 13.16.2.5 #dene TRUE 1

Referenced by f_read(), s_congure(), and s_open(). 13.16.3 13.16.3.1 Function Documentation signed char f_close (void)

f_close - close the le Returns: pass/fail References F_ERROR, F_INFO, Fhandle, FILE_ERROR, and FILE_OK. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_close send_file main main

13.16.3.2

signed char f_open (const char f_name)

f_open - open the le Parameters: f_name le name Returns: success/fail

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.16

lib/le_win32.c File Reference

29

References F_ERROR, F_INFO, Fhandle, FILE_ERROR, FILE_OK, and NULL. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_open send_file main main

13.16.3.3

signed int f_read (unsigned char buffer, unsigned int read_size)

f_read - read from le Parameters: buffer buffer read_size size to read Returns: pass/fail References F_ERROR, F_INFO, Fhandle, FILE_ERROR, NULL, and TRUE. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_read send_file main main

13.16.3.4

signed long f_size (const char f_name)

f_size - returns the size of the le Parameters: f_name - name of the le including path Returns: success/fail References F_ERROR, F_INFO, Fhandle, FILE_ERROR, and NULL. Referenced by k_send_data(), and send_le(). Here is the caller graph for this function:
k_send_data f_size send_file main main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.17

lib/serial_posix.c File Reference

30

13.16.4 13.16.4.1

Variable Documentation HANDLE Fhandle = INVALID_HANDLE_VALUE [static]

Referenced by f_close(), f_open(), f_read(), and f_size().

13.17
13.17.1

lib/serial_posix.c File Reference


Detailed Description

Serial port operations wrapper for Linux/posix compliant OSs. FileName: lib/serial_linux.c This implements the APIs in include/serial.h for linux and posix compliant OSes. The code here is heavily indebted to: http://tldp.org/HOWTO/Serial-Programming-HOWTO/x115.html#AEN129 http://www.comptechdoc.org/os/linux/programming/c/linux_pgcserial.html #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <errno.h> #include <serial.h> Include dependency graph for serial_posix.c:
lib/serial_posix.c

sys/types.h

sys/stat.h

fcntl.h

termios.h

stdio.h

string.h

unistd.h

errno.h

serial.h

Denes #dene S_ERROR(ARGS...) perror("Serial: System Error"); fprintf(stderr,ARGS) #dene S_INFO(ARGS...) Functions signed char s_open (char t_port)
s_open - open a serial port

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.17

lib/serial_posix.c File Reference

31

signed char s_congure (unsigned long s_baud_rate, unsigned char s_parity, unsigned char s_stop_bits, unsigned char s_data_bits)
s_congure - congure the serial port

signed int s_ush (unsigned int rx_bytes, unsigned int tx_bytes)


Flush the serial port data.

signed char s_close (void)


s_close - close the serial port

signed int s_read (unsigned char p_buffer, unsigned long size)


s_read - serial port read

signed int s_write (unsigned char p_buffer, unsigned long size)


s_write - write to serial port

signed int s_read_remaining (void)


s_read_remaining - get the remaining bytes (TBD)

signed int s_getc (void)


s_getc - get a character from serial port

signed int s_putc (char x)


s_putc - put a character into serial port

Variables static unsigned char port [30] static int fd static struct termios oldtio newtio 13.17.2 13.17.2.1 Dene Documentation #dene S_ERROR(ARGS...) perror("Serial: System Error"); fprintf(stderr,ARGS)

Referenced by reset_comm_error(), s_close(), s_congure(), s_ush(), s_getc(), s_open(), s_putc(), s_read(), s_read_remaining(), and s_write(). 13.17.2.2 #dene S_INFO(ARGS...)

Referenced by s_close(), s_congure(), s_ush(), s_getc(), s_open(), s_putc(), s_read(), and s_write(). 13.17.3 13.17.3.1 Function Documentation signed char s_close (void)

s_close - close the serial port Returns: sucess/fail


Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.17

lib/serial_posix.c File Reference

32

References fd, port, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. 13.17.3.2 signed char s_congure (unsigned long s_baud_rate, unsigned char s_parity, unsigned char s_stop_bits, unsigned char s_data_bits) s_congure - congure the serial port Parameters: s_baud_rate -baudrate s_parity -parity s_stop_bits -num stop bits s_data_bits -data bits Returns: -success/failure References EVENPARITY, fd, newtio, NOPARITY, ODDPARITY, ONE_STOP_BIT, port, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, and TWO_STOP_BIT. 13.17.3.3 signed int s_ush (unsigned int rx_bytes, unsigned int tx_bytes)

Flush the serial port data. Parameters: rx_bytes return bytes that remains(TBD) tx_bytes the bytes that are to be send(TBD) Returns: error/fail References fd, port, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. 13.17.3.4 signed int s_getc (void)

s_getc - get a character from serial port Returns: character read or error References S_ERROR, S_INFO, and s_read(). Here is the call graph for this function:
s_getc s_read reset_comm_error

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.17

lib/serial_posix.c File Reference

33

13.17.3.5

signed char s_open (char t_port)

s_open - open a serial port Parameters: t_port -port number Returns: success/fail References fd, port, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. 13.17.3.6 signed int s_putc (char x)

s_putc - put a character into serial port Parameters: x - character to write Returns: character written or error References S_ERROR, S_INFO, and s_write(). Here is the call graph for this function:
s_putc s_write reset_comm_error

13.17.3.7

signed int s_read (unsigned char p_buffer, unsigned long size)

s_read - serial port read Parameters: p_buffer buffer size buffer length Returns: bytes read if ok, else SERIAL_FAILED References fd, newtio, S_ERROR, S_INFO, and SERIAL_FAILED. 13.17.3.8 signed int s_read_remaining (void)

s_read_remaining - get the remaining bytes (TBD) Returns: error or num bytes remaining References fd, S_ERROR, and SERIAL_FAILED.
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

34

13.17.3.9

signed int s_write (unsigned char p_buffer, unsigned long size)

s_write - write to serial port Parameters: p_buffer - buffer pointer size -size of buffer Returns: bytes wrote if ok, else SERIAL_FAILED References fd, NULL, S_ERROR, S_INFO, and SERIAL_FAILED. 13.17.4 13.17.4.1 Variable Documentation int fd [static]

Referenced by s_close(), s_congure(), s_ush(), s_open(), s_read(), s_read_remaining(), and s_write(). 13.17.4.2 struct termios oldtio newtio [static]

Referenced by s_congure(), and s_read(). 13.17.4.3 unsigned char port[30] [static]

Referenced by main(), reset_comm_error(), s_close(), s_congure(), s_ush(), s_open(), s_read(), and s_write().

13.18
13.18.1

lib/serial_win32.c File Reference


Detailed Description

Win32 based serial port operations. FileName: lib/serial_win32.c I am heavily indebted to MSDN for guiding me on this. http://msdn.microsoft.com/ #include <windows.h> #include <stdlib.h> #include <stdio.h> #include "serial.h" Include dependency graph for serial_win32.c:
lib/serial_win32.c

windows.h

stdlib.h

stdio.h

serial.h

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

35

Denes #dene FALSE 0 #dene TRUE 1 #dene NULL ((void )0) #dene S_ERROR(ARGS...) fprintf(stderr,ARGS) #dene S_INFO(ARGS...) #dene S_DEBUG(ARGS...) #dene BUF_SIZE (80962) #dene RX_HW_BUF_SIZE BUF_SIZE #dene TX_HW_BUF_SIZE BUF_SIZE #dene R_EVENT_MASK EV_RXCHAR #dene T_EVENT_MASK EV_TXEMPTY

Functions static signed int reset_comm_error (unsigned int rx_bytes, unsigned int tx_bytes)
reset_comm_error - Reset comport errors

signed char s_open (char t_port)


s_open - open a serial port

signed char s_congure (unsigned long s_baud_rate, unsigned char s_parity, unsigned char s_stop_bits, unsigned char s_data_bits)
s_congure - congure the serial port

signed int s_ush (unsigned int rx_bytes, unsigned int tx_bytes)


Flush the serial port data.

signed char s_close (void)


s_close - close the serial port

signed int s_read (unsigned char p_buffer, unsigned long size)


s_read - serial port read

signed int s_write (unsigned char p_buffer, unsigned long size)


s_write - write to serial port

signed int s_read_remaining (void)


s_read_remaining - read remaining bytes

signed int s_getc (void)


s_getc - get a single character

signed int s_putc (char x)


s_putc put a single character

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

36

Variables static unsigned char port [30] static HANDLE h_serial static OVERLAPPED read_overlapped static OVERLAPPED write_overlapped Dene Documentation #dene BUF_SIZE (80962) #dene FALSE 0 #dene NULL ((void )0) #dene R_EVENT_MASK EV_RXCHAR

13.18.2 13.18.2.1 13.18.2.2 13.18.2.3 13.18.2.4

Referenced by s_close(), and s_write(). 13.18.2.5 #dene RX_HW_BUF_SIZE BUF_SIZE

Referenced by s_congure(), and s_read(). 13.18.2.6 #dene S_DEBUG(ARGS...)

Referenced by s_close(), s_congure(), s_ush(), s_getc(), s_open(), s_putc(), s_read(), s_read_remaining(), and s_write(). 13.18.2.7 13.18.2.8 13.18.2.9 #dene S_ERROR(ARGS...) fprintf(stderr,ARGS) #dene S_INFO(ARGS...) #dene T_EVENT_MASK EV_TXEMPTY

Referenced by s_close(), and s_write(). 13.18.2.10 13.18.2.11 #dene TRUE 1 #dene TX_HW_BUF_SIZE BUF_SIZE

Referenced by s_congure(), and s_write(). 13.18.3 Function Documentation

13.18.3.1 static signed int reset_comm_error (unsigned int rx_bytes, unsigned int tx_bytes) [static] reset_comm_error - Reset comport errors

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

37

Parameters: rx_bytes - read the bytes left tx_bytes - read the bytes left Returns: success/failure References h_serial, port, and S_ERROR. Referenced by s_read(), s_read_remaining(), and s_write(). Here is the caller graph for this function:
s1_getpacket

kermit_ack_type s_read s_getc send_file s_putc reset_comm_error s_write k_send_data_packet_small s_read_remaining s1_sendpacket send_cmd main k_send_data main main

13.18.3.2

signed char s_close (void)

s_close - close the serial port Returns: sucess/fail References h_serial, NULL, port, R_EVENT_MASK, read_overlapped, S_DEBUG, S_ERROR, S_INFO, SERIAL_OK, T_EVENT_MASK, and write_overlapped. Referenced by main(). Here is the caller graph for this function:
s_close main

13.18.3.3 signed char s_congure (unsigned long s_baud_rate, unsigned char s_parity, unsigned char s_stop_bits, unsigned char s_data_bits) s_congure - congure the serial port Parameters: s_baud_rate -baudrate
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

38

s_parity -parity s_stop_bits -num stop bits s_data_bits -data bits Returns: -success/failure References FALSE, h_serial, NOPARITY, port, RX_HW_BUF_SIZE, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, TRUE, and TX_HW_BUF_SIZE. Referenced by main(). Here is the caller graph for this function:
s_configure main

13.18.3.4

signed int s_ush (unsigned int rx_bytes, unsigned int tx_bytes)

Flush the serial port data. Parameters: rx_bytes return bytes that remains(TBD) tx_bytes the bytes that are to be send(TBD) Returns: error/fail References h_serial, and S_DEBUG. Referenced by main(). Here is the caller graph for this function:
s_flush main

13.18.3.5

signed int s_getc (void)

s_getc - get a single character s_getc - get a character from serial port Returns: character read or error References S_DEBUG, S_ERROR, and s_read(). Referenced by get_response().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

39

Here is the call graph for this function:


s_getc s_read reset_comm_error

Here is the caller graph for this function:


s_getc get_response main

13.18.3.6

signed char s_open (char t_port)

s_open - open a serial port Parameters: t_port -port number Returns: success/fail References FALSE, h_serial, NULL, port, read_overlapped, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, TRUE, and write_overlapped. Referenced by main(). Here is the caller graph for this function:
s_open main

13.18.3.7

signed int s_putc (char x)

s_putc put a single character s_putc - put a character into serial port Parameters: x -character to write to serial port Returns: -written character or error References S_DEBUG, S_ERROR, and s_write(). Here is the call graph for this function:
s_putc s_write reset_comm_error

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.18

lib/serial_win32.c File Reference

40

13.18.3.8

signed int s_read (unsigned char p_buffer, unsigned long size)

s_read - serial port read Parameters: p_buffer buffer size buffer length Returns: success/fail References h_serial, NULL, port, read_overlapped, reset_comm_error(), RX_HW_BUF_SIZE, S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, and SERIAL_OK. Referenced by main(), s1_getpacket(), and s_getc(). Here is the call graph for this function:
s_read reset_comm_error

Here is the caller graph for this function:


main s_read s1_getpacket s_getc kermit_ack_type k_send_data main

13.18.3.9

signed int s_read_remaining (void)

s_read_remaining - read remaining bytes s_read_remaining - get the remaining bytes (TBD) Returns: num bytes remaining OR error. References reset_comm_error(), and S_DEBUG. Here is the call graph for this function:
s_read_remaining reset_comm_error

13.18.3.10

signed int s_write (unsigned char p_buffer, unsigned long size)

s_write - write to serial port Parameters: p_buffer - buffer pointer


Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.19

src/pserial.c File Reference

41

size -size of buffer Returns: success/failure References h_serial, NULL, port, R_EVENT_MASK, reset_comm_error(), S_DEBUG, S_ERROR, S_INFO, SERIAL_FAILED, SERIAL_OK, T_EVENT_MASK, TX_HW_BUF_SIZE, and write_overlapped. Referenced by main(), s1_sendpacket(), s_putc(), send_cmd(), and send_le(). Here is the call graph for this function:
s_write reset_comm_error

Here is the caller graph for this function:


s1_sendpacket k_send_data_packet_small k_send_data main

s_write

s_putc main send_file send_cmd main

13.18.4 13.18.4.1

Variable Documentation HANDLE h_serial [static]

Referenced by reset_comm_error(), s_close(), s_congure(), s_ush(), s_open(), s_read(), and s_write(). 13.18.4.2 13.18.4.3 unsigned char port[30] [static] OVERLAPPED read_overlapped [static]

Referenced by s_close(), s_open(), and s_read(). 13.18.4.4 OVERLAPPED write_overlapped [static]

Referenced by s_close(), s_open(), and s_write().

13.19
13.19.1

src/pserial.c File Reference


Detailed Description

Peripheral Boot downloader over UART. FileName: src/pserial.c

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.19

src/pserial.c File Reference

42

Application which uses Peripheral mode conguration to download an image using the OMAP ROM Code protocol #include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include "rev.h" #include "serial.h" #include "file.h" #include "f_status.h" Include dependency graph for pserial.c:
src/pserial.c

ctype.h

stdlib.h

stdio.h

unistd.h

string.h

rev.h

serial.h

file.h

f_status.h

Denes #dene ASIC_ID_SIZE 58 #dene MAX_BUF 2048 #dene TOT_SIZE MAX_BUF #dene PRINT_SIZE 100 #dene PORT_ARG "p" #dene PORT_ARG_C p #dene SEC_ARG "f" #dene SEC_ARG_C f #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS) #dene PORT_NAME "/dev/ttyS0" #dene F_NAME "/tmp/u-boot.bin"

Functions static int send_le (char f_name)


send_le - send a le to the host

static void usage (char appname)


usage - help info

int main (int argc, char argv)


main application entry

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.19

src/pserial.c File Reference

43

13.19.2 13.19.2.1

Dene Documentation #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS)

Referenced by get_response(), k_send_data(), k_send_data_packet_small(), kermit_ack_type(), main(), send_cmd(), and send_le(). 13.19.2.2 #dene ASIC_ID_SIZE 58

Referenced by main(). 13.19.2.3 #dene F_NAME "/tmp/u-boot.bin"

Referenced by usage(). 13.19.2.4 #dene MAX_BUF 2048

Referenced by main(). 13.19.2.5 #dene PORT_ARG "p"

Referenced by main(), and usage(). 13.19.2.6 #dene PORT_ARG_C p

Referenced by main(). 13.19.2.7 #dene PORT_NAME "/dev/ttyS0"

Referenced by usage(). 13.19.2.8 13.19.2.9 #dene PRINT_SIZE 100 #dene SEC_ARG "f"

Referenced by main(), and usage(). 13.19.2.10 #dene SEC_ARG_C f

Referenced by main(). 13.19.2.11 #dene TOT_SIZE MAX_BUF

Referenced by send_le(). 13.19.3 13.19.3.1 Function Documentation int main (int argc, char argv)

main application entry

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.19

src/pserial.c File Reference

44

Parameters: argc argv Returns: pass/fail References APP_ERROR, ASIC_ID_SIZE, EVENPARITY, MAX_BUF, NULL, ONE_STOP_BIT, port, PORT_ARG, PORT_ARG_C, s_close(), s_congure(), s_open(), s_read(), s_write(), SEC_ARG, SEC_ARG_C, send_le(), SERIAL_OK, and usage(). Here is the call graph for this function:
s_close s_configure s_open main s_read s_write f_close send_file usage f_open f_read f_size f_status_init f_status_show

reset_comm_error

13.19.3.2

static int send_le (char f_name) [static]

send_le - send a le to the host Parameters: f_name le to send Returns: fail/success References APP_ERROR, f_close(), f_open(), f_read(), f_size(), f_status_init(), f_status_show(), FILE_OK, NORMAL_PRINT, s_write(), and TOT_SIZE. Referenced by main().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

45

Here is the call graph for this function:


f_close f_open f_read send_file f_size f_status_init f_status_show s_write reset_comm_error

Here is the caller graph for this function:


send_file main

13.19.3.3

static void usage (char appname) [static]

usage - help info Parameters: appname my name References F_NAME, OMAP_UBOOT_UTILS_REVISION, PORT_ARG, PORT_NAME, and SEC_ARG. Referenced by main(). Here is the caller graph for this function:
usage main

13.20
13.20.1

src/pusb.c File Reference


Detailed Description

Peripheral Boot downloader over USB. FileName: src/pserial.c OMAP USB peripheral booting helper using libusb example USB module usage based on testlibusb.c Caveat: NOTE: Windows support is still a work in progress #include <sys/types.h> #include <sys/stat.h> #include <ctype.h>
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

46

#include <stdio.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <usb.h> #include <time.h> #include "rev.h" #include "file.h" #include "f_status.h" Include dependency graph for pusb.c:
src/pusb.c

sys/types.h

sys/stat.h

ctype.h

stdio.h

errno.h

string.h

unistd.h

usb.h

time.h

rev.h

file.h

f_status.h

Denes #dene SEARCH_VENDOR_DEFAULT 0x0451 #dene SEARCH_PRODUCT_DEFAULT 0xD009 #dene CONFIG_INDEX_DEFAULT 0x1 #dene INTERFACE_INDEX_DEFAULT 0x0 #dene DEVICE_IN_ENDPOINT 0x81 #dene DEVICE_OUT_ENDPOINT 0x1 #dene ASICID_SIZE 69 #dene ASIC_ID_TIMEOUT 100 #dene DOWNLOAD_COMMAND 0xF0030002 #dene MAX_SIZE (64 1024) #dene READ_BUFFER_SIZE 4096 #dene V_PRINT(ARGS...) if (verbose >= 1) printf(ARGS) #dene N_PRINT(ARGS...) if (verbose >= 0) printf(ARGS) #dene E_PRINT(ARGS...) printf("%s:%d:",__func__,__LINE__);printf(ARGS)

Functions static void usb_sleep (unsigned int ms)


sleep for a denite time

void print_endpoint (struct usb_endpoint_descriptor endpoint) void print_altsetting (struct usb_interface_descriptor interface) void print_interface (struct usb_interface interface) void print_conguration (struct usb_cong_descriptor cong) int print_device (struct usb_device dev, int level) int search_device (struct usb_device dev, int level) int congure_device (struct usb_device dev) int send_le (struct usb_device dev, char f_name) void help (void) int main (int argc, char argv[ ])

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

47

Variables static int verbose = 0 static unsigned int search_vendor = SEARCH_VENDOR_DEFAULT static unsigned int search_product = SEARCH_PRODUCT_DEFAULT static int cong_idx = CONFIG_INDEX_DEFAULT static struct usb_device found_dev = NULL static char program_name Dene Documentation #dene ASIC_ID_TIMEOUT 100

13.20.2 13.20.2.1

Referenced by send_le(). 13.20.2.2 #dene ASICID_SIZE 69

Referenced by send_le(). 13.20.2.3 13.20.2.4 #dene CONFIG_INDEX_DEFAULT 0x1 #dene DEVICE_IN_ENDPOINT 0x81

Referenced by send_le(). 13.20.2.5 #dene DEVICE_OUT_ENDPOINT 0x1

Referenced by send_le(). 13.20.2.6 #dene DOWNLOAD_COMMAND 0xF0030002

Referenced by send_le(). 13.20.2.7 #dene E_PRINT(ARGS...) printf("%s:%d:",__func__,__LINE__);printf(ARGS)

Referenced by congure_device(), main(), and send_le(). 13.20.2.8 #dene INTERFACE_INDEX_DEFAULT 0x0

Referenced by send_le(). 13.20.2.9 #dene MAX_SIZE (64 1024)

Referenced by send_le(). 13.20.2.10 #dene N_PRINT(ARGS...) if (verbose >= 0) printf(ARGS)

Referenced by main(), and print_device(). 13.20.2.11 #dene READ_BUFFER_SIZE 4096

Referenced by send_le().
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

48

13.20.2.12 13.20.2.13 13.20.2.14

#dene SEARCH_PRODUCT_DEFAULT 0xD009 #dene SEARCH_VENDOR_DEFAULT 0x0451 #dene V_PRINT(ARGS...) if (verbose >= 1) printf(ARGS)

Referenced by main(), and search_device(). 13.20.3 13.20.3.1 Function Documentation int congure_device (struct usb_device dev)

References cong_idx, and E_PRINT. Referenced by main(). Here is the caller graph for this function:
configure_device main

13.20.3.2

void help (void)

References OMAP_UBOOT_UTILS_REVISION, program_name, and search_product. Referenced by main(). Here is the caller graph for this function:
help main

13.20.3.3

int main (int argc, char argv[ ])

References congure_device(), E_PRINT, found_dev, help(), N_PRINT, NULL, print_device(), program_name, search_device(), search_product, search_vendor, send_le(), usb_sleep(), V_PRINT, and verbose. Here is the call graph for this function:
configure_device print_configuration help f_close print_device main search_device f_read send_file f_size usb_sleep f_status_init f_status_show s_write reset_comm_error f_open print_interface print_altsetting print_endpoint

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

49

13.20.3.4

void print_altsetting (struct usb_interface_descriptor interface)

References print_endpoint(). Referenced by print_interface(). Here is the call graph for this function:
print_altsetting print_endpoint

Here is the caller graph for this function:


print_altsetting print_interface print_configuration print_device main

13.20.3.5

void print_conguration (struct usb_cong_descriptor cong)

References print_interface(). Referenced by print_device(). Here is the call graph for this function:
print_configuration print_interface print_altsetting print_endpoint

Here is the caller graph for this function:


print_configuration print_device main

13.20.3.6

int print_device (struct usb_device dev, int level)

References N_PRINT, print_conguration(), and verbose. Referenced by main(). Here is the call graph for this function:
print_device print_configuration print_interface print_altsetting print_endpoint

Here is the caller graph for this function:


print_device main

13.20.3.7

void print_endpoint (struct usb_endpoint_descriptor endpoint)

Referenced by print_altsetting().
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.20

src/pusb.c File Reference

50

Here is the caller graph for this function:


print_endpoint print_altsetting print_interface print_configuration print_device main

13.20.3.8

void print_interface (struct usb_interface interface)

References print_altsetting(). Referenced by print_conguration(). Here is the call graph for this function:
print_interface print_altsetting print_endpoint

Here is the caller graph for this function:


print_interface print_configuration print_device main

13.20.3.9

int search_device (struct usb_device dev, int level)

References found_dev, search_product, search_vendor, V_PRINT, and verbose. Referenced by main(). Here is the caller graph for this function:
search_device main

13.20.3.10

int send_le (struct usb_device dev, char f_name)

References ASIC_ID_TIMEOUT, ASICID_SIZE, DEVICE_IN_ENDPOINT, DEVICE_OUT_ENDPOINT, DOWNLOAD_COMMAND, E_PRINT, f_close(), f_open(), f_read(), f_size(), f_status_init(), f_status_show(), INTERFACE_INDEX_DEFAULT, MAX_SIZE, NORMAL_PRINT, READ_BUFFER_SIZE, and verbose. Here is the call graph for this function:
f_close f_open f_read send_file f_size f_status_init f_status_show

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.21

src/ucmd.c File Reference

51

13.20.3.11

static void usb_sleep (unsigned int ms) [static]

sleep for a denite time Parameters: ms delay in ms Returns: none References NULL. Referenced by main(). Here is the caller graph for this function:
usb_sleep main

13.20.4 13.20.4.1

Variable Documentation int cong_idx = CONFIG_INDEX_DEFAULT [static]

Referenced by congure_device(). 13.20.4.2 struct usb_device found_dev = NULL [static]

Referenced by main(), and search_device(). 13.20.4.3 char program_name [static]

Referenced by help(), and main(). 13.20.4.4 unsigned int search_product = SEARCH_PRODUCT_DEFAULT [static]

Referenced by help(), main(), and search_device(). 13.20.4.5 unsigned int search_vendor = SEARCH_VENDOR_DEFAULT [static]

Referenced by main(), and search_device(). 13.20.4.6 int verbose = 0 [static]

Referenced by main(), print_device(), search_device(), and send_le().

13.21
13.21.1

src/ucmd.c File Reference


Detailed Description

Tiny little app which sends a command to uboot and waits for a response. FileName: src/ucmd.c
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.21

src/ucmd.c File Reference

52

This sends a command to the serial port for uboot and exepects a matching response #include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include "rev.h" #include "serial.h" Include dependency graph for ucmd.c:
src/ucmd.c

ctype.h

stdlib.h

stdio.h

unistd.h

string.h

rev.h

serial.h

Denes #dene PORT_ARG "p" #dene PORT_ARG_C p #dene CMD_ARG "c" #dene CMD_ARG_C c #dene EXP_ARG "e" #dene EXP_ARG_C e #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS) #dene PORT_NAME "/dev/ttyS0"

Functions static int send_cmd (char cmd)


send_cmd - send the command to uboot

static int get_response (char expected)


get_response - get the response from uboot

static void usage (char appname)


usage - help info

int main (int argc, char argv)


main application entry

13.21.2 13.21.2.1

Dene Documentation #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS)

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.21

src/ucmd.c File Reference

53

13.21.2.2

#dene CMD_ARG "c"

Referenced by main(), and usage(). 13.21.2.3 #dene CMD_ARG_C c

Referenced by main(). 13.21.2.4 #dene EXP_ARG "e"

Referenced by main(), and usage(). 13.21.2.5 #dene EXP_ARG_C e

Referenced by main(). 13.21.2.6 13.21.2.7 13.21.2.8 13.21.3 13.21.3.1 #dene PORT_ARG "p" #dene PORT_ARG_C p #dene PORT_NAME "/dev/ttyS0" Function Documentation static int get_response (char expected) [static]

get_response - get the response from uboot Parameters: expected - expected string from uboot Returns: -match or fail References APP_ERROR, and s_getc(). Referenced by main(). Here is the call graph for this function:
get_response s_getc s_read reset_comm_error

Here is the caller graph for this function:


get_response main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.21

src/ucmd.c File Reference

54

13.21.3.2

int main (int argc, char argv)

main application entry Parameters: argc argv Returns: pass/fail References APP_ERROR, CMD_ARG, CMD_ARG_C, EXP_ARG, EXP_ARG_C, get_response(), NOPARITY, NULL, ONE_STOP_BIT, port, PORT_ARG, PORT_ARG_C, s_close(), s_congure(), s_ush(), s_open(), send_cmd(), SERIAL_OK, and usage(). Here is the call graph for this function:
get_response s_close s_configure main s_flush s_open s_write s_getc s_read reset_comm_error send_cmd

usage

13.21.3.3

static int send_cmd (char cmd) [static]

send_cmd - send the command to uboot Parameters: cmd - command to send Returns: - result References APP_ERROR, NULL, s_write(), SERIAL_FAILED, and SERIAL_OK. Referenced by main(). Here is the call graph for this function:
send_cmd s_write reset_comm_error

Here is the caller graph for this function:


send_cmd main

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

55

13.21.3.4

static void usage (char appname) [static]

usage - help info Parameters: appname my name References CMD_ARG, EXP_ARG, OMAP_UBOOT_UTILS_REVISION, PORT_ARG, and PORT_NAME.

13.22
13.22.1

src/ukermit.c File Reference


Detailed Description

Reverse of kermit protocol implemented by uboot. FileName: src/ukermit.c Ref: http://git.denx.de/?p=u-boot/u-boot-v2.git;f=commands/loadb.c;hb=HEAD Much of this code is based on loadb.c in U-Boot. This provides the reverse logic of providing data packets alone to the host. we support Kermit Data packet format only. Typical usage is to run loadb in uboot, close the same and run this app Kermit Protocol consists of multiple packets owing back and froth b/w a Host a client. First implemented by columbia university can be seen here: http://www.columbia.edu/kermit/ Motivation: For a full edged implementation, look for ckermit(Linux), kermit95(win), gkermit or ekermit. Many terminal applications such as Hyperterminal(win) support kermit. However, in many cases, users desire to have a simple app which can send data to uboot by exploiting the crc checks over serial. Details: This code is written by reversing the sequence of data reception expected by U-Boot. it may not be compatible with standard kermit protocol Kermit protocol in its simplest form is described as a transmission followed by a end of transmission character. Each transmission consists of multiple packets. Each packet can be a session initiation, data packet or many other packet types. This application supports only sending data packets. So, it is not complete on its own, but this is ne, since U-Boot cares only for data packets. Every packet is an individual entity of its own. Every packet has a start and end packet marker. Data packets come in two avors - large packets and small packets. Data packets have their own header kermit_data_header_small structure shows how it looks like. Following the header, there is a bunch of data bytes which end with a CRC and end character. The data bytes could create confusing state for kermit protocol, hence the control characters are specially encoded by the protocol. encoding is simple: an escape character is prexed to characters which are specially encoded. If the reciever gets the packet properly, it acknowledges the receipt of packet. The kermit_ack_nack_type packet describes how it looks like. If a NAK(negative acknowledgement) or the recieved ack packet itself is corrupted, the transmitter retries the old packet. The packet sequence number allows for the sender and reciever to keep track of the packet ow sequence. #include <ctype.h> #include <stdio.h>
Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

56

#include <stdlib.h> #include <unistd.h> #include <string.h> #include "rev.h" #include "serial.h" #include "file.h" #include "f_status.h" Include dependency graph for ukermit.c:
src/ukermit.c

ctype.h

stdio.h

stdlib.h

unistd.h

string.h

rev.h

serial.h

file.h

f_status.h

Data Structures struct kermit_data_header_small


Kermit data packet header.

struct kermit_ack_nack_type
Kermit ack packet type.

Denes #dene XON_CHAR 17 #dene XOFF_CHAR 19 #dene START_CHAR 0x01 #dene ETX_CHAR 0x03 #dene END_CHAR 0x0D #dene SPACE 0x20 #dene K_ESCAPE 0x23 #dene SEND_TYPE S #dene DATA_TYPE D #dene ACK_TYPE Y #dene NACK_TYPE N #dene BREAK_TYPE B #dene tochar(x) ((char) (((x) + SPACE) & 0xff)) #dene untochar(x) ((int) (((x) - SPACE) & 0xff)) #dene escape_it(ch) ((ch) 0x40 ) #dene SEQ_ERROR 0x40 #dene CHK_ERROR 0x41 #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS) #dene MAX_CHUNK 100 #dene RETRY_MAX 4 #dene PRINT_SIZE 100

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

57

#dene PORT_ARG "p" #dene PORT_ARG_C p #dene DNLD_ARG "f" #dene DNLD_ARG_C f #dene DLY_ARG "d" #dene DLY_ARG_C d #dene PORT_NAME "/dev/ttyS0" #dene F_NAME "/tmp/u-boot.bin"

Functions static void s1_getpacket (char packet, int size)


s1_getpacket - get a packet from the target s_read is expected to be blocking in this case

static void s1_sendpacket (char packet, int size)


s1_sendpacket - send a data packet to the target

static int should_escape (char out)


should_escape - decides if a binary character should be escaped as per kermit protocol

static char k_escape (char out)


k_escape - provide escape character convertion

static signed int k_send_data_packet_small (unsigned char buffer, unsigned int size, unsigned char sequence)
k_send_data_packet_small - send a small data packet

static void print_ack_packet (struct kermit_ack_nack_type k_ack)


print_ack_packet - Debug print of the ack packet from target

static signed int kermit_ack_type (int seq_num)


kermit_ack_type - Analyse the ack packet

static signed int k_send_data (char f_name)


k_send_data - send a le to the target using kermit

static void usage (char appname)


usage help

int main (int argc, char argv)


application entry

Variables static unsigned int delay

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

58

13.22.2 13.22.2.1

Dene Documentation #dene ACK_TYPE Y

Referenced by k_send_data(), and kermit_ack_type(). 13.22.2.2 13.22.2.3 13.22.2.4 #dene APP_ERROR(ARGS...) fprintf(stderr,ARGS) #dene BREAK_TYPE B #dene CHK_ERROR 0x41

Referenced by kermit_ack_type(). 13.22.2.5 #dene DATA_TYPE D

Referenced by k_send_data_packet_small(). 13.22.2.6 #dene DLY_ARG "d"

Referenced by main(), and usage(). 13.22.2.7 #dene DLY_ARG_C d

Referenced by main(). 13.22.2.8 #dene DNLD_ARG "f"

Referenced by main(), and usage(). 13.22.2.9 #dene DNLD_ARG_C f

Referenced by main(). 13.22.2.10 #dene END_CHAR 0x0D

Referenced by k_send_data_packet_small(). 13.22.2.11 #dene escape_it(ch) ((ch) 0x40 )

Referenced by k_escape(). 13.22.2.12 #dene ETX_CHAR 0x03

Referenced by k_send_data(). 13.22.2.13 13.22.2.14 #dene F_NAME "/tmp/u-boot.bin" #dene K_ESCAPE 0x23

Referenced by k_escape(), k_send_data_packet_small(), and should_escape().


Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

59

13.22.2.15

#dene MAX_CHUNK 100

Referenced by k_send_data(). 13.22.2.16 #dene NACK_TYPE N

Referenced by kermit_ack_type(). 13.22.2.17 13.22.2.18 13.22.2.19 13.22.2.20 13.22.2.21 #dene PORT_ARG "p" #dene PORT_ARG_C p #dene PORT_NAME "/dev/ttyS0" #dene PRINT_SIZE 100 #dene RETRY_MAX 4

Referenced by k_send_data(). 13.22.2.22 13.22.2.23 #dene SEND_TYPE S #dene SEQ_ERROR 0x40

Referenced by kermit_ack_type(). 13.22.2.24 #dene SPACE 0x20

Referenced by should_escape(). 13.22.2.25 #dene START_CHAR 0x01

Referenced by k_send_data_packet_small(). 13.22.2.26 #dene tochar(x) ((char) (((x) + SPACE) & 0xff))

Referenced by k_send_data_packet_small(), and kermit_ack_type(). 13.22.2.27 #dene untochar(x) ((int) (((x) - SPACE) & 0xff))

Referenced by k_send_data_packet_small(), kermit_ack_type(), and print_ack_packet(). 13.22.2.28 13.22.2.29 #dene XOFF_CHAR 19 #dene XON_CHAR 17

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

60

13.22.3 13.22.3.1

Function Documentation static char k_escape (char out) [static]

k_escape - provide escape character convertion Parameters: out - character to be escaped Returns: -escaped character References escape_it, and K_ESCAPE. Referenced by k_send_data_packet_small(). Here is the caller graph for this function:
k_escape k_send_data_packet_small k_send_data main

13.22.3.2

static signed int k_send_data (char f_name) [static]

k_send_data - send a le to the target using kermit Parameters: f_name - le name to send Returns: -success/failure References ACK_TYPE, APP_ERROR, ETX_CHAR, f_close(), f_open(), f_read(), f_size(), f_status_init(), f_status_show(), FILE_OK, k_send_data_packet_small(), kermit_ack_type(), MAX_CHUNK, NORMAL_PRINT, RETRY_MAX, and s1_sendpacket(). Referenced by main().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

61

Here is the call graph for this function:


f_close f_open f_read f_size k_send_data f_status_init f_status_show k_send_data_packet_small k_escape should_escape s1_sendpacket print_ack_packet s_read s1_getpacket

s_write reset_comm_error

kermit_ack_type

Here is the caller graph for this function:


k_send_data main

13.22.3.3 static signed int k_send_data_packet_small (unsigned char buffer, unsigned int size, unsigned char sequence) [static] k_send_data_packet_small - send a small data packet Kermit protocol allows for two types of data packets ->small and large. This function sends a small packet to the target. the identication of a small packet is if length_normal ==0 in which case length_hi and lo are used from k_large structure. Parameters: buffer - buffer to send size -size of the buffer to send sequence - sequence number of the transmission. Returns: success/fail References APP_ERROR, DATA_TYPE, END_CHAR, k_escape(), K_ESCAPE, kermit_data_header_small::length_normal, NULL, kermit_data_header_small::packet_type, s1_sendpacket(), kermit_data_header_small::sequence_number, should_escape(), kermit_data_header_small::start, START_CHAR, tochar, and untochar. Referenced by k_send_data().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

62

Here is the call graph for this function:


k_escape k_send_data_packet_small s1_sendpacket should_escape s_write reset_comm_error

Here is the caller graph for this function:


k_send_data_packet_small k_send_data main

13.22.3.4

static signed int kermit_ack_type (int seq_num) [static]

kermit_ack_type - Analyse the ack packet Parameters: seq_num - sequence number expected Returns: - result References ACK_TYPE, APP_ERROR, CHK_ERROR, NACK_TYPE, print_ack_packet(), s1_getpacket(), SEQ_ERROR, tochar, and untochar. Referenced by k_send_data(). Here is the call graph for this function:
print_ack_packet kermit_ack_type s1_getpacket s_read reset_comm_error

Here is the caller graph for this function:


kermit_ack_type k_send_data main

13.22.3.5

int main (int argc, char argv)

application entry Parameters: argc -argument count argv - argument string

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

63

Returns: fail/pass References APP_ERROR, delay, DLY_ARG, DLY_ARG_C, DNLD_ARG, DNLD_ARG_C, k_send_data(), NOPARITY, NULL, ONE_STOP_BIT, port, PORT_ARG, PORT_ARG_C, s_close(), s_congure(), s_ush(), s_open(), SERIAL_OK, and usage(). Here is the call graph for this function:
f_close f_open f_read f_size k_send_data s_close s_configure main s_flush s_open usage s1_sendpacket print_ack_packet s_read s1_getpacket s_write reset_comm_error f_status_init f_status_show k_send_data_packet_small k_escape should_escape

kermit_ack_type

13.22.3.6

static void print_ack_packet (struct kermit_ack_nack_type k_ack) [static]

print_ack_packet - Debug print of the ack packet from target Parameters: k_ack -ack structure References kermit_ack_nack_type::checksum, kermit_ack_nack_type::eol, kermit_ack_nack_type::length_norm, kermit_ack_nack_type::packet_type, kermit_ack_nack_type::sequence_number, kermit_ack_nack_type::start, and untochar. Referenced by kermit_ack_type(). Here is the caller graph for this function:
print_ack_packet kermit_ack_type k_send_data main

13.22.3.7

static void s1_getpacket (char packet, int size) [static]

s1_getpacket - get a packet from the target s_read is expected to be blocking in this case Parameters: packet - the buffer to which data is stored

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

64

size the size of the packet References delay, and s_read(). Referenced by kermit_ack_type(). Here is the call graph for this function:
s1_getpacket s_read reset_comm_error

Here is the caller graph for this function:


s1_getpacket kermit_ack_type k_send_data main

13.22.3.8

static void s1_sendpacket (char packet, int size) [static]

s1_sendpacket - send a data packet to the target Parameters: packet - buffer containing the data buffer size - size of the buffer References s_write(). Referenced by k_send_data(), and k_send_data_packet_small(). Here is the call graph for this function:
s1_sendpacket s_write reset_comm_error

Here is the caller graph for this function:


s1_sendpacket k_send_data_packet_small k_send_data main

13.22.3.9

static int should_escape (char out) [static]

should_escape - decides if a binary character should be escaped as per kermit protocol Escape is a concept which prexes # in front of a converted character The idea is to deny CONTROL characters from going over serial port directly. so all characters 0 to 31 and 127 ASCII code is considered control characters Parameters: out - character to be analyzed

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

13.22

src/ukermit.c File Reference

65

Returns: -1 if it should be escaped, else 0 References K_ESCAPE, and SPACE. Referenced by k_send_data_packet_small(). Here is the caller graph for this function:
should_escape k_send_data_packet_small k_send_data main

13.22.3.10 usage help Parameters:

static void usage (char appname) [static]

appname my application name Returns: none References DLY_ARG, DNLD_ARG, F_NAME, OMAP_UBOOT_UTILS_REVISION, PORT_ARG, and PORT_NAME. 13.22.4 13.22.4.1 Variable Documentation unsigned int delay [static]

Referenced by main(), and s1_getpacket().

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

Index
ACK_TYPE ukermit.c, 57 APP_ERROR pserial.c, 42 ucmd.c, 52 ukermit.c, 57 ASIC_ID_SIZE pserial.c, 42 ASIC_ID_TIMEOUT pusb.c, 46 ASICID_SIZE pusb.c, 46 back_buff f_status.c, 23 BACK_SPACE_CHAR f_status.c, 22 BREAK_TYPE ukermit.c, 57 BUF_SIZE serial_win32.c, 35 checksum kermit_ack_nack_type, 8 CHK_ERROR ukermit.c, 57 CMD_ARG ucmd.c, 52 CMD_ARG_C ucmd.c, 52 cong_idx pusb.c, 50 CONFIG_INDEX_DEFAULT pusb.c, 46 congure_device pusb.c, 47 DATA_TYPE ukermit.c, 57 delay ukermit.c, 64 DEVICE_IN_ENDPOINT pusb.c, 46 DEVICE_OUT_ENDPOINT pusb.c, 46 DLY_ARG ukermit.c, 57 DLY_ARG_C ukermit.c, 57 DNLD_ARG ukermit.c, 57 DNLD_ARG_C ukermit.c, 57 docs/app_pserial.dox, 10 docs/app_pusb.dox, 10 docs/app_ucmd.dox, 10 docs/app_ukermit.dox, 10 docs/apps.dox, 10 docs/caveat.dox, 10 docs/compile.dox, 10 docs/library.dox, 10 docs/main.dox, 10 DOWNLOAD_COMMAND pusb.c, 46 E_PRINT pusb.c, 46 END_CHAR ukermit.c, 57 eol kermit_ack_nack_type, 8 escape_it ukermit.c, 58 ETX_CHAR ukermit.c, 58 EVENPARITY serial.h, 16 EXP_ARG ucmd.c, 52 EXP_ARG_C ucmd.c, 52 f_close le.h, 13 le_posix.c, 25 le_win32.c, 27 F_ERROR le_posix.c, 25 le_win32.c, 27 F_INFO le_posix.c, 25 le_win32.c, 27 F_NAME pserial.c, 42 ukermit.c, 58 f_open le.h, 13 le_posix.c, 25 le_win32.c, 28 f_read le.h, 13 le_posix.c, 25

INDEX

67

le_win32.c, 28 f_size le.h, 14 le_posix.c, 26 le_win32.c, 28 f_status.c back_buff, 23 BACK_SPACE_CHAR, 22 f_status_init, 23 f_status_show, 23 print_buff, 23 PRINT_SIZE, 22 s_special, 24 tsize, 24 f_status.h f_status_init, 11 f_status_show, 11 NORMAL_PRINT, 11 SPECIAL_PRINT, 11 f_status_init f_status.c, 23 f_status.h, 11 f_status_show f_status.c, 23 f_status.h, 11 FALSE le_win32.c, 27 serial_win32.c, 35 fd serial_posix.c, 33 Fhandle le_win32.c, 29 le le_posix.c, 26 le.h f_close, 13 f_open, 13 f_read, 13 f_size, 14 FILE_ERROR, 13 FILE_OK, 13 FILE_ERROR le.h, 13 FILE_OK le.h, 13 le_posix.c f_close, 25 F_ERROR, 25 F_INFO, 25 f_open, 25 f_read, 25 f_size, 26 le, 26 le_win32.c

f_close, 27 F_ERROR, 27 F_INFO, 27 f_open, 28 f_read, 28 f_size, 28 FALSE, 27 Fhandle, 29 NULL, 27 TRUE, 27 found_dev pusb.c, 50 get_response ucmd.c, 52 h_serial serial_win32.c, 41 help pusb.c, 47 include/f_status.h, 10 include/le.h, 12 include/rev.h, 15 include/serial.h, 15 INTERFACE_INDEX_DEFAULT pusb.c, 47 K_ESCAPE ukermit.c, 58 k_escape ukermit.c, 59 k_send_data ukermit.c, 59 k_send_data_packet_small ukermit.c, 60 kermit_ack_nack_type, 7 checksum, 8 eol, 8 length_norm, 8 packet_type, 8 sequence_number, 8 start, 8 kermit_ack_type ukermit.c, 61 kermit_data_header_small, 8 length_normal, 9 packet_type, 9 sequence_number, 9 start, 9 length_norm kermit_ack_nack_type, 8 length_normal kermit_data_header_small, 9

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

INDEX

68

lib/f_status.c, 22 lib/le_posix.c, 24 lib/le_win32.c, 26 lib/serial_posix.c, 29 lib/serial_win32.c, 33 main pserial.c, 43 pusb.c, 47 ucmd.c, 53 ukermit.c, 61 MAX_BUF pserial.c, 42 MAX_CHUNK ukermit.c, 58 MAX_SIZE pusb.c, 47 N_PRINT pusb.c, 47 NACK_TYPE ukermit.c, 58 newtio serial_posix.c, 33 NOPARITY serial.h, 16 NORMAL_PRINT f_status.h, 11 NULL le_win32.c, 27 serial_win32.c, 35 ODDPARITY serial.h, 16 OMAP_UBOOT_UTILS_REVISION rev.h, 15 ONE_STOP_BIT serial.h, 16 ONEPFIVE_STOP_BIT serial.h, 16 packet_type kermit_ack_nack_type, 8 kermit_data_header_small, 9 port serial_posix.c, 33 serial_win32.c, 41 PORT_ARG pserial.c, 42 ucmd.c, 52 ukermit.c, 58 PORT_ARG_C pserial.c, 42 ucmd.c, 52

ukermit.c, 58 PORT_NAME pserial.c, 42 ucmd.c, 52 ukermit.c, 58 print_ack_packet ukermit.c, 62 print_altsetting pusb.c, 48 print_buff f_status.c, 23 print_conguration pusb.c, 48 print_device pusb.c, 48 print_endpoint pusb.c, 49 print_interface pusb.c, 49 PRINT_SIZE f_status.c, 22 pserial.c, 42 ukermit.c, 58 program_name pusb.c, 50 pserial.c APP_ERROR, 42 ASIC_ID_SIZE, 42 F_NAME, 42 main, 43 MAX_BUF, 42 PORT_ARG, 42 PORT_ARG_C, 42 PORT_NAME, 42 PRINT_SIZE, 42 SEC_ARG, 43 SEC_ARG_C, 43 send_le, 43 TOT_SIZE, 43 usage, 44 pusb.c ASIC_ID_TIMEOUT, 46 ASICID_SIZE, 46 cong_idx, 50 CONFIG_INDEX_DEFAULT, 46 congure_device, 47 DEVICE_IN_ENDPOINT, 46 DEVICE_OUT_ENDPOINT, 46 DOWNLOAD_COMMAND, 46 E_PRINT, 46 found_dev, 50 help, 47 INTERFACE_INDEX_DEFAULT, 47 main, 47

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

INDEX

69

MAX_SIZE, 47 N_PRINT, 47 print_altsetting, 48 print_conguration, 48 print_device, 48 print_endpoint, 49 print_interface, 49 program_name, 50 READ_BUFFER_SIZE, 47 search_device, 49 search_product, 50 SEARCH_PRODUCT_DEFAULT, 47 search_vendor, 51 SEARCH_VENDOR_DEFAULT, 47 send_le, 49 usb_sleep, 50 V_PRINT, 47 verbose, 51 R_EVENT_MASK serial_win32.c, 35 READ_BUFFER_SIZE pusb.c, 47 read_overlapped serial_win32.c, 41 reset_comm_error serial_win32.c, 36 RETRY_MAX ukermit.c, 58 rev.h OMAP_UBOOT_UTILS_REVISION, 15 RX_HW_BUF_SIZE serial_win32.c, 35 s1_getpacket ukermit.c, 62 s1_sendpacket ukermit.c, 63 s_close serial.h, 17 serial_posix.c, 31 serial_win32.c, 36 s_congure serial.h, 17 serial_posix.c, 31 serial_win32.c, 37 S_DEBUG serial_win32.c, 35 S_ERROR serial_posix.c, 31 serial_win32.c, 35 s_ush serial.h, 18 serial_posix.c, 31

serial_win32.c, 37 s_getc serial.h, 18 serial_posix.c, 31 serial_win32.c, 38 S_INFO serial_posix.c, 31 serial_win32.c, 35 s_open serial.h, 19 serial_posix.c, 32 serial_win32.c, 38 s_putc serial.h, 19 serial_posix.c, 32 serial_win32.c, 38 s_read serial.h, 19 serial_posix.c, 32 serial_win32.c, 39 s_read_remaining serial.h, 20 serial_posix.c, 33 serial_win32.c, 39 s_special f_status.c, 24 s_write serial.h, 21 serial_posix.c, 33 serial_win32.c, 40 search_device pusb.c, 49 search_product pusb.c, 50 SEARCH_PRODUCT_DEFAULT pusb.c, 47 search_vendor pusb.c, 51 SEARCH_VENDOR_DEFAULT pusb.c, 47 SEC_ARG pserial.c, 43 SEC_ARG_C pserial.c, 43 send_cmd ucmd.c, 53 send_le pserial.c, 43 pusb.c, 49 SEND_TYPE ukermit.c, 58 SEQ_ERROR ukermit.c, 58 sequence_number

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

INDEX

70

kermit_ack_nack_type, 8 kermit_data_header_small, 9 serial.h EVENPARITY, 16 NOPARITY, 16 ODDPARITY, 16 ONE_STOP_BIT, 16 ONEPFIVE_STOP_BIT, 16 s_close, 17 s_congure, 17 s_ush, 18 s_getc, 18 s_open, 19 s_putc, 19 s_read, 19 s_read_remaining, 20 s_write, 21 SERIAL_FAILED, 16 SERIAL_OK, 17 SERIAL_TIMEDOUT, 17 TWO_STOP_BIT, 17 SERIAL_FAILED serial.h, 16 SERIAL_OK serial.h, 17 serial_posix.c fd, 33 newtio, 33 port, 33 s_close, 31 s_congure, 31 S_ERROR, 31 s_ush, 31 s_getc, 31 S_INFO, 31 s_open, 32 s_putc, 32 s_read, 32 s_read_remaining, 33 s_write, 33 SERIAL_TIMEDOUT serial.h, 17 serial_win32.c BUF_SIZE, 35 FALSE, 35 h_serial, 41 NULL, 35 port, 41 R_EVENT_MASK, 35 read_overlapped, 41 reset_comm_error, 36 RX_HW_BUF_SIZE, 35 s_close, 36 s_congure, 37

S_DEBUG, 35 S_ERROR, 35 s_ush, 37 s_getc, 38 S_INFO, 35 s_open, 38 s_putc, 38 s_read, 39 s_read_remaining, 39 s_write, 40 T_EVENT_MASK, 35 TRUE, 36 TX_HW_BUF_SIZE, 36 write_overlapped, 41 should_escape ukermit.c, 63 SPACE ukermit.c, 58 SPECIAL_PRINT f_status.h, 11 src/pserial.c, 41 src/pusb.c, 45 src/ucmd.c, 51 src/ukermit.c, 54 start kermit_ack_nack_type, 8 kermit_data_header_small, 9 START_CHAR ukermit.c, 58 T_EVENT_MASK serial_win32.c, 35 tochar ukermit.c, 59 TOT_SIZE pserial.c, 43 TRUE le_win32.c, 27 serial_win32.c, 36 tsize f_status.c, 24 TWO_STOP_BIT serial.h, 17 TX_HW_BUF_SIZE serial_win32.c, 36 ucmd.c APP_ERROR, 52 CMD_ARG, 52 CMD_ARG_C, 52 EXP_ARG, 52 EXP_ARG_C, 52 get_response, 52 main, 53

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen

INDEX

71

PORT_ARG, 52 PORT_ARG_C, 52 PORT_NAME, 52 send_cmd, 53 usage, 54 ukermit.c ACK_TYPE, 57 APP_ERROR, 57 BREAK_TYPE, 57 CHK_ERROR, 57 DATA_TYPE, 57 delay, 64 DLY_ARG, 57 DLY_ARG_C, 57 DNLD_ARG, 57 DNLD_ARG_C, 57 END_CHAR, 57 escape_it, 58 ETX_CHAR, 58 F_NAME, 58 K_ESCAPE, 58 k_escape, 59 k_send_data, 59 k_send_data_packet_small, 60 kermit_ack_type, 61 main, 61 MAX_CHUNK, 58 NACK_TYPE, 58 PORT_ARG, 58 PORT_ARG_C, 58 PORT_NAME, 58 print_ack_packet, 62 PRINT_SIZE, 58 RETRY_MAX, 58 s1_getpacket, 62 s1_sendpacket, 63 SEND_TYPE, 58 SEQ_ERROR, 58 should_escape, 63 SPACE, 58 START_CHAR, 58 tochar, 59 untochar, 59 usage, 64 XOFF_CHAR, 59 XON_CHAR, 59 untochar ukermit.c, 59 usage pserial.c, 44 ucmd.c, 54 ukermit.c, 64 usb_sleep pusb.c, 50

V_PRINT pusb.c, 47 verbose pusb.c, 51 write_overlapped serial_win32.c, 41 XOFF_CHAR ukermit.c, 59 XON_CHAR ukermit.c, 59

Generated on Wed Aug 27 23:33:10 2008 for OMAP-U-Boot-Utils by Doxygen