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                    ['Symbols',
    58                        {
    59                            type: xdc.rov.ViewInfo.MODULE_DATA,
    60                            viewInitFxn: 'viewInitSymbols',
    61                            structName: 'SymbolView'
    62                        }
    63                    ],
    64                ]
    65            });
    66    
    67        /*!
    68         *  ======== ModuleView ========
    69         *  @_nodoc
    70         */
    71        metaonly struct ModuleView {
    72            String command;   /* current monitor command */
    73            String readFxn;   /* monitor's read function */   
    74            String writeFxn;  /* monitor's write function */
    75        }
    76    
    77        /*!
    78         *  ======== SectionView ========
    79         *  @_nodoc
    80         */
    81        metaonly struct SectionView {
    82            String name;
    83            Ptr    start;
    84            Ptr    end;
    85            UInt   len;
    86        };
    87    
    88        /*!
    89         *  ======== SymbolView ========
    90         *  @_nodoc
    91         */
    92        metaonly struct SymbolView {
    93            String name;
    94            Ptr    addr;
    95            String type;
    96        };
    97        
    98        /*!
    99         *  ======== Bits16View ========
   100         *  One row of Bits16 values
   101         *  @_nodoc
   102         */
   103        metaonly struct Bits16View {
   104            Ptr    addr;
   105            Bits16 word0;
   106            Bits16 word1;
   107            Bits16 word2;
   108            Bits16 word3;
   109            Bits16 word4;
   110            Bits16 word5;
   111            Bits16 word6;
   112            Bits16 word7;
   113        };
   114    
   115        /*!
   116         *  ======== Bits32View ========
   117         *  One row of Bits32 values
   118         *  @_nodoc
   119         */
   120        metaonly struct Bits32View {
   121            Ptr    addr;
   122            Bits32 word0;
   123            Bits32 word1;
   124            Bits32 word2;
   125            Bits32 word3;
   126        };
   127    
   128        /*!
   129         *  ======== UCharView ========
   130         *  One row of UChar values
   131         *  @_nodoc
   132         */
   133        metaonly struct UCharView {
   134            Ptr   addr;
   135            UChar byte0;
   136            UChar byte1;
   137            UChar byte2;
   138            UChar byte3;
   139            UChar byte4;
   140            UChar byte5;
   141            UChar byte6;
   142            UChar byte7;
   143        };
   144    
   145        /*! @_nodoc - target datatype used to fetch data for UCharView */
   146        struct UCharBuffer {
   147            UChar elem;
   148        };
   149        
   150        /*! @_nodoc - target datatype used to fetch data for Bits16View */
   151        struct Bits16Buffer {
   152            Bits16 elem;
   153        };
   154        
   155        /*! @_nodoc - target datatype used to fetch data for Bits32View */
   156        struct Bits32Buffer {
   157            Bits32 elem;
   158        };
   159        
   160        /*! @_nodoc - matches Mon command size */
   161        config Int MAXCMDSIZE = 128;
   162        
   163        /*! @_nodoc - Mon state structure address */
   164        config Ptr STATEADDR = "&monObject";
   165        
   166        /*! @_nodoc - matches Mon state structure */
   167        struct MonState {
   168            Char *buffer; /* command buffer (of length MAXCMDSIZE) */
   169            Fxn  read;
   170            Fxn  write;
   171        };
   172    }