publishing to check changes in cdms code
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE_samp_23SEP_DMA_flag by
Diff: cdms_sd.h
- Revision:
- 203:424308159a56
- Parent:
- 197:1369ef45b49e
- Child:
- 209:63e9c8f8b5d2
diff -r 8700a3e6324c -r 424308159a56 cdms_sd.h --- a/cdms_sd.h Fri Jul 01 08:56:27 2016 +0000 +++ b/cdms_sd.h Fri Jul 01 17:41:48 2016 +0000 @@ -126,11 +126,13 @@ uint32_t fsc; uint32_t start_fsc; uint8_t buffer[512]; + int i; disk_read(buffer,SD_MNG_SECT); if(sid==0x01) { fsc=(uint32_t)(buffer[0]<<24)+(uint32_t)(buffer[1]<<16)+(uint32_t)(buffer[2]<<8)+(uint32_t)buffer[3]; start_fsc=(uint32_t)(buffer[4]<<24)+(uint32_t)(buffer[5]<<16)+(uint32_t)(buffer[6]<<8)+(uint32_t)buffer[7]; + fsc++; buffer[0]=(uint8_t) (fsc>>24 & 0xFF); buffer[1]=(uint8_t) (fsc>>16 & 0xFF); buffer[2]=(uint8_t) (fsc>>8 & 0xFF); @@ -143,12 +145,15 @@ buffer[6]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[7]=(uint8_t) (start_fsc & 0xFF); } - return disk_write(buffer,SD_MNG_SECT); + i = disk_write(buffer,SD_MNG_SECT); + FCTN_SD_MNGR(); + return i; } if(sid==0x02) { fsc=(uint32_t)(buffer[8]<<24)+(uint32_t)(buffer[9]<<16)+(uint32_t)(buffer[10]<<8)+(uint32_t)buffer[11]; start_fsc=(uint32_t)(buffer[12]<<24)+(uint32_t)(buffer[13]<<16)+(uint32_t)(buffer[14]<<8)+(uint32_t)buffer[15]; + fsc++; buffer[8]=(uint8_t) (fsc>>24 & 0xFF); buffer[9]=(uint8_t) (fsc>>16 & 0xFF); buffer[10]=(uint8_t) (fsc>>8 & 0xFF); @@ -161,12 +166,15 @@ buffer[14]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[15]=(uint8_t) (start_fsc & 0xFF); } - return disk_write(buffer,SD_MNG_SECT); + i = disk_write(buffer,SD_MNG_SECT); + FCTN_SD_MNGR(); + return i; } if(sid==0x03) { fsc=(uint32_t)(buffer[16]<<24)+(uint32_t)(buffer[17]<<16)+(uint32_t)(buffer[18]<<8)+(uint32_t)buffer[19]; start_fsc=(uint32_t)(buffer[20]<<24)+(uint32_t)(buffer[21]<<16)+(uint32_t)(buffer[22]<<8)+(uint32_t)buffer[23]; + fsc++; buffer[16]=(uint8_t) (fsc>>24 & 0xFF); buffer[17]=(uint8_t) (fsc>>16 & 0xFF); buffer[18]=(uint8_t) (fsc>>8 & 0xFF); @@ -179,12 +187,15 @@ buffer[22]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[23]=(uint8_t) (start_fsc & 0xFF); } - return disk_write(buffer,SD_MNG_SECT); + i = disk_write(buffer,SD_MNG_SECT); + FCTN_SD_MNGR(); + return i; } if(sid==0x04) { fsc=(uint32_t)(buffer[24]<<24)+(uint32_t)(buffer[25]<<16)+(uint32_t)(buffer[26]<<8)+(uint32_t)buffer[27]; start_fsc=(uint32_t)(buffer[28]<<24)+(uint32_t)(buffer[29]<<16)+(uint32_t)(buffer[30]<<8)+(uint32_t)buffer[31]; + fsc++; buffer[24]=(uint8_t) (fsc>>24 & 0xFF); buffer[25]=(uint8_t) (fsc>>16 & 0xFF); buffer[26]=(uint8_t) (fsc>>8 & 0xFF); @@ -197,12 +208,15 @@ buffer[30]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[31]=(uint8_t) (start_fsc & 0xFF); } - return disk_write(buffer,SD_MNG_SECT); + i = disk_write(buffer,SD_MNG_SECT); + FCTN_SD_MNGR(); + return i; } if(sid==0x05) { fsc=(uint32_t)(buffer[32]<<24)+(uint32_t)(buffer[33]<<16)+(uint32_t)(buffer[34]<<8)+(uint32_t)buffer[35]; start_fsc=(uint32_t)(buffer[36]<<24)+(uint32_t)(buffer[37]<<16)+(uint32_t)(buffer[38]<<8)+(uint32_t)buffer[39]; + fsc++; buffer[32]=(uint8_t) (fsc>>24 & 0xFF); buffer[33]=(uint8_t) (fsc>>16 & 0xFF); buffer[34]=(uint8_t) (fsc>>8 & 0xFF); @@ -215,7 +229,9 @@ buffer[38]=(uint8_t) (start_fsc>>8 & 0xFF); buffer[39]=(uint8_t) (start_fsc & 0xFF); } - return disk_write(buffer,SD_MNG_SECT); + i = disk_write(buffer,SD_MNG_SECT); + FCTN_SD_MNGR(); + return i; } return -1; }