SDHostCC32XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2017, 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  */
32 
73 #ifndef ti_drivers_sd_SDHostCC32XX__include
74 #define ti_drivers_sd_SDHostCC32XX__include
75 
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79 
80 #include <stdint.h>
81 #include <ti/drivers/SD.h>
82 
83 #include <ti/drivers/dpl/HwiP.h>
84 #include <ti/drivers/dpl/SemaphoreP.h>
85 #include <ti/drivers/Power.h>
88 
89 #define SDHostCC32XX_PIN_06_SDCARD_DATA 0x0805
90 #define SDHostCC32XX_PIN_07_SDCARD_CLK 0x0806
91 #define SDHostCC32XX_PIN_08_SDCARD_CMD 0x0807
92 #define SDHostCC32XX_PIN_01_SDCARD_CLK 0x0600
93 #define SDHostCC32XX_PIN_02_SDCARD_CMD 0x0601
94 #define SDHostCC32XX_PIN_64_SDCARD_DATA 0x063f
95 
96 /* SDHost function table */
98 
134 typedef struct SDHostCC32XX_HWAttrsV1 {
136  uint_fast32_t clkRate;
137 
139  int_fast32_t intPriority;
140 
142  uint_fast32_t baseAddr;
143 
145  unsigned long rxChIdx;
146 
148  unsigned long txChIdx;
149 
151  uint32_t dataPin;
152 
154  uint32_t cmdPin;
155 
157  uint32_t clkPin;
159 
165 typedef struct SDHostCC32XX_Object {
166  /* Relative Card Address */
167  uint_fast32_t rca;
168  /* Write data pointer */
169  const uint_fast32_t *writeBuf;
170  /* Number of sectors written */
171  volatile uint_fast32_t writeSecCount;
172  /* Read data pointer */
173  uint_fast32_t *readBuf;
174  /* Number of sectors read */
175  volatile uint_fast32_t readSecCount;
176  /*
177  * Semaphore to suspend thread execution when waiting for SD Commands
178  * or data transfers to complete.
179  */
180  SemaphoreP_Handle cmdSem;
181  /*
182  * SD Card interrupt handle.
183  */
184  HwiP_Handle hwiHandle;
185  /* Determined from base address */
186  unsigned int powerMgrId;
187  /* LPDS wake-up notify object */
189  /* Previous park state SDCARD_CLK pin */
191  /* SDCARD_CLK pin */
192  uint16_t clkPin;
193  /* UDMA Handle */
195  /* SD Card command state */
196  volatile int_fast8_t stat;
197  /* State of the driver (open or closed) */
198  bool isOpen;
199  /* SDCard Card Command Class(CCC) */
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif /* ti_drivers_sd_SDHostCC32XX__include */
volatile int_fast8_t stat
Definition: SDHostCC32XX.h:196
SemaphoreP_Handle cmdSem
Definition: SDHostCC32XX.h:180
struct SDHostCC32XX_HWAttrsV1 SDHostCC32XX_HWAttrsV1
uint32_t clkPin
Definition: SDHostCC32XX.h:157
uint_fast32_t baseAddr
Definition: SDHostCC32XX.h:142
int_fast32_t intPriority
Definition: SDHostCC32XX.h:139
Power_NotifyObj postNotify
Definition: SDHostCC32XX.h:188
Power manager interface.
uint_fast32_t clkRate
Definition: SDHostCC32XX.h:136
SDHostCC32XX Object.
Definition: SDHostCC32XX.h:165
Power notify object structure.
Definition: Power.h:113
uint32_t dataPin
Definition: SDHostCC32XX.h:151
volatile uint_fast32_t writeSecCount
Definition: SDHostCC32XX.h:171
SD_CardType cardType
Definition: SDHostCC32XX.h:200
uDMA driver implementation for CC32XX.
bool isOpen
Definition: SDHostCC32XX.h:198
UDMACC32XX Global configuration.
Definition: UDMACC32XX.h:135
Power manager interface for the CC32XX.
uint32_t cmdPin
Definition: SDHostCC32XX.h:154
SD driver interface.
unsigned long txChIdx
Definition: SDHostCC32XX.h:148
struct SDHostCC32XX_Object SDHostCC32XX_Object
SDHostCC32XX Object.
UDMACC32XX_Handle dmaHandle
Definition: SDHostCC32XX.h:194
HwiP_Handle hwiHandle
Definition: SDHostCC32XX.h:184
PowerCC32XX_ParkState prevParkCLK
Definition: SDHostCC32XX.h:190
uint16_t clkPin
Definition: SDHostCC32XX.h:192
uint_fast32_t rca
Definition: SDHostCC32XX.h:167
The definition of a SD function table that contains the required set of functions to control a specif...
Definition: SD.h:266
uint_fast32_t * readBuf
Definition: SDHostCC32XX.h:173
enum SD_CardType_ SD_CardType
SD Card type inserted.
volatile uint_fast32_t readSecCount
Definition: SDHostCC32XX.h:175
unsigned long rxChIdx
Definition: SDHostCC32XX.h:145
const SD_FxnTable sdHostCC32XX_fxnTable
Definition: SDHostCC32XX.h:134
unsigned int powerMgrId
Definition: SDHostCC32XX.h:186
const uint_fast32_t * writeBuf
Definition: SDHostCC32XX.h:169
PowerCC32XX_ParkState
Enumeration of states a pin can be parked in.
Definition: PowerCC32XX.h:385
Copyright 2017, Texas Instruments Incorporated