1    /* 
     2     *  Copyright (c) 2016-2019 Texas Instruments Incorporated
     3     *  This program and the accompanying materials are made available under the
     4     *  terms of the Eclipse Public License v1.0 and Eclipse Distribution License
     5     *  v. 1.0 which accompanies this distribution. The Eclipse Public License is
     6     *  available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
     7     *  Distribution License is available at
     8     *  http://www.eclipse.org/org/documents/edl-v10.php.
     9     *
    10     *  Contributors:
    11     *      Texas Instruments - initial implementation
    12     * */
    13    /*
    14     *  ======== Rta.xdc ========
    15     */
    16    
    17    package xdc.runtime;
    18    
    19    /*!
    20     *  ======== Rta ========
    21     *  The Rta module contains target and configuration code for providing RTA
    22     *  support.
    23     *
    24     *  The 'Command' enum defines the available control commands, and the
    25     *  'CommandPacket' structure defines the format of commands received from
    26     *  the host.
    27     *
    28     *  All commands should send back a response, even if only to acknowledge
    29     *  receipt and completion of the command. The format of the response
    30     *  is defined by the 'ResponsePacket' structure.
    31     *
    32     *  The Rta_processCommand can be used to process commands received from a
    33     *  host to call the appropriate API. Alternatively, the individual APIs can
    34     *  be called if not all of the defined commands are used.
    35     */
    36    @DirectCall
    37    module Rta {
    38    
    39        /*! Logged when the Agent receives a command */
    40        config Log.Event LD_cmdRcvd = {
    41            mask: Diags.USER2,
    42            msg: "LD_cmdRcvd: Received command: %d, arg0: 0x%x, arg1: 0x%x"
    43        };
    44    
    45        /*! Logged when a diags mask is changed */
    46        config Log.Event LD_writeMask = {
    47            mask: Diags.USER2,
    48            msg: "LD_writeMask: Mask addres: 0x%x, New mask value: 0x%x"
    49        };
    50    
    51        /*! Assert if logger id in control command is invalid. */
    52        config Assert.Id A_invalidLogger = {
    53            msg: "A_invalidLogger: The logger id %d is invalid."
    54        };
    55    
    56        /*! Error raised if Agent receives an invalid command. */
    57        config Error.Id E_badCommand  = {
    58            msg: "E_badCommand: Received invalid command, id: %d."
    59        };
    60    
    61        /*! Command ids */
    62        enum Command : Int {
    63            Command_READ_MASK = 0,
    64            Command_WRITE_MASK = 1,
    65            Command_LOGGER_OFF = 2,
    66            Command_LOGGER_ON = 3,
    67            Command_GET_CPU_SPEED = 4,
    68            Command_RESET_LOGGER = 5,
    69            Command_CHANGE_PERIOD = 6,
    70            Command_START_TX = 7,
    71            Command_STOP_TX = 8
    72        };
    73    
    74        /*!
    75         * Structure of command received from host
    76         * TODO - Either the types should be changed to 32-bits, or the packet
    77         * size information should be added to the RTA XML file.
    78         */
    79        struct CommandPacket {
    80            Command  cmdId;
    81            UArg     arg0;
    82            UArg     arg1;
    83        }
    84    
    85        /*! Structure of response packet sent back to host */
    86        struct ResponsePacket {
    87            Command  cmdId;
    88            UArg     resp0;
    89            UArg     resp1;
    90        }
    91    
    92        /*!
    93         *  ======== dataTransportClassName =========
    94         *  The name of the xdc.rta.IDataTransport class to use.
    95         *
    96         *  The class specified here can be used on the host for reading RTA data
    97         *  from this target application.
    98         */
    99        config String dataTransportClassName = "";
   100    
   101        /*!
   102         *  ======== controlTransportClassName ========
   103         *  The name of the xdc.rta.IControlTransport class to use.
   104         *
   105         *  The class specified here can be used on the host for communicating with
   106         *  this target application to send control commands and receive responses.
   107         */
   108        config String controlTransportClassName = "";
   109    
   110        /*!
   111         *  ======== processCommand ========
   112         *  Executes a command packet and prepares the response packet.
   113         *
   114         *  This API will execute the command specified by the command packet
   115         *  argument, and will store the response information in the response
   116         *  packet argument.
   117         *
   118         *  @param(cmd)    The CommandPacket to execute.
   119         *  @param(resp)   The ResponsePacket to populate with the response.
   120         */
   121        Void processCommand(CommandPacket *cmd, ResponsePacket *resp);
   122    
   123        /*!
   124         *  ======== acknowledgeCmd ========
   125         */
   126        Void acknowledgeCmd(ResponsePacket *resp);
   127    
   128        /*!
   129         *  ======== readMask ========
   130         */
   131        Void readMask(ResponsePacket *resp, UArg addr);
   132    
   133        /*!
   134         *  ======== writeMask ========
   135         */
   136        Void writeMask(ResponsePacket *resp, UArg addr, UArg val);
   137    
   138        /*!
   139         *  ======== enableLog ========
   140         */
   141        Void enableLog(ResponsePacket *resp, UArg logNum);
   142    
   143        /*!
   144         *  ======== disableLog ========
   145         */
   146        Void disableLog(ResponsePacket *resp, UArg logNum);
   147    
   148        /*!
   149         *  ======== getCpuSpeed ========
   150         */
   151        Void getCpuSpeed(ResponsePacket *resp);
   152    
   153        /*!
   154         *  ======== resetLog ========
   155         */
   156        Void resetLog(ResponsePacket *resp, UArg logNum);
   157    
   158        /*!
   159         *  ======== changePeriod ========
   160         */
   161        Void changePeriod(ResponsePacket *resp, UArg period);
   162    
   163        /*!
   164         *  @_nodoc
   165         *  ======== genRta ========
   166         *  Generates the Rta XML file.
   167         */
   168        function genRta(outputFileName);
   169    
   170    }
   171    /*
   172     *  @(#) xdc.runtime; 2, 1, 0,0; 8-21-2019 13:22:47; /db/ztree/library/trees/xdc/xdc-H25/src/packages/
   173     */
   174