Functions for accessing M24SR device.

Dependents:   Nucleo_NFC_Example I2C_NFC_Master Print_Entire_Nucleo_NFC01A1_Memory

Fork of lib_M24SR by Enrico Gregoratto

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lib_M24SR.h Source File

lib_M24SR.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    lib_M24SR.h
00004   * @author  MMY Application Team
00005   * @version V1.0.0
00006   * @date    20-November-2013
00007   * @brief   This file help to manage Data inside M24SR.
00008    ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MMY-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */
00027 
00028 /* Define to prevent recursive inclusion -------------------------------------*/
00029 #ifndef __LIB_M24SR_H
00030 #define __LIB_M24SR_H
00031 
00032 #ifdef __cplusplus
00033  extern "C" {
00034 #endif
00035 
00036 /* Includes ------------------------------------------------------------------*/
00037 #include "m24sr.h"   
00038      
00039 /* ---------------------- M24SR properties -----------------------------------*/
00040 #define M24SR04_NDEF_MAX_SIZE                               0x200
00041 #define M24SR16_NDEF_MAX_SIZE                               0x800
00042 #define M24SR64_NDEF_MAX_SIZE                               0x2000   
00043 
00044 
00045 #define ASK_FOR_SESSION                                         0x0000
00046 #define TAKE_SESSION                                                0xFFFF   
00047      
00048 /* M24SR buffer size is 0xF6 can be retrieve dynamicaly in CC file */
00049 #define M24SR_READ_MAX_NBBYTE                               0xF6 
00050 #define M24SR_WRITE_MAX_NBBYTE                          0xF6
00051 
00052 
00053 #define NDEF_SESSION_CLOSED                                 0xDEADBEEF
00054      
00055 #ifndef errorchk
00056 #define errorchk(fCall) if (status = (fCall), status != M24SR_ACTION_COMPLETED) \
00057     {goto Error;} else
00058 #endif
00059 
00060 uint16_t M24SR_Initialization (uint8_t* pCCBuffer, uint8_t size );
00061     
00062 uint16_t M24SR_GetNDEFFileId ( uint16_t *NDEF_fileID );
00063 uint16_t M24SR_OpenNDEFSession ( uint16_t NDEF_fileID, uint16_t Priority );
00064 uint16_t M24SR_ReadData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData);
00065 uint16_t M24SR_ForceReadData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData);
00066 uint16_t M24SR_WriteData ( uint16_t Offset , uint16_t DataSize , uint8_t* pData);
00067 uint16_t M24SR_CloseNDEFSession ( uint16_t NDEF_fileID );   
00068 
00069 uint16_t M24SR_EnableReadPassword( uint8_t* pCurrentWritePassword, uint8_t* pNewPassword);  
00070 uint16_t M24SR_DisableReadPassword( uint8_t* pCurrentWritePassword );   
00071 uint16_t M24SR_EnableWritePassword( uint8_t* pCurrentWritePassword, uint8_t* pNewPassword); 
00072 uint16_t M24SR_DisableWritePassword( uint8_t* pCurrentWritePassword );
00073 uint16_t M24SR_DisableAllPassword( uint8_t* pSuperUserPassword);
00074 
00075 uint16_t M24SR_EnableReadOnly( uint8_t* pCurrentWritePassword); 
00076 uint16_t M24SR_DisableReadOnly( uint8_t* pCurrentWritePassword);    
00077 uint16_t M24SR_EnableWriteOnly( uint8_t* pCurrentWritePassword);    
00078 uint16_t M24SR_DisableWriteOnly( uint8_t* pCurrentWritePassword);
00079 
00080 uint16_t M24SR_ManageGPO( uc8 GPO_config, uc8 mode);    
00081 
00082 #ifdef __cplusplus
00083 }
00084 #endif
00085     
00086     
00087 #endif /* __LIB_M24SR_H */
00088  
00089 /******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/