Imagix 4D User Guide


Calls in Critical Regions

Potential issues involving the use of enable/disable interrupt calls or semaphores within tasks are detected by the Calls in Critical Regions report along with the Mismatched Critical Regions report. Both reports require that your critical region mechanism first be identified, as this is not explicit in C/C++ programs.

Functions that are called from within a critical region extend the time that other tasks are locked out. The Calls in Critical Regions analysis identifies all such functions so that they can be reviewed for appropriateness. Such calls from inside a critical region might also indicate an error in how the critical regions have been implemented. Consider the following code:

int getSensorData();

int input, output;

// start & end critical region
void DisableIrpt(), EnableIrpt();

void SetVars() {
    DisableIrpt();
    input = getSensorData();
}

void CalcOutput() {
    output = input * input / 0.25;
    EnableIrpt();
}

void Task1() {
    SetVars();

    PerformSomeOtherAction();

    CalcOutput();
}

The functions called from inside the critical region are identified in the report.

Calls in Critical Regions

Settings:
        Critical Region:  CR ( DisableIrpt / EnableIrpt )
                          

Task Definitions
Tasks are from User Defined Tasks
Name        Members  Graph  Root
Task1             7    [+]  Task1

Calls in Critical Region                          File (Line)
          Task
             Line Number of Usage
                  Critical Region
                              User of Calls in Critical Region

CalcOutput                                        calls_in_cr.c (13)
          Task1
               23 (CR)     Task1                               calls_in_cr.c (18)

getSensorData                                     calls_in_cr.c (1)
          Task1
               10 (CR)     SetVars                             calls_in_cr.c (8)

PerformSomeOtherAction                            
          Task1
               21 (CR)     Task1                               calls_in_cr.c (18)