ECEn 425

Lab #7: Event Flags


Overview

This lab is the final phase in the development of your YAK kernel. You are to add functions that create, pend on, set, and reset event flags so that you can correctly execute the application program lab7app.c without modification. You will also need the file lab7defs.h. You are expected to complete this lab with a partner.

Functionality

You must add the following functions to your kernel. You should implement each function exactly according to the prototype given on the YAK Kernel webpage. Refer to that web page for additional details about these functions.

For this lab you will also need to change your tick and keyboard interrupt handlers. For the tick handler, you need not generate any output -- this makes your output much easier to read. You should replace the contents of your keyboard handler with the contents of sample function shown below.

void KeyboardHandler(void)
{
    char c;
    c = KeyBuffer;

    if(c == 'a') YKEventSet(charEvent, EVENT_A_KEY);
    else if(c == 'b') YKEventSet(charEvent, EVENT_B_KEY);
    else if(c == 'c') YKEventSet(charEvent, EVENT_C_KEY);
    else if(c == 'd') YKEventSet(charEvent, EVENT_A_KEY | EVENT_B_KEY | EVENT_C_KEY);
    else if(c == '1') YKEventSet(numEvent, EVENT_1_KEY);
    else if(c == '2') YKEventSet(numEvent, EVENT_2_KEY);
    else if(c == '3') YKEventSet(numEvent, EVENT_3_KEY);
    else {
        print("\nKEYPRESS (", 11);
        printChar(c);
        print(") IGNORED\n", 10);
    }
}
You will also need to #include the header file lab7defs.h above your keyboard handler. This keyboard handler, in combination with the application code, will allow you to test the ability of your kernel to unblock one or multiple tasks in response to different events. Study the application code and keyboard handler carefully so that you understand what should happen when keys are pressed.

Requirements

Implement the required functions and make sure that the application program runs correctly. As usual, the system should not crash when key presses occur in rapid succession, even with the timer tick frequency increased to 750 instructions per tick. For full credit, your application code must run correctly at this high tick rate, including the generation of all output for any combination of keypresses.

The behavior of the code depends on which keys are pressed. To verify that your kernel is running correctly, check the following functionality:

If other keys are pressed, the usual "KEYPRESS (X) IGNORED" should be displayed. No other text or error messages should be displayed.

Pass-off

When you are confident that your kernel runs the application program correctly, demonstrate its execution to a TA. Be prepared to show your source code to the TA and discuss your design decisions. Since you must demonstrate working code to a TA on or before the due date, please consider their lab schedule well in advance.

In addition to the demonstration, you must send email to the Lab TA with a written summary of problems you encountered, if any, and a realistic estimate of the total number of hours you spent on this lab. You are also invited to include suggestions or additional information that could have been included on the web pages, or additional simulator features that would have reduced your debugging time.

Important Notes

Debugging help

Here are comments from student reports describing their problems on this lab and how they tracked them down. As always, take them with a grain of salt.



Last updated 29 August 2016