Download Using Time Division Multiplexing to support Real

Transcript
Program 4.1 Pseudo-Code for the Timer handling routine invoked at the start of a
transmission slot
1 void set_transmit_bit(data)
2 {
3
if(tdm_status == TDM_SCHEDULE_SET){
4
tdm_status = TDM_ENABLED;
5
}
6
time_to_transmit = TRUE;
7
kernel_timer.expiration_jiffy = end_time_jiffies;
8
kernel_timer.expiration_subjiffy = end_time_subjiffies;
9
kernel_timer.handling_function = reset_transmit_bit;
10
set_kernel_timer(kernel_timer);
11 }
next transmission cycle. This is done by simply adding the transmission cycle jiffy
values to the current time-slot’s begin and end time values. It then sets up the kernel
timer to expire at the start time of the next interval. Now the set transmit bit routine is set as the timer handling routine. Program 4.2 gives the pseudo-code for the
reset transmit bit handling routine.
The TDM scheduler follows a simple policy of sequentially selecting its members
for execution. In this model the NET TX SOFTIRQ is the only member belonging to the
Transmit group. When the TDM Scheduler is invoked by the Top Group’s scheduler, it
selects the NET TX SOFTIRQ and performs the following checks. First, it checks if TDM
is enabled. If so, it checks if it is the time-slot for transmission. If that also happens to
be true, it verifies if there are any packets to be transmitted by checking the NET TX SOFTIRQ bit in the pending softirq flag field. Only when this condition evaluates to
true, does the TDM scheduler return the NET TX SOFTIRQ member to be scheduled. If
the either of these conditions fail, the scheduler returns a global pass member, denoting
that it doesn’t have any member to be scheduled. Program 4.3 gives the pseudo code
for the Scheduling Decision Function associated with the TDM scheduler.
43