Navigation bar
  Start Previous page  23 of 35  Next page End Home  13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33  

 TPB_T  TasknTPBTPB_T  TaskCTPBTPB_T  TaskBTPBTPB_T  TaskATPB
Embedded Web Server for the CR16
National Semiconductor
Jeff Wright
23
The Application Layer (HTTP 1.0)
A limited version of HTTP 1.0 is included.  The supported methods (or, commands) are GET and
POST - all others are ignored.  A schematic of this layer is shown in Figure 16.  This HTTP can
operate with both static (FLASH-based) and dynamic (RAM/EE-base) user defined pages.  
const UCHAR Pagel_htm[] =
"\r\n\r\n<html>"
"\r\n<head><title>About the
CB</title>”"\r\n\r\n<html>"
...
"\r\n</html>\r\n\r\n";
const UCHAR Clockl_htm[]
=
"\r\n<head><title>About the
CB</title>”
...
"\r\n</html>\r\n\r\n";
const UCHAR Test_htm
[] =
"\r\n\r\n<html>"
"\r\n<head><title>About the
CB</title>”
...
"\r\n</html>\r\n\r\n";
OSTaskCreate (TaskA, ...)
User defined html pages (FLASH)
User defined tasks
UCHAR   HTTPTxBuf [HTTPTxBufSize
];
UCHAR   HTTPRxBuf
[MaxSS-24];
HTTP
TCP
TCAPI_T  TAppIface {...}
TCP’s “API”
User defined Rx and Tx buffers
const UCHAR CBall_htm
[] =
"\r\n\r\n<html>"
"\r\n<head><title>About the
CB</title>”
...
"\r\n</html>\r\n\r\n";
OSTaskDelete (TaskX
;...)
TaskA ( void *data)
{
   while (1) {
      do this;
      do that;
      do the other thing;
   }
}
TaskA ( void *data)
{
   while (1) {
      do this;
      do that;
      do the other thing;
   }
}
TaskB ( void *data)
{
   while (1) {
      do this;
      do that;
      do the other thing;
   }
}
TaskA ( void *data)
{
   while (1) {
      do this;
      do that;
      do the other thing;
   }
}
Figure 16.  Application Layer (HTTP) schematic
In addition to simply returning static Web pages, this server is capable of responding to forms
Similar in function to cgi’s, the user may define application-specific “scripts” (tasks) which may
be spawned by the Server to perform user-specified functions.  As the user “submits” form
data to the server, these user-defined tasks operate on this data and return results or take
user-specified actions.  These tasks may, or may not, return a new or modified Web page. 
These built-in features provide a user with a great deal of flexibility in creating fully
interactive applications.  
User tasks are written to operate under the RTOS.  Special control blocks and data structures
are used to manage all this activity.  These are defined and maintained in a central location,
making development a straightforward process.  Users may create their own embedded Web
pages in a number of ways.  One easy method is to first write them in standard HTML and then
add the necessary formatting to transform them into an array of characters, making them
amenable to the ‘C’ compiler. Once understood, this process is remarkably quick and easy. 
This server was developed with efficiency in mind.  To that end, Web pages may share common
headers and footers, thereby giving them a uniform look and feel.  Alternatively, users may opt
Microcontroller.com White Papers Previous page Top Next page