Question: As written, Listing 4 is considered a blocking function, i . e . , it won't return until the delay as expired. However, Dr .

As written, Listing 4 is considered a "blocking" function, i.e., it won't return until the delay as expired. However, Dr. J would now like you to create a "non-blocking" hardware-assisted delay using the Core Timer and static variables as needed to implement the following behavior:
(a) The first time the routine is called, it sets an internal variable to to indicate that a delay is in progress, saves other information as well, and returns a "1" to show a delay operation is in progress.
(b) Subsequent calls to the delay routine will check to determine if the delay has elapsed and if so, return "0". Otherwise, it returns a "1".
A sample application is below
main()
{
non_block_delay(100); // Initial call
while(non_block_delay(100))
{
task1;
task2;
}// end while
}// end main
The above will cause task1 and task2 to be executed repeatedly for at least 100 msec.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!