William Kane / Generic

Dependents:   LaserioLib

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers abcc_drv_par_if.h Source File

abcc_drv_par_if.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, this code can be   **
00016 ** modified, reproduced and distributed in binary form without any            **
00017 ** 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 the parallel driver interface.
00026 ********************************************************************************
00027 ********************************************************************************
00028 ** Driver services:
00029 **       ABCC_DrvParInit()                      - Initialize driver privates and states to default values.
00030 **       ABCC_DrvParISR()                       - Calls in the interrupt context to acknowledge received interrupts.
00031 **       ABCC_DrvParExecute()                   - Drives the internal send/receive process if applicable
00032 **       ABCC_DrvParWriteMessage()              - Writes a message.
00033 **       ABCC_DrvParWriteProcessData()          - Writes current process data.
00034 **       ABCC_DrvParIsReadyForWriteMessage()    - Checks if the driver is ready to send a new write message.
00035 **       ABCC_DrvParIsReadyForCmd()             - Checks if the Anybus is ready to receive a new command message.
00036 **       ABCC_DrvParSetNbrOfCmds()              - Sets the number of simultaneous commands that is supported by the application.
00037 **       ABCC_DrvParSetAppStatus()              - Sets the current application status.
00038 **       ABCC_DrvParSetPdSize()                 - Sets the current process data size.
00039 **       ABCC_DrvParSetMsgReceiverBuffer()      - Sets the message receiver buffer.
00040 **       ABCC_DrvParSetIntMask()                - Set interrupt mask
00041 **       ABCC_DrvParGetWrPdBuffer()             - Get wrpd buffer
00042 **       ABCC_DrvParGetModCap()                 - Read module capability
00043 **       ABCC_DrvParGetLedStat()                - Read led status
00044 **       ABCC_DrvParParGetIntStatus()              - Get current interrupt status
00045 **       ABCC_DrvParGetAnybusState()            - Get current Anybus state
00046 **       ABCC_DrvParReadProcessData()           - Get read process data if any.
00047 **       ABCC_DrvParReadMessage()               - Get read message if any.
00048 **       ABCC_DrvParRegisterWd()                - Function to call when Wd timeOuts
00049 **       ABCC_DrvParIsSuperviced()              - Is the network supervised
00050 ********************************************************************************
00051 ********************************************************************************
00052 */
00053 
00054 #ifndef PHY_DRV_PAR_IF_H_
00055 #define PHY_DRV_PAR_IF_H_
00056 #include "abcc_drv_cfg.h"
00057 #include "abcc_td.h"
00058 #include "abp.h"
00059 
00060 #if( ABCC_CFG_DRV_PARALLEL )
00061 
00062 /*******************************************************************************
00063 ** Constants
00064 ********************************************************************************
00065 */
00066 
00067 /*******************************************************************************
00068 ** Typedefs
00069 ********************************************************************************
00070 */
00071 
00072 
00073 
00074 /*******************************************************************************
00075 ** Public Globals
00076 ********************************************************************************
00077 */
00078 
00079 
00080 /*******************************************************************************
00081 ** Public Services
00082 ********************************************************************************
00083 */
00084 
00085 /*------------------------------------------------------------------------------
00086 ** Initializes the driver to default values.
00087 ** Must be called before the driver is used.
00088 **------------------------------------------------------------------------------
00089 ** Arguments:
00090 **       None.
00091 **
00092 ** Returns:
00093 **       None.
00094 **------------------------------------------------------------------------------
00095 */
00096 EXTFUNC void ABCC_DrvParInit( UINT8 bOpmode );
00097 
00098 
00099 /*------------------------------------------------------------------------------
00100 ** Calls in the interrupt context to acknowledge received interrupts.
00101 **
00102 ** Remarks:
00103 **       The ISR routine will clear all pending interrupts.
00104 **------------------------------------------------------------------------------
00105 ** Arguments:
00106 **       None.
00107 **
00108 ** Returns:
00109 **       Acknowledged interrupts.
00110 **------------------------------------------------------------------------------
00111 */
00112 EXTFUNC UINT16  ABCC_DrvParISR( void );
00113 
00114 
00115 /*------------------------------------------------------------------------------
00116 ** Drives the internal send process.
00117 **------------------------------------------------------------------------------
00118 ** Arguments:
00119 **       None.
00120 **
00121 ** Returns:
00122 **       None.
00123 **------------------------------------------------------------------------------
00124 */
00125 EXTFUNC void ABCC_DrvParRunDriverTx( void );
00126 
00127 /*------------------------------------------------------------------------------
00128 ** Drives the internal receive process.
00129 **------------------------------------------------------------------------------
00130 ** Arguments:
00131 **       None.
00132 **
00133 ** Returns:
00134 **       Pointer to successfully sent write message.
00135 **------------------------------------------------------------------------------
00136 */
00137 EXTFUNC ABP_MsgType* ABCC_DrvParRunDriverRx( void );
00138 
00139 
00140 /*------------------------------------------------------------------------------
00141 ** Writes a message to the driver.
00142 **------------------------------------------------------------------------------
00143 ** Arguments:
00144 **       psWriteMsg:    Pointer to message.
00145 **
00146 ** Returns:
00147 **       True:          Message was successfully written and can be deallocated
00148 **                      immediately.
00149 **       False:         Message was not yet written and cannot be deallocated.
00150 **                      The psWriteMsg pointer is owned by the driver until the
00151 **                      message is written and the pointer is returned in the
00152 **                      driver execution response.
00153 **------------------------------------------------------------------------------
00154 */
00155 EXTFUNC BOOL ABCC_DrvParWriteMessage( ABP_MsgType* psWriteMsg );
00156 
00157 
00158 /*------------------------------------------------------------------------------
00159 ** Writes current process data.
00160 ** The data is copied before returning from the method.
00161 **------------------------------------------------------------------------------
00162 ** Arguments:
00163 **       pxProcessData: Pointer to process data to be sent.
00164 **
00165 ** Returns:
00166 **       None.
00167 **------------------------------------------------------------------------------
00168 */
00169 EXTFUNC void ABCC_DrvParWriteProcessData( void* pxProcessData );
00170 
00171 /*------------------------------------------------------------------------------
00172 ** Checks if the driver is in the correct state for writing process data to the anybus
00173 **------------------------------------------------------------------------------
00174 ** Arguments:
00175 **       None.
00176 **
00177 ** Returns:
00178 **       True:          Driver is in correct state to send WrPd
00179 **       False:         Driver is not in correct state to send Wrpd
00180 **------------------------------------------------------------------------------
00181 */
00182 EXTFUNC BOOL ABCC_DrvParIsReadyForWrPd( void );
00183 
00184 
00185 /*------------------------------------------------------------------------------
00186 ** Checks if the driver is ready to send a new write message.
00187 **------------------------------------------------------------------------------
00188 ** Arguments:
00189 **       None.
00190 **
00191 ** Returns:
00192 **       True:          Driver is ready to send a new write message.
00193 **       False:         Driver is not ready to send a new write message.
00194 **------------------------------------------------------------------------------
00195 */
00196 EXTFUNC BOOL ABCC_DrvParIsReadyForWriteMessage( void );
00197 
00198 
00199 /*------------------------------------------------------------------------------
00200 ** The host application checks if the Anybus is ready to receive a new command
00201 ** message.
00202 **------------------------------------------------------------------------------
00203 ** Arguments:
00204 **       None.
00205 **
00206 ** Returns:
00207 **       True:          OK to send new command.
00208 **       False:         NOK to send new command.
00209 **------------------------------------------------------------------------------
00210 */
00211 EXTFUNC BOOL ABCC_DrvParIsReadyForCmd( void );
00212 
00213 
00214 /*------------------------------------------------------------------------------
00215 ** Sets the number of simultaneous commands that is supported by the application.
00216 **------------------------------------------------------------------------------
00217 ** Arguments:
00218 **       bNbrOfCmds:    Number of commands that the application is ready to receive.
00219 **
00220 ** Returns:
00221 **       None.
00222 **------------------------------------------------------------------------------
00223 */
00224 EXTFUNC void ABCC_DrvParSetNbrOfCmds( UINT8 bNbrOfCmds );
00225 
00226 
00227 /*------------------------------------------------------------------------------
00228 **  Sets the current application status.
00229 **  Note! This information is not supported by all protocols.
00230 **------------------------------------------------------------------------------
00231 ** Arguments:
00232 **       eAppStatus:    Current application status.
00233 **
00234 ** Returns:
00235 **       None.
00236 **------------------------------------------------------------------------------
00237 */
00238 EXTFUNC void ABCC_DrvParSetAppStatus( ABP_AppStatusType eAppStatus );
00239 
00240 
00241 /*------------------------------------------------------------------------------
00242 ** Sets the current process data size.
00243 **------------------------------------------------------------------------------
00244 ** Arguments:
00245 **       iReadPdSize:   Size of read process data (bytes)
00246 **       iWritePdSize:  Size of write process data (bytes)
00247 **
00248 ** Returns:
00249 **       None.
00250 **------------------------------------------------------------------------------
00251 */
00252 EXTFUNC void ABCC_DrvParSetPdSize( const UINT16 iReadPdSize, const UINT16 iWritePdSize );
00253 
00254 
00255 /*------------------------------------------------------------------------------
00256 ** Sets the receiver buffer, to be used for the next read message.
00257 **------------------------------------------------------------------------------
00258 ** Arguments:
00259 **       psReadMsg:     Pointer where next read message will be put.
00260 **                      psReadMsg is not allowed to contain a NULL value.
00261 **
00262 ** Returns:
00263 **       None.
00264 **------------------------------------------------------------------------------
00265 */
00266 EXTFUNC void ABCC_DrvParSetMsgReceiverBuffer( ABP_MsgType* const psReadMsg );
00267 
00268 
00269 /*------------------------------------------------------------------------------
00270 ** Sets Interrupt mask according to h_aci.h.
00271 **------------------------------------------------------------------------------
00272 ** Arguments:
00273 **       iIntMask:      Interrupt mask set according to h_aci.h.
00274 **
00275 ** Returns:
00276 **       None.
00277 **------------------------------------------------------------------------------
00278 */
00279 EXTFUNC void ABCC_DrvParSetIntMask( const UINT16 iIntMask );
00280 
00281 
00282 /*------------------------------------------------------------------------------
00283 ** Get WrpdBuffer for the user to update.
00284 **------------------------------------------------------------------------------
00285 ** Arguments:
00286 **       None.
00287 **
00288 ** Returns:
00289 **       Pointer to WrPd buffer.
00290 **------------------------------------------------------------------------------
00291 */
00292 EXTFUNC void* ABCC_DrvParGetWrPdBuffer( void );
00293 
00294 
00295 /*------------------------------------------------------------------------------
00296 ** Read module capabillity
00297 **------------------------------------------------------------------------------
00298 ** Arguments:
00299 **       None.
00300 **
00301 ** Returns:
00302 **       Module capability.
00303 **------------------------------------------------------------------------------
00304 */
00305 EXTFUNC UINT16 ABCC_DrvParGetModCap( void );
00306 
00307 
00308 /*------------------------------------------------------------------------------
00309 ** Read module capability
00310 **------------------------------------------------------------------------------
00311 ** Arguments:
00312 **       None.
00313 **
00314 ** Returns:
00315 **       Module capability.
00316 **------------------------------------------------------------------------------
00317 */
00318 EXTFUNC UINT16 ABCC_DrvParGetLedStatus( void );
00319 
00320 
00321 /*------------------------------------------------------------------------------
00322 ** Gets the Anybus interrupt status.
00323 **
00324 ** Remarks:
00325 **       The ABCC_DrvISR() function will clear all pending interrupts. This
00326 **       function must be called before ABCC_DrvISR() or it will always return 0.
00327 **------------------------------------------------------------------------------
00328 ** Arguments:
00329 **       None.
00330 **
00331 ** Returns:
00332 **       The Anybus interrupt status.
00333 **------------------------------------------------------------------------------
00334 */
00335 EXTFUNC UINT16 ABCC_DrvParGetIntStatus( void );
00336 
00337 
00338 /*------------------------------------------------------------------------------
00339 ** Gets the Anybus state.
00340 **------------------------------------------------------------------------------
00341 ** Arguments:
00342 **       None.
00343 **
00344 ** Returns:
00345 **       The Anybus state.
00346 **------------------------------------------------------------------------------
00347 */
00348 EXTFUNC UINT8 ABCC_DrvParGetAnybusState( void );
00349 
00350 
00351 /*------------------------------------------------------------------------------
00352 ** Reads the read process data.
00353 **------------------------------------------------------------------------------
00354 ** Arguments:
00355 **       None.
00356 **
00357 ** Returns:
00358 **       A pointer to the read process data; or NULL if no process data to read
00359 **       was available.
00360 **------------------------------------------------------------------------------
00361 */
00362 EXTFUNC void* ABCC_DrvParReadProcessData( void );
00363 
00364 
00365 /*------------------------------------------------------------------------------
00366 ** Reads the read message.
00367 **------------------------------------------------------------------------------
00368 ** Arguments:
00369 **       None.
00370 **
00371 ** Returns:
00372 **       A pointer to the read message; or NULL if no message is available.
00373 **       The pointer, if not NULL, will point to the buffer previously set by
00374 **       calling ABCC_DrvSetMsgReceiverBuffer().
00375 **------------------------------------------------------------------------------
00376 */
00377 EXTFUNC ABP_MsgType* ABCC_DrvParReadMessage( void );
00378 
00379 /*------------------------------------------------------------------------------
00380 **  Returns supervision bit in status register.
00381 **------------------------------------------------------------------------------
00382 ** Arguments:
00383 **          -
00384 **
00385 ** Returns:
00386 **          TRUE: The device is supervised by another network device.
00387 **------------------------------------------------------------------------------
00388 */
00389 EXTFUNC BOOL ABCC_DrvParIsSupervised( void );
00390 
00391 
00392 /*------------------------------------------------------------------------------
00393 **  Returns anybus status register.
00394 **------------------------------------------------------------------------------
00395 ** Arguments:
00396 **          -
00397 **
00398 ** Returns:
00399 **          Anybus status register
00400 **------------------------------------------------------------------------------
00401 */
00402 EXTFUNC UINT8 ABCC_DrvParGetAnbStatus ( void );
00403 
00404 #endif  /* ABCC_CFG_DRV_PARALLEL */
00405 
00406 #endif  /* inclusion lock */
00407 
00408 /*******************************************************************************
00409 ** End of drv_if.h
00410 ********************************************************************************
00411 */