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