TI-RTOS Drivers  tidrivers_full_2_20_00_08
SDSPI.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
100 #ifndef ti_drivers_SDSPI__include
101 #define ti_drivers_SDSPI__include
102 
103 #ifdef __cplusplus
104 extern "C" {
105 #endif
106 
107 #include <stdint.h>
108 
126 #define SDSPI_CMD_RESERVED 32
127 
140 #define SDSPI_STATUS_RESERVED -32
141 
155 #define SDSPI_STATUS_SUCCESS 0
156 
163 #define SDSPI_STATUS_ERROR -1
164 
172 #define SDSPI_STATUS_UNDEFINEDCMD -2
173 
183 /* Add SDSPI_CMD_<commands> here */
184 
192 typedef struct SDSPI_Config *SDSPI_Handle;
193 
194 
203 typedef struct SDSPI_Params {
204  uint32_t bitRate;
205  uintptr_t custom;
206 } SDSPI_Params;
207 
212 typedef void (*SDSPI_InitFxn) (SDSPI_Handle handle);
213 
218 typedef SDSPI_Handle (*SDSPI_OpenFxn) (SDSPI_Handle handle,
219  unsigned char drv,
220  SDSPI_Params *params);
221 
226 typedef void (*SDSPI_CloseFxn) (SDSPI_Handle handle);
227 
232 typedef int (*SDSPI_ControlFxn) (SDSPI_Handle handle,
233  unsigned int cmd,
234  void *arg);
235 
241 typedef struct SDSPI_FxnTable {
244 
247 
250 
254 
266 typedef struct SDSPI_Config {
269 
271  void *object;
272 
274  void const *hwAttrs;
275 } SDSPI_Config;
276 
288 extern void SDSPI_close(SDSPI_Handle handle);
289 
327 extern int SDSPI_control(SDSPI_Handle handle, unsigned int cmd, void *arg);
328 
337 extern void SDSPI_init(void);
338 
361 extern SDSPI_Handle SDSPI_open(unsigned int index, unsigned char drv,
362  SDSPI_Params *params);
363 
373 extern void SDSPI_Params_init(SDSPI_Params *params);
374 
375 #ifdef __cplusplus
376 }
377 #endif
378 
379 #endif /* ti_drivers_SDSPI__include */
SDSPI Global configuration.
Definition: SDSPI.h:266
void * object
Definition: SDSPI.h:271
struct SDSPI_Config * SDSPI_Handle
A handle that is returned from a SDSPI_open() call.
Definition: SDSPI.h:192
int(* SDSPI_ControlFxn)(SDSPI_Handle handle, unsigned int cmd, void *arg)
A function pointer to a driver specific implementation of SDSPI_control().
Definition: SDSPI.h:232
SDSPI_OpenFxn openFxn
Definition: SDSPI.h:246
SDSPI_FxnTable const * fxnTablePtr
Definition: SDSPI.h:268
The definition of a SDSPI function table that contains the required set of functions to control a spe...
Definition: SDSPI.h:241
SDSPI_Handle SDSPI_open(unsigned int index, unsigned char drv, SDSPI_Params *params)
This function registers the SDSPI driver with BIOS' FatFs module and mounts the FatFs file system...
void(* SDSPI_InitFxn)(SDSPI_Handle handle)
A function pointer to a driver specific implementation of SDSPI_init().
Definition: SDSPI.h:212
struct SDSPI_FxnTable SDSPI_FxnTable
The definition of a SDSPI function table that contains the required set of functions to control a spe...
struct SDSPI_Config SDSPI_Config
SDSPI Global configuration.
SDSPI Parameters.
Definition: SDSPI.h:203
uint32_t bitRate
Definition: SDSPI.h:204
void const * hwAttrs
Definition: SDSPI.h:274
void SDSPI_init(void)
This function initializes the SDSPI driver module.
int SDSPI_control(SDSPI_Handle handle, unsigned int cmd, void *arg)
Function performs implementation specific features on a given SDSPI_Handle.
SDSPI_Handle(* SDSPI_OpenFxn)(SDSPI_Handle handle, unsigned char drv, SDSPI_Params *params)
A function pointer to a driver specific implementation of SDSPI_open().
Definition: SDSPI.h:218
void(* SDSPI_CloseFxn)(SDSPI_Handle handle)
A function pointer to a driver specific implementation of SDSPI_close().
Definition: SDSPI.h:226
void SDSPI_Params_init(SDSPI_Params *params)
Function to initialize the SDSPI_Params struct to its defaults.
SDSPI_InitFxn initFxn
Definition: SDSPI.h:243
uintptr_t custom
Definition: SDSPI.h:205
struct SDSPI_Params SDSPI_Params
SDSPI Parameters.
void SDSPI_close(SDSPI_Handle handle)
Function to close a SDSPI peripheral specified by the SDSPI handle. This function unmounts the file s...
SDSPI_ControlFxn controlFxn
Definition: SDSPI.h:252
SDSPI_CloseFxn closeFxn
Definition: SDSPI.h:249
Copyright 2016, Texas Instruments Incorporated