MT2523 API Reference  LinkIt SDK v4
hal_sdio.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_SDIO_H__
36 #define __HAL_SDIO_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_SDIO_MODULE_ENABLED
40 
244 #ifdef __cplusplus
245 extern "C" {
246 #endif
247 
253 typedef enum {
258 
259 
261 typedef enum {
265 
266 
268 typedef enum {
272 
273 
275 typedef enum {
279 
280 
282 typedef enum {
286 
287 
298 typedef struct {
300  uint32_t clock;
302 
303 
306 typedef struct {
309  bool block;
311  uint16_t count;
312  uint32_t address;
313  uint32_t buffer;
315 
316 
319 typedef struct {
323  bool stop;
324  uint8_t data;
325  uint32_t address;
327 
344 
345 
353 
354 
363 hal_sdio_status_t hal_sdio_set_clock(hal_sdio_port_t sdio_port, uint32_t clock);
364 
365 
373 hal_sdio_status_t hal_sdio_get_clock(hal_sdio_port_t sdio_port, uint32_t *clock);
374 
375 
385 
386 
396 hal_sdio_status_t hal_sdio_set_block_size(hal_sdio_port_t sdio_port, hal_sdio_function_id_t function, uint32_t block_size);
397 
398 
407 hal_sdio_status_t hal_sdio_get_block_size(hal_sdio_port_t sdio_port, hal_sdio_function_id_t function, uint32_t *block_size);
408 
409 
419 
420 
421 
431 
432 
442 
443 
444 #ifdef __cplusplus
445 }
446 #endif
447 
448 
453 #endif /*HAL_SDIO_MODULE_ENABLED*/
454 #endif /* __HAL_SDIO_H__ */
455 
uint32_t clock
The SDIO bus clock.
Definition: hal_sdio.h:300
No error occurred during the function call.
Definition: hal_sdio.h:256
hal_sdio_status_t hal_sdio_set_bus_width(hal_sdio_port_t sdio_port, hal_sdio_bus_width_t bus_width)
This function sets the bus widths for the MSDC and SDIO slave.
The SDIO function 0, this function selects the common I/O area register to read or write...
Definition: hal_sdio.h:283
hal_sdio_direction_t
This enum defines the SDIO command direction types.
Definition: hal_sdio.h:268
uint8_t data
Write or read back data.
Definition: hal_sdio.h:324
The SDIO bus width is 4 bits.
Definition: hal_sdio.h:263
This structure defines the SDIO COMMAND53 configuration parameter.
Definition: hal_sdio.h:306
hal_sdio_status_t hal_sdio_set_clock(hal_sdio_port_t sdio_port, uint32_t clock)
Set the output clock of the MSDC.
The SDIO function 1, this function selects the I/O function 1 register to read or write...
Definition: hal_sdio.h:284
This structure defines the SDIO COMMAND52 configuration parameter.
Definition: hal_sdio.h:319
hal_sdio_command53_operation_t
This enum defines the SDIO command operation types.
Definition: hal_sdio.h:275
The SDIO read command.
Definition: hal_sdio.h:269
hal_sdio_status_t hal_sdio_init(hal_sdio_port_t sdio_port, hal_sdio_config_t *sdio_config)
This function initializes the MSDC hardware and SDIO slave.
hal_sdio_status_t hal_sdio_execute_command53(hal_sdio_port_t sdio_port, hal_sdio_command53_config_t *command53_config)
This function reads from or writes to the SDIO slave with COMMAND53 MCU mode.
hal_sdio_status_t hal_sdio_execute_command52(hal_sdio_port_t sdio_port, hal_sdio_command52_config_t *command52_config)
This function reads from or writes to the SDIO slave with COMMAND52.
The SDIO multi-byte read/write at a fixed address.
Definition: hal_sdio.h:276
hal_sdio_bus_width_t
This enum define the SDIO bus width types.
Definition: hal_sdio.h:261
The SDIO write command.
Definition: hal_sdio.h:270
uint16_t count
Byte or block count.
Definition: hal_sdio.h:311
hal_sdio_status_t hal_sdio_execute_command53_dma(hal_sdio_port_t sdio_port, hal_sdio_command53_config_t *command53_config)
This function reads from or writes to the SDIO slave with COMMAND53 DMA mode.
The SDIO multi-byte read/write at an incrementing address.
Definition: hal_sdio.h:277
uint32_t buffer
Buffer address for data transfer.
Definition: hal_sdio.h:313
hal_sdio_status_t
This enum defines the SDIO API return type.
Definition: hal_sdio.h:253
hal_sdio_status_t hal_sdio_deinit(hal_sdio_port_t sdio_port)
This function deinitializes the MSDC and the SDIO slave settings.
hal_sdio_direction_t direction
Read/write direction for the SDIO COMMAND52.
Definition: hal_sdio.h:320
hal_sdio_status_t hal_sdio_get_block_size(hal_sdio_port_t sdio_port, hal_sdio_function_id_t function, uint32_t *block_size)
This function gets the transaction block size of the MSDC.
An error occurred and the operation failed.
Definition: hal_sdio.h:255
hal_sdio_function_id_t
This enum defines the SDIO command function number.
Definition: hal_sdio.h:282
hal_sdio_status_t hal_sdio_set_block_size(hal_sdio_port_t sdio_port, hal_sdio_function_id_t function, uint32_t block_size)
This function sets the transaction block size of the MSDC.
uint32_t address
Read/write address of the SDIO COMMAND53.
Definition: hal_sdio.h:312
hal_sdio_bus_width_t bus_width
Bus width for the SDIO read/write operation.
Definition: hal_sdio.h:299
hal_sdio_command53_operation_t operation
Operation mode for the SDIO COMMAND53.
Definition: hal_sdio.h:310
hal_sdio_port_t
This enum defines the SDIO port.
Definition: hal_platform.h:1035
The SDIO bus is busy error occurred.
Definition: hal_sdio.h:254
uint32_t address
Read/write address of the SDIO COMMAND52.
Definition: hal_sdio.h:325
hal_sdio_status_t hal_sdio_get_clock(hal_sdio_port_t sdio_port, uint32_t *clock)
Get the output clock of the MSDC.
bool stop
Indicates if the data transfer stopped or not.
Definition: hal_sdio.h:323
The SDIO bus width is 1 bit.
Definition: hal_sdio.h:262
hal_sdio_direction_t direction
Read/write direction for the SDIO COMMAND53.
Definition: hal_sdio.h:307
This structure defines the SDIO initialization parameters.
Definition: hal_sdio.h:298
bool block
Indicates whether read/write is in a block mode or not.
Definition: hal_sdio.h:309
bool read_after_write
Indicates whether read is after write or not.
Definition: hal_sdio.h:322