ppp\echomod2: Echo Client via Modem on /com/0


This application uses /com/0 for dial up PPP and /com/1 for printfs.
The following #defines should be updated in ppp_test.h to the user
specific values:

ECHO_SERVER_IP     The IP address of the echo server.
MODEM_DIAL_STRING  The telephone number for the Remote Access Server.
LOGIN_PAPNAME      The PAP name used by the target board to log into
                   the Remote Access Server.
LOGIN_PASSWORD     The PAP password used by the target board to log 
                   into the Remote Access Server.
LOGIN_CHAPNAME     The CHAP name used by the target baord to log into
                   the Remote Access Server.
LOGIN_SECRET       The CHAP secret used by the target baord to log
                   into the Remote Access Server.
BAUD_RATE          The baud rate of the serial port.


Note:

The following discussion describes the general setup to run this
application.  All the phone numbers and IP address related info are
for descriptive purposes only.  The user must have provide a real RAS
server telephone number and real IP addresses for this setup.

End note.

The application itself actively connects /com/0 via a modem to the Remote
Access Server (RAS) at 1-(800)555-1212.  After the connection is
established, the unit connects to an ECHO server (7.92.187.28) and an echo
test is performed, which sends arbitrarily sized chunks of data to the 
server.  The reply is checked for mismatches.  The modem hangs up after 
completing the echo test and reconnects to the server to repeat the test,
after which the modem hangs up again.

The application can handle the most common PPP modem communications
exceptions such as 

- line is busy (BUSY)
- no dialtone (NO DIALTONE)
- remote device doesn't answer or
- line got hung up prior to modem connection (NO CARRIER)
- PPP link was NOT established because RAS server doesn't respond to PPP
  protocol messages.
- PPP link was NOT established because PPP protocol negotiations failed. 


Note:

The PPPAddStaticRoute() call causes the TCP connection to be made through
the PPP link (and not through ethernet).

The ECHO Server at 7.92.186.28 must be active for this application to
function properly.

If a Windows PC in the LAN is configured as a RAS server, make sure that
IP routing is configured properly on the RAS server.

End note.


The following diagram shows the connections required for this
application:

  +---------+    +---------+
  |         |    |         |
  |HyperTerm|----|/com/1   |              +-------+         +-------+
  |         |    |         |202.92.186.151|       |telephone|       |
  +---------+    |   /com/0|--------------| Modem |=========| Modem |
                 |         |              |       |         |       |
                 | NET+ARM |              +-------+         +---+---+
                 |         |                                    |
                 |         |7.92.187.134                        |
                 | Ethernet|--+                                 |
                 |         |  |                                 |
                 +---------+  |                    +------------+--+
  +--------+                  |                    | Remote Access |
  |        |                  |                    |    Server     |
  |        |  7.92.187.218    |                    |               |
  | Router |------------------+---> Local Subnet   | (800)555-1212 |
  |        |                                       +---------------+
  |        |                                               |
  |        |--------> Internet       +----------+          |
  |        |                         |          |          |
  +--------+                         |   Echo   |----------+
                                     |  Server  | 7.92.186.28
                                     |          |
                                     +----------+



This application routes printf data to COM1, since the bsp_sys.h file
includes the following:

#define BSP_DIALOG_PORT         "/com/1"
#define BSP_STDIO_PORT          "/com/1"

To eliminate the dialog data and redirect the printf data to the
debug window, comment out both lines.  COM1 is then available to
the application programmer.


For users who need to switch back and forth between dial up client mode
and dial up server mode, setting ENABLE_DUAL_MODE to 1 in ppp_test.h
enables the dialup server code.  When ENABLE_DUAL_MODE is set to 1, 
the application performs it's dial up client functionality, and then
switches to dial up server mode waiting for an incoming call.  While in
dial up server mode, if the PPP link is closed (after the PPP link was 
opened), the application switches to dial up client mode again and the
mode switching process continues.  Refer to the readme file in the 
/ppp/httpmod2 example for more info on dial up server functionality.

When the application is in dial up server mode and the PPP link is
established, the remote client can issue pings to the PPP interface on
the target board.


Note:

User should refer to BSP configuration header files to check the features enabled 
for the specific board and modify them as needed.
If BSP is modified, the BSP for the specific platform must be rebuilt.

To enable using PPP, you must set the following #define in bsp_net.h to the
following:

#define BSP_WANT_PPP                        TRUE

For each specific platform, you must set the following #defines in
bsp_serial.h and gpio.h to the appropriate values:

#define BSP_SERIAL_PORT_1
#define BSP_SERIAL_PORT_x (if applicable)
#define BSP_GPIO_MUX_SERIAL_A
#define BSP_GPIO_MUX_SERIAL_x (if applicable)                       

Make sure the serial port is available on the platform. If different
serial port is used, root.c must be updated to the correct serial port.

Since this application uses both two serial ports, if no other serial
ports are available for CLI (Command Line Interface) traces, you must
set the following #defines in bsp_cli.h have to the following:

#define BSP_CLI_TELNET_ENABLE   TRUE
#define BSP_CLI_SERIAL_ENABLE   FALSE

The above settings enable the CLI trace feature through telnet instead
of through a serial port.

End note


One GNU make file is provided.  Build the target 'image' to
generate an image that can be debugged with gdb, and the file 
image.bin which can be written to flash if the bootloader is used.
Build the target 'rom.bin' to create the file rom.bin which 
can be written to ROM if the bootloader is not used.

The following files are provided with this application:

appconf.h         sets application configuration settings
makefile          Make file for the GNU toolset.
readme            this file
root.c            contains the applicationStart() function that creates
                  an application thread and echo client


In addition, the following files in the BSP directory are built
as part of this application:

reset.s         contains the reset code
appconf_api.c   contains code used to read settings in appconf.h


The application build file links in the following libraries.  

libbsp.a           contains the BSP code
libtcpip.a         contains the Net+Works TCP/IP stack
libtx.a            contains the ThreadX kernel
libfilesys.a       contains the file system libraries
libposix.a         contains the POSIX layer libraries
libflash.a         contains the Flash driver API library
libaddp.a		   contains the ADDP Library
libssh.a		   contains the SSH Library
libtelnsvr.a       contains the Telnet server library
libdnsclnt.a       contains the DNS client library
libpppintf.a       contains the PPP API library

The application uses the following files located in the
netos\src\linkerScripts directory.  These files are generated
when the BSP is built.

bootldr.dat     bootloader configuration file used to generate the
                file image.bin.  It controls the information placed
                in the bootloader header of the image.

image.ldr       GNU linker script used to build an image that can
                be debugged and used with the bootloader.
                
customize.ldr   Customizable GNU linker script
