The event-driven operation of RL-TCPnet allows you to run TCPnet
application in event-driven mode in a multitasking environment.
Instead of calling the polling loop constantly, the system processess
TCPnet events only when needed. The rest of time, TCPnet system
remains idle.
The main_TcpNet()
function is modified to return a busy status indication. If TCPnet
system is busy, this function has to be called again, to complete the
TCP/IP processing. If TCPnet is not busy, TCP/IP processing might be
stalled, until a TCPnet event occurs.
The TCPnet events, which require TCP/IP processing, are:
ethernet packet received,
tick timer interval expired,
serial character received or transmitted.
Event-driven operation optimizes the cpu usage a lot. The
following table lists the cpu time required for TCP/IP processing and
cpu idle time for HTTP_Demo example:
TCP/IP processing
System Idle time
247 ms
85953 ms
In order to modify the TCPnet application for event-driven
operation, you must make the following changes to your project:
ethernet driver
Add the code to send a signal event to tcp_main task in
the ethernet receive interrupt function.
tcp_tick task
Add the code to send a signal event to tcp_main task. The
priority of the tcp_tick task should be higher than the
priority of tcp_main task.
tcp_main task
Add the code to wait for an event in TCPnet tcp_main task.
The priority of tcp_main task should be higher than the
application layer / service layer tasks.
__task void tcp_main (void) {
init_TcpNet ();
while (1) {
os_evt_wait_and(0x0001, 0xFFFF);
while (main_TcpNet() == __TRUE);
}
}
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.