1    /* 
     2     *  Copyright (c) 2012 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     *  ======== SysCallback.xdc ========
    15     */
    16    package xdc.runtime;
    17    
    18    /*!
    19     *  ======== SysCallback ========
    20     *  ISystemSupport implementation for user callback functions
    21     *
    22     *  This module provides a implementation of the `{@link ISystemSupport}`
    23     *  interface that simply calls back the user defined functions to enable the
    24     *  System module's functionality.
    25     *
    26     *  Configuration is as shown below.
    27     *  @p(code)
    28     *
    29     *  var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
    30     *  SysCallback.abortFxn = "&userAbort";
    31     *  SysCallback.exitFxn  = "&userExit";
    32     *  SysCallback.flushFxn = "&userFlush";
    33     *  SysCallback.putchFxn = "&userPutch";
    34     *  SysCallback.readyFxn = "&userReady";
    35     *
    36     *  @p
    37     *
    38     */
    39    @RomConsts
    40    
    41    module SysCallback inherits xdc.runtime.ISystemSupport
    42    {
    43        /*!
    44         *  ======== AbortFxn ========
    45         *  Abort function signature
    46         */
    47        typedef Void (*AbortFxn)(CString);
    48    
    49        /*!
    50         *  ======== defaultAbort ========
    51         *  Default abort function that does nothing
    52         *
    53         *  This default abort function spins forever and never returns.
    54         */
    55        extern Void defaultAbort(CString) = xdc_runtime_SysCallback_defaultAbort;
    56    
    57        /*!
    58         *  ======== ExitFxn ========
    59         *  Exit function signature
    60         */
    61        typedef Void (*ExitFxn)(Int);
    62    
    63        /*!
    64         *  ======== defaultExit ========
    65         *  Default exit function that does nothing
    66         *
    67         *  The default exit function does nothing and returns.
    68         */
    69        extern Void defaultExit(Int) = xdc_runtime_SysCallback_defaultExit;
    70    
    71        /*!
    72         *  ======== FlushFxn ========
    73         *  Flush function signature
    74         */
    75        typedef Void (*FlushFxn)();
    76    
    77        /*!
    78         *  ======== defaultFlush ========
    79         *  Default flush function that does nothing
    80         *
    81         *  The default flush function does nothing and returns.
    82         */
    83        extern Void defaultFlush() = xdc_runtime_SysCallback_defaultFlush;
    84    
    85        /*!
    86         *  ======== PutchFxn ========
    87         *  Putch function signature
    88         */
    89        typedef Void (*PutchFxn)(Char);
    90    
    91        /*!
    92         *  ======== defaultPutch ========
    93         *  Default putch function that does nothing
    94         *
    95         *  The default putch function drops the characters.
    96         */
    97        extern Void defaultPutch(Char) = xdc_runtime_SysCallback_defaultPutch;
    98    
    99        /*!
   100         *  ======== ReadyFxn ========
   101         *  Ready function signature
   102         */
   103        typedef Bool (*ReadyFxn)();
   104    
   105        /*!
   106         *  ======== defaultReady ========
   107         *  Default ready function that does nothing
   108         *
   109         *  The default ready function returns `TRUE` always.
   110         */
   111        extern Bool defaultReady() = xdc_runtime_SysCallback_defaultReady;
   112    
   113        /*!
   114         *  ======== abortFxn =========
   115         *  User supplied abort function
   116         *
   117         *  This function is called when the application calls
   118         *  `{@link System#abort()}` function. If the user supplied funtion
   119         *  returns, the abort function of the ANSI C Standard library is called.
   120         *  For more information see the `{@link System#abort()}` documentation.
   121         *
   122         *  By default, this function is configured with a default abort function.
   123         *  This default abort function spins forever and never returns.
   124         */
   125        config AbortFxn abortFxn = "&xdc_runtime_SysCallback_defaultAbort";
   126    
   127        /*!
   128         *  ======== exitFxn =========
   129         *  User supplied exit function
   130         *
   131         *  This function is called when the application calls
   132         *  `{@link System#exit()}` function. If the user supplied function
   133         *  returns, the ANSI C Standard Library atexit processing will be
   134         *  completed. For more information see the `{@link System#exit()}`
   135         *  documentation.
   136         *
   137         *  By default, this function is configured with a default exit function.
   138         *  The default exit function does nothing and returns.
   139         */
   140        config ExitFxn exitFxn = "&xdc_runtime_SysCallback_defaultExit";
   141    
   142        /*!
   143         *  ======== flushFxn =========
   144         *  User supplied flush function
   145         *
   146         *  This function is called when the application calls
   147         *  `{@link System#flush()}` function. 
   148         *
   149         *  By default, this function is configured with a default flush function.
   150         *  The default flush function does nothing and returns.
   151         */
   152        config FlushFxn flushFxn = "&xdc_runtime_SysCallback_defaultFlush";
   153    
   154        /*!
   155         *  ======== putchFxn =========
   156         *  User supplied character output function
   157         *
   158         *  This function is called whenever the `System` module needs to output 
   159         *  a character; e.g., during `{@link System#printf()}` or 
   160         *  `{@link System#putch()}`.
   161         *
   162         *  By default, this function is configured with a default putch function.
   163         *  The default putch function drops the characters.
   164         */
   165        config PutchFxn putchFxn = "&xdc_runtime_SysCallback_defaultPutch";
   166    
   167        /*!
   168         *  ======== readyFxn =========
   169         *  User supplied ready function
   170         *
   171         *  This function is called by the `System` module prior to performing any
   172         *  character output to check if the `SystemSupport` module is ready to 
   173         *  accept the character. For more information see the 
   174         * `{@link ISystemSupport#ready()}` documentation.
   175         *
   176         *  By default, this function is configured with a default ready function. 
   177         *  The default ready function returns `TRUE` always.
   178         */
   179        config ReadyFxn readyFxn = "&xdc_runtime_SysCallback_defaultReady";
   180    }
   181    /*
   182     *  @(#) xdc.runtime; 2, 1, 0,0; 7-26-2016 11:46:16; /db/ztree/library/trees/xdc/xdc-B21/src/packages/
   183     */
   184