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            Command_START_TX = 7,
    58            Command_STOP_TX = 8
    59        };
    60        
    61        /*! 
    62         * Structure of command received from host 
    63         * TODO - Either the types should be changed to 32-bits, or the packet
    64         * size information should be added to the RTA XML file.
    65         */
    66        struct CommandPacket {
    67            Command  cmdId;
    68            UArg     arg0;
    69            UArg     arg1;
    70        }
    71    
    72        /*! Structure of response packet sent back to host */
    73        struct ResponsePacket {
    74            Command  cmdId;
    75            UArg     resp0;
    76            UArg     resp1;
    77        }
    78        
    79        /*! 
    80         *  ======== dataTransportClassName ========= 
    81         *  The name of the xdc.rta.IDataTransport class to use. 
    82         *  
    83         *  The class specified here can be used on the host for reading RTA data
    84         *  from this target application.
    85         */
    86        config String dataTransportClassName = "";
    87    
    88        /*!
    89         *  ======== controlTransportClassName ========
    90         *  The name of the xdc.rta.IControlTransport class to use.
    91         *
    92         *  The class specified here can be used on the host for communicating with
    93         *  this target application to send control commands and receive responses.
    94         */
    95        config String controlTransportClassName = "";
    96         
    97        /*!
    98         *  ======== processCommand ========
    99         *  Executes a command packet and prepares the response packet.
   100         *  
   101         *  This API will execute the command specified by the command packet
   102         *  argument, and will store the response information in the response
   103         *  packet argument.
   104         *
   105         *  @param(cmd)    The CommandPacket to execute.
   106         *  @param(resp)   The ResponsePacket to populate with the response.
   107         */
   108        Void processCommand(CommandPacket *cmd, ResponsePacket *resp);
   109        
   110        /*!
   111         *  ======== acknowledgeCmd ========
   112         */
   113        Void acknowledgeCmd(ResponsePacket *resp);
   114    
   115        /*!
   116         *  ======== readMask ========
   117         */
   118        Void readMask(ResponsePacket *resp, UArg addr);
   119        
   120        /*!
   121         *  ======== writeMask ========
   122         */   
   123        Void writeMask(ResponsePacket *resp, UArg addr, UArg val);
   124        
   125        /*!
   126         *  ======== enableLog ========
   127         */
   128        Void enableLog(ResponsePacket *resp, UArg log);
   129        
   130        /*!
   131         *  ======== disableLog ========
   132         */
   133        Void disableLog(ResponsePacket *resp, UArg log);
   134        
   135        /*!
   136         *  ======== getCpuSpeed ========
   137         */
   138        Void getCpuSpeed(ResponsePacket *resp);
   139        
   140        /*!
   141         *  ======== resetLog ========
   142         */
   143        Void resetLog(ResponsePacket *resp, UArg log);
   144        
   145        /*!
   146         *  ======== changePeriod ========
   147         */
   148        Void changePeriod(ResponsePacket *resp, UArg period);
   149    
   150        /*!
   151         *  @_nodoc
   152         *  ======== genRta ========
   153         *  Generates the Rta XML file.
   154         */
   155        function genRta(outputFileName);
   156    
   157    }
   158    /*
   159     *  @(#) xdc.runtime; 2, 1, 0,373; 3-21-2012 10:48:13; /db/ztree/library/trees/xdc/xdc-y23x/src/packages/
   160     */
   161