Advertisement

Quick Links

J640
Product Information
Full information about other Arcom products is available by contacting our Website at:
www.arcomcontrols.com
Useful Contact Information
Customer Support Europe
Tel:
+44 (0)1223 412 428
Fax:
+44 (0)1223 403 409
E-mail: support@arcom.co.uk
Sales offices
United Kingdom:
Arcom Control Systems Ltd
Clifton Road
Cambridge CB1 7EA, UK
Tel: 01223 411 200
Fax: 01223 410 457
E-mail:
sales@arcom.co.uk
Whilst Arcom's sales team is always available to assist you in making your decision, the final
choice of boards or systems is solely and wholly the responsibility of the buyer. Arcom's entire
liability in respect of the boards or systems is as set out in Arcom's standard terms and
conditions of sale.
If you intend to write your own low level software, you can start with the source code on the
disk, which is supplied. This is example code only to illustrate use on Arcom's products. It has
not been commercially tested. No warranty is made in respect of this code and Arcom shall
incur no liability whatsoever or howsoever arising from any use made of the code.
© 2000 Arcom Control Systems Ltd
All trademarks recognised.
C O N T R OL S Y S T E M S
Embedded Industrial
Internet Appliance
Library Technical Manual
United States:
Arcom Control Systems Inc
13510 South Oak Street
Kansas City MO 64145 USA
Tel: 816 941 7025
Fax: 816 941 7807
E-mail:
icpsales@arcomcontrols.com
MERLIN
Customer Support US
Tel:
816 941 7025
Fax:
816 941 7807
E-mail: support@arcomcontrols.com
Sales hotlines
Belgium:
Groen Nummer:
Tel: 0800 7 3192
Fax: 0800 7 3191
France:
Numero Vert
Tel: 0800 90 84 06
Fax: 0800 90 84 12
2192-10850-000-000
Germany:
Italy:
Kostenlose Infoline:
Numero Verde:
Tel: 08001 824 511
Tel: 0800 790841
Fax:08001 824 512
Fax: 0800 780841
Netherlands:
Gratis Nummer:
Tel: 0800 0221136
Fax: 0800 0221148
Arcom Control Systems Ltd
operate a company-wide quality
management system which has
been certified by the British
Standards Institution (BSI) as
compliant with ISO9001:1994
Page 1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MERLIN (ROM-DOS/Sockets) and is the answer not in the manual?

Questions and answers

