blob: 178c795b98d9224891373f40efdd36bd92f93da5 [file] [log] [blame]
Jorge Ramirez-Ortiz766263c2018-09-23 09:39:56 +02001/*
2 * Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/**
8 * @file emmc_def.h
9 * @brief eMMC boot is expecting this header file
10 *
11 */
12
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000013#ifndef EMMC_DEF_H
14#define EMMC_DEF_H
Jorge Ramirez-Ortiz766263c2018-09-23 09:39:56 +020015
16#include "emmc_std.h"
17
18/* ************************ HEADER (INCLUDE) SECTION *********************** */
19
20/* ***************** MACROS, CONSTANTS, COMPILATION FLAGS ****************** */
21#define EMMC_POWER_ON (1U)
22
23/* ********************** STRUCTURES, TYPE DEFINITIONS ********************* */
24
25/* ********************** DECLARATION OF EXTERNAL DATA ********************* */
26extern st_mmc_base mmc_drv_obj;
27
28/* ************************** FUNCTION PROTOTYPES ************************** */
29
30/** @brief for assembler program
31 */
32uint32_t _rom_emmc_finalize(void);
33
34/** @brief eMMC driver API
35 */
36EMMC_ERROR_CODE rcar_emmc_init(void);
37EMMC_ERROR_CODE emmc_terminate(void);
38EMMC_ERROR_CODE rcar_emmc_memcard_power(uint8_t mode);
39EMMC_ERROR_CODE rcar_emmc_mount(void);
40EMMC_ERROR_CODE emmc_set_request_mmc_clock(uint32_t *freq);
41EMMC_ERROR_CODE emmc_send_idle_cmd(uint32_t arg);
42EMMC_ERROR_CODE emmc_select_partition(EMMC_PARTITION_ID id);
43EMMC_ERROR_CODE emmc_read_sector(uint32_t *buff_address_virtual,
44 uint32_t sector_number, uint32_t count,
45 uint32_t feature_flags);
46EMMC_ERROR_CODE emmc_write_sector(uint32_t *buff_address_virtual,
47 uint32_t sector_number, uint32_t count,
48 uint32_t feature_flags);
49EMMC_ERROR_CODE emmc_erase_sector(uint32_t *start_address,
50 uint32_t *end_address);
51uint32_t emmc_bit_field(uint8_t *data, uint32_t top, uint32_t bottom);
52
53/** @brief interrupt service
54 */
55uint32_t emmc_interrupt(void);
56
57/** @brief DMA
58 */
59
60/** @brief send command API
61 */
62EMMC_ERROR_CODE emmc_exec_cmd(uint32_t error_mask, uint32_t *response);
63void emmc_make_nontrans_cmd(HAL_MEMCARD_COMMAND cmd, uint32_t arg);
64void emmc_make_trans_cmd(HAL_MEMCARD_COMMAND cmd, uint32_t arg,
65 uint32_t *buff_address_virtual, uint32_t len,
66 HAL_MEMCARD_OPERATION dir,
67 HAL_MEMCARD_DATA_TRANSFER_MODE transfer_mode);
68EMMC_ERROR_CODE emmc_set_ext_csd(uint32_t arg);
69
70/** @brief for error information
71 */
72void emmc_write_error_info(uint16_t func_no, EMMC_ERROR_CODE error_code);
73void emmc_write_error_info_func_no(uint16_t func_no);
74
75/* ********************************* CODE ********************************** */
76
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000077#endif /* EMMC_DEF_H */
Jorge Ramirez-Ortiz766263c2018-09-23 09:39:56 +020078/* ******************************** END ************************************ */