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_handler_spi.c
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 ** This file implements the ABCC_DunDriver() and ABCC_ISR() routine for SPI 00026 ** operating mode. 00027 ******************************************************************************** 00028 ******************************************************************************** 00029 */ 00030 00031 #include "abcc_drv_cfg.h" 00032 00033 #if( ABCC_CFG_DRV_SPI ) 00034 00035 #include "abcc_td.h" 00036 #include "../abcc_drv_if.h" 00037 #include "abp.h" 00038 #include "abcc.h" 00039 #include "../abcc_link.h" 00040 #include "abcc_sys_adapt.h" 00041 #include "../abcc_debug_err.h" 00042 #include "../abcc_handler.h" 00043 #include "../abcc_timer.h" 00044 00045 /******************************************************************************* 00046 ** Public Globals 00047 ******************************************************************************** 00048 */ 00049 00050 /******************************************************************************* 00051 ** Private Globals 00052 ******************************************************************************** 00053 */ 00054 00055 /******************************************************************************* 00056 ** Public Functions 00057 ******************************************************************************** 00058 */ 00059 00060 /*------------------------------------------------------------------------------ 00061 ** ABCC_RunDriver() 00062 **------------------------------------------------------------------------------ 00063 */ 00064 ABCC_ErrorCodeType ABCC_SpiRunDriver( void ) 00065 { 00066 ABCC_MainStateType eMainState; 00067 00068 eMainState = ABCC_GetMainState(); 00069 00070 if ( eMainState < ABCC_DRV_SETUP ) 00071 { 00072 if ( eMainState != ABCC_DRV_ERROR ) 00073 { 00074 ABCC_ERROR(ABCC_SEV_WARNING, ABCC_EC_INCORRECT_STATE, 0); 00075 ABCC_SetMainStateError(); 00076 } 00077 return( ABCC_EC_INCORRECT_STATE ); 00078 } 00079 00080 ABCC_CheckWrPdUpdate(); 00081 ABCC_LinkCheckSendMessage(); 00082 00083 /* 00084 ** Send MOSI frame 00085 */ 00086 pnABCC_DrvRunDriverTx(); 00087 00088 #if( ABCC_CFG_SYNC_MEASUREMENT_IP ) 00089 /* 00090 ** We have now finished sending data to the Anybus and thus we end the 00091 ** sync measurement. 00092 */ 00093 if( fAbccUserSyncMeasurementIp ) 00094 { 00095 ABCC_SYS_GpioReset(); 00096 fAbccUserSyncMeasurementIp = FALSE; 00097 } 00098 #endif 00099 00100 /* 00101 ** Handle received MISO frame 00102 */ 00103 ABCC_LinkRunDriverRx(); 00104 00105 ABCC_TriggerRdPdUpdate(); 00106 ABCC_TriggerAnbStatusUpdate(); 00107 ABCC_TriggerReceiveMessage(); 00108 00109 return( ABCC_EC_NO_ERROR ); 00110 /* end of AnybusMain() */ 00111 } 00112 00113 #if( ABCC_CFG_INT_ENABLED ) 00114 void ABCC_SpiISR() 00115 { 00116 ABCC_MainStateType eMainState; 00117 00118 eMainState = ABCC_GetMainState(); 00119 00120 if ( eMainState < ABCC_DRV_WAIT_COMMUNICATION_RDY ) 00121 { 00122 return; 00123 } 00124 00125 if ( eMainState == ABCC_DRV_WAIT_COMMUNICATION_RDY ) 00126 { 00127 ABCC_SetReadyForCommunication(); 00128 return; 00129 } 00130 00131 ABCC_CbfEvent( 0 ); 00132 } 00133 #else 00134 void ABCC_SpiISR() 00135 { 00136 ABCC_ERROR( ABCC_SEV_WARNING, ABCC_EC_INTERNAL_ERROR, 0); 00137 } 00138 #endif 00139 #endif /* ABCC_CFG_DRV_SPI */ 00140 00141 /******************************************************************************* 00142 ** Public Services 00143 ******************************************************************************** 00144 */ 00145 00146 /******************************************************************************* 00147 ** Tasks 00148 ******************************************************************************** 00149 */
Generated on Tue Jul 12 2022 15:51:56 by
