MT2523 API Reference  LinkIt SDK v4
hal_sdio.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2017 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 
343 #ifdef __cplusplus
344 extern "C" {
345 #endif
346 
352 typedef enum {
357 
358 
360 typedef enum {
364 
365 
367 typedef enum {
371 
372 
374 typedef enum {
378 
379 
381 typedef enum {
385 
386 typedef enum {
392 
403 typedef struct {
405  uint32_t clock;
407 
408 
411 typedef struct {
414  bool block;
416  uint16_t count;
417  uint32_t address;
418  uint32_t buffer;
420 
421 
424 typedef struct {
428  bool stop;
429  uint8_t data;
430  uint32_t address;
432 
448 typedef void (*hal_sdio_callback_t)(hal_sdio_callback_event_t event, void *user_data);
461 hal_sdio_status_t hal_sdio_register_callback(hal_sdio_port_t sdio_port, hal_sdio_callback_t sdio_callback,void *user_data);
462 
474 
475 
483 
484 
493 hal_sdio_status_t hal_sdio_set_clock(hal_sdio_port_t sdio_port, uint32_t clock);
494 
495 
503 hal_sdio_status_t hal_sdio_get_clock(hal_sdio_port_t sdio_port, uint32_t *clock);
504 
505 
515 
516 
526 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);
527 
528 
537 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);
538 
539 
549 
550 
551 
561 
571 
581 
582 
583 #ifdef __cplusplus
584 }
585 #endif
586 
587 
592 #endif /*HAL_SDIO_MODULE_ENABLED*/
593 #endif /* __HAL_SDIO_H__ */
594 
uint32_t clock
The SDIO bus clock.
Definition: hal_sdio.h:405
void(* hal_sdio_callback_t)(hal_sdio_callback_event_t event, void *user_data)
This defines the callback function prototype.
Definition: hal_sdio.h:448
No error occurred during the function call.
Definition: hal_sdio.h:355
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.
hal_sdio_callback_event_t
Definition: hal_sdio.h:386
SDIO function 0, this function selects the common I/O area register to read or write.
Definition: hal_sdio.h:382
hal_sdio_direction_t
This enum defines the SDIO command direction types.
Definition: hal_sdio.h:367
uint8_t data
Write or read back data.
Definition: hal_sdio.h:429
The SDIO bus width is 4 bits.
Definition: hal_sdio.h:362
This structure defines the SDIO COMMAND53 configuration parameter.
Definition: hal_sdio.h:411
hal_sdio_status_t hal_sdio_set_clock(hal_sdio_port_t sdio_port, uint32_t clock)
This function sets the output clock of the MSDC.
SDIO function 1, this function selects the I/O function 1 register to read or write.
Definition: hal_sdio.h:383
This structure defines the SDIO COMMAND52 configuration parameter.
Definition: hal_sdio.h:424
hal_sdio_command53_operation_t
This enum defines the SDIO command operation types.
Definition: hal_sdio.h:374
The transaction completed without any error.
Definition: hal_sdio.h:387
The SDIO read command.
Definition: hal_sdio.h:368
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.
SDIO multi-byte read/write at a fixed address.
Definition: hal_sdio.h:375
hal_sdio_bus_width_t
This enum define the SDIO bus width types.
Definition: hal_sdio.h:360
hal_sdio_status_t hal_sdio_register_callback(hal_sdio_port_t sdio_port, hal_sdio_callback_t sdio_callback, void *user_data)
This function registers a callback function to inform the user the transfer is complete.
The SDIO write command.
Definition: hal_sdio.h:369
uint16_t count
Byte or block count.
Definition: hal_sdio.h:416
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 interrupt mode...
SDIO multi-byte read/write at an incrementing address.
Definition: hal_sdio.h:376
uint32_t buffer
Buffer address for data transfer.
Definition: hal_sdio.h:418
hal_sdio_status_t
This enum defines the SDIO API return type.
Definition: hal_sdio.h:352
hal_sdio_status_t hal_sdio_execute_command53_dma_blocking(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 interrupt mode...
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:425
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:354
hal_sdio_function_id_t
This enum defines the SDIO command function number.
Definition: hal_sdio.h:381
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.
CRC error occurred during transaction.
Definition: hal_sdio.h:389
uint32_t address
Read/write address of the SDIO COMMAND53.
Definition: hal_sdio.h:417
hal_sdio_bus_width_t bus_width
Bus width for the SDIO read/write operation.
Definition: hal_sdio.h:404
An error occurred during transaction.
Definition: hal_sdio.h:388
hal_sdio_command53_operation_t operation
Operation mode for the SDIO COMMAND53.
Definition: hal_sdio.h:415
hal_sdio_port_t
This enum defines the SDIO port.
Definition: hal_platform.h:1084
An error occurred, the SDIO bus is busy.
Definition: hal_sdio.h:353
uint32_t address
Read/write address of the SDIO COMMAND52.
Definition: hal_sdio.h:430
hal_sdio_status_t hal_sdio_get_clock(hal_sdio_port_t sdio_port, uint32_t *clock)
This function gets the output clock of the MSDC.
bool stop
Indicates if the data transfer stopped or not.
Definition: hal_sdio.h:428
The SDIO bus width is 1 bit.
Definition: hal_sdio.h:361
hal_sdio_direction_t direction
Read/write direction for the SDIO COMMAND53.
Definition: hal_sdio.h:412
Data timeout occurred during transaction.
Definition: hal_sdio.h:390
This structure defines the SDIO initialization parameters.
Definition: hal_sdio.h:403
bool block
Indicates whether read/write is in a block mode or not.
Definition: hal_sdio.h:414
bool read_after_write
Indicates whether read is after write or not.
Definition: hal_sdio.h:427