1    /*
     2     *  ======== Rta.xdc ========
     3     */
     4     
     5    package xdc.runtime;
     6    
     7    /*!
     8     *  ======== Rta ========
     9     *  The Rta module contains target and configuration code for providing RTA
    10     *  support.
    11     *
    12     *  The 'Command' enum defines the available control commands, and the
    13     *  'CommandPacket' structure defines the format of commands received from
    14     *  the host. 
    15     *
    16     *  All commands should send back a response, even if only to acknowledge
    17     *  receipt and completion of the command. The format of the response
    18     *  is defined by the 'ResponsePacket' structure.
    19     *
    20     *  The Rta_processCommand can be used to process commands received from a
    21     *  host to call the appropriate API. Alternatively, the individual APIs can
    22     *  be called if not all of the defined commands are used.
    23     */
    24    module Rta {
    25    
    26        /*! Logged when the Agent receives a command */
    27        config Log.Event LD_cmdRcvd = {
    28            mask: Diags.USER2,
    29            msg: "LD_cmdRcvd: Received command: %d, arg0: 0x%x, arg1: 0x%x"
    30        };
    31    
    32        /*! Logged when a diags mask is changed */
    33        config Log.Event LD_writeMask = {
    34            mask: Diags.USER2,
    35            msg: "LD_writeMask: Mask addres: 0x%x, New mask value: 0x%x"
    36        };
    37        
    38        /*! Assert if logger id in control command is invalid. */
    39        config Assert.Id A_invalidLogger = {
    40            msg: "A_invalidLogger: The logger id %d is invalid."
    41        };
    42        
    43        /*! Error raised if Agent receives an invalid command. */
    44        config Error.Id E_badCommand  = {
    45            msg: "E_badCommand: Received invalid command, id: %d."
    46        };
    47    
    48        /*! Command ids */
    49        enum Command : Int {
    50            Command_READ_MASK = 0,  
    51            Command_WRITE_MASK = 1, 
    52            Command_LOGGER_OFF = 2,
    53            Command_LOGGER_ON = 3,
    54            Command_GET_CPU_SPEED = 4,
    55            Command_RESET_LOGGER = 5,
    56            Command_CHANGE_PERIOD = 6
    57        };
    58        
    59        /*! 
    60         * Structure of command received from host 
    61         * TODO - Either the types should be changed to 32-bits, or the packet
    62         * size information should be added to the RTA XML file.
    63         */
    64        struct CommandPacket {
    65            Command  cmdId;
    66            UArg     arg0;
    67            UArg     arg1;
    68        }
    69    
    70        /*! Structure of response packet sent back to host */
    71        struct ResponsePacket {
    72            Command  cmdId;
    73            UArg     resp0;
    74            UArg     resp1;
    75        }
    76        
    77        /*!
    78         *  ======== processCommand ========
    79         *  Executes a command packet and prepares the response packet.
    80         *  
    81         *  This API will execute the command specified by the command packet
    82         *  argument, and will store the response information in the response
    83         *  packet argument.
    84         *
    85         *  @param(cmd)    The CommandPacket to execute.
    86         *  @param(resp)   The ResponsePacket to populate with the response.
    87         */
    88        Void processCommand(CommandPacket *cmd, ResponsePacket *resp);
    89        
    90        /*!
    91         *  ======== acknowledgeCmd ========
    92         */
    93        Void acknowledgeCmd(ResponsePacket *resp);
    94    
    95        /*!
    96         *  ======== readMask ========
    97         */
    98        Void readMask(ResponsePacket *resp, UArg addr);
    99        
   100        /*!
   101         *  ======== writeMask ========
   102         */   
   103        Void writeMask(ResponsePacket *resp, UArg addr, UArg val);
   104        
   105        /*!
   106         *  ======== enableLog ========
   107         */
   108        Void enableLog(ResponsePacket *resp, UArg log);
   109        
   110        /*!
   111         *  ======== disableLog ========
   112         */
   113        Void disableLog(ResponsePacket *resp, UArg log);
   114        
   115        /*!
   116         *  ======== getCpuSpeed ========
   117         */
   118        Void getCpuSpeed(ResponsePacket *resp);
   119        
   120        /*!
   121         *  ======== resetLog ========
   122         */
   123        Void resetLog(ResponsePacket *resp, UArg log);
   124        
   125        /*!
   126         *  ======== changePeriod ========
   127         */
   128        Void changePeriod(ResponsePacket *resp, UArg period);
   129    
   130        /*!
   131         *  @_nodoc
   132         *  ======== genRta ========
   133         *  Generates the Rta XML file.
   134         */
   135        function genRta(outputFileName);
   136    
   137    }
   138    /*
   139     *  @(#) xdc.runtime; 2, 1, 0,282; 6-23-2010 14:03:17; /db/ztree/library/trees/xdc/xdc-v41x/src/packages/
   140     */
   141