BSP and Device Driver Development Guide
When writing code for the driver transmit and receive tasks,
take care to follow the network scheduling conventions. All tasks
which are associated with networking share various
data structures and resources. To ensure the consistency
of these structures the tasks
execute only when they hold the network semaphore (rtems_bsdnet_semaphore
).
The transmit and receive tasks must abide by this protocol. Be very
careful to avoid `deadly embraces' with the other network tasks.
A number of routines are provided to make it easier for the network
driver code to conform to the network task scheduling conventions.
void rtems_bsdnet_semaphore_release(void)
This function releases the network semaphore. The network driver tasks must call this function immediately before making any blocking RTEMS request.
void rtems_bsdnet_semaphore_obtain(void)
This function obtains the network semaphore. If a network driver task has released the network semaphore to allow other network-related tasks to run while the task blocks, then this function must be called to reobtain the semaphore immediately after the return from the blocking RTEMS request.
rtems_bsdnet_event_receive(rtems_event_set, rtems_option, rtems_interval, rtems_event_set *)
The network driver task should call this function when it wishes to wait
for an event. This function releases the network semaphore,
calls rtems_event_receive
to wait for the specified event
or events and reobtains the semaphore.
The value returned is the value returned by the rtems_event_receive
.
BSP and Device Driver Development Guide
Copyright © 1988-2003 OAR Corporation