[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/lib/SD SD_DMA_M.nc, 1.2, 1.3
steve ayer
ayer1 at users.sourceforge.net
Tue Aug 19 11:51:48 PDT 2008
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/apps/FAT_EKG ClockSet.nc, NONE, 1.1 DataFileInit.c, NONE, 1.1 DataFileRead.c, NONE, 1.1 FAT_EKG.nc, NONE, 1.1 FAT_EKG_M.nc, NONE, 1.1 Makefile, NONE, 1.1 PowerMonitor.nc, NONE, 1.1 SHIMMER2_SD_cardImage.zip, NONE, 1.1 SerialLink.nc, NONE, 1.1 crc16.h, NONE, 1.1 dostime.c, NONE, 1.1 dostime.h, NONE, 1.1 fileCatalog.txt, NONE, 1.1 plotEKG.m, NONE, 1.1 plotEKGdata.plt, NONE, 1.1 readme.doc, NONE, 1.1 readme.txt, NONE, 1.1 shimmerSerial.c, NONE, 1.1 shimmerSerial.h, NONE, 1.1
- Next message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/lib/SD SD_M.nc, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/lib/SD
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv18300
Modified Files:
SD_DMA_M.nc
Log Message:
stephen linder made mods to his driver, made comments inline.
Index: SD_DMA_M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/tos/lib/SD/SD_DMA_M.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SD_DMA_M.nc 16 Jun 2008 17:00:47 -0000 1.2
--- SD_DMA_M.nc 19 Aug 2008 18:51:46 -0000 1.3
***************
*** 180,183 ****
--- 180,187 ----
from the spiSendByte () function. There are two while statements in the function that can take
an indeterminate time to complete.
+ -------------------------------------------------------------------------------
+ 08-8-08
+ Rearange code to stop warning:
+ SD_DMA_M.nc:407: warning: `SD.init' called asynchronously from `SD.forceInit'
*/
***************
*** 210,213 ****
--- 214,218 ----
void errorHandler(uint32_t duration);
void initSPI();
+ result_t idleSD();
//result_t setIdle();
result_t setBlockLength (const uint16_t len);
***************
*** 264,274 ****
//////////////////////////////////////////////////////////////////////////
command result_t StdControl.stop() {
! TOSH_SET_SW_SD_PWR_N_PIN();
! call blinkErrorTimer.stop();
!
! call DockInterrupt.disable();
! call DockInterrupt.clear();
!
! return SUCCESS;
}
--- 269,279 ----
//////////////////////////////////////////////////////////////////////////
command result_t StdControl.stop() {
! TOSH_SET_SW_SD_PWR_N_PIN();
! call blinkErrorTimer.stop();
!
! call DockInterrupt.disable();
! call DockInterrupt.clear();
!
! return SUCCESS;
}
***************
*** 278,282 ****
}
! //Interrupt Edge Select Registers P1IES, P2IES
// Each PxIES bit selects the interrupt edge for the corresponding I/O pin.
// Bit = 0: The PxIFGx flag is set with a low-to-high transition
--- 283,288 ----
}
! /////////////////////////////////////////////////////////////////////////
! // DockInterrupt.edge manipulates the Interrupt Edge Select Registers P1IES, P2IES
// Each PxIES bit selects the interrupt edge for the corresponding I/O pin.
// Bit = 0: The PxIFGx flag is set with a low-to-high transition
***************
*** 305,309 ****
void powerCycleSDcard () {
uint16_t i;
!
// turn off power to SD card and set all input pins to the SD card low
// so it does not draw power from those pins
--- 311,315 ----
void powerCycleSDcard () {
uint16_t i;
!
// turn off power to SD card and set all input pins to the SD card low
// so it does not draw power from those pins
***************
*** 312,322 ****
// set clock pin to a general Output pin and drive low
! TOSH_SEL_UCLK0_IOFUNC();
! TOSH_MAKE_UCLK0_OUTPUT();
! TOSH_CLR_UCLK0_PIN();
! TOSH_SEL_SIMO0_IOFUNC();
! TOSH_MAKE_SIMO0_OUTPUT();
! TOSH_CLR_SIMO0_PIN();
for (i = 0; i < 20; i++) {
--- 318,328 ----
// set clock pin to a general Output pin and drive low
! TOSH_SEL_SD_CLK_IOFUNC();
! TOSH_MAKE_SD_CLK_OUTPUT();
! TOSH_CLR_SD_CLK_PIN();
! TOSH_SEL_SD_DI_IOFUNC();
! TOSH_MAKE_SD_DI_OUTPUT();
! TOSH_CLR_SD_DI_PIN();
for (i = 0; i < 20; i++) {
***************
*** 327,332 ****
// set clock and SIMO pins back to being used by USART
! TOSH_SEL_UCLK0_MODFUNC ();
! TOSH_SEL_SIMO0_MODFUNC();
}
// Over ride the dock pin and reset the SD card
--- 333,338 ----
// set clock and SIMO pins back to being used by USART
! TOSH_SEL_SD_CLK_MODFUNC ();
! TOSH_SEL_SD_DI_MODFUNC();
}
// Over ride the dock pin and reset the SD card
***************
*** 346,402 ****
// be raised to 25 MHz
/////////////////////////////////////////////////////////////////////////
! async command result_t SD.forceInit() {
! atomic is_SD_initalized = FALSE;
! return call SD.init();
! }
! command result_t SD.init() {
! register uint8_t i;
! // if docked we do not have access to SD card
! if(!TOSH_READ_DOCK_N_PIN()){
! return MMC_INIT_ERROR;
! }
! initSPI();
! CS_LOW();
! atomic i = is_SD_initalized;
! if (i == TRUE) {
! return MMC_SUCCESS;
! }
! // during the initialization step the clock rate must be below
! // 400 KHz.
! //////////////////////////////////////////////////////////////////
! call USARTControl.setClockRate(UBR_SMCLK_115200, UMCTL_SMCLK_115200);
! for(i = 0; i < 10; i++) {
! spiSendByte(0xff);
! }
!
! CS_HIGH();
! for(i = 0; i < 10; i++) {
! spiSendByte(0xff);
! }
! if (call SD.setIdle() != MMC_SUCCESS) {
! return MMC_INIT_ERROR;
! }
! if(setBlockLength (SD_BLOCKSIZE) != MMC_SUCCESS) {
! return MMC_RESPONSE_ERROR;
! }
! for(i = 0; i < 100; i++) {
! spiSendByte(0xff);
! }
!
! // increase the clock rateof the SPI bus so to maximize
! // the transfer rate to and from the SD card
! // WARNING: not all values work here!!!
! //////////////////////////////////////////////////////////////////
! call USARTControl.setClockRate(0x02, 0x00);
! atomic is_SD_initalized = TRUE;
! CS_HIGH ();
! return MMC_SUCCESS;
- }
// Must notify the user of this module that the SD card has
// become available or is no longer available.
--- 352,413 ----
// be raised to 25 MHz
/////////////////////////////////////////////////////////////////////////
! result_t initSD () {
! register uint8_t i;
! // if docked we do not have access to SD card
! if(!TOSH_READ_DOCK_N_PIN()){
! return MMC_INIT_ERROR;
! }
! initSPI();
! CS_LOW();
! atomic i = is_SD_initalized;
! if (i == TRUE) {
! return MMC_SUCCESS;
! }
!
! // during the initialization step the clock rate must be below
! // 400 KHz.
! //////////////////////////////////////////////////////////////////
! call USARTControl.setClockRate(UBR_SMCLK_115200, UMCTL_SMCLK_115200);
!
! for(i = 0; i < 10; i++) {
! spiSendByte(0xff);
! }
! CS_HIGH();
! for(i = 0; i < 10; i++) {
! spiSendByte(0xff);
! }
! if (idleSD() != MMC_SUCCESS) {
! return MMC_INIT_ERROR;
! }
! if(setBlockLength (SD_BLOCKSIZE) != MMC_SUCCESS) {
! return MMC_RESPONSE_ERROR;
! }
! for(i = 0; i < 100; i++) {
! spiSendByte(0xff);
! }
!
! // increase the clock rateof the SPI bus so to maximize
! // the transfer rate to and from the SD card
! // WARNING: not all values work here!!!
! //////////////////////////////////////////////////////////////////
! call USARTControl.setClockRate(0x02, 0x00);
! atomic is_SD_initalized = TRUE;
! CS_HIGH ();
! return MMC_SUCCESS;
! }
!
! command result_t SD.init() {
! return initSD ();
! }
! async command result_t SD.forceInit() {
! atomic is_SD_initalized = FALSE;
! return initSD();
! }
// Must notify the user of this module that the SD card has
// become available or is no longer available.
***************
*** 596,600 ****
///////////////////////////////////////////////////////////////////////////////
#define MAXIMUM_RETRY_FOR_IDLE 100
! command result_t SD.setIdle(){
char response;
uint16_t retryCount = 0;
--- 607,611 ----
///////////////////////////////////////////////////////////////////////////////
#define MAXIMUM_RETRY_FOR_IDLE 100
! result_t idleSD() {
char response;
uint16_t retryCount = 0;
***************
*** 639,642 ****
--- 650,656 ----
return MMC_SUCCESS;
}
+ command result_t SD.setIdle(){
+ idleSD ();
+ }
// we don't have pin for this one yet; it uses cd pin, which we don't have wired in mock-up
***************
*** 651,655 ****
// get response from card, should be 0; so, shouldn't this be 'while'?
if(getResponse() != 0x00){
! call SD.init();
sendCmd(MMC_SET_BLOCKLEN, len, 0xff);
getResponse();
--- 665,669 ----
// get response from card, should be 0; so, shouldn't this be 'while'?
if(getResponse() != 0x00){
! initSD ();
sendCmd(MMC_SET_BLOCKLEN, len, 0xff);
getResponse();
***************
*** 995,999 ****
// Ignore the checksum
SD_delay(4);
- TOSH_TOGGLE_SER0_CTS_PIN ();
// Check for the busy flag (set on a write block)
--- 1009,1012 ----
***************
*** 1008,1012 ****
}
}
- TOSH_TOGGLE_SER0_CTS_PIN ();
CS_HIGH ();
--- 1021,1024 ----
- Previous message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/apps/FAT_EKG ClockSet.nc, NONE, 1.1 DataFileInit.c, NONE, 1.1 DataFileRead.c, NONE, 1.1 FAT_EKG.nc, NONE, 1.1 FAT_EKG_M.nc, NONE, 1.1 Makefile, NONE, 1.1 PowerMonitor.nc, NONE, 1.1 SHIMMER2_SD_cardImage.zip, NONE, 1.1 SerialLink.nc, NONE, 1.1 crc16.h, NONE, 1.1 dostime.c, NONE, 1.1 dostime.h, NONE, 1.1 fileCatalog.txt, NONE, 1.1 plotEKG.m, NONE, 1.1 plotEKGdata.plt, NONE, 1.1 readme.doc, NONE, 1.1 readme.txt, NONE, 1.1 shimmerSerial.c, NONE, 1.1 shimmerSerial.h, NONE, 1.1
- Next message: [Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/tos/lib/SD SD_M.nc, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-contrib-commits
mailing list