synced with newer version by Michael Baar.
This commit is contained in:
parent
d5c8b18fc2
commit
3fec8ee5e7
10 changed files with 1367 additions and 562 deletions
|
@ -41,16 +41,19 @@ scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
|
|||
Berlin, 2007
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file ScatterWeb.sd.info.c
|
||||
* @file ScatterWeb.Sd.info.c
|
||||
* @ingroup libsd
|
||||
* @brief MMC-/SD-Card library, Additional Information
|
||||
*
|
||||
* @author Michael Baar <baar@inf.fu-berlin.de>
|
||||
* @date Feb 2007
|
||||
* @version 0.2
|
||||
* @version $Revision: 1.2 $
|
||||
*
|
||||
* $Id: sd_info.c,v 1.2 2008/03/28 15:58:44 nvt-se Exp $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @addtogroup libsd
|
||||
* @{
|
||||
|
@ -58,29 +61,48 @@ Berlin, 2007
|
|||
#include "sd_internals.h"
|
||||
#include "sd.h"
|
||||
|
||||
uint16_t
|
||||
sd_read_cid(sd_cid_t * pCID)
|
||||
unsigned int
|
||||
sd_read_cid(struct sd_cid *pCID)
|
||||
{
|
||||
return sd_read_register(pCID, SD_CMD_SEND_CID, sizeof (sd_cid_t));
|
||||
|
||||
return _sd_read_register(pCID, SD_CMD_SEND_CID, sizeof (struct sd_cid));
|
||||
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sd_get_size(void)
|
||||
|
||||
sd_get_size()
|
||||
{
|
||||
|
||||
uint32_t size = 0;
|
||||
|
||||
if (uart_lock(UART_MODE_SPI)) {
|
||||
sd_csd_t csd;
|
||||
|
||||
if (sd_read_register(&csd, SD_CMD_SEND_CSD, sizeof (sd_csd_t))) {
|
||||
if (uart_lock(UART_MODE_SPI)) {
|
||||
|
||||
struct sd_csd csd;
|
||||
|
||||
|
||||
if (_sd_read_register(&csd, SD_CMD_SEND_CSD, sizeof (struct sd_csd))) {
|
||||
|
||||
size = SD_CSD_C_SIZE(csd) + 1;
|
||||
|
||||
size <<= SD_CSD_C_MULT(csd);
|
||||
|
||||
size <<= 2;
|
||||
|
||||
size <<= sd_state.MaxBlockLen_bit;
|
||||
|
||||
}
|
||||
|
||||
uart_unlock(UART_MODE_SPI);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return size;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue