バックナンバーはこちら。
https://www.simulationroom999.com/blog/In-vehicle-external-storage-backnumber/
はじめに
SDカードのCQ(Command Queue) Modeの話。
登場人物
博識フクロウのフクさん

イラスト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
CQ(Command Queue) Mode

前回説明した通り、
CQ(Command Queue) Modeは以下2種類。
- Voluntary CQ mode
- Sequential CQ Mode

Voluntary CQ modeがSDカードで処理順を決定するモードで、
Sequential CQ Modeがホストで処理順を決定するモードだったね。

そうそう。
Voluntary CQ mode

まずはVoluntary CQ modeを説明しよう。

あっさり気味で頼むよー。

(うーん、なかなか難しい注文だ)

まず、SDカード主導で処理順を決定するとは言ったが、
ある程度の方針はホスト側から指定する。

方針?

各処理に優先度ってのを設定する。

あー。
その優先度順に処理してくれるってことか。

ただ、優先度順に処理してくれるかは保証されていない。

それって優先度って言えるの?

まぁカード側の効率重視の都合で処理が後回しになるから仕様上は保証しないってことだねー。

Voluntary CQ modeを使用するには
Performance Enhancement Function Registerの
offset 262byte bit1=’0′
にする必要がある。

・・・。

Performance Enhancement Function Registerは後で説明するよ。
Sequential CQ Mode

次はSequential CQ Modeかな。

まずこのModeを使用するには、さっき出てきた
Performance Enhancement Function Registerの
offset 262byte bit1=’1′
にする。

あー、同じbitのON/OFFで切り替わるのね。

Sequential CQ Modeの場合、Task ID順に必ず実行される。

Task ID?

まぁCommand Queueに振られたIDだねー。
0~31の最大32個分ある。
必ず32個ある保証は無いんで、ACMD13(SD_STATUS)の中で定義されてる。

SD_STATUS?

512bit(=64byte)長のSD内部パラメータ群だねー。

512bitのレスポンスフォーマットがあるってこと?

うんにゃ。
レスポンスフォーマットとしてはR1で
512bit長のデータはDATのラインで取得できる。

ほー。
CMD17(READ_SINGLE_BLOCK)、CMD18(READ_MULTIPLE_BLOCK)以外にも
読み出しでDATラインを使うコマンドが出てきたのは初めてだねー。

そうだね。
他にもちょこちょこ出てくるけどねー。

まぁ次回はACMD13(SD_STATUS)について掘り下げるか。
まとめ

まとめだよ。
- CQ(Command Queue) Modeを簡単に説明。
- Performance Enhancement Function Register offset 262byte bit1で切替ができる。
- 1:Voluntary CQ mode。
- 0:Sequential CQ Mode
- Sequential CQ ModeはTask ID順に処理される。
バックナンバーはこちら。
コメント