📄 csl_nfc.h
字号:
* any module specific parameters. */typedef struct { /** Bit mask to be used for module specific parameters. * The below declaration is just a place-holder for future * implementation. */ CSL_BitMask16 flags;} CSL_NfcParam;/** @brief Module specific context information. Present implementation doesn't have * any Context information. */typedef struct { /** Context information of NFC. * The below declaration is just a place-holder for future * implementation. */ Uint16 contextInfo;} CSL_NfcContext;/** * @brief Default values for the setup-parameters */#define CSL_NFC_HWSETUP_DEFAULTS { \ /* .chipSelect0 = */ FALSE, \ /* .chipSelect1 = */ FALSE, \ /* .chipSelect2 = */ FALSE, \ /* .chipSelect3 = */ FALSE, \ /* .writeProt0 = */ FALSE, \ /* .writeProt1 = */ FALSE, \ /* .writeProt2 = */ FALSE, \ /* .writeProt3 = */ FALSE, \ /* .eccLogic = */ CSL_NFC_ECC_DISABLE, \ /* .endianness = */ CSL_NFC_ENDIAN_LITTLE, \ /* .sendAddrBit8 = */ FALSE, \ /* .fifoMode = */ CSL_NFC_FIFOMODE_HOST, \ /* .fifoSize = */ CSL_NFC_FIFOSIZE_1, \ /* .blockCount = */ 0, \ /* .eccSelect = */ CSL_NFC_ECCREGS_3, \ /* .prescale = */ CSL_NFC_PRESCALE_DIVBY1, \ /* .autoIdle = */ CSL_NFC_AUTOIDLE_FREERUNNING \}/** @brief Setup structure used to configure the NAND Flash Controller * * This structure is used to setup the NFC using CSL_nfcHwSetup(..) */typedef struct { Bool chipSelect0; /**< Enable(TRUE)/Disable(FALSE) selection of card 0 */ Bool chipSelect1; /**< Enable(TRUE)/Disable(FALSE) selection of card 1 */ Bool chipSelect2; /**< Enable(TRUE)/Disable(FALSE) selection of card 2 */ Bool chipSelect3; /**< Enable(TRUE)/Disable(FALSE) selection of card 3 */ Bool writeProt0; /**< Enable(TRUE)/Disable(FALSE) Write Protection on card 0 */ Bool writeProt1; /**< Enable(TRUE)/Disable(FALSE) Write Protection on card 1 */ Bool writeProt2; /**< Enable(TRUE)/Disable(FALSE) Write Protection on card 2 */ Bool writeProt3; /**< Enable(TRUE)/Disable(FALSE) Write Protection on card 3 */ CSL_NfcEccComputation eccLogic; /**< Configure computation of ECC */ CSL_NfcEndianness endianness; /**< Endianism to use */ Bool sendAddrBit8; /**< Enable(TRUE)/Disable(FALSE) sending bit-8 of address */ CSL_NfcFifoMode fifoMode; /**< Configure FIFO mode -- prefetch/postwrite/host modes */ CSL_NfcFifoSize fifoSize; /**< Size of the FIFO in bytes */ Uint16 blockCount; /**< Block count of FIFO-sized bytes to read/write in advance */ CSL_NfcEccRegSelect eccSelect; /**< Number of ECC registers to enable */ CSL_NfcPrescale prescale; /**< Prescale sampling clock divider */ CSL_NfcAutoIdle autoIdle; /**< Controls clock activity */} CSL_NfcHwSetup;/** The default value for @a CSL_NfcConfig structure */#define CSL_NFC_CONFIG_DEFAULTS { \ CSL_NFC_ACCESS_RESETVAL, \ CSL_NFC_ADDR_SRC_RESETVAL, \ CSL_NFC_CTRL_RESETVAL, \ CSL_NFC_MASK_RESETVAL, \ CSL_NFC_STATUS_RESETVAL, \ CSL_NFC_COMMAND_RESETVAL, \ CSL_NFC_COMMAND_SEC_RESETVAL, \ CSL_NFC_ECC_SELECT_RESETVAL, \ CSL_NFC_RESET_RESETVAL, \ CSL_NFC_FIFO_RESETVAL, \ CSL_NFC_FIFOCTRL_RESETVAL, \ CSL_NFC_PSC_CLK_RESETVAL, \ CSL_NFC_SYSTEST_RESETVAL, \ CSL_NFC_SYSCFG_RESETVAL, \ CSL_NFC_FIFOTEST1_RESETVAL, \ CSL_NFC_FIFOTEST2_RESETVAL, \ CSL_NFC_FIFOTEST3_RESETVAL, \ CSL_NFC_FIFOTEST4_RESETVAL \}/** * @brief The config-structure * * Used to configure the nfc using CSL_nfcHwSetupRaw() function */typedef struct { Uint32 ACCESS; Uint32 ADDR_SRC; Uint32 CTRL; Uint32 MASK; Uint32 STATUS; Uint32 COMMAND; Uint32 COMMAND_SEC; Uint32 ECC_SELECT; Uint32 RESET; Uint32 FIFO; Uint32 FIFOCTRL; Uint32 PSC_CLK; Uint32 SYSTEST; Uint32 SYSCFG; Uint32 FIFOTEST1; Uint32 FIFOTEST2; Uint32 FIFOTEST3; Uint32 FIFOTEST4;} CSL_NfcConfig;/** This function initializes the device registers with the register-values provided through the Config Data structure. For information passed thr ough the Config Data structure refer to @a CSL_NfcConfig. * * <b> Usage Constraints: </b> * The user has to allocate space for & fill in the main setup structure appropriately before calling this function. * * @b Example: * @verbatim CSL_NfcHandle hNfc; CSL_NfcConfig config = CSL_NFC_CONFIG_DEFAULTS; ... CSL_nfc(hNfc, &config); @endverbatim * * @return Returns the status of the setup operation * */CSL_Status CSL_nfcHwSetupRaw( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc, /** pointer to the object that holds reference to the * config structure */ CSL_NfcConfig * setup);/** @brief Opens the instance of NFC requested. * * The open call sets up the data structures for the particular instance of * NFC device. The device can be re-opened anytime after it has been normally * closed if so required. The handle returned by this call is input as an * essential argument for rest of the APIs described for this module. * * <b> Usage Constraints: </b> * NFC must be successfully initialized via @a CSL_nfcInit() before calling * this function. Memory for the @a CSL_nfcObj must be allocated outside * this call. This object must be retained while usage of this peripheral. * * @b Example: * @verbatim CSL_NfcObj nfcObj; CSL_Status status; ... hNfc = CSL_nfcOpen(&nfcObj, CSL_NFC_1, NULL, &status); @endverbatim * * @return returns a handle @a CSL_NfcHandle to the requested instance of * NFC if the call is successful, otherwise, a @a NULL is returned. * */CSL_NfcHandle CSL_nfcOpen ( /** Pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcObj * pNfcObj, /** Instance of NFC to which a handle is requested */ CSL_InstNum nfcNum, /** Module specific parameters; * Currently there are none; the user should pass 'NULL' */ CSL_NfcParam * pNfcParam, /** This returns the status (success/errors) of the call. * Could be 'NULL' if the user does not want status information. */ CSL_Status * pStatus);/** @brief closes the instance of NFC requested */CSL_Status CSL_nfcClose( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc);/** @brief programs the NFC to a useful state as specified */CSL_Status CSL_nfcHwSetup( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc, /** pointer to setup structure which contains the * information to program NFC to a useful state */ CSL_NfcHwSetup * setup);/** @brief gets the current setup of the NFC */CSL_Status CSL_nfcGetHwSetup ( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc, /** pointer to setup structure which would be populated * with the NFC's configuration */ CSL_NfcHwSetup * setup);/** @brief controls the different operations that can be performed by NFC */CSL_Status CSL_nfcHwControl( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc, /** the command to this API which indicates the action to be taken */ CSL_NfcHwControlCmd cmd, /** an optional argument @a void* casted */ void * arg);/** @brief Peripheral specific initialization function. * * This is the peripheral specific intialization function. This function is * idempotent in that calling it many times is same as calling it once. * This function initializes the CSL data structures, and doesn't touches * the hardware. * * <b> Usage Constraints: </b> * This function should be called before using any of the CSL APIs in the NFC * module. * * Note: As NFC doesn't have any context based information, currently, the function * just returns CSL_SOK. User is expected to pass NULL in the function call. * * @b Example: * @verbatim ... if (CSL_SOK != CSL_nfcInit(NULL)) { return; } @endverbatim * * @return returns the status of the operation * */CSL_Status CSL_nfcInit( /** NFC specific context information */ CSL_NfcContext * pContext);/** @brief returns the status of different operations or the current setup of * NFC */CSL_Status CSL_nfcGetHwStatus ( /** pointer to the object that holds reference to the * instance of NFC requested after the call */ CSL_NfcHandle hNfc, /** the query to this API which indicates the status/setup * to be returned */ CSL_NfcHwStatusQuery query, /** placeholder to return the status; @a void* casted */ void * response);/** @brief Function to get the Base-address of the peripheral instance. * * This function is used for getting the base-address of the peripheral * instance. This function will be called inside the @ CSL_nfcOpen() * function call. * * Note: This function is open for re-implementing if the user wants to modify * the base address of the peripheral object to point to a different * location and there by allow CSL initiated write/reads into peripheral * MMR's go to an alternate location. Please refer the documentation for * more details. * * @b Example: * @verbatim CSL_Status status; CSL_NfcBaseAddress baseAddress; ... status = CSL_nfcGetBaseAddress(CSL_UART_1, NULL, &baseAddress); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_nfcGetBaseAddress ( /** Instance number */ CSL_InstNum nfcNum, /** Module specific parameters */ CSL_NfcParam * pNfcParam, /** Base address details */ CSL_NfcBaseAddress * pBaseAddress);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -