1    import xdc.rov.ViewInfo;
     2    
     3    /*!
     4     *  ======== Monitor ========
     5     *  ROV support for the pure C "module" Mod.c[h]
     6     *
     7     *  The file `Board_serialMon.txt` (contained in this package) illustrates
     8     *  how to use the runtime monitor `Mon.[ch]` with a TI-RTOS UART driver.
     9     */
    10    //@NoRuntime
    11    //@HeaderName("")
    12    module Monitor
    13    {
    14        /*!
    15         *  ======== rovViewInfo ========
    16         *  @_nodoc
    17         */
    18        @Facet
    19        metaonly config ViewInfo.Instance rovViewInfo = 
    20            ViewInfo.create({
    21                viewMap: [
    22                    ['Module',
    23                        {
    24                          type: ViewInfo.MODULE,
    25                                viewInitFxn: 'viewInitModule',
    26                                structName: 'ModuleView'
    27                        }
    28                    ],
    29                    ['UChar',
    30                        {
    31                            type: xdc.rov.ViewInfo.MODULE_DATA,
    32                            viewInitFxn: 'viewInitUChar',
    33                            structName: 'UCharView'
    34                        }
    35                    ],
    36                    ['Bits16',
    37                        {
    38                            type: xdc.rov.ViewInfo.MODULE_DATA,
    39                            viewInitFxn: 'viewInitBits16',
    40                            structName: 'Bits16View'
    41                        }
    42                    ],
    43                    ['Bits32',
    44                        {
    45                            type: xdc.rov.ViewInfo.MODULE_DATA,
    46                            viewInitFxn: 'viewInitBits32',
    47                            structName: 'Bits32View'
    48                        }
    49                    ],
    50                    ['Sections',
    51                        {
    52                            type: xdc.rov.ViewInfo.MODULE_DATA,
    53                            viewInitFxn: 'viewInitSections',
    54                            structName: 'SectionView'
    55                        }
    56                    ],
    57                ]
    58            });
    59    
    60        /*!
    61         *  ======== ModuleView ========
    62         *  @_nodoc
    63         */
    64        metaonly struct ModuleView {
    65            String command;   /* current monitor command */
    66            String readFxn;   /* monitor's read function */   
    67            String writeFxn;  /* monitor's write function */
    68        }
    69    
    70        /*!
    71         *  ======== SectionView ========
    72         *  @_nodoc
    73         */
    74        metaonly struct SectionView {
    75            String name;
    76            Ptr    start;
    77            Ptr    end;
    78            UInt   len;
    79        };
    80    
    81        /*!
    82         *  ======== Bits16View ========
    83         *  One row of Bits16 values
    84         *  @_nodoc
    85         */
    86        metaonly struct Bits16View {
    87            Ptr    addr;
    88            Bits16 word0;
    89            Bits16 word1;
    90            Bits16 word2;
    91            Bits16 word3;
    92            Bits16 word4;
    93            Bits16 word5;
    94            Bits16 word6;
    95            Bits16 word7;
    96        };
    97    
    98        /*!
    99         *  ======== Bits32View ========
   100         *  One row of Bits32 values
   101         *  @_nodoc
   102         */
   103        metaonly struct Bits32View {
   104            Ptr    addr;
   105            Bits32 word0;
   106            Bits32 word1;
   107            Bits32 word2;
   108            Bits32 word3;
   109        };
   110    
   111        /*!
   112         *  ======== UCharView ========
   113         *  One row of UChar values
   114         *  @_nodoc
   115         */
   116        metaonly struct UCharView {
   117            Ptr   addr;
   118            UChar byte0;
   119            UChar byte1;
   120            UChar byte2;
   121            UChar byte3;
   122            UChar byte4;
   123            UChar byte5;
   124            UChar byte6;
   125            UChar byte7;
   126        };
   127    
   128        /*! @_nodoc - target datatype used to fetch data for UCharView */
   129        struct UCharBuffer {
   130            UChar elem;
   131        };
   132        
   133        /*! @_nodoc - target datatype used to fetch data for Bits16View */
   134        struct Bits16Buffer {
   135            Bits16 elem;
   136        };
   137        
   138        /*! @_nodoc - target datatype used to fetch data for Bits32View */
   139        struct Bits32Buffer {
   140            Bits32 elem;
   141        };
   142        
   143        /*! @_nodoc - matches Mon command size */
   144        config Int MAXCMDSIZE = 128;
   145        
   146        /*! @_nodoc - Mon state structure address */
   147        config Ptr STATEADDR = "&monObject";
   148        
   149        /*! @_nodoc - matches Mon state structure */
   150        struct MonState {
   151            Char *buffer; /* command buffer (of length MAXCMDSIZE) */
   152            Fxn  read;
   153            Fxn  write;
   154        };
   155    }