3.2.8 DIAG_DMAC

The DIAG_DMAC module is designed to verify the correct functionality of the Direct Memory Access Controller (DMAC) through a set of C function calls.

The DIAG_DMAC software test API is mapped to the following safety mechanisms:

Table 3-9. 
FunctionDiagnostic MechanismUse CaseElapsed Time (μs)~
DIAG_DMAC_Disable()DMA_DISABLEPOST / OnDemand1.5
DIAG_DMAC_Enable()DMA_ENABLEPOST / OnDemand1.45
DIAG_DMAC_Interrupts()DMA_INTERRUPTSPOST41.45
DIAG_DMAC_LinkedList()DMA_LINKED_TRANSFERPOST / OnDemand69.27
DIAG_DMAC_SFRReset()SFR_RESET_CHECKPOST46.20
DIAG_DMAC_SFRWriteRead()SFR_WRITE_READPOST / OnDemand 52.72
DIAG_DMAC_Transfer()DMA_TRANSFERPOST / OnDemand / InUSE45.20

Configuring the Diagnostic

DMAC Safe-Plib must be configured as illustrated to supported to support all diagnostics:

Using the Diagnostic (example reference)

#include "definitions.h"

// SFR testing
DIAG_TEST_STATUS DIAG_DMAC_SFRPost()
{   
    DIAG_TEST_STATUS result = DIAG_TEST_NOT_EXECUTED;

    NVMCTRL_Initialize();
    
    result = DIAG_DMAC_SFRReset(NULL,0,false);
    
    if (result == DIAG_TEST_PASSED)
    {
        result = DIAG_DMAC_SFRWriteRead(NULL,0,false);
    }
       
    return result; 
}


// Post testing
DIAG_TEST_STATUS DIAG_DMAC_Post()
{   
    DIAG_TEST_STATUS result;
       
    result = DIAG_DMAC_Transfer(DMAC_CHANNEL_9);

    if (result == DIAG_TEST_PASSED)
    {    
        result = DIAG_DMAC_Interrupts(DMAC_CHANNEL_9); 

        if (result == DIAG_TEST_PASSED)
        {    
            result = DIAG_DMAC_LinkedList(DMAC_CHANNEL_9);
        }
    }
    return result; 
}