Home | History | Annotate | Download | only in inc
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
      5 **| All rights reserved.                                                  |**
      6 **|                                                                       |**
      7 **| Redistribution and use in source and binary forms, with or without    |**
      8 **| modification, are permitted provided that the following conditions    |**
      9 **| are met:                                                              |**
     10 **|                                                                       |**
     11 **|  * Redistributions of source code must retain the above copyright     |**
     12 **|    notice, this list of conditions and the following disclaimer.      |**
     13 **|  * Redistributions in binary form must reproduce the above copyright  |**
     14 **|    notice, this list of conditions and the following disclaimer in    |**
     15 **|    the documentation and/or other materials provided with the         |**
     16 **|    distribution.                                                      |**
     17 **|  * Neither the name Texas Instruments nor the names of its            |**
     18 **|    contributors may be used to endorse or promote products derived    |**
     19 **|    from this software without specific prior written permission.      |**
     20 **|                                                                       |**
     21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
     22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
     23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
     24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
     25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
     26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
     27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
     28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
     29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
     30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
     31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
     32 **|                                                                       |**
     33 **+-----------------------------------------------------------------------+**
     34 ****************************************************************************/
     35 
     36 
     37 #ifndef MMC_OMAP_API_H
     38 #define MMC_OMAP_API_H
     39 
     40 #ifdef __LINUX__
     41 #include <asm/io.h>	/* include for SDIO Compilation */
     42 #endif
     43 
     44 /*
     45    SDIO_SUCCESS,
     46    SDIO_FAILURE - API return code (means success or failure of command invocation
     47    in unblocking mode and success or failure of command completion in blocking mode).
     48    SDIO_BUSY - Busy means that bus is not avilable.
     49    SDIO_BAD_ALIGNMENT - Bad alignment means that data passed for DMA transaction
     50    has been not aligned.
     51    SDIO_TIMEOUT - Timeout menas that attempt to acquire bus was failed.
     52    SDIO_BAD_INPUT_PARAMS - Bad input parameters means that parameters failed validation.
     53    SDIO_BAD_ADDRESS - Input peripheral address is not in valid range.
     54    SDIO_PACKET_SIZE_AND_MODE_INCONSISTENCY - Packet size inconsistency means that packet
     55    size does not fit the transaction mode (synchronous or asynchronous).
     56    SDIO_CONTEXT_AND_MODE_INCONSISTENCY - Context inconsistency means that API has been
     57    called from context that has some conflicts with API input parameters.
     58    SDIO_NON_AFFECTED - action was not failed, but it has no influence.
     59 */
     60 typedef enum {
     61 	SDIO_SUCCESS=0,
     62 	SDIO_FAILURE,
     63 	SDIO_BUSY,
     64 	SDIO_BAD_ALIGNMENT,
     65 	SDIO_TIMEOUT,
     66 	SDIO_BAD_INPUT_PARAMS,
     67 	SDIO_BAD_PERIPHERAL_ADDRESS,
     68 	SDIO_PACKET_SIZE_AND_MODE_INCONSISTENCY,
     69 	SDIO_CONTEXT_AND_MODE_INCONSISTENCY,
     70 	SDIO_NO_RESOURCES,
     71 	SDIO_NON_AFFECTED,
     72 } SDIO_Status;
     73 
     74 /* Pointer to the SDIO memory-mapped address space */
     75 typedef unsigned long SDIO_Address;
     76 
     77 /* Peripheral address space */
     78 typedef unsigned long Peripheral_Address;
     79 
     80 /*
     81    SDIO_BufferLength: The length of the transaction.
     82    In byte-basis operation, this length is the number of
     83    bytes in the transaction. In block-basis operation, this
     84    length is the number of blocks in the transaction.
     85 */
     86 typedef unsigned int SDIO_BufferLength;
     87 
     88 /* SDIO device driver activation states */
     89 typedef enum {
     90 	SDIO_Activation_InactiveState,    /* non initialized state */
     91 	SDIO_Activation_InitializedState, /* state after initialization or after stop */
     92 	SDIO_Activation_ActiveState,      /* state after start */
     93 	SDIO_Activation_PowerSaveState,   /* to be defined */
     94 	SDIO_Activation_EnchancedPowerSaveState,/* to be defined */
     95 	SDIO_Activation_None,
     96 } SDIO_ActivationState;
     97 
     98 /* Bus statuses */
     99 typedef enum {
    100 	SDIO_Bus_Busy,           /* in processing */
    101 	SDIO_Bus_Wait_Queue,     /* in processing - wait for the request from queue */
    102 	SDIO_Bus_Wait_Async,	 /* in processing - wait for the asynchronous response */
    103 	SDIO_Bus_Available,      /* available for use */
    104 	SDIO_Bus_None,
    105 } SDIO_BusStatus;
    106 
    107 /* SDIO request statuses */
    108 typedef enum {
    109 	SDIO_Request_Completed = 0, /* last request has been successfully completed */
    110 	SDIO_Request_InProgress,    /* last request is still in progress */
    111 	SDIO_Request_FailedTimeOut, /* last request has been failed - timeout */
    112 	SDIO_Request_FailedCRC,     /* last request has been failed - CRC */
    113 	SDIO_Request_FailedSubmit,  /* last request has been failed - submit request */
    114 	SDIO_Request_Rejected,	    /* last request has been rejected */
    115 	SDIO_Request_ReadFailed,    /* last read request has been failed */
    116 	SDIO_Request_WriteFailed,   /* last write request has been failed */
    117 	SDIO_Request_None,          /* no request has been submitted */
    118 } SDIO_RequestStatus;
    119 
    120 /*
    121    SDIO_RequestMode - how to proccess request.
    122    SDIO read or write transaction mode.
    123    OP Code 0 is used to read or write multiple bytes of
    124    data to/from a single I/O register address.
    125    This command is useful when I/O data is transferred
    126    using a FIFO inside of the I/O device. In this case,
    127    multiple bytes of data are transferred to/from a single
    128    register address.
    129    OP Code 1 is used to read or write multiple bytes of
    130    data to/from an I/O register address that increment
    131    by 1after each operation. This command is used used when
    132    large amounts of I/O data exist within the I/O card in a
    133    RAM like data buffer.
    134 */
    135 
    136 typedef char SDIO_FunctionNumber; /* SDIO protocol function Id */
    137 typedef unsigned int SDIO_RequestMode;
    138 typedef unsigned int SDIO_BlockSize; /* Block size in case of SDIO is working in block mode */
    139 typedef unsigned int SDIO_ReportLevel; /* Debug report level */
    140 typedef unsigned int SDIO_DMAThreshold; /* Threshold with regards to DMA read and write operations */
    141 typedef void* SDIO_Handle; /* SDIO handle as returned from init routine (SDIO_Init) */
    142 typedef void* SDIO_Owner;  /* handle of the object called SDIO_Init */
    143 typedef struct SDIO_Request SDIO_Request_t;
    144 /*
    145    User callback function for request completion notification
    146 */
    147 typedef void (*FNotify)(struct SDIO_Request *, int status);
    148 
    149 /*
    150    User callback function for request error notification
    151 */
    152 typedef void (*FError)(struct SDIO_Request *, int status);
    153 
    154 /* Request external format */
    155 struct SDIO_Request {
    156    u16 		 block_len;      /* Block length. Zero means byte mode */
    157    u8            *buffer;        /* Pointer to the data buffer. Data must be
    158                                     contiguously allocated and write and release
    159                                     protected by application. */
    160    unsigned long physical_buffer;/* Physical address of the same buffer */
    161    u16           buffer_len;     /* Data buffer length in bytes */
    162    SDIO_Address  peripheral_addr;/* SDIO peripheral address */
    163    u32           acquire_window; /* Time out value. If not zero, means in case SDIO resources
    164                                     are not available, try to acquire it within acquire_window
    165                                     time. Return with busy resources indication in case
    166                                     of expiration. */
    167    u8		 enqueue_flag;   /* 0 - reject request if bus is not avaialable;
    168 				    1 - put request into waiting list.
    169 				    This field is relevant only for synchronous requests.
    170 				    In case acquire_window is not zero - the attempt to wait
    171 				    for free bus is to be performed and this flag is ignored. */
    172    SDIO_RequestMode mode;	 /* One of the following values:
    173 				    - MMC_DEV_BYTE_INCREMENTAL_MODE
    174 				    - MMC_DEV_BLOCK_INCREMENTAL_MODE
    175 				    - MMC_DEV_BYTE_FIXED_MODE
    176 				    - MMC_DEV_BLOCK_FIXED_MODE */
    177    SDIO_RequestStatus status;	 /* Request complition or progress status */
    178    SDIO_Handle 	 handle;	 /* SDIO object handle */
    179    SDIO_Owner 	 owner;	 	 /* SDIO object owner handle */
    180    void          *user;          /* Lower level handle */
    181    u8            access_flag;    /* 0 means write operation !0 - read */
    182    FNotify       fnotify;	 /* callback for request completion notification */
    183    FError        ferror;         /* callback for request error notification */
    184 };
    185 
    186 /*
    187    Peripheral configuration function
    188 */
    189 typedef void Peripheral_ConfigParams;
    190 typedef SDIO_Status (*FPeripheral)(SDIO_Handle, Peripheral_ConfigParams **);
    191 
    192 /*
    193    Convert peripheral adddress into 17 bits SDIO address.
    194    Default empty function is provided for the case when a caller
    195    supplies already converted address.
    196 */
    197 typedef SDIO_Address (*FConvert)(Peripheral_Address, SDIO_BufferLength);
    198 
    199 /* Constants that are used for device driver configuration and tuning */
    200 #define MMC_DEV_TIWIPP_CONFIG_SDIO1          0x00000001 /* use SDIO port 1 */
    201 #define MMC_DEV_TIWIPP_CONFIG_SDIO2          0x00000002 /* use SDIO port 2 */
    202 #define MMC_DEV_TIWIPP_CONFIG_SDDETECT_EN    0x00000004 /* auto detection is enable */
    203 #define MMC_DEV_INIT_BE_MODE                 0x00000010 /* big endian mode */
    204 #define MMC_DEV_INIT_LE_MODE                 0x00000020 /* little endian mode */
    205 #define MMC_DEV_IRQ_NOTIFY_MODE              0x00000100 /* request notify in irq */
    206 #define MMC_DEV_TASKLET_NOTIFY_MODE          0x00000200 /* request notify in tasklet */
    207 #define MMC_DEV_SDIO_BUS_WIDTH_1             0x00001000 /* 1-bit bus mode */
    208 #define MMC_DEV_SDIO_BUS_WIDTH_4             0x00002000 /* 4-bit bus mode */
    209 #define MMC_DEV_CALLBACK_BLOCKING_MODE       0x00010000 /* callbacks in blocking mode */
    210 #define MMC_DEV_CALLBACK_ASYNC_MODE          0x00020000 /* callbacks in asynchronous mode */
    211 #define MMC_DEV_DMA_ONE_CHUNK_MODE           0x01000000 /* buffer size <= transaction */
    212 #define MMC_DEV_DMA_MULTI_CHUNK_MODE         0x02000000 /* buffer size = n*transaction */
    213 #define MMC_DEV_CONTIGUOUSE_MEMORY_MODE      0x10000000 /* memory convergence is required */
    214 #define MMC_DEV_NON_CONTIGUOUSE_MEMORY_MODE  0x20000000 /* memory copy is required */
    215 #define MMC_DEV_VIRTUAL_MEMORY_MODE  	     0x40000000 /* application passes virtual address */
    216 #define MMC_DEV_PHYSICAL_MEMORY_MODE  	     0x80000000 /* application passes physical address*/
    217 #define MMC_DEV_DEFAULT_CLOCK_RATE           24000000	/* clock rate value (24MHz) */
    218 #define MMC_DEV_DEFAULT_AFL_SIZE	              2 /* 16-bit words used by DMA write */
    219 #define MMC_DEV_DEFAULT_AEL_SIZE	              2 /* 16-bit words used by DMA read */
    220 #define MMC_DEV_DEFAULT_VDD_VOLTAGE_WINDOW   0xFFFFC0   /* 0xFFFF00 is 2.0-3.6 volts window */
    221 #define MMC_DEV_MAX_FIFO_SIZE                        64 /* controller size in bytes */
    222 #define MMC_DEV_MIN_AFL_AEL_SIZE                      2 /* 2 16-bit words used by DMA */
    223 /* Static configuration parameters.*/
    224 typedef struct {
    225 	SDIO_Owner owner;	       /* caller id */
    226 	unsigned int config_flags;     /* combination of the above "mode" values */
    227 	unsigned int clock_rate;       /* initial clock rate of SDIO bus in microseconds */
    228 	unsigned int size_for_afl;     /* AFL of MMC_BUF register (number of 16-bit words) */
    229 	unsigned int size_for_ael;     /* AEL of MMC_BUF register (number of 16-bit words) */
    230 	unsigned int vdd_voltage_window; /* VDD voltage window - OCR values */
    231 	/* User callback function for request completion notification */
    232 	FNotify fnotify_read;/* callback for read request completion notification */
    233 	FNotify fnotify_write;/* callback for write request completion notification */
    234 	FError ferror; /* callback for request error notification */
    235 	FPeripheral fconfig_peripheral; /* to be assigned to configuration peripheral target */
    236 	FConvert fconvert; /* convert peripheral address to host address function */
    237 } SDIO_ConfigParams;
    238 
    239 /* Clock and DMA threshold values  should be tuned */
    240 #define MMC_DEV_MASTER_CLOCK                48000000 /* deviser=MASTER_CLOCK/CLOCK_RATE */
    241 #define MMC_DEV_DATA_ALIGNMENT_DEFAULT		   4
    242 #define MMC_DEV_DATA_BLOCK_SIZE_DEFAULT		 512
    243 #define MMC_DEV_WRITE_BYTE_DMA_THRESHOLD_DEFUALT   MMC_DEV_DEFAULT_AFL_SIZE
    244 						   /* use DMA for packet size > threshold */
    245 #define MMC_DEV_READ_BYTE_DMA_THRESHOLD_DEFUALT    MMC_DEV_DEFAULT_AEL_SIZE
    246 						   /* use DMA for packet size > threshold */
    247 #define MMC_DEV_FUNCTION_NUMBER_DEFUALT   	   1 /* default function code Id */
    248 #define MMC_DEV_BLOCK_MODE                0x01000000 /* transaction size in blocks */
    249 #define MMC_DEV_BYTE_MODE                 0x02000000 /* transaction size in bytes */
    250 #define MMC_DEV_INCREMENTAL_ADDRESS       0x10000000 /* transaction with OP code 0 */
    251 #define MMC_DEV_FIXED_ADDRESS             0x20000000 /* transaction with OP code 1 */
    252 #define MMC_DEV_BYTE_INCREMENTAL_MODE     (MMC_DEV_BYTE_MODE|MMC_DEV_INCREMENTAL_ADDRESS)
    253 #define MMC_DEV_BLOCK_INCREMENTAL_MODE    (MMC_DEV_BLOCK_MODE|MMC_DEV_INCREMENTAL_ADDRESS)
    254 #define MMC_DEV_BYTE_FIXED_MODE           (MMC_DEV_BYTE_MODE|MMC_DEV_FIXED_ADDRESS)
    255 #define MMC_DEV_BLOCK_FIXED_MODE          (MMC_DEV_BLOCK_MODE|MMC_DEV_FIXED_ADDRESS)
    256 /* Dynamic configuration parameters */
    257 typedef struct {
    258        unsigned int write_bytes_threshold;
    259        unsigned int read_bytes_threshold;
    260        char card_function_code; /* Card function code */
    261 #ifdef CONFIG_MMC_DEBUG
    262        unsigned int report_level;
    263 #endif
    264 } SDIO_DynamicParams;
    265 
    266 /*
    267   This function initializes the SDIO host controller.
    268   After the function is completed SDIO controller is
    269   ready for SDIO interface activating.
    270   The function creates SDIO object and returns a pointer to SDIO handler.
    271   This function does not communicate with SDIO controller.
    272 */
    273 SDIO_Status SDIO_Init(SDIO_ConfigParams*, SDIO_Handle*);
    274 
    275 /*
    276   This function frees all resources and destroys SDIO object.
    277 */
    278 SDIO_Status SDIO_Shutdown(SDIO_Handle);
    279 
    280 /*
    281    This function activates configured setup for the SDIO device.
    282 */
    283 SDIO_Status SDIO_Start(SDIO_Handle);
    284 
    285 /*
    286    This function disconnects the host CPU from the slave SDIO device.
    287    wait_window if non zero means to wait until last transaction is
    288    completed or until wait_window is expired and only after that
    289    disconnect.
    290    wait_window has to be always zero in case API is called from
    291    hardware interrupt context.
    292 */
    293 SDIO_Status SDIO_Stop(SDIO_Handle, unsigned long wait_window);
    294 
    295 /*
    296    This function re-activates configured setup for the SDIO device.
    297    This function can be used for recovery purpose.
    298    It performs the same set of actions like SDIO_Start with regard to
    299    SDIO controller. In addition it reset the bus state to the initial
    300    value, it drops a non-competed transaction if exist, it drops whole
    301    SDIO request (in case the request is multi transaction), in case such
    302    request is in progress.
    303 */
    304 SDIO_Status SDIO_Reset(SDIO_Handle);
    305 
    306 /*
    307    This function reads from SDIO interface.
    308    The input address is SDIO_Address, which is a pointer to
    309    the SDIO address space. The output address is local pointer in the virtual
    310    address space.
    311    The driver should convert the virtual address space to physical address
    312    space in case of DMA operation.
    313    Read operation can't be processed in case SDIO interface is occupied by
    314    other transaction. But in case acquire_window in input request is not zero,
    315    routine should try to acquire SDIO interface within acquire window.
    316 
    317    request->buf            - pointer to the data buffer. Data must be contiguously allocated
    318                              and write and release protected by application.
    319    request->physical_buffer- physical address of the same buffer.
    320    request->buf_len        - data buffer length in bytes. It contains the number of
    321                              bytes that is requested to be read.
    322                              The number of bytes that have been read within each transaction
    323                              is to be returned (one request can contain several transactions).
    324    request->peripheral_addr- SDIO peripheral address.
    325    request->acquire_window - time out value. If not zero, means in case SDIO resources
    326                              are not available, try to acquire it within acquire_window
    327                              time. Return with busy resources indication in case  of
    328                              expiration.
    329    request->enqueue_flag   - flag indicating whether to put or not syncronouse request into
    330 			     device waiting list.
    331    request->mode           - flag that is a valid combination of the following constants:
    332                              - MMC_DEV_BLOCK_MODE or MMC_DEV_BYTE_MODE;
    333                              - MMC_DEV_INCREMENTAL_ADDRESS or MMC_DEV_FIXED_ADDRESS.
    334 
    335    Upon request completion, the result is to be returned to the request
    336    originator.
    337 */
    338 SDIO_Status SDIO_SyncRead(SDIO_Handle, SDIO_Request_t*);
    339 
    340 /*
    341    The input address is a local pointer in the virtual address space.
    342    The output address is SDIO_Address, which is a pointer to the SDIO
    343    address space.
    344    Write operation can't be processed in case SDIO interface is occupied by
    345    other transaction. But in case acquire_window in input request is not zero,
    346    routine should try to acquire SDIO interface within acquire window.
    347 
    348    request->buf            - pointer to the data buffer. Data must be contiguously allocated
    349                              and write and release protected by application.
    350    request->physical_buffer- physical address of the same buffer.
    351    request->buf_len        - data buffer length in bytes. It contains the number of
    352                              bytes that is requested to be read.
    353                              The number of bytes that have been written within each transaction
    354                              is to be returned (one request can contain several transactions).
    355    request->peripheral_addr- SDIO peripheral address.
    356    request->acquire_window - time out value. If not zero, means in case SDIO resources
    357                              are not available, try to acquire it within acquire_window
    358                              time. Return with busy resources indication in case  of
    359                              expiration.
    360    request->enqueue_flag   - flag indicating whether to put or not syncronouse request into
    361 			     device waiting list.
    362    request->mode           - flag that is a valid combination of the following constants:
    363                              - MMC_DEV_BLOCK_MODE or MMC_DEV_BYTE_MODE;
    364                              - MMC_DEV_INCREMENTAL_ADDRESS or MMC_DEV_FIXED_ADDRESS.
    365 
    366    Upon request completion, the result is to be returned to the request
    367    originator.
    368 */
    369 SDIO_Status SDIO_SyncWrite(SDIO_Handle, SDIO_Request_t*);
    370 
    371 #ifdef CONFIG_ASYNC_API
    372 /*
    373    This function reads from SDIO interface.
    374    Read operation request is to be proceeded in a chunks of
    375    pre-configured size (this size is set at the initialization time).
    376    Upon part of the request completion (up to one chunk), the result
    377    is to be indicated through the related DMA callback.
    378    The request control data, like number of bytes or blocks that
    379    should be read within transaction, bus status etc, are to be stored
    380    within request template.
    381 */
    382 SDIO_Status SDIO_AsyncRead(SDIO_Handle, SDIO_Request_t*);
    383 
    384 /*
    385    This function writes to SDIO interface.
    386    Write operation request is to be proceeded in a chunks of
    387    pre-configured size (this size is set at the initialization time).
    388    Upon part of the request completion (up to one chunk), the result is to
    389    be indicated through the related DMA callback.
    390    The request control data, like number of bytes or blocks that should be
    391    read within transaction, bus status etc, are to be stored within request
    392    template.
    393 */
    394 SDIO_Status SDIO_AsyncWrite(SDIO_Handle, SDIO_Request_t*);
    395 
    396 /* The same as SDIO_SyncKillRequest, but for asynchronous mode.
    397    This function drops a non-competed transaction in case such transaction
    398    is exist, it drops whole SDIO request, in case such request is in progress.
    399    A host communicating with SDIO device can abort data transfer just by
    400    writing to the ASx bits in the CCCR. Normally, the abort is used to
    401    stop an infinite block transfer (block count=0). If an exact number of
    402    blocks to be transferred, it is recommended that the host issue a block
    403    command with the correct block count, rather than using an infinite count
    404    and aborting the data at the correct time.
    405    Additionally function runs user iterator function over each item from
    406    driver asynchronous request queue.
    407  */
    408 SDIO_Status SDIO_AsyncKillRequest(SDIO_Handle sdioHandle, void(*fiterator)(void*, int));
    409 
    410 /* Go through asynchronous request queue and call fiterator function
    411    for each non empty entry.
    412    Iterator function could be anything according to application needs: delete
    413    entry, modify entry, print entry etc from asynchronous request queue.
    414 */
    415 SDIO_Status SDIO_AsyncIterateQueue(SDIO_Handle sdioHandle, void(*fiterator)(void*, int));
    416 #endif /*CONFIG_ASYNC_API*/
    417 
    418 /*
    419    Set activation mode - write it into sdio object control structure
    420 */
    421 SDIO_Status SDIO_SetActivationState(SDIO_Handle, SDIO_ActivationState);
    422 
    423 /*
    424    Get activation mode - read from sdio object control structure
    425 */
    426 SDIO_ActivationState SDIO_GetActivationState(SDIO_Handle);
    427 
    428 /*
    429    Set function number - write it into sdio object control structure
    430 */
    431 SDIO_Status SDIO_SetFunctionNumber(SDIO_Handle, SDIO_FunctionNumber);
    432 
    433 /*
    434    Get function number - read it from sdio object control structure
    435 */
    436 SDIO_FunctionNumber SDIO_GetFunctionNumber(SDIO_Handle sdioHandle);
    437 
    438 /*
    439    Set DMA threshold parameter for read transactions - write it into
    440    SDIO object control structure
    441 */
    442 SDIO_Status SDIO_SetDMAReadThreshold(SDIO_Handle, SDIO_DMAThreshold);
    443 
    444 /*
    445    Set DMA threshold parameter for write transactions - write it into
    446    SDIO object control structure
    447 */
    448 SDIO_Status SDIO_SetDMAWriteThreshold(SDIO_Handle, SDIO_DMAThreshold);
    449 
    450 /*
    451    Set sdio object debug report level - write it into sdio object control structure
    452 */
    453 SDIO_Status SDIO_SetReportLevel(SDIO_Handle, SDIO_ReportLevel);
    454 
    455 /*
    456    Set sdio object static parameters - write it into sdio object control
    457    structure. Initialization time only.
    458 */
    459 SDIO_Status SDIO_SetStaticParams(SDIO_Handle sdioHandle, SDIO_ConfigParams *staticParams);
    460 
    461 /*
    462    Get sdio object static parameters.
    463    This function can be invoked at the initialization time only, it sets SDIO
    464    static parameters:
    465    - sdio port (controller id);
    466    - Card auto detection mode;
    467    - Endian mode;
    468    - Device driving mode (interrupt, polling or blind);
    469    - Sdio bus width (1 or 4);
    470    - Callback mode (blocking or non-blocking);
    471    - Transfer mode (single or multi chunks);
    472    - DMA channel allocation method (dynamic or static);
    473    - Clock size.
    474    SDIO object static parameters setting will be updated after validation,
    475    as following: object->static_params |= static_params.
    476 */
    477 SDIO_ConfigParams *SDIO_GetStaticParams(SDIO_Handle sdioHandle);
    478 
    479 /*
    480    Get sdio object dynamic parameters.
    481    This function can be invoked at the run-time, it sets SDIO parameters,
    482    for example:
    483    - Activation mode;
    484    - Function number;
    485    - Read DMA threshold;
    486    - Write DMA threshold;
    487    - Report level;
    488    - Transaction size (chunk);
    489    SDIO object dynamic parameters setting will be updated after validation,
    490    as following: object->dynamic_params |= dynamic_params;
    491 */
    492 SDIO_Status SDIO_SetDynamicParams(SDIO_Handle sdioHandle, SDIO_DynamicParams *dynamicParams);
    493 
    494 
    495 /*
    496    Get sdio object dynamic parameters - write it into sdio
    497    object control structure.
    498 */
    499 SDIO_DynamicParams *SDIO_GetDynamicParams(SDIO_Handle sdioHandle);
    500 
    501 /*
    502    This function read bus status from SDIO object and returns it to
    503    the caller.
    504    Note that bus status returned to the caller could be different
    505    from the real status, because this function does not run in a lock mode.
    506 */
    507 SDIO_BusStatus SDIO_GetBusStatus(SDIO_Handle);
    508 
    509 /*
    510    Set size of the block for the blocking mode.
    511    The SDIO device may transfer data in an optional block format.
    512    The SDIO specification allows any block size from 1 byte to 2048 bytes
    513    (power of 2) in order to accommodate the various natural block sizes
    514    for IO functions. Note that an SDIO card function may define a maximum
    515    block size or byte count in the CIS that is smaller than the maximum
    516    values described above.
    517 */
    518 SDIO_Status SDIO_SetBlockSize(SDIO_Handle, SDIO_BlockSize);
    519 
    520 /*
    521    This function can be used for recovery purpose.
    522    This function drops a non-competed transaction in case such transaction
    523    is exist, it drops whole SDIO request, in case such request is in progress.
    524    A host communicating with SDIO device can abort data transfer just by
    525    writing to the ASx bits in the CCCR. Normally, the abort is used to
    526    stop an infinite block transfer (block count=0). If an exact number of
    527    blocks to be transferred, it is recommended that the host issue a block
    528    command with the correct block count, rather than using an infinite count
    529    and aborting the data at the correct time.
    530 */
    531 SDIO_Status SDIO_SyncKillRequest(SDIO_Handle);
    532 
    533 /*
    534    Get status of the request executed last time.
    535 */
    536 SDIO_RequestStatus SDIO_GetLastRequestStatus(SDIO_Handle);
    537 
    538 #ifdef CONFIG_FORCE_API
    539 /*
    540    Like SDIO_SyncRead and SDIO_SyncWrite, but with enforcement to perform
    541    transactions through DMA (only one chunck per transaction).
    542    Both APIs must be called only in case the length of the buffer fits
    543    the next condtition:
    544    MMC_DEV_MAX_FIFO_SIZE <= length <= MMC_DEV_DATA_BLOCK_SIZE_DEFAULT
    545    For example:
    546    sync_read_request.buffer = dest_addr;
    547    sync_read_request.peripheral_addr = perph_addr;
    548    sync_read_request.buffer_len = length;
    549    if(lenght<MMC_DEV_MAX_FIFO_SIZE || length>MMC_DEV_DATA_BLOCK_SIZE_DEFAULT)
    550       status=SDIO_SyncRead(pHwAccess->hSdio,&sync_read_request);
    551    else
    552       status=SDIO_ForceRead(pHwAccess->hSdio,&sync_read_request);
    553    These APIs is faster then SDIO_SyncRead/SDIO_SyncWrite, but can be used
    554    only for synchronous mode.
    555 */
    556 SDIO_Status SDIO_ForceRead(SDIO_Handle sdioHandle, SDIO_Request_t *req);
    557 SDIO_Status SDIO_ForceWrite(SDIO_Handle sdioHandle, SDIO_Request_t *req);
    558 #endif
    559 
    560 #endif /* MMC_OMAP_API_H */
    561 
    562 
    563 
    564 
    565 
    566 
    567 
    568 
    569 
    570 
    571