Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

/opentcp/include/inet/system.h File Reference


Detailed Description

Author:
Version:
1.0
Date:
23.6.2002
OpenTCP system function declarations, constants, general assignments, etc.

Definition in file system.h.

Go to the source code of this file.

Data Structures

struct  netif
 Network Interface declaration. More...


Defines

#define OPENTCP_VERSION   "1.0.4"
 OpenTCP major version number.

#define TRUE   1
#define FALSE   0
#define NETWORK_TX_BUFFER_SIZE   1024
 Transmit buffer size.

#define MASTER_MS_CLOCK   base_timer
#define TXBUF   net_buf
#define RESET_SYSTEM()   while(1)
 Macro used to reset the MCU.

#define OS_EnterCritical   __DI
 Macro used to enter critical sections.

#define OS_ExitCritical   __EI
 Macro used to exit critical sections.

#define RECEIVE_NETWORK_B()   inNE2000again()
 Use this macro to read data from Ethernet controller.

#define RECEIVE_NETWORK_BUF(c, d)   inNE2000againbuf(c,d)
 Use this macro to read data from Ethernet controller to a buffer.

#define SEND_NETWORK_B(c)   outNE2000again(c)
 Use this macro to write data to Ethernet controller.

#define SEND_NETWORK_BUF(c, d)   outNE2000againbuf(c,d)
 Use this macro to write data from buffer to Ethernet controller.

#define NETWORK_CHECK_IF_RECEIVED()   NE2000ReceiveFrame()
 Use this macro to check if there is recieved data in Ethernet controller.

#define NETWORK_RECEIVE_INITIALIZE(c)   NE2000DMAInit_position(c)
 Initialize reading from a given address.

#define NETWORK_RECEIVE_END()   NE2000DumpRxFrame()
 Dump received packet in the Ethernet controller.

#define NETWORK_COMPLETE_SEND(c)   NE2000SendFrame(c)
 Send the Ethernet packet that was formed in the Ethernet controller.

#define NETWORK_SEND_INITIALIZE(c)   InitTransmission(c)
 Initialize sending of Ethernet packet from a given address.

#define NETWORK_ADD_DATALINK(c)   NE2000WriteEthernetHeader(c)
 Add lower-level datalink information.


Define Documentation

#define OPENTCP_VERSION   "1.0.4"
 

This define represents OpenTCP version information. Version is in the format MAJOR.MINOR.PATCH.

Definition at line 75 of file system.h.

#define TRUE   1
 

Boolean TRUE value as used in the OpenTCP

Definition at line 78 of file system.h.

Referenced by free_timer(), get_timer(), init_timer(), process_ip_in(), and timer_pool_init().

#define FALSE   0
 

Boolean FALSE value as used in the OpenTCP

Definition at line 79 of file system.h.

Referenced by arp_add(), decrement_timers(), get_timer(), and NE2000ReceiveFrame().

#define MASTER_MS_CLOCK   base_timer
 

Interrupt driven msec free-running clock

Definition at line 150 of file system.h.

#define TXBUF   net_buf
 

TXBUF points to transmit network buffer

Definition at line 151 of file system.h.

Referenced by process_icmp_in().

 
#define RESET_SYSTEM      while(1)
 

By default this macro is only an infinite loop and the system is reset by the (presumably) running watchdog timer.

Change this if another form of reset is desired/needed.

Examples:
tcp_client_demo.c, tcp_server_demo.c, and udp_demo.c.

Definition at line 163 of file system.h.

Referenced by get_host_by_name(), get_timer(), https_init(), pop3c_init(), process_tcp_in(), and smtpc_init().

#define OS_EnterCritical   __DI
 

Todo:
  • Move this to other arch-dependant place
This is highly dependant on the architecture that is used and/or possible operating system beeing used so it will be moved to some other place in the future.

Usually disabling globally interrupts works just fine :-)

Definition at line 176 of file system.h.

Referenced by init_timer().

#define OS_ExitCritical   __EI
 

Todo:
  • Move this to other arch-dependant place
This is highly dependant on the architecture that is used and/or possible operating system beeing used so it will be moved to some other place in the future.

For now this only globally enables interrupts

Definition at line 189 of file system.h.

Referenced by init_timer().

 
#define RECEIVE_NETWORK_B      inNE2000again()
 

This macro should be used to read data from the Ethernet controller. Procedure for doing this would be as follows:

  • Initialize reading of data from certain address in the Ethernet controller (usually you will do that based on buf_index value of ip_frame, udp_frame or tcp_frame type of variables; in certain special situations you can also use buf_index from ethernet_frame type of var.
  • Keep invoking RECEIVE_NETWORK_B() to read one byte at a time from the ethernet controller. Take care not to read more data than actually received
  • If needed, reinitialize reading of data again and start all over again
  • When finished discard the current frame in the Ethernet controller by invoking NETWORK_RECEIVE_END() macro
Examples:
tcp_client_demo.c, tcp_server_demo.c, and udp_demo.c.

Definition at line 210 of file system.h.

Referenced by arp_get_response(), arp_send_response(), bootpc_eventlistener(), dhcpc_eventlistener(), dhcpc_read_n_bytes(), dns_eventlistener(), process_arp(), process_icmp_in(), process_ip_in(), process_tcp_in(), process_udp_in(), and tcp_check_cs().

#define RECEIVE_NETWORK_BUF c,
     inNE2000againbuf(c,d)
 

This macro should be used to read data from the Ethernet controller to a buffer in memory. Procedure for using this macro is the same as for using RECEIVE_NETWORK_B() macro.

Definition at line 220 of file system.h.

Referenced by process_icmp_in(), and tcp_check_cs().

#define SEND_NETWORK_B      outNE2000again(c)
 

This macro should be used to write data to Ethernet controller. Procedure for doing this would be as follows:

  • Initialize writing of data to certain address in the Ethernet controller. Buffer space in Ethernet controller is divided among the protocols in the following way:
  • 256 byte Tx for ARP (see ARP_BUFFER )
  • 1536 byte Tx for ICMP (see ICMP_BUF)
  • 1536 byte Tx for TCP (see TCP_BUF)
  • 1536 byte Tx for UDP (see UDP_BUF)
  • Write the data by using SEND_NETWORK_B() macro
  • When all of the data is written instruct the Ethernet controller to send the data by calling the NETWORK_COMPLETE_SEND() macro with number of bytes to send as a parameter

Definition at line 240 of file system.h.

Referenced by arp_send_req(), arp_send_response(), and process_ip_out().

#define SEND_NETWORK_BUF c,
     outNE2000againbuf(c,d)
 

This macro should be used to write data from a buffer to Ethernet controller. Usage is the same as for the SEND_NETWORK_B() macro.

Definition at line 248 of file system.h.

Referenced by process_ip_out().

#define NETWORK_RECEIVE_INITIALIZE      NE2000DMAInit_position(c)
 

This macro initializes reading of the received Ethernet frame from a given address in the Ethernet controller.

Definition at line 270 of file system.h.

Referenced by bootpc_eventlistener(), process_arp(), process_icmp_in(), process_ip_in(), process_tcp_in(), and process_udp_in().

#define NETWORK_COMPLETE_SEND      NE2000SendFrame(c)
 

After the data has been written to the Ethernet controller, use this function to instruct the Ethernet controller that data is in it's internal buffer and should be sent.

Definition at line 288 of file system.h.

Referenced by arp_send_req(), arp_send_response(), and process_ip_out().

#define NETWORK_SEND_INITIALIZE      InitTransmission(c)
 

Use this function to initialize sending (or creating) of an Ethernet packet from a given address in the Ethernet controller.

Definition at line 296 of file system.h.

Referenced by arp_send_req(), arp_send_response(), and process_ip_out().

#define NETWORK_ADD_DATALINK      NE2000WriteEthernetHeader(c)
 

This implementation adds Ethernet data-link information by invoking NE2000WriteEthernetHeader() function that writes Ethernet header based on information provided (destination and source ethernet address and protocol field).

Definition at line 306 of file system.h.

Referenced by arp_send_req(), arp_send_response(), and process_ip_out().


Generated on Sun Aug 3 20:33:00 2003 for OpenTCP by doxygen1.2.18