📄 csl_ms.h
字号:
/* ============================================================================ * Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005 * * Use of this software is controlled by the terms and conditions found in the * license agreement under which this software has been supplied. * =========================================================================== *//** @file csl_ms.h * * @brief Header file for functional layer of MS CSL * * Path: \\(CSLPATH)\\ipmodules\\memstick\\src * * Description * - The different enumerations, structure definitions * and function declarations * * Modification 1 * - modified on: 3/6/2004 * - reason: Created the sources * * Date 3rd June, 2004 * Author Santosh Narayanan. * *//** @mainpage MS CSL 3.x * * @section Introduction * * @subsection xxx Purpose and Scope * The purpose of this document is to identify a set of common CSL APIs for * the MS module across various devices. The CSL developer is expected to * refer to this document while designing APIs for these modules. Some of the * listed APIs may not be applicable to a given MS module. While other cases * this list of APIs may not be sufficient to cover all the features of a * particular MS Module. The CSL developer should use his discretion designing * new APIs or extending the existing ones to cover these. * * @subsection aaa Terms and Abbreviations * -# CSL: Chip Support Library * -# API: Application Programmer Interface * * @subsection References * -# CSL-001-DES, CSL 3.x Design Specification Document Version 1.02 * *//* ============================================================================= * Revision History * ================ * 14-Dec-2004 kpn Updated according to CSL Upgradation guidelines * Added code for register MSMCR according to specification. * ============================================================================= */#ifndef _CSL_MS_H_#define _CSL_MS_H_#ifdef __cplusplusextern "C" {#endif#include <soc.h>#include <cslr.h>#include <csl_error.h>#include <csl_types.h>#include <cslr_ms.h>/******************************************************************************\* MS global macro declarations\******************************************************************************//* Constants for passing parameters to the MS Hardware setup function *//** @brief For not resetting the MS device */#define CSL_MS_NO_RESET (0)/** @brief For resetting the MS */#define CSL_MS_RESET (1)/** @brief For setting the parallel access interface mode for MS */#define CSL_MS_ACCESS_PARALLEL (0)/** @brief For setting the serial access interface mode for MS */#define CSL_MS_ACCESS_SERIAL (1)/** @brief For enabling the CRC */#define CSL_MS_CRC_ENABLE (0)/** @brief For disabling the CRC */#define CSL_MS_CRC_DISABLE (1)/** @brief For not clearing the Interrupt to Host */#define CSL_MS_INTCLR_DISABLE (0)/** @brief For clearing the Interrupt to Host */#define CSL_MS_INTCLR_ENABLE (1)/** @brief For disabling the interrupt to Host */#define CSL_MS_INT_HOST_DISABLE (0)/** @brief For enabling the interrupt to Host */#define CSL_MS_INT_HOST_ENABLE (1)/** @brief For disabling the interrupt to MS device */#define CSL_MS_INT_DEVICE_DISABLE (0)/** @brief For enabling the interrupt to MS device */#define CSL_MS_INT_DEVICE_ENABLE (1)/** @brief For not clearing the FIFO */#define CSL_MS_FIFO_CLEAR_DISABLE (0)/** @brief For clearing the FIFO */#define CSL_MS_FIFO_CLEAR_ENABLE (1)/** @brief For setting the FIFO direction as MS to FIFO to CPU */#define CSL_MS_FIFO_DIR_READ (0)/** @brief For setting the FIFO direction as FIFO to CPU to MS */#define CSL_MS_FIFO_DIR_WRITE (1)/** @brief For disabling DMA */#define CSL_MS_DMA_DISABLE (0)/** @brief For enabling DMA */#define CSL_MS_DMA_ENABLE (1)/** @brief For disabling DRM */#define CSL_MS_DRM_DISABLE (0)/** @brief For enabling DRM */#define CSL_MS_DRM_ENABLE (1)/** @brief For disabling Interrupt when Data request occurs */#define CSL_MS_DRQSL_DISABLE (0)/** @brief For enabling Interrupt when Data request occurs */#define CSL_MS_DRQSL_ENABLE (1)/** @brief For disabling the Rising Edge input */#define CSL_MS_REI_DISABLE (0)/** @brief For enabling the Rising Edge input */#define CSL_MS_REI_ENABLE (1)/** @brief For disabling the Rising Edge output */#define CSL_MS_REO_DISABLE (0)/** @brief For enabling the Rising Edge output */#define CSL_MS_REO_ENABLE (1)/* Constants for passing parameters to the MS Status Query function. *//** @brief For indicating the absence of a Data Request Interrupt */#define CSL_MS_NO_DRQ (0)/** @brief For indicating the presence of a Data Request Interrupt */#define CSL_MS_DRQ (1)/** @brief For indicating that no interrupt was received from MS */#define CSL_MS_NO_MSINT (0)/** @brief For indicating the presence of an interrupt received from MS */#define CSL_MS_MSINT (1)/** @brief For indicating command receive disabled */#define CSL_MS_RDY_DISABLE (0)/** @brief For indicating command receive enabled or protocol ended */#define CSL_MS_RDY_ENABLE (1)/** @brief For indicating no CRC error */#define CSL_MS_NO_CRC (0)/** @brief For indicating a CRC error */#define CSL_MS_CRC (1)/** @brief For indicating no Time-out error */#define CSL_MS_NO_TOE (0)/** @brief For indicating Time-out error */#define CSL_MS_TOE (1)/** @brief For indicating that the FIFO is not empty */#define CSL_MS_FIFO_NOT_EMPTY (0)/** @brief For indicating that the FIFO is empty */#define CSL_MS_FIFO_EMPTY (1)/** @brief For indicating that the FIFO is not full */#define CSL_MS_FIFO_NOT_FULL (0)/** @brief For indicating that the FIFO is full */#define CSL_MS_FIFO_FULL (1)/** @brief For indicating No MS Command End */#define CSL_MS_NO_CED (0)/** @brief For indicating an MS command End */#define CSL_MS_CED (1)/** @brief For indicating No Memory Stick errors */#define CSL_MS_NO_ERR (0)/** @brief For indicating Memory Stick error */#define CSL_MS_ERR (1)/** @brief For indicating No data buffer request */#define CSL_MS_NO_BRQ (0)/** @brief For indicating a MS data buffer request */#define CSL_MS_BRQ (1)/** @brief For indicating a command acknowledge from MS */#define CSL_MS_ACK (0)/** @brief For indicating a command no acknowledge from MS */#define CSL_MS_NO_ACK (1)/******************************************************************************\* MS global typedef declarations\******************************************************************************//** @brief Enumeration for Byte Swap selection values, to be passed as * argument to the function @a CSL_msHwControl(). * * This is used for selecting the Byte Swap order using @a CSL_msHwControl() * when the command is CSL_MS_CMD_SET_BYTESWAP. These values are obtained when * we use query command for Byte Swap Selection value. */typedef enum { /** * @brief Byte Swap Selection as: B3B2B1B0 => B3B2B1B0 */ CSL_MS_SWAP0 = CSL_MS_MSMCR_BS_SWAP0, /** * @brief Byte Swap Selection as: B3B2B1B0 => B1B0B3B2 */ CSL_MS_SWAP1 = CSL_MS_MSMCR_BS_SWAP1, /** * @brief Byte Swap Selection as: B3B2B1B0 => B2B3B0B1 */ CSL_MS_SWAP2 = CSL_MS_MSMCR_BS_SWAP2, /** * @brief Byte Swap Selection as: B3B2B1B0 => B0B1B2B3 */ CSL_MS_SWAP3 = CSL_MS_MSMCR_BS_SWAP3} CSL_MsByteSwapSel;/** @brief Enumeration for Clock Divider Ratio values, to be passed as * argument to the function @a CSL_msHwControl(). * * This is used for selecting the Clk Divider Ratio using @a CSL_msHwControl() * when the command is CSL_MS_CMD_SET_CLKDIV. These values are obtained when * we use query command for Clock Divider Ratio value. */typedef enum { /** * @brief Clock Divider Ratio : Divide by 1 */ CSL_MS_DIV1 = CSL_MS_MSMCR_CD_DIV1, /** * @brief Clock Divider Ratio : Divide by 2 */ CSL_MS_DIV2 = CSL_MS_MSMCR_CD_DIV2, /** * @brief Clock Divider Ratio : Divide by 4 */ CSL_MS_DIV4 = CSL_MS_MSMCR_CD_DIV4, /** * @brief Clock Divider Ratio : Divide by 6 */ CSL_MS_DIV6 = CSL_MS_MSMCR_CD_DIV6, /** * @brief Clock Divider Ratio : Divide by 8 */ CSL_MS_DIV8 = CSL_MS_MSMCR_CD_DIV8, /** * @brief Clock Divider Ratio : Divide by 10 */ CSL_MS_DIV10 = CSL_MS_MSMCR_CD_DIV10, /** * @brief Clock Divider Ratio : Divide by 12 */ CSL_MS_DIV12 = CSL_MS_MSMCR_CD_DIV12, /** * @brief Clock Divider Ratio : Divide by 14 */ CSL_MS_DIV14 = CSL_MS_MSMCR_CD_DIV14} CSL_MsClkDivRatio;/** @brief This object contains the reference to the instance of MS opened * using the @a CSL_msOpen(). * * Description * - The pointer to this, is passed to all MS CSL APIs. */typedef struct CSL_MsObj { /** This is a pointer to the registers of the instance of MS * referred to by this object */ CSL_MsRegsOvly regs; /** This is the instance of MS being referred to by this object */ CSL_InstNum msNum;}CSL_MsObj;/** @brief This data type is used to return the handle to the CSL of MS */typedef struct CSL_MsObj *CSL_MsHandle;/** @brief This will have the base-address information for the peripheral * instance */typedef struct { /** Base-address of the Configuration registers of MS. */ CSL_MsRegsOvly regs;} CSL_MsBaseAddress;/** @brief MS specific parameters. Present implementation doesn't have * any 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_MsParam;/** @brief MS specific context information. Present implementation doesn't * have any Context information. */typedef struct { /** Context information of MS. * The below declaration is just a place-holder for future * implementation. */ Uint16 contextInfo;} CSL_MsContext;/** @brief Register Configuration structure for Memory Stick * * Config structure of MS. This is used to configure MS * using CSL_msHwSetupRaw function */typedef struct { /** Memory Stick Command register */ volatile Uint32 MSCMD; /** Memory Stick Data register */ volatile Uint32 MSDAT; /** Memory Stick System register */ volatile Uint32 MSSYST; /** Memory Stick Module Control register */ volatile Uint32 MSMCR;} CSL_MsConfig;/** @brief Default Values for Config structure */#define CSL_MS_CONFIG_DEFAULTS { \ CSL_MS_MSCMD_RESETVAL, \ CSL_MS_MSDAT_RESETVAL, \ CSL_MS_MSSYST_RESETVAL, \ CSL_MS_MSMCR_RESETVAL \}/** @brief This has all the fields required to configure MS * at Power Up (After a Hardware Reset) or a Soft Reset
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -