PDK API Guide for J721E
MMCSD.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
59 #ifndef MMCSD_H
60 #define MMCSD_H
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 #include <stdint.h>
67 #include <stddef.h>
68 
75 #define MMCSD_OK (0)
76 
82 #define MMCSD_CMD_RESERVED (32U)
83 
88 #define MMCSD_ERR (-(1))
89 
95 #define MMCSD_UNDEFINEDCMD (-(2))
96 
97 
103 #define MMCSD_ERR_1P8V_SWITCH_CARD_NOT_RESPONDING (-(3))
104 
111 #define MMCSD_ERR_1P8V_SWITCH_MMCIO_SWITCH_FAILURE (-(4))
112 
119 #define MMCSD_ERR_1P8V_SWITCH_CARD_CMD11_FAILURE (-(5))
120 
126 #define MMCSD_ERR_INVALID_FREQ (-(6))
127 
132 #define MMCSD_ERR_FREQ_SWITCH_UNSUCCESSFUL (-(7))
133 
139 #define MMCSD_ERR_VOLTAGE_SWITCH_FAILURE (-(8))
140 
146 #define MMCSD_ERR_SET_SOC_INTERRUPT_PATH (-(9))
147 
153 #define MMCSD_ERR_REL_SOC_INTERRUPT_PATH (-(10))
154 
160 #define MMCSD_ERR_TUNING_CMD_ERROR (-(11))
161 
168 typedef int32_t MMCSD_Error;
169 
173 typedef void *MMCSD_Handle;
174 
178 typedef void *MMCSD_Params;
179 
191 typedef void (*MMCSD_CardDetectCallbackFxn)(MMCSD_Handle handle, uint32_t temp);
192 
201 typedef struct MMCSD_ConfigParams_s {
202  void *custom;
206 
212 
218  uint32_t cmd,
219  const void *arg);
220 
226 
232  MMCSD_Params params);
233 
239  uint8_t *buf,
240  uint32_t block,
241  uint32_t numBlks);
242 
248  uint8_t *buf,
249  uint32_t block,
250  uint32_t numBlks);
251 
257 typedef struct MMCSD_FxnTable_s {
260 
263 
266 
269 
272 
276 
277 /* SD function table pointer */
278 extern const MMCSD_FxnTable MMCSD_fxnTable;
279 
291 typedef struct MMCSD_Config_s {
294 
296  void *object;
297 
299  void const *hwAttrs;
300 } MMCSD_Config;
301 
310 typedef struct MMCSD_mediaParams_s {
312  uint32_t blockSize;
313 
315  uint64_t blockCount;
316 
318  uint64_t size;
319 
321 
322 
323 #define MMCSD_MAX_CONFIG_CNT (5U)
325 
326 extern const MMCSD_Config_list MMCSD_config;
327 
337 extern MMCSD_Error MMCSD_close(MMCSD_Handle handle);
338 
358 extern MMCSD_Error MMCSD_control(MMCSD_Handle handle, uint32_t cmd, void *arg);
359 
368 extern MMCSD_Error MMCSD_init(void);
369 
391 extern MMCSD_Error MMCSD_open(uint32_t index,
392  MMCSD_Params params,
393  MMCSD_Handle *handle);
394 
403 
417 extern MMCSD_Error MMCSD_write(MMCSD_Handle handle,
418  uint8_t *buf,
419  uint32_t block,
420  uint32_t numBlks);
421 
435 extern MMCSD_Error MMCSD_read(MMCSD_Handle handle,
436  uint8_t *buf,
437  uint32_t block,
438  uint32_t numBlks);
439 
440 #ifdef __cplusplus
441 }
442 #endif
443 
444 #endif /* _MMCSD_H_ */
445 /* @} */
uint16_t index
Definition: tisci_rm_proxy.h:153
SD Parameters.
Definition: MMCSD.h:201
MMCSD_Config MMCSD_Config_list[MMCSD_MAX_CONFIG_CNT]
Definition: MMCSD.h:324
MMCSD_Error(* MMCSD_WriteFxn)(MMCSD_Handle handle, uint8_t *buf, uint32_t block, uint32_t numBlks)
A function pointer to a driver specific implementation of MMCSD_write().
Definition: MMCSD.h:238
MMCSD_Error MMCSD_read(MMCSD_Handle handle, uint8_t *buf, uint32_t block, uint32_t numBlks)
Function that handles the SD read for SYS/BIOS.
MMCSD_InitFxn initFxn
Definition: MMCSD.h:265
uint64_t size
Definition: MMCSD.h:318
MMCSD_Error MMCSD_control(MMCSD_Handle handle, uint32_t cmd, void *arg)
Function performs implementation specific features on a given MMCSD_Handle.
const MMCSD_FxnTable MMCSD_fxnTable
void * MMCSD_Params
A handle that is returned from a MMCSD_open() call.
Definition: MMCSD.h:178
MMCSD_Error(* MMCSD_InitFxn)(MMCSD_Handle handle)
A function pointer to a driver specific implementation of MMCSD_init().
Definition: MMCSD.h:225
The definition of a SD function table that contains the required set of functions to control a specif...
Definition: MMCSD.h:257
MMCSD_ReadFxn readFxn
Definition: MMCSD.h:274
MMCSD_Error(* MMCSD_OpenFxn)(MMCSD_Handle handle, MMCSD_Params params)
A function pointer to a driver specific implementation of MMCSD_open().
Definition: MMCSD.h:231
MMCSD_FxnTable const * fxnTablePtr
Definition: MMCSD.h:293
uint64_t blockCount
Definition: MMCSD.h:315
SD Global configuration.
Definition: MMCSD.h:291
void * MMCSD_Handle
A handle that is returned from a MMCSD_open() call.
Definition: MMCSD.h:173
MMCSD_Error MMCSD_close(MMCSD_Handle handle)
Function to close a SD peripheral specified by the SD handle.
MMCSD_Error(* MMCSD_CloseFxn)(MMCSD_Handle handle)
A function pointer to a driver specific implementation of MMCSD_close().
Definition: MMCSD.h:211
void * custom
Definition: MMCSD.h:202
uint32_t blockSize
Definition: MMCSD.h:312
MMCSD_Error MMCSD_open(uint32_t index, MMCSD_Params params, MMCSD_Handle *handle)
Function to initialize a given SD peripheral specified by the particular index value....
MMCSD_WriteFxn writeFxn
Definition: MMCSD.h:271
MMCSD_CardDetectCallbackFxn cardDetectCallback
Definition: MMCSD.h:204
MMCSD_Error(* MMCSD_ControlFxn)(MMCSD_Handle handle, uint32_t cmd, const void *arg)
A function pointer to a driver specific implementation of MMCSD_control().
Definition: MMCSD.h:217
MMCSD_ControlFxn controlFxn
Definition: MMCSD.h:262
#define MMCSD_MAX_CONFIG_CNT
Definition: MMCSD.h:323
MMCSD_OpenFxn openFxn
Definition: MMCSD.h:268
int32_t MMCSD_Error
Return status of MMCSD.
Definition: MMCSD.h:168
const MMCSD_Config_list MMCSD_config
gptp_ipc_command_t cmd
Definition: gptpipc.h:140
void * object
Definition: MMCSD.h:296
Parameters of the media attached to the controller.
Definition: MMCSD.h:310
void(* MMCSD_CardDetectCallbackFxn)(MMCSD_Handle handle, uint32_t temp)
MMCSD callback function.
Definition: MMCSD.h:191
MMCSD_CloseFxn closeFxn
Definition: MMCSD.h:259
MMCSD_Error MMCSD_Params_init(MMCSD_Params params)
Function to initialize the MMCSD_Params struct to its defaults.
MMCSD_Error MMCSD_init(void)
Function to initializes the SD module.
void const * hwAttrs
Definition: MMCSD.h:299
MMCSD_Error(* MMCSD_ReadFxn)(MMCSD_Handle handle, uint8_t *buf, uint32_t block, uint32_t numBlks)
A function pointer to a driver specific implementation of MMCSD_read().
Definition: MMCSD.h:247
MMCSD_Error MMCSD_write(MMCSD_Handle handle, uint8_t *buf, uint32_t block, uint32_t numBlks)
Function that handles the SD write for SYS/BIOS.