diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/hal/dox/sdc.dox | 6 | ||||
-rw-r--r-- | os/hal/src/sdc.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/os/hal/dox/sdc.dox b/os/hal/dox/sdc.dox index 2a18977ff..df88796af 100644 --- a/os/hal/dox/sdc.dox +++ b/os/hal/dox/sdc.dox @@ -52,9 +52,10 @@ stop -> stop [label="\nsdcStop()"];
stop -> ready [label="\nsdcStart()"];
ready -> stop [label="\nsdcStop()"];
- ready -> ready [label="\nsdcStart()"];
+ ready -> ready [label="\nsdcStart()\nsdcDisconnect()"];
ready -> connecting [label="\nsdcConnect()"];
connecting -> active [label="\nconnection\nsuccessful"];
+ connecting -> active [label="\nsdcConnect()", dir="back"];
connecting -> ready [label="\nconnection\nfailed"];
disconnecting -> active [label="\nsdcDisconnect()", dir="back"];
ready -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
@@ -85,9 +86,10 @@ stop -> stop [label="\nsdcStop()"];
stop -> ready [label="\nsdcStart()"];
ready -> stop [label="\nsdcStop()"];
- ready -> ready [label="\nsdcStart()"];
+ ready -> ready [label="\nsdcStart()\nsdcDisconnect()"];
ready -> connecting [label="\nsdcConnect()"];
connecting -> active [label="\nconnection\nsuccessful"];
+ connecting -> active [label="\nsdcConnect()", dir="back"];
connecting -> ready [label="\nconnection\nfailed"];
disconnecting -> active [label="\nsdcDisconnect()", dir="back"];
ready -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index a7a39c268..08c667df4 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -169,7 +169,8 @@ bool_t sdcConnect(SDCDriver *sdcp) { chDbgCheck(sdcp != NULL, "sdcConnect");
chSysLock();
- chDbgAssert(sdcp->state == SDC_READY, "mmcConnect(), #1", "invalid state");
+ chDbgAssert((sdcp->state == SDC_READY) || (sdcp->state == SDC_ACTIVE),
+ "mmcConnect(), #1", "invalid state");
sdcp->state = SDC_CONNECTING;
chSysUnlock();
@@ -302,6 +303,10 @@ bool_t sdcDisconnect(SDCDriver *sdcp) { chSysLock();
chDbgAssert(sdcp->state == SDC_ACTIVE,
"sdcDisconnect(), #1", "invalid state");
+ if (sdcp->state == SDC_READY) {
+ chSysUnlock();
+ return FALSE;
+ }
sdcp->state = SDC_DISCONNECTING;
chSysUnlock();
|