バックナンバーはこちら。
https://www.simulationroom999.com/blog/In-vehicle-external-storage-backnumber/
はじめに
SDカードのPERFORMANCE_ENHANCEの話。
Card-initiated maintenanceについて。
登場人物
博識フクロウのフクさん

イラストACにて公開の「kino_k」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=iKciwKA9&area=1
エンジニア歴8年の太郎くん

イラストACにて公開の「しのみ」さんのイラストを使用しています。
https://www.ac-illust.com/main/profile.php?id=uCKphAW2&area=1
Performance Enhancement Register

今回もPerformance Enhancement Registerが絡むんで、表を貼っておこう。
Byte Offset | Bits | Name | Description |
---|---|---|---|
0 | – | Performance Enhancement Function Revision | 00h:Revison 1 |
1 | [0] | FX_EVENT Support | 0:Not support,1:Supported |
2 | [0] | Card Initiated Maintenance Support | 0:Not support,1:Supported |
2 | [1] | Host Initiated maintenance Support | 0:Not support,1:Supported |
3 | [1:0] | Card maintenance Urgency 00b:None, 01b:Mild, 10b:Middle, 11b:Urgent | |
4 | [0] | Cache Support | 0:Not support,1:Supported |
5 | – | Reserved | – |
6 | – | CQ Support and Depth | 00h:CA is not supported,01h:depth=2(ID=0,1),…,1Fh:depth=32(ID 0~31) |
7 | – | Reserved | – |
8月15日 | – | Task Error Status | 00h:No Error,01h:Error,Other:Reserved |
16-256 | – | Reserved | – |
257 | 0 | FX_EVENT Enable | 0:Disable,1Enable |
258 | 0 | Card Initiated maintenance Enable | 0:Disable,1Enable |
258 | 1 | Host Initiated maintenance Enable | 0:Disable,1Enable |
259 | 0 | Start Host-Initiated Maintenance | 1:Starts host-initiated maintenance.0:By card indicates the break of maintenance.(break within 1 secomd.) |
260 | 0 | Flush Cache | 1:Start Cache flush.0:By card indicates the end of Cache flush.(flush within 1 second.) |
262 | 0 | Enable CQ | 0:Disable,1Enable |
262 | 1 | CQ Mode | 0:Voluntary mode, 1:Sequential Mode |
263-511 | – | Reserved | – |
Card-initiated maintenance

そして今回はCard-initiated maintenance。

これはPerformance Enhancement Registerの
Card Initiated maintenance Enable
を1にしておけばOKだ。

あれ?
開始指示とかはしないの?

Card-initiated maintenanceは
SDカードバスがIdleになったら勝手にやってくれるモードなんだ。

ほー。
つまり、こっちが指示しなくても、
暇になったらちょっとずつ最適化をしてくれるって感じなのかな?

そうだね。
ただし、セルフメンテナンス中でもちゃんとコマンドには応答しないといけない。

結構大変そうだねー。
Card-initiated maintenanceの終了判定

でも、Card-initiated maintenanceもどっかで終了するんだよね?
どうやって判断するんだろ?

R1レスポンスフォーマットでcard statusってのが取得できるじゃん?

そうだね。

その中にFX_EVENTってbitがある。
それが立ってたら終了したって合図だ。

FX_EVENT?
そんなのあったっけ?

card status自体はここでやったけど。

とりあえず表を持ってきた。
Bits | Identifier |
---|---|
31 | OUT_OF_RANGE |
30 | ADDRESS_ERROR |
29 | BLOCK_LEN_ERROR |
28 | ERASE_SEQ_ERROR |
27 | ERASE_PARAM |
26 | WP_VIOLATION |
25 | CARD_IS_LOCKED |
24 | LOCK_UNLOCK_FAILED |
23 | COM_CRC_ERROR |
22 | ILLEGAL_COMMAND |
21 | CARD_ECC_FAILED |
20 | CC_ERROR |
19 | ERROR |
18 | reserved |
17 | reserved |
16 | CSD_OVERWRITE |
15 | WP_ERASE_SKIP |
14 | CARD_ECC_DISABLED |
13 | ERASE_RESET |
[12:9] | CURRENT_STATE |
8 | READY_FOR_DATA |
7 | reserved |
6 | FX_EVENT |
5 | APP_CMD |
4 | reserved |
3 | AKE_SEQ_ERROR |
[2:0] | reserved |

お!
確かにFX_EVENTってのがいるね。
これを見て判断するのか。

ところでFX_EVENTって何かの略だと思うけど、
正式名称はどうなってるの?

FX_EVENTはFunction Extension Eventの略だね。
FX_EVENT自体はセルフメンテナンス以外にも使われるものだけど、
SDカードのストレージとしての機能以外の何かしらの通知で使われイメージだ。
SDカードに搭載し得る特殊な機能

セルフメンテナンスもストレージとしての機能ではないもんね。

例えば、他にどんな機能があるの?

そうだねー。
Wifi機能とか、iSDIOとかが有名かな。

なに?iSDIOって?

SDAの記述を引用しよう。
iSDIO(インテリジェントSDIO)規格は、Wireless LAN SDのブランドで、IEEE 802.11(a/b/g/n)を搭載した機器、ホームネットワーキングやクラウドコンピューティングサービスとSDメモリーカード間での通信を可能とする新しいSD規格として開発されました。Wireless LAN SDメモリーカードは、通常のSDメモリーカードにワイヤレスLAN (Local Area Network)、フラッシュメモリーとMPUモジュールを一体化した初のSD規格です。規格策定完了後に会員企業の製品開発に利用可能となるWireless LAN SD規格は、単純なホストコマンドで、複雑な通信タスクの実行をSDカードで可能にします。
SDAより

ほう。
こんな仕様があるのか・・・。

iSDIOは
KIOXIA(旧東芝メモリ)社のFlashAirが有名だね。
というか他でやってるところは記憶にないな。

まぁこれもそういうのがあるってのだけ覚えておこう。
まとめ

まとめだよ。
- Card-initiated maintenanceについて説明。
- Card Initiated maintenance Enableを1にすれば起動。
- SDカードバスがIdleの時に勝手にセルフメンテナンスを実施してくれる。
- R1フォーマットのcard statusにあるFX_EVENTで完了判定。
バックナンバーはこちら。
コメント