A.8.2 Component CADI class declaration

This section describes the component CADI class declaration.

// Header file for a typical CADI component class.
class CADIMyComponent : public CADI 
{
public:
    CADIMyComponent(MyComponentClass *c); // Change names accordingly.
    virtual ~CADIMyComponent();
// The declaration/implementation of CAInterface() methods is missing 
// and must be added at this point. 
// These are essential for properly obtaining a CADI 2.0 interface.
public:
    // Register access functions.
    CADIReturn_t   CADIRegGetGroups(uint32_t groupIndex
        , uint32_t desiredNumOfRegGroups, uint32_t *actualNumOfRegGroups
        , CADIRegGroup_t *reg);
    CADIReturn_t   CADIRegGetMap( uint32_t groupID, uint32_t regIndex
        , uint32_t registerSlots, uint32_t *registerCount, CADIRegInfo_t *reg);
    CADIReturn_t   CADIRegWrite( uint32_t regCount, CADIReg_t *reg
        , uint32_t *numRegsWritten, uint8_t doSideEffects);
    CADIReturn_t   CADIRegRead(uint32_t regCount, CADIReg_t *reg
        , uint32_t *numRegsRead, uint8_t doSideEffects);
    // Memory access functions.
    CADIReturn_t   CADIMemGetSpaces( uint32_t spaceIndex, uint32_t memSpaceSlots
        , uint32_t *memSpaceCount, CADIMemSpaceInfo_t *memSpace);
    CADIReturn_t   CADIMemGetBlocks( uint32_t memorySpace, uint32_t blockIndex
        , uint32_t memBlockSlots, uint32_t *memBlockCount
        , CADIMemBlockInfo_t *memBlock);
    CADIReturn_t   CADIMemWrite( CADIAddrComplete_t startAddress
        , uint32_t unitsToWrite, uint32_t unitSizeInBytes, const uint8_t *data
        , uint32_t *actualNumOfUnitsWritten, uint8_t doSideEffects);    
    CADIReturn_t   CADIMemRead( CADIAddrComplete_t startAddress
        , uint32_t unitsToRead, uint32_t unitSizeInBytes, uint8_t *data
        , uint32_t *actualNumOfUnitsRead, uint8_t doSideEffects);    
    // Access to disassembly class (if available).
    CADIDisassembler *CADIGetDisassembler(void);
private:
    // Pointer to your own component class, see constructor.
    MyComponentClass *target;
    // Register related info.
    CADIRegInfo_t *regInfo;
    CADIRegGroup_t *regGroup;
    // Memory related info.
    CADIMemSpaceInfo_t *memSpaceInfo;    
    CADIMemBlockInfo_t *memBlockInfo; 
};

Typically, you can leave the class declaration as it is, except for:

  • Adding any private data members.
  • Changing the parameter in the constructor to the class name of the component.

Note:

If your component is a processor, see also the functions that are available in the CADIDisassembler and CADIProfiler classes for controlling and monitoring application execution.
Non-ConfidentialPDF file icon PDF version100963_0200_03_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.