Summary of Contents for Arcom MERLIN (ROM-DOS/Sockets)

  • Page 1 Whilst Arcom’s sales team is always available to assist you in making your decision, the final choice of boards or systems is solely and wholly the responsibility of the buyer. Arcom’s entire liability in respect of the boards or systems is as set out in Arcom’s standard terms and conditions of sale.
  • Page 2: Table Of Contents

    J640 2192-10850-000-000 Contents Contents ............................2 Revision History..........................3 Preface............................3 Software Library..........................4 TSR (“Terminate and Stay Resident”) Support................4 SSI (“Server Side Include”) Support ..................... 4 CGI (“Common Gateway Interface”) Support ................4 Data Types............................. 5 Logic ............................5 Include Files..........................
  • Page 3: Revision History

    Issue C 260601 [ECO 2985] Changes to sections discussing stack sizes Preface The Arcom MERLIN (ROM-DOS/Sockets) Development Kit enables you to build full Ethernet and PSTN dial-up network support (modem required) into your target systems. This includes: • TCP/IP API with TCP, UDP and ICMP •...
  • Page 4: Software Library

    The library is supplied as a set of binaries pre-built for use with the Borland C++ 4.52 compiler. A number of examples are provided which demonstrate use of the library functionalities. If Borland C++ 4.52 is required, a copy may be obtained from Arcom Control Systems. At this time the library comprises the following components: TSR (“Terminate and Stay Resident”) Support...
  • Page 5: Data Types

    ERR_NORXDAT Include Files The .\include directory contains the ARAPI.H include file. This include file declares the publicised API to the Arcom E.I.I.A. library. The demonstration board API may be found in the ARDEMO.H include file. Page 5 C O N T R OL S Y S T E M S...
  • Page 6: Tsr ("Terminate And Stay Resident") Support

    J640 2192-10850-000-000 TSR (“Terminate and Stay Resident”) Support Allows loading of a program in the background. The program code and data will remain in memory, until unloaded. This facilitates use of ‘callbacks’ (see later) Function FLAG fArFindTSR( UCHAR *sID ) Description Check if a program corresponding to string sID is installed as a TSR Parameters...
  • Page 7: Issues Pertaining To Stack Size

    J640 2192-10850-000-000 Function FLAG *fArUnloadTSR( UCHAR *sID ) Description Uninstall an installed TSR program Parameters UCHAR *sID If non-NULL then unload the TSR corresponding to the sID string which is in memory. Alternatively unload the TSR in memory with a name corresponding to the program name of this executable (i.e.
  • Page 8: Coreleft() Function

    J640 2192-10850-000-000 TOP OF AVAILABLE APPLICATION MEMORY (TOP OF STACK) The stack expands downwards as the running program makes calls to functions and/or creates ‘local’ variables. Top of stack Function calls cause parameters and a return address to be placed on the stack. Bottom of stack Local variables are also placed on the stack.
  • Page 9: Small Model Executable Example

    J640 2192-10850-000-000 SMALL Model Executable Example For a SMALL model executable we have one area for code (the code ‘segment’) and another area for both the data and stack (data/stack segment). The maximum size of both of these segments is 64Kb.
  • Page 10: Choice Of Wsptop Parameter (When Registering Cgi Handler Or Ssi File)

    J640 2192-10850-000-000 A suggested methodology is to first use either the TDUMP program or your application .MAP file to see how much application data your program uses. For details on TDUMP or mapfiles see the relevant compiler reference manual. If you use dynamic memory allocation in your application – this is not recommended for TSRs – then you should calculate how this will increase your data area usage (heap usage).
  • Page 11: Tsr Example

    J640 2192-10850-000-000 TSR Example The .\library\examples\chktsr directory contains a Borland C++ 4.52 project which can be used to build the TSR example application. The project builds a number of executables. These are the same source code but built in the small, medium, compact, large and huge models.
  • Page 12: Ssi ("Server Side Includes") Support

    J640 2192-10850-000-000 SSI (“Server Side Includes”) Support Allows creation of HTML template files. These files may contain variables, defined using a certain HTML tag. When a client requests the template file it is parsed and the variable is replaced with an application definable string.
  • Page 13 J640 2192-10850-000-000 Function SINT16 wArSSIAddVar( UCHAR *pszName, UCHAR *pszValue Description Adds an SSI variable for HTML template parsing. When the HTML template is requested any occurrences of the variable (pszName) will be replaced with the string corresponding to (pszValue). Parameters UCHAR *pszName Pointer to parameter string (e.g.
  • Page 14 J640 2192-10850-000-000 Function SINT16 wArSSIUpdateVar( UCHAR *pszName, UCHAR *pszValue Description Updates an SSI variable for HTML template parsing – replaces the existing value string with the new pszValue string. When the HTML template is requested any occurrences of the variable (pszName) will be replaced with the string corresponding to (pszValue).
  • Page 15: An Example Ssi Implementation

    J640 2192-10850-000-000 Function const UCHAR *psArSSIReadVar(UCHAR *pszName) Description Returns a pointer to the value string associated with a given parameter string. Parameters UCHAR *pszName SSI variable name Returns NULL Error or NULL value != NULL Pointer to value string Notes The value string should not be modified directly.
  • Page 16 J640 2192-10850-000-000 The simplest case would be something like the following: <HTML> <BODY> LED1 = <!--#echo var=”LED1”--> </BODY> </HTML> Note the very specific tag containing the LED1 parameter. This is the standard SSI variable replacement format. Having created the HTML template and stored this on the server, the next step is to “register” this template file with the SSI adaptor.
  • Page 17: Dynamic Ssi Variable Update

    J640 2192-10850-000-000 Dynamic SSI Variable Update Looking back at the wArSSIAddFile() code snippet we see that there is a function referenced, wArUpdateVars(). This function will be called whenever a client connects to the HTTP server and requests the registered file. The application developer may choose to implement this function to update all SSI variables before the HTML template file is parsed.
  • Page 18: Cgi ("Common Gateway Interface") Support

    J640 2192-10850-000-000 CGI (“Common Gateway Interface”) Support Allows the execution of user application code when specified URL requests are received from clients. Additionally supports the parsing of data received from these clients. Returned data may be in the form of dynamic HTML or other depending on application requirements. Function SINT16 wArCGIRegister( UCHAR *pszFilePath,...
  • Page 19 J640 2192-10850-000-000 Function SINT16 wArCGIUnregister(UCHAR far *pszFilePath) Description Deregisters a partial URL path from the CGI adapter Parameters UCHAR *pszFilePath URL portion to unregister from HTTP server Returns - Success < 0 - Error condition Notes This must be called before the application exits or is unloaded from memory.
  • Page 20 J640 2192-10850-000-000 Function SINT16 wArCGIRxData( SINT16 wHandle , UCHAR far *pData, SINT16 wSize ) Description This function may be used to receive data from the client (< 2^16 -1 bytes) e.g. sent via a POST function Parameters SINT16 wHandle Connection handle for Tx/Rx from client UCHAR far *pData Pointer to a byte array of data to hold received data SINT16 wCount...
  • Page 21 J640 2192-10850-000-000 Function SINT16 wArCGIParseQuery( UCHAR far *pParam, SINT16 wSize, UCHAR far **pValue, UCHAR far **pNextParam ) Description Parses through a subsection of a query. Query form: "Axx=ABCD&Byy=1234" etc. Caller's pValue and pNextParam get set to the appropriate portion of the query.
  • Page 22 J640 2192-10850-000-000 Function SINT16 wArCGIParsePOSTParams( UCHAR far *pParam, SINT16 wSize, UCHAR far * far *pValue, UCHAR far * far *pNextParam) Description Parses through a subsection of a POST for parameters. Post form: "P1=V1\0x0D\0x0A" etc. Caller's pValue and pNextParam get set to the appropriate portion of the query.
  • Page 23 J640 2192-10850-000-000 Function SINT16 wArCGITxStdHTTPHeader( SINT16 wHandle ) Description Transmits the standard HTTP header to the client Parameters SINT16 wHandle Connection handle for data transmissions to the client Returns SUCCESS Notes Transmits: "HTTP/1.0 200 OK\r\n\r\n" Function SINT16 wArCGITxStdHTMLHeader( SINT16 wHandle ) Description Transmits an HTML header to the client Parameters...
  • Page 24 J640 2192-10850-000-000 Structure CGI_HANDLERS Function CGI_HANDLERS-> SINT16 (far *wfpConnected)( SINT16 wHandle ) Description Initial connect handler Called when a client connects to the HTTP serve. Allows user to return HTTP, HTML headers (or custom data). This is called prior to the parameters on the GET line being parsed.
  • Page 25 J640 2192-10850-000-000 Function CGI_HANDLERS-> SINT16 (far *wfpGetParam)( SINT16 wHandle, UCHAR far *pParam, UCHAR far *pValue ) Description User parameter handler Called when a client connects to the HTTP server and provides parameters via the get method. e.g. http://w.x.y.z/cgi?alex=1&says=2&hello=3 would result in three separate calls to this handler. Parameters SINT16 wHandle Handle for this connection.
  • Page 26 J640 2192-10850-000-000 Function CGI_HANDLERS-> SINT16 (far *wfpPost)( SINT16 wHandle) Description User POST handler Called when a client connects to the HTTP server and provides parameters/data via the POST method. This will occur if the client is handling form data or sending a file Parameters SINT16 wHandle Handle for this connection.
  • Page 27 J640 2192-10850-000-000 Function CGI_HANDLERS-> SINT16 (far *wfpTxData)( SINT16 wHandle, SINT16 wTxCount) Description User Transmit handler Called when a client connects to the HTTP server after the GET and/or POST data has been handled, if such data is present. The purpose of this handler is to allow dynamic data transmission from the server to the client.
  • Page 28: Common Gateway Interface Demonstration Applications

    J640 2192-10850-000-000 Common Gateway Interface Demonstration Applications The CGI implementation is more complex to use than SSI but provides a more flexible development environment. It is possible to analyse data provided by the client (through the ‘GET’ and ‘POST’ methods). It is also possible to generate completely dynamic pages of HTML data, or alternatively to provide dynamic binary information.
  • Page 29: Stack Overflow Example

    J640 2192-10850-000-000 NOTE: It is extremely important to understand that the callback may be called before all of the POSTed data is received. It should not be assumed that any complete data structures are in memory when a given callback occurs. The user provided function may be called more than once as data is received.
  • Page 30: Embedded Lan Connections

    J640 2192-10850-000-000 Embedded LAN Connections TCP/IP Servers The FTPD and HTTPD servers are included in the MERLIN AUTOEXEC.BAT file pre-loaded on the MERLIN and are run at startup. You can FTP into the MERLIN from your host by typing (in a DOS window): (where 10.2.6.14 is the I.P.
  • Page 31: Netbios / Smb Troubleshooter

    J640 2192-10850-000-000 On the MERLIN target board, run the SHARE command to enable DOS level file sharing. Run the NETBIOS.COM command to enable the NETBIOS API. Run the REDIR.EXE command to provide local access to remote drives. Then type: NET USE E: \\ server\drive where: server is the Windows 9x name of your host PC (or another networked PC) drive is the name of the shared network drive.
  • Page 32: Host Configuration

    J640 2192-10850-000-000 • Enter an I.P. address for the remote system and select whether the user should be called back. A callback provides additional connection security. • You should repeat this process if you require support for multiple dial-in users. For dial-out networking (or dial-in and dial-out): •...
  • Page 33: Connecting To A Windows 9X System

    J640 2192-10850-000-000 Click on ‘Configure’ to bring up the ‘Configure port usage’ window. Select ‘Dial out and receive calls’ or ‘Receive calls only’. This will allow incoming calls to be picked up. Click ‘Network’ to bring up the ‘Network Configuration’ window. Ensure that the Server Settings TCP/IP box is checked and click ‘Configure’...
  • Page 34 J640 2192-10850-000-000 Next select the “Protocol” network component type and “Microsoft” for the manufacturer. The “TCP/IP” protocol will appear in the “Network Protocols” window. You should double click on this line. A new line will now appear in the “Network components” window, “TCP/IP -> Dial-Up Adapter”. Click ‘OK’.
  • Page 35: Modem Connectivity Troubleshooter

    J640 2192-10850-000-000 Modem Connectivity Troubleshooter • Make sure all cables are properly connected and modem power is on. • Make sure modem is connected to correct COM port. • Make sure the same username and password combination is specified on both target and host systems.
  • Page 36: Host Configuration

    J640 2192-10850-000-000 Save the configuration and copy to the MERLIN. Reboot the MERLIN to load the TCP/IP stack with the new parameters Host Configuration Connection to a Windows NT system The NT server must have Remote Access Services (RAS) enabled and you must be running Service Pack 4 or greater.
  • Page 37: Connecting From A Windows 9X System

    For Windows 95 and 98 you will be required to install a null modem driver for connection of two PC’s. Arcom recommend the freely available Aeriden drivers included on this CD in Utils\Aeriden To install the Null Modem driver follow these steps: 1.
  • Page 38: Glossary

    J640 2192-10850-000-000 Glossary Application Programming Interface Address Resolution Protocol. Converts I.P. addresses to MAC (Ethernet) Addresses for TCP/IP connections to be established between hosts. Authentication The process whereby a server identifies that a client is allowed to connect and determines what access that client should have. BOOTP Boot Protocol.
  • Page 39 J640 2192-10850-000-000 ICMP Internet Control Message Protocol. Message and error control protocol used between hosts, hosts and gateways. The PING application uses ICMP messaging. INTRANET A private network (LAN) contained within an enterprise. Usually connected to other intranets and the Internet via a Gateway or Firewall. IP Address A 4-byte address of an host on a network.
  • Page 40 J640 2192-10850-000-000 Sub-net Mask A 4-byte bitmask that controls which others hosts a given host can talk to, e.g. A host with I.P. address 10.2.2.10 and sub-net mask 255.255.0.0 can send I.P. packets directly to any hosts in the address range 10.2.1.1 to 10.2.254.254.

Table of Contents