William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers abcc_sys_adapt.h Source File

abcc_sys_adapt.h

00001 /*******************************************************************************
00002 ********************************************************************************
00003 **                                                                            **
00004 ** ABCC Driver version 4.01.01 (2015-12-14)                                   **
00005 **                                                                            **
00006 ** Delivered with:                                                            **
00007 **    ABP         7.16.01 (2015-10-14)                                        **
00008 **                                                                            */
00009 /*******************************************************************************
00010 ********************************************************************************
00011 ** COPYRIGHT NOTIFICATION (c) 2013 HMS Industrial Networks AB                 **
00012 **                                                                            **
00013 ** This code is the property of HMS Industrial Networks AB.                   **
00014 ** The source code may not be reproduced, distributed, or used without        **
00015 ** permission. When used together with a product from HMS, permission is      **
00016 ** granted to modify, reproduce and distribute the code in binary form        **
00017 ** without any restrictions.                                                  **
00018 **                                                                            **
00019 ** THE CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. HMS DOES NOT    **
00020 ** WARRANT THAT THE FUNCTIONS OF THE CODE WILL MEET YOUR REQUIREMENTS, OR     **
00021 ** THAT THE OPERATION OF THE CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR     **
00022 ** THAT DEFECTS IN IT CAN BE CORRECTED.                                       **
00023 ********************************************************************************
00024 ********************************************************************************
00025 ** Defines system specific interface.
00026 ********************************************************************************
00027 ********************************************************************************
00028 ** Services:
00029 **    ABCC_SYS_AbccInterruptEnable  - Enable interrupts.
00030 **    ABCC_SYS_AbccInterruptDisable - Disable interrupts.
00031 **    ABCC_SYS_HWReset()            - Puts Anybus HW into reset.
00032 **    ABCC_SYS_HWReleaseReset       - Pulls Anybus HW out of reset.
00033 **    ABCC_SYS_IsAbccInterruptActive- Check if interrupt is active.
00034 **    ABCC_SYS_ReadModuleId         - Read Module Identification pins from the
00035 **                                    ABCC interface.
00036 **    ABCC_SYS_SetOpmode            - Sets ABCC Operating Mode pins from the
00037 **                                    ABCC interface
00038 **    ABCC_SYS_GetOpmode            - Reads ABCC Operating Mode from hardware
00039 **    ABCC_SYS_ModuleDetect         - Detects if a module is present by reading
00040 **                                    the Module Detection pins.
00041 **    ABCC_SYS_Init()               - Hardware or system dependent
00042 **                                    initialization.
00043 **    ABCC_SYS_Close()              - Close or free all resources allocated in
00044 **                                    ABCC_SYS_Init
00045 ********************************************************************************
00046 ********************************************************************************
00047 */
00048 #ifndef ABCC_SYS_ADAPT
00049 #define ABCC_SYS_ADAPT
00050 #include "abcc_drv_cfg.h"
00051 #include "abcc_td.h"
00052 
00053 /*******************************************************************************
00054 ** Defines
00055 ********************************************************************************
00056 */
00057 
00058 /*******************************************************************************
00059 ** Public Services Definitions
00060 ********************************************************************************
00061 */
00062 
00063 /*------------------------------------------------------------------------------
00064 ** Enable the ABCC HW interrupt (IRQ_N pin on the application interface)
00065 ** This function will be called by the driver when the ABCC interrupt shall be
00066 ** enabled.
00067 **------------------------------------------------------------------------------
00068 ** Arguments:
00069 **    None
00070 **
00071 ** Returns:
00072 **    None
00073 **------------------------------------------------------------------------------
00074 */
00075 #if( ABCC_CFG_INT_ENABLED )
00076 EXTFUNC void ABCC_SYS_AbccInterruptEnable( void );
00077 #endif
00078 
00079 /*------------------------------------------------------------------------------
00080 ** Disable ABCC HW interrupt (IRQ_N pin on the application interface)
00081 **------------------------------------------------------------------------------
00082 ** Arguments:
00083 **    None
00084 **
00085 ** Returns:
00086 **    None
00087 **------------------------------------------------------------------------------
00088 */
00089 #if( ABCC_CFG_INT_ENABLED )
00090 EXTFUNC void ABCC_SYS_AbccInterruptDisable( void );
00091 #endif
00092 
00093 /*------------------------------------------------------------------------------
00094 ** Enable the sync interrupt triggered by the sync pin on the application
00095 ** interface (MI0/SYNC).
00096 ** This function will be called by the driver when the sync interrupt shall be
00097 ** enabled.
00098 **------------------------------------------------------------------------------
00099 ** Arguments:
00100 **    None
00101 **
00102 ** Returns:
00103 **    None
00104 **------------------------------------------------------------------------------
00105 */
00106 #if( ABCC_CFG_SYNC_ENABLE && ABCC_CFG_USE_ABCC_SYNC_SIGNAL )
00107 EXTFUNC void ABCC_SYS_SyncInterruptEnable( void );
00108 #endif
00109 
00110 /*------------------------------------------------------------------------------
00111 ** Disable sync interrupt
00112 **------------------------------------------------------------------------------
00113 ** Arguments:
00114 **    None
00115 **
00116 ** Returns:
00117 **    None
00118 **------------------------------------------------------------------------------
00119 */
00120 #if( ABCC_CFG_SYNC_ENABLE && ABCC_CFG_USE_ABCC_SYNC_SIGNAL )
00121 EXTFUNC void ABCC_SYS_SyncInterruptDisable( void );
00122 #endif
00123 
00124 /*------------------------------------------------------------------------------
00125 ** Reset ABCC. Set the reset pin on the ABCC interface to low.
00126 **------------------------------------------------------------------------------
00127 ** Arguments:
00128 **    None
00129 **
00130 ** Returns:
00131 **    None
00132 **------------------------------------------------------------------------------
00133 */
00134 EXTFUNC void ABCC_SYS_HWReset( void );
00135 
00136 /*------------------------------------------------------------------------------
00137 ** Release reset of ABCC. Sets the reset pin on the ABCC_ interface to high.
00138 **------------------------------------------------------------------------------
00139 ** Arguments:
00140 **    None
00141 **
00142 ** Returns:
00143 **    None
00144 **-------------------------------------------------------------------------------
00145 */
00146 EXTFUNC void ABCC_SYS_HWReleaseReset( void );
00147 
00148 /*------------------------------------------------------------------------------
00149 ** This function shall be able to read the interrupt signal from the ABCC. It is
00150 ** used to enable polling of interrupts if they should not be enabled.
00151 **------------------------------------------------------------------------------
00152 ** Arguments:
00153 **       None.
00154 **
00155 ** Returns:
00156 **       Returns TRUE if an interrupt is active, otherwise it returns FALSE.
00157 **------------------------------------------------------------------------------
00158 */
00159 #if( ABCC_CFG_POLL_ABCC_IRQ_PIN )
00160 EXTFUNC BOOL ABCC_SYS_IsAbccInterruptActive( void );
00161 #endif
00162 
00163 /*------------------------------------------------------------------------------
00164 ** Read Module Identification pins on the host connector.
00165 ** If the identification pins are not connected the ABCC_CFG_ABCC_MODULE_ID
00166 ** definition must be set in abcc_drv_cfg.h with the correct value
00167 ** corresponding to the used device.
00168 **
00169 ** Valid return values:
00170 **    00b (0) Active CompactCom 30-series
00171 **    01b (1) Passive CompactCom
00172 **    10b (2) Active CompactCom 40-series
00173 **    11b (3) Customer specific
00174 **------------------------------------------------------------------------------
00175 ** Arguments:
00176 **    None
00177 **
00178 ** Returns:
00179 **    Module identification value
00180 **
00181 **------------------------------------------------------------------------------
00182 */
00183 #ifndef ABCC_CFG_ABCC_MODULE_ID
00184 EXTFUNC UINT8 ABCC_SYS_ReadModuleId( void );
00185 #endif
00186 
00187 /*------------------------------------------------------------------------------
00188 ** Sets ABCC Operating Mode pins on the ABCC interface. If the operating mode is
00189 ** fixed the definition ABCC_CFG_ABCC_OP_MODE_X shall be set to the configured
00190 ** operating mode instead of implementing this function. If it is hardware
00191 ** configurable ABCC_CFG_OP_MODE_HW_CONF must be defined.
00192 **------------------------------------------------------------------------------
00193 ** Arguments:
00194 **    bOpMode - 1 SPI
00195 **            - 2 Shift Register ( not supported )
00196 **            - 3-6 Reserved
00197 **            - 7 16 bit parallel
00198 **            - 8 8 bit parallel
00199 **            - 9 Serial 19.2 kbit/s
00200 **            - 10 Serial 57.6 kbit/s
00201 **            - 11 Serial 115.2 kbit/s
00202 **            - 12 Serial 625 kbit/s
00203 **
00204 ** Returns:
00205 **    None
00206 **------------------------------------------------------------------------------
00207 */
00208 #if( ABCC_CFG_OP_MODE_SETTABLE )
00209 EXTFUNC void ABCC_SYS_SetOpmode( UINT8 bOpMode );
00210 #endif
00211 
00212 /*------------------------------------------------------------------------------
00213 ** Read the configured operating mode to be used from hardware. It could be
00214 ** either e.g. a switch or the operating mode pins of the host connector.
00215 ** This function needs to be implemented if the operating mode is hardware
00216 ** configurable.
00217 **------------------------------------------------------------------------------
00218 ** Arguments:
00219 **    None
00220 **
00221 ** Returns:
00222 **    bOpMode - 1 SPI
00223 **            - 2 Shift Register ( not supported )
00224 **            - 3-6 Reserved
00225 **            - 7 16 bit parallel
00226 **            - 8 8 bit parallel
00227 **            - 9 Serial 19.2 kbit/s
00228 **            - 10 Serial 57.6 kbit/s
00229 **            - 11 Serial 115.2 kbit/s
00230 **            - 12 Serial 625 kbit/s
00231 **------------------------------------------------------------------------------
00232 */
00233 #if( ABCC_CFG_OP_MODE_GETTABLE )
00234 EXTFUNC UINT8 ABCC_SYS_GetOpmode( void );
00235 #endif
00236 
00237 /*------------------------------------------------------------------------------
00238 ** Detects if a module is present by reading the Module Detection pins on the
00239 ** ABCC interface.
00240 ** If the ABCC Module detection pins are not connected
00241 ** ABCC_CFG_MOD_DETECT_PINS_CONN must be defined.
00242 **------------------------------------------------------------------------------
00243 ** Arguments:
00244 **    None
00245 **
00246 ** Returns:
00247 **    TRUE  - Module is detected.
00248 **    FALSE - Module is not detected.
00249 **------------------------------------------------------------------------------
00250 */
00251 #if( ABCC_CFG_MOD_DETECT_PINS_CONN )
00252 EXTFUNC BOOL ABCC_SYS_ModuleDetect( void );
00253 #endif
00254 
00255 /*------------------------------------------------------------------------------
00256 ** This function is called by the driver from the ABCC_HwInit() interface.
00257 ** If there is any hardware or system dependent initialization required
00258 ** to be done at the power up initialization it shall be done here.
00259 **------------------------------------------------------------------------------
00260 ** Arguments:
00261 **    None
00262 **
00263 ** Returns:
00264 **    TRUE  - Initialization succeeded.
00265 **    FALSE - Initialization failed.
00266 **------------------------------------------------------------------------------
00267 */
00268 EXTFUNC BOOL ABCC_SYS_HwInit( void );
00269 
00270 /*------------------------------------------------------------------------------
00271 ** This function is used to measure sync timings. ABCC_CFG_SYNC_MEASUREMENT_OP
00272 ** is used when measuring the output processing time and
00273 ** ABCC_CFG_SYNC_MEASUREMENT_IP is used to measure the input processing time.
00274 ** It should reset an output signal that can be measured to ascertain
00275 ** aforementioned sync times.
00276 **------------------------------------------------------------------------------
00277 ** Arguments:
00278 **    None
00279 **
00280 ** Returns:
00281 **    None
00282 **------------------------------------------------------------------------------
00283 */
00284 #if ( ABCC_CFG_SYNC_MEASUREMENT_OP || ABCC_CFG_SYNC_MEASUREMENT_IP )
00285 EXTFUNC void ABCC_SYS_GpioReset( void );
00286 #endif
00287 
00288 /*------------------------------------------------------------------------------
00289 ** This function is used to measure sync timings. ABCC_CFG_SYNC_MEASUREMENT_OP
00290 ** is used when measuring the output processing time and
00291 ** ABCC_CFG_SYNC_MEASUREMENT_IP is used to measure the input processing time.
00292 ** It should set an output signal that can be measured to ascertain
00293 ** aforementioned sync times.
00294 **------------------------------------------------------------------------------
00295 ** Arguments:
00296 **    None
00297 **
00298 ** Returns:
00299 **    None
00300 **------------------------------------------------------------------------------
00301 */
00302 #if ( ABCC_CFG_SYNC_MEASUREMENT_OP || ABCC_CFG_SYNC_MEASUREMENT_IP )
00303 EXTFUNC void ABCC_SYS_GpioSet( void );
00304 #endif
00305 
00306 /*------------------------------------------------------------------------------
00307 ** This function is called by the driver at the beginning ABCC_StartDriver().
00308 ** If there is any hardware specific tasks required to be done every time the
00309 ** driver starts it shall be done here. Note that ABCC_StartDriver() will also
00310 ** be called during restart of the driver.
00311 **------------------------------------------------------------------------------
00312 ** Arguments:
00313 **    None
00314 **
00315 ** Returns:
00316 **    TRUE  - Initialization succeeded.
00317 **    FALSE - Initialization failed.
00318 **------------------------------------------------------------------------------
00319 */
00320 EXTFUNC BOOL ABCC_SYS_Init( void );
00321 
00322 /*------------------------------------------------------------------------------
00323 ** Called from driver at the end of ABCC_ShutDown(). Any hardware specific
00324 ** tasks that is required to be done every time the driver is stopped it shall
00325 ** be done here. Note that the driver could be started  again by calling
00326 ** ABCC_StartDriver().
00327 **------------------------------------------------------------------------------
00328 ** Arguments:
00329 **    None
00330 ** Returns:
00331 **    None
00332 **------------------------------------------------------------------------------
00333 */
00334 EXTFUNC void ABCC_SYS_Close( void );
00335 
00336 #endif  /* inclusion lock */