1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     * 
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     * 
    11     * --/COPYRIGHT--*/
    12    /*
    13     *  ======== SysCallback.xdc ========
    14     */
    15    import xdc.runtime.Types;
    16    
    17    /*!
    18     *  ======== SysCallback ========
    19     *  ISystemSupport provider that "calls back" to application defined functions
    20     *
    21     *  This module provides an implementation of the `{@link ISystemSupport}`
    22     *  interface that simply calls back to user defined functions to enable the
    23     *  System module's functionality.
    24     */
    25    @ModuleStartup
    26    @Template("./SysCallback.xdt")
    27    module SysCallback inherits xdc.runtime.ISystemSupport {
    28        /*!
    29         *  ======== PutCharFxn ========
    30         *  Putchar function signature
    31         */
    32        typedef Void (*PutCharFxn)(Char);
    33    
    34        /*!
    35         *  ======== AtExitFxn ========
    36         *  Function called as part of normal application exit
    37         */
    38        typedef Int (*AtExitFxn)(void (*)(void));
    39    
    40        /*!
    41         *  ======== AbortFxn ========
    42         *  Abort function signature
    43         */
    44        typedef Void (*AbortFxn)(void);
    45    
    46        /*!
    47         *  ======== InitFxn ========
    48         *  Init function signature
    49         */
    50        typedef Void (*InitFxn)(void);
    51    
    52        /*!
    53         *  ======== ExitFxn ========
    54         *  Exit function signature
    55         */
    56        typedef Void (*ExitFxn)(int);
    57    
    58        /*!
    59         *  ======== putCharFxn ========
    60         *  User suplied character output function
    61         *
    62         *  This function is called whenever the `System` module needs to output
    63         *  a character; e.g., during `System_printf()` or `System_putch()`.
    64         *
    65         *  If this function is set to `null`, output characters are simply
    66         *  ignored (i.e., they are not output).
    67         */
    68        config PutCharFxn putCharFxn = null;
    69    
    70        /*!
    71         *  ======== atExitFxn ========
    72         *  User supplied atexit function to be called when `atexit()` is called
    73         *
    74         *  This function is called when the application calls `atexit()` and its
    75         *  argument is passed to this function.
    76         *
    77         *  If this function is set to `null`, the function passed to `atexit()`
    78         *  is ignored and `atexit()` will return 0.
    79         */
    80        config AtExitFxn atExitFxn = null;
    81    
    82        /*!
    83         *  ======== abortFxn ========
    84         *  User supplied abort function
    85         *
    86         *  This function is called when `abort()` is called.  If it returns to
    87         *  the caller, `abort()` will enter into a self loop to prevent futher
    88         *  execution.
    89         *
    90         *  If this function is set to `null`, `abort()` will enter into a self
    91         *  loop to prevent futher execution.
    92         */
    93        config AbortFxn abortFxn = null;
    94    
    95        /*!
    96         *  ======== initFxn ========
    97         *  User supplied initialization function
    98         *
    99         *  If this function is set to non-`null` value, it is called prior to
   100         *  `main()` during this module's startup function.
   101         */
   102        config InitFxn initFxn = null;
   103    
   104        /*!
   105         *  ======== exitFxn ========
   106         *  User supplied exit function
   107         *
   108         *  This function is called when `exit()` is called.  If it returns to
   109         *  the caller, `exit()` will enter into a self loop to prevent futher
   110         *  execution.
   111         *
   112         *  If this function is set to `null`, `exit()` will enter into a self
   113         *  loop to prevent futher execution.
   114         */
   115        config ExitFxn exitFxn = null;
   116    }