Added support for WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Dependents:   http-example-wnc http-example-wnc-modified

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPIRIT_Types.c Source File

SPIRIT_Types.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    SPIRIT_Types.c
00004   * @author  VMA division - AMS
00005   * @version 3.2.2
00006   * @date    08-July-2015
00007   * @brief   File for SPIRIT types.
00008   * @details
00009   *
00010   * @attention
00011   *
00012   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00013   *
00014   * Redistribution and use in source and binary forms, with or without modification,
00015   * are permitted provided that the following conditions are met:
00016   *   1. Redistributions of source code must retain the above copyright notice,
00017   *      this list of conditions and the following disclaimer.
00018   *   2. Redistributions in binary form must reproduce the above copyright notice,
00019   *      this list of conditions and the following disclaimer in the documentation
00020   *      and/or other materials provided with the distribution.
00021   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00022   *      may be used to endorse or promote products derived from this software
00023   *      without specific prior written permission.
00024   *
00025   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00028   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00029   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00030   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00031   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00033   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00034   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035   *
00036   ******************************************************************************
00037   */
00038 
00039 /* Includes ------------------------------------------------------------------*/
00040 #include "SPIRIT_Types.h"
00041 #include "MCU_Interface.h"
00042 
00043 
00044 /** @addtogroup SPIRIT_Libraries
00045  * @{
00046  */
00047 
00048 
00049 /** @addtogroup SPIRIT_Types
00050  * @{
00051  */
00052 
00053 
00054 /** @defgroup Types_Private_TypesDefinitions    Types Private Types Definitions
00055  * @{
00056  */
00057 
00058 
00059 /**
00060  * @}
00061  */
00062 
00063 
00064 
00065 /** @defgroup Types_Private_Defines             Types Private Defines
00066  * @{
00067  */
00068 
00069 
00070 /**
00071  * @}
00072  */
00073 
00074 
00075 
00076 /** @defgroup Types_Private_Macros               Types Private Macros
00077  * @{
00078  */
00079 
00080 
00081 /**
00082  * @}
00083  */
00084 
00085 
00086 
00087 /** @defgroup Types_Private_Variables             Types Private Variables
00088  * @{
00089  */
00090 
00091 /**
00092  * @brief  Spirit Status global variable.
00093  *         This global variable of @ref SpiritStatus type is updated on every SPI transaction
00094  *         to maintain memory of Spirit Status.
00095  */
00096 
00097 volatile SpiritStatus g_xStatus;
00098 
00099 /**
00100  * @}
00101  */
00102 
00103 
00104 
00105 /** @defgroup Types_Private_FunctionPrototypes       Types Private FunctionPrototypes
00106  * @{
00107  */
00108 
00109 
00110 
00111 /**
00112  * @}
00113  */
00114 
00115 
00116 
00117 /** @defgroup Types_Private_Functions                 Types Private Functions
00118  * @{
00119  */
00120 
00121 #ifdef  SPIRIT_USE_FULL_ASSERT
00122 /**
00123  * @brief  Reports the name of the source file and the source line number
00124  *         where the assert_param error has occurred.
00125  * @param file  pointer to the source file name
00126  * @param line  assert_param error line source number
00127  * @retval : None
00128  */
00129 void s_assert_failed(uint8_t* file, uint32_t line)
00130 {
00131   /* User can add his own implementation to report the file name and line number */
00132   printf("Wrong parameters value: file %s on line %d\r\n", file, (int)line);
00133 
00134   /* Infinite loop */
00135   while (1)
00136   {
00137   }
00138 }
00139 #elif SPIRIT_USE_VCOM_ASSERT
00140 
00141 #include "SDK_EVAL_VC_General.h"
00142 
00143 /**
00144  * @brief  Reports the name of the source file and the source line number
00145  *         where the assert_param error has occurred.
00146  * @param file pointer to the source file name
00147  * @param line  assert_param error line source number
00148  * @param expression: string representing the assert failed expression
00149  * @retval : None
00150  */
00151 void s_assert_failed(uint8_t* file, uint32_t line, char* expression)
00152 {
00153 
00154   printf("\n\rVCOM DEBUG: Incorrect parameter. Please reboot.\n\r");
00155   printf("%s:%d \n\r",file,line);
00156   printf("The expression %s returned FALSE.\n\r", expression);
00157 
00158   /* Infinite loop */
00159   while (1)
00160   {
00161   }
00162 }
00163 
00164 #elif SPIRIT_USE_FRAME_ASSERT
00165 
00166 #include "SdkUsbProtocol.h"
00167 
00168 /**
00169  * @brief Sends a notify frame with a payload indicating the name 
00170  *        of the assert failed.
00171  * @param expression: string representing the assert failed expression
00172  * @retval : None
00173  */
00174 void s_assert_failed(char* expression)
00175 {
00176   char pcPayload[100];
00177   uint16_t i;
00178   
00179   for(i = 0 ; expression[i]!='(' ; i++);
00180   expression[i]='\0';
00181   
00182   strcpy(pcPayload, &expression[3]);
00183   
00184   //sprintf(pcPayload, "The expression %s returned FALSE.\n\r", expression);
00185   SpiritNotifyAssertFailed(pcPayload);
00186 
00187 }
00188 
00189 #endif
00190 
00191 
00192 /**
00193  * @brief  Updates the gState (the global variable used to maintain memory of Spirit Status)
00194  *         reading the MC_STATE register of SPIRIT.
00195  * @param  None
00196  * @retval None
00197  */
00198 void SpiritRefreshStatus(void)
00199 {
00200   uint8_t tempRegValue;
00201 
00202   /* Reads the MC_STATUS register to update the g_xStatus */
00203   g_xStatus = SpiritSpiReadRegisters(MC_STATE1_BASE, 1, &tempRegValue);
00204 }
00205 
00206 
00207 /**
00208  * @}
00209  */
00210 
00211 
00212 
00213 /**
00214  * @}
00215  */
00216 
00217 
00218 
00219 /**
00220  * @}
00221  */
00222 
00223 
00224 
00225 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/