ioMutex removed
This commit is contained in:
@@ -94,22 +94,16 @@ uint32_t Cmd_A41_resp ;
|
||||
uint8_t cardType;
|
||||
uint32_t transSpeed;
|
||||
|
||||
#if !defined(BOOT)
|
||||
static OS_MutexID ioMutex;
|
||||
#define IO_MUTEX_ENTER() CoEnterMutexSection(ioMutex);
|
||||
#define IO_MUTEX_LEAVE() CoLeaveMutexSection(ioMutex);
|
||||
#else
|
||||
#define IO_MUTEX_ENTER()
|
||||
#define IO_MUTEX_LEAVE()
|
||||
#endif //#if !defined(BOOT)
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Lock / unlock functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if !defined(BOOT)
|
||||
static OS_MutexID ioMutex;
|
||||
volatile int mutexCheck = 0;
|
||||
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
|
||||
{
|
||||
*mutex = CoCreateMutex();
|
||||
*mutex = ioMutex;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -128,6 +122,7 @@ int ff_del_syncobj (_SYNC_t mutex)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Get Trans Speed Value (Kbit/s)
|
||||
@@ -1288,8 +1283,6 @@ DRESULT disk_read (
|
||||
|
||||
if ( sd_card_ready() == 0 ) return RES_NOTRDY;
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
do {
|
||||
result = sd_read_block(sector, dma_sd_buffer) ;
|
||||
if (result) {
|
||||
@@ -1304,8 +1297,6 @@ DRESULT disk_read (
|
||||
}
|
||||
} while ( count ) ;
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
if (!count)
|
||||
return RES_OK;
|
||||
|
||||
@@ -1335,8 +1326,6 @@ DRESULT disk_write (
|
||||
|
||||
if ( sd_card_ready() == 0 ) return RES_NOTRDY;
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
do {
|
||||
|
||||
while (1) {
|
||||
@@ -1368,14 +1357,12 @@ DRESULT disk_write (
|
||||
} while ( count ) ;
|
||||
|
||||
if (!count) {
|
||||
IO_MUTEX_LEAVE();
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
if (++sdErrorCount > 3)
|
||||
Card_state = SD_ST_ERR;
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
return RES_ERROR;
|
||||
}
|
||||
|
||||
@@ -1397,8 +1384,6 @@ DRESULT disk_ioctl (
|
||||
|
||||
res = RES_ERROR;
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
if (ctrl == CTRL_POWER) {
|
||||
#if 0
|
||||
switch (ptr[0]) {
|
||||
@@ -1476,7 +1461,5 @@ DRESULT disk_ioctl (
|
||||
// BSS deselect();
|
||||
}
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,12 @@ uint32_t transSpeed; */
|
||||
/* Lock / unlock functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
#if !defined(BOOT)
|
||||
static OS_MutexID ioMutex;
|
||||
volatile int mutexCheck = 0;
|
||||
|
||||
int ff_cre_syncobj (BYTE vol, _SYNC_t *mutex)
|
||||
{
|
||||
*mutex = CoCreateMutex();
|
||||
*mutex = ioMutex;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -119,16 +122,6 @@ int ff_del_syncobj (_SYNC_t mutex)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(BOOT)
|
||||
static OS_MutexID ioMutex;
|
||||
#define IO_MUTEX_ENTER() CoEnterMutexSection(ioMutex);
|
||||
#define IO_MUTEX_LEAVE() CoLeaveMutexSection(ioMutex);
|
||||
#else
|
||||
#define IO_MUTEX_ENTER()
|
||||
#define IO_MUTEX_LEAVE()
|
||||
#endif //#if !defined(BOOT)
|
||||
|
||||
static const DWORD socket_state_mask_cp = (1 << 0);
|
||||
static const DWORD socket_state_mask_wp = (1 << 1);
|
||||
|
||||
@@ -652,8 +645,6 @@ DSTATUS disk_initialize (
|
||||
if (drv) return STA_NOINIT; /* Supports only single drive */
|
||||
if (Stat & STA_NODISK) return Stat; /* No card in the socket */
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
power_on(); /* Force socket power on and initialize interface */
|
||||
interface_speed(INTERFACE_SLOW);
|
||||
for (n = 10; n; n--) rcvr_spi(); /* 80 dummy clocks */
|
||||
@@ -687,12 +678,11 @@ DSTATUS disk_initialize (
|
||||
if (ty) { /* Initialization succeeded */
|
||||
Stat &= ~STA_NOINIT; /* Clear STA_NOINIT */
|
||||
interface_speed(INTERFACE_FAST);
|
||||
} else { /* Initialization failed */
|
||||
}
|
||||
else { /* Initialization failed */
|
||||
power_off();
|
||||
}
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
return Stat;
|
||||
}
|
||||
|
||||
@@ -718,8 +708,6 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count)
|
||||
{
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
if (count == 1) { /* Single block read */
|
||||
if (send_cmd(CMD17, sector) == 0) { /* READ_SINGLE_BLOCK */
|
||||
if (rcvr_datablock(buff, 512)) {
|
||||
@@ -747,8 +735,6 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count)
|
||||
release_spi();
|
||||
TRACE_SD_CARD_EVENT((count != 0), sd_SD_ReadSectors, (count << 24) + ((sector/((CardType & CT_BLOCK) ? 1 : 512)) & 0x00FFFFFF));
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
return count ? -1 : 0;
|
||||
}
|
||||
|
||||
@@ -776,8 +762,6 @@ int8_t SD_WriteSectors(const uint8_t *buff, uint32_t sector, uint32_t count)
|
||||
{
|
||||
if (!(CardType & CT_BLOCK)) sector *= 512; /* Convert to byte address if needed */
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
if (count == 1) { /* Single block write */
|
||||
if (send_cmd(CMD24, sector) == 0) { /* WRITE_BLOCK */
|
||||
if (xmit_datablock(buff, 0xFE)) {
|
||||
@@ -805,8 +789,6 @@ int8_t SD_WriteSectors(const uint8_t *buff, uint32_t sector, uint32_t count)
|
||||
release_spi();
|
||||
TRACE_SD_CARD_EVENT((count != 0), sd_SD_WriteSectors, (count << 24) + ((sector/((CardType & CT_BLOCK) ? 1 : 512)) & 0x00FFFFFF));
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
return count ? -1 : 0;
|
||||
}
|
||||
|
||||
@@ -848,8 +830,6 @@ DRESULT disk_ioctl (
|
||||
|
||||
res = RES_ERROR;
|
||||
|
||||
IO_MUTEX_ENTER();
|
||||
|
||||
if (ctrl == CTRL_POWER) {
|
||||
switch (*ptr) {
|
||||
case 0: /* Sub control code == 0 (POWER_OFF) */
|
||||
@@ -871,7 +851,6 @@ DRESULT disk_ioctl (
|
||||
}
|
||||
else {
|
||||
if (Stat & STA_NOINIT) {
|
||||
IO_MUTEX_LEAVE();
|
||||
return RES_NOTRDY;
|
||||
}
|
||||
|
||||
@@ -987,8 +966,6 @@ DRESULT disk_ioctl (
|
||||
release_spi();
|
||||
}
|
||||
|
||||
IO_MUTEX_LEAVE();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user