1    /* 
     2     *  Copyright (c) 2016 Texas Instruments. All rights reserved.
     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    @RomConsts
    38    
    39    module Rta {
    40    
    41        /*! Logged when the Agent receives a command */
    42        config Log.Event LD_cmdRcvd = {
    43            mask: Diags.USER2,
    44            msg: "LD_cmdRcvd: Received command: %d, arg0: 0x%x, arg1: 0x%x"
    45        };
    46    
    47        /*! Logged when a diags mask is changed */
    48        config Log.Event LD_writeMask = {
    49            mask: Diags.USER2,
    50            msg: "LD_writeMask: Mask addres: 0x%x, New mask value: 0x%x"
    51        };
    52    
    53        /*! Assert if logger id in control command is invalid. */
    54        config Assert.Id A_invalidLogger = {
    55            msg: "A_invalidLogger: The logger id %d is invalid."
    56        };
    57    
    58        /*! Error raised if Agent receives an invalid command. */
    59        config Error.Id E_badCommand  = {
    60            msg: "E_badCommand: Received invalid command, id: %d."
    61        };
    62    
    63        /*! Command ids */
    64        enum Command : Int {
    65            Command_READ_MASK = 0,
    66            Command_WRITE_MASK = 1,
    67            Command_LOGGER_OFF = 2,
    68            Command_LOGGER_ON = 3,
    69            Command_GET_CPU_SPEED = 4,
    70            Command_RESET_LOGGER = 5,
    71            Command_CHANGE_PERIOD = 6,
    72            Command_START_TX = 7,
    73            Command_STOP_TX = 8
    74        };
    75    
    76        /*!
    77         * Structure of command received from host
    78         * TODO - Either the types should be changed to 32-bits, or the packet
    79         * size information should be added to the RTA XML file.
    80         */
    81        struct CommandPacket {
    82            Command  cmdId;
    83            UArg     arg0;
    84            UArg     arg1;
    85        }
    86    
    87        /*! Structure of response packet sent back to host */
    88        struct ResponsePacket {
    89            Command  cmdId;
    90            UArg     resp0;
    91            UArg     resp1;
    92        }
    93    
    94        /*!
    95         *  ======== dataTransportClassName =========
    96         *  The name of the xdc.rta.IDataTransport class to use.
    97         *
    98         *  The class specified here can be used on the host for reading RTA data
    99         *  from this target application.
   100         */
   101        config String dataTransportClassName = "";
   102    
   103        /*!
   104         *  ======== controlTransportClassName ========
   105         *  The name of the xdc.rta.IControlTransport class to use.
   106         *
   107         *  The class specified here can be used on the host for communicating with
   108         *  this target application to send control commands and receive responses.
   109         */
   110        config String controlTransportClassName = "";
   111    
   112        /*!
   113         *  ======== processCommand ========
   114         *  Executes a command packet and prepares the response packet.
   115         *
   116         *  This API will execute the command specified by the command packet
   117         *  argument, and will store the response information in the response
   118         *  packet argument.
   119         *
   120         *  @param(cmd)    The CommandPacket to execute.
   121         *  @param(resp)   The ResponsePacket to populate with the response.
   122         */
   123        Void processCommand(CommandPacket *cmd, ResponsePacket *resp);
   124    
   125        /*!
   126         *  ======== acknowledgeCmd ========
   127         */
   128        Void acknowledgeCmd(ResponsePacket *resp);
   129    
   130        /*!
   131         *  ======== readMask ========
   132         */
   133        Void readMask(ResponsePacket *resp, UArg addr);
   134        
   135        /*!
   136         *  ======== writeMask ========
   137         */   
   138        Void writeMask(ResponsePacket *resp, UArg addr, UArg val);
   139        
   140        /*!
   141         *  ======== enableLog ========
   142         */
   143        Void enableLog(ResponsePacket *resp, UArg log);
   144        
   145        /*!
   146         *  ======== disableLog ========
   147         */
   148        Void disableLog(ResponsePacket *resp, UArg log);
   149        
   150        /*!
   151         *  ======== getCpuSpeed ========
   152         */
   153        Void getCpuSpeed(ResponsePacket *resp);
   154        
   155        /*!
   156         *  ======== resetLog ========
   157         */
   158        Void resetLog(ResponsePacket *resp, UArg log);
   159        
   160        /*!
   161         *  ======== changePeriod ========
   162         */
   163        Void changePeriod(ResponsePacket *resp, UArg period);
   164    
   165        /*!
   166         *  @_nodoc
   167         *  ======== genRta ========
   168         *  Generates the Rta XML file.
   169         */
   170        function genRta(outputFileName);
   171    
   172    }
   173    /*
   174     *  @(#) xdc.runtime; 2, 1, 0,0; 7-26-2016 11:46:16; /db/ztree/library/trees/xdc/xdc-B21/src/packages/
   175     */
   176