TI-RTOS Drivers  tidrivers_full_2_20_00_08
SDHostCC3200.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, 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  */
93 #ifndef ti_drivers_sdhost_SDHostCC3200__include
94 #define ti_drivers_sdhost_SDHostCC3200__include
95 
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99 
100 #include <stdint.h>
101 #include <ti/drivers/ports/HwiP.h>
103 #include <ti/drivers/Power.h>
104 #include <ti/mw/fatfs/ff.h>
105 #include <ti/mw/fatfs/diskio.h>
106 
123 #define SDHostCC3200_CMD_RESERVED (32)
124 
137 #define SDHostCC3200_STATUS_RESERVED (-32)
138 
155 #define SDHostCC3200_STATUS_SUCCESS (0)
156 
166 #define SDHostCC3200_STATUS_ERROR (-1)
167 
175 #define SDHostCC3200_STATUS_UNDEFINEDCMD (-2)
176 
187 /* Add SDHostCC3200_CMD_<commands> here */
188 
196 typedef enum SDHostCC3200_CardType {
202 
243 typedef struct SDHostCC3200_HWAttrs {
245  uint_fast32_t clkRate;
246 
248  int_fast32_t intPriority;
249 
251  uint_fast32_t baseAddr;
252 
254  int_least8_t dataPin;
255 
257  int_least8_t dataPinMode;
258 
260  int_least8_t cmdPin;
261 
263  int_least8_t cmdPinMode;
264 
266  int_least8_t clkPin;
267 
269  int_least8_t clkPinMode;
271 
277 typedef struct SDHostCC3200_Object {
278  /* Disk status */
280  /* FATFS data object */
282  /* Drive number (1 Supported) */
283  uint_fast32_t driveNumber;
284  /* Number of sectors on the device */
285  uint_fast32_t numSec;
286  /* Relative Card Address */
287  uint_fast32_t rca;
288  /* SD Card command state */
289  volatile int_fast32_t stat;
290  /* SDCard Card Command Class(CCC) */
301  /* LPDS wake-up notify object */
303  /* Determined from base address */
304  unsigned int powerMgrId;
306 
311 
323 typedef struct SDHostCC3200_Config {
325  void *object;
326 
328  void const *hwAttrs;
330 
340  /* SDHostCC3200 functions */
341 typedef struct SDHostCC3200_Params {
342  uintptr_t custom;
344 
350 
357 void SDHostCC3200_close(SDHostCC3200_Handle handle);
358 
362 void SDHostCC3200_init(SDHostCC3200_Handle handle);
363 
368 int_fast8_t SDHostCC3200_control(SDHostCC3200_Handle handle, uint_fast32_t cmd,
369  uintptr_t arg);
370 
383 SDHostCC3200_Handle SDHostCC3200_open(uint_least8_t index, uint_least8_t drv,
384  SDHostCC3200_Params *params);
385 
386 #ifdef __cplusplus
387 }
388 #endif
389 
390 #endif /* ti_drivers_sdhost_SDHostCC3200__include */
unsigned int powerMgrId
Definition: SDHostCC3200.h:304
struct SDHostCC3200_Config * SDHostCC3200_Handle
A handle that is returned from a SDHost_open() call.
Definition: SDHostCC3200.h:310
SDHostCC3200 Object.
Definition: SDHostCC3200.h:277
SDHostCC3200 Hardware attributes.
Definition: SDHostCC3200.h:243
Definition: SDHostCC3200.h:199
Power manager interface.
Definition: ff.h:78
int_least8_t cmdPinMode
Definition: SDHostCC3200.h:263
void SDHostCC3200_init(SDHostCC3200_Handle handle)
uint_fast32_t numSec
Definition: SDHostCC3200.h:285
SDHost Global configuration.
Definition: SDHostCC3200.h:323
int_least8_t clkPinMode
Definition: SDHostCC3200.h:269
uint_fast32_t baseAddr
Definition: SDHostCC3200.h:251
void * SemaphoreP_Handle
Opaque client reference to an instance of a SemaphoreP.
Definition: SemaphoreP.h:96
Semaphore module for the RTOS Porting Interface.
void SDHostCC3200_Params_init(SDHostCC3200_Params *params)
Power_NotifyObj postNotify
Definition: SDHostCC3200.h:302
SDHostCC3200_Handle SDHostCC3200_open(uint_least8_t index, uint_least8_t drv, SDHostCC3200_Params *params)
BYTE DSTATUS
Definition: diskio.h:19
void SDHostCC3200_close(SDHostCC3200_Handle handle)
SemaphoreP_Handle sdSem
Definition: SDHostCC3200.h:296
uintptr_t custom
Definition: SDHostCC3200.h:342
SDHostCC3200_CardType
SD Card type inserted.
Definition: SDHostCC3200.h:196
uint_fast32_t rca
Definition: SDHostCC3200.h:287
Power notify object structure.
Definition: Power.h:112
SDHostCC3200_CardType cardType
Definition: SDHostCC3200.h:291
Definition: SDHostCC3200.h:198
void const * hwAttrs
Definition: SDHostCC3200.h:328
Definition: SDHostCC3200.h:197
void * object
Definition: SDHostCC3200.h:325
struct SDHostCC3200_Config SDHostCC3200_Config
SDHost Global configuration.
int_least8_t cmdPin
Definition: SDHostCC3200.h:260
int_least8_t dataPinMode
Definition: SDHostCC3200.h:257
Definition: SDHostCC3200.h:200
uint_fast32_t clkRate
Definition: SDHostCC3200.h:245
DSTATUS diskState
Definition: SDHostCC3200.h:279
SDHostParameters.
Definition: SDHostCC3200.h:341
volatile int_fast32_t stat
Definition: SDHostCC3200.h:289
struct SDHostCC3200_Params SDHostCC3200_Params
SDHostParameters.
void * HwiP_Handle
Opaque client reference to an instance of a HwiP.
Definition: HwiP.h:66
uint_fast32_t driveNumber
Definition: SDHostCC3200.h:283
int_least8_t dataPin
Definition: SDHostCC3200.h:254
HwiP_Handle hwiHandle
Definition: SDHostCC3200.h:300
Hardware Interrupt module for the RTOS Porting Interface.
struct SDHostCC3200_HWAttrs SDHostCC3200_HWAttrs
struct SDHostCC3200_Object SDHostCC3200_Object
SDHostCC3200 Object.
FATFS filesystem
Definition: SDHostCC3200.h:281
int_fast8_t SDHostCC3200_control(SDHostCC3200_Handle handle, uint_fast32_t cmd, uintptr_t arg)
int_least8_t clkPin
Definition: SDHostCC3200.h:266
int_fast32_t intPriority
Definition: SDHostCC3200.h:248
Copyright 2016, Texas Instruments Incorporated