X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fplatforms%2Fshimmer%2Fchips%2Fsd%2FSD.nc;h=243d53e9dba42c728aab8a06f589b361a469f6ab;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=035dd827a5e7cf5f45a4051896d70c452458b401;hpb=4bfcdacf6e4dff27bf1269e666e788b9edb0098a;p=tinyos-2.x.git diff --git a/tos/platforms/shimmer/chips/sd/SD.nc b/tos/platforms/shimmer/chips/sd/SD.nc index 035dd827..243d53e9 100644 --- a/tos/platforms/shimmer/chips/sd/SD.nc +++ b/tos/platforms/shimmer/chips/sd/SD.nc @@ -31,36 +31,46 @@ * Interface for communciating with an SD card via a standard sd card slot. * * @author Steve Ayer + * @author Konrad Lorincz * @date May 2006 - */ - + */ #include "SD.h" interface SD { + /** + * Returns the card size in bytes. + * + * @return the card size in bytes. + */ + command uint32_t readCardSize(); - command mmcerror_t init (); - - command mmcerror_t setIdle(); - - // we don't have pin for this one yet; it uses cd - // command mmcerror_t detect(); - - // change block length to 2^len bytes; default is 512 - command mmcerror_t setBlockLength (const uint16_t len); - - // see macro in module for writing to a sector instead of an address - // read a block of size count from address - command mmcerror_t readBlock(const uint32_t address, const uint16_t count, uint8_t * buffer); - command mmcerror_t readSector(uint32_t sector, uint8_t * pBuffer); + /** + * Reads 512 bytes from the SD at sector and copies it to bufferPtr + * + * @param sector the sector on the SD card (in multiples of 512 bytes). + * @param bufferPtr pointer to where the SD will copy the data to. Must be 512 bytes. + * @return SUCCESS if it was read successfully; FAIL otherwise + */ + command error_t readBlock(const uint32_t sector, uint8_t * buffer); - // see macro in module for writing to a sector instead of an address - command mmcerror_t writeBlock (const uint32_t address, const uint16_t count, uint8_t * buffer); - command mmcerror_t writeSector(uint32_t sector, uint8_t * pBuffer); + /** + * Writes 512 bytes from the bufferPtr to the SD card + * + * @param sector the sector on the SD card (in multiples of 512 bytes + * where to write the data to). + * @param bufferPtr pointer to data to be added. Must be 512 bytes. + * @return SUCCESS if it was written successfully; FAIL otherwise + */ + command error_t writeBlock(const uint32_t sector, uint8_t * buffer); - // register read of length len into buffer - command mmcerror_t readRegister(const uint8_t register, const uint8_t len, uint8_t * buffer); + /** + * the device has control over the sd card + */ + async event void available(); - // Read the Card Size from the CSD Register - // unsupported on sdio only cards - command uint32_t readCardSize(); + /** + * the device has lost control of the sd and should cease + * attempts to talk to the card + */ + async event void unavailable(); }