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

Initialization functions


Detailed Description

These are the functions that MUST be invoked at startup so that appropriate modules can work properly. Failure to do so may lead to difficult to find bugs and unexpected behaviour!

In general, all modules should be initialized starting from the most basic ones upwards. See main_demo.c for an example startup procedure.

Functions

void arp_init (void)
 Initialize data structures for ARP processing.

void NE2000Init (UINT8 *mac)
 Initialize and configure RTL8019AS.

INT8 tcp_init (void)
 Initialize TCP module.

void timer_pool_init (void)
 Initialize timer pool.

INT8 udp_init (void)
 Initialize UDP socket pool.


Function Documentation

void arp_init void   
 

Author:
Date:
01.11.2001
Warning:
  • Invoke this function at start-up to properly initialize ARP cache subsystem.
Call this function to properly initialize ARP cache table and so that ARP allocates and initializes a timer for it's use.
Examples:
main_demo.c.

Definition at line 910 of file arp.c.

References ARP_FIXED_IP, ARP_FREE, ARP_MAXRETRY, ARP_RESOLVED, ARP_TEMP_IP, ARP_TIMEOUT, arp_timer, get_timer(), arp_entry::hwadr, init_timer(), MAXHWALEN, arp_entry::pradr, arp_entry::retries, arp_entry::state, TIMERTIC, arp_entry::ttl, and arp_entry::type.

void NE2000Init UINT8 *    mac
 

Author:
Date:
19.02.2002
Parameters:
mac  Pointer to NIC's hardware address
Invoke this function at startup to properly initialize NIC's registers, HW address and operation.
Examples:
main_demo.c.

Definition at line 327 of file ethernet.c.

References BOUNDARY, CR, CURR, DCR, ISR, NE2000CurrPktPtr, NE2000NextPktPtr, outNE2000(), PAR0, PSTART, PSTOP, RCR, RESETPIN_NE2000, RXBUF_END, RXBUF_START, and TCR.

INT8 tcp_init void   
 

Author:
Date:
21.07.2002
Returns:
  • -1 - error
  • >0 - number of sockets initialized
Warning:
  • This function must be invoked at startup before any other TCP functions are invoked.
This function initializes all sockets and corresponding tcbs to known state. Timers are also allocated for each socket and everything is brought to a predefined state.
Examples:
main_demo.c.

Definition at line 1154 of file tcp.c.

References tcb::event_listener, tcb::flags, get_timer(), init_timer(), tcb::locport, tcb::myflags, tcb::persist_timerh, tcb::rem_ip, tcb::remport, tcb::retransmit_timerh, tcb::retries_left, tcb::send_mtu, tcb::state, TCP_STATE_FREE, TCP_TYPE_NONE, tcb::tos, tcb::tout, and tcb::type.

void timer_pool_init void   
 

Author:
Date:
18.07.2001
Warning:
  • This function must be invoked at startup before any other timer function is used.
This function resets all timer counter to zero and initializes all timers to available (free) state.
Examples:
main_demo.c.

Definition at line 105 of file timers.c.

References NUMTIMERS, timer_pool, and TRUE.

INT8 udp_init void   
 

Author:
Date:
26.07.2002
Returns:
  • -1 - Error
  • >0 - Number of UDP sockets initialized
Warning:
  • This function must be invoked before any other UDP-related function is called
This function initializes UDP socket pool to get everything into a known state at startup.
Examples:
main_demo.c.

Definition at line 118 of file udp.c.

References ucb::locport, ucb::opts, ucb::state, ucb::tos, UDP_OPT_CHECK_CS, UDP_OPT_SEND_CS, and UDP_STATE_FREE.


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