Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
3
目次
第 I部 USB概要 1
第 1章 信号概要 3
1.1 電気的接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 接続構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 デバイスの接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 デバイスの初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6 ホストとデバイスの同期 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 データ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
第 2章 通信概要 7
2.1 時分割 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 通信要素 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 通信方式 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3.1 コントロール転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
セットアップステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
データステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
ステータスステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2 バルク転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3 インタラプト転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.4 アイソクロナス転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4 パケット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1 基本構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.2 Tokenパケット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.3 Dataパケット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.4 Handshakeパケット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 詳細構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.1 SYNC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.2 PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.3 DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.4 CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5.5 各パケットの構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4 目次
2.6 パケットの保証 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7 パケットのやりとりの保証 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.7.1 コントロール転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7.2 バルク転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7.3 アイソクロナス転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.8 パケットの終了の認識 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.9 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.10 ディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.11 ディスクリプタの構成 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.11.1 デバイスディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.11.2 コンフィギュレーションディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.11.3 インターフェースディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.11.4 エンドポイントディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.11.5 ディスクリプタの構成例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.12 転送の種類 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
第 II部 デバイスコントローラ 23
第 3章 概要 25
3.1 構成 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
第 4章 論理譜 27
4.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3 手続き接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.4 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.5 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.6 代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.7 送信 CLK期間 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.8 送信 CLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.9 ビット送信起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.10 連続 1が 6個の処理前のビット送信起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.11 送信端に同期した EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.12 送信ビット移動指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.13 手続き getbyte引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.14 手続き sendPACKET引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.15 手続き getSOForToken引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.16 手続き getPID引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.17 手続き crc16引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.18 手続き getEOP引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.19 手続き getPACKET引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5
4.20 手続き usbstate引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.21 手続き usbcstate引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.22 手続き devreq引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.23 手続き devaddr引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.24 手続き devint引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.25 手続き devcf引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.26 手続き descriptor引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.27 初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.28 速度選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.29 手続き usbif引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.30 USB入力シリアルデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.31 受信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.32 USB差動出力+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.33 USB差動出力- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.34 ビットデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.35 ビットデータ起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.36 ディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.37 デバイスリクエスト取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.38 デバイスリクエスト種類決定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.39 ビットデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.40 バイトデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.41 SYNC読み取り指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.42 PID通過計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.43 PID読み取り指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.44 pidpassa否定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.45 Tokenパケット CRC結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.46 PID通過指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.47 パケットの CRC結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.48 EOP終了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.49 PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.50 Tokenパケット指定アドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.51 Tokenパケット指定エンドポイント . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.52 受信したパケットのデータ数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.53 Tokenとデバイスのアドレスが一致 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.54 転送方式割り当て . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.55 無通信時間計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.56 応答パケット位置計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.57 応答パケット PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.58 デバイスリクエスト有効 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.59 PID通過後の CRCを除外したバイト起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.60 PID通過後のバイト計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.61 デバイスリクエスト SyncFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6 目次
4.62 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.63 送信有効 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.64 デバイスリクエスト指定エンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.65 送信データ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.66 終了送信指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.67 コントロール転送の送信バイト数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.68 送信パケットの PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.69 送信パケットの容量 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.70 コントロール転送の送信残りデータ数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.71 送信パケットのデータ数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.72 送信データ計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.73 送信ビットデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.74 送信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.75 送信 EOP終了 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.76 パケット送信データ計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.77 送信 EOP開始 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.78 送信 CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.79 エンドポイント 1トグル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.80 エンドポイント 2トグル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.81 コントロール転送のパケット送信の計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.82 コントロール転送の送信済みのデータ数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.83 手続き確定信号を 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
第 III部 ホストコントローラ 57
第 5章 概要 59
5.1 構成 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.2 データ転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3 レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.3.1 一般レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
通信要求レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
通信済みレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
接続検出レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
切断検出レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
割り込みレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
チャネル選択レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
端子選択レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
データレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
下ポイントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
上ポイントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
5.3.2 チャネルレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
7
CHR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CHR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CHR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
CHR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
CHCNR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3.3 セグメントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.3.4 レジスタ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
一般レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
チャネルレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
セグメントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
第 6章 使い方 67
6.1 初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2 デバイスの接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.2.1 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
6.3 コントロール転送 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.3.1 セットアップステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
実行 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.3.2 データステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
実行 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
データステージの継続と終了 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.3.3 ステータスステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
実行 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.4 デバイスの調査 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.4.1 デバイスディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.4.2 コンフィギュレーションディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . 72
デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.4.3 インターフェースディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
インターフェースの代替値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.4.4 エンドポイントディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.5 ホストの役割 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.5.1 通信の割り当て . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
6.5.2 通信手順 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
送信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
受信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
8 目次
6.5.3 通信結果への対応 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
ACK 肯定応答 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
NAK 否定応答 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
STALL停止中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
タイムアウト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
6.5.4 フレーム中のひとつのチャネルのトランザクション数 . . . . . . . . . . . . . . . . . . . 76
第 7章 論理譜 77
7.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.3 手続き接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.4 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.5 定数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
7.6 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.7 48MHzを約 10MHzに分周 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.8 0.1us起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.9 48MHzを 10KHzに分周 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.10 0.1ms起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.11 0.1ms起点から 1msを作る . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.12 1ms起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
7.13 フレーム番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.14 送信 CLK期間 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.15 送信 CLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
7.16 ビット送信停止指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.17 ビット送信起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.18 スピード設定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.19 レジスタ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
7.20 レジスタ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.21 チャネル□レジスタ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
7.22 データバス制御 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
7.23 データバス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
7.24 割り込み要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.25 通信済みレジスタ RDYRのビット 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
7.26 通信済みレジスタ RDYRのビット 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
7.27 通信済みレジスタ RDYRのビット 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.28 通信済みレジスタ RDYRのビット 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.29 通信済みレジスタ RDYRのビット 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
7.30 通信済みレジスタ RDYRのビット 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
7.31 通信済みレジスタ RDYRのビット 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
7.32 通信済みレジスタ RDYRのビット 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
7.33 通信済みレジスタ RDYRの書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
7.34 通信要求レジスタ REQRのビット 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
9
7.35 通信要求レジスタ REQRのビット 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.36 通信要求レジスタ REQRのビット 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
7.37 通信要求レジスタ REQRのビット 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.38 通信要求レジスタ REQRのビット 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
7.39 通信要求レジスタ REQRのビット 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.40 通信要求レジスタ REQRのビット 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.41 通信要求レジスタ REQRのビット 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.42 通信要求レジスタ REQRの書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.43 割り込みレジスタ IRのビット 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.44 割り込みレジスタ IRのビット 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.45 割り込みレジスタ IRのビット 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.46 割り込みレジスタ IRのビット 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.47 割り込みレジスタ IRのビット 4から 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.48 割り込みレジスタ IRのビット 0の書き込み 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.49 割り込みレジスタ IRのビット 1の書き込み 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.50 割り込みレジスタ IRのビット 2の書き込み 1 . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.51 チャネル選択レジスタ CHSEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.52 接続検出レジスタ DETARのビット 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
7.53 接続検出レジスタ DETARのビット 0の書き込み . . . . . . . . . . . . . . . . . . . . . . . . 102
7.54 切断検出レジスタ DETDRのビット 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
7.55 切断検出レジスタ DETDRのビット 0の書き込み . . . . . . . . . . . . . . . . . . . . . . . . 102
7.56 下ポイントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
7.57 上ポイントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
7.58 チャネル A設定レジスタ CHAR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
7.59 チャネル B設定レジスタ CHBR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.60 チャネル C設定レジスタ CHCR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
7.61 チャネル D設定レジスタ CHDR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.62 チャネル E設定レジスタ CHER0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.63 チャネル F設定レジスタ CHFR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
7.64 チャネル G設定レジスタ CHGR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7.65 チャネル H設定レジスタ CHHR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7.66 チャネル A設定レジスタ CHAR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7.67 チャネル B設定レジスタ CHBR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7.68 チャネル C設定レジスタ CHCR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
7.69 チャネル D設定レジスタ CHDR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
7.70 チャネル E設定レジスタ CHER1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
7.71 チャネル F設定レジスタ CHFR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
7.72 チャネル G設定レジスタ CHGR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
7.73 チャネル H設定レジスタ CHHR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
7.74 チャネル A設定レジスタ CHAR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
7.75 チャネル B設定レジスタ CHBR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
7.76 チャネル C設定レジスタ CHCR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
10 目次
7.77 チャネル D設定レジスタ CHDR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.78 チャネル E設定レジスタ CHER2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.79 チャネル F設定レジスタ CHFR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
7.80 チャネル G設定レジスタ CHGR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
7.81 チャネル H設定レジスタ CHHR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
7.82 チャネル Aコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
7.83 チャネル Bコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.84 チャネル Cコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.85 チャネル Dコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.86 チャネル Eコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
7.87 チャネル Fコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.88 チャネル Gコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
7.89 チャネル Hコントロールレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
7.90 チャネル A設定レジスタ CHAR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
7.91 チャネル B設定レジスタ CHBR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
7.92 チャネル C設定レジスタ CHCR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.93 チャネル D設定レジスタ CHDR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.94 チャネル E設定レジスタ CHER3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.95 チャネル F設定レジスタ CHFR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.96 チャネル G設定レジスタ CHGR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
7.97 チャネル H設定レジスタ CHHR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
7.98 端子 0セグメント 0レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
7.99 端子 0セグメント 1レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
7.100 端子 0セグメント 2レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
7.101 端子 0セグメント 3レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
7.102 端子 0セグメント 4レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
7.103 端子 0セグメント 5レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
7.104 端子 0セグメント 6レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.105 端子 0セグメント 7レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.106 送信端に同期した EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
7.107 送信ビット移動指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.108 端子 0の手続き sendToken引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.109 端子 0の手続き sendPACKET引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.110 端子 0の手続き usbif引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
7.111 端子 0の手続き getbyte引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.112 端子 0の手続き crc16引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.113 端子 0の手続き getPID引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.114 端子 0の手続き getEOP引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.115 端子 0の USB差動出力+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
7.116 端子 0の USB差動出力- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.117 端子 0の USB入力シリアルデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.118 端子 0の受信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
11
7.119 端子 0の同期ビットデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.120 端子 0のビットデータ起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.121 端子 0のビットデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.122 端子 0のバイトデータ取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.123 端子 0の SYNC読み取り指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.124 端子 0の PIDエラー指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.125 端子 0の PID通過指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.126 端子 0の送信ビットデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.127 端子 0の送信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.128 端子 0の送信 EOP終了 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.129 端子 0の送信データ計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
7.130 端子 0の送信 EOP開始 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.131 端子 0の送信 CRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.132 端子 0のデータ書き込み起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.133 端子 0のデータ読み込み起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.134 端子 0送信有効 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.135 端子 0デバイス接続状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.136 端子 0接続認識タイマ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.137 端子 0初期化タイマ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
7.138 端子 0切断タイマ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.139 端子 0コンフィギュレーション要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.140 端子 0切断検出 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
7.141 端子 0の送信バイトデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
7.142 端子 0の送信 PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
7.143 端子 0のセグメント位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
7.144 端子 0のセグメントの通信開始指示 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.145 端子 0のセグメントの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.146 端子 0のデバイスアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7.147 端子 0のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
7.148 端子 0のセグメントの Tokenパケットの送信開始指示 . . . . . . . . . . . . . . . . . . . . . . 141
7.149 端子 0のセグメントの Tokenパケット以外の送信開始指示 . . . . . . . . . . . . . . . . . . . 142
7.150 端子 0の次送信のパケットの待ち時間計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
7.151 端子 0の次送信のパケットの待ち時間起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
7.152 端子 0のセグメント 0のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
7.153 端子 0のセグメント 1のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
7.154 端子 0のセグメント 2のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
7.155 端子 0のセグメント 3のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.156 端子 0のセグメント 4のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.157 端子 0のセグメント 5のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.158 端子 0のセグメント 6のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.159 端子 0のセグメント 7のアドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
7.160 端子 0のセグメント 0のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
12 目次
7.161 端子 0のセグメント 1のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.162 端子 0のセグメント 2のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
7.163 端子 0のセグメント 3のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.164 端子 0のセグメント 4のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.165 端子 0のセグメント 5のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.166 端子 0のセグメント 6のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.167 端子 0のセグメント 7のエンドポイント番号 . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.168 端子 0のセグメント 0の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
7.169 端子 0のセグメント 1の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.170 端子 0のセグメント 2の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.171 端子 0のセグメント 3の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.172 端子 0のセグメント 4の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.173 端子 0のセグメント 5の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.174 端子 0のセグメント 6の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
7.175 端子 0のセグメント 7の送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.176 端子 0のセグメント 0の送信要求期間 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.177 端子 0のセグメント 0の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.178 端子 0のセグメント 1の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.179 端子 0のセグメント 2の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.180 端子 0のセグメント 3の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.181 端子 0のセグメント 4の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.182 端子 0のセグメント 5の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.183 端子 0のセグメント 6の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.184 端子 0のセグメント 7の送信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.185 端子 0のセグメントの送信の PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
7.186 端子 0の通信状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
7.187 端子 0の通信終了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.188 端子 0の通信完了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.189 端子 0のタイムアウト起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.190 端子 0のチャネル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.191 端子 0の通信終了のチャネル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.192 端子 0の通信完了のチャネル . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.193 端子 0の EOP終了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.194 データ変化点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.195 端子 0の無通信時間計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.196 端子 0の受信パケットの CRC結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.197 端子 0の受信パケットのビットの通過計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.198 端子 0の PIDの読み取り指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.199 pidpassa否定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.200 端子 0の受信初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.201 端子 0の CHR0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.202 端子 0の CHR1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
13
7.203 端子 0の CHR2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.204 端子 0の CHRCNR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.205 端子 0の CHR3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
7.206 チャネル□のパケット通信完了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.207 チャネル Aの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
7.208 チャネル Bの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
7.209 チャネル Cの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
7.210 チャネル Dの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
7.211 チャネル Eの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
7.212 チャネル Fの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
7.213 チャネル Gの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
7.214 チャネル Hの送信数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
7.215 チャネル Aのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.216 チャネル Bのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.217 チャネル Cのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.218 チャネル Dのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.219 チャネル Eのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.220 チャネル Fのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
7.221 チャネル Gのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
7.222 チャネル Hのメモリ番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
7.223 チャネル Aのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
7.224 チャネル Bのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.225 チャネル Cのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.226 チャネル Dのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.227 チャネル Eのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.228 チャネル Fのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.229 チャネル Gのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.230 チャネル Hのメモリ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.231 チャネル Aのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.232 チャネル Bのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.233 チャネル Cのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
7.234 チャネル Dのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.235 チャネル Eのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.236 チャネル Fのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.237 チャネル Gのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
7.238 チャネル Hのメモリ書き込み . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.239 チャネル Aのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.240 チャネル Bのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
7.241 チャネル Cのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
7.242 チャネル Dのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
7.243 チャネル Eのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
7.244 チャネル Fのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
14 目次
7.245 チャネル Gのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
7.246 チャネル Hのメモリ読み出し . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
7.247 チャネル Aの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
7.248 チャネル Bの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
7.249 チャネル Cの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.250 チャネル Dの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.251 チャネル Eの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.252 チャネル Fの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
7.253 チャネル Gの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
7.254 チャネル Hの書き込みデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
7.255 チャネル Aのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
7.256 チャネル Bのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
7.257 チャネル Cのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
7.258 チャネル Dのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
7.259 チャネル Eのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
7.260 チャネル Fのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
7.261 チャネル Gのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
7.262 チャネル Hのデータ方向 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
7.263 チャネル Aの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
7.264 チャネル Bの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
7.265 チャネル Cの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
7.266 チャネル Dの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
7.267 チャネル Eの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
7.268 チャネル Fの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
7.269 チャネル Gの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
7.270 チャネル Hの書き込み行程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
7.271 チャネル Aのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
7.272 チャネル Bのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
7.273 チャネル Cのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
7.274 チャネル Dのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
7.275 チャネル Eのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
7.276 チャネル Fのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
7.277 チャネル Gのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
7.278 チャネル Hのパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
7.279 端子 0のパケット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
7.280 チャネル Aの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
7.281 チャネル Bの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
7.282 チャネル Cの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
7.283 チャネル Dの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
7.284 チャネル Eの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
7.285 チャネル Fの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
7.286 チャネル Gの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
15
7.287 チャネル Hの通信データ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
7.288 端子 0のチャネルの通信要求 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
7.289 受信 EOPの遅延 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
第 IV部 ライブラリ 197
第 8章 手続き 199
8.1 CRC5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.1.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.1.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.1.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.1.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.1.5 CRC計算 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.2 ディスクリプタデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
8.2.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.2.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.2.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.2.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.2.5 ディスクリプタ位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
8.2.6 ディスクリプタデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
8.3 コントロール転送以外の状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
8.3.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.3.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.3.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.3.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
8.3.5 コントロール転送以外の状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
8.4 コントロール転送の状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.4.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.4.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.4.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.4.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
8.4.5 状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
8.5 コンフィギュレーション . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
8.5.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.5.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.5.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.5.4 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
8.5.5 コンフィギュレーション値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
8.6 代替値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
8.6.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
8.6.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
16 目次
8.6.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8.6.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8.6.5 代替値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
8.7 Tokenパケット取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
8.7.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
8.7.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
8.7.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
8.7.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
8.7.5 CRC5計算 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
8.7.6 手続き crc5引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
8.7.7 シフトレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
8.7.8 ビット計数器 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
8.7.9 11ビットデータ記憶 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
8.8 Token情報取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
8.8.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
8.8.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
8.8.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
8.8.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
8.8.5 eopp遅延 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
8.8.6 PID設置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.8.7 フレーム番号設置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.8.8 フレーム番号エラー . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
8.8.9 アドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
8.8.10 エンドポイント . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
8.8.11 Token取得状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.9 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.9.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.9.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
8.9.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
8.9.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
8.9.5 デバイスリクエスト byte0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
8.9.6 デバイスリクエスト byte1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
8.9.7 デバイスリクエスト byte2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
8.9.8 デバイスリクエスト byte3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
8.9.9 デバイスリクエスト byte4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
8.9.10 デバイスリクエスト byte5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
8.9.11 デバイスリクエスト byte6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
8.9.12 デバイスリクエスト byte7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
8.10 番地 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
8.10.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.10.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.10.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
17
8.10.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.10.5 アドレス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
8.11 EOP取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
8.11.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
8.11.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
8.11.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.11.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.11.5 EOP起点のための計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.12 PID取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
8.12.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
8.12.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
8.12.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
8.12.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
8.12.5 バイト計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.12.6 PID通過 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.12.7 PID記憶 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
8.12.8 PID検査 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.12.9 PIDエラー . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.12.10 clr遅延 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.13 CRC16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
8.13.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.13.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.13.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.13.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.13.5 CRC計算 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8.14 パケットバイトデータ取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.14.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.14.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.14.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
8.14.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.14.5 シフトレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.14.6 同期指標 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
8.14.7 ビット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
8.14.8 バイトデータ起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
8.14.9 バイト保持 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
8.14.10パケット開始点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
8.15 NRZI符号化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
8.15.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
8.15.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
8.15.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.15.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.15.5 0追加点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
18 目次
8.15.6 6桁列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
8.15.7 EOPを送信端に同期させる 6桁列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.15.8 6連続検知 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.15.9 NRZI符号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.16 NRZIの変換と連続 1の後の 0の除去 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
8.16.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
8.16.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
8.16.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
8.16.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
8.16.5 検査列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
8.16.6 除外ビット位置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
8.16.7 除外列 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8.16.8 出力列データ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8.16.9 出力列 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8.16.10NRZI復号論理 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
8.16.11NRZI復号論理 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
8.17 datapで同期を取って qpと qmを取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.17.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.17.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.17.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.17.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
8.17.5 EOP終了起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
8.17.6 受信中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
8.17.7 変化点捕捉シフトレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8.17.8 変化点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8.17.9 取得計数器 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8.17.10差動信号取得点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
8.17.11差動信号取得点フィルタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.17.12差動信号+取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.17.13差動信号-取得 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.18 USB I/F . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.18.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
8.18.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
8.18.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
8.18.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
8.18.5 差動信号の同期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.18.6 同期化後の差動信号+ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.18.7 同期化後の差動信号- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.18.8 差動信号から NRZI信号を抽出 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
8.18.9 手続き nrzichgr引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
8.18.10 senの論理否定 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
8.18.11手続き nrzichgs引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
19
8.18.12出力端に同期した送信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
8.18.13NRZIを差動信号+に変換 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
8.18.14差動信号から通信状態を抽出 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
8.18.15NRZIを差動信号-に変換 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
8.18.16dseopの遅延 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
8.19 パケットの送信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
8.19.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.19.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.19.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.19.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.19.5 読み込み起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.19.6 パケット開始起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.19.7 eopの開始点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
8.19.8 eopの終了点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
8.19.9 送信ビット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
8.19.10バイト送信起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
8.19.11データ計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
8.19.12送信状態制御 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
8.19.13送信ビットデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
8.19.14送信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
8.19.15送信 CRC16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
8.19.16CRC計算点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
8.19.17手続き crc16引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
8.20 Tokenパケットの送信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.20.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.20.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.20.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
8.20.4 出力代入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.20.5 パケット開始起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.20.6 eopの開始点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.20.7 eopの終了点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
8.20.8 送信ビット計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
8.20.9 バイト送信起点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
8.20.10送信状態制御 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
8.20.11送信ビットデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
8.20.12送信 EOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
8.20.13送信 CRC16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
8.20.14CRC計算点 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
8.20.15手続き crc16引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
20 目次
第 V部 テストベンチ 263
第 9章 論理譜 265
9.1 ライブラリ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
9.2 手続き . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
9.3 実効譜 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
9.3.1 入力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
9.3.2 出力 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
9.3.3 内部信号 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
9.3.4 検査端子 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
9.3.5 デバイスコントローラ導入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
9.3.6 ホストコントローラ導入 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
9.3.7 ホストからデバイス . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
9.3.8 デバイスからホスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
9.3.9 USB端子 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
9.3.10 デバイスコントローラ rp端子 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
9.3.11 チャネル A メモリ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
9.4 GetDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
9.4.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
9.4.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
9.4.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
9.4.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 272
9.4.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 272
9.4.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
9.4.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 273
9.4.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 273
9.4.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
9.4.10 パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
9.4.11 Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
9.4.12 チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 274
9.4.13 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
9.4.14 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
9.4.15 通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
9.4.16 フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
9.4.17 Dataステージ No.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
9.4.18 チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 275
9.4.19 チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 275
9.4.20 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
9.4.21 パケット数を 5にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
9.4.22 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
9.4.23 Dataステージ No.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
9.4.24 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
21
9.4.25 チャネル Aの通信済みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
9.4.26 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.4.27 Dataステージ No.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.4.28 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.4.29 チャネル Aの通信済みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.4.30 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
9.4.31 Dataステージ No.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
9.4.32 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
9.4.33 チャネル Aの通信済みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
9.4.34 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
9.5 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
9.5.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
9.5.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
9.5.3 デバイスの接続と切断 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
9.5.4 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 279
9.5.5 デバイス接続認識 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
9.5.6 割り込み発生のため IRを読む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
9.5.7 IRでデバイスの接続を認識したので DETARを読む . . . . . . . . . . . . . . . . . . . 280
9.5.8 割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
9.5.9 デバイス切断認識 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.5.10 割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.6 デバイス切断 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.6.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
9.6.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.6.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.6.4 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.6.5 デバイス認識 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.6.6 割り込み発生のため IRを読む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
9.6.7 IRでデバイスの接続を認識したので DETARを読む . . . . . . . . . . . . . . . . . . . 283
9.7 SetConfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
9.7.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
9.7.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
9.7.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
9.7.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 284
9.7.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 285
9.7.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
9.7.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 285
9.7.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 285
9.7.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
9.7.10 パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
9.7.11 Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
9.7.12 チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 286
22 目次
9.7.13 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
9.7.14 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.7.15 通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.7.16 フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.7.17 Dataステージ No.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
9.7.18 チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 287
9.7.19 チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 288
9.7.20 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9.8 SetAddress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9.8.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
9.8.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
9.8.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
9.8.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 289
9.8.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 290
9.8.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
9.8.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 290
9.8.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 291
9.8.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
9.8.10 パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
9.8.11 Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
9.8.12 チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 291
9.8.13 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.8.14 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.8.15 通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.8.16 フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.8.17 Dataステージ No.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
9.8.18 チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 293
9.8.19 チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 293
9.8.20 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
9.9 SetInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
9.9.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
9.9.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
9.9.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
9.9.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 294
9.9.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 295
9.9.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
9.9.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 296
9.9.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 296
9.9.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9.9.10 パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9.9.11 Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
9.9.12 チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 296
23
9.9.13 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
9.9.14 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
9.9.15 通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
9.9.16 フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
9.9.17 Dataステージ No.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
9.9.18 チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 298
9.9.19 チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 298
9.9.20 チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
9.10 Syncframe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
9.10.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
9.10.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
9.10.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
9.10.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 299
9.10.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 300
9.10.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
9.10.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 301
9.10.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 301
9.10.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
9.10.10パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
9.10.11Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
9.10.12チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 302
9.10.13チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
9.10.14接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
9.10.15通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
9.10.16チャネル Aのメモリにフレーム番号をを書き込む . . . . . . . . . . . . . . . . . . . . . 302
9.10.17チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
9.10.18フレーム番号の下位 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
9.10.19フレーム番号の上位 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
9.10.20Dataステージ No.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
9.10.21チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 303
9.10.22チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 304
9.10.23チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
9.10.24パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
9.10.25Tokenを OUTにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
9.10.26チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
9.10.27Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
9.10.28チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 305
9.10.29チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 305
9.10.30通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
9.10.31チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
9.11 GetConfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
9.11.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
24 目次
9.11.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
9.11.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
9.11.4 チャネル Aのメモリにデバイスリクエスト SetConfigurationを書き込む . . . . . . . . 307
9.11.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 307
9.11.6 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
9.11.7 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 308
9.11.8 チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 308
9.11.9 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
9.11.10パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
9.11.11Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.11.12チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 309
9.11.13チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.11.14接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.11.15通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
9.11.16フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
9.11.17Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
9.11.18チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 310
9.11.19チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 310
9.11.20チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
9.11.21SetConfiguration終了処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
9.11.22通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
9.11.23フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
9.11.24チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
9.11.25チャネル Aのメモリにデバイスリクエスト GetConfigurationを書き込む . . . . . . . . 311
9.11.26Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
9.11.27チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 312
9.11.28チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 313
9.11.29チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
9.11.30パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
9.11.31Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
9.11.32チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
9.11.33Setupステージ終了処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
9.11.34通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
9.11.35チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
9.11.36Dataステージ no.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
9.11.37チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 314
9.11.38チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 314
9.11.39チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
9.11.40Dataステージ no.1 終了処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
9.11.41通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
9.11.42Dataステージ no.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
9.11.43チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
25
9.12 GetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
9.12.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
9.12.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
9.12.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
9.12.4 チャネル Aのメモリにデバイスリクエスト GetStatusを書き込む . . . . . . . . . . . . 317
9.12.5 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
9.12.6 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 318
9.12.7 接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
9.12.8 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
9.12.9 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
9.12.10チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 319
9.12.11チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 319
9.12.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
9.12.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
9.12.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 319
9.12.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.12.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.12.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.12.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.12.19チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
9.12.20Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
9.12.21チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 321
9.12.22チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 321
9.12.23チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
9.12.24GetStatus終了処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
9.12.25通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
9.12.26フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
9.12.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
9.13 GetInterface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
9.13.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
9.13.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
9.13.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
9.13.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 323
9.13.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 324
9.13.6 接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
9.13.7 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
9.13.8 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
9.13.9 チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 325
9.13.10チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 325
9.13.11チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
9.13.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
9.13.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
26 目次
9.13.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 326
9.13.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
9.13.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
9.13.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.13.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.13.19Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.13.20チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 327
9.13.21チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 327
9.13.22チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
9.13.23Statusステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
9.13.24通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
9.13.25フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
9.13.26チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 328
9.13.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
9.13.28チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
9.13.29Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
9.13.30チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 330
9.13.31チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 330
9.13.32パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
9.13.33Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
9.13.34チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
9.13.35Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
9.13.36通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
9.13.37フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
9.13.38チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
9.13.39Dataステージ no.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
9.13.40チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 332
9.13.41チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 332
9.13.42チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
9.13.43Dataステージ no.1 後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
9.13.44通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
9.13.45フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
9.13.46チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
9.13.47Dataステージ no.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
9.13.48チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 333
9.13.49チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 333
9.13.50チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9.14 インタラプト転送送信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9.14.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9.14.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
9.14.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
9.14.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 335
27
9.14.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 336
9.14.6 デバイス接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
9.14.7 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
9.14.8 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
9.14.9 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
9.14.10チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 337
9.14.11チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 337
9.14.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
9.14.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
9.14.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 338
9.14.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.14.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.14.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.14.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
9.14.19Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
9.14.20チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 339
9.14.21チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 339
9.14.22チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
9.14.23Statusステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
9.14.24通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
9.14.25フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.14.26インタラプト転送データ準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.14.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.14.28チャネル Aにデータを書き込む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
9.14.29チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
9.14.30インタラプト転送準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
9.14.31チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 342
9.14.32チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 342
9.14.33パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.14.34Tokenを OUTにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.14.35エンドポイントを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.14.36デバイスアドレスを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
9.14.37インタラプト転送送信開始 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.14.38チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.15 インタラプト転送受信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
9.15.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
9.15.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
9.15.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
9.15.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 344
9.15.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 345
9.15.6 デバイス接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
9.15.7 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
28 目次
9.15.8 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
9.15.9 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
9.15.10チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 346
9.15.11チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 346
9.15.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
9.15.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.15.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 347
9.15.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.15.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.15.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
9.15.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
9.15.19Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
9.15.20チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 348
9.15.21チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 348
9.15.22チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
9.15.23Statusステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
9.15.24通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
9.15.25フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
9.15.26インタラプト転送データ準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
9.15.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
9.15.28チャネル Aにデータを書き込む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
9.15.29チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
9.15.30インタラプト転送準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
9.15.31チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 351
9.15.32チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 351
9.15.33エンドポイントを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
9.15.34デバイスアドレスを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
9.15.35インタラプト転送受信開始 a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.15.36チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.15.37割り込み解除 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.15.38通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.15.39フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
9.15.40インタラプト転送受信開始 b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.15.41チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.15.42チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.15.43エンドポイントの読み出しの計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.15.44エンドポイントの読み出しのデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
9.16 アイソクロナス転送送信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
9.16.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
9.16.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
9.16.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
9.16.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 355
29
9.16.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 356
9.16.6 デバイス接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
9.16.7 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
9.16.8 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.16.9 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.16.10チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 357
9.16.11チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 357
9.16.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.16.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
9.16.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 358
9.16.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
9.16.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
9.16.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
9.16.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
9.16.19Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
9.16.20チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 359
9.16.21チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 359
9.16.22チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
9.16.23Statusステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
9.16.24通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.16.25フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.16.26アイソクロナス転送データ準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.16.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.16.28チャネル Aにデータを書き込む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9.16.29チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
9.16.30アイソクロナス転送準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
9.16.31チャネル Aの設定レジスタ 2の転送形式を 3にする . . . . . . . . . . . . . . . . . . . . 362
9.16.32チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 362
9.16.33チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 362
9.16.34パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
9.16.35Tokenを OUTにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
9.16.36エンドポイントを 2にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
9.16.37デバイスアドレスを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
9.16.38アイソクロナス転送送信開始 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
9.16.39チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
9.17 アイソクロナス転送受信 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
9.17.1 クロック . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
9.17.2 実効譜引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
9.17.3 デバイス接続 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
9.17.4 チャネル Aのメモリにデバイスリクエストを書き込む . . . . . . . . . . . . . . . . . . . 364
9.17.5 割り込みマスクを解除して割り込み許可 . . . . . . . . . . . . . . . . . . . . . . . . . . 365
9.17.6 デバイス接続検出後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
30 目次
9.17.7 接続検出の割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
9.17.8 チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
9.17.9 Setupステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
9.17.10チャネル Aの設定レジスタ 2の I/Oを 1にする . . . . . . . . . . . . . . . . . . . . . . 366
9.17.11チャネル Aの設定レジスタのデータ数を 8にする . . . . . . . . . . . . . . . . . . . . . 366
9.17.12パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
9.17.13Tokenを SETUPにする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
9.17.14チャネル Aを端子 0のセグメント 0に登録する . . . . . . . . . . . . . . . . . . . . . . 367
9.17.15チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
9.17.16Setupステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
9.17.17通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
9.17.18フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
9.17.19Statusステージ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
9.17.20チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 368
9.17.21チャネル Aの設定レジスタのデータ数を 0にする . . . . . . . . . . . . . . . . . . . . . 368
9.17.22チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
9.17.23Statusステージ後処理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
9.17.24通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
9.17.25フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
9.17.26アイソクロナス転送データ準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
9.17.27チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
9.17.28チャネル Aにデータを書き込む . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
9.17.29チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
9.17.30アイソクロナス転送準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
9.17.31チャネル Aの設定レジスタ 2の転送形式を 3にする . . . . . . . . . . . . . . . . . . . . 371
9.17.32チャネル Aの設定レジスタ 2の I/Oを 0にする . . . . . . . . . . . . . . . . . . . . . . 371
9.17.33チャネル Aの設定レジスタ 2のデータ数を 8にする . . . . . . . . . . . . . . . . . . . . 371
9.17.34パケット数を 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
9.17.35エンドポイントを 2にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.17.36デバイスアドレスを 1にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.17.37アイソクロナス転送送信開始 a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.17.38チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.17.39割り込み解除と次の準備 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
9.17.40チャネル Aのデータ位置を初期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.17.41通信済みの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.17.42フレームの割り込みを解除する . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.17.43アイソクロナス転送送信開始 b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.17.44チャネル Aの通信を有効にする . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
9.17.45エンドポイントの読み出しの計数 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
9.17.46エンドポイントの読み出しのデータ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
31
図目次
1.1 概念図 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 電流 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 状態遷移 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 信号値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 信号状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7 同期化 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.8 データ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 パケット . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 PID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 パケット詳細 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.4 ディスクリプタ構造 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 ディスクリプタ構成 例 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.6 ディスクリプタ構成 例 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.1 チップ化例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.1 チップ化例 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.2 時間割り当て . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.3 レジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.4 チャネルレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.5 セグメントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.1 コンフィギュレーションディスクリプタの関連 . . . . . . . . . . . . . . . . . . . . . . . . . . 72
6.2 転送量と時間 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
6.3 セグメント . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.1 デバイス接続状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.2 通信状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
8.1 コントロール転送以外の状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.2 コントロール転送状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.3 USB状態 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
33
表目次
2.1 通信手順 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 パケットの種類 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 標準デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.4 ※ 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.5 ※ 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 ※ 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.7 bmRequestType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.8 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.9 ディスクリプタ形式 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.10 デバイスディスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.11 コンフィギュレーションデスクリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.12 インターフェースディスリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.13 エンドポイントディスリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.14 ストリングディスリプタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.15 ディスリプタの形式 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.16 転送の種類 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1 デバイスリクエスト対応 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.1 チャネル設定レジスタ 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.2 数値 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
5.3 通信結果 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
5.4 レジスタ種類選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.5 一般レジスタ選択 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.6 チャネルレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.7 セグメントレジスタ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.1 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.2 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
6.3 デバイスリクエスト . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
6.4 1番目の GetDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.5 2番目の GetDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3
第 1章
信号概要
1.1 電気的接続
図 1.1 概念図
D+
D-
D+
D-
差動入力
差動出力
D+
D-
ツイストケーブル
差動入力
差動出力
D+
D-
EOP EOP
電位
電位
電位
電位
USBは 2本の電源供給線と信号線を持っています。信号線は双方向の電流駆動で平衡型回路になっています。
図 1.1 は概念を示す接続図です、ホスト側とデバイス側では基本的な違いはありません。電流駆動はデータ通信
時のみ行われます、それ以外では無駆動です。ホストにデバイスが接続されていない時点では両端子が抵抗で
0Vに接続されているので電位は低になります。USB1.1では 2種類の通信速度を定義していますが、デバイス
の 2端子のどちらかを抵抗で高電圧に接続することで通信速度を分けます。ホストにデバイスを接続すると 2端
子のどちらかが高電位になるので接続と通信速度を検出します。このために D+と D-の電位を知る必要があり
ます。データ通信の最後に両端子を電位 0にします、このために EOPを使います。
1.2 接続構造
通信線は図 1.2 の様に唯一のホストに対して多数のハブ (ハブデバイス) とデバイスが接続されたバス型に
なっていることを前提に考えます。デバイスはハブに接続されます、ハブはハブどうしでルートハブは含まずに
5段の深さまで接続できます。最初のハブはホストと一体になったルートハブと呼ばれるものです。
4 第 1章 信号概要
図 1.2 構造
ホスト
ルートハブ
デバイス ハブ
デバイス ハブ
デバイス デバイス
1.3 デバイスの接続
デバイスが端子に接続されると D+ か D-が高電位になります。ホストはこ
の状態が 2ms 以上継続するとデバイスが接続されたことを認識します。
1. デバイスが接続されていないときは通信線は両方ともホスト側でプルダ
ウンされているので 0Vになっています。
2. デバイスが接続されると通信線のどちらかがプルアップされるので、新
しいデバイスの接続がホストに認識されます。
3. ホストは新しいデバイスの接続と、その通信速度を認識します。
4. ホストは接続の認識から 100ms の間をおいてデバイスの安定を待って
から通信線を 10msの間 0Vにしてデバイスを初期化します。
5. ホストとデバイスは通信条件の整備を行うための情報のやり取りをコン
トロール転送で行いデバイスはホストからアドレスを付与されます。
1.4 デバイスの初期化
デバイスの接続時点でホストがデバイスについて知っている情報は通信速度だけです。デバイスはこの後にホ
ストからの通信によって設定が必要ですが、この時点でアドレス 0 、エンドポイント 0 でのコントロール転送
による通信が可能になっています。ホストはコントロール転送によりデバイスの通信仕様を読み取ったりデバイ
スにアドレスを設定したりします。
1.5 信号
USBでは 2本の通信端子を図 1.3 のように電流駆動しています。図 1.3 の➀と➁と➂で 3値の信号を通信する
ことができます。電流を駆動した場合に論理値 1 または 0 を示します。電流駆動がなされない場合は論理値は
図 1.3 電流
D+
D-
送り側 受け側
D+
D-
送り側 受け側
D+
D-
送り側 受け側
順駆動
逆駆動
両駆動
1
2
3
図 1.4 状態遷移
full low 状態
無駆動 無駆動 IDLE
逆駆動 順駆動 K
順駆動 逆駆動 J
両駆動 両駆動 SE0
無しになります。まとめると図 1.5 の様になります。電位だけで考えると意味が重なるものがありますが、これ
らは状態位置が違うので区別できます。
• IDLE : ホストとデバイスがつながっているがパケットは転送されていないとき。
1.6 ホストとデバイスの同期 5
図 1.5 信号値
遷移 full low 意味
D+ D- D+ D-
a 0 1 1 0 SOP
b 1 0 0 1 J
c 0 1 1 0 K
d 0 0 0 0 EOP
e 0 0 0 0 EOP
f 1 0 0 1 IDLE
図 1.6 信号状態
IDLE SE0
K J
ab
c
d e
f
• J : パケット中の論理値 1
• K : パケット中の論理値 0
• SE0 : Single ended 0 ホストが 10ms以上駆動した場合は Reset、デバイスが外されたとき 2.5us続い
たらホストがデバイスの取り外しを認識します。
• SOP : Start of Packet - パケットの開始で IDLEから Kになったときです。
• EOP : End of Packet - パケットの終了で送り出し側では 2ビット期間送ります、受け取り側では 1ビッ
ト期間受け取ったらパケットの終了を認識します。
デバイスが接続されたら 2 端子のどちらかが高電位になるのでこれが IDLE になります。USB1.1 では full
と low の 2種類の通信速度が定義されていますが。信号状態を遷移する値はこのどちらかを選択することで図
1.5 のように異なります。パケットの通信は IDLE から K になりデータ転送中は K か J の状態にあります。
パケットの端末で SE0 の状態になり IDLE に戻ります。
1.6 ホストとデバイスの同期
パケットの通信中は J か K の状態にありますが J から K になるときと K から J になるときがデータビッ
トの境目になります。ここで位相を合わせることができます。送り側と受け側は通信 CLKを共有していないの
で双方の通信 CLK は非同期の状態にあります。送り側に対する受け側の通信 CLK の位置は図 1.7 のように
様々ですが J と K の境目を根拠に計数器を駆動するとその値が 1 か 2 のときに信号値が送り側に同期して取
得できます。図 1.7 の場合は受信側が通信の 1ビットの 4倍の通信 CLKで信号を取得するもので 3まで計数し
た後には 0になります。J が連続したり K が連続したりする場合はその計数間隔の位置で信号が取得されます。
J が連続したり K が連続すると位相調整ができなくて位相がずれていきますが USB では 6 ビット以上連続し
て J または K であることがないように工夫されているので最長でも 6ビット以内に位相調整が入ります。
1.7 データ
信号が取得できるようになるとビットデータに直します。この行程は通信 CLKに同期した論理での説明にな
ります。信号値をデータ値に変換する方法は J から K になったときと K から J になったときを 1 として J
から J と K から K になったときは 0 として信号値からデータ値に変換します。図 1.8 は 80h のデータの例
です。この値はパケットの SYNC に当たります。信号の同期が取れていてもデータをバイトで取得する場合に
はビット位置を合わせるビットの同期を取ってその位置から 8ビットずつバイトデータとして取っていきます。
6 第 1章 信号概要
図 1.7 同期化
0 1 2 3 0
0 1 2 3 0
0 1 2 3 0
0 1 2 3 0
0 1 2 3 0
0 1 2 3 0 1 2 3 0
J K
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
0
0
0
0
0
送り側
受け側
J K
図 1.8 データ
K J K J K J K J
0 0 0 0 0 0 0
J
1
USB では LSB から送り出すので 80h の場合は前が 0 で MSB だけが 1 なのでこの 1 の次からがバイトデー
タの初めのビット位置になります。データ値を信号値に変えて送り出す場合には K を初期値にして 0 なら K
を J に、または J を K にします。1 なら J は J のまま K は K のままとします。
7
第 2章
通信概要
2.1 時分割
USBではホストの主導により通信を行っているのですが。ホストは通信の時間割のようなものを想定して予
定を組みます。その基本となるものが連続した時間を 1msごとに区切ったフレームと言われるものです。例え
ばホストが毎フレームに 1k バイトのパケットを割り当てると 1000k バイト/秒 の転送量を保証できます。
2.2 通信要素
通信はパケットを単位として行います。パケットは大別して Token、Data、Handshakeの 3種類があります。
この 3種類のパケットを表 2.1 の手順でやり取りして一連の手順を終了します。当方ではこの一連の手順をトラ
ンザクションと言うことにします。手順の実行中に次のパケットが来るまでの時間を計測して USBの規定時間
表 2.1 通信手順
送信 受信
ホストが Tokenを送る ホストが Tokenを送る
ホストが続いて Dataを送る デバイスが Dataを送る
デバイスは Handshakeを返す ホストが Handshakeを返す
内に来ない場合はタイムアウトになります。
2.3 通信方式
2.3.1 コントロール転送
ホストがデバイスの設定をしたり仕様を読み出したりするときに使う転送方式です。デバイスが接続された直
後にはアドレス 0、エンドポイント 0にコントロール転送でやりとりできるようになっています。ホストは次の
3種類のトランザクションを使ってデバイスにデバイスリクエストを発行します。
1. セットアップステージ
2. データステージ
3. ステータスステージ
8 第 2章 通信概要
手順は次のものがあります。1番目はデータのあるデバイスリクエストに 2番目はデータのないデバイスリク
エストに使います。
• セットアップステージ → データステージ → ステータスステージ
• セットアップステージ → ステータスステージ
セットアップステージ
コントロール転送を始めるトランザクションでありデバイスリクエストを発行します。
• Tokenパケットに Setupを使うトランザクションです。
• Dataパケットはホストが送ります。ここにデバイスリクエストが入ります。
• Handshakeパケットはデバイスが返します。
データステージ
デバイスリクエストにデータを付加したりデバイスリクエストがデバイスにデータを要求するときにそのデー
タが入ります。
• Tokenパケットに INか OUTを使うトランザクションです。
• Dataパケットは Tokenパケットによってホストが送ったりデバイスが送ったりします。
• Handshakeパケットは Tokenパケットによってホストが返したりデバイスが返したりします。
ステータスステージ
コントロール転送を終わらせるトランザクションです。
• Tokenパケットに INか OUTを使います。
• Data パケットは Token パケットによってホストかデバイスが送ります。パケットのデータ数は 0 にし
ます。
• Handshakeパケットは Tokenパケットによってホストが返したりデバイスが返したりします
2.3.2 バルク転送
転送間隔を指定しない転送方式で実時間性の少ない転送形態に使う方式です。
通常のトランザクションを使って通信を行います。
使用例としてプリンタの印刷データなど実時間性は低いが大量のデータ転送に向くとされています。
2.3.3 インタラプト転送
転送間隔を指定する実時間性の必要な転送形態に使う方式です。
通常のトランザクションを使って通信を行います。
使用例としてキーやマウスなどの実時間性の高い少量のデータ転送に向くとされています。
実時間は最速でも最短の転送間隔の 1ms です。
2.4 パケット 9
2.3.4 アイソクロナス転送
毎フレームで転送を行う実時間性の高い大容量の転送を行う転送方式です。
通常のトランザクションから Handshakeパケットを除いた短縮したトランザクションを使います。
使用例として音声や動画など大量のデータを一定間隔で転送する場合に向くとされています。
2.4 パケット
2.4.1 基本構造
パケットは基本的に図 2.1 のような構造になっています。これを基本として短縮した形も使われます。
SYNCは全パケットで同じ値を使います。
PIDはパケットの種類を示すものでパケットによって違います。
DATAの大きさはパケットによって異なります。
CRCはパケットの種類によって 2種類あります。
図 2.1 パケット
SYNC PID DATA CRC
2.4.2 Tokenパケット
このパケットは DATAと CRCが他のパケットと異なっています。DATAは固定で 11ビットなので CRCは
5ビットになっています。パケットの総計は SYNCと PIDと合わせていつでも 4バイトになります。Tokenパ
ケットはトランザクションの先頭にあってホスト側からのみ送り出されるパケットです DATAでデバイスのア
ドレスとエンドポイントを指定します。
2.4.3 Dataパケット
このパケットの DATAはバイト単位で大きさが変わります。CRCは 16ビットです。
DATAの大きさはデバイスのエンドポイントの仕様によって送り出し側で決定されます。
DATAパケットをホストとデバイスのどちらが送り出すかは Tokenパケットの PIDで決まります。
Tokenが OUTならホストが DATAパケットを送り出します。
Tokenが INならデバイスが DATAパケットを送り出します。
DATAパケットがホストから送り出されるときにその受け手のデバイスの指定については Tokenの内容から
アドレスとエンドポイントが示されています。
2.4.4 Handshakeパケット
このパケットは DATAと CRCがないので 2バイトの固定です。
Handshakeパケットは DATAパケットを受けた側が返します。
基本的には Tokenが INならホストが返し Tokenが OUTならデバイスが返します。
10 第 2章 通信概要
2.5 詳細構造
2.5.1 SYNC
パケットの先頭に必ずつける 1バイトのデータで 80hです。この 80hの受信中に通信の同期が確立されます。
2.5.2 PID
PID はパケットの種類を示しており表 2.2 のものがあります。PID は 8 ビットです表 2.2 の PID の値は 4
ビットですがこれを下位の 4ビットにして上位はこれを反転した値を配置します。Tokenの OUTを例にする
と 1110 0001b になります。
表 2.2 パケットの種類
形式 名前 PID バイト数 CRC 説明
Token OUT 0001 4 5 ホストが Dataパケットを送信する
IN 1001 〃 〃 ホストが Dataパケットを受信する
SOF 0101 〃 〃 フレームの開始
SETUP 1101 〃 〃 デバイスリクエスト
Data Data0 0011 可変 16 偶数番目のパケット
Data1 1011 〃 〃 奇数番目のパケット
Handshake ACK 0010 2 なし 肯定応答
NAK 1010 〃 〃 否定応答
STALL 1110 〃 〃 停止中
Special PRE 1100
図 2.2 PID
P I D3 P I D2 P I D1 P I D0 P I D3 P I D2 P I D1 P I D0
MS B L S B
2.5.3 DATA
Handshakeパケット以外のパケットは DATAを持っています。Tokenパケットの DATAは通信の進行に必
要な情報が置かれています。デバイスのアドレスやエンドポイントとフレーム番号などです。DATAの大きさ
は 11ビットですが 5ビットの CRCと合わせて 2バイトです。Dataパケットの DATAは通信したいデータそ
のものが置かれます。DATAの大きさはエンドポイントの仕様により決められています。
2.5.4 CRC
Tokenパケットは 5ビットの CRC、Dataパケットには 16 ビットの CRCを使います。Handshakeパケッ
トには CRCがありません。CRCの計算は DATAから行います SYNCと PIDは含みません。
2.6 パケットの保証 11
5ビットの CRC f(x) = x5 + x2 + 1
16ビットの CRC f(x) = x16 + x15 + x2 + 1
2.5.5 各パケットの構造
パケットの詳細は図のようになっています。通信では 8ビットの LSBから送り出されます。
図 2.3 パケット詳細
0 1 2 3 4 5 6 7
S YNC
0 0 0 0 0 0 0 1
0 1 2 3 4 5 6 7
P I D
P 0 P 1 P 2 P 3P 0 P 1 P 2 P 3
0 1 2 3 4 5 6 7
F r a me
0 1 2 3 4 5 6 7
CRC5 EO
P
0 1 2 3 4 5 6 7
S YNC
0 0 0 0 0 0 0 1
0 1 2 3 4 5 6 7
P I D
P 0 P 1 P 2 P 3P 0 P 1 P 2 P 3
0 1 2 3 4 5 6 7
ADDR
0 1 2 3 4 5 6 7
CRC5 EO
P
ENDP
0 1 2 3 4 5 6 7
S YNC
0 0 0 0 0 0 0 1
0 1 2 3 4 5 6 7
P I D
P 0 P 1 P 2 P 3P 0 P 1 P 2 P 3
0 1 2 3 4 5 6 7
DATA
0 1 2 3 4 5 6 7
CRC1 6 EO
P
DATA
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
S YNC
0 0 0 0 0 0 0 1
0 1 2 3 4 5 6 7
P I D
P 0 P 1 P 2 P 3P 0 P 1 P 2 P 3
EO
P
To k e n
To k e n ( S ETUP , I N, OUT)
Da t a
Ha n d s h a k e
2.6 パケットの保証
通信ではデータが途中で損傷していることがあると考えて対策されています。データが損傷していることがわ
かればデータを送りなおすことも可能です。最も困るのは損傷したデータを正常なデータと区別できないことで
す。PIDは下位の 4ビットを反転したものが上位の 4ビットにされているのでこの整合がないとパケットと認
識されません。これによって不確かなパケット認識を防いでいます。DATAには CRCが付けられているので
データに損傷があったことを認識できます。
2.7 パケットのやりとりの保証
Handshakeパケットで否定応答の結果が返された場合には Dataパケットを送り出した側は次のトランザク
ションでは次のデータではなく否定応答を受けたトランザクションのデータを送りなおします。Dataパケット
には 2種類の PIDが割り当てられていてこれを交互に使うことでトランザクションの順番を監視できるように
なっています。奇数→偶数→奇数・・・と送っていく訳です。
12 第 2章 通信概要
2.7.1 コントロール転送
セットアップステージの Dataパケットの PIDは Data0です。
データステージの Dataパケットの PIDは Data1から始まります。
ステータスステージの Dataパケットは Data1です。
2.7.2 バルク転送
Dataパケットの PIDは Data0から始まります。
2.7.3 アイソクロナス転送
Dataパケットの PIDは Data0だけを使います。この転送のトランザクションには Handshakeパケットを使
わないのでデータの検査結果に応じた処理はなくパケットの順番を監視する機構も省かれています。
2.8 パケットの終了の認識
Data パケットは DATAが可変なのでパケットの最後を示すために通信線が特別の状態になります。これを
EOPと言います。パケットの最後の 2ビット期間この状態になります。パケットの受け手は EOPを 1ビット
検出するとパケットの最後と認識します。パケットのデータは同期が確立されていないと読み取れませんが通信
線はデータに 2値、EOPに 1値の 3値を使えるので EOP は同期確立に関係なく通信線の状態だけで認識でき
るようになっています。
2.9 デバイスリクエスト
基本的に表 2.3 の様なデバイスの持つディスクリプタの情報の読み取り、書き換えや、その情報を基に行われ
る操作などがあります。
• Get Descriptor
指定したディスクリプタの読み取りを行います。指定できるディスクリプタはデバイスディスクリプタ、
コンフィギュレーションディスクリプタ、ストリングディスクリプタです。指定の方法はディスクリプタ
の形式と番号です、形式は先に挙げた 3種類です。コンフィギュレーションディスクリプタを選択した場
合はそれを構成するインターフェースディスクリプタ、エンドポイントディスクリプタも含んでいます。
番号と言うのは、例えばコンフィグレーションディスクリプタが 5個あるとすれば番号は 0から 4でそ
れらを指定します。
• Set Descriptor
ディスクリプタの更新または追加を行います、ディスクリプタの指定は先と同じく形式と番号で行い
ます。
• Set Configuration
デバイス構成の設定を行います。構成の選択はコンフィギュレーションディスクリプタから得られている
構成値 (bConfigurationValue) で指定します。構成値を 0 にしたときはデバイスを未構成に戻すことに
なります。
• Get Configuration
2.10 ディスクリプタ 13
現在のデバイス構成を得ます。デバイス構成とは構成値のことです、0の場合は先にも触れたように未構
成を示します。
• Set Address
デバイスにアドレスの割り当てを行います。
他にもありますが、ここでは重要と思われるものを取り上げました。
表 2.3 標準デバイスリクエスト
機能名 bmRequest bRequest wValue wIndex wLength Data
Type
1バイト 1バイト 2バイト 2バイト 2バイト
CLEAR FEATURE 0000 0000 1 選択値 0 0 なし
0000 0001 Interface
0000 0010 Endpoint
GET CONFIGURATION 1000 0000 8 0 0 1 構成値
GET DESCRIPTOR 1000 0000 6 Type:Index 0か言語 ID バイト数 ディスクリプタ
GET INTERFACE 1000 0001 10 0 Interface 1 代替値
GET STATUS 1000 0000 0 0 0 2 ※ 1 表 2.4
1000 0001 Interface ※ 2 表 2.5
1000 0010 Endpoint ※ 3 表 2.6
SET ADDRESS 0000 0000 5 アドレス 0 0 なし
SET CONFIGURATION 0000 0000 9 構成値 0 0 なし
SET DESCRIPTOR 0000 0000 7 Type:Index 0か言語 ID バイト数 ディスクリプタ
SET FEATURE 0000 0000 3 選択値 0 0 なし
0000 0001 Interface
0000 0010 Endpoint
SET INTERFACE 0000 0001 11 代替値 Interface 0 なし
SYNCH FRAME 1000 0010 12 0 Endpoint 2 フレーム番号
Type (上位バイト) : ディスリプタ形式 表 2.15参照
Index (下位バイト) : ディスクリプタ番号
Interface : インターフェースディスクリプタ番号
Endpoint : エンドポイントディスクリプタ番号
2.10 ディスクリプタ
コントロール転送ではホストはデバイスの持つディスクリプタを読みます。デバイスはディスクリプタを記憶
するメモリまたはレジスタが必要です。デバイスディスクリプタはデバイスに関する一般情報を書いてあるもの
で、デバイスごとにひつだけあるものです。エンドポイントディスクリプタは (エンドポイントの) アドレス、
転送方式、容量などを書いてあります。USBを説明した資料にはコンフィギュレーションを構成と言っている
ものがあるのでここはその言葉も使いながら説明を続けます。
14 第 2章 通信概要
表 2.4 ※ 1
D7 D6 D5 D4 D3 D2 D1 D0
0 リモート・ウェイクアップ 自己電源
D7 D6 D5 D4 D3 D2 D1 D0
0
表 2.5 ※ 2
D7 D6 D5 D4 D3 D2 D1 D0
0
D7 D6 D5 D4 D3 D2 D1 D0
0
表 2.6 ※ 3
D7 D6 D5 D4 D3 D2 D1 D0
0 ストール
D7 D6 D5 D4 D3 D2 D1 D0
0
表 2.7 bmRequestType
定義 ビット 値 意味
転送方向 D7 0 ホスト→デバイス
1 デバイス→ホスト
形式 D6,D5 0 Standard
1 Class
2 Vendor
3 Reserved
内容 D4∼D0 0 Device
1 Interface
2 Endpoint
3 Other
4∼31 Reserved
2.10 ディスクリプタ 15
表 2.8 デバイスリクエスト
リクエスト SETUPステージ DATAステージ
0 1 2 3 4 5 6 7 データ数
GetDescriptor 80h 6 ※ 1 0か言語 ID バイト数 バイト数
GetConfiguration 80h 8 0 0 1 1
GetInterface 81h 10 0 Intno 1 1
ClearFeature 0 0
1 1 選択値 インターフェース 0 なし
2 エンドポイント
GetStatus 80h 0
81h 0 0 インターフェース 2 2
82h エンドポイント
SetConfiguration 0 9 構成値 0 0 なし
SetDescriptor 0 7 ※ 1 0か言語 ID バイト数 バイト数
SetInterface 1 11 代替値 Intno 0 なし
SetFeature 0 0
1 3 選択値 インターフェース 0 なし
2 エンドポイント
SetAddress 0 5 アドレス 0 0 なし
Syncframe 2 12 0 Endno 2 フレーム番号
※ 1 (表 2.9参照) 上位 8ビットはディスクリプタ形式、下位 8ビットはディスクリプタ番号
Intno インターフェースディスクリプタ番号
Endno エンドポイントディスクリプタ番号
表 2.9 ディスクリプタ形式
形式 値
DEVICE 1
CONFIGURATION 2
STRING 3
INTERFACE 4
ENDPOINT 5
• デバイスディスクリプタ (表 2.10)
• コンフィギュレーションディスクリプタ (表 2.11)
• インターフェースディスクリプタ (表 2.12)
• エンドポイントディスクリプタ (表 2.13)
• ストリングディスクリプタ (表 2.14)
ホストからデバイスを見た場合には、それぞれはエンドポイントのかたまりのように見えています。エンドポ
イント個々の特性は先のエンドポイントディスクリプタに書いてあります、例外としてエンドポイント 0に対応
16 第 2章 通信概要
図 2.4 ディスクリプタ構造
コンフィギュレーションディスクリプタ
インターフェースディスクリプタ
エンドポイントディスクリプタ
構成 構成
0
1
1 2
1
3 4 5
2
6
するエンドポイントディスクリプタはありません、エンドポイントが 1種類以上の転送方式をもっている場合も
あります、エンドポイントを場面に応じた特性で使い分けることもあります。エンドポイントの使い方を決定す
ることをコンフィギュレーションといいます、コンフィギュレーションする前を構成が選択されていないと言い
ます、コンフィギュレーション後を構成されていると言います。コンフィギュレーションは専用のコマンドが用
意されていて、そこでコンフィギュレーションディスクリプタを指定してデバイスが可能な構成の中からホスト
が任意で選んだものでデバイスのエンドポイントを構成します。そういうことなのでデバイスはコンフィギュ
レーションディスクリプタを最低でもひとつは必要ですし、いくつもの構成を提供するのなら、同数のコンフィ
グレーションディスクリプタを持つ必要があります。コンフィギュレーションディスクリプタの下位の構造とし
て図 2.4 のようにインターフェースディスクリプタがあります、インターフェースディスクリプタはエンドポイ
ントディスクリプタを下位に持っていて、ここに書かれた内容でエンドポイントの使い方が決まります。イン
ターフェースディスクリプタとエンドポイントディスクリプタはコンフィギュレーションディスクリプタを構成
するものなのでコンフィギュレーションディスリプタの全体と言った場合には下位のこれらのディスクリプタを
含みます。ストリングディスクリプタは文字列を格納しているところです、各ディスクリプタから番号で参照さ
れています。
2.11 ディスクリプタの構成
デバイスはディスクリプタを持ちホストはデバイスからディスクリプタを読み出してデバイスとそのエンドポ
イントの使い方を把握します。ホストが読み出すディスクリプタはデバイスディスクリプタ、コンフィギュレー
ションディスクリプタ、ストリングディスクリプタの 3種類です。
2.11.1 デバイスディスクリプタ
デバイスディスクリプタはデバイスにひとつだけあります、コンフィギュレーションディスクリプタとストリ
ングディスクリプタは複数個あるので番号を指定して読み出します。コンフィギュレーションディスクリプタが
いくつあるかはデバイスディスクリプタの bNumConfigurationsに示されます。
2.11.2 コンフィギュレーションディスクリプタ
コンフィギュレーションディスクリプタを読み出すとその構成に必要なすべてのインターフェースディスクリ
プタとエンドポイントディスクリプタが同時に読み出されます。コンフィギュレーションディスクリプタには、
2.11 ディスクリプタの構成 17
表 2.10 デバイスディスクリプタ
定義名 バイト数 意味
bLength 1 ディスクリプタのバイト数
bDescriptorType 1 ディスクリプタの形式
bcdUSB 2 USB仕様リリース番号 (BCD)
bDeviceClass 1 クラスコード
bDeviceSubClass 1 サブクラスコード
bDeviceProtocol 1 プロトコルコード
bMaxPacketSize0 1 エンドポイント 0の最大パケットサイズ
idVendor 2 ベンダ ID
idProduct 2 プロダクト ID
bcdDevice 2 デバイスリリース番号 (BCD)
iManufactuer 1 製造者を示すストリングディスクリプタ番号
iProduct 1 製品を示すストリングディスクリプタ番号
iSerialNumber 1 製造番号を示すストリングディスクリプタ番号
bNumConfigurations 1 可能な構成の数
表 2.11 コンフィギュレーションデスクリプタ
定義名 バイト数 意味
bLength 1 ディスクリプタのバイト数
bDescriptorType 1 ディスクリプタの形式
wTotalLength 2 本構成の全ディスクリプタのバイト数
bNumInterface 1 本構成でサポートされるインターフェースの数
bConfigurationValue 1 構成値
iConfiguration 1 本構成を示すストリングディスクリプタ番号
bmAttributes 1 本構成の特性
D7 : 1
D6 : 自己電源
D5 : リモート・ウェイクアップ
D4∼D0 : 0
MaxPower 1 最大電力消費量 2mA単位
その構成で取り扱うインターフェースの数が bNumInterface に示されます。ホストが読み取ったコンフィギュ
レーションディスクリプタを含む構成全体からインターフェースディスクリプタを特定するのはインターフェー
スディスリプタの bInterfaceNumberで示されるインターフェース番号と代替値です。
2.11.3 インターフェースディスクリプタ
インターフェースディスクリプタには、そのインターフェースが取り扱うエンドポイントの数が bNumEnd-
points に示されます。ホストが読み取ったコンフィギュレーションディスクリプタを含む構成全体からエンド
18 第 2章 通信概要
表 2.12 インターフェースディスリプタ
定義名 バイト数 意味
bLength 1 ディスクリプタのバイト数
bDescriptorType 1 ディスクリプタの形式
bInterfaceNumber 1 インターフェース番号
bAlternateSetting 1 代替値
bNumEndpoints 1 本インタフェースの構成するエンドポイントの数
bInterfaceClass 1 クラスコード
bInterfaceSubClass 1 サブクラスコード
bInterfaceProtocol 1 プロトコルコード
iInterface 1 本インターフェースを示すストリングディスクリプタ番号
表 2.13 エンドポイントディスリプタ
定義名 バイト数 意味
bLength 1 ディスクリプタのバイト数
bDescriptorType 1 ディスクリプタの形式
bEndpointAddress 1 エンドポイントのアドレス
D7 : 方向 (OUT 0 / IN 1 )
D6∼D4 : 0
D3∼D0 : エンドポイント番号
bmAttributes 1 エンドポイントの属性
0 : コントロール転送
1 : アイソクロナス転送
2 : バルク転送
3 : インタラプト転送
wMaxPacketSize 2 本エンドポイントのパケットの最大データ数
bInterval 1 ポーリング間隔
アイソクロナス転送は 1、インタラプト転送は 1∼255
表 2.14 ストリングディスリプタ
定義名 バイト数 意味
bLength 1 ディスクリプタのバイト数
bDescriptorType 1 ディスクリプタの形式
bString – UNICODEの文字列
2.11 ディスクリプタの構成 19
表 2.15 ディスリプタの形式
形式 値
DEVICE 1
CONFIGURATION 2
STRING 3
INTERFACE 4
ENDPOINT 5
ポイントディスクリプタを特定するのはエンドポイントディスリプタの bEndpointAddressで示されるエンド
ポイント番号です。
図 2.5 ディスクリプタ構成 例 2
エンドポイント 4
エンドポイント 1
エンドポイント 2
エンドポイント 3
インターフェース 0
コンフィギュレーション 1
デバイス
2.11.4 エンドポイントディスクリプタ
エンドポイントディスクリプタは同一構成の中のインターフェースで重複定義することは許されないのでホス
トが読み取ったコンフィギュレーションディスクリプタを含む構成全体の中には該当するエンドポイント番号の
エンドポイントディスクリプタはひとつだけです。尚、エンドポイントディスクリプタは 0 から 15 までの 16
個まで持つことが出来ます、エンドポイントの 0番はコントロール転送でデバイスリクエストを受ける必須のも
のです、どの構成を選んでもエンドポイントの 0番はコントロール転送に当てられるのでエンドポイントディス
クリプタはありません。
2.11.5 ディスクリプタの構成例
ディスクリプタの構成例を 2例示します、図 2.6 は構成を 2個持っていて、どちらかを選択できます、コン
フィギュレーション 1のインターフェース 2は代替値で 2種類から選択できます。図 2.5 は最も簡単なもので
構成もインターフェースもひとつだけで代替値の選択もできません、ストリングディスクリプタも必須ではない
ので外せます。尚、コンフィギュレーションの 0番は未構成を示す番号です。
20 第 2章 通信概要
図 2.6 ディスクリプタ構成 例 1
エンドポイント 4
エンドポイント 1
エンドポイント 2
エンドポイント 3
エンドポイント 5
エンドポイント 6
エンドポイント 7
エンドポイント 9
エンドポイント 1 0
エンドポイント 1 1
エンドポイント 1 2
エンドポイント 1 3
エンドポイント 1 4
エンドポイント 1 5
インターフェース 0
インターフェース 1
インターフェース 2
インターフェース 3
コンフィギュレーション 1
エンドポイント 1 2
エンドポイント 9
エンドポイント 1 0
エンドポイント 1 1
代替値 0
代替値 1
エンドポイント 1
エンドポイント 2
エンドポイント 3
エンドポイント 4
エンドポイント 5
エンドポイント 6
エンドポイント 7
エンドポイント 8
エンドポイント 9
エンドポイント 1 0
エンドポイント 1 1
エンドポイント 1 2
インターフェース 0
インターフェース 1
コンフィギュレーション 2デバイス
ストリング 0
ストリング 1
ストリング 2
ストリング 3
ストリング 4
ストリング 5
ストリング 6
エンドポイント 8
エンドポイント 1 3
エンドポイント 1 4
エンドポイント 1 5
2.12 転送の種類
先に説明したコントロール転送と他にインタラプト転送、バルク転送、アイソクロナス転送の 4種類がありま
す。転送の種類はエンドポイントの属性なのでエンドポイントディスクリプタの定義値で固定されています。エ
ンドポイント 0はエンドポイントディスリプタを持たない特別のエンドポイントでコントロール転送のみが可能
です。
各転送の概要は表 2.16 のとおりです。転送周期のあるものはエンドポイントディスクリプタに定義します。
コントロール転送は双方向ですが他の転送は片方向なのでエンドポイントディスクリプタに転送方向を定義し
2.12 転送の種類 21
表 2.16 転送の種類
名前 最大 byte/packet 応答 転送 特徴
full low パケット 周期
コントロール 8/16/32/64 8 あり 不定 デバイス制御 、双方向
バルク 64 8 〃 〃 実時間性は低いが大量のデータ転送ができる。
インタラプト 64 〃 1 ∼ 255ms データ量は少ないが実時間で転送できる。
アイソクロナス 1023 なし 1ms 一定の周期でデータ転送ができる。
ます。表 2.16 に示した「最大 byte/packet」を上限として各エンドポイントのパケット容量をエンドポイント
ディスクリプタに定義します。Dataパケットの使い方は基本的に偶数パケットを始めに奇数パケット、偶数パ
ケット・・・と送ります。例外としてアイソクロナス転送では偶数パケットだけを使います、アイソクロナス転
送では Handshakeパケットのやりとりがないので Dataパケットの再送が発生せず奇数と偶数でパケットの順
序を監視する必要がありません。またコントロール転送の Statusステージは奇数パケットに決まっています。
25
第 3章
概要
デバイスはホストと USBの仕様による通信の手順を実行しなければなりません。この部分をコントローラに
集約してコントローラを使用する周辺機能がデータ転送に集中できるようにします。
• デバイスリクエストの応答に周辺機能が関知しないで済むようにします。• デバイスディスクリプタの情報をコントローラに実装します。• 通信するデータの読み取りや書き込みをコントローラが直接行うことでコントローラとデータとの間にプロセッサなどの介在を不用にします。
• コントローラにはプロセッサの操作対象になるレジスタなどは設けず単独で簡単に使えるようにします。ひとつのコントローラが対象にする USB端子はひとつにして、複数の USB端子がある場合には必要分
のコントローラを用意します。
3.1 構成
コントローラは手続きとして提供されます、これに周辺機能を追加して USBデバイスにします。周辺機能と
はコントローラからのデータを受け取ったりコントローラにデータを渡したりする機能です。
図 3.1 チップ化例
dpindmindpout
dmout
dir
selwprp
edatainedataout
D+D-
RESET
CS
ADDRESS
DATA
デバイスコントローラ
reset
周辺機能
USBデバイスチップの例
WERD
CLK CLK
26 第 3章 概要
3.2 デバイスリクエスト
デバイスリクエストへの対応動作は次のようになっています。
表 3.1 デバイスリクエスト対応
リクエスト 対応動作
GetDescriptor デバイスディスクリプタを返す。
GetConfiguration 構成値を返す。
GetInterface 代替値を返す。
ClearFeature なし
GetStatus 対応値を返す。
SetConfiguration 構成値を記憶する。
SetDescriptor なし
SetInterface 代替値を記憶します。
SetFeature なし
SetAddress 番地を記憶します。
SyncFrame フレーム番号を記憶します。
27
第 4章
論理譜
{ ==================================================================== }{ USBデバイスコントローラ }{ 通信基本論理 }{ ==================================================================== }logicname usbblock
library usb.lib
{ ==================================================================== }{ 実効譜 }{ ==================================================================== }procedure usbdevcont
4.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input dpin; { 差動入力 + }input dmin; { 差動入力- }input edatain[8]; { エンドポイント入力データ }
4.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[317];
4.3 手続き接続
28 第 4章 論理譜
{ -------------------------------------------------------------------- }{ 手続き接続 }{ -------------------------------------------------------------------- }bitn q[25];bitn usbport[68];bitn bit11d[38];bitn pid[17];bitn crc16d[16];bitn eopp[2];bitn packet[34];bitn cst[5];bitn st[3];bitn drd[64];bitn daddr[8];bitn dif[8];bitn dcf[8];bitn intdescriptor[14];bitn spacket[46];
4.4 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitn dpout;bitn dmout;bitn dir;bitn sel[4];bitn psp;bitn pep;bitn wp;bitn rp;bitn edataout[8];bitn clr;bitn invpidpassa;bitn crc5;bitn sp;bitn sdno[11];bitn spid[8];bitn seop;bitn seope;bitn seops;bitn sd;bitn devreq0d[8];bitn devreq1d[8];bitn devreq2d[8];bitn devreq3d[8];bitn devreq4d[8];bitn devreq5d[8];bitn devreq6d[8];bitn devreq7d[8];bitr crc16c;bitn sen;bitn devreqvalid;bitn sdcount[11];bitn sbdata[8];bitn spdno[11];
4.5 出力代入 29
bitn srdno[11];bitn sdeno[11];bitn scrc16[16];bitn sdatano[11];bitn tmode[2];bitn mode;bitn data;bitn eop;bitn syncsp;bitr eope[2];bitr comtime[8];bitr count[11];bitr pdsize[11];bitr devreqcmd[5];bitr descindex[8];bitr desctype[8];bitr desc0wIndex[8];bitr desc1wIndex[8];bitr desc0wLength[8];bitr desc1wLength[8];bitr spsize[11];bitr spc[4];bitr ssPACKET;bitr tog1p;bitr tog2p;bitr pidct[4];bitr respid[4];bitr respidct[2];bitn PID[4];bitn pidpassa;bitn pidpassb;bitn bytesp;bitn tokenaddr[7];bitn tokenendpoint[4];bitn sync;bitn cd;bitn descdata[8];bitr sclk[2];bitn sbp;bitn nextbit;bitn dseop;bitr ensclk[2];bitn waitsbp;bitn usbconnect;bitr syncframe[16];bitn devreqendno[16];
4.5 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0=dpout; { 差動出力 + }Q.1=dmout; { 差動出力- }Q.2=dir; { 転送方向 }Q.3:6=sel; { エンドポイント }Q.7=psp; { パケット開始起点 }Q.8=pep; { パケット終了起点 }
30 第 4章 論理譜
Q.9=wp; { 書き込み起点 }Q.10=rp; { 読み込み起点 }Q.11:18=edataout; { エンドポイント出力データ }
Q.19=sp;Q.20=sync;Q.21=data;Q.22:29=q.0:7;Q.30:34=cst;Q.35=eop;Q.36:37=usbport.6:7;Q.38=usbport.4;Q.39=usbport.5;Q.40:45=usbport.19:24;Q.46=usbport.8;Q.47=usbport.46;Q.48=usbport.45;Q.49:52=respid;Q.53:56=spid.0:3;Q.57=spacket.0;Q.58=spacket.1;Q.59=spacket.17;Q.60=sbp;Q.61=dseop;Q.62:68=0;Q.69:71=st;Q.72:76=devreqcmd;Q.77:84=desctype;Q.85:92=sbdata;Q.93:108=spacket.20:35;Q.109:114=0;Q.115:117=spacket.14:16;Q.118:119=sclk;Q.120=nextbit;Q.121:131=sdno;Q.132:142=sdeno;Q.143=ssPACKET;Q.144:147=spc;Q.148:158=spsize;Q.159:166=daddr;Q.167=usbconnect;Q.168:174=tokenaddr.0:6;Q.175:212=bit11d;Q.213=eope.0;Q.214=crc5;Q.215:223=pid.0:8;Q.224=seope;Q.225:235=pdsize;Q.236:246=count;Q.247:248=eopp;Q.249:264=crc16d;Q.265=q.8;Q.266:273=dcf;Q.274:281=dif;Q.282=syncsp;Q.283=usbport.10;Q.284=usbport.12;Q.285:300=syncframe;Q.301:316=devreqendno;
4.6 代入
4.7 送信 CLK期間 31
{ -------------------------------------------------------------------- }{ 代入 }{ -------------------------------------------------------------------- }
dir=ensclk.0;psp=q.10 | spacket.36;pep=eopp.0 | seops;sel=packet.26:29;rp=spacket.45;edataout=q.0:7;
4.7 送信 CLK期間
{ -------------------------------------------------------------------- }{ 送信 CLK期間 }{ -------------------------------------------------------------------- }
if (reset)ensclk=0;
elseswitch(ensclk)
case 0:if (sen) ensclk=0b01; endif
case 1:if (dseop) ensclk=0b11; else ensclk=ensclk; endif
case 3:if (dseop) ensclk=ensclk; endif
endswitchendif
4.8 送信 CLK
{ -------------------------------------------------------------------- }{ 送信 CLK }{ -------------------------------------------------------------------- }
if (ensclk.0)sclk=sclk+1;
elsesclk=0;
endif
4.9 ビット送信起点
{ -------------------------------------------------------------------- }{ ビット送信起点 }{ -------------------------------------------------------------------- }
32 第 4章 論理譜
if (sclk==3) sbp=1; endif
4.10 連続 1が 6個の処理前のビット送信起点
{ -------------------------------------------------------------------- }{ 連続 1が 6個の処理前のビット送信起点 }{ -------------------------------------------------------------------- }
if (nextbit)if (sclk==3) waitsbp=1; endif
endif
4.11 送信端に同期した EOP
{ -------------------------------------------------------------------- }{ 送信端に同期した EOP }{ -------------------------------------------------------------------- }
dseop=usbport.61;
4.12 送信ビット移動指標
{ -------------------------------------------------------------------- }{ 送信ビット移動指標 }{ -------------------------------------------------------------------- }
nextbit=usbport.59;
4.13 手続き getbyte引用
{ -------------------------------------------------------------------- }{ 手続き getbyte引用 }{ -------------------------------------------------------------------- }
q=getbyte(clr,eope.0,syncsp,data);
4.14 手続き sendPACKET引用
4.15 手続き getSOForToken引用 33
{ -------------------------------------------------------------------- }{ 手続き sendPACKET引用 }{ -------------------------------------------------------------------- }
spacket=sendPACKET(sen,spdno,spid,sbdata,tmode,waitsbp);
4.15 手続き getSOForToken引用
{ -------------------------------------------------------------------- }{ 手続き getSOForToken引用 }{ -------------------------------------------------------------------- }
bit11d=getSOForToken(data,sp,pidpassa);
4.16 手続き getPID引用
{ -------------------------------------------------------------------- }{ 手続き getPID引用 }{ -------------------------------------------------------------------- }
pid=getPID(clr,q.0:7,bytesp,eopp.0);
4.17 手続き crc16引用
{ -------------------------------------------------------------------- }{ 手続き crc16引用 }{ -------------------------------------------------------------------- }
crc16d=crc16(invpidpassa,sp,data);
4.18 手続き getEOP引用
{ -------------------------------------------------------------------- }{ 手続き getEOP引用 }{ -------------------------------------------------------------------- }
eopp=getEOP(reset,eop,syncsp);
4.19 手続き getPACKET引用
34 第 4章 論理譜
{ -------------------------------------------------------------------- }{ 手続き getPACKET引用 }{ -------------------------------------------------------------------- }
packet=getPACKET(reset,eope.0,pid.0:8,bit11d.0:10,crc5);
4.20 手続き usbstate引用
{ -------------------------------------------------------------------- }{ 手続き usbstate引用 }{ -------------------------------------------------------------------- }
st=usbstate(reset,respid,comtime,seope,spid.0:3,tmode,usbconnect);
4.21 手続き usbcstate引用
{ -------------------------------------------------------------------- }{ 手続き usbcstate引用 }{ -------------------------------------------------------------------- }
cst=usbcstate(reset,respid,comtime,seope,spid.0:3,crc16c,ssPACKET,pdsize,tmode,usbconnect);
4.22 手続き devreq引用
{ -------------------------------------------------------------------- }{ 手続き devreq引用 }{ -------------------------------------------------------------------- }
drd=devreq(reset,bytesp,count.0:3,q);
4.23 手続き devaddr引用
{ -------------------------------------------------------------------- }{ 手続き devaddr引用 }{ -------------------------------------------------------------------- }
daddr=devaddr(reset,devreqvalid,devreq0d,devreq1d,devreq2d);
4.24 手続き devint引用 35
4.24 手続き devint引用
{ -------------------------------------------------------------------- }{ 手続き devint引用 }{ -------------------------------------------------------------------- }
dif=devint(reset,devreqvalid,devreq0d,devreq1d,devreq2d);
4.25 手続き devcf引用
{ -------------------------------------------------------------------- }{ 手続き devcf引用 }{ -------------------------------------------------------------------- }
dcf=devcf(reset,devreqvalid,devreq0d,devreq1d,devreq2d);
4.26 手続き descriptor引用
{ -------------------------------------------------------------------- }{ 手続き descriptor引用 }{ -------------------------------------------------------------------- }
intdescriptor=descriptor(desctype,sdatano.0:5);
4.27 初期化
{ -------------------------------------------------------------------- }{ 初期化 }{ -------------------------------------------------------------------- }
clr=reset|eope.0;
4.28 速度選択
{ -------------------------------------------------------------------- }{ 速度選択 }{ -------------------------------------------------------------------- }
36 第 4章 論理譜
mode=1; { full speed }
4.29 手続き usbif引用
{ -------------------------------------------------------------------- }{ 手続き usbif引用 }{ -------------------------------------------------------------------- }
usbport=usbif(reset,dpin,dmin,mode,ensclk.0,sd,seop,sync,sbp);
4.30 USB入力シリアルデータ
{ -------------------------------------------------------------------- }{ USB入力シリアルデータ }{ -------------------------------------------------------------------- }
data=usbport.0;
4.31 受信 EOP
{ -------------------------------------------------------------------- }{ 受信 EOP }{ -------------------------------------------------------------------- }
eop=usbport.1;
4.32 USB差動出力+
{ -------------------------------------------------------------------- }{ USB差動出力 + }{ -------------------------------------------------------------------- }
dpout=usbport.2;
4.33 USB差動出力-
{ -------------------------------------------------------------------- }
4.34 ビットデータ取得点 37
{ USB差動出力- }{ -------------------------------------------------------------------- }
dmout=usbport.3;
4.34 ビットデータ取得点
{ -------------------------------------------------------------------- }{ ビットデータ取得点 }{ -------------------------------------------------------------------- }
syncsp=usbport.9;
4.35 ビットデータ起点
{ -------------------------------------------------------------------- }{ ビットデータ起点 }{ -------------------------------------------------------------------- }
cd=usbport.12;
4.36 ディスクリプタ
{ -------------------------------------------------------------------- }{ ディスクリプタ }{ -------------------------------------------------------------------- }
descdata=intdescriptor.0:7;
4.37 デバイスリクエスト取得
{ -------------------------------------------------------------------- }{ デバイスリクエスト取得 1 }{ デバイスリクエスト取得 2 }{ デバイスリクエスト取得 3 }{ デバイスリクエスト取得 4 }{ デバイスリクエスト取得 5 }{ デバイスリクエスト取得 6 }{ -------------------------------------------------------------------- }
if (reset)descindex=0;desctype=0;desc0wIndex=0;
38 第 4章 論理譜
desc1wIndex=0;desc0wLength=0;desc1wLength=0;
elseif (cst==0x12)
if (crc16c)descindex=devreq2d;desctype=devreq3d;desc0wIndex=devreq4d;desc1wIndex=devreq5d;desc0wLength=devreq6d;desc1wLength=devreq7d;
endifelse
descindex=descindex;desctype=desctype;desc0wIndex=desc0wIndex;desc1wIndex=desc1wIndex;desc0wLength=desc0wLength;desc1wLength=desc1wLength;
endifendif
4.38 デバイスリクエスト種類決定
{ -------------------------------------------------------------------- }{ デバイスリクエスト種類決定 }{ -------------------------------------------------------------------- }
if (reset)devreqcmd=0;
elseif (cst==0x12)
if ((devreq0d==0x80)&(devreq1d==0x08)) devreqcmd=1; endif { Get Configuration }if ((devreq0d==0x80)&(devreq1d==0x06)) devreqcmd=2; endif { Get Descriptor }if ((devreq0d==0x81)&(devreq1d==0x0a)) devreqcmd=3; endif { Get Interface }if ((devreq0d==0x00)&(devreq1d==0x01)) devreqcmd=4; endif { Clear Feature 0 }if ((devreq0d==0x01)&(devreq1d==0x01)) devreqcmd=5; endif { Clear Feature 1 }if ((devreq0d==0x02)&(devreq1d==0x01)) devreqcmd=6; endif { Clear Feature 2 }if ((devreq0d==0x80)&(devreq1d==0x00)) devreqcmd=7; endif { Get Status 0 }if ((devreq0d==0x81)&(devreq1d==0x00)) devreqcmd=8; endif { Get Status 1 }if ((devreq0d==0x82)&(devreq1d==0x00)) devreqcmd=9; endif { Get Status 2 }if ((devreq0d==0x00)&(devreq1d==0x09)) devreqcmd=10; endif { Set Configuration }if ((devreq0d==0x00)&(devreq1d==0x07)) devreqcmd=11; endif { Set Descriptor }if ((devreq0d==0x01)&(devreq1d==0x0b)) devreqcmd=12; endif { Set Interface }if ((devreq0d==0x00)&(devreq1d==0x03)) devreqcmd=13; endif { Set Feature 0 }if ((devreq0d==0x01)&(devreq1d==0x03)) devreqcmd=14; endif { Set Feature 1 }if ((devreq0d==0x02)&(devreq1d==0x03)) devreqcmd=15; endif { Set Feature 2 }if ((devreq0d==0x00)&(devreq1d==0x05)) devreqcmd=16; endif { Set Address }if ((devreq0d==0x02)&(devreq1d==0x0c)) devreqcmd=17; endif { Synch Frame }
elseswitch(cst)
case 0: devreqcmd=0; { デバイスリクエストを解除 }case 0x14:
switch(devreqcmd)case 17:
if (bytesp)switch(count)
case 2: devreqcmd=0; { Sync Frame を解除 }
4.39 ビットデータ取得点 39
default: devreqcmd=devreqcmd;endswitch
elsedevreqcmd=devreqcmd;
endifdefault: devreqcmd=devreqcmd;
endswitchdefault: devreqcmd=devreqcmd;
endswitchendif
endif
4.39 ビットデータ取得点
{ -------------------------------------------------------------------- }{ ビットデータ取得点 }{ -------------------------------------------------------------------- }
sp=q.8&!eop;
4.40 バイトデータ取得点
{ -------------------------------------------------------------------- }{ バイトデータ取得点 }{ -------------------------------------------------------------------- }
bytesp=q.9;
4.41 SYNC読み取り指標
{ -------------------------------------------------------------------- }{ SYNC読み取り指標 }{ -------------------------------------------------------------------- }
sync=q.11;
4.42 PID通過計数
{ -------------------------------------------------------------------- }{ PID通過計数 }{ -------------------------------------------------------------------- }
if (clr)
40 第 4章 論理譜
pidct=0;else
if (sp)if (pidct<8)
pidct=pidct+1;else
pidct=pidct;endif
elsepidct=pidct;
endifendif
4.43 PID読み取り指標
{ -------------------------------------------------------------------- }{ PID読み取り指標 }{ -------------------------------------------------------------------- }
if (pidct==8) pidpassa=1; endif
4.44 pidpassa否定
{ -------------------------------------------------------------------- }{ pidpassa否定 }{ -------------------------------------------------------------------- }
invpidpassa=!pidpassa;
4.45 Tokenパケット CRC結果
{ -------------------------------------------------------------------- }{ Tokenパケット CRC結果 }{ -------------------------------------------------------------------- }
if (bit11d.11:15==0) crc5=1; endif
4.46 PID通過指標
{ -------------------------------------------------------------------- }{ PID通過指標 }{ -------------------------------------------------------------------- }
4.47 パケットの CRC結果 41
pidpassb=pid.9;
4.47 パケットの CRC結果
{ -------------------------------------------------------------------- }{ パケットの CRC結果 }{ -------------------------------------------------------------------- }
if (reset)crc16c=0;
elseif (pidpassa)
if (bytesp)if (crc16d==0) crc16c=1; endif
elsecrc16c=crc16c;
endifelse
crc16c=crc16c;endif
endif
4.48 EOP終了起点
{ -------------------------------------------------------------------- }{ EOP終了起点 }{ -------------------------------------------------------------------- }
if (reset)eope=0;
elseif (eop)
eope=0;else
switch(eope)case 0: eope=1;case 1: eope=2;default: eope=eope;
endswitchendif
endif
4.49 PID
{ -------------------------------------------------------------------- }{ PID }{ -------------------------------------------------------------------- }
PID=packet.0:3;
42 第 4章 論理譜
4.50 Tokenパケット指定アドレス
{ -------------------------------------------------------------------- }{ Tokenパケット指定アドレス }{ -------------------------------------------------------------------- }
tokenaddr=packet.19:25;
4.51 Tokenパケット指定エンドポイント
{ -------------------------------------------------------------------- }{ Tokenパケット指定エンドポイント }{ -------------------------------------------------------------------- }
tokenendpoint=packet.26:29;
4.52 受信したパケットのデータ数
{ -------------------------------------------------------------------- }{ 受信したパケットのデータ数 }{ -------------------------------------------------------------------- }
if (reset)pdsize=0;
elseif ((pid.0:3==3)|(pid.0:3==11))
if (eopp.1)pdsize=count;
elsepdsize=pdsize;
endifelse
pdsize=pdsize;endif
endif
4.53 Tokenとデバイスのアドレスが一致
{ -------------------------------------------------------------------- }{ Tokenとデバイスのアドレスが一致 }{ -------------------------------------------------------------------- }
4.54 転送方式割り当て 43
if (tokenaddr.0:6==daddr.0:6) usbconnect=1; endif
4.54 転送方式割り当て
{ -------------------------------------------------------------------- }{ 転送方式割り当て }{ -------------------------------------------------------------------- }{ 0: コントロール転送 }{ 1: バルク転送 }{ 2: インタラプト転送 }{ 3: アイソクロナス転送 }{ -------------------------------------------------------------------- }
switch(tokenendpoint)case 0: tmode=0;case 1: tmode=2;case 2: tmode=3;
endswitch
4.55 無通信時間計数
{ -------------------------------------------------------------------- }{ 無通信時間計数 }{ -------------------------------------------------------------------- }
if (cd)comtime=0;
elseif (st==2) { コントロール転送以外 }
comtime=0; { データ送信 }else { コントロール転送 }
switch(cst)case 0x10: comtime=0; { 応答なし }case 0x13: comtime=0; { 待機 }case 0x18: comtime=0; { ハンドシェーク送信 }case 0x15: comtime=0; { データ送信 }case 0x1a: comtime=0; { データ再送 }case 0x1b: comtime=0;default:
if (comtime==0xff)comtime=comtime;
elseif (data)
comtime=comtime+1;endif
endifendswitch
endifendif
44 第 4章 論理譜
4.56 応答パケット位置計数
{ -------------------------------------------------------------------- }{ 応答パケット位置計数 }{ -------------------------------------------------------------------- }
if (reset)respidct=0;
elseif (pidpassa)
respidct=0;else
if (respidct==2)respidct=respidct;
elserespidct=respidct+1;
endifendif
endif
4.57 応答パケット PID
{ -------------------------------------------------------------------- }{ 応答パケット PID }{ -------------------------------------------------------------------- }
if (reset|(cst==0x1d))respid=0;
elseif (respidct.0)
respid=packet.0:3;else
if (seope)respid=0;
elserespid=respid;
endifendif
endif
4.58 デバイスリクエスト有効
{ -------------------------------------------------------------------- }{ デバイスリクエスト有効 }{ -------------------------------------------------------------------- }
if ((cst==0x12)&crc16c) devreqvalid=1; endif
4.59 PID通過後の CRCを除外したバイト起点 45
4.59 PID通過後の CRCを除外したバイト起点
{ -------------------------------------------------------------------- }{ PID通過後の CRCを除外したバイト起点 }{ -------------------------------------------------------------------- }
if (st==1)if (pidpassb)
if (!eop)if (bytesp)
wp=1;endif
endifendif
endif
4.60 PID通過後のバイト計数
{ -------------------------------------------------------------------- }{ PID通過後のバイト計数 }{ -------------------------------------------------------------------- }
if (clr)count=0;
elseif (pidpassb)
if (eop)count=count;
elseif (bytesp)
count=count+1;else
count=count;endif
endifelse
count=count;endif
endif
4.61 デバイスリクエスト SyncFrame
{ -------------------------------------------------------------------- }{ デバイスリクエスト SyncFrame }{ -------------------------------------------------------------------- }
if (reset)syncframe=0;
elseswitch(cst)
46 第 4章 論理譜
case 0x14:switch(devreqcmd)
case 17:if (bytesp)
switch(count)case 0:
syncframe.0:7=q.0:7;syncframe.8:15=syncframe.8:15;
case 1:syncframe.0:7=syncframe.0:7;syncframe.8:15=q.0:7;
default:syncframe=syncframe;
endswitchelse
syncframe=syncframe;endif
default:syncframe=syncframe;
endswitchdefault:
syncframe=syncframe;endswitch
endif
4.62 デバイスリクエスト
{ -------------------------------------------------------------------- }{ デバイスリクエスト 0バイト目 }{ デバイスリクエスト 1バイト目 }{ デバイスリクエスト 2バイト目 }{ デバイスリクエスト 3バイト目 }{ デバイスリクエスト 4バイト目 }{ デバイスリクエスト 5バイト目 }{ デバイスリクエスト 6バイト目 }{ デバイスリクエスト 7バイト目 }{ -------------------------------------------------------------------- }
devreq0d.0:7=drd.0:7;devreq1d.0:7=drd.8:15;devreq2d.0:7=drd.16:23;devreq3d.0:7=drd.24:31;devreq4d.0:7=drd.32:39;devreq5d.0:7=drd.40:47;devreq6d.0:7=drd.48:55;devreq7d.0:7=drd.56:63;
4.63 送信有効
{ -------------------------------------------------------------------- }{ 送信有効 }{ -------------------------------------------------------------------- }
if ((st==2)|(st==3)|(st==5)) { コントロール転送以外の送信か再送 }
4.64 デバイスリクエスト指定エンドポイント番号 47
sen=1;else
switch(cst)case 0x12: sen=1; { SETUPステージ ハンドシェーク送信 }case 0x15: sen=1; { Dataステージ データ送信 }case 0x18: sen=1; { Dataステージ ハンドシェーク送信 }case 0x19: sen=1; { Statusステージ ハンドシェーク送信 }case 0x1a: sen=1; { Statusステージ データ再送 }case 0x1b: sen=1; { Dataステージ データ再送 }
endswitchendif
4.64 デバイスリクエスト指定エンドポイント番号
{ -------------------------------------------------------------------- }{ デバイスリクエスト指定エンドポイント番号 }{ -------------------------------------------------------------------- }
devreqendno.0:7=desc0wIndex;devreqendno.8:15=desc1wIndex;
4.65 送信データ
{ -------------------------------------------------------------------- }{ 送信データ }{ -------------------------------------------------------------------- }
if ((cst==0x15)|(cst==0x1b)){ コントロール転送: データ送信/データ再送 }switch(devreqcmd)
case 1: sbdata=dcf; { Get Configuration }case 2: sbdata=descdata; { Get Descriptor }case 3: sbdata=dif; { Get Interface }case 7: { Get Status 0 }
switch(sdatano)case 0: sbdata=0x01; { 自己電源 }case 1: sbdata=0;
endswitchcase 8: { Get Status 1 }
switch(sdatano)case 0: sbdata=0;case 1: sbdata=0;
endswitchcase 9: { Get Status 2 }
switch(devreqendno)case 0: { エンドポイント 0 }
switch(sdatano)case 0: sbdata=0;case 1: sbdata=0;
endswitchcase 1: { エンドポイント 1 }
switch(sdatano)case 0: sbdata=0;case 1: sbdata=0;
48 第 4章 論理譜
endswitchcase 2: { エンドポイント 2 }
switch(sdatano)case 0: sbdata=0;case 1: sbdata=0;
endswitchdefault: { 無効エンドポイント }
switch(sdatano)case 0: sbdata=1;case 1: sbdata=0;
endswitchendswitch
endswitchelse
switch(tokenendpoint)case 1: sbdata=edatain; { 外部から入力 }case 2: sbdata=edatain; { 〃 }
endswitchendif
4.66 終了送信指標
{ -------------------------------------------------------------------- }{ 終了送信指標 }{ -------------------------------------------------------------------- }
if (cst==0x15)switch(devreqcmd)
case 4: ssPACKET=1; { Clear Feature 0 }case 5: ssPACKET=1; { Clear Feature 1 }case 6: ssPACKET=1; { Clear Feature 2 }case 10: ssPACKET=1; { Set Configuration }case 12: ssPACKET=1; { Set Interface }case 13: ssPACKET=1; { Set Feature 0 }case 14: ssPACKET=1; { Set Feature 1 }case 15: ssPACKET=1; { Set Feature 2 }case 16: ssPACKET=1; { Set Address }default:
if (seope)if (sdno<=sdeno) ssPACKET=1; endif
elsessPACKET=ssPACKET;
endifendswitch
elseif ((cst==0x13)|(cst==0x17))
ssPACKET=ssPACKET;endif
endif
4.67 コントロール転送の送信バイト数
{ -------------------------------------------------------------------- }
4.68 送信パケットの PID 49
{ コントロール転送の送信バイト数 }{ -------------------------------------------------------------------- }
switch(cst)case 0x12: { SETUPステージ応答 }
sdno=0; { ACK }case 0x15: { デバイスリクエストへの応答 }
switch(devreqcmd)case 1: sdno=1; { Get Configuration }case 2: { Get Descriptor }
switch(desctype)case 1: sdno=18; { デバイス }case 2: sdno=10; { <@1@> コンフィギュレーション 1 }
endswitchcase 3: sdno=1; { Get Interface }case 7: sdno=2; { Get Status 0 }case 8: sdno=2; { Get Status 1 }case 9: sdno=2; { Get Status 2 }
endswitchcase 0x18: { データパケットへの応答 }
sdno=0; { ハンドシェークパケット }case 0x19: { ステータスステージへの応答 }
sdno=0; { ハンドシェークパケット }case 0x1a: { データ再送 (終了送信) }
switch(devreqcmd)case 1: sdno=1; { Get Configuration }case 2: { Get Descriptor }
switch(desctype)case 1: sdno=18; { デバイス }case 2: sdno=32; { コンフィギュレーション 0 }
endswitchcase 3: sdno=1; { Get Interface }case 7: sdno=2; { Get Status 0 }case 8: sdno=2; { Get Status 1 }case 9: sdno=2; { Get Status 2 }
endswitchcase 0x1b: { データ再送 (Data送信) }
switch(devreqcmd)case 1: sdno=1; { Get Configuration }case 2: { Get Descriptor }
switch(desctype)case 1: sdno=18; { デバイス }case 2: sdno=32; { コンフィギュレーション 0 }
endswitchcase 3: sdno=1; { Get Interface }case 7: sdno=2; { Get Status 0 }case 8: sdno=2; { Get Status 1 }case 9: sdno=2; { Get Status 2 }
endswitchendswitch
4.68 送信パケットの PID
{ -------------------------------------------------------------------- }{ 送信パケットの PID }{ -------------------------------------------------------------------- }
if ((st==2)|(st==3)|(st==5)) { コントロール転送以外 }
50 第 4章 論理譜
if (tmode==3) { アイソクロナス転送 }spid=0xc3;
else { バルク転送かインタラプト転送 }if (st==3)
if (crc16c) { CRCエラーなし }spid=0xd2; { ACK }
else { CRCエラーあり }spid=0x5a; { NAK }
endifelse
switch(tokenendpoint)case 1:
if (tog1p)spid=0x4b; { Data1 }
elsespid=0xc3; { Data0 }
endifcase 2:
if (tog2p)spid=0x4b; { Data1 }
elsespid=0xc3; { Data0 }
endifendswitch
endifendif
elseswitch(cst)
case 0x12: { SETUPステージ応答 }spid=0xd2; { ACK }
case 0x15: { デバイスリクエストへの応答 }if (spc.0) { パケット計数の奇数偶数 }
spid=0x4b; { Data1 }else
spid=0xc3; { Data0 }endif
case 0x18: { Dataステージ ハンドシェーク送信 }if (crc16c)
spid=0xd2; { ACK }else
spid=0x5a; { NAK }endif
case 0x19: { ステータスステージへの応答 }spid=0xd2; { ACK }
case 0x1a: { データ再送 (終了送信) }spid=0x4b; { Data1 }
case 0x1b: { データ再送 (Data送信) }if (spc.0) { パケット計数の奇数偶数 }
spid=0x4b; { Data1 }else
spid=0xc3; { Data0 }endif
endswitchendif
4.69 送信パケットの容量
{ -------------------------------------------------------------------- }
4.70 コントロール転送の送信残りデータ数 51
{ 送信パケットの容量 }{ -------------------------------------------------------------------- }
if (tmode==0) { コントロール転送 }if (sdno==0) { 送信データなし }
spsize=0; { ステータスステージ }else
spsize=8;endif
else { コントロール転送以外 }switch(tokenendpoint)
case 1: spsize=8; { エンドポイント 1 }case 2: spsize=8; { エンドポイント 2 }
endswitchendif
4.70 コントロール転送の送信残りデータ数
{ -------------------------------------------------------------------- }{ コントロール転送の送信残りデータ数 }{ -------------------------------------------------------------------- }
srdno=sdno-sdeno;
4.71 送信パケットのデータ数
{ -------------------------------------------------------------------- }{ 送信パケットのデータ数 }{ -------------------------------------------------------------------- }
if (tmode==0) { コントロール転送 }if (ssPACKET)
spdno=0;else
if (srdno>=spsize)spdno=spsize;
else{
spdno=srdno; { データ数でパケットを可変 }}
spdno=spsize; { データ数によらずパケットを固定 }endif
endifelse { コントロール転送以外 }
spdno=spsize;endif
4.72 送信データ計数
52 第 4章 論理譜
{ -------------------------------------------------------------------- }{ 送信データ計数 }{ -------------------------------------------------------------------- }
sdatano=sdeno+sdcount-1;
4.73 送信ビットデータ
{ -------------------------------------------------------------------- }{ 送信ビットデータ }{ -------------------------------------------------------------------- }
sd=spacket.0;
4.74 送信 EOP
{ -------------------------------------------------------------------- }{ 送信 EOP }{ -------------------------------------------------------------------- }
seop=spacket.1;
4.75 送信 EOP終了
{ -------------------------------------------------------------------- }{ 送信 EOP終了 }{ -------------------------------------------------------------------- }
seope=spacket.2;
4.76 パケット送信データ計数
{ -------------------------------------------------------------------- }{ パケット送信データ計数 }{ -------------------------------------------------------------------- }
sdcount=spacket.3:13;
4.77 送信 EOP開始
4.78 送信 CRC 53
{ -------------------------------------------------------------------- }{ 送信 EOP開始 }{ -------------------------------------------------------------------- }
seops=spacket.18;
4.78 送信 CRC
{ -------------------------------------------------------------------- }{ 送信 CRC }{ -------------------------------------------------------------------- }
scrc16=spacket.20:35;
4.79 エンドポイント 1トグル
{ -------------------------------------------------------------------- }{ エンドポイント 1トグル }{ -------------------------------------------------------------------- }
if (reset)tog1p=0;
elseif (tokenendpoint==1)
switch(st)case 5: { データ再送 }
tog1p=tog1p;case 2: { データ送信 }
if (seops)tog1p=tog1p+1;
elsetog1p=tog1p;
endifdefault:
tog1p=tog1p;endswitch
elsetog1p=tog1p;
endifendif
4.80 エンドポイント 2トグル
{ -------------------------------------------------------------------- }{ エンドポイント 2トグル }{ -------------------------------------------------------------------- }
if (reset)
54 第 4章 論理譜
tog2p=0;else
if (tokenendpoint==2)switch(st)
case 5: { データ再送 }tog2p=tog2p;
case 2: { データ送信 }if (seops)
tog2p=tog2p+1;else
tog2p=tog2p;endif
default:tog2p=tog2p;
endswitchelse
tog2p=tog2p;endif
endif
4.81 コントロール転送のパケット送信の計数
{ -------------------------------------------------------------------- }{ コントロール転送のパケット送信の計数 }{ -------------------------------------------------------------------- }
if ((reset)|(cst==0x12))spc=0;
elseif (tmode==0) { コントロール転送 }
if ((cst==0x1a)|(cst==0x1b)) { データ再送 }spc=spc;
elseif (seops)
spc=spc+1;else
spc=spc;endif
endifendif
endif
4.82 コントロール転送の送信済みのデータ数
{ -------------------------------------------------------------------- }{ コントロール転送の送信済みのデータ数 }{ -------------------------------------------------------------------- }
if (sdno<spsize)if (spc==1) sdeno=sdno; endif
elseswitch(spsize)
case 1: sdeno.0:3=spc;case 2: sdeno.1:4=spc;
4.83 手続き確定信号を 1 55
case 4: sdeno.2:5=spc;case 8: sdeno.3:6=spc;case 16: sdeno.4:7=spc;
endswitchendif
4.83 手続き確定信号を 1
{ -------------------------------------------------------------------- }{ 手続き確定信号を 1 }{ -------------------------------------------------------------------- }q.25=1; { 手続き getbyte接続 }usbport.62=1; { 手続き usbif接続 }intdescriptor.14=1; { 手続き descriptor接続 }bit11d.38=1; { 手続き getSOForToken接続 }pid.17=1; { 手続き getPID接続 }crc16d.16=1; { 手続き crc16接続 }eopp.2=1; { 手続き getEOP接続 }packet.34=1; { 手続き getPACKET接続 }cst.5=1; { 手続き usbcstate接続 }st.3=1; { 手続き usbstate接続 }drd.64=1; { 手続き devreq接続 }daddr.8=1; { 手続き devaddr接続 }dif.8=1; { 手続き devint接続 }dcf.8=1; { 手続き devcf接続 }spacket.46=1; { 手続き sendPACKET }
endp
endlogic
59
第 5章
概要
図 5.1 チップ化例
csrewers0
intr
dpindmin
dpout
dmoutdir
rs1rs2rs3rs4rs5
CLKreset
D+D-
CSRDWERS0RS1RS2RS3RS4RS5
INTRCLK
RESET
D0D1D2D3D4D5D6D7
rw
datain0datain1datain2datain3datain4datain5datain6datain7
dataout0
dataout1
dataout2
dataout3
dataout4
dataout5
dataout6
dataout7
プロセッサの周辺機能として実装されることを前提としま
す。プロセッサは USB 通信に関してはデータ転送に集中し通
信の実行に当たってはホストコントローラがそのほとんどを自
動的に行うようにします。ホストコントローラはプロセッサに
対して次のことを行います。
• デバイスの接続を知らせる。• デバイスの切断を知らせる。• 送信が終了したことを知らせる。• 受信が終了したことを知らせる。
プロセッサは通信の設定を行いホストコントローラのメモリ
にデータを転送してから通信を起動して通信の終了を待つ繰り
返しになります。
5.1 構成
コントローラは手続きとして提供されます。転送データを格
納するメモリをコントローラ内に実装する場合は図 5.1 のよう
なチップになります。
5.2 データ転送
プロセッサがホストコントローラにデータ転送をさせるには予定表にデータ転送を割り当てる必要がありま
す。USB ではデータ転送の間隔や転送量を保証する必要がありますが予定表によってこれを実現します。予定
表の実際は図 5.2 です。フレームは USB の呼称ですがセグメントとチャネルは当コントローラ独自の名称と意
味付けです。USB ではフレームを単位にデータ転送を行います。ホストコントローラはこれを 8分割してその
ひとつをセグメントとします。セグメントは指定枠であり実体を割り当てないとデータ転送は行われません。セ
グメントに割り当てる実体とはチャネルのことです。チャネルはエンドポイントとその情報を持っています。こ
れはプロセッサの通信設定で設置されるものです。番号の若いセグメント位置のチャネルからデータ転送されま
す。ホストコントローラは割り当てられたチャネルのデータ量がフレームに納まることを検査していません、プ
ロセッサはこれを考慮してチャネルの割り当てを行います。
60 第 5章 概要
図 5.2 時間割り当て
SOF 0 1 2 3 4 5 6 7
A B Cチャネル
SOF
フレーム
セグメント
5.3 レジスタ
ホストコントローラのレジスタは図 5.3 のようになっています。
図 5.3 レジスタ
7 6 5 4 3 2 1 0REQR通信要求レジスタ(チャネル)
7 6 5 4 3 2 1 0DETAR接続検出レジスタ(端子)
7 6 5 4 3 2 1 0DETDR切断検出レジスタ(端子)
7 6 5 4 3 2 1 0
割り込みレジスタ
IR
切断検出
接続検出
割り込み許可
切断検出
接続検出
マスク
マスク
7 6 5 4 3 2 1 0RDYR
7 6 5 4 3 2 1 0CHSELチャネル選択レジスタ
フレーム起点
フレーム起点マスク
7 6 5 4 3 2 1 0TMSEL端子選択レジスタ
通信済みレジスタ(チャネル)
7 6 5 4 3 2 1 0DATAデータレジスタ
7 6 5 4 3 2 1 0POINTL下ポイントレジスタ
データ計数初期化
パケット計数初期化
7 6 5 4 3 2 1 0POINTH上ポイントレジスタ
通信終了
5.3.1 一般レジスタ
各レジスタは 8ビットで USB の端子を 8個、チャネルを 8個もてます。
通信要求レジスタ
チャネルを指定して通信の開始を要求します。ビットの位置でチャネルを指定します。最下位はチャネル 0で
最上位はチャネル 7です。
通信済みレジスタ
該当チャネルのビット位置にチャネルの通信が終了したことを示します。ビット位置は最下位はチャネル 0で
最上位はチャネル 7 です。
5.3 レジスタ 61
接続検出レジスタ
該当端子のビット位置にデバイスが接続されたことを示します。ビット位置は最下位は端子 0で最上位は端子
7です。
切断検出レジスタ
該当端子のビット位置のデバイスが切断されたことを示します。ビット位置は最下位は端子 0で最上位は端子
7です。
割り込みレジスタ
割り込みの許可とマスクなどの割り込み制御が上位 4 ビットにあります。割り込み元を下位 4ビットに示し
ます。
チャネル選択レジスタ
チャネルレジスタで操作対象にするチャネルの番号を指定します。
端子選択レジスタ
セグメントレジスタで操作対象にする端子の番号を指定します。
データレジスタ
指定したチャネルの送信データを書き込んだり受信データを読み取ったりします。
下ポイントレジスタ
各種ポインタの操作と下位のデータポインタの読み出しを行います。
上ポイントレジスタ
上位のデータポインタの読み出しを行います。
5.3.2 チャネルレジスタ
データ転送の対象は端子とその先にあるデバイスのエンドポイントです。エンドポイントの通信の仕様に基づ
いてデータ転送を行いますが、これらの情報をチャネルレジスタに登録します。
CHR0
データ転送の対象の端子とその先にあるエンドポイントの番号を指定します。
CHR1
インタラプト転送での転送間隔を指定します。この指定値はエンドポイントの通信仕様に基づきます。インタ
ラプト転送以外では本レジスタ値は使われません。
62 第 5章 概要
図 5.4 チャネルレジスタ
端子番号 エンドポイント
データ数
チャネル設定レジスタ
転送形式I / O
転送間隔
7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0
7 6 5 4 3 2 1 0
CHR0
CHR1
CHR2
外部からの操作は CHSEL の選択チャネルが対象になります。
7 6 5 4 3 2 1 0CHCNRコントロールレジスタ
パケット数 通信結果
Token 選択 0 : SETUP
1 : OUT
7 6 5 4 3 2 1 0CHR3
デバイスアドレス
CHR2
IOを 1にしたときホストからデバイスに向けてのデータ転送になります。IOを 0にしたときデバイスから
ホストへのデータ転送になります。転送形式の選択は表 5.1 のようになります。数値は表 5.2 の代表値を設定し
ます。
表 5.1 チャネル設定レジスタ 2
I/O 転送形式 意味
– 0 コントロール転送
入出力 1 インタラプト転送
〃 2 バルク転送
〃 3 アイソクロナス転送
I/Oは 0で入力 1で出力
表 5.2 数値
代表値 数値 代表値 数値 代表値 数値
0 0 4 8 8 128
1 1 5 16 9 256
2 2 6 32 10 512
3 4 7 64 11 1024
CHR3
Token パケットに使うデバイスのアドレスを設定します。
CHCNR
パケット数 はコントローラの動作には影響を与えません。コントローラは該当チャネルのトランザクション
が終るとこの数値を減数します。Token選択 はホストからデバイスのデータ転送する場合に Token を SETUP
5.3 レジスタ 63
か OUT のどちらかに選択します。SETUPはコントロール転送の場合にだけ使います。通信結果は該当チャネ
ルの最近のトランザクションの結果を表 5.3 のように示します。
表 5.3 通信結果
結果 値
ACK 1
NAK 2
STALL 3
タイムアウト 4
ステータスステージ 5
5.3.3 セグメントレジスタ
端子は 1ms の時間に分割されてそのひとつがフレームです。ホストコントローラはフレームを 8 分割して
チャネルを割り当てる対象にします。図 5.5 は端子ひとつ分のセグメントレジスタです。
図 5.5 セグメントレジスタ
7 6 5 4 3 2 1 0SEGR0セグメントレジスタ0
7 6 5 4 3 2 1 0SEGR1セグメントレジスタ1
7 6 5 4 3 2 1 0SEGR2セグメントレジスタ2
7 6 5 4 3 2 1 0SEGR3セグメントレジスタ3
7 6 5 4 3 2 1 0SEGR4セグメントレジスタ4
7 6 5 4 3 2 1 0SEGR5セグメントレジスタ5
7 6 5 4 3 2 1 0SEGR6セグメントレジスタ6
7 6 5 4 3 2 1 0SEGR7セグメントレジスタ7
外部からの操作は TMSEL の選択チャネルが対象になります。
5.3.4 レジスタ選択
レジスタを選択するビットは 6個あります。上位の 2ビットが表 5.4 のようにレジスタの大枠を分けます。
一般レジスタ
表 5.5 のように 10個のレジスタを選択します。
64 第 5章 概要
表 5.4 レジスタ種類選択
rs 種類
5 4
0 0 一般
0 1 チャネル
1 0 セグメント
1 1 –
表 5.5 一般レジスタ選択
rs レジスタ
3 2 1 0
0 0 0 0 REQR 通信要求レジスタ
0 0 0 1 RDYR 通信済みレジスタ
0 0 1 0 DETAR 接続検出レジスタ
0 0 1 1 DETDR 切断検出レジスタ
0 1 0 0 IR 割り込みレジスタ
0 1 0 1 CHSEL チャネル選択レジスタ
0 1 1 0 TMSEL 端子選択レジスタ
0 1 1 1 DATA データレジスタ
1 0 0 0 POINTL 下ポイントレジスタ
1 0 0 1 POINTU 上ポイントレジスタ
チャネルレジスタ
ひとつのチャネルは表 5.6 のように 4個のレジスタを持っています。操作できるのはチャネル選択レジスタで
選択されたチャネルのレジスタです。
表 5.6 チャネルレジスタ
rs レジスタ
3 2 1 0 x は選択チャネル
0 0 0 0 CHR0 チャネル設定レジスタ 0
0 0 0 1 CHR1 チャネル設定レジスタ 1
0 0 1 0 CHR2 チャネル設定レジスタ 2
0 0 1 1 CHCNR チャネルコントロールレジスタ
0 1 0 0 CHR3 チャネル設定レジスタ 3
5.3 レジスタ 65
セグメントレジスタ
ひとつの端子は表 5.7 のように 8個のレジスタを持っています。操作できるのは端子選択レジスタで選択され
た端子のレジスタです。
表 5.7 セグメントレジスタ
rs レジスタ
3 2 1 0
0 0 0 0 SEGR0 レジスタ 0
0 0 0 1 SEGR1 レジスタ 1
0 0 1 0 SEGR2 レジスタ 2
0 0 1 1 SEGR3 レジスタ 3
0 1 0 0 SEGR4 レジスタ 4
0 1 0 1 SEGR5 レジスタ 5
0 1 1 0 SEGR6 レジスタ 6
0 1 1 1 SEGR7 レジスタ 7
67
第 6章
使い方
6.1 初期化
ホストコントローラはデバイスの接続を待たなければどこにも通信できません。デバイスの接続は接続検出
レジスタ DETAR の変化を待ちます。接続検出レジスタの変化は割り込みで待つこともできます。割り込みレ
ジスタ IR に対して次の操作を行います。リセット後のホストコントローラの初期化は割り込みの設定くらい
です。
1. ビット 7を 1にして割り込みを有効にします。
2. ビット 5を 0にして接続検出の割り込みマスクを解除します。
3. 接続検出が原因で割り込みが要求されたときビット 1 が 1になります。
6.2 デバイスの接続
デバイスが接続されたときアドレス 0のエンドポイント番号 0にコントロール転送で通信が可能になってい
ます。ホストは新しくデバイスが接続されたときにはデバイスと通信して 0以外のアドレスを割り当て、構成を
設定しなくてはなりません。構成の設定は USBではコンフィギュレーションと言われています。デバイスは通
信仕様をいくつも持つことができるようになっていますが、それらを構成と言い、そのどれかを選択して構成を
設定します。これを「デバイスの構成を完了する」などと言います。アドレスを割り当てたり構成を設定したり
するにはデバイスに対してデバイスリクエストを発行します。
6.2.1 デバイスリクエスト
デバイスがデバイスリクエストを認識するのは Token パケットに SETUP が使われたときです。Token に
SETUPが使えるのはコントロール転送に限られています。デバイスの構成を設定するにはデバイスの持ってい
る構成をホストが調査する必要がありますがこれもデバイスリクエストを使ってデバイスから読み出します。デ
バイスが接続されたときにホストは次のことを行います。
1. デバイスリクエストを発行してデバイスの構成を読み取る。
2. 構成を調査して構成値を決定する。
3. デバイスリクエストを発行して構成を設定する。
4. デバイスリクエストを発行してアドレスを割り当てる。
68 第 6章 使い方
これらはホストコントローラで自動的に行われませんのでプロセッサがホストコントローラを操作して行い
ます。
6.3 コントロール転送
デバイスリクエストを発行するには Tokenに SETUPパケットを使うので コントロール転送で通信します。
デバイスリクエスト専用の通信方法と言えると思います。コントロール転送は 3種類のトランザクションから成
りますが、それぞれは性質が異なるためそれぞれにプロセッサが関与します。デバイスの接続後にはデバイスの
情報を読み取るためにデバイスリクエストの GetDescriptorを発行します。
6.3.1 セットアップステージ
通信は次の順番で行います。
1. ホストがデバイスに Tokenパケット (SETUP)を送る。
2. ホストがデバイスに Dataパケット (Data0)を送る。
3. デバイスがホストに Handshakeパケット (ACK)を返す。
Dataパケットの内容にデバイスリクエストが入ります。
準備
ホストコントローラの通信を実行する直前までの操作は次のようになります。
1. チャネル選択レジスタ CHSELに 0を書き込んでチャネルに Aを選択します。
2. デバイスリクエストの内容をチャネルのメモリに書き込みます。
表 6.1 デバイスリクエスト
0 1 2 3 4 5 6 7
80h 6 0 1 0 0 8 0
(a)下ポイントレジスタ POINTLのビット 0と 1に 1を書き込んでメモリ位置を 0にします 。
(b)データレジスタ DATAに表 6.2 のデータを書き込みます。*1
3. チャネル設定レジスタ 0 CHR0 に 0を書き込んで端子の選択を 0、エンドポイント番号 を 0にします。
4. チャネル設定レジスタ 2 CHR2 に 84hを書き込みます。
• ビット 7に 1を書き込んでホストからデバイスの転送を選択します。
• ビット 4~6に 0を書き込んでコントロール転送を選択します。
• ビット 0~3に 4を書き込んでデータ数に 8を設定します。
5. チャネルコントロールレジスタ CHCNRに 18hを書き込みます。
• ビット 4~7に 1を書き込んでパケット数を 1にします。
• ビット 3に 0を書き込んで Tokenに SETUPを選択します。
6. 端子選択レジスタ TMSELに 0を書き込んで端子の 0を選択します。
7. セグメントレジスタ 0 SEGR0に 0を書き込んでチャネル Aを設定します。
*1 メモリ位置は書き込み後に自動的に進みます。
6.3 コントロール転送 69
実行
通信要求レジスタのビット 0に 1を書き込んでチャネル Aのトランザクションをホストコントローラに要求
します。この後のセットアップステージのトランザクションの開始から終了までをコントローラが自動的に実行
します。チャネル Aのトランザクションの終了は通信済みレジスタ RDYRのビット 0を 1にして示されます。
割り込みが有効になっていれば割り込みで待つこともできます。*2
結果
セットアップステージのトランザクションの結果は正常に終了した場合は ACKです。デバイスはデータに問
題があった場合は本ステージでは応答してはならないことになっているのでホストコントローラは Handshake
パケットを待ってタイムアウトになります。トランザクションの終了時には通信要求レジスタ REQR のビット
0は 0になりチャネル Aの要求は解除されます。トランザクションが成功した場合は次のデータステージに移
ります。失敗した場合は通信要求レジスタ REQRのビット 0を 1にするとチャネル Aの通信を要求できます。
トランザクションの再送を試みるかどうかはプロセッサのプログラムの判断によります。
6.3.2 データステージ
通信は次の順番で行います。
1. ホストがデバイスに Tokenパケットを送ります。
2. Tokenが INのときデバイスが Dataパケットを送ります。Tokenが OUTのときホストが Dataパケッ
トを送ります。
3. Token が IN のときホストが Handshake パケットを送ります。Token が OUT のときデバイスが
Handshakeパケットを送ります。
データステージを使うのは表 6.2 のデバイスリクエストです。これ以外のデバイスリクエストでは Tokenに
INを送ってステータスステージに入ります。
表 6.2 デバイスリクエスト
リクエスト Token データ数 内容
GetDescriptor IN リクエストに指定 ディスクリプタ
GetConfiguration IN 1 構成値
GetInterface IN 1 代替値
GetStatus IN 2
SetDescriptor OUT リクエストに指定 ディスクリプタ
Syncframe OUT 2 フレーム番号
準備
セットアップステージで行った設定が残っていることを前提にした操作です。
• ホストからデバイスに送る場合
*2 トランザクション終了の割り込みはマスクできない割り込みです。
70 第 6章 使い方
1. 該当チャネルのメモリ位置を 0にして Dataパケットで送るデータを書き込みます。
2. 上の操作で移動したデータ位置を 0にします。
3. チャネル設定レジスタ 2 CHR2のデータ数に Dataパケットで送るデータ数を代表値で設定します。
4. コントロールレジスタ CHCNRの Token選択を 1にして OUT を選択します。
• デバイスからホストに送る場合1. 該当チャネルのメモリのデータ位置を 0にします。
2. チャネル設定レジスタ 2 CHR2の IOを 0にして Tokenに INを選択します。
• データステージを使わない場合ステータスステージに移ります。
実行
通信要求レジスタのビット 0に 1を書き込んでチャネル Aのトランザクションをホストコントローラに要求
します。トランザクションの実行はセットアップステージの場合と同じです。
結果
• ホストからデバイスに送った場合– データステージのトランザクションの結果は正常に終了した場合は ACKです。
– Dataパケットのデータに問題のあった場合は NAKです。
• デバイスからホストに送った場合– データステージのトランザクションの結果は正常に終了した場合は ACKです。
– Tokenの INパケットにデバイスが応答できない場合は STALLです。
データステージの継続と終了
• ホストからデバイスに送った場合デバイスに送るデータが残っている場合には該当チャネルのメモリの内容の更新とデータ位置を 0にして
実行を繰り返します。すべてのデータを送り終わったときはステータスステージに移ります。
• デバイスからホストに送った場合デバイスが送った Dataパケットのデータ数はポイントレジスタ POINTL,POINTHに示します。デー
タ数が 0 の Data パケットを受け取ったらステータステージです。ここでコントロール転送は完了しま
す。データ数が 0以上の Dataパケットを受け取ったら該当チャネルのメモリ位置を 0にしてデータを読
み出してからまたデータ位置を 0にして実行を繰り返します。
6.3.3 ステータスステージ
ステータスステージはデータステージのトランザクションの Dataパケットのデータ数が 0であることで認識
されます。ステータスステージを開始するのは Dataパケットの送り側になります。
準備
• ホストからデバイスに送る場合1. チャネル設定レジスタ 2 CHR2のデータ数に 0を書き込みます。
2. コントロールレジスタ CHCNRの Token選択を 1にして OUT を選択します。
6.4 デバイスの調査 71
• デバイスからホストに送る場合ホストコントローラがトランザクションの前にステータスステージを知ることはないのでデータステージ
の場合と同じです。
• データステージを使わなかった場合チャネル設定レジスタ 2 CHR2の IOを 0にして Tokenに INを選択します。
実行
通信要求レジスタのビット 0に 1を書き込んでチャネル Aのトランザクションをホストコントローラに要求
します。トランザクションの実行はセットアップステージの場合と同じです。
結果
• ステータスステージのトランザクションの結果は正常に終了した場合は ACKです。
• Tokenの INパケットにデバイスが応答できない場合は STALLです。
6.4 デバイスの調査
デバイスの情報はコントロール転送のデバイスリクエストを使って読み出します。
6.4.1 デバイスディスクリプタ
接続されたデバイスが何であるかを知るのはデバイスディスクリプタ によってです。デバイスの基本的な情
報が置いてあります。通信の設定に関係のあるものは次のものがあります。
• エンドポイント 0の最大パケットサイズの bMaxPacketSize0
エンドポイント 0は接続後にすぐ通信できるためエンドポイントディスクリプタがありません、ホストか
らエンドポイント 0に送る場合の Dataパケットの最大値はここで分かります。
• 可能な構成の数の nNumConfigurations
デバイスは構成を完了してから使いますがその構成の選択できる数が示されています。
デバイスリクエスト
デバイスディスクリプタを読み取るにはデバイスリクエストの GetDescriptorを使います。2番目にディスク
リプタの番号を 3番目にディスクリプタの形式を指定します。デバイスディスクリプタの大きさは 18バイトに
決まっているのでこれを 6番目と 7番目の 2バイトで指定します。2バイトで数値を指定する場合は下位バイト
を先に上位バイトを後にします。1番のコンフィギュレーションディスクリプタを読むデバイスリクエストは表
6.3 のようなデータ列になります。
表 6.3 デバイスリクエスト
0 1 2 3 4 5 6 7
80h 6 1 1 0 0 18 0
72 第 6章 使い方
6.4.2 コンフィギュレーションディスクリプタ
デバイスの構成を決める情報を得るためにコンフィギュレーションディスクリプタを読み出します。構
成とはエンドポイントの特性を決めるときの選択肢のことです。選択肢の数はデバイスディスクリプタの
bNumConfigurationsに示されます。
• エンドポイントの特性はエンドポイントディスクリプタにまとめられています。• エンドポイントディスクリプタはインターフェースディスクリプタにまとめられています。• インターフェースディスクリプタはコンフィギュレーションディスクリプタにまとめられています。
まとめられていると言ってもインターフェースディスクリプタはエンドポイントディスクリプタの見出しのよ
うなものです。コンフィギュレーションディスクリプタもインターフェースディスクリプタの見出しのようなも
のです。bNumInterfaceでコンフィギュレーションの持つインターフェースの数が示されます。構成を示す主
要なディスリプタは次の 3種類です。
• コンフィギュレーションディスクリプタ• インターフェースディスクリプタ• エンドポイントディスクリプタ
デバイスリクエスト GetDescriptor で読み出せるディスクリプタはコンフィギュレーションディスクリプタ
だけです。インターフェースディスクリプタとその配下のエンドポイントディスクリプタは図 6.1 のようにコン
フィギュレーションディスクリプタに続いています。コンフィギュレーションディスクリプタの「本構成の全
ディスクリプタのバイト数」の wTotalLength に構成の全長が示されています。
図 6.1 コンフィギュレーションディスクリプタの関連
コンフィギュレーションディスクリプタ
インターフェースディスクリプタ
エンドポインタディスクリプタ
エンドポインタディスクリプタ
インターフェースディスクリプタ
インターフェース0
インターフェース1
構成を示すディスクリプタは頁 16 の図 2.4 のような木構造になっています。エンドポイントディスクリプタ
は実体の内容を記述したものですがインタフェースディスクリプタやコンフィギュレーションディスクリプタは
エンドポイントの情報をたどるためにあります。
6.4 デバイスの調査 73
デバイスリクエスト
構成を読み取るには 2段階のデバイスリクエストの発行が必要です。
1. コンフィギュレーションディスクリプタを読み取る。
2. wTotalLengthで示されるバイト数で構成の全ディスクリプタを読み出す。
表 6.4 が 1番のコンフィギュレーションディスリプタを読み出すデータ列です。コンフィギュレーションディ
スリプタは 9バイトです。
表 6.4 1番目の GetDescriptor
0 1 2 3 4 5 6 7
80h 6 1 2 0 0 9 0
表 6.5 の 2番のコンフィギュレーションディスリプタを読み出すデータ列です。コンフィギュレーションディ
スリプタを含んで構成の全体を wTotalLengthのバイト数で読み出します。
表 6.5 2番目の GetDescriptor
0 1 2 3 4 5 6 7
80h 6 1 2 0 0 wTotalLength
表 6.5 のデバイスリクエストで構成の全体を示すコンフィギュレーションディスクリプタとインターフェース
ディスクリプタとエンドポイントディスクリプタが読み出されます。読み出した構成のデータ中のディスクリプ
タの位置は次のことで探索できます。
• 各ディスクリプタの構造は初めにディスクリプタのバイト数と形式が記述されているのでこれでディスクリプタの境目が分かる。
• エンドポイントディスクリプタには所属しているインタフェースの番号を登録する場所がないのでインターフェースディスクリプタに続いて配下のエンドポイントディスクリプタが位置していると推定さ
れる。
• コンフィギュレーションディスクリプタには配下のインターフェースの数が示されている。• インターフェースディスクリプタには配下のエンドポイントの数が示されている。
プロセッサは構成の情報から求めるエンドポイントのディスクリプタを読み出してホストコントローラのチャ
ネル設定レジスタの設定値の根拠とします。
6.4.3 インターフェースディスクリプタ
通信に必要な情報はエンドポイントディスクリプタにあります。この上位にあるディスクリプタはエンドポイ
ントディスクリプタをたどるためにあります。この頭にあるのがコンフィギュレーションディスクリプタです。
インターフェースディスクリプタは中間にあるのですがこれを介在させる理由は代替値にあります。インター
フェースの代替値を変えることで全体の構成を変えなくてもそのインタフェースの配下にあるエンドポイントを
デバイスが予め準備した別の設定で使うことができます。インターフェースディスクリプタは個別にデバイスリ
74 第 6章 使い方
クエストで読み出すことはできません。コンフィギュレーションディスクリプタの全体構成の一部として読み出
されます。
インターフェースの代替値
デバイスがエンドポイントをいくつかの使い方ができるように作っていてホストにそれを選択できるように公
開していればひとつのエンドポイントは複数の使い方に違いのあるエンドポイントディスクリプタを持っていま
す。同一の構成中にある違う値の代替値を持つ同じ番号のインターフェースディスクリプタは代替値を切り替え
ることでエンドポイントの使い方を変えることを実現するために同じエンドポイントに違う使い方を記述したエ
ンドポイントディスクリプタを持っています。
6.4.4 エンドポイントディスクリプタ
エンドポイントディスクリプタは構成の最も下位にあってエンドポイントの使い方の情報を記述してありま
す。ディスクリプタによって示されるエンドポイントの情報は次のものです。
• エンドポイントディスクリプタがどのエンドポインタについてのものかは bEndpointAddressのエンド
ポイント番号に示されます。
• エンドポイントの入出力方向は bEndpointAddressのビット 7に示されます。
• 通信方式は bmAttributesに示されます。
• パケットの最大データ数は wMaxPacketSizeに示されます。
• 通信間隔は bIntervalに示されます。
エンドポイントディスクリプタは個別にデバイスリクエストで読み出すことはできません。コンフィギュレー
ションディスクリプタの全体構成の一部として読み出されます。
6.5 ホストの役割
6.5.1 通信の割り当て
フレームをセグメントに分割してチャネルを割り付ける単位としています。フレームは 1msの時間に固定さ
れているので表 6.2 の時間を参考にして時間内に納まるようにチャネルを収容します。ひとつのセグメントでは
ひとつの通信単位を実行します。通信単位はトランザクションで Token→Data→Handshake の 3 パケットを
通信します。図 6.3 のようにセグメント 0にチャネル Dを割り当てると SOF の直後にトランザクションを実
行します。セグメント 4から 7はチャネルの割り当てがなく空なので通信は行われません。セグメントにチャネ
ルが割り当てられていても通信要求レジスタ REQRの該当のビットが 1になっていないと通信は実行されませ
ん。ホストコントローラは要求のあったチャネルのセグメントのトランザクションを自動的に実行しますが時間
の管理まで行っていないのでホストプロセッサは実行されるチャネルのトランザクションの全時間がフレーム内
の 1ms以内に納まるように予定します。
• アイソクロナス転送のチャネルは 1個のセグメントを割り当てます。
• インタラプト転送のチャネルは 1個のセグメントを割り当てます。
• バルク転送のチャネルは複数のセグメントに割り当てることができます。• コントロール転送は 1フレームに 1ステージなのでチャネルは 1個のセグメントを割り当てます。
6.5 ホストの役割 75
図 6.2 転送量と時間
パケット バイト数 時間 (us)
1.5Mbps 12Mbps
Token 4 21.44 2.66
Handshake 2 10.72 1.33
Data 4+8 64.32 7.97
4+16 – 13.28
4+32 – 23.90
4+64 – 45.15
4+1023 – 679.27
1バイト 5.36 0.664
図 6.3 セグメント
セグメント0
チャネルDSOF
セグメント1
チャネルB
セグメント2
チャネルC
セグメント3
チャネルA
セグメント4 セグメント5 セグメント6 セグメント7
SOF
6.5.2 通信手順
エンドポイントの特性に合わせて チャネルレジスタを設定しておきます。
送信
1. トランザクションの通信するデータをホストコントローラの該当チャネルのメモリに書き込みます。
(a)下ポイントレジスタ POINTLのビット 0と 1に 1を書き込んで位置を 0にします。
(b)データレジスタ DATAにデータを書き込みます。
(c)下ポイントレジスタ POINTLのビット 0と 1に 1を書き込んで位置を 0に戻します。
2. 通信要求レジスタ REQRの該当チャネルのビットを 1にします。
3. 通信済みレジスタ RDYRの該当チャネルが 1になるのを待ちます。
受信
1. 下ポイントレジスタ POINTLのビット 0と 1に 1を書き込んで位置を 0にします。
2. 通信要求レジスタ REQRの該当チャネルのビットを 1にします。
3. 通信済みレジスタ RDYRの該当チャネルが 1になるのを待ちます。
4. ホストコントローラの該当チャネルのメモリに受信データがあります。
受信データ数はポイントレジスタに示します。
76 第 6章 使い方
1. 下ポイントレジスタ POINTLのビット 0に 1を書き込んで位置を 0にします。
2. トランザクションが受信したデータをデータレジスタ DATAから読み出します。
6.5.3 通信結果への対応
ACK 肯定応答
次のデータをホストコントローラの該当チャネルのメモリに書き込んで通信要求レジスタ REQRの該当チャ
ネルのビットを 1 にします。次のデータがない場合またはホスト側が時間をあけたい場合は通信要求レジスタ
REQRの操作をしません。*3
NAK 否定応答
• 再送現在のデータはそのままで通信要求レジスタ REQRの該当チャネルのビットを 1にします。
• エラーNAKが連続する場合は再送を繰り返せますがホストプロセッサ判断で通信を停止することもできます。
この場合は通信要求レジスタREQRを操作しません。通信の再開はホストプロセッサの判断によります。
STALL停止中
再送を繰り返せますがホストプロセッサ判断で通信を停止することもできます。この場合は通信要求レジスタ
REQRを操作しません。通信の再開はホストプロセッサの判断によります。
タイムアウト
再送を繰り返せますがホストプロセッサ判断で通信を停止することもできます。この場合は通信要求レジスタ
REQRを操作しません。通信の再開はホストプロセッサの判断によります。
6.5.4 フレーム中のひとつのチャネルのトランザクション数
USBの仕様では最多の頻度でもひとつのエンドポイントは 1フレームに 1回のトランザクションを受けるの
を上限として前提にしているようです。バルク転送以外では仕様で 1フレームに 2回以上のトランザクション
は置けません。バルク転送でも設定上は可能ですが当方では USBでは 1フレームに 1回のトランザクションが
上限と理解しています。当方のホストコントローラとデバイスコントローラがバルク転送のチャネルにセグメン
トを 2個以上割り当てて 1フレームに 2回以上のトランザクションがあるのは何の問題もありません。
*3 該当チャネルのビットを 1にしないことです。
77
第 7章
論理譜
{ ==================================================================== }{ USBホストコントローラ }{ 通信基本論理 }{ ==================================================================== }logicname usbhostcont
library usb.lib
procedure usbhostcont
7.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input cs; { チップ選択 }input re; { 読み出し }input we; { 書き込み }input rs[6]; { レジスタ選択 }input dpin;input dmin;input datain[8];input chadatain[8]; { チャネル Aデータバス }input chbdatain[8]; { チャネル Bデータバス }input chcdatain[8]; { チャネル Cデータバス }input chddatain[8]; { チャネル Dデータバス }input chedatain[8]; { チャネル Eデータバス }input chfdatain[8]; { チャネル Fデータバス }input chgdatain[8]; { チャネル Gデータバス }input chhdatain[8]; { チャネル Hデータバス }
7.2 出力
{ -------------------------------------------------------------------- }
78 第 7章 論理譜
{ 出力 }{ -------------------------------------------------------------------- }output Q[221];
7.3 手続き接続
{ -------------------------------------------------------------------- }{ 手続き接続 }{ -------------------------------------------------------------------- }bitn usbport[68];bitn q[25];bitn crc16d[16];bitn pid[17];bitn eopp[2];bitn spacket[46];bitn stoken[24];
7.4 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitn dataout[8];bitn rw;bitn dpout;bitn dmout;bitn mode;bitn sd;bitn seop;bitn sync;bitn data;bitn eop;bitn syncsp;bitn cd;bitn clr;bitr eope[2];bitn sp;bitn bytesp;bitn sync;bitn invpidpassa;
bitr dev0const[3];bitr dev0contimer[5];bitr dev0initimer[5];bitr dev0remtimer[7];bitr b48to10count[3];bitr b48to10kcount[13];bitn pulse0p1us;bitn pulse0p1ms;bitr dev0confreq[2];bitr dev0remdet;bitn readreg;
7.4 内部信号 79
bitn writereg;bitr CHA0R[8];bitr CHA1R[8];bitr CHA2R[8];bitr CHA3R[8];bitr CHB0R[8];bitr CHB1R[8];bitr CHB2R[8];bitr CHB3R[8];bitr CHC0R[8];bitr CHC1R[8];bitr CHC2R[8];bitr CHC3R[8];bitr CHD0R[8];bitr CHD1R[8];bitr CHD2R[8];bitr CHD3R[8];bitr CHE0R[8];bitr CHE1R[8];bitr CHE2R[8];bitr CHE3R[8];bitr CHF0R[8];bitr CHF1R[8];bitr CHF2R[8];bitr CHF3R[8];bitr CHG0R[8];bitr CHG1R[8];bitr CHG2R[8];bitr CHG3R[8];bitr CHH0R[8];bitr CHH1R[8];bitr CHH2R[8];bitr CHH3R[8];bitr IR[8];bitr CHSEL[8];bitn IRb0w;bitn IRb1w;bitn IRb2w;bitn DETAR[8];bitn DETDR[8];bitn DETARb0w;bitn DETDRb0w;bitn intreq;bitr REQR[8];bitn spdnoa[11];bitn spdnob[11];bitn spdnoc[11];bitn spdnod[11];bitn spdnoe[11];bitn spdnof[11];bitn spdnog[11];bitn spdnoh[11];bitn s0pid[8];bitn sbdata[8];bitn tmode[2];bitn seope;bitn sdcount[11];bitn seops;bitn scrc16[16];bitn rp;bitn wp;bitr RDYR[8];bitn RDYRw[8];bitn REQRw[8];bitr datapointa[12];bitr datapointb[12];
80 第 7章 論理譜
bitr datapointc[12];bitr datapointd[12];bitr datapointe[12];bitr datapointf[12];bitr datapointg[12];bitr datapointh[12];bitr count0p1ms[4];bitn pulse1ms;bitr sen0count[4];bitn s0en;bitn s0pdno[11];bitn devaddress0t[7];bitn endpoint0t[4];bitr fn[11];bitn s0ten;bitn s0pen;bitr sendwait[8];bitn send10wait;bitr CHACNR[8];bitr CHBCNR[8];bitr CHCCNR[8];bitr CHDCNR[8];bitr CHECNR[8];bitr CHFCNR[8];bitr CHGCNR[8];bitr CHHCNR[8];bitr T0SEG0R[4];bitr T0SEG1R[4];bitr T0SEG2R[4];bitr T0SEG3R[4];bitr T0SEG4R[4];bitr T0SEG5R[4];bitr T0SEG6R[4];bitr T0SEG7R[4];bitn DATA[8];bitn POINT[8];bitn POINTU[8];bitr TMSEL[8];bitn address0s0t[7];bitn address1s0t[7];bitn address2s0t[7];bitn address3s0t[7];bitn address4s0t[7];bitn address5s0t[7];bitn address6s0t[7];bitn address7s0t[7];bitn endpoint0s0t[4];bitn endpoint1s0t[4];bitn endpoint2s0t[4];bitn endpoint3s0t[4];bitn endpoint4s0t[4];bitn endpoint5s0t[4];bitn endpoint6s0t[4];bitn endpoint7s0t[4];bitn t0s0pdno[11];bitn t0s1pdno[11];bitn t0s2pdno[11];bitn t0s3pdno[11];bitn t0s4pdno[11];bitn t0s5pdno[11];bitn t0s6pdno[11];bitn t0s7pdno[11];bitn t0s0en;bitn t0s1en;bitn t0s2en;bitn t0s3en;
7.4 内部信号 81
bitn t0s4en;bitn t0s5en;bitn t0s6en;bitn t0s7en;bitr t0comst[4];bitn t0s0pid[4];bitn t0s1pid[4];bitn t0s2pid[4];bitn t0s3pid[4];bitn t0s4pid[4];bitn t0s5pid[4];bitn t0s6pid[4];bitn t0s7pid[4];bitn t0chn[4];bitn t0comst4p;bitn t0comst5p;bitn t0comst9p;bitn t0chncomp[4];bitr comtime[8];bitr crc16c;bitr bitcount[4];bitn clr;bitn pidpassa;bitn chsela;bitn chselb;bitn chselc;bitn chseld;bitn chsele;bitn chself;bitn chselg;bitn chselh;bitn t0chndatacomp[4];bitn chapknext;bitn chbpknext;bitn chcpknext;bitn chdpknext;bitn chepknext;bitn chfpknext;bitn chgpknext;bitn chhpknext;bitn t0senden;bitn t0segreq;bitn t0segCH0R[8];bitn t0segCH1R[8];bitn t0segCH2R[8];bitn t0segCHCNR[8];bitn t0segCH3R[8];bitn chadataout[8];bitn chbdataout[8];bitn chcdataout[8];bitn chddataout[8];bitn chedataout[8];bitn chfdataout[8];bitn chgdataout[8];bitn chhdataout[8];bitn charw;bitn chbrw;bitn chcrw;bitn chdrw;bitn cherw;bitn chfrw;bitn chgrw;bitn chhrw;bitr chawseq[2];bitr chbwseq[2];bitr chcwseq[2];
82 第 7章 論理譜
bitr chdwseq[2];bitr chewseq[2];bitr chfwseq[2];bitr chgwseq[2];bitr chhwseq[2];bitr sclk[2];bitn sbp;bitn nextbit;bitn dseop;bitr t0ensclk[2];bitn t0s0sendtime;bitn t0piderr;bitn t0pidpass;bitr chapkcount[2];bitr chbpkcount[2];bitr chcpkcount[2];bitr chdpkcount[2];bitr chepkcount[2];bitr chfpkcount[2];bitr chgpkcount[2];bitr chhpkcount[2];bitn t0segpkcount[2];bitn chaaddress[4];bitn chbaddress[4];bitn chcaddress[4];bitn chdaddress[4];bitn cheaddress[4];bitn chfaddress[4];bitn chgaddress[4];bitn chhaddress[4];bitn chacs;bitn chbcs;bitn chccs;bitn chdcs;bitn checs;bitn chfcs;bitn chgcs;bitn chhcs;bitn chare;bitn chbre;bitn chcre;bitn chdre;bitn chere;bitn chfre;bitn chgre;bitn chhre;bitn chawe;bitn chbwe;bitn chcwe;bitn chdwe;bitn chewe;bitn chfwe;bitn chgwe;bitn chhwe;bitn delayeop[8];bitr stopbit[2];bitr difdata[2];
7.5 定数
7.6 出力代入 83
{ -------------------------------------------------------------------- }{ 定数 }{ -------------------------------------------------------------------- }bitn rsREQR[6]; rsREQR= 0b000000;bitn rsRDYR[6]; rsRDYR= 0b000001;bitn rsDETAR[6]; rsDETAR= 0b000010;bitn rsDETDR[6]; rsDETDR= 0b000011;bitn rsIR[6]; rsIR= 0b000100;bitn rsCHSEL[6]; rsCHSEL= 0b000101;bitn rsTMSEL[6]; rsTMSEL= 0b000110;bitn rsDATA[6]; rsDATA= 0b000111;bitn rsPOINT[6]; rsPOINT= 0b001000;bitn rsPOINTU[6]; rsPOINTU= 0b001001;
bitn rsCHxR0[6]; rsCHxR0= 0b010000;bitn rsCHxR1[6]; rsCHxR1= 0b010001;bitn rsCHxR2[6]; rsCHxR2= 0b010010;bitn rsCHxCNR[6]; rsCHxCNR=0b010011;bitn rsCHxR3[6]; rsCHxR3= 0b010100;
bitn rsTxSEG0R[6]; rsTxSEG0R=0b100000;bitn rsTxSEG1R[6]; rsTxSEG1R=0b100001;bitn rsTxSEG2R[6]; rsTxSEG2R=0b100010;bitn rsTxSEG3R[6]; rsTxSEG3R=0b100011;bitn rsTxSEG4R[6]; rsTxSEG4R=0b100100;bitn rsTxSEG5R[6]; rsTxSEG5R=0b100101;bitn rsTxSEG6R[6]; rsTxSEG6R=0b100110;bitn rsTxSEG7R[6]; rsTxSEG7R=0b100111;
7.6 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0=dpout;Q.1=dmout;Q.2=t0ensclk.0;Q.3:10=dataout;Q.11:18=chadataout;Q.19=rw;Q.20=intreq;Q.21:28=chadataout;Q.29:32=chaaddress;Q.33=chacs;Q.34=chare;Q.35=chawe;
Q.36:39=T0SEG0R;Q.40:43=t0comst;Q.44:54=s0pdno;Q.55:58=sen0count;Q.59:66=CHA2R;Q.67:77=spdnoa;Q.78:89=datapointa;Q.90:97=usbport.25:32;Q.98:105=CHACNR;Q.106:113=REQR;Q.114:121=DETAR;
84 第 7章 論理譜
Q.122:129=DETDR;Q.130:137=IR;Q.138:145=RDYR;Q.146:153=CHSEL;Q.154:161=TMSEL;Q.162:169=CHA0R;Q.170:177=CHA1R;Q.178:185=CHA3R;Q.186:189=T0SEG0R;Q.190:193=t0chn;Q.194=seop;Q.195:197=spacket.14:16;Q.198:200=spacket.38:40;Q.201:206=usbport.62:67;Q.207:208=sclk;Q.209=nextbit;Q.210=stopbit.0;Q.211=syncsp;Q.212=data;Q.213:220=comtime;
{ ==================================================================== }{ 時間信号 }{ ==================================================================== }
7.7 48MHzを約 10MHzに分周
{ -------------------------------------------------------------------- }{ 48MHzを約 10MHzに分周 }{ -------------------------------------------------------------------- }
if (reset)b48to10count=0;
elseif (b48to10count==4)
b48to10count=0;else
b48to10count=b48to10count+1;endif
endif
7.8 0.1us起点
{ -------------------------------------------------------------------- }{ 0.1us起点 }{ -------------------------------------------------------------------- }
if (b48to10count==4) pulse0p1us=1; endif
7.9 48MHzを 10KHzに分周
7.10 0.1ms起点 85
{ -------------------------------------------------------------------- }{ 48MHzを 10KHzに分周 }{ -------------------------------------------------------------------- }
if (reset)b48to10kcount=0;
elseif (pulse0p1ms)
b48to10kcount=0;else
b48to10kcount=b48to10kcount+1;endif
endif
7.10 0.1ms起点
{ -------------------------------------------------------------------- }{ 0.1ms起点 }{ -------------------------------------------------------------------- }
if (b48to10kcount==10) pulse0p1ms=1; endif { @sim@ 4800->20 }
7.11 0.1ms起点から 1msを作る
{ -------------------------------------------------------------------- }{ 0.1ms起点から 1msを作る }{ -------------------------------------------------------------------- }
if (reset)count0p1ms=0;
elseif (pulse0p1ms)
if (pulse1ms)count0p1ms=0;
elsecount0p1ms=count0p1ms+1;
endifelse
count0p1ms=count0p1ms;endif
endif
7.12 1ms起点
{ -------------------------------------------------------------------- }{ 1ms起点 }{ -------------------------------------------------------------------- }
86 第 7章 論理譜
if (count0p1ms==9)if (pulse0p1ms) pulse1ms=1; endif
endif
7.13 フレーム番号
{ -------------------------------------------------------------------- }{ フレーム番号 }{ -------------------------------------------------------------------- }
if (reset)fn=0;
elseif (pulse1ms)
fn=fn+1;else
fn=fn;endif
endif
7.14 送信 CLK期間
{ -------------------------------------------------------------------- }{ 送信 CLK期間 }{ -------------------------------------------------------------------- }
if (reset)t0ensclk=0;
elseswitch(t0ensclk)
case 0:if (t0senden) t0ensclk=0b01; endif
case 1:if (dseop) t0ensclk=0b11; else t0ensclk=t0ensclk; endif
case 3:if (dseop) t0ensclk=t0ensclk; endif
endswitchendif
7.15 送信 CLK
{ -------------------------------------------------------------------- }{ 送信 CLK }{ -------------------------------------------------------------------- }
if (t0ensclk.0)sclk=sclk+1;
elsesclk=0;
7.16 ビット送信停止指標 87
endif
7.16 ビット送信停止指標
{ -------------------------------------------------------------------- }{ ビット送信停止指標 }{ -------------------------------------------------------------------- }
switch(stopbit)case 0:
if (!nextbit) stopbit=1; endifcase 1:
if (sclk==3)stopbit=2;
elsestopbit=stopbit;
endifcase 2:
if (!nextbit) stopbit=stopbit; endifendswitch
7.17 ビット送信起点
{ -------------------------------------------------------------------- }{ ビット送信起点 }{ -------------------------------------------------------------------- }
if (!stopbit)if (sclk==3) sbp=1; endif
endif
7.18 スピード設定
{ -------------------------------------------------------------------- }{ スピード設定 }{ -------------------------------------------------------------------- }
mode=1; { full }
{ ==================================================================== }{ レジスタ操作 }{ ==================================================================== }
7.19 レジスタ読み出し
88 第 7章 論理譜
{ -------------------------------------------------------------------- }{ レジスタ読み出し }{ -------------------------------------------------------------------- }
if (cs)if (re)
readreg=1;endif
endif
7.20 レジスタ書き込み
{ -------------------------------------------------------------------- }{ レジスタ書き込み }{ -------------------------------------------------------------------- }
if (cs)if (we)
writereg=1;endif
endif
7.21 チャネル□レジスタ選択
{ -------------------------------------------------------------------- }{ チャネル Aレジスタ選択 }{ チャネル Bレジスタ選択 }{ チャネル Cレジスタ選択 }{ チャネル Dレジスタ選択 }{ チャネル Eレジスタ選択 }{ チャネル Fレジスタ選択 }{ チャネル Gレジスタ選択 }{ チャネル Hレジスタ選択 }{ -------------------------------------------------------------------- }
switch(CHSEL)case 0: chsela=1;case 1: chselb=1;case 2: chselc=1;case 3: chseld=1;case 4: chsele=1;case 5: chself=1;case 6: chselg=1;case 7: chselh=1;
endswitch
{ ==================================================================== }{ データバス }{ ==================================================================== }
7.22 データバス制御 89
7.22 データバス制御
{ -------------------------------------------------------------------- }{ データバス制御 }{ -------------------------------------------------------------------- }
rw=re;
7.23 データバス
{ -------------------------------------------------------------------- }{ データバス }{ -------------------------------------------------------------------- }{ 一般レジスタの読み出し }
if (cs)if (re)
switch(rs)case 0: dataout=REQR; { 通信要求レジスタ }case 1: dataout=RDYR; { 通信済みレジスタ }case 2: dataout=DETAR; { 接続検出レジスタ }case 3: dataout=DETDR; { 切断検出レジスタ }case 4: dataout=IR; { 割り込みレジスタ }case 5: dataout=CHSEL; { チャネル選択レジスタ }case 6: dataout=TMSEL; { 端子選択レジスタ }case 7: dataout=DATA; { データレジスタ }case 8: dataout=POINT; { ポイントレジスタ }case 9: dataout=POINTU; { 上ポイントレジスタ }
endswitchendif
endif
{ チャネルレジスタ Aの読み出し }if (cs)
if (re)if (CHSEL==0)
switch(rs)case 0x10: dataout=CHA0R; { チャネル A設定レジスタ 0 }case 0x11: dataout=CHA1R; { チャネル A設定レジスタ 1 }case 0x12: dataout=CHA2R; { チャネル A設定レジスタ 2 }case 0x13: dataout=CHACNR; { チャネル Aコントロールレジスタ }case 0x14: dataout=CHA3R; { チャネル A設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Bの読み出し }if (cs)
if (re)if (CHSEL==1)
switch(rs)case 0x10: dataout=CHB0R; { チャネル B設定レジスタ 0 }
90 第 7章 論理譜
case 0x11: dataout=CHB1R; { チャネル B設定レジスタ 1 }case 0x12: dataout=CHB2R; { チャネル B設定レジスタ 2 }case 0x13: dataout=CHBCNR; { チャネル Bコントロールレジスタ }case 0x14: dataout=CHB3R; { チャネル B設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Cの読み出し }if (cs)
if (re)if (CHSEL==2)
switch(rs)case 0x10: dataout=CHC0R; { チャネル C設定レジスタ 0 }case 0x11: dataout=CHC1R; { チャネル C設定レジスタ 1 }case 0x12: dataout=CHC2R; { チャネル C設定レジスタ 2 }case 0x13: dataout=CHCCNR; { チャネル Cコントロールレジスタ }case 0x14: dataout=CHC3R; { チャネル C設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Dの読み出し }if (cs)
if (re)if (CHSEL==3)
switch(rs)case 0x10: dataout=CHD0R; { チャネル D設定レジスタ 0 }case 0x11: dataout=CHD1R; { チャネル D設定レジスタ 1 }case 0x12: dataout=CHD2R; { チャネル D設定レジスタ 2 }case 0x13: dataout=CHDCNR; { チャネル Dコントロールレジスタ }case 0x14: dataout=CHD3R; { チャネル D設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Eの読み出し }if (cs)
if (re)if (CHSEL==4)
switch(rs)case 0x10: dataout=CHE0R; { チャネル E設定レジスタ 0 }case 0x11: dataout=CHE1R; { チャネル E設定レジスタ 1 }case 0x12: dataout=CHE2R; { チャネル E設定レジスタ 2 }case 0x13: dataout=CHECNR; { チャネル Eコントロールレジスタ }case 0x14: dataout=CHE3R; { チャネル E設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Fの読み出し }if (cs)
if (re)if (CHSEL==5)
switch(rs)case 0x10: dataout=CHF0R; { チャネル F設定レジスタ 0 }case 0x11: dataout=CHF1R; { チャネル F設定レジスタ 1 }case 0x12: dataout=CHF2R; { チャネル F設定レジスタ 2 }case 0x13: dataout=CHFCNR; { チャネル Fコントロールレジスタ }case 0x14: dataout=CHF3R; { チャネル F設定レジスタ 3 }
7.24 割り込み要求 91
endswitchendif
endifendif
{ チャネルレジスタ Gの読み出し }if (cs)
if (re)if (CHSEL==6)
switch(rs)case 0x10: dataout=CHG0R; { チャネル G設定レジスタ 0 }case 0x11: dataout=CHG1R; { チャネル G設定レジスタ 1 }case 0x12: dataout=CHG2R; { チャネル G設定レジスタ 2 }case 0x13: dataout=CHGCNR; { チャネル Gコントロールレジスタ }case 0x14: dataout=CHG3R; { チャネル G設定レジスタ 3 }
endswitchendif
endifendif
{ チャネルレジスタ Hの読み出し }if (cs)
if (re)if (CHSEL==7)
switch(rs)case 0x10: dataout=CHH0R; { チャネル H設定レジスタ 0 }case 0x11: dataout=CHH1R; { チャネル H設定レジスタ 1 }case 0x12: dataout=CHH2R; { チャネル H設定レジスタ 2 }case 0x13: dataout=CHHCNR; { チャネル Hコントロールレジスタ }case 0x14: dataout=CHH3R; { チャネル H設定レジスタ 3 }
endswitchendif
endifendif
{ 端子 0のセグメントレジスタ }if (cs)
if (re)if (TMSEL==0)
switch(rs)case 0x20: dataout.0:3=T0SEG0R; { セグメントレジスタ 0 }case 0x21: dataout.0:3=T0SEG1R; { セグメントレジスタ 1 }case 0x22: dataout.0:3=T0SEG2R; { セグメントレジスタ 2 }case 0x23: dataout.0:3=T0SEG3R; { セグメントレジスタ 3 }case 0x24: dataout.0:3=T0SEG4R; { セグメントレジスタ 4 }case 0x25: dataout.0:3=T0SEG5R; { セグメントレジスタ 5 }case 0x26: dataout.0:3=T0SEG6R; { セグメントレジスタ 6 }case 0x27: dataout.0:3=T0SEG7R; { セグメントレジスタ 7 }
endswitchendif
endifendif
{ ==================================================================== }{ 割り込み }{ ==================================================================== }
7.24 割り込み要求
92 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 割り込み要求 }{ -------------------------------------------------------------------- }
if (IR.7)if (IR.0&!IR.4) intreq=1; endif { 切断検出 }if (IR.1&!IR.5) intreq=1; endif { 接続検出 }if (IR.2&!IR.6) intreq=1; endif { フレーム起点 }if (RDYR!=0) intreq=1; endif { トランザクションを完了したチャネルあり }
endif
{ ==================================================================== }{ 一般レジスタ }{ ==================================================================== }
7.25 通信済みレジスタ RDYRのビット 0
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 0 }{ -------------------------------------------------------------------- }
if (reset)RDYR.0=0;
elseif (RDYRw.0)
RDYR.0=0;else
if (t0chncomp.3)if (t0chncomp.0:2==0)
RDYR.0=1;else
RDYR.0=RDYR.0;endif
elseRDYR.0=RDYR.0;
endifendif
endif
7.26 通信済みレジスタ RDYRのビット 1
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 1 }{ -------------------------------------------------------------------- }
if (reset)RDYR.1=0;
elseif (RDYRw.1)
RDYR.1=0;else
if (t0chncomp.3)if (t0chncomp.0:2==1)
RDYR.1=1;else
RDYR.1=RDYR.1;
7.27 通信済みレジスタ RDYRのビット 2 93
endifelse
RDYR.1=RDYR.1;endif
endifendif
7.27 通信済みレジスタ RDYRのビット 2
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 2 }{ -------------------------------------------------------------------- }
if (reset)RDYR.2=0;
elseif (RDYRw.2)
RDYR.2=0;else
if (t0chncomp.3)if (t0chncomp.0:2==2)
RDYR.2=1;else
RDYR.2=RDYR.2;endif
elseRDYR.2=RDYR.2;
endifendif
endif
7.28 通信済みレジスタ RDYRのビット 3
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 3 }{ -------------------------------------------------------------------- }
if (reset)RDYR.3=0;
elseif (RDYRw.3)
RDYR.3=0;else
if (t0chncomp.3)if (t0chncomp.0:2==3)
RDYR.3=1;else
RDYR.3=RDYR.3;endif
elseRDYR.3=RDYR.3;
endifendif
endif
94 第 7章 論理譜
7.29 通信済みレジスタ RDYRのビット 4
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 4 }{ -------------------------------------------------------------------- }
if (reset)RDYR.4=0;
elseif (RDYRw.4)
RDYR.4=0;else
if (t0chncomp.3)if (t0chncomp.0:2==4)
RDYR.4=1;else
RDYR.4=RDYR.4;endif
elseRDYR.4=RDYR.4;
endifendif
endif
7.30 通信済みレジスタ RDYRのビット 5
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 5 }{ -------------------------------------------------------------------- }
if (reset)RDYR.5=0;
elseif (RDYRw.5)
RDYR.5=0;else
if (t0chncomp.3)if (t0chncomp.0:2==5)
RDYR.5=1;else
RDYR.5=RDYR.5;endif
elseRDYR.5=RDYR.5;
endifendif
endif
7.31 通信済みレジスタ RDYRのビット 6
7.32 通信済みレジスタ RDYRのビット 7 95
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 6 }{ -------------------------------------------------------------------- }
if (reset)RDYR.6=0;
elseif (RDYRw.6)
RDYR.6=0;else
if (t0chncomp.3)if (t0chncomp.0:2==6)
RDYR.6=1;else
RDYR.6=RDYR.6;endif
elseRDYR.6=RDYR.6;
endifendif
endif
7.32 通信済みレジスタ RDYRのビット 7
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRのビット 7 }{ -------------------------------------------------------------------- }
if (reset)RDYR.7=0;
elseif (RDYRw.7)
RDYR.7=0;else
if (t0chncomp.3)if (t0chncomp.0:2==7)
RDYR.7=1;else
RDYR.7=RDYR.7;endif
elseRDYR.7=RDYR.7;
endifendif
endif
7.33 通信済みレジスタ RDYRの書き込み
{ -------------------------------------------------------------------- }{ 通信済みレジスタ RDYRの書き込み }{ -------------------------------------------------------------------- }
if (writereg)
96 第 7章 論理譜
if (rs==rsRDYR) RDYRw=datain; endifendif
7.34 通信要求レジスタ REQRのビット 0
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 0 }{ -------------------------------------------------------------------- }
if (reset)REQR.0=0;
elseif (RDYR.0)
REQR.0=0;else
if (REQRw.0)REQR.0=datain.0;
elseREQR.0=REQR.0;
endifendif
endif
7.35 通信要求レジスタ REQRのビット 1
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 1 }{ -------------------------------------------------------------------- }
if (reset)REQR.1=0;
elseif (RDYR.1)
REQR.1=0;else
if (REQRw.1)REQR.1=datain.1;
elseREQR.1=REQR.1;
endifendif
endif
7.36 通信要求レジスタ REQRのビット 2
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 2 }{ -------------------------------------------------------------------- }
7.37 通信要求レジスタ REQRのビット 3 97
if (reset)REQR.2=0;
elseif (RDYR.2)
REQR.2=0;else
if (REQRw.2)REQR.2=datain.2;
elseREQR.2=REQR.2;
endifendif
endif
7.37 通信要求レジスタ REQRのビット 3
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 3 }{ -------------------------------------------------------------------- }
if (reset)REQR.3=0;
elseif (RDYR.3)
REQR.3=0;else
if (REQRw.3)REQR.3=datain.3;
elseREQR.3=REQR.3;
endifendif
endif
7.38 通信要求レジスタ REQRのビット 4
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 4 }{ -------------------------------------------------------------------- }
if (reset)REQR.4=0;
elseif (RDYR.4)
REQR.4=0;else
if (REQRw.4)REQR.4=datain.4;
elseREQR.4=REQR.4;
endifendif
endif
98 第 7章 論理譜
7.39 通信要求レジスタ REQRのビット 5
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 5 }{ -------------------------------------------------------------------- }
if (reset)REQR.5=0;
elseif (RDYR.5)
REQR.5=0;else
if (REQRw.5)REQR.5=datain.5;
elseREQR.5=REQR.5;
endifendif
endif
7.40 通信要求レジスタ REQRのビット 6
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 6 }{ -------------------------------------------------------------------- }
if (reset)REQR.6=0;
elseif (RDYR.6)
REQR.6=0;else
if (REQRw.6)REQR.6=datain.6;
elseREQR.6=REQR.6;
endifendif
endif
7.41 通信要求レジスタ REQRのビット 7
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRのビット 7 }{ -------------------------------------------------------------------- }
if (reset)REQR.7=0;
elseif (RDYR.7)
7.42 通信要求レジスタ REQRの書き込み 99
REQR.7=0;else
if (REQRw.7)REQR.7=datain.7;
elseREQR.7=REQR.7;
endifendif
endif
7.42 通信要求レジスタ REQRの書き込み
{ -------------------------------------------------------------------- }{ 通信要求レジスタ REQRの書き込み }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsREQR) REQRw=datain; endif
endif
7.43 割り込みレジスタ IRのビット 0
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 0 }{ -------------------------------------------------------------------- }
IR.0=DETDR.0;
7.44 割り込みレジスタ IRのビット 1
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 1 }{ -------------------------------------------------------------------- }
IR.1=DETAR.0;
7.45 割り込みレジスタ IRのビット 2
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 2 }{ -------------------------------------------------------------------- }
if (reset)
100 第 7章 論理譜
IR.2=0;else
if (pulse1ms)IR.2=1;
elseif (IRb2w)
IR.2=0;else
IR.2=IR.2;endif
endifendif
7.46 割り込みレジスタ IRのビット 3
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 3 }{ -------------------------------------------------------------------- }
IR.3=RDYR!=0;
7.47 割り込みレジスタ IRのビット 4から 7
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 4から 7 }{ -------------------------------------------------------------------- }
if (reset)IR.4:7=0b0011;
elseif (writereg)
if (rs==rsIR)IR.4:7=datain.4:7;
elseIR.4:7=IR.4:7;
endifelse
IR.4:7=IR.4:7;endif
endif
7.48 割り込みレジスタ IRのビット 0の書き込み 1
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 0の書き込み 1 }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsIR)
7.49 割り込みレジスタ IRのビット 1の書き込み 1 101
if (datain.0) IRb0w=1; endifendif
endif
7.49 割り込みレジスタ IRのビット 1の書き込み 1
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 1の書き込み 1 }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsIR)
if (datain.1) IRb1w=1; endifendif
endif
7.50 割り込みレジスタ IRのビット 2の書き込み 1
{ -------------------------------------------------------------------- }{ 割り込みレジスタ IRのビット 2の書き込み 1 }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsIR)
if (datain.2) IRb2w=1; endifendif
endif
7.51 チャネル選択レジスタ CHSEL
{ -------------------------------------------------------------------- }{ チャネル選択レジスタ CHSEL }{ -------------------------------------------------------------------- }
if (reset)CHSEL=0;
elseif (writereg)
if (rs==rsCHSEL)CHSEL=datain;
elseCHSEL=CHSEL;
endifelse
CHSEL=CHSEL;endif
endif
102 第 7章 論理譜
7.52 接続検出レジスタ DETARのビット 0
{ -------------------------------------------------------------------- }{ 接続検出レジスタ DETARのビット 0 }{ -------------------------------------------------------------------- }
DETAR.0=dev0confreq.0;
7.53 接続検出レジスタ DETARのビット 0の書き込み
{ -------------------------------------------------------------------- }{ 接続検出レジスタ DETARのビット 0の書き込み }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsDETAR)
if (datain.0) DETARb0w=1; endifendif
endif
7.54 切断検出レジスタ DETDRのビット 0
{ -------------------------------------------------------------------- }{ 切断検出レジスタ DETDRのビット 0 }{ -------------------------------------------------------------------- }
DETDR.0=dev0remdet;
7.55 切断検出レジスタ DETDRのビット 0の書き込み
{ -------------------------------------------------------------------- }{ 切断検出レジスタ DETDRのビット 0の書き込み }{ -------------------------------------------------------------------- }
if (writereg)if (rs==rsDETDR)
if (datain.0) DETDRb0w=1; endifendif
endif
7.56 下ポイントレジスタ
7.57 上ポイントレジスタ 103
{ -------------------------------------------------------------------- }{ 下ポイントレジスタ }{ -------------------------------------------------------------------- }
switch(CHSEL)case 0: POINT=datapointa.0:7;case 1: POINT=datapointb.0:7;case 2: POINT=datapointc.0:7;case 3: POINT=datapointd.0:7;case 4: POINT=datapointe.0:7;case 5: POINT=datapointf.0:7;case 6: POINT=datapointg.0:7;case 7: POINT=datapointh.0:7;
endswitch
7.57 上ポイントレジスタ
{ -------------------------------------------------------------------- }{ 上ポイントレジスタ }{ -------------------------------------------------------------------- }
switch(CHSEL)case 0: POINTU.0:3=datapointa.8:11;case 1: POINTU.0:3=datapointb.8:11;case 2: POINTU.0:3=datapointc.8:11;case 3: POINTU.0:3=datapointd.8:11;case 4: POINTU.0:3=datapointe.8:11;case 5: POINTU.0:3=datapointf.8:11;case 6: POINTU.0:3=datapointg.8:11;case 7: POINTU.0:3=datapointh.8:11;
endswitch
{ ==================================================================== }{ チャネルレジスタ }{ ==================================================================== }
7.58 チャネル A設定レジスタ CHAR0
{ -------------------------------------------------------------------- }{ チャネル A設定レジスタ CHAR0 }{ -------------------------------------------------------------------- }
if (reset)CHA0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chsela)
CHA0R=datain;else
CHA0R=CHA0R;
104 第 7章 論理譜
endifelse
CHA0R=CHA0R;endif
elseCHA0R=CHA0R;
endifendif
7.59 チャネル B設定レジスタ CHBR0
{ -------------------------------------------------------------------- }{ チャネル B設定レジスタ CHBR0 }{ -------------------------------------------------------------------- }
if (reset)CHB0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chselb)
CHB0R=datain;else
CHB0R=CHB0R;endif
elseCHB0R=CHB0R;
endifelse
CHB0R=CHB0R;endif
endif
7.60 チャネル C設定レジスタ CHCR0
{ -------------------------------------------------------------------- }{ チャネル C設定レジスタ CHCR0 }{ -------------------------------------------------------------------- }
if (reset)CHC0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chselc)
CHC0R=datain;else
CHC0R=CHC0R;endif
elseCHC0R=CHC0R;
endifelse
CHC0R=CHC0R;endif
7.61 チャネル D設定レジスタ CHDR0 105
endif
7.61 チャネル D設定レジスタ CHDR0
{ -------------------------------------------------------------------- }{ チャネル D設定レジスタ CHDR0 }{ -------------------------------------------------------------------- }
if (reset)CHD0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chseld)
CHD0R=datain;else
CHD0R=CHD0R;endif
elseCHD0R=CHD0R;
endifelse
CHD0R=CHD0R;endif
endif
7.62 チャネル E設定レジスタ CHER0
{ -------------------------------------------------------------------- }{ チャネル E設定レジスタ CHER0 }{ -------------------------------------------------------------------- }
if (reset)CHE0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chsele)
CHE0R=datain;else
CHE0R=CHE0R;endif
elseCHE0R=CHE0R;
endifelse
CHE0R=CHE0R;endif
endif
7.63 チャネル F設定レジスタ CHFR0
106 第 7章 論理譜
{ -------------------------------------------------------------------- }{ チャネル F設定レジスタ CHFR0 }{ -------------------------------------------------------------------- }
if (reset)CHF0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chself)
CHF0R=datain;else
CHF0R=CHF0R;endif
elseCHF0R=CHF0R;
endifelse
CHF0R=CHF0R;endif
endif
7.64 チャネル G設定レジスタ CHGR0
{ -------------------------------------------------------------------- }{ チャネル G設定レジスタ CHGR0 }{ -------------------------------------------------------------------- }
if (reset)CHG0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chselg)
CHG0R=datain;else
CHG0R=CHG0R;endif
elseCHG0R=CHG0R;
endifelse
CHG0R=CHG0R;endif
endif
7.65 チャネル H設定レジスタ CHHR0
{ -------------------------------------------------------------------- }{ チャネル H設定レジスタ CHHR0 }{ -------------------------------------------------------------------- }
7.66 チャネル A設定レジスタ CHAR1 107
if (reset)CHH0R=0;
elseif (writereg)
if (rs==rsCHxR0)if (chselh)
CHH0R=datain;else
CHH0R=CHH0R;endif
elseCHH0R=CHH0R;
endifelse
CHH0R=CHH0R;endif
endif
7.66 チャネル A設定レジスタ CHAR1
{ -------------------------------------------------------------------- }{ チャネル A設定レジスタ CHAR1 }{ -------------------------------------------------------------------- }
if (reset)CHA1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chsela)
CHA1R=datain;else
CHA1R=CHA1R;endif
elseCHA1R=CHA1R;
endifelse
CHA1R=CHA1R;endif
endif
7.67 チャネル B設定レジスタ CHBR1
{ -------------------------------------------------------------------- }{ チャネル B設定レジスタ CHBR1 }{ -------------------------------------------------------------------- }
if (reset)CHB1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chselb)
CHB1R=datain;
108 第 7章 論理譜
elseCHB1R=CHB1R;
endifelse
CHB1R=CHB1R;endif
elseCHB1R=CHB1R;
endifendif
7.68 チャネル C設定レジスタ CHCR1
{ -------------------------------------------------------------------- }{ チャネル C設定レジスタ CHCR1 }{ -------------------------------------------------------------------- }
if (reset)CHC1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chselc)
CHC1R=datain;else
CHC1R=CHC1R;endif
elseCHC1R=CHC1R;
endifelse
CHC1R=CHC1R;endif
endif
7.69 チャネル D設定レジスタ CHDR1
{ -------------------------------------------------------------------- }{ チャネル D設定レジスタ CHDR1 }{ -------------------------------------------------------------------- }
if (reset)CHD1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chseld)
CHD1R=datain;else
CHD1R=CHD1R;endif
elseCHD1R=CHD1R;
endifelse
7.70 チャネル E設定レジスタ CHER1 109
CHD1R=CHD1R;endif
endif
7.70 チャネル E設定レジスタ CHER1
{ -------------------------------------------------------------------- }{ チャネル E設定レジスタ CHER1 }{ -------------------------------------------------------------------- }
if (reset)CHE1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chsele)
CHE1R=datain;else
CHE1R=CHE1R;endif
elseCHE1R=CHE1R;
endifelse
CHE1R=CHE1R;endif
endif
7.71 チャネル F設定レジスタ CHFR1
{ -------------------------------------------------------------------- }{ チャネル F設定レジスタ CHFR1 }{ -------------------------------------------------------------------- }
if (reset)CHF1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chself)
CHF1R=datain;else
CHF1R=CHF1R;endif
elseCHF1R=CHF1R;
endifelse
CHF1R=CHF1R;endif
endif
110 第 7章 論理譜
7.72 チャネル G設定レジスタ CHGR1
{ -------------------------------------------------------------------- }{ チャネル G設定レジスタ CHGR1 }{ -------------------------------------------------------------------- }
if (reset)CHG1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chselg)
CHG1R=datain;else
CHG1R=CHG1R;endif
elseCHG1R=CHG1R;
endifelse
CHG1R=CHG1R;endif
endif
7.73 チャネル H設定レジスタ CHHR1
{ -------------------------------------------------------------------- }{ チャネル H設定レジスタ CHHR1 }{ -------------------------------------------------------------------- }
if (reset)CHH1R=0;
elseif (writereg)
if (rs==rsCHxR1)if (chselh)
CHH1R=datain;else
CHH1R=CHH1R;endif
elseCHH1R=CHH1R;
endifelse
CHH1R=CHH1R;endif
endif
7.74 チャネル A設定レジスタ CHAR2
7.75 チャネル B設定レジスタ CHBR2 111
{ -------------------------------------------------------------------- }{ チャネル A設定レジスタ CHAR2 }{ -------------------------------------------------------------------- }
if (reset)CHA2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chsela)
CHA2R=datain;else
CHA2R=CHA2R;endif
elseCHA2R=CHA2R;
endifelse
CHA2R=CHA2R;endif
endif
7.75 チャネル B設定レジスタ CHBR2
{ -------------------------------------------------------------------- }{ チャネル B設定レジスタ CHBR2 }{ -------------------------------------------------------------------- }
if (reset)CHB2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chselb)
CHB2R=datain;else
CHB2R=CHB2R;endif
elseCHB2R=CHB2R;
endifelse
CHB2R=CHB2R;endif
endif
7.76 チャネル C設定レジスタ CHCR2
{ -------------------------------------------------------------------- }{ チャネル C設定レジスタ CHCR2 }{ -------------------------------------------------------------------- }
if (reset)CHC2R=0;
112 第 7章 論理譜
elseif (writereg)
if (rs==rsCHxR2)if (chselc)
CHC2R=datain;else
CHC2R=CHC2R;endif
elseCHC2R=CHC2R;
endifelse
CHC2R=CHC2R;endif
endif
7.77 チャネル D設定レジスタ CHDR2
{ -------------------------------------------------------------------- }{ チャネル D設定レジスタ CHDR2 }{ -------------------------------------------------------------------- }
if (reset)CHD2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chseld)
CHD2R=datain;else
CHD2R=CHD2R;endif
elseCHD2R=CHD2R;
endifelse
CHD2R=CHD2R;endif
endif
7.78 チャネル E設定レジスタ CHER2
{ -------------------------------------------------------------------- }{ チャネル E設定レジスタ CHER2 }{ -------------------------------------------------------------------- }
if (reset)CHE2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chsele)
CHE2R=datain;else
CHE2R=CHE2R;
7.79 チャネル F設定レジスタ CHFR2 113
endifelse
CHE2R=CHE2R;endif
elseCHE2R=CHE2R;
endifendif
7.79 チャネル F設定レジスタ CHFR2
{ -------------------------------------------------------------------- }{ チャネル F設定レジスタ CHFR2 }{ -------------------------------------------------------------------- }
if (reset)CHF2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chself)
CHF2R=datain;else
CHF2R=CHF2R;endif
elseCHF2R=CHF2R;
endifelse
CHF2R=CHF2R;endif
endif
7.80 チャネル G設定レジスタ CHGR2
{ -------------------------------------------------------------------- }{ チャネル G設定レジスタ CHGR2 }{ -------------------------------------------------------------------- }
if (reset)CHG2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chselg)
CHG2R=datain;else
CHG2R=CHG2R;endif
elseCHG2R=CHG2R;
endifelse
CHG2R=CHG2R;endif
114 第 7章 論理譜
endif
7.81 チャネル H設定レジスタ CHHR2
{ -------------------------------------------------------------------- }{ チャネル H設定レジスタ CHHR2 }{ -------------------------------------------------------------------- }
if (reset)CHH2R=0;
elseif (writereg)
if (rs==rsCHxR2)if (chselh)
CHH2R=datain;else
CHH2R=CHH2R;endif
elseCHH2R=CHH2R;
endifelse
CHH2R=CHH2R;endif
endif
7.82 チャネル Aコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Aコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHACNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chsela)
CHACNR=datain;else
CHACNR=CHACNR;endif
elseCHACNR=CHACNR;
endifelse
CHACNR.3=CHACNR.3;
if (chapknext)if (CHACNR.4:7==0)
CHACNR.4:7=CHACNR.4:7;else
CHACNR.4:7=CHACNR.4:7-1;endif
else
7.83 チャネル Bコントロールレジスタ 115
CHACNR.4:7=CHACNR.4:7;endif
if (chapknext)switch(pid.0:3)
case 2: CHACNR.0:2=1; { ACK }case 10: CHACNR.0:2=2; { NAK }case 14: CHACNR.0:2=3; { STALL }default: CHACNR.0:2=CHACNR.0:2;
endswitchelse
if (t0comst9p)CHACNR.0:2=4; { タイムアウト }
elseif (eopp.0)
if (datapointa==0)CHACNR.0:2=5; { ステータスステージ }
elseCHACNR.0:2=CHACNR.0:2;
endifelse
CHACNR.0:2=CHACNR.0:2;endif
endifendif
endifendif
7.83 チャネル Bコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Bコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHBCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chselb)
CHBCNR=datain;else
CHBCNR=CHBCNR;endif
elseCHBCNR=CHBCNR;
endifelse
CHBCNR.3=CHBCNR.3;
if (chbpknext)if (CHBCNR.4:7==0)
CHBCNR.4:7=CHBCNR.4:7;else
CHBCNR.4:7=CHBCNR.4:7-1;endif
elseCHBCNR.4:7=CHBCNR.4:7;
endif
116 第 7章 論理譜
if (chbpknext)switch(pid.0:3)
case 2: CHBCNR.0:2=1; { ACK }case 10: CHBCNR.0:2=2; { NAK }case 14: CHBCNR.0:2=3; { STALL }default: CHBCNR.0:2=CHBCNR.0:2;
endswitchelse
if (t0comst9p)CHBCNR.0:2=4;
elseif (eopp.0)
if (datapointb==1)CHBCNR.0:2=5;
elseCHBCNR.0:2=CHBCNR.0:2;
endifelse
CHBCNR.0:2=CHBCNR.0:2;endif
endifendif
endifendif
7.84 チャネル Cコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Cコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHCCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chselc)
CHCCNR=datain;else
CHCCNR=CHCCNR;endif
elseCHCCNR=CHCCNR;
endifelse
CHCCNR.3=CHCCNR.3;
if (chcpknext)if (CHCCNR.4:7==0)
CHCCNR.4:7=CHCCNR.4:7;else
CHCCNR.4:7=CHCCNR.4:7-1;endif
elseCHCCNR.4:7=CHCCNR.4:7;
endif
if (chcpknext)switch(pid.0:3)
case 2: CHCCNR.0:2=1; { ACK }
7.85 チャネル Dコントロールレジスタ 117
case 10: CHCCNR.0:2=2; { NAK }case 14: CHCCNR.0:2=3; { STALL }default: CHCCNR.0:2=CHCCNR.0:2;
endswitchelse
if (t0comst9p)CHCCNR.0:2=4;
elseif (eopp.0)
if (datapointc==1)CHCCNR.0:2=5;
elseCHCCNR.0:2=CHCCNR.0:2;
endifelse
CHCCNR.0:2=CHCCNR.0:2;endif
endifendif
endifendif
7.85 チャネル Dコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Dコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHDCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chseld)
CHDCNR=datain;else
CHDCNR=CHDCNR;endif
elseCHDCNR=CHDCNR;
endifelse
CHDCNR.3=CHDCNR.3;
if (chdpknext)if (CHDCNR.4:7==0)
CHDCNR.4:7=CHDCNR.4:7;else
CHDCNR.4:7=CHDCNR.4:7-1;endif
elseCHDCNR.4:7=CHDCNR.4:7;
endif
if (chdpknext)switch(pid.0:3)
case 2: CHDCNR.0:2=1; { ACK }case 10: CHDCNR.0:2=2; { NAK }case 14: CHDCNR.0:2=3; { STALL }default: CHDCNR.0:2=CHDCNR.0:2;
118 第 7章 論理譜
endswitchelse
if (t0comst9p)CHDCNR.0:2=4;
elseif (eopp.0)
if (datapointd==1)CHDCNR.0:2=5;
elseCHDCNR.0:2=CHDCNR.0:2;
endifelse
CHDCNR.0:2=CHDCNR.0:2;endif
endifendif
endifendif
7.86 チャネル Eコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Eコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHECNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chsele)
CHECNR=datain;else
CHECNR=CHECNR;endif
elseCHECNR=CHECNR;
endifelse
CHECNR.3=CHECNR.3;
if (chepknext)if (CHECNR.4:7==0)
CHECNR.4:7=CHECNR.4:7;else
CHECNR.4:7=CHECNR.4:7-1;endif
elseCHECNR.4:7=CHECNR.4:7;
endif
if (chepknext)switch(pid.0:3)
case 2: CHECNR.0:2=1; { ACK }case 10: CHECNR.0:2=2; { NAK }case 14: CHECNR.0:2=3; { STALL }default: CHECNR.0:2=CHECNR.0:2;
endswitchelse
if (t0comst9p)
7.87 チャネル Fコントロールレジスタ 119
CHECNR.0:2=4;else
if (eopp.0)if (datapointe==1)
CHECNR.0:2=5;else
CHECNR.0:2=CHECNR.0:2;endif
elseCHECNR.0:2=CHECNR.0:2;
endifendif
endifendif
endif
7.87 チャネル Fコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Fコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHFCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chself)
CHFCNR=datain;else
CHFCNR=CHFCNR;endif
elseCHFCNR=CHFCNR;
endifelse
CHFCNR.3=CHFCNR.3;
if (chfpknext)if (CHFCNR.4:7==0)
CHFCNR.4:7=CHFCNR.4:7;else
CHFCNR.4:7=CHFCNR.4:7-1;endif
elseCHFCNR.4:7=CHFCNR.4:7;
endif
if (chfpknext)switch(pid.0:3)
case 2: CHFCNR.0:2=1; { ACK }case 10: CHFCNR.0:2=2; { NAK }case 14: CHFCNR.0:2=3; { STALL }default: CHFCNR.0:2=CHFCNR.0:2;
endswitchelse
if (t0comst9p)CHFCNR.0:2=4;
elseif (eopp.0)
120 第 7章 論理譜
if (datapointf==1)CHFCNR.0:2=5;
elseCHFCNR.0:2=CHFCNR.0:2;
endifelse
CHFCNR.0:2=CHFCNR.0:2;endif
endifendif
endifendif
7.88 チャネル Gコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Gコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHGCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chselg)
CHGCNR=datain;else
CHGCNR=CHGCNR;endif
elseCHGCNR=CHGCNR;
endifelse
CHGCNR.3=CHGCNR.3;
if (chgpknext)if (CHGCNR.4:7==0)
CHGCNR.4:7=CHGCNR.4:7;else
CHGCNR.4:7=CHGCNR.4:7-1;endif
elseCHGCNR.4:7=CHGCNR.4:7;
endif
if (chgpknext)switch(pid.0:3)
case 2: CHGCNR.0:2=1; { ACK }case 10: CHGCNR.0:2=2; { NAK }case 14: CHGCNR.0:2=3; { STALL }default: CHGCNR.0:2=CHGCNR.0:2;
endswitchelse
if (t0comst9p)CHGCNR.0:2=4;
elseif (eopp.0)
if (datapointg==1)CHGCNR.0:2=5;
else
7.89 チャネル Hコントロールレジスタ 121
CHGCNR.0:2=CHGCNR.0:2;endif
elseCHGCNR.0:2=CHGCNR.0:2;
endifendif
endifendif
endif
7.89 チャネル Hコントロールレジスタ
{ -------------------------------------------------------------------- }{ チャネル Hコントロールレジスタ }{ -------------------------------------------------------------------- }
if (reset)CHHCNR=0;
elseif (writereg)
if (rs==rsCHxCNR)if (chselh)
CHHCNR=datain;else
CHHCNR=CHHCNR;endif
elseCHHCNR=CHHCNR;
endifelse
CHHCNR.3=CHHCNR.3;
if (chhpknext)if (CHHCNR.4:7==0)
CHHCNR.4:7=CHHCNR.4:7;else
CHHCNR.4:7=CHHCNR.4:7-1;endif
elseCHHCNR.4:7=CHHCNR.4:7;
endif
if (chhpknext)switch(pid.0:3)
case 2: CHHCNR.0:2=1; { ACK }case 10: CHHCNR.0:2=2; { NAK }case 14: CHHCNR.0:2=3; { STALL }default: CHHCNR.0:2=CHHCNR.0:2;
endswitchelse
if (t0comst9p)CHHCNR.0:2=4;
elseif (eopp.0)
if (datapointh==1)CHHCNR.0:2=5;
elseCHHCNR.0:2=CHHCNR.0:2;
endifelse
122 第 7章 論理譜
CHHCNR.0:2=CHHCNR.0:2;endif
endifendif
endifendif
7.90 チャネル A設定レジスタ CHAR3
{ -------------------------------------------------------------------- }{ チャネル A設定レジスタ CHAR3 }{ -------------------------------------------------------------------- }
if (reset)CHA3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chsela)
CHA3R=datain;else
CHA3R=CHA3R;endif
elseCHA3R=CHA3R;
endifelse
CHA3R=CHA3R;endif
endif
7.91 チャネル B設定レジスタ CHBR3
{ -------------------------------------------------------------------- }{ チャネル B設定レジスタ CHBR3 }{ -------------------------------------------------------------------- }
if (reset)CHB3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chselb)
CHB3R=datain;else
CHB3R=CHB3R;endif
elseCHB3R=CHB3R;
endifelse
CHB3R=CHB3R;endif
endif
7.92 チャネル C設定レジスタ CHCR3 123
7.92 チャネル C設定レジスタ CHCR3
{ -------------------------------------------------------------------- }{ チャネル C設定レジスタ CHCR3 }{ -------------------------------------------------------------------- }
if (reset)CHC3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chselc)
CHC3R=datain;else
CHC3R=CHC3R;endif
elseCHC3R=CHC3R;
endifelse
CHC3R=CHC3R;endif
endif
7.93 チャネル D設定レジスタ CHDR3
{ -------------------------------------------------------------------- }{ チャネル D設定レジスタ CHDR3 }{ -------------------------------------------------------------------- }
if (reset)CHD3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chseld)
CHD3R=datain;else
CHD3R=CHD3R;endif
elseCHD3R=CHD3R;
endifelse
CHD3R=CHD3R;endif
endif
7.94 チャネル E設定レジスタ CHER3
124 第 7章 論理譜
{ -------------------------------------------------------------------- }{ チャネル E設定レジスタ CHER3 }{ -------------------------------------------------------------------- }
if (reset)CHE3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chsele)
CHE3R=datain;else
CHE3R=CHE3R;endif
elseCHE3R=CHE3R;
endifelse
CHE3R=CHE3R;endif
endif
7.95 チャネル F設定レジスタ CHFR3
{ -------------------------------------------------------------------- }{ チャネル F設定レジスタ CHFR3 }{ -------------------------------------------------------------------- }
if (reset)CHF3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chself)
CHF3R=datain;else
CHF3R=CHF3R;endif
elseCHF3R=CHF3R;
endifelse
CHF3R=CHF3R;endif
endif
7.96 チャネル G設定レジスタ CHGR3
{ -------------------------------------------------------------------- }{ チャネル G設定レジスタ CHGR3 }{ -------------------------------------------------------------------- }
if (reset)
7.97 チャネル H設定レジスタ CHHR3 125
CHG3R=0;else
if (writereg)if (rs==rsCHxR3)
if (chselg)CHG3R=datain;
elseCHG3R=CHG3R;
endifelse
CHG3R=CHG3R;endif
elseCHG3R=CHG3R;
endifendif
7.97 チャネル H設定レジスタ CHHR3
{ -------------------------------------------------------------------- }{ チャネル H設定レジスタ CHHR3 }{ -------------------------------------------------------------------- }
if (reset)CHH3R=0;
elseif (writereg)
if (rs==rsCHxR3)if (chselh)
CHH3R=datain;else
CHH3R=CHH3R;endif
elseCHH3R=CHH3R;
endifelse
CHH3R=CHH3R;endif
endif
{ ==================================================================== }{ セグメントレジスタ }{ ==================================================================== }
7.98 端子 0セグメント 0レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 0レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG0R=15;
elseif (writereg)
126 第 7章 論理譜
if (rs==rsTxSEG0R)T0SEG0R=datain.0:3;
elseT0SEG0R=T0SEG0R;
endifelse
T0SEG0R=T0SEG0R;endif
endif
7.99 端子 0セグメント 1レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 1レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG1R=15;
elseif (writereg)
if (rs==rsTxSEG1R)T0SEG1R=datain.0:3;
elseT0SEG1R=T0SEG1R;
endifelse
T0SEG1R=T0SEG1R;endif
endif
7.100 端子 0セグメント 2レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 2レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG2R=15;
elseif (writereg)
if (rs==rsTxSEG2R)T0SEG2R=datain.0:3;
elseT0SEG2R=T0SEG2R;
endifelse
T0SEG2R=T0SEG2R;endif
endif
7.101 端子 0セグメント 3レジスタ
7.102 端子 0セグメント 4レジスタ 127
{ -------------------------------------------------------------------- }{ 端子 0セグメント 3レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG3R=15;
elseif (writereg)
if (rs==rsTxSEG3R)T0SEG3R=datain.0:3;
elseT0SEG3R=T0SEG3R;
endifelse
T0SEG3R=T0SEG3R;endif
endif
7.102 端子 0セグメント 4レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 4レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG4R=15;
elseif (writereg)
if (rs==rsTxSEG4R)T0SEG4R=datain.0:3;
elseT0SEG4R=T0SEG4R;
endifelse
T0SEG4R=T0SEG4R;endif
endif
7.103 端子 0セグメント 5レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 5レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG5R=15;
elseif (writereg)
if (rs==rsTxSEG5R)T0SEG5R=datain.0:3;
elseT0SEG5R=T0SEG5R;
128 第 7章 論理譜
endifelse
T0SEG5R=T0SEG5R;endif
endif
7.104 端子 0セグメント 6レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 6レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG6R=15;
elseif (writereg)
if (rs==rsTxSEG6R)T0SEG6R=datain.0:3;
elseT0SEG6R=T0SEG6R;
endifelse
T0SEG6R=T0SEG6R;endif
endif
7.105 端子 0セグメント 7レジスタ
{ -------------------------------------------------------------------- }{ 端子 0セグメント 7レジスタ }{ -------------------------------------------------------------------- }
if (reset)T0SEG7R=15;
elseif (writereg)
if (rs==rsTxSEG7R)T0SEG7R=datain.0:3;
elseT0SEG7R=T0SEG7R;
endifelse
T0SEG7R=T0SEG7R;endif
endif
{ ==================================================================== }{ 端子 0 手続き引用 }{ ==================================================================== }
7.106 送信端に同期した EOP
7.107 送信ビット移動指標 129
{ -------------------------------------------------------------------- }{ 送信端に同期した EOP }{ -------------------------------------------------------------------- }
dseop=usbport.61;
7.107 送信ビット移動指標
{ -------------------------------------------------------------------- }{ 送信ビット移動指標 }{ -------------------------------------------------------------------- }
nextbit=usbport.59;
7.108 端子 0の手続き sendToken引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き sendToken引用 }{ -------------------------------------------------------------------- }
stoken=sendToken(s0ten,s0pid,devaddress0t,endpoint0t,fn,sbp);
stoken.24=1;
7.109 端子 0の手続き sendPACKET引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き sendPACKET引用 }{ -------------------------------------------------------------------- }
spacket=sendPACKET(s0pen,s0pdno,s0pid,sbdata,tmode,sbp);
spacket.46=1;
7.110 端子 0の手続き usbif引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き usbif引用 }{ -------------------------------------------------------------------- }
usbport=usbif(reset,dpin,dmin,mode,t0ensclk.0,sd,seop,sync,sbp);usbport.68=1;
130 第 7章 論理譜
7.111 端子 0の手続き getbyte引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き getbyte引用 }{ -------------------------------------------------------------------- }
q=getbyte(clr,eope.0,syncsp,data);
7.112 端子 0の手続き crc16引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き crc16引用 }{ -------------------------------------------------------------------- }
crc16d=crc16(invpidpassa,sp,data);
7.113 端子 0の手続き getPID引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き getPID引用 }{ -------------------------------------------------------------------- }
pid=getPID(clr,q.0:7,bytesp,eopp.0);
7.114 端子 0の手続き getEOP引用
{ -------------------------------------------------------------------- }{ 端子 0の手続き getEOP引用 }{ -------------------------------------------------------------------- }
eopp=getEOP(reset,eop,syncsp);
7.115 端子 0の USB差動出力+
{ -------------------------------------------------------------------- }{ 端子 0の USB差動出力 + }
7.116 端子 0の USB差動出力- 131
{ -------------------------------------------------------------------- }dpout=usbport.2;
7.116 端子 0の USB差動出力-
{ -------------------------------------------------------------------- }{ 端子 0の USB差動出力- }{ -------------------------------------------------------------------- }
dmout=usbport.3;
7.117 端子 0の USB入力シリアルデータ
{ -------------------------------------------------------------------- }{ 端子 0の USB入力シリアルデータ }{ -------------------------------------------------------------------- }
data=usbport.0;
7.118 端子 0の受信 EOP
{ -------------------------------------------------------------------- }{ 端子 0の受信 EOP }{ -------------------------------------------------------------------- }
eop=usbport.1;
7.119 端子 0の同期ビットデータ取得点
{ -------------------------------------------------------------------- }{ 端子 0の同期ビットデータ取得点 }{ -------------------------------------------------------------------- }
syncsp=usbport.9;
7.120 端子 0のビットデータ起点
132 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 端子 0のビットデータ起点 }{ -------------------------------------------------------------------- }
cd=usbport.12;
7.121 端子 0のビットデータ取得点
{ -------------------------------------------------------------------- }{ 端子 0のビットデータ取得点 }{ -------------------------------------------------------------------- }
sp=q.8&!eop;
7.122 端子 0のバイトデータ取得点
{ -------------------------------------------------------------------- }{ 端子 0のバイトデータ取得点 }{ -------------------------------------------------------------------- }
bytesp=q.9;
7.123 端子 0の SYNC読み取り指標
{ -------------------------------------------------------------------- }{ 端子 0の SYNC読み取り指標 }{ -------------------------------------------------------------------- }
sync=q.11;
q.25=1;
7.124 端子 0の PIDエラー指標
{ -------------------------------------------------------------------- }{ 端子 0の PIDエラー指標 }{ -------------------------------------------------------------------- }
t0piderr=pid.8;
7.125 端子 0の PID通過指標
7.126 端子 0の送信ビットデータ 133
{ -------------------------------------------------------------------- }{ 端子 0の PID通過指標 }{ -------------------------------------------------------------------- }
t0pidpass=pid.9;
7.126 端子 0の送信ビットデータ
{ -------------------------------------------------------------------- }{ 端子 0の送信ビットデータ }{ -------------------------------------------------------------------- }
if (s0ten) sd=stoken.0; endifif (s0pen) sd=spacket.0; endif
7.127 端子 0の送信 EOP
{ -------------------------------------------------------------------- }{ 端子 0の送信 EOP }{ -------------------------------------------------------------------- }
if (s0ten) seop=stoken.1; endifif (s0pen) seop=spacket.1; endif
7.128 端子 0の送信 EOP終了
{ -------------------------------------------------------------------- }{ 端子 0の送信 EOP終了 }{ -------------------------------------------------------------------- }
if (s0ten) seope=stoken.2; endifif (s0pen) seope=spacket.2; endif
7.129 端子 0の送信データ計数
{ -------------------------------------------------------------------- }{ 端子 0の送信データ計数 }{ -------------------------------------------------------------------- }
sdcount=spacket.3:13;
134 第 7章 論理譜
7.130 端子 0の送信 EOP開始
{ -------------------------------------------------------------------- }{ 端子 0の送信 EOP開始 }{ -------------------------------------------------------------------- }
if (s0ten) seops=stoken.7; endifif (s0pen) seops=spacket.18; endif
7.131 端子 0の送信 CRC
{ -------------------------------------------------------------------- }{ 端子 0の送信 CRC }{ -------------------------------------------------------------------- }
scrc16=spacket.20:35;
7.132 端子 0のデータ書き込み起点
{ -------------------------------------------------------------------- }{ 端子 0のデータ書き込み起点 }{ -------------------------------------------------------------------- }
if ((t0comst==7)&(t0pidpass))if (delayeop==0)
wp=bytesp;endif
endif
7.133 端子 0のデータ読み込み起点
{ -------------------------------------------------------------------- }{ 端子 0のデータ読み込み起点 }{ -------------------------------------------------------------------- }
if (spacket.14:16==2)rp=spacket.17;
endif
{ ==================================================================== }{ 端子 0 }{ ==================================================================== }
7.134 端子 0送信有効 135
7.134 端子 0送信有効
{ -------------------------------------------------------------------- }{ 端子 0送信有効 }{ -------------------------------------------------------------------- }
if (s0ten|s0pen) t0senden=1; endif
7.135 端子 0デバイス接続状態
図 7.1 デバイス接続状態
無接続
時間待 初期化
切断 SE0
待機
0
1 2
3
45
ab
cd
ef
gh
{ -------------------------------------------------------------------- }{ 端子 0デバイス接続状態 }{ -------------------------------------------------------------------- }
if (reset)dev0const=0;
elseswitch(dev0const)
case 0: { 無接続 }if (dpin|dmin) dev0const=1; endif
case 1: { 時間待ち }if (dpin|dmin)
if (dev0contimer>20)dev0const=2;
elsedev0const=dev0const;
endifelse
dev0const=0;endif
case 2: { 初期化 }if (dev0initimer>100)
dev0const=3;else
dev0const=dev0const;endif
case 3: { 待機 }
136 第 7章 論理譜
if (!dpin&!dmin)dev0const=4;
elsedev0const=dev0const;
endifcase 4: { SE0 }
if (!dpin&!dmin)if (dev0remtimer>25)
dev0const=5;else
dev0const=dev0const;endif
elsedev0const=3;
endifcase 5: { 切断 }
dev0const=0;endswitch
endif
7.136 端子 0接続認識タイマ
{ -------------------------------------------------------------------- }{ 端子 0接続認識タイマ }{ -------------------------------------------------------------------- }
if (reset)dev0contimer=0;
elseif (dev0const==1)
if (pulse0p1ms)dev0contimer=dev0contimer+1;
elsedev0contimer=dev0contimer;
endifendif
endif
7.137 端子 0初期化タイマ
{ -------------------------------------------------------------------- }{ 端子 0初期化タイマ }{ -------------------------------------------------------------------- }
if (reset)dev0initimer=0;
elseif (dev0const==2)
if (pulse0p1ms)dev0initimer=dev0initimer+1;
elsedev0initimer=dev0initimer;
endifendif
endif
7.138 端子 0切断タイマ 137
7.138 端子 0切断タイマ
{ -------------------------------------------------------------------- }{ 端子 0切断タイマ }{ -------------------------------------------------------------------- }
if (reset)dev0remtimer=0;
elseif (dev0const==4)
if (pulse0p1us)dev0remtimer=dev0remtimer+1;
elsedev0remtimer=dev0remtimer;
endifendif
endif
7.139 端子 0コンフィギュレーション要求
{ -------------------------------------------------------------------- }{ 端子 0コンフィギュレーション要求 }{ -------------------------------------------------------------------- }
if (reset)dev0confreq=0;
elseswitch(dev0confreq)
case 0:if (dev0const==2) dev0confreq=2; endif
case 1:if (dev0const==5)
dev0confreq=0;else
if (DETARb0w)dev0confreq=0;
elsedev0confreq=dev0confreq;
endifendif
case 2:if (dev0const==3)
dev0confreq=1;else
dev0confreq=dev0confreq;endif
endswitchendif
7.140 端子 0切断検出
138 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 端子 0切断検出 }{ -------------------------------------------------------------------- }
if (reset)dev0remdet=0;
elseif (dev0const==5)
dev0remdet=1;else
if (DETDRb0w|IRb0w)dev0remdet=0;
elsedev0remdet=dev0remdet;
endifendif
endif
7.141 端子 0の送信バイトデータ
{ -------------------------------------------------------------------- }{ 端子 0の送信バイトデータ }{ -------------------------------------------------------------------- }
switch(sen0count)case 0:case 1: { フレーム開始パケット }default:
switch(t0chn)case 0: sbdata=chadatain; { チャネル A }case 1: sbdata=chbdatain; { チャネル B }case 2: sbdata=chcdatain; { チャネル C }case 3: sbdata=chddatain; { チャネル D }case 4: sbdata=chedatain; { チャネル E }case 5: sbdata=chfdatain; { チャネル F }case 6: sbdata=chgdatain; { チャネル G }case 7: sbdata=chhdatain; { チャネル H }
endswitchendswitch
7.142 端子 0の送信 PID
{ -------------------------------------------------------------------- }{ 端子 0の送信 PID }{ -------------------------------------------------------------------- }
switch(sen0count)case 1: s0pid.0:3=0b0101; { SOF }
s0pid.4:7=0b1010;case 2: s0pid.0:3=t0s0pid; { セグメント 0 }
s0pid.4:7=!t0s0pid;
7.143 端子 0のセグメント位置 139
case 3: s0pid.0:3=t0s1pid; { セグメント 1 }s0pid.4:7=!t0s1pid;
case 4: s0pid.0:3=t0s2pid; { セグメント 2 }s0pid.4:7=!t0s2pid;
case 5: s0pid.0:3=t0s3pid; { セグメント 3 }s0pid.4:7=!t0s3pid;
case 6: s0pid.0:3=t0s4pid; { セグメント 4 }s0pid.4:7=!t0s4pid;
case 7: s0pid.0:3=t0s5pid; { セグメント 5 }s0pid.4:7=!t0s5pid;
case 8: s0pid.0:3=t0s6pid; { セグメント 6 }s0pid.4:7=!t0s6pid;
case 9: s0pid.0:3=t0s7pid; { セグメント 7 }s0pid.4:7=!t0s7pid;
endswitch
7.143 端子 0のセグメント位置
{ -------------------------------------------------------------------- }{ 端子 0のセグメント位置 }{ -------------------------------------------------------------------- }
if (reset)sen0count=0;
elseif (pulse1ms)
sen0count=2; { @sim@ 1->2 }else
switch(sen0count)case 1: { SOF }
if (seope)sen0count=2;
elsesen0count=sen0count;
endifcase 2: { セグメント 0 }
if (t0segreq)sen0count=sen0count;
elsesen0count=3;
endifcase 3: { セグメント 1 }
if (t0segreq)sen0count=sen0count;
elsesen0count=4;
endifcase 4: { セグメント 2 }
if (t0segreq)sen0count=sen0count;
elsesen0count=5;
endifcase 5: { セグメント 3 }
if (t0segreq)sen0count=sen0count;
elsesen0count=6;
endifcase 6: { セグメント 4 }
140 第 7章 論理譜
if (t0segreq)sen0count=sen0count;
elsesen0count=7;
endifcase 7: { セグメント 5 }
if (t0segreq)sen0count=sen0count;
elsesen0count=8;
endifcase 8: { セグメント 6 }
if (t0segreq)sen0count=sen0count;
elsesen0count=9;
endifcase 9: { セグメント 7 }
if (t0segreq)sen0count=sen0count;
elsesen0count=0;
endifendswitch
endifendif
7.144 端子 0のセグメントの通信開始指示
{ -------------------------------------------------------------------- }{ 端子 0のセグメントの通信開始指示 }{ -------------------------------------------------------------------- }
if (send10wait)switch(sen0count)
case 1: s0en=1; { フレーム開始パケット }case 2: s0en=t0s0en; { セグメント 0 }case 3: s0en=t0s1en; { セグメント 1 }case 4: s0en=t0s2en; { セグメント 2 }case 5: s0en=t0s3en; { セグメント 3 }case 6: s0en=t0s4en; { セグメント 4 }case 7: s0en=t0s5en; { セグメント 5 }case 8: s0en=t0s6en; { セグメント 6 }case 9: s0en=t0s7en; { セグメント 7 }
endswitchelse
s0en=0;endif
7.145 端子 0のセグメントの送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメントの送信数 }
7.146 端子 0のデバイスアドレス 141
{ -------------------------------------------------------------------- }switch(sen0count)
case 2: s0pdno=t0s0pdno; { セグメント 0 }case 3: s0pdno=t0s1pdno; { セグメント 1 }case 4: s0pdno=t0s2pdno; { セグメント 2 }case 5: s0pdno=t0s3pdno; { セグメント 3 }case 6: s0pdno=t0s4pdno; { セグメント 4 }case 7: s0pdno=t0s5pdno; { セグメント 5 }case 8: s0pdno=t0s6pdno; { セグメント 6 }case 9: s0pdno=t0s7pdno; { セグメント 7 }
endswitch
7.146 端子 0のデバイスアドレス
{ -------------------------------------------------------------------- }{ 端子 0のデバイスアドレス }{ -------------------------------------------------------------------- }
switch(sen0count)case 2: devaddress0t=address0s0t; { セグメント 0 }case 3: devaddress0t=address1s0t; { セグメント 1 }case 4: devaddress0t=address2s0t; { セグメント 2 }case 5: devaddress0t=address3s0t; { セグメント 3 }case 6: devaddress0t=address4s0t; { セグメント 4 }case 7: devaddress0t=address5s0t; { セグメント 5 }case 8: devaddress0t=address6s0t; { セグメント 6 }case 9: devaddress0t=address7s0t; { セグメント 7 }
endswitch
7.147 端子 0のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(sen0count)case 2: endpoint0t.0:3=endpoint0s0t; { セグメント 0 }case 3: endpoint0t.0:3=endpoint1s0t; { セグメント 1 }case 4: endpoint0t.0:3=endpoint2s0t; { セグメント 2 }case 5: endpoint0t.0:3=endpoint3s0t; { セグメント 3 }case 6: endpoint0t.0:3=endpoint4s0t; { セグメント 4 }case 7: endpoint0t.0:3=endpoint5s0t; { セグメント 5 }case 8: endpoint0t.0:3=endpoint6s0t; { セグメント 6 }case 9: endpoint0t.0:3=endpoint7s0t; { セグメント 7 }
endswitch
7.148 端子 0のセグメントの Tokenパケットの送信開始指示
142 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 端子 0のセグメントの Tokenパケットの送信開始指示 }{ -------------------------------------------------------------------- }
if (s0en)switch(s0pid.0:3)
case 0x01: s0ten=1; { OUT }case 0x09: s0ten=1; { IN }case 0x05: s0ten=1; { SOF }case 0x0d: s0ten=1; { SETUP }
endswitchendif
7.149 端子 0のセグメントの Tokenパケット以外の送信開始指示
{ ----------------------------------------------------------------------- }{ 端子 0のセグメントの Tokenパケット以外の送信開始指示 }{ ----------------------------------------------------------------------- }
if (s0en)switch(s0pid.0:3)
case 0x03: s0pen=1; { Data0 }case 0x0b: s0pen=1; { Data1 }case 0x02: s0pen=1; { ACK }case 0x0a: s0pen=1; { NAK }case 0x0e: s0pen=1; { STALL }case 0x0c: s0pen=1; { PRE }
endswitchendif
7.150 端子 0の次送信のパケットの待ち時間計数
{ -------------------------------------------------------------------- }{ 端子 0の次送信のパケットの待ち時間計数 }{ -------------------------------------------------------------------- }
if (reset)sendwait=0;
elseif (seope)
sendwait=0;else
if (send10wait)sendwait=sendwait;
elsesendwait=sendwait+1;
endifendif
endif
7.151 端子 0の次送信のパケットの待ち時間起点 143
7.151 端子 0の次送信のパケットの待ち時間起点
{ -------------------------------------------------------------------- }{ 端子 0の次送信のパケットの待ち時間起点 }{ -------------------------------------------------------------------- }
if (sendwait==50) send10wait=1; endif
7.152 端子 0のセグメント 0のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 0のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: address0s0t=CHA3R.0:6;case 1: address0s0t=CHB3R.0:6;case 2: address0s0t=CHC3R.0:6;case 3: address0s0t=CHD3R.0:6;case 4: address0s0t=CHE3R.0:6;case 5: address0s0t=CHF3R.0:6;case 6: address0s0t=CHG3R.0:6;case 7: address0s0t=CHH3R.0:6;
endswitch
7.153 端子 0のセグメント 1のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 1のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG1R)case 0: address1s0t=CHA3R.0:6;case 1: address1s0t=CHB3R.0:6;case 2: address1s0t=CHC3R.0:6;case 3: address1s0t=CHD3R.0:6;case 4: address1s0t=CHE3R.0:6;case 5: address1s0t=CHF3R.0:6;case 6: address1s0t=CHG3R.0:6;case 7: address1s0t=CHH3R.0:6;
endswitch
7.154 端子 0のセグメント 2のアドレス
144 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 2のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG2R)case 0: address2s0t=CHA3R.0:6;case 1: address2s0t=CHB3R.0:6;case 2: address2s0t=CHC3R.0:6;case 3: address2s0t=CHD3R.0:6;case 4: address2s0t=CHE3R.0:6;case 5: address2s0t=CHF3R.0:6;case 6: address2s0t=CHG3R.0:6;case 7: address2s0t=CHH3R.0:6;
endswitch
7.155 端子 0のセグメント 3のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 3のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG3R)case 0: address3s0t=CHA3R.0:6;case 1: address3s0t=CHB3R.0:6;case 2: address3s0t=CHC3R.0:6;case 3: address3s0t=CHD3R.0:6;case 4: address3s0t=CHE3R.0:6;case 5: address3s0t=CHF3R.0:6;case 6: address3s0t=CHG3R.0:6;case 7: address3s0t=CHH3R.0:6;
endswitch
7.156 端子 0のセグメント 4のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 4のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG4R)case 0: address4s0t=CHA3R.0:6;case 1: address4s0t=CHB3R.0:6;case 2: address4s0t=CHC3R.0:6;case 3: address4s0t=CHD3R.0:6;case 4: address4s0t=CHE3R.0:6;case 5: address4s0t=CHF3R.0:6;case 6: address4s0t=CHG3R.0:6;case 7: address4s0t=CHH3R.0:6;
endswitch
7.157 端子 0のセグメント 5のアドレス
7.158 端子 0のセグメント 6のアドレス 145
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 5のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG5R)case 0: address5s0t=CHA3R.0:6;case 1: address5s0t=CHB3R.0:6;case 2: address5s0t=CHC3R.0:6;case 3: address5s0t=CHD3R.0:6;case 4: address5s0t=CHE3R.0:6;case 5: address5s0t=CHF3R.0:6;case 6: address5s0t=CHG3R.0:6;case 7: address5s0t=CHH3R.0:6;
endswitch
7.158 端子 0のセグメント 6のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 6のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG6R)case 0: address6s0t=CHA3R.0:6;case 1: address6s0t=CHB3R.0:6;case 2: address6s0t=CHC3R.0:6;case 3: address6s0t=CHD3R.0:6;case 4: address6s0t=CHE3R.0:6;case 5: address6s0t=CHF3R.0:6;case 6: address6s0t=CHG3R.0:6;case 7: address6s0t=CHH3R.0:6;
endswitch
7.159 端子 0のセグメント 7のアドレス
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 7のアドレス }{ -------------------------------------------------------------------- }
switch(T0SEG7R)case 0: address7s0t=CHA3R.0:6;case 1: address7s0t=CHB3R.0:6;case 2: address7s0t=CHC3R.0:6;case 3: address7s0t=CHD3R.0:6;case 4: address7s0t=CHE3R.0:6;case 5: address7s0t=CHF3R.0:6;case 6: address7s0t=CHG3R.0:6;case 7: address7s0t=CHH3R.0:6;
endswitch
7.160 端子 0のセグメント 0のエンドポイント番号
146 第 7章 論理譜
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 0のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: endpoint0s0t.0:3=CHA0R.0:3;case 1: endpoint0s0t.0:3=CHB0R.0:3;case 2: endpoint0s0t.0:3=CHC0R.0:3;case 3: endpoint0s0t.0:3=CHD0R.0:3;case 4: endpoint0s0t.0:3=CHE0R.0:3;case 5: endpoint0s0t.0:3=CHF0R.0:3;case 6: endpoint0s0t.0:3=CHG0R.0:3;case 7: endpoint0s0t.0:3=CHH0R.0:3;
endswitch
7.161 端子 0のセグメント 1のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 1のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG1R)case 0: endpoint1s0t.0:3=CHA0R.0:3;case 1: endpoint1s0t.0:3=CHB0R.0:3;case 2: endpoint1s0t.0:3=CHC0R.0:3;case 3: endpoint1s0t.0:3=CHD0R.0:3;case 4: endpoint1s0t.0:3=CHE0R.0:3;case 5: endpoint1s0t.0:3=CHF0R.0:3;case 6: endpoint1s0t.0:3=CHG0R.0:3;case 7: endpoint1s0t.0:3=CHH0R.0:3;
endswitch
7.162 端子 0のセグメント 2のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 2のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG2R)case 0: endpoint2s0t.0:3=CHA0R.0:3;case 1: endpoint2s0t.0:3=CHB0R.0:3;case 2: endpoint2s0t.0:3=CHC0R.0:3;case 3: endpoint2s0t.0:3=CHD0R.0:3;case 4: endpoint2s0t.0:3=CHE0R.0:3;case 5: endpoint2s0t.0:3=CHF0R.0:3;case 6: endpoint2s0t.0:3=CHG0R.0:3;case 7: endpoint2s0t.0:3=CHH0R.0:3;
endswitch
7.163 端子 0のセグメント 3のエンドポイント番号 147
7.163 端子 0のセグメント 3のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 3のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG3R)case 0: endpoint3s0t.0:3=CHA0R.0:3;case 1: endpoint3s0t.0:3=CHB0R.0:3;case 2: endpoint3s0t.0:3=CHC0R.0:3;case 3: endpoint3s0t.0:3=CHD0R.0:3;case 4: endpoint3s0t.0:3=CHE0R.0:3;case 5: endpoint3s0t.0:3=CHF0R.0:3;case 6: endpoint3s0t.0:3=CHG0R.0:3;case 7: endpoint3s0t.0:3=CHH0R.0:3;
endswitch
7.164 端子 0のセグメント 4のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 4のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG4R)case 0: endpoint4s0t.0:3=CHA0R.0:3;case 1: endpoint4s0t.0:3=CHB0R.0:3;case 2: endpoint4s0t.0:3=CHC0R.0:3;case 3: endpoint4s0t.0:3=CHD0R.0:3;case 4: endpoint4s0t.0:3=CHE0R.0:3;case 5: endpoint4s0t.0:3=CHF0R.0:3;case 6: endpoint4s0t.0:3=CHG0R.0:3;case 7: endpoint4s0t.0:3=CHH0R.0:3;
endswitch
7.165 端子 0のセグメント 5のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 5のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG5R)case 0: endpoint5s0t.0:3=CHA0R.0:3;case 1: endpoint5s0t.0:3=CHB0R.0:3;case 2: endpoint5s0t.0:3=CHC0R.0:3;case 3: endpoint5s0t.0:3=CHD0R.0:3;case 4: endpoint5s0t.0:3=CHE0R.0:3;case 5: endpoint5s0t.0:3=CHF0R.0:3;case 6: endpoint5s0t.0:3=CHG0R.0:3;case 7: endpoint5s0t.0:3=CHH0R.0:3;
endswitch
148 第 7章 論理譜
7.166 端子 0のセグメント 6のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 6のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG6R)case 0: endpoint6s0t.0:3=CHA0R.0:3;case 1: endpoint6s0t.0:3=CHB0R.0:3;case 2: endpoint6s0t.0:3=CHC0R.0:3;case 3: endpoint6s0t.0:3=CHD0R.0:3;case 4: endpoint6s0t.0:3=CHE0R.0:3;case 5: endpoint6s0t.0:3=CHF0R.0:3;case 6: endpoint6s0t.0:3=CHG0R.0:3;case 7: endpoint6s0t.0:3=CHH0R.0:3;
endswitch
7.167 端子 0のセグメント 7のエンドポイント番号
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 7のエンドポイント番号 }{ -------------------------------------------------------------------- }
switch(T0SEG7R)case 0: endpoint7s0t.0:3=CHA0R.0:3;case 1: endpoint7s0t.0:3=CHB0R.0:3;case 2: endpoint7s0t.0:3=CHC0R.0:3;case 3: endpoint7s0t.0:3=CHD0R.0:3;case 4: endpoint7s0t.0:3=CHE0R.0:3;case 5: endpoint7s0t.0:3=CHF0R.0:3;case 6: endpoint7s0t.0:3=CHG0R.0:3;case 7: endpoint7s0t.0:3=CHH0R.0:3;
endswitch
7.168 端子 0のセグメント 0の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 0の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s0pdno=spdnoa; { チャネル A }case 1: t0s0pdno=spdnob; { チャネル B }case 2: t0s0pdno=spdnoc; { チャネル C }case 3: t0s0pdno=spdnod; { チャネル D }case 4: t0s0pdno=spdnoe; { チャネル E }case 5: t0s0pdno=spdnof; { チャネル F }
7.169 端子 0のセグメント 1の送信数 149
case 6: t0s0pdno=spdnog; { チャネル G }case 7: t0s0pdno=spdnoh; { チャネル H }
endswitch
7.169 端子 0のセグメント 1の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 1の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s1pdno=spdnoa; { チャネル A }case 1: t0s1pdno=spdnob; { チャネル B }case 2: t0s1pdno=spdnoc; { チャネル C }case 3: t0s1pdno=spdnod; { チャネル D }case 4: t0s1pdno=spdnoe; { チャネル E }case 5: t0s1pdno=spdnof; { チャネル F }case 6: t0s1pdno=spdnog; { チャネル G }case 7: t0s1pdno=spdnoh; { チャネル H }
endswitch
7.170 端子 0のセグメント 2の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 2の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s2pdno=spdnoa; { チャネル A }case 1: t0s2pdno=spdnob; { チャネル B }case 2: t0s2pdno=spdnoc; { チャネル C }case 3: t0s2pdno=spdnod; { チャネル D }case 4: t0s2pdno=spdnoe; { チャネル E }case 5: t0s2pdno=spdnof; { チャネル F }case 6: t0s2pdno=spdnog; { チャネル G }case 7: t0s2pdno=spdnoh; { チャネル H }
endswitch
7.171 端子 0のセグメント 3の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 3の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s3pdno=spdnoa; { チャネル A }case 1: t0s3pdno=spdnob; { チャネル B }
150 第 7章 論理譜
case 2: t0s3pdno=spdnoc; { チャネル C }case 3: t0s3pdno=spdnod; { チャネル D }case 4: t0s3pdno=spdnoe; { チャネル E }case 5: t0s3pdno=spdnof; { チャネル F }case 6: t0s3pdno=spdnog; { チャネル G }case 7: t0s3pdno=spdnoh; { チャネル H }
endswitch
7.172 端子 0のセグメント 4の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 4の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s4pdno=spdnoa; { チャネル A }case 1: t0s4pdno=spdnob; { チャネル B }case 2: t0s4pdno=spdnoc; { チャネル C }case 3: t0s4pdno=spdnod; { チャネル D }case 4: t0s4pdno=spdnoe; { チャネル E }case 5: t0s4pdno=spdnof; { チャネル F }case 6: t0s4pdno=spdnog; { チャネル G }case 7: t0s4pdno=spdnoh; { チャネル H }
endswitch
7.173 端子 0のセグメント 5の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 5の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s5pdno=spdnoa; { チャネル A }case 1: t0s5pdno=spdnob; { チャネル B }case 2: t0s5pdno=spdnoc; { チャネル C }case 3: t0s5pdno=spdnod; { チャネル D }case 4: t0s5pdno=spdnoe; { チャネル E }case 5: t0s5pdno=spdnof; { チャネル F }case 6: t0s5pdno=spdnog; { チャネル G }case 7: t0s5pdno=spdnoh; { チャネル H }
endswitch
7.174 端子 0のセグメント 6の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 6の送信数 }
7.175 端子 0のセグメント 7の送信数 151
{ -------------------------------------------------------------------- }switch(T0SEG0R)
case 0: t0s6pdno=spdnoa; { チャネル A }case 1: t0s6pdno=spdnob; { チャネル B }case 2: t0s6pdno=spdnoc; { チャネル C }case 3: t0s6pdno=spdnod; { チャネル D }case 4: t0s6pdno=spdnoe; { チャネル E }case 5: t0s6pdno=spdnof; { チャネル F }case 6: t0s6pdno=spdnog; { チャネル G }case 7: t0s6pdno=spdnoh; { チャネル H }
endswitch
7.175 端子 0のセグメント 7の送信数
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 7の送信数 }{ -------------------------------------------------------------------- }
switch(T0SEG0R)case 0: t0s7pdno=spdnoa; { チャネル A }case 1: t0s7pdno=spdnob; { チャネル B }case 2: t0s7pdno=spdnoc; { チャネル C }case 3: t0s7pdno=spdnod; { チャネル D }case 4: t0s7pdno=spdnoe; { チャネル E }case 5: t0s7pdno=spdnof; { チャネル F }case 6: t0s7pdno=spdnog; { チャネル G }case 7: t0s7pdno=spdnoh; { チャネル H }
endswitch
7.176 端子 0のセグメント 0の送信要求期間
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 0の送信要求期間 }{ -------------------------------------------------------------------- }
switch(t0comst)case 1: t0s0sendtime=1; { Token送信 }case 2: t0s0sendtime=1; { Data送信 }case 8: t0s0sendtime=1; { Handshake送信 }
endswitch
7.177 端子 0のセグメント 0の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 0の送信要求 }{ -------------------------------------------------------------------- }
152 第 7章 論理譜
if (t0s0sendtime)switch(T0SEG0R)
case 0: t0s0en=REQR.0; { チャネル A }case 1: t0s0en=REQR.1; { チャネル B }case 2: t0s0en=REQR.2; { チャネル C }case 3: t0s0en=REQR.3; { チャネル D }case 4: t0s0en=REQR.4; { チャネル E }case 5: t0s0en=REQR.5; { チャネル F }case 6: t0s0en=REQR.6; { チャネル G }case 7: t0s0en=REQR.7; { チャネル H }
endswitchendif
7.178 端子 0のセグメント 1の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 1の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG1R)case 0: t0s1en=REQR.0; { チャネル A }case 1: t0s1en=REQR.1; { チャネル B }case 2: t0s1en=REQR.2; { チャネル C }case 3: t0s1en=REQR.3; { チャネル D }case 4: t0s1en=REQR.4; { チャネル E }case 5: t0s1en=REQR.5; { チャネル F }case 6: t0s1en=REQR.6; { チャネル G }case 7: t0s1en=REQR.7; { チャネル H }
endswitch
7.179 端子 0のセグメント 2の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 2の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG2R)case 0: t0s2en=REQR.0; { チャネル A }case 1: t0s2en=REQR.1; { チャネル B }case 2: t0s2en=REQR.2; { チャネル C }case 3: t0s2en=REQR.3; { チャネル D }case 4: t0s2en=REQR.4; { チャネル E }case 5: t0s2en=REQR.5; { チャネル F }case 6: t0s2en=REQR.6; { チャネル G }case 7: t0s2en=REQR.7; { チャネル H }
endswitch
7.180 端子 0のセグメント 3の送信要求
7.181 端子 0のセグメント 4の送信要求 153
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 3の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG3R)case 0: t0s3en=REQR.0; { チャネル A }case 1: t0s3en=REQR.1; { チャネル B }case 2: t0s3en=REQR.2; { チャネル C }case 3: t0s3en=REQR.3; { チャネル D }case 4: t0s3en=REQR.4; { チャネル E }case 5: t0s3en=REQR.5; { チャネル F }case 6: t0s3en=REQR.6; { チャネル G }case 7: t0s3en=REQR.7; { チャネル H }
endswitch
7.181 端子 0のセグメント 4の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 4の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG4R)case 0: t0s4en=REQR.0; { チャネル A }case 1: t0s4en=REQR.1; { チャネル B }case 2: t0s4en=REQR.2; { チャネル C }case 3: t0s4en=REQR.3; { チャネル D }case 4: t0s4en=REQR.4; { チャネル E }case 5: t0s4en=REQR.5; { チャネル F }case 6: t0s4en=REQR.6; { チャネル G }case 7: t0s4en=REQR.7; { チャネル H }
endswitch
7.182 端子 0のセグメント 5の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 5の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG5R)case 0: t0s5en=REQR.0; { チャネル A }case 1: t0s5en=REQR.1; { チャネル B }case 2: t0s5en=REQR.2; { チャネル C }case 3: t0s5en=REQR.3; { チャネル D }case 4: t0s5en=REQR.4; { チャネル E }case 5: t0s5en=REQR.5; { チャネル F }case 6: t0s5en=REQR.6; { チャネル G }case 7: t0s5en=REQR.7; { チャネル H }
endswitch
154 第 7章 論理譜
7.183 端子 0のセグメント 6の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 6の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG6R)case 0: t0s6en=REQR.0; { チャネル A }case 1: t0s6en=REQR.1; { チャネル B }case 2: t0s6en=REQR.2; { チャネル C }case 3: t0s6en=REQR.3; { チャネル D }case 4: t0s6en=REQR.4; { チャネル E }case 5: t0s6en=REQR.5; { チャネル F }case 6: t0s6en=REQR.6; { チャネル G }case 7: t0s6en=REQR.7; { チャネル H }
endswitch
7.184 端子 0のセグメント 7の送信要求
{ -------------------------------------------------------------------- }{ 端子 0のセグメント 7の送信要求 }{ -------------------------------------------------------------------- }
switch(T0SEG7R)case 0: t0s7en=REQR.0; { チャネル A }case 1: t0s7en=REQR.1; { チャネル B }case 2: t0s7en=REQR.2; { チャネル C }case 3: t0s7en=REQR.3; { チャネル D }case 4: t0s7en=REQR.4; { チャネル E }case 5: t0s7en=REQR.5; { チャネル F }case 6: t0s7en=REQR.6; { チャネル G }case 7: t0s7en=REQR.7; { チャネル H }
endswitch
7.185 端子 0のセグメントの送信の PID
{ -------------------------------------------------------------------- }{ 端子 0のセグメントの送信の PID }{ -------------------------------------------------------------------- }
switch(t0comst)case 1:
if (t0segCH2R.4:6==0) { コントロール転送 }if (t0segCH2R.7) { 出力 }
if (!t0segCHCNR.3)t0s0pid=0b1101; { Setup }
elset0s0pid=0b0001; { Out }
7.186 端子 0の通信状態 155
endifelse { 入力 }
t0s0pid=0b1001; { In }endif
else { コントロール転送以外 }if (t0segCH2R.7) { 出力 }
t0s0pid=0b0001; { Out }else { 入力 }
t0s0pid=0b1001; { In }endif
endifcase 2: { Data送信 }
if (t0segpkcount.0)t0s0pid=0b1011; { 奇数パケット }
elset0s0pid=0b0011; { 偶数パケット }
endifcase 8: { Handshake送信 }
if (crc16c)t0s0pid=0b0010; { ACK }
elset0s0pid=0b1010; { NAK }
endifendswitch
7.186 端子 0の通信状態
図 7.2 通信状態
待機
終了
Token送信
Data
送信
Handshake
受信
Data受信
Handshake
送信
タイムアウト 完了 未了
終了へ終了へ
ACK
ACK 以外
ACK
ACK以外
01
2
3
4
5
6
7
8
9a
b
c
d
e
f
g
h
j
k
m
np
q r
{ -------------------------------------------------------------------- }{ 端子 0の通信状態 }{ -------------------------------------------------------------------- }
156 第 7章 論理譜
if (reset)t0comst=0;
elseswitch(t0comst)
case 0: { 待機 }switch(t0chn)
case 0: if (REQR.0) t0comst=1; endif { a }case 1: if (REQR.1) t0comst=1; endifcase 2: if (REQR.2) t0comst=1; endifcase 3: if (REQR.3) t0comst=1; endifcase 4: if (REQR.4) t0comst=1; endifcase 5: if (REQR.5) t0comst=1; endifcase 6: if (REQR.6) t0comst=1; endifcase 7: if (REQR.7) t0comst=1; endif
endswitchcase 1: { Token送信 }
if (seope)if (t0segCH2R.7)
t0comst=2; { b }else
t0comst=7;endif
elset0comst=t0comst;
endifcase 2: { Data送信 }
if (seope)if (t0segCH2R.4:6==3) { アイソクロナス転送は Handshakeなし }
t0comst=4;else { Handshakeあり }
t0comst=3; { c }endif
elset0comst=t0comst;
endifcase 3: { Handshake受信 }
if (comtime>90)t0comst=9; { k }
elseif (eope.0)
if ((pid.0:3==2)&!pid.8)t0comst=4; { g }
elset0comst=6; { f }
endifelse
if (t0piderr)t0comst=6;
elset0comst=t0comst;
endifendif
endifcase 4: { 完了 }
t0comst=5; { n }case 5: { 終了 }
t0comst=0; { p }case 6: { 未了 }
t0comst=5; { r }case 7: { Data受信 }
if (comtime>90)t0comst=9; { m }
elseif (eope.0)
if (t0segCH2R.4:6==3) { アイソクロナス転送は Handshakeなし }
7.187 端子 0の通信終了起点 157
t0comst=4;else { Handshakeあり }
t0comst=8; { e }endif
elseif (t0piderr)
t0comst=6;else
t0comst=t0comst;endif
endifendif
case 8: { Handshake送信 }if (seope)
if (s0pid.0:3==2)t0comst=4; { h }
elset0comst=6; { j }
endifelse
t0comst=t0comst;endif
case 9: { タイムアウト }t0comst=5; { q }
endswitchendif
7.187 端子 0の通信終了起点
{ -------------------------------------------------------------------- }{ 端子 0の通信終了起点 }{ -------------------------------------------------------------------- }
if (t0comst==5) t0comst5p=1; endif
7.188 端子 0の通信完了起点
{ -------------------------------------------------------------------- }{ 端子 0の通信完了起点 }{ -------------------------------------------------------------------- }
if (t0comst==4) t0comst4p=1; endif
7.189 端子 0のタイムアウト起点
{ -------------------------------------------------------------------- }{ 端子 0のタイムアウト起点 }{ -------------------------------------------------------------------- }
158 第 7章 論理譜
if (t0comst==9) t0comst9p=1; endif
7.190 端子 0のチャネル
{ -------------------------------------------------------------------- }{ 端子 0のチャネル }{ -------------------------------------------------------------------- }
switch(sen0count)case 2: t0chn=T0SEG0R;case 3: t0chn=T0SEG1R;case 4: t0chn=T0SEG2R;case 5: t0chn=T0SEG3R;case 6: t0chn=T0SEG4R;case 7: t0chn=T0SEG5R;case 8: t0chn=T0SEG6R;case 9: t0chn=T0SEG7R;default: t0chn=0b1111;
endswitch
7.191 端子 0の通信終了のチャネル
{ -------------------------------------------------------------------- }{ 端子 0の通信終了のチャネル }{ -------------------------------------------------------------------- }
if (t0comst5p)t0chncomp.3=1;t0chncomp.0:2=t0chn.0:2;
endif
7.192 端子 0の通信完了のチャネル
{ -------------------------------------------------------------------- }{ 端子 0の通信完了のチャネル }{ -------------------------------------------------------------------- }
if (t0comst4p)t0chndatacomp.3=1;t0chndatacomp.0:2=t0chn.0:2;
endif
7.193 端子 0の EOP終了起点
7.194 データ変化点 159
{ -------------------------------------------------------------------- }{ 端子 0の EOP終了起点 }{ -------------------------------------------------------------------- }
if (reset)eope=0;
elseif (eop)
eope=0;else
switch(eope)case 0: eope=1;case 1: eope=2;default: eope=eope;
endswitchendif
endif
7.194 データ変化点
{ -------------------------------------------------------------------- }{ データ変化点 }{ -------------------------------------------------------------------- }
if (reset)difdata=0;
elsedifdata.0=data;difdata.1=difdata.0;
endif
7.195 端子 0の無通信時間計数
{ -------------------------------------------------------------------- }{ 端子 0の無通信時間計数 }{ -------------------------------------------------------------------- }
if (reset)comtime=0;
elseif (cd)
comtime=0;else
switch(t0comst)case 1: comtime=0;case 2: comtime=0;default:
if (comtime==0xff)comtime=comtime;
elseif (difdata.0==difdata.1)
comtime=comtime+1;endif
160 第 7章 論理譜
endifendswitch
endifendif
7.196 端子 0の受信パケットの CRC結果
{ -------------------------------------------------------------------- }{ 端子 0の受信パケットの CRC結果 }{ -------------------------------------------------------------------- }
if (reset)crc16c=0;
elseif (pidpassa)
if (bytesp)if (crc16d==0) crc16c=1; endif
elsecrc16c=crc16c;
endifelse
crc16c=crc16c;endif
endif
7.197 端子 0の受信パケットのビットの通過計数
{ -------------------------------------------------------------------- }{ 端子 0の受信パケットのビットの通過計数 }{ -------------------------------------------------------------------- }
if (clr)bitcount=0;
elseif (sp)
if (bitcount<8)bitcount=bitcount+1;
elsebitcount=bitcount;
endifelse
bitcount=bitcount;endif
endif
7.198 端子 0の PIDの読み取り指標
{ -------------------------------------------------------------------- }
7.199 pidpassa否定 161
{ 端子 0の PIDの読み取り指標 }{ -------------------------------------------------------------------- }
if (bitcount==8) pidpassa=1; endif
7.199 pidpassa否定
{ -------------------------------------------------------------------- }{ pidpassa否定 }{ -------------------------------------------------------------------- }
invpidpassa=!pidpassa;
7.200 端子 0の受信初期化
{ -------------------------------------------------------------------- }{ 端子 0の受信初期化 }{ -------------------------------------------------------------------- }
clr=reset|eope.0;
7.201 端子 0の CHR0
{ -------------------------------------------------------------------- }{ 端子 0の CHR0 }{ -------------------------------------------------------------------- }
switch(t0chn)case 0: t0segCH0R=CHA0R;case 1: t0segCH0R=CHB0R;case 2: t0segCH0R=CHC0R;case 3: t0segCH0R=CHD0R;case 4: t0segCH0R=CHE0R;case 5: t0segCH0R=CHF0R;case 6: t0segCH0R=CHG0R;case 7: t0segCH0R=CHH0R;
endswitch
7.202 端子 0の CHR1
{ -------------------------------------------------------------------- }{ 端子 0の CHR1 }{ -------------------------------------------------------------------- }
162 第 7章 論理譜
switch(t0chn)case 0: t0segCH1R=CHA1R;case 1: t0segCH1R=CHB1R;case 2: t0segCH1R=CHC1R;case 3: t0segCH1R=CHD1R;case 4: t0segCH1R=CHE1R;case 5: t0segCH1R=CHF1R;case 6: t0segCH1R=CHG1R;case 7: t0segCH1R=CHH1R;
endswitch
7.203 端子 0の CHR2
{ -------------------------------------------------------------------- }{ 端子 0の CHR2 }{ -------------------------------------------------------------------- }
switch(t0chn)case 0: t0segCH2R=CHA2R;case 1: t0segCH2R=CHB2R;case 2: t0segCH2R=CHC2R;case 3: t0segCH2R=CHD2R;case 4: t0segCH2R=CHE2R;case 5: t0segCH2R=CHF2R;case 6: t0segCH2R=CHG2R;case 7: t0segCH2R=CHH2R;
endswitch
7.204 端子 0の CHRCNR
{ -------------------------------------------------------------------- }{ 端子 0の CHCNR }{ -------------------------------------------------------------------- }
switch(t0chn)case 0: t0segCHCNR=CHACNR;case 1: t0segCHCNR=CHBCNR;case 2: t0segCHCNR=CHCCNR;case 3: t0segCHCNR=CHDCNR;case 4: t0segCHCNR=CHECNR;case 5: t0segCHCNR=CHFCNR;case 6: t0segCHCNR=CHGCNR;case 7: t0segCHCNR=CHHCNR;
endswitch
7.205 端子 0の CHR3
{ -------------------------------------------------------------------- }
7.206 チャネル□のパケット通信完了起点 163
{ 端子 0の CHR3 }{ -------------------------------------------------------------------- }
switch(t0chn)case 0: t0segCH3R=CHA3R;case 1: t0segCH3R=CHB3R;case 2: t0segCH3R=CHC3R;case 3: t0segCH3R=CHD3R;case 4: t0segCH3R=CHE3R;case 5: t0segCH3R=CHF3R;case 6: t0segCH3R=CHG3R;case 7: t0segCH3R=CHH3R;
endswitch
7.206 チャネル□のパケット通信完了起点
{ ==================================================================== }{ チャネル }{ ==================================================================== }{ -------------------------------------------------------------------- }{ チャネル Aのパケット通信完了起点 }{ チャネル Bのパケット通信完了起点 }{ チャネル Cのパケット通信完了起点 }{ チャネル Dのパケット通信完了起点 }{ チャネル Eのパケット通信完了起点 }{ チャネル Fのパケット通信完了起点 }{ チャネル Gのパケット通信完了起点 }{ チャネル Hのパケット通信完了起点 }{ -------------------------------------------------------------------- }
if (t0chndatacomp.3)switch(t0chndatacomp.0:2) { 端子 0 }
case 0x0: chapknext=1;case 0x1: chbpknext=1;case 0x2: chcpknext=1;case 0x3: chdpknext=1;case 0x4: chepknext=1;case 0x5: chfpknext=1;case 0x6: chgpknext=1;case 0x7: chhpknext=1;
endswitchendif
7.207 チャネル Aの送信数
{ -------------------------------------------------------------------- }{ チャネル Aの送信数 }{ -------------------------------------------------------------------- }
switch(CHA2R.0:3)case 0: spdnoa=0;case 1: spdnoa=1;case 2: spdnoa=2;case 3: spdnoa=4;
164 第 7章 論理譜
case 4: spdnoa=8;case 5: spdnoa=16;case 6: spdnoa=32;case 7: spdnoa=64;case 8: spdnoa=128;case 9: spdnoa=256;case 10: spdnoa=512;case 11: spdnoa=1024;
endswitch
7.208 チャネル Bの送信数
{ -------------------------------------------------------------------- }{ チャネル Bの送信数 }{ -------------------------------------------------------------------- }
switch(CHB2R.0:3)case 0: spdnob=0;case 1: spdnob=1;case 2: spdnob=2;case 3: spdnob=4;case 4: spdnob=8;case 5: spdnob=16;case 6: spdnob=32;case 7: spdnob=64;case 8: spdnob=128;case 9: spdnob=256;case 10: spdnob=512;case 11: spdnob=1024;
endswitch
7.209 チャネル Cの送信数
{ -------------------------------------------------------------------- }{ チャネル Cの送信数 }{ -------------------------------------------------------------------- }
switch(CHC2R.0:3)case 0: spdnoc=0;case 1: spdnoc=1;case 2: spdnoc=2;case 3: spdnoc=4;case 4: spdnoc=8;case 5: spdnoc=16;case 6: spdnoc=32;case 7: spdnoc=64;case 8: spdnoc=128;case 9: spdnoc=256;case 10: spdnoc=512;case 11: spdnoc=1024;
endswitch
7.210 チャネル Dの送信数 165
7.210 チャネル Dの送信数
{ -------------------------------------------------------------------- }{ チャネル Dの送信数 }{ -------------------------------------------------------------------- }
switch(CHD2R.0:3)case 0: spdnod=0;case 1: spdnod=1;case 2: spdnod=2;case 3: spdnod=4;case 4: spdnod=8;case 5: spdnod=16;case 6: spdnod=32;case 7: spdnod=64;case 8: spdnod=128;case 9: spdnod=256;case 10: spdnod=512;case 11: spdnod=1024;
endswitch
7.211 チャネル Eの送信数
{ -------------------------------------------------------------------- }{ チャネル Eの送信数 }{ -------------------------------------------------------------------- }
switch(CHE2R.0:3)case 0: spdnoe=0;case 1: spdnoe=1;case 2: spdnoe=2;case 3: spdnoe=4;case 4: spdnoe=8;case 5: spdnoe=16;case 6: spdnoe=32;case 7: spdnoe=64;case 8: spdnoe=128;case 9: spdnoe=256;case 10: spdnoe=512;case 11: spdnoe=1024;
endswitch
7.212 チャネル Fの送信数
{ -------------------------------------------------------------------- }{ チャネル Fの送信数 }{ -------------------------------------------------------------------- }
switch(CHF2R.0:3)case 0: spdnof=0;
166 第 7章 論理譜
case 1: spdnof=1;case 2: spdnof=2;case 3: spdnof=4;case 4: spdnof=8;case 5: spdnof=16;case 6: spdnof=32;case 7: spdnof=64;case 8: spdnof=128;case 9: spdnof=256;case 10: spdnof=512;case 11: spdnof=1024;
endswitch
7.213 チャネル Gの送信数
{ -------------------------------------------------------------------- }{ チャネル Gの送信数 }{ -------------------------------------------------------------------- }
switch(CHG2R.0:3)case 0: spdnog=0;case 1: spdnog=1;case 2: spdnog=2;case 3: spdnog=4;case 4: spdnog=8;case 5: spdnog=16;case 6: spdnog=32;case 7: spdnog=64;case 8: spdnog=128;case 9: spdnog=256;case 10: spdnog=512;case 11: spdnog=1024;
endswitch
7.214 チャネル Hの送信数
{ -------------------------------------------------------------------- }{ チャネル Hの送信数 }{ -------------------------------------------------------------------- }
switch(CHH2R.0:3)case 0: spdnoh=0;case 1: spdnoh=1;case 2: spdnoh=2;case 3: spdnoh=4;case 4: spdnoh=8;case 5: spdnoh=16;case 6: spdnoh=32;case 7: spdnoh=64;case 8: spdnoh=128;case 9: spdnoh=256;case 10: spdnoh=512;case 11: spdnoh=1024;
endswitch
7.215 チャネル Aのメモリ番地 167
7.215 チャネル Aのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Aのメモリ番地 }{ -------------------------------------------------------------------- }
chaaddress.0:3=datapointa.0:3;
7.216 チャネル Bのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Bのメモリ番地 }{ -------------------------------------------------------------------- }
chbaddress.0:3=datapointb.0:3;
7.217 チャネル Cのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Cのメモリ番地 }{ -------------------------------------------------------------------- }
chcaddress.0:3=datapointc.0:3;
7.218 チャネル Dのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Dのメモリ番地 }{ -------------------------------------------------------------------- }
chdaddress.0:3=datapointd.0:3;
7.219 チャネル Eのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Eのメモリ番地 }{ -------------------------------------------------------------------- }
168 第 7章 論理譜
cheaddress.0:3=datapointe.0:3;
7.220 チャネル Fのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Fのメモリ番地 }{ -------------------------------------------------------------------- }
chfaddress.0:3=datapointf.0:3;
7.221 チャネル Gのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Gのメモリ番地 }{ -------------------------------------------------------------------- }
chgaddress.0:3=datapointg.0:3;
7.222 チャネル Hのメモリ番地
{ -------------------------------------------------------------------- }{ チャネル Hのメモリ番地 }{ -------------------------------------------------------------------- }
chhaddress.0:3=datapointh.0:3;
7.223 チャネル Aのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Aのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.0)if (t0chn==0) chacs=1; endif { 通信中 }
elseif (chsela)
if (rs==rsDATA) chacs=1; endif { レジスタ操作 }endif
endif
7.224 チャネル Bのメモリ選択 169
7.224 チャネル Bのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Bのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.1)if (t0chn==1) chbcs=1; endif { 通信中 }
elseif (chselb)
if (rs==rsDATA) chbcs=1; endif { レジスタ操作 }endif
endif
7.225 チャネル Cのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Cのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.2)if (t0chn==2) chccs=1; endif { 通信中 }
elseif (chselc)
if (rs==rsDATA) chccs=1; endif { レジスタ操作 }endif
endif
7.226 チャネル Dのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Cのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.3)if (t0chn==3) chdcs=1; endif { 通信中 }
elseif (chseld)
if (rs==rsDATA) chdcs=1; endif { レジスタ操作 }endif
endif
7.227 チャネル Eのメモリ選択
170 第 7章 論理譜
{ -------------------------------------------------------------------- }{ チャネル Eのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.4)if (t0chn==4) checs=1; endif { 通信中 }
elseif (chsele)
if (rs==rsDATA) checs=1; endif { レジスタ操作 }endif
endif
7.228 チャネル Fのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Fのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.5)if (t0chn==5) chfcs=1; endif { 通信中 }
elseif (chself)
if (rs==rsDATA) chfcs=1; endif { レジスタ操作 }endif
endif
7.229 チャネル Gのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Gのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.6)if (t0chn==6) chgcs=1; endif { 通信中 }
elseif (chselg)
if (rs==rsDATA) chgcs=1; endif { レジスタ操作 }endif
endif
7.230 チャネル Hのメモリ選択
{ -------------------------------------------------------------------- }{ チャネル Hのメモリ選択 }{ -------------------------------------------------------------------- }
if (REQR.7)if (t0chn==7) chhcs=1; endif { 通信中 }
else
7.231 チャネル Aのメモリ書き込み 171
if (chselh)if (rs==rsDATA) chhcs=1; endif { レジスタ操作 }
endifendif
7.231 チャネル Aのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Aのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.0)if (t0chn==0)
if (wp) chawe=1; endifendif
elseif (chawseq==1) chawe=1; endif
endif
7.232 チャネル Bのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Bのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.1)if (t0chn==1)
if (wp) chbwe=1; endifendif
elseif (chbwseq==1) chbwe=1; endif
endif
7.233 チャネル Cのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Cのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.2)if (t0chn==2)
if (wp) chcwe=1; endifendif
elseif (chcwseq==1) chcwe=1; endif
endif
172 第 7章 論理譜
7.234 チャネル Dのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Dのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.3)if (t0chn==3)
if (wp) chdwe=1; endifendif
elseif (chdwseq==1) chdwe=1; endif
endif
7.235 チャネル Eのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Eのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.4)if (t0chn==4)
if (wp) chewe=1; endifendif
elseif (chewseq==1) chewe=1; endif
endif
7.236 チャネル Fのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Fのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.5)if (t0chn==5)
if (wp) chfwe=1; endifendif
elseif (chfwseq==1) chfwe=1; endif
endif
7.237 チャネル Gのメモリ書き込み
7.238 チャネル Hのメモリ書き込み 173
{ -------------------------------------------------------------------- }{ チャネル Gのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.6)if (t0chn==6)
if (wp) chgwe=1; endifendif
elseif (chgwseq==1) chgwe=1; endif
endif
7.238 チャネル Hのメモリ書き込み
{ -------------------------------------------------------------------- }{ チャネル Hのメモリ書き込み }{ -------------------------------------------------------------------- }
if (REQR.7)if (t0chn==7)
if (wp) chhwe=1; endifendif
elseif (chhwseq==1) chhwe=1; endif
endif
7.239 チャネル Aのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Aのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.0)if (t0chn==0)
if (CHA2R.7) chare=1; endifendif
elseif (readreg)
if (chsela)if (rs==rsDATA) chare=1; endif
endifendif
endif
7.240 チャネル Bのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Bのメモリ読み出し }
174 第 7章 論理譜
{ -------------------------------------------------------------------- }if (REQR.1)
if (t0chn==1)if (CHB2R.7) chbre=1; endif
endifelse
if (readreg)if (chselb)
if (rs==rsDATA) chbre=1; endifendif
endifendif
7.241 チャネル Cのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Cのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.2)if (t0chn==2)
if (CHC2R.7) chcre=1; endifendif
elseif (readreg)
if (chselc)if (rs==rsDATA) chcre=1; endif
endifendif
endif
7.242 チャネル Dのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Dのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.3)if (t0chn==3)
if (CHD2R.7) chdre=1; endifendif
elseif (readreg)
if (chseld)if (rs==rsDATA) chdre=1; endif
endifendif
endif
7.243 チャネル Eのメモリ読み出し
7.244 チャネル Fのメモリ読み出し 175
{ -------------------------------------------------------------------- }{ チャネル Eのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.4)if (t0chn==4)
if (CHE2R.7) chere=1; endifendif
elseif (readreg)
if (chsele)if (rs==rsDATA) chere=1; endif
endifendif
endif
7.244 チャネル Fのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Fのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.5)if (t0chn==5)
if (CHF2R.7) chfre=1; endifendif
elseif (readreg)
if (chself)if (rs==rsDATA) chfre=1; endif
endifendif
endif
7.245 チャネル Gのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Gのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.6)if (t0chn==6)
if (CHG2R.7) chgre=1; endifendif
elseif (readreg)
if (chselg)if (rs==rsDATA) chgre=1; endif
endifendif
endif
176 第 7章 論理譜
7.246 チャネル Hのメモリ読み出し
{ -------------------------------------------------------------------- }{ チャネル Hのメモリ読み出し }{ -------------------------------------------------------------------- }
if (REQR.7)if (t0chn==7)
if (CHH2R.7) chhre=1; endifendif
elseif (readreg)
if (chselh)if (rs==rsDATA) chhre=1; endif
endifendif
endif
7.247 チャネル Aの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Aの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.0)if (t0chn==0)
chadataout=q.0:7;endif
elsechadataout=datain;
endif
7.248 チャネル Bの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Bの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.1)if (t0chn==1)
chbdataout=q.0:7;endif
elsechbdataout=datain;
endif
7.249 チャネル Cの書き込みデータ 177
7.249 チャネル Cの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Cの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.2)if (t0chn==2)
chcdataout=q.0:7;endif
elsechcdataout=datain;
endif
7.250 チャネル Dの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Dの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.3)if (t0chn==3)
chddataout=q.0:7;endif
elsechddataout=datain;
endif
7.251 チャネル Eの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Eの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.4)if (t0chn==4)
chedataout=q.0:7;endif
elsechedataout=datain;
endif
7.252 チャネル Fの書き込みデータ
178 第 7章 論理譜
{ -------------------------------------------------------------------- }{ チャネル Fの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.5)if (t0chn==5)
chfdataout=q.0:7;endif
elsechfdataout=datain;
endif
7.253 チャネル Gの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Gの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.6)if (t0chn==6)
chgdataout=q.0:7;endif
elsechgdataout=datain;
endif
7.254 チャネル Hの書き込みデータ
{ -------------------------------------------------------------------- }{ チャネル Hの書き込みデータ }{ -------------------------------------------------------------------- }
if (REQR.7)if (t0chn==7)
chhdataout=q.0:7;endif
elsechhdataout=datain;
endif
7.255 チャネル Aのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Aのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.0)if (t0chn==0)
if (CHA2R.7)
7.256 チャネル Bのデータ方向 179
charw=0;else
charw=1;endif
endifelse
if (chsela)if (rs==rsDATA)
if (writereg) charw=1; endifendif
endifendif
7.256 チャネル Bのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Bのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.1)if (t0chn==1)
if (CHB2R.7)chbrw=0;
elsechbrw=1;
endifendif
elseif (chselb)
if (rs==rsDATA)if (writereg) chbrw=1; endif
endifendif
endif
7.257 チャネル Cのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Cのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.2)if (t0chn==2)
if (CHC2R.7)chcrw=0;
elsechcrw=1;
endifendif
elseif (chselc)
if (rs==rsDATA)if (writereg) chcrw=1; endif
endifendif
180 第 7章 論理譜
endif
7.258 チャネル Dのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Dのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.3)if (t0chn==3)
if (CHD2R.7)chdrw=0;
elsechdrw=1;
endifendif
elseif (chseld)
if (rs==rsDATA)if (writereg) chdrw=1; endif
endifendif
endif
7.259 チャネル Eのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Eのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.4)if (t0chn==4)
if (CHE2R.7)cherw=0;
elsecherw=1;
endifendif
elseif (chsele)
if (rs==rsDATA)if (writereg) cherw=1; endif
endifendif
endif
7.260 チャネル Fのデータ方向
7.261 チャネル Gのデータ方向 181
{ -------------------------------------------------------------------- }{ チャネル Fのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.5)if (t0chn==5)
if (CHF2R.7)chfrw=0;
elsechfrw=1;
endifendif
elseif (chself)
if (rs==rsDATA)if (writereg) chfrw=1; endif
endifendif
endif
7.261 チャネル Gのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Gのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.6)if (t0chn==6)
if (CHG2R.7)chgrw=0;
elsechgrw=1;
endifendif
elseif (chselg)
if (rs==rsDATA)if (writereg) chgrw=1; endif
endifendif
endif
7.262 チャネル Hのデータ方向
{ -------------------------------------------------------------------- }{ チャネル Hのデータ方向 }{ -------------------------------------------------------------------- }
if (REQR.7)if (t0chn==7)
if (CHH2R.7)chhrw=0;
elsechhrw=1;
endif
182 第 7章 論理譜
endifelse
if (chselh)if (rs==rsDATA)
if (writereg) chhrw=1; endifendif
endifendif
7.263 チャネル Aの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Aの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chawseq=0;
elseswitch(chawseq)
case 0:if (chsela)
if (rs==rsDATA)if (writereg) chawseq=1; endif
endifendif
case 1: chawseq=2;case 2:
if (writereg)chawseq=chawseq;
elsechawseq=3;
endifcase 3: chawseq=0;
endswitchendif
7.264 チャネル Bの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Bの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chbwseq=0;
elseswitch(chbwseq)
case 0:if (chselb)
if (rs==rsDATA)if (writereg) chbwseq=1; endif
endifendif
case 1: chbwseq=2;case 2:
if (writereg)
7.265 チャネル Cの書き込み行程 183
chbwseq=chbwseq;else
chbwseq=3;endif
case 3: chbwseq=0;endswitch
endif
7.265 チャネル Cの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Cの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chcwseq=0;
elseswitch(chcwseq)
case 0:if (chselc)
if (rs==rsDATA)if (writereg) chcwseq=1; endif
endifendif
case 1: chcwseq=2;case 2:
if (writereg)chcwseq=chcwseq;
elsechcwseq=3;
endifcase 3: chcwseq=0;
endswitchendif
7.266 チャネル Dの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Dの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chdwseq=0;
elseswitch(chdwseq)
case 0:if (chseld)
if (rs==rsDATA)if (writereg) chdwseq=1; endif
endifendif
case 1: chdwseq=2;case 2:
if (writereg)chdwseq=chdwseq;
184 第 7章 論理譜
elsechdwseq=3;
endifcase 3: chdwseq=0;
endswitchendif
7.267 チャネル Eの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Eの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chewseq=0;
elseswitch(chewseq)
case 0:if (chsele)
if (rs==rsDATA)if (writereg) chewseq=1; endif
endifendif
case 1: chewseq=2;case 2:
if (writereg)chewseq=chewseq;
elsechewseq=3;
endifcase 3: chewseq=0;
endswitchendif
7.268 チャネル Fの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Fの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chfwseq=0;
elseswitch(chfwseq)
case 0:if (chself)
if (rs==rsDATA)if (writereg) chfwseq=1; endif
endifendif
case 1: chfwseq=2;case 2:
if (writereg)chfwseq=chfwseq;
else
7.269 チャネル Gの書き込み行程 185
chfwseq=3;endif
case 3: chfwseq=0;endswitch
endif
7.269 チャネル Gの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Gの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chgwseq=0;
elseswitch(chgwseq)
case 0:if (chselg)
if (rs==rsDATA)if (writereg) chgwseq=1; endif
endifendif
case 1: chgwseq=2;case 2:
if (writereg)chgwseq=chgwseq;
elsechgwseq=3;
endifcase 3: chgwseq=0;
endswitchendif
7.270 チャネル Hの書き込み行程
{ -------------------------------------------------------------------- }{ チャネル Hの書き込み行程 }{ -------------------------------------------------------------------- }
if (reset)chhwseq=0;
elseswitch(chhwseq)
case 0:if (chselh)
if (rs==rsDATA)if (writereg) chhwseq=1; endif
endifendif
case 1: chhwseq=2;case 2:
if (writereg)chhwseq=chhwseq;
elsechhwseq=3;
186 第 7章 論理譜
endifcase 3: chhwseq=0;
endswitchendif
7.271 チャネル Aのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Aのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chapkcount=0;
elseif (writereg)
if (chsela)if (rs==rsPOINT)
if (datain.1)chapkcount=0;
elsechapkcount=chapkcount;
endifelse
chapkcount=chapkcount;endif
elsechapkcount=chapkcount;
endifelse
if (chapknext)chapkcount.0=!chapkcount.0;chapkcount.1=1;
elsechapkcount=chapkcount;
endifendif
endif
7.272 チャネル Bのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Bのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chbpkcount=0;
elseif (writereg)
if (chselb)if (rs==rsPOINT)
if (datain.1)chbpkcount=0;
elsechbpkcount=chbpkcount;
endif
7.273 チャネル Cのパケット計数 187
elsechbpkcount=chbpkcount;
endifelse
chbpkcount=chbpkcount;endif
elseif (chbpknext)
chbpkcount.0=!chbpkcount.0;chbpkcount.1=1;
elsechbpkcount=chbpkcount;
endifendif
endif
7.273 チャネル Cのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Cのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chcpkcount=0;
elseif (writereg)
if (chselc)if (rs==rsPOINT)
if (datain.1)chcpkcount=0;
elsechcpkcount=chcpkcount;
endifelse
chcpkcount=chcpkcount;endif
elsechcpkcount=chcpkcount;
endifelse
if (chcpknext)chcpkcount.0=!chcpkcount.0;chcpkcount.1=1;
elsechcpkcount=chcpkcount;
endifendif
endif
7.274 チャネル Dのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Dのパケット計数 }{ -------------------------------------------------------------------- }
188 第 7章 論理譜
if (reset)chdpkcount=0;
elseif (writereg)
if (chseld)if (rs==rsPOINT)
if (datain.1)chdpkcount=0;
elsechdpkcount=chdpkcount;
endifelse
chdpkcount=chdpkcount;endif
elsechdpkcount=chdpkcount;
endifelse
if (chdpknext)chdpkcount.0=!chdpkcount.0;chdpkcount.1=1;
elsechdpkcount=chdpkcount;
endifendif
endif
7.275 チャネル Eのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Eのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chepkcount=0;
elseif (writereg)
if (chsele)if (rs==rsPOINT)
if (datain.1)chepkcount=0;
elsechepkcount=chepkcount;
endifelse
chepkcount=chepkcount;endif
elsechepkcount=chepkcount;
endifelse
if (chepknext)chepkcount.0=!chepkcount.0;chepkcount.1=1;
elsechepkcount=chepkcount;
endifendif
endif
7.276 チャネル Fのパケット計数 189
7.276 チャネル Fのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Fのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chfpkcount=0;
elseif (writereg)
if (chself)if (rs==rsPOINT)
if (datain.1)chfpkcount=0;
elsechfpkcount=chfpkcount;
endifelse
chfpkcount=chfpkcount;endif
elsechfpkcount=chfpkcount;
endifelse
if (chfpknext)chfpkcount.0=!chfpkcount.0;chfpkcount.1=1;
elsechfpkcount=chfpkcount;
endifendif
endif
7.277 チャネル Gのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Gのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chgpkcount=0;
elseif (writereg)
if (chselg)if (rs==rsPOINT)
if (datain.1)chgpkcount=0;
elsechgpkcount=chgpkcount;
endifelse
chgpkcount=chgpkcount;endif
elsechgpkcount=chgpkcount;
190 第 7章 論理譜
endifelse
if (chgpknext)chgpkcount.0=!chgpkcount.0;chgpkcount.1=1;
elsechgpkcount=chgpkcount;
endifendif
endif
7.278 チャネル Hのパケット計数
{ -------------------------------------------------------------------- }{ チャネル Hのパケット計数 }{ -------------------------------------------------------------------- }
if (reset)chhpkcount=0;
elseif (writereg)
if (chselh)if (rs==rsPOINT)
if (datain.1)chhpkcount=0;
elsechhpkcount=chhpkcount;
endifelse
chhpkcount=chhpkcount;endif
elsechhpkcount=chhpkcount;
endifelse
if (chhpknext)chhpkcount.0=!chhpkcount.0;chhpkcount.1=1;
elsechhpkcount=chhpkcount;
endifendif
endif
7.279 端子 0のパケット計数
{ -------------------------------------------------------------------- }{ 端子 0のパケット計数 }{ -------------------------------------------------------------------- }
switch(t0chn)case 0: t0segpkcount=chapkcount;case 1: t0segpkcount=chbpkcount;case 2: t0segpkcount=chcpkcount;case 3: t0segpkcount=chdpkcount;
7.280 チャネル Aの通信データ位置 191
case 4: t0segpkcount=chepkcount;case 5: t0segpkcount=chfpkcount;case 6: t0segpkcount=chgpkcount;case 7: t0segpkcount=chhpkcount;
endswitch
7.280 チャネル Aの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Aの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointa=0;
elseif (writereg) { 初期位置 }
if (chsela)if (rs==rsPOINT)
if (datain.0)datapointa.0:3=0;datapointa.4:11=0;
elsedatapointa=datapointa;
endifelse
datapointa=datapointa;endif
elsedatapointa=datapointa;
endifelse
if (chawseq==3) { レジスタ経由データ書き込み }datapointa=datapointa+1;
elseif (rp|wp) { 通信による位置操作 }
datapointa=datapointa+1;else
datapointa=datapointa;endif
endifendif
endif
7.281 チャネル Bの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Bの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointb=0;
elseif (writereg)
if (chselb)if (rs==rsPOINT)
192 第 7章 論理譜
if (datain.0)datapointb.0:3=0;datapointb.4:11=0;
elsedatapointb=datapointb;
endifelse
datapointb=datapointb;endif
elsedatapointb=datapointb;
endifelse
if (rp)datapointb=datapointb+1;
elsedatapointb=datapointb;
endifendif
endif
7.282 チャネル Cの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Cの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointc=0;
elseif (writereg)
if (chselc)if (rs==rsPOINT)
if (datain.0)datapointc.0:3=0;datapointc.4:11=0;
elsedatapointc=datapointc;
endifelse
datapointc=datapointc;endif
elsedatapointc=datapointc;
endifelse
if (rp)datapointc=datapointc+1;
elsedatapointc=datapointc;
endifendif
endif
7.283 チャネル Dの通信データ位置
7.284 チャネル Eの通信データ位置 193
{ -------------------------------------------------------------------- }{ チャネル Dの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointd=0;
elseif (writereg)
if (chseld)if (rs==rsPOINT)
if (datain.0)datapointd.0:3=0;datapointd.4:11=0;
elsedatapointd=datapointd;
endifelse
datapointd=datapointd;endif
elsedatapointd=datapointd;
endifelse
if (rp)datapointd=datapointd+1;
elsedatapointd=datapointd;
endifendif
endif
7.284 チャネル Eの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Eの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointe=0;
elseif (writereg)
if (chsele)if (rs==rsPOINT)
if (datain.0)datapointe.0:3=0;datapointe.4:11=0;
elsedatapointe=datapointe;
endifelse
datapointe=datapointe;endif
elsedatapointe=datapointe;
endifelse
if (rp)datapointe=datapointe+1;
else
194 第 7章 論理譜
datapointe=datapointe;endif
endifendif
7.285 チャネル Fの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Fの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointf=0;
elseif (writereg)
if (chself)if (rs==rsPOINT)
if (datain.0)datapointf.0:3=0;datapointf.4:11=0;
elsedatapointf=datapointf;
endifelse
datapointf=datapointf;endif
elsedatapointf=datapointf;
endifelse
if (rp)datapointf=datapointf+1;
elsedatapointf=datapointf;
endifendif
endif
7.286 チャネル Gの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Gの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointg=0;
elseif (writereg)
if (chselg)if (rs==rsPOINT)
if (datain.0)datapointg.0:3=0;datapointg.4:11=0;
elsedatapointg=datapointg;
7.287 チャネル Hの通信データ位置 195
endifelse
datapointg=datapointg;endif
elsedatapointg=datapointg;
endifelse
if (rp)datapointg=datapointg+1;
elsedatapointg=datapointg;
endifendif
endif
7.287 チャネル Hの通信データ位置
{ -------------------------------------------------------------------- }{ チャネル Hの通信データ位置 }{ -------------------------------------------------------------------- }
if (reset)datapointh=0;
elseif (writereg)
if (chselh)if (rs==rsPOINT)
if (datain.0)datapointh.0:3=0;datapointh.4:11=0;
elsedatapointh=datapointh;
endifelse
datapointh=datapointh;endif
elsedatapointh=datapointh;
endifelse
if (rp)datapointh=datapointh+1;
elsedatapointh=datapointh;
endifendif
endif
7.288 端子 0のチャネルの通信要求
{ -------------------------------------------------------------------- }{ 端子 0のチャネルの通信要求 }{ -------------------------------------------------------------------- }
196 第 7章 論理譜
switch(t0chn)case 0: t0segreq=REQR.0;case 1: t0segreq=REQR.1;case 2: t0segreq=REQR.2;case 3: t0segreq=REQR.3;case 4: t0segreq=REQR.4;case 5: t0segreq=REQR.5;case 6: t0segreq=REQR.6;case 7: t0segreq=REQR.7;
endswitch
7.289 受信 EOPの遅延
{ -------------------------------------------------------------------- }{ 受信 EOPの遅延 }{ -------------------------------------------------------------------- }
delayeop=usbport.25:32;
endp
endlogic
199
第 8章
手続き
logicname usblib
8.1 CRC5
{ ==================================================================== }{ 05C03RCRC5 }{ ==================================================================== }procedure crc5
8.1.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input res; { 初期化 }input ep; { 能動点 }input sin; { ビットデータ }
8.1.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output q[5];
8.1.3 内部信号
200 第 8章 手続き
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr rq[5];
8.1.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
q = rq;
8.1.5 CRC計算
{ -------------------------------------------------------------------- }{ CRC計算 }{ -------------------------------------------------------------------- }
if (res)rq = 0;
elseif (ep)
rq.0 = rq.4 ^ sin;rq.2 = rq.1 ^ (rq.4 ^ sin);
rq.1 = rq.0;rq.3 = rq.2;rq.4 = rq.3;
elserq=rq;
endifendif
endp
8.2 ディスクリプタデータ
{ ==================================================================== }{ 05A06Aディスクリプタデータ }{ ==================================================================== }procedure descriptor
8.2 ディスクリプタデータ 201
8.2.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input desctype[8];input count[6];
8.2.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[14];
8.2.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitn descdata[8];bitn descaddr[6];
8.2.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0:7=descdata;Q.8:13=descaddr;
8.2.5 ディスクリプタ位置
{ -------------------------------------------------------------------- }{ ディスクリプタ位置 }{ -------------------------------------------------------------------- }
202 第 8章 手続き
switch(desctype)case 1: { デバイス }
descaddr=count;case 2: { コンフィギュレーション }
descaddr=18+count;case 3: { ストリング }
endswitch
8.2.6 ディスクリプタデータ
{ -------------------------------------------------------------------- }{ ディスクリプタデータ }{ -------------------------------------------------------------------- }
switch(descaddr){ -------------------------------------- }{ デバイスディスクリプタ }{ -------------------------------------- }case 0: descdata=18; { bLength : ディスクリプタのサイズ }case 1: descdata=1; { bDescriptorType : ディスクリプタ・タイプ }case 2: descdata=0; { bcdUSB : USB仕様リリース番号 no.1 }case 3: descdata=0; { bcdUSB : USB仕様リリース番号 no.2 }case 4: descdata=0; { bDeviceClass : クラスコード }case 5: descdata=0; { bDeviceSubClass : サブクラスコード }case 6: descdata=0; { bDeviceProtocol : プロトコルコード }case 7: descdata=20; { bMaxPacketSize0 : エンドポイント 0の最大パケットサイズ }case 8: descdata=1; { idVendor : ベンダ ID no.1 }case 9: descdata=2; { idVendor : ベンダ ID no.2 }case 10: descdata=3; { idProduct : プロダクト ID no.1 }case 11: descdata=4; { idProduct : プロダクト ID no.2 }case 12: descdata=5; { bcdDevice : デバイスリリース番号 no.1 }case 13: descdata=6; { bcdDevice : デバイスリリース番号 no.2 }case 14: descdata=7; { iManufacturer : 製造者文字列インデックス }case 15: descdata=8; { iProduct : 製品文字列インデックス }case 16: descdata=9; { iSerialNumber : 製造番号文字列インデックス }case 17: descdata=10; { bNumConfigurations : 可能な構成の数 }{ -------------------------------------- }{ コンフィギュレーションディスクリプタ }{ -------------------------------------- }case 18: descdata=9; { bLength : ディスクリプタのサイズ }case 19: descdata=2; { bDescriptorType : ディスクリプタ・タイプ }case 20: descdata=41; { wTotalLength : 本構成の合計サイズ no.1 }case 21: descdata=0; { wTotalLength : 本構成の合計サイズ no.2 }case 22: descdata=0; { bNumInterface : 本構成のインターフェースの数 }case 23: descdata=0; { bConfigurationValue : 本構成の選択番号 }case 24: descdata=255; { iConfiguration : 本構成の文字列インデックス }
{ D7: 1, D6: 自己電源, D5: リモートウェイクアップ, D4-D0: 0 }case 25: descdata=0; { bmAttributes : 本構成の特性 }
{ 2mA * N }case 26: descdata=0; { MaxPower : 最大電力消費量 }{ -------------------------------------- }{ インターフェースディスクリプタ }{ -------------------------------------- }case 27: descdata=9; { bLength : ディスクリプタのサイズ }case 28: descdata=4; { bDescriptorType : ディスクリプタ・タイプ }case 29: descdata=0; { bInterfaceNumber : インタフェースの番号 }case 30: descdata=0; { bAlternateSetting : 代替設定を選択するための値 }
8.3 コントロール転送以外の状態 203
case 31: descdata=2; { bNumEndpoints : 本インターフェースのエンドポイントの数 }case 32: descdata=0; { bInterfaceClass : クラスコード }case 33: descdata=0; { bInterfaceSubClass : サブクラスコード }case 34: descdata=0; { bInterfaceProtocol : プロトコルコード }case 35: descdata=0; { iInterface : 本インターフェースの文字列 }{ -------------------------------------- }{ エンドポイントディスクリプタ }{ -------------------------------------- }case 36: descdata=7; { bLength : ディスクリプタのサイズ }case 37: descdata=5; { bDescriptorType : ディスクリプタ・タイプ }
{ D7: 方向 (OUT:0/IN:1), D6-D4: 0, D3-D0: 番号 }case 38: descdata=0x81; { bEndpointAddess : エンドポイントのアドレス }
{ D1-D0: 転送タイプ 00=Control/01=Isochronous/10=Bulk/11:Interrupt}case 39: descdata=3; { bmAttributes : エンドポイントの属性 }case 40: descdata=1; { wMaxPacketSize : 本エンドポイントの最大パケットサイズ no.1 }case 41: descdata=0; { wMaxPacketSize : 本エンドポイントの最大パケットサイズ no.2 }
{ Isoの場合は 1, Interでは 1 ~ 255 }case 42: descdata=1; { bInterval : ポーリング間隔 }{ -------------------------------------- }{ エンドポイントディスクリプタ }{ -------------------------------------- }case 43: descdata=7; { bLength : ディスクリプタのサイズ }case 44: descdata=5; { bDescriptorType : ディスクリプタ・タイプ }
{ D7: 方向 (OUT:0/IN:1), D6-D4: 0, D3-D0: 番号 }case 45: descdata=0x02; { bEndpointAddess : エンドポイントのアドレス }
{ D1-D0: 転送タイプ 00=Control/01=Isochronous/10=Bulk/11:Interrupt}case 46: descdata=3; { bmAttributes : エンドポイントの属性 }case 47: descdata=1; { wMaxPacketSize : 本エンドポイントの最大パケットサイズ no.1 }case 48: descdata=0; { wMaxPacketSize : 本エンドポイントの最大パケットサイズ no.2 }
{ Isoの場合は 1, Interでは 1 ~ 255 }case 49: descdata=1; { bInterval : ポーリング間隔 }
endswitch
endp
8.3 コントロール転送以外の状態
{ ==================================================================== }{ 05B03Aコントロール転送以外の状態 }{ -------------------------------------------------------------------- }{ 通常転送 }{ 0 : 応答なし }{ 1 : データ受信 }{ 2 : データ送信 }{ 3 : ハンドシェーク送信 }{ 4 : ハンドシェーク受信 }{ 5 : データ再送 }{ 6 : 正常終了 }{ 7 : 異常終了 }
204 第 8章 手続き
図 8.1 コントロール転送以外の状態
応答なし
異常終了
正常終了
データ受信
ハンドシェーク送信
データ送信
ハンドシェーク受信
データ再送
タイムアウト
Da t a 受信NAK送信
OUT受信
ACK送信
I N受信
ACK受信
NAK受信
送信終了
送信終了
タイムアウトS t a l l 受信
5
4
2
6
0
7
3
1
{ ==================================================================== }procedure usbstate
8.3.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset;input respid[4]; { 送信応答用 PID 記憶 }input comtime[8]; { 無通信時間 }input seope; { 送信 eop 終了 }input spid[4]; { 送信パケットの PID }input tmode[2]; { 転送種類 }input usbconnect;
8.3.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[3];
8.3.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr st[3];
8.3 コントロール転送以外の状態 205
8.3.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q=st;
8.3.5 コントロール転送以外の状態
{ -------------------------------------------------------------------- }{ コントロール転送以外の状態 }{ -------------------------------------------------------------------- }
if (reset)st=0;
elseif (tmode!=0)
switch(st)case 0: { *応答なし }
if (usbconnect)if (respid==1) st=1; endif { OUT受信 }if (respid==9) st=2; endif { IN受信 }
endifcase 1: { *データ受信 }
if ((respid==3)|(respid==11)) { Data受信 }if (tmode==3)
st=6;else
st=3;endif
elseif (comtime>64) { タイムアウト }
st=7;else
st=st;endif
endifcase 2: { *データ送信 }
if (seope) { 送信終了 }if (tmode==3)
st=6;else
st=4;endif
elsest=st;
endifcase 3: { *ハンドシェーク送信 }
if (seope)switch(spid)
case 2: st=6; { ACK送信 }case 10: st=7; { NAK送信 }default: st=st;
endswitchelse
206 第 8章 手続き
st=st;endif
case 4: { *ハンドシェーク受信 }switch(respid)
case 2: st=6; { ACK受信 }case 10: st=7; { NAK受信 }default: st=st;
endswitchcase 6: { *正常終了 }case 7: { *異常終了 }
endswitchendif
endif
endp
8.4 コントロール転送の状態
図 8.2 コントロール転送状態
応答なし データ受信
待機
データ送信
ハンドシェーク受信 ハンドシェーク受信
データ再送
データ受信
ハンドシェーク送信
ハンドシェーク送信
I N受信
OUT受信
Da t a 送信
終了送信
Da t a 受信
NAK送信ACK送信
終了受信
ACK送信
ACK受信
NAK受信 送信終了
ACK受信
S E T UP受信
ハンドシェーク送信
Da t a 受信
ACK送信
S E T UPステージ
S t a t u s ステージ
St a t u sステージ
Da t a ステージ
データ再送
NAK受信送信終了
正常終了
異常終了へ
タイムアウト
タイムアウト
タイムアウト
異常終了
データエラー
タイムアウト
1C
00
1D
11
12
13 14
15
16 17
18
19
1A1B
{ ==================================================================== }{ 05A05Aコントロール転送の状態 }{ -------------------------------------------------------------------- }{ コントロール転送 }{ 0x11 : データ受信 }{ 0x12 : ハンドシェーク送信 }{ 0x13 : 待機 }{ 0x14 : データ受信 }{ 0x15 : データ送信 }
8.4 コントロール転送の状態 207
{ 0x16 : ハンドシェーク受信 Statusステージ }{ 0x17 : ハンドシェーク受信 Dataステージ }{ 0x18 : ハンドシェーク送信 Dataステージ }{ 0x19 : ハンドシェーク送信 Statusステージ }{ 0x1a : データ再送 Statusステージ }{ 0x1b : データ再送 Dataステージ }{ 0x1c : 正常終了 }{ 0x1d : 異常終了 }{ ==================================================================== }procedure usbcstate
8.4.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset;input respid[4]; { 送信応答用 PID 記憶 }input comtime[8]; { 無通信時間 }input seope; { 送信 eop 終了 }input spid[4]; { 送信パケットの PID }input crc16c; { CRC16検査結果 }input ssPACKET; { 終了送信 }input pdsize[11]; { 受信したパケットのデータ数 }input tmode[2];input usbconnect;
8.4.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[5];
8.4.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr st[5];
8.4.4 出力代入
208 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q=st;
8.4.5 状態
{ -------------------------------------------------------------------- }{ 状態 }{ -------------------------------------------------------------------- }
if (reset)st=0;
elseif (tmode==0)
switch(st)case 0: { *待機 }
if (usbconnect)if (respid==13) st=0x11; endif
endifcase 0x11: { *データ受信 }
if (comtime>64) { タイムアウト }st=0x1d;
elseif ((respid==3)|(respid==11)) { Data受信 }
st=0x12;else
st=st;endif
endif{ SETUPステージ }
case 0x12: { *ハンドシェーク送信 }if (crc16c) { データエラー }
if (seope) { ACK送信 }st=0x13;
elsest=st;
endifelse
st=0x1d;endif
{ Dataステージ }case 0x13: { 待機 }
switch(respid)case 1: st=0x14; { OUT受信 }case 9: st=0x15; { IN受信 }default: st=st;
endswitchcase 0x14: { *データ受信 }
if (comtime>64) { タイムアウト }st=0x1d;
elseif ((respid==3)|(respid==11))
if (pdsize==0) { 終了受信 }st=0x19;
else { Data受信 }st=0x18;
endif
8.5 コンフィギュレーション 209
elsest=st;
endifendif
case 0x15: { *データ送信 }if (seope)
if (ssPACKET) { 終了送信 }st=0x16;
else { Data送信 }st=0x17;
endifelse
st=st;endif
case 0x16: { *ハンドシェーク受信 }if (comtime>64) { タイムアウト }
st=0x1d;else
switch(respid)case 2: st=0x1c; { ACK受信 }case 10: st=0x13; { NAK受信 }default: st=st;
endswitchendif
case 0x17: { *ハンドシェーク受信 }if (comtime>64)
st=0x1d; { タイムアウト }else
switch(respid)case 2: st=0x13; { ACK受信 }case 10: st=0x13; { NAK受信 }default: st=st;
endswitchendif
case 0x18: { *ハンドシェーク送信 }if (seope)
switch(spid.0:3)case 2: st=0x13; { ACK送信 }case 10: st=0x13; { NAK送信 }default: st=st;
endswitchelse
st=st;endif
case 0x19: { *ハンドシェーク送信 }if (seope)
st=0x1c; { ACK送信 }else
st=st;endif
case 0x1c: { *正常終了 }case 0x1d: { *異常終了 }
if (respid!=0) st=st; endifendswitch
endifendif
endp
8.5 コンフィギュレーション
210 第 8章 手続き
{ ==================================================================== }{ 05A01Eコンフィギュレーション }{ -------------------------------------------------------------------- }{ bm_Request_Type 00h }{ bRequest 09h }{ ==================================================================== }procedure devcf
8.5.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset;input devreqvalid;input devreq0d[8];input devreq1d[8];input devreq2d[8];
8.5.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[8];
8.5.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr dcf[8];
8.5.4 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }
Q=dcf;
8.6 代替値 211
8.5.5 コンフィギュレーション値
{ -------------------------------------------------------------------- }{ コンフィギュレーション値 }{ -------------------------------------------------------------------- }
if (reset)dcf=0;
elseif (devreqvalid)
if ((devreq0d==0)&(devreq1d==9))dcf=devreq2d;
elsedcf=dcf;
endifelse
dcf=dcf;endif
endif
endp
8.6 代替値
{ ==================================================================== }{ 05A01D代替値 }{ -------------------------------------------------------------------- }{ bm_Request_Type 01h }{ bRequest 0bh }{ ==================================================================== }procedure devint
8.6.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset;input devreqvalid;input devreq0d[8];input devreq1d[8];input devreq2d[8];
8.6.2 出力
212 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[8];
8.6.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr dif[8];
8.6.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q=dif;
8.6.5 代替値
{ -------------------------------------------------------------------- }{ 代替値 }{ -------------------------------------------------------------------- }
if (reset)dif=0;
elseif (devreqvalid)
if ((devreq0d==1)&(devreq1d==0xb))dif=devreq2d;
elsedif=dif;
endifelse
dif=dif;endif
endif
endp
8.7 Tokenパケット取得 213
8.7 Tokenパケット取得
{ ==================================================================== }{ 05C05HTokenパケット取得 }{ ==================================================================== }procedure getSOForToken
8.7.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input data; { ビットデータ }input sp; { ビット起点 }input pidpass; { PID通過 }
8.7.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[38];
8.7.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr sr[16];bitr bc[5];bitr fn[11];bitn crc5d[5];bitn invpidpass;bitr rcrc5[5];
8.7.4 出力代入
214 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0:10=fn;Q.11:15=crc5d;Q.16=(bc==16)&sp;Q.17:32=sr;Q.33:37=bc;
8.7.5 CRC5計算
{ -------------------------------------------------------------------- }{ CRC5計算 }{ -------------------------------------------------------------------- }
invpidpass=!pidpass;
8.7.6 手続き crc5引用
{ -------------------------------------------------------------------- }{ 手続き crc5引用 }{ -------------------------------------------------------------------- }
crc5d=crc5(invpidpass,sp,data);
8.7.7 シフトレジスタ
{ -------------------------------------------------------------------- }{ シフトレジスタ }{ -------------------------------------------------------------------- }
if (pidpass)if (sp)
sr.0=data;sr.1:15=sr.0:14;
elsesr=sr;
endifendif
8.7.8 ビット計数器
{ -------------------------------------------------------------------- }
8.8 Token情報取得 215
{ ビット計数器 }{ -------------------------------------------------------------------- }
if (pidpass)if (sp)
bc=bc+1;else
bc=bc;endif
endif
8.7.9 11ビットデータ記憶
{ -------------------------------------------------------------------- }{ 11ビットデータ記憶 }{ -------------------------------------------------------------------- }
if (bc==11)if (sp)
fn=sr.10:0;else
fn=fn;endif
elsefn=fn;
endifendp
8.8 Token情報取得
{ ==================================================================== }{ 05C06CToken情報取得 }{ ==================================================================== }procedure getPACKET
8.8.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input eopp; { EOP終了起点 }input pid[9]; { PID }input bit11d[11]; { Token }input crc5; { CRC5 }
216 第 8章 手続き
8.8.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[34];
8.8.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr rpid[8];bitr fn[11];bitr ferr;bitr usbaddr[7];bitr endpoint[4];bitr st[3];bitr deopp[4];
8.8.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0:7=rpid;Q.8:18=fn;Q.19:25=usbaddr;Q.26:29=endpoint;Q.30:32=st;Q.33=ferr;
8.8.5 eopp遅延
{ -------------------------------------------------------------------- }{ eopp遅延 }{ -------------------------------------------------------------------- }
if (reset)deopp=0;
elsedeopp.0=eopp;deopp.1:3=deopp.0:2;
8.8 Token情報取得 217
endif
8.8.6 PID設置
{ -------------------------------------------------------------------- }{ PID設置 }{ -------------------------------------------------------------------- }
if (reset)rpid=0;
elseif (eopp)
if (pid.8) { PID エラー }rpid=0;
elserpid=pid.0:7; { PID 設置 }
endifelse
rpid=rpid;endif
endif
8.8.7 フレーム番号設置
{ -------------------------------------------------------------------- }{ フレーム番号設置 }{ -------------------------------------------------------------------- }
if (reset)fn=0;
elseif (deopp.3)
if (rpid.0:3==5) { SOF パケット }if (crc5)
fn=bit11d.0:10; { フレーム番号 設置 }else { CRC5 エラー }
fn=0;endif
elsefn=fn;
endifelse
fn=fn;endif
endif
8.8.8 フレーム番号エラー
{ -------------------------------------------------------------------- }
218 第 8章 手続き
{ フレーム番号エラー }{ -------------------------------------------------------------------- }
if (reset)ferr=0;
elseif (rpid.0:3==5) { SOF パケット }
if (crc5)ferr=0;
else { CRC5 エラー }ferr=1;
endifelse
ferr=ferr;endif
endif
8.8.9 アドレス
{ -------------------------------------------------------------------- }{ アドレス }{ -------------------------------------------------------------------- }
if (reset)usbaddr=0;
elseif (deopp.3)
if ((rpid.0:3==1)|(rpid.0:3==9)|(rpid.0:3==13)) { SOF 以外の Token パケット }if (crc5) { CRC5 正常 }
usbaddr=bit11d.0:6;endif
elseusbaddr=usbaddr;
endifelse
usbaddr=usbaddr;endif
endif
8.8.10 エンドポイント
{ -------------------------------------------------------------------- }{ エンドポイント }{ -------------------------------------------------------------------- }
if (reset)endpoint=0;
elseif (deopp.3)
if ((rpid.0:3==1)|(rpid.0:3==9)|(rpid.0:3==13)) { SOF 以外の Token パケット }if (crc5) { CRC5 正常 }
endpoint=bit11d.7:10;endif
elseendpoint=endpoint;
endif
8.9 デバイスリクエスト 219
elseendpoint=endpoint;
endifendif
8.8.11 Token取得状態
{ -------------------------------------------------------------------- }{ Token取得状態 }{ -------------------------------------------------------------------- }
if (reset)st=0;
elseif (deopp.3)
st.0=rpid==0;st.1=crc5;st.2=ferr;
elsest=st;
endifendif
endp
8.9 デバイスリクエスト
{ ==================================================================== }{ 05C06Lデバイスリクエスト }{ ==================================================================== }procedure devreq
8.9.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input bytesp; { バイト起点 }input count[4]; { PID後バイト数 }input q[8]; { バイトデータ }
8.9.2 出力
220 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[64];
8.9.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr devreq0d[8];bitr devreq1d[8];bitr devreq2d[8];bitr devreq3d[8];bitr devreq4d[8];bitr devreq5d[8];bitr devreq6d[8];bitr devreq7d[8];
8.9.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0:7 =devreq0d.0:7;Q.8:15 =devreq1d.0:7;Q.16:23=devreq2d.0:7;Q.24:31=devreq3d.0:7;Q.32:39=devreq4d.0:7;Q.40:47=devreq5d.0:7;Q.48:55=devreq6d.0:7;Q.56:63=devreq7d.0:7;
8.9.5 デバイスリクエスト byte0
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte0 }{ -------------------------------------------------------------------- }
if (reset)devreq0d=0;
elseif (bytesp)
if (count==0)devreq0d=q.0:7;
else
8.9 デバイスリクエスト 221
devreq0d=devreq0d;endif
elsedevreq0d=devreq0d;
endifendif
8.9.6 デバイスリクエスト byte1
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte1 }{ -------------------------------------------------------------------- }
if (reset)devreq1d=0;
elseif (bytesp)
if (count==1)devreq1d=q.0:7;
elsedevreq1d=devreq1d;
endifelse
devreq1d=devreq1d;endif
endif
8.9.7 デバイスリクエスト byte2
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte2 }{ -------------------------------------------------------------------- }
if (reset)devreq2d=0;
elseif (bytesp)
if (count==2)devreq2d=q.0:7;
elsedevreq2d=devreq2d;
endifelse
devreq2d=devreq2d;endif
endif
8.9.8 デバイスリクエスト byte3
222 第 8章 手続き
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte3 }{ -------------------------------------------------------------------- }
if (reset)devreq3d=0;
elseif (bytesp)
if (count==3)devreq3d=q.0:7;
elsedevreq3d=devreq3d;
endifelse
devreq3d=devreq3d;endif
endif
8.9.9 デバイスリクエスト byte4
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte4 }{ -------------------------------------------------------------------- }
if (reset)devreq4d=0;
elseif (bytesp)
if (count==4)devreq4d=q.0:7;
elsedevreq4d=devreq4d;
endifelse
devreq4d=devreq4d;endif
endif
8.9.10 デバイスリクエスト byte5
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte5 }{ -------------------------------------------------------------------- }
if (reset)devreq5d=0;
elseif (bytesp)
if (count==5)devreq5d=q.0:7;
elsedevreq5d=devreq5d;
endifelse
devreq5d=devreq5d;endif
8.10 番地 223
endif
8.9.11 デバイスリクエスト byte6
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte6 }{ -------------------------------------------------------------------- }
if (reset)devreq6d=0;
elseif (bytesp)
if (count==6)devreq6d=q.0:7;
elsedevreq6d=devreq6d;
endifelse
devreq6d=devreq6d;endif
endif
8.9.12 デバイスリクエスト byte7
{ -------------------------------------------------------------------- }{ デバイスリクエスト byte7 }{ -------------------------------------------------------------------- }
if (reset)devreq7d=0;
elseif (bytesp)
if (count==7)devreq7d=q.0:7;
elsedevreq7d=devreq7d;
endifelse
devreq7d=devreq7d;endif
endif
endp
8.10 番地
{ ==================================================================== }{ 05C06X番地 }{ -------------------------------------------------------------------- }
224 第 8章 手続き
{ bm_Request_Type 00h }{ bRequest 05h }{ ==================================================================== }procedure devaddr
8.10.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input devreqvalid; { デバイスリクエスト確定 }input devreq0d[8]; { 0番 }input devreq1d[8]; { 1番 }input devreq2d[8]; { 2番 }
8.10.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[8];
8.10.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr addr[8];
8.10.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q=addr;
8.10.5 アドレス
8.11 EOP取得 225
{ -------------------------------------------------------------------- }{ アドレス }{ -------------------------------------------------------------------- }
if (reset)addr=0;
elseif (devreqvalid)
if ((devreq0d==0)&(devreq1d==5))addr=devreq2d;
elseaddr=addr;
endifelse
addr=addr;endif
endif
endp
8.11 EOP取得
{ ==================================================================== }{ 05C06AEOP取得 }{ ==================================================================== }procedure getEOP
8.11.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input eop; { EOP }input sp; { ビット起点 }
8.11.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[2];
226 第 8章 手続き
8.11.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr eopp[2];
8.11.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q=eopp;
8.11.5 EOP起点のための計数
{ -------------------------------------------------------------------- }{ EOP起点のための計数 }{ -------------------------------------------------------------------- }
if (reset)eopp=0;
elseif (eop)
if (sp)if (eopp==0)
eopp=1;else
eopp=eopp;endif
elseswitch(eopp)
case 1: eopp=2;case 2: eopp=2;
endswitchendif
elseeopp=0;
endifendif
endp
8.12 PID取得
8.12 PID取得 227
{ ==================================================================== }{ 05C03KPID取得 }{ ==================================================================== }procedure getPID
8.12.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input data[8]; { パケットデータ }input bytesp; { バイト取得点 }input eopp; { EOP起点 }
8.12.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[17];
8.12.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr pid[8];bitn pidpass;bitn piderr;bitn pidchk[4];bitr count[3];bitr dreset;
8.12.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
228 第 8章 手続き
Q.13:16=pidchk;Q.10:12=count;Q.9=pidpass;Q.8=piderr;Q.0:7=pid;
8.12.5 バイト計数
{ -------------------------------------------------------------------- }{ バイト計数 }{ -------------------------------------------------------------------- }
if (reset)count=0;
elseif (bytesp)
if (count<3)count=count+1;
elsecount=count;
endifelse
count=count;endif
endif
8.12.6 PID通過
{ -------------------------------------------------------------------- }{ PID通過 }{ -------------------------------------------------------------------- }
if (count==3) pidpass=1; endif
8.12.7 PID記憶
{ -------------------------------------------------------------------- }{ PID記憶 }{ -------------------------------------------------------------------- }
if (dreset)pid=0;
elseif (pidpass)
pid=pid;else
if (eopp) { Handshakeパケットの PID位置 }pid=data.0:7;
elseif (bytesp)
8.13 CRC16 229
pid=data.0:7;else
pid=pid;endif
endifendif
endif
8.12.8 PID検査
{ -------------------------------------------------------------------- }{ PID検査 }{ -------------------------------------------------------------------- }
pidchk=pid.0:3^pid.4:7;
8.12.9 PIDエラー
{ -------------------------------------------------------------------- }{ PIDエラー }{ -------------------------------------------------------------------- }
if (pidpass)if (pidchk!=0xff) piderr=1; endif
endif
8.12.10 clr遅延
{ -------------------------------------------------------------------- }{ clr遅延 }{ -------------------------------------------------------------------- }
dreset=reset;
endp
8.13 CRC16
{ ==================================================================== }{ 05C03SCRC16 }{ ==================================================================== }procedure crc16
230 第 8章 手続き
8.13.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input res; { 初期化 }input ep; { 能動点 }input sin; { ビットデータ }
8.13.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output q[16];
8.13.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr rq[16];
8.13.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
q = rq;
8.13.5 CRC計算
{ -------------------------------------------------------------------- }{ CRC計算 }{ -------------------------------------------------------------------- }
8.14 パケットバイトデータ取得 231
if (res)rq = 0;
elseif (ep)
rq.0 = rq.15 ^ sin;rq.5 = rq.4 ^ (rq.15 ^ sin);rq.12 = rq.11 ^ (rq.15 ^ sin);
rq.1:4 = rq.0:3;rq.6:11 = rq.5:10;rq.13:15 = rq.12:14;
elserq=rq;
endifendif
endp
8.14 パケットバイトデータ取得
{ ==================================================================== }{ 05C03Aパケットバイトデータ取得 }{ ==================================================================== }procedure getbyte
8.14.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input eopp; { EOP終了起点 }input sp; { ビット起点 }input data; { ビットデータ }
8.14.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[25];
8.14.3 内部信号
232 第 8章 手続き
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr sync;bitr sc[3];bitr sr[8];bitr bc[3];bitn bp;bitr bdata[8];bitr psp[2];
8.14.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0:7=bdata.7:0;Q.8=sp&sync;Q.9=bp;Q.10=psp.0;Q.11=sync;Q.12:19=sr;Q.20:22=bc;Q.23:24=psp;
8.14.5 シフトレジスタ
{ -------------------------------------------------------------------- }{ シフトレジスタ }{ -------------------------------------------------------------------- }
if (reset)sr=0xff;
elseif (sp)
sr.0=data;sr.1:7=sr.0:6;
elsesr=sr;
endifendif
8.14.6 同期指標
{ -------------------------------------------------------------------- }{ 同期指標 }
8.14 パケットバイトデータ取得 233
{ -------------------------------------------------------------------- }if (reset)
sync=0;else
if (sr.7:0==0x80)sync=1;
elseif (eopp)
sync=0;else
sync=sync;endif
endifendif
8.14.7 ビット計数
{ -------------------------------------------------------------------- }{ ビット計数 }{ -------------------------------------------------------------------- }
if (sync)if (sp)
bc=bc+1;else
bc=bc;endif
elsebc=0;
endif
8.14.8 バイトデータ起点
{ -------------------------------------------------------------------- }{ バイトデータ起点 }{ -------------------------------------------------------------------- }
if ((bc==0)&sp&sync) bp=1; endif
8.14.9 バイト保持
{ -------------------------------------------------------------------- }{ バイト保持 }{ -------------------------------------------------------------------- }
if (bp)bdata=sr;
elsebdata=bdata;
endif
234 第 8章 手続き
8.14.10 パケット開始点
{ -------------------------------------------------------------------- }{ パケット開始点 }{ -------------------------------------------------------------------- }
if (sync)switch(psp)
case 0: psp=1;case 1: psp=2;default: psp=psp;
endswitchendif
endp
8.15 NRZI符号化
{ ==================================================================== }{ 05G19ENRZI符号化 }{ ==================================================================== }procedure nrzichgs
8.15.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input data; { データ }input seop;input sbp;
8.15.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output q[15];
8.15 NRZI符号化 235
8.15.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitn cp;bitr bs6[6];bitn se;bitr nrziq;bitr bs6e[7];
8.15.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
q.0=nrziq;q.1=se;q.2:7=bs6;q.8:14=bs6e;
8.15.5 0追加点
{ -------------------------------------------------------------------- }{ 0追加点 }{ -------------------------------------------------------------------- }
if (se)cp=data;
elsecp=0;
endif
8.15.6 6桁列
{ -------------------------------------------------------------------- }{ 6桁列 }{ -------------------------------------------------------------------- }
if (reset)bs6=0;
elseif (sbp)
bs6.0=cp;
236 第 8章 手続き
bs6.1:5=bs6.0:4;else
bs6=bs6;endif
endif
8.15.7 EOPを送信端に同期させる 6桁列
{ -------------------------------------------------------------------- }{ EOPを送信端に同期させる 6桁列 }{ -------------------------------------------------------------------- }
if (reset)bs6e=0;
elseif (sbp)
bs6e.0=seop;bs6e.1:6=bs6e.0:5;
elsebs6e=bs6e;
endifendif
8.15.8 6連続検知
{ -------------------------------------------------------------------- }{ 6連続検知 }{ -------------------------------------------------------------------- }
if (bs6==0b111111) se=0; else se=1; endif
8.15.9 NRZI符号
{ -------------------------------------------------------------------- }{ NRZI符号 }{ -------------------------------------------------------------------- }
if (sbp)if (bs6.5)
nrziq=nrziq;else
nrziq=!nrziq;endif
elsenrziq=nrziq;
endif
endp
8.16 NRZIの変換と連続 1の後の 0の除去 237
8.16 NRZIの変換と連続 1の後の 0の除去
{ ==================================================================== }{ 05G18CYNRZIの変換と連続 1の後の 0の除去 }{ ==================================================================== }procedure nrzichgr
8.16.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset; { 初期化 }input sp; { 取得点 }input sin; { 入力 }input eop; { 端末 }input sync; { 同期指標 }input comon; { 受信中 }
8.16.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output dq[33]; { 出力 }
8.16.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr rdqa[6];bitr rdqb[8];bitr rdqc[6];bitr rdqd[6];bitn pass;bitr rnrzi;bitr data;bitr count[4];bitr rc[6];
238 第 8章 手続き
8.16.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
dq.32=rnrzi;dq.31=data;dq.25:30=rdqd;dq.19:24=rdqc;dq.11:18=rdqb;dq.5:10=rdqa;dq.4=pass;dq.3=rdqb.6;dq.2=data;dq.1=rdqd.5;dq.0=rdqa.5;
8.16.5 検査列
{ -------------------------------------------------------------------- }{ 検査列 }{ -------------------------------------------------------------------- }
if (reset)rdqc=0b111111;
elseif (eop)
rdqc=0;else
if (sp)rdqc.0=data;rdqc.1:5=rdqc.0:4;
elserdqc=rdqc;
endifendif
endif
8.16.6 除外ビット位置
{ -------------------------------------------------------------------- }{ 除外ビット位置 }{ -------------------------------------------------------------------- }
if (sync)if (rdqc==0b111111) pass=1; endif
endif
8.16 NRZIの変換と連続 1の後の 0の除去 239
8.16.7 除外列
{ -------------------------------------------------------------------- }{ 除外列 }{ -------------------------------------------------------------------- }
if (reset)rdqd=0;
elseif (sp)
if (rdqd.0)rdqd.0=0; { 1が 2CLK以上になることを防止 }
elserdqd.0=pass;
endif
rdqd.1:5=rdqd.0:4;else
rdqd=rdqd;endif
endif
8.16.8 出力列データ
{ -------------------------------------------------------------------- }{ 出力列データ }{ -------------------------------------------------------------------- }
if (reset)rdqa=0b111111;
elseif (sp)
if (pass)rdqa=rdqa;
elserdqa.0=data;rdqa.1:5=rdqa.0:4;
endifelse
rdqa=rdqa;endif
endif
8.16.9 出力列 EOP
{ -------------------------------------------------------------------- }{ 出力列 EOP }{ -------------------------------------------------------------------- }
if (reset|!comon)rdqb=0;
240 第 8章 手続き
elseif (sp)
if (pass&!rdqb.6)rdqb=rdqb;
elserdqb.0=eop;rdqb.1:7=rdqb.0:6;
endifelse
rdqb=rdqb;endif
endif
8.16.10 NRZI復号論理 1
{ -------------------------------------------------------------------- }{ NRZI復号論理 1 }{ -------------------------------------------------------------------- }
if (reset)rnrzi=1;
elseif (sp)
rnrzi=sin;else
rnrzi=rnrzi;endif
endif
8.16.11 NRZI復号論理 2
{ -------------------------------------------------------------------- }{ NRZI復号論理 2 }{ -------------------------------------------------------------------- }
if (reset)data=1;
elseif (eop)
data=data;else
if (sp)switch(sin,rnrzi)
case 0,0: data=1;case 0,1: data=0;case 1,0: data=0;case 1,1: data=1;
endswitchelse
data=data;endif
endifendif
endp
8.17 datapで同期を取って qpと qmを取得 241
8.17 datapで同期を取って qpと qmを取得
{ ==================================================================== }{ 05G18CKdatapで同期を取って qp,qmを取得 }{ ==================================================================== }procedure usbsync
8.17.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input datap;input datam;input signst[2]; { USB端子状態 }input mode; { USB速度選択 }input eop; { EOP }
8.17.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output q[11];
8.17.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr edr[2];bitn edp;bitr sc[2];bitr rqp;bitr rqm;bitn sp;bitr comon;bitr eopep[2];bitr filt[2];
242 第 8章 手続き
8.17.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
q.0=rqp;q.1=rqm;q.2=sp;q.3=comon;q.4:5=eopep;q.6:7=edr;q.8=edp;q.9:10=sc;
8.17.5 EOP終了起点
{ -------------------------------------------------------------------- }{ EOP終了起点 }{ -------------------------------------------------------------------- }
if (eop)eopep=0;
elseswitch(eopep)
case 0: eopep=1;case 1: eopep=2;case 2: eopep=eopep;
endswitchendif
8.17.6 受信中
{ -------------------------------------------------------------------- }{ 受信中 }{ -------------------------------------------------------------------- }
if (signst==0) { 待機中 }if (comon)
if (eopep.0)comon=0;
elsecomon=comon;
endifelse
if (mode) { full }if (!datap&datam) comon=1; endif { SOP }
else { low }if (datap&!datam) comon=1; endif { SOP }
endif
8.17 datapで同期を取って qpと qmを取得 243
endifelse { 通信中 }
comon=comon;endif
8.17.7 変化点捕捉シフトレジスタ
{ -------------------------------------------------------------------- }{ 変化点捕捉シフトレジスタ }{ -------------------------------------------------------------------- }
edr.0=datap;edr.1=edr.0;
8.17.8 変化点
{ -------------------------------------------------------------------- }{ 変化点 }{ -------------------------------------------------------------------- }
edp=edr.0^edr.1;
8.17.9 取得計数器
{ -------------------------------------------------------------------- }{ 取得計数器 }{ -------------------------------------------------------------------- }
if (edp)sc=0;
elsesc=sc+1;
endif
8.17.10 差動信号取得点
{ -------------------------------------------------------------------- }{ 差動信号取得点 }{ -------------------------------------------------------------------- }
if (comon)if (sc==0)
if (filt==0) sp=1; endifendif
endif
244 第 8章 手続き
8.17.11 差動信号取得点フィルタ
{ -------------------------------------------------------------------- }{ 差動信号取得点フィルタ }{ -------------------------------------------------------------------- }
if (comon)filt.0=sp;filt.1=filt.0;
endif
8.17.12 差動信号+取得
{ -------------------------------------------------------------------- }{ 差動信号 +取得 }{ -------------------------------------------------------------------- }
if(sp)rqp=datap;
elserqp=rqp;
endif
8.17.13 差動信号-取得
{ -------------------------------------------------------------------- }{ 差動信号-取得 }{ -------------------------------------------------------------------- }
if(sp)rqm=datam;
elserqm=rqm;
endif
endp
8.18 USB I/F
{ ==================================================================== }{ 05G19AMUSB I/F }{ ==================================================================== }
8.18 USB I/F 245
procedure usbif
8.18.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input reset;input dpina;input dmina;input mode;input sen;input sdata;input seop;input sync;input sbp;
8.18.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[68];
8.18.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr signst[2];bitn difsync[11];bitn dpin;bitn dmin;bitn data[33];bitn eop;bitn dpout;bitn dmout;bitn nrzi;bitn nrzis[15];bitn invsen;bitn dseop;bitr dseopdelay[2];
8.18.4 出力代入
246 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0=data.0;Q.1=data.3;Q.2=dpout;Q.3=dmout;Q.4=dpin;Q.5=dmin;Q.6=signst.0;Q.7=signst.1;Q.8=nrzi;Q.9=difsync.2&!data.1;Q.10=data.1;Q.11=data.2;Q.12=difsync.2;Q.13=data.4;Q.14:46=data.0:32;Q.47=eop;Q.48:49=difsync.4:5;Q.50=difsync.3;Q.51:52=difsync.6:7;Q.53=difsync.8;Q.54:55=difsync.9:10;Q.56=difsync.0;Q.57=difsync.1;Q.58:59=nrzis.0:1;Q.60=invsen;Q.61=dseop;Q.62:67=nrzis.2:7;
8.18.5 差動信号の同期化
{ -------------------------------------------------------------------- }{ 差動信号の同期化 }{ -------------------------------------------------------------------- }
difsync=usbsync(dpina,dmina,signst,mode,data.3);
8.18.6 同期化後の差動信号+
{ -------------------------------------------------------------------- }{ 同期化後の差動信号 + }{ -------------------------------------------------------------------- }
dpin=difsync.0;
8.18.7 同期化後の差動信号-
8.18 USB I/F 247
{ -------------------------------------------------------------------- }{ 同期化後の差動信号- }{ -------------------------------------------------------------------- }
dmin=difsync.1;
8.18.8 差動信号から NRZI信号を抽出
{ -------------------------------------------------------------------- }{ 差動信号から NRZI信号を抽出 }{ -------------------------------------------------------------------- }
if (sen) { 自身のパケットを送信中 }nrzi=0;
else { パケット受信 }switch(signst)
case 0: nrzi=1; { IDLE }case 1: nrzi=0; { K }case 2: nrzi=1; { J }case 3: nrzi=0; { SE0 }
eop=1;endswitch
endif
8.18.9 手続き nrzichgr引用
{ -------------------------------------------------------------------- }{ 手続き nrzichgr引用 }{ -------------------------------------------------------------------- }
data=nrzichgr(reset,difsync.2,nrzi,eop,sync,difsync.3);
8.18.10 senの論理否定
{ -------------------------------------------------------------------- }{ senの論理否定 }{ -------------------------------------------------------------------- }
invsen=!sen;
8.18.11 手続き nrzichgs引用
248 第 8章 手続き
{ -------------------------------------------------------------------- }{ 手続き nrzichgs引用 }{ -------------------------------------------------------------------- }
nrzis=nrzichgs(invsen,sdata,seop,sbp);
8.18.12 出力端に同期した送信 EOP
{ -------------------------------------------------------------------- }{ 出力端に同期した送信 EOP }{ -------------------------------------------------------------------- }
dseop=nrzis.14;
8.18.13 NRZIを差動信号+に変換
{ -------------------------------------------------------------------- }{ NRZIを差動信号 +に変換 }{ -------------------------------------------------------------------- }
if (sen)if ((dseop)|(dseopdelay!=0)) { SE0 }
dpout=0;else
if (mode) { full }if (nrzis.0) { J }
dpout=1;else { K }
dpout=0;endif
else { low }if (nrzis.0) { J }
dpout=0;else { K }
dpout=1;endif
endifendif
endif
8.18.14 差動信号から通信状態を抽出
{ -------------------------------------------------------------------- }{ 差動信号から通信状態を抽出 }{ -------------------------------------------------------------------- }
if (mode) { full }switch(signst)
case 0: { IDLE }
8.18 USB I/F 249
図 8.3 USB状態
IDLE SE0
K J
ab
c
d e
f
if (!dpin&dmin) { a }signst=1;
elsesignst=signst;
endifcase 1: { K }
switch(dpin,dmin)case 0,0: signst=3; { d }case 1,0: signst=2; { b }default: signst=signst;
endswitchcase 2: { J }
switch(dpin,dmin)case 0,1: signst=1; { c }case 0,0: signst=3; { e }default: signst=signst;
endswitchcase 3: { EOP }
if (dpin&!dmin)signst=0; { f }
elsesignst=signst;
endifendswitch
else { low }switch(signst)
case 0: { IDLE }if (dpin&!dmin) { a }
signst=1;else
signst=signst;endif
case 1: { K }switch(dpin,dmin)
case 0,0: signst=3; { d }case 0,1: signst=2; { b }default: signst=signst;
endswitchcase 2: { J }
switch(dpin,dmin)case 1,0: signst=1; { c }case 0,0: signst=3; { e }default: signst=signst;
endswitchcase 3: { EOP }
if (!dpin&dmin)signst=0; { f }
elsesignst=signst;
250 第 8章 手続き
endifendswitch
endif
8.18.15 NRZIを差動信号-に変換
{ -------------------------------------------------------------------- }{ NRZIを差動信号-に変換 }{ -------------------------------------------------------------------- }
if (sen)if ((dseop)|(dseopdelay!=0)) { SE0 }
dmout=0;else
if (mode) { full }if (nrzis.0) { J }
dmout=0;else { K }
dmout=1;endif
else { low }if (nrzis.0) { J }
dmout=1;else { K }
dmout=0;endif
endifendif
endif
8.18.16 dseopの遅延
{ -------------------------------------------------------------------- }{ dseopの遅延 }{ -------------------------------------------------------------------- }
if (reset)dseopdelay=0;
elsedseopdelay.0=dseop;dseopdelay.1=dseopdelay.0;
endif
endp
8.19 パケットの送信
{ ==================================================================== }{ 05A01Aパケットの送信 }
8.19 パケットの送信 251
{ ==================================================================== }procedure sendPACKET
8.19.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input sen; { 送信有効 }input sdno[11]; { 送信個数 }input spid[8]; { 送信パケットの PID }input sbdata[8]; { 送信バイトデータ }input tmode[2]; { 転送種類 }input sbp;
8.19.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[46];
8.19.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr sbc[3];bitr sst[3];bitn sd;bitr sdct[11];bitn seop;bitn seope;bitn seops;bitn bp;bitn scrc16en;bitn scrc16n[16];bitn crcp;bitr psp[2];bitn rp;
8.19.4 出力代入
252 第 8章 手続き
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0=sd;Q.1=seop;Q.2=seope;Q.3:13=sdct;Q.14:16=sst;Q.17=bp;Q.18=seops;Q.19=sbp;Q.20:35=scrc16n;Q.36:37=psp;Q.38:40=sbc;Q.41:42=0;Q.43=scrc16en;Q.44=crcp;Q.45=rp;
8.19.5 読み込み起点
{ -------------------------------------------------------------------- }{ 読み込み起点 }{ -------------------------------------------------------------------- }
if (sst==2) rp=bp; endif
8.19.6 パケット開始起点
{ -------------------------------------------------------------------- }{ パケット開始起点 }{ -------------------------------------------------------------------- }
if (sen)if (!seop)
switch(psp)case 0: if (bp) psp=1; endifcase 1: psp=2;default: psp=psp;
endswitchendif
endif
8.19.7 eopの開始点
{ -------------------------------------------------------------------- }{ eopの開始点 }{ -------------------------------------------------------------------- }
8.19 パケットの送信 253
if ((sst==5)&(sbc==0)&sbp) seops=1; endif
8.19.8 eopの終了点
{ -------------------------------------------------------------------- }{ eopの終了点 }{ -------------------------------------------------------------------- }
if ((sst==5)&(sbc==2)&sbp) seope=1; endif
8.19.9 送信ビット計数
{ -------------------------------------------------------------------- }{ 送信ビット計数 }{ -------------------------------------------------------------------- }
if (sen)if (sbp)
sbc=sbc+1;else
sbc=sbc;endif
endif
8.19.10 バイト送信起点
{ -------------------------------------------------------------------- }{ バイト送信起点 }{ -------------------------------------------------------------------- }
bp=(sbc==7)&sbp;
8.19.11 データ計数
{ -------------------------------------------------------------------- }{ データ計数 }{ -------------------------------------------------------------------- }
if (sst==2) { データ送信中 }if (bp) { バイト送信起点 }
sdct=sdct+1;else
sdct=sdct;endif
else
254 第 8章 手続き
sdct=1; { 1から計数 }endif
8.19.12 送信状態制御
{ -------------------------------------------------------------------- }{ 送信状態制御 }{ -------------------------------------------------------------------- }
if (sen)if (bp) { バイト送信起点 }
switch(sst)case 0: { SYNC }
sst=1; { -> PID }case 1: { PID }
if (spid.0:1==2) { Handshake パケット }sst=5; { -> EOP }
elseif (tmode==0)
if (sdno==0) { 終了送信 }sst=3;
else { Data パケット }sst=2; { -> データ }
endifelse
sst=2;endif
endifcase 2: { データ }
if (sdno<=sdct) { データ送信終了 }sst=3; { -> CRC16上 }
elsesst=sst;
endifcase 3: { CRC16上 }
sst=4; { -> CRC16下 }case 4: { CRC16下 }
sst=5; { -> EOP }case 5: { EOP }
sst=6; { -> 待機 }case 6:
sst=sst;endswitch
elsesst=sst;
endifendif
8.19.13 送信ビットデータ
{ -------------------------------------------------------------------- }{ 送信ビットデータ }{ -------------------------------------------------------------------- }
8.19 パケットの送信 255
if (sen)switch(sst)
case 0: { SYNC }switch(sbc)
case 0: sd=0;case 1: sd=0;case 2: sd=0;case 3: sd=0;case 4: sd=0;case 5: sd=0;case 6: sd=0;case 7: sd=1;
endswitchcase 1: { PID }
switch(sbc)case 0: sd=spid.0;case 1: sd=spid.1;case 2: sd=spid.2;case 3: sd=spid.3;case 4: sd=spid.4;case 5: sd=spid.5;case 6: sd=spid.6;case 7: sd=spid.7;
endswitchcase 2: { DATA }
switch(sbc)case 0: sd=sbdata.0;case 1: sd=sbdata.1;case 2: sd=sbdata.2;case 3: sd=sbdata.3;case 4: sd=sbdata.4;case 5: sd=sbdata.5;case 6: sd=sbdata.6;case 7: sd=sbdata.7;
endswitchcase 3: { CRC16下 }
switch(sbc)case 0: sd=scrc16n.15;case 1: sd=scrc16n.14;case 2: sd=scrc16n.13;case 3: sd=scrc16n.12;case 4: sd=scrc16n.11;case 5: sd=scrc16n.10;case 6: sd=scrc16n.9;case 7: sd=scrc16n.8;
endswitchcase 4: { CRC16上 }
switch(sbc)case 0: sd=scrc16n.7;case 1: sd=scrc16n.6;case 2: sd=scrc16n.5;case 3: sd=scrc16n.4;case 4: sd=scrc16n.3;case 5: sd=scrc16n.2;case 6: sd=scrc16n.1;case 7: sd=scrc16n.0;
endswitchcase 5: { EOP }
sd=0;endswitch
elsesd=0;
endif
256 第 8章 手続き
8.19.14 送信 EOP
{ -------------------------------------------------------------------- }{ 送信 EOP }{ -------------------------------------------------------------------- }
if (sen)if (sst==5)
switch(sbc)case 0: seop=1;case 1: seop=1;
endswitchendif
endif
8.19.15 送信 CRC16
{ -------------------------------------------------------------------- }{ 送信 CRC16 }{ -------------------------------------------------------------------- }
if (sst>=2)scrc16en=0;
elsescrc16en=1;
endif
8.19.16 CRC計算点
{ -------------------------------------------------------------------- }{ CRC計算点 }{ -------------------------------------------------------------------- }
if (sst==2) crcp=sbp; endif
8.19.17 手続き crc16引用
{ -------------------------------------------------------------------- }{ 手続き crc16引用 }{ -------------------------------------------------------------------- }
scrc16n=crc16(scrc16en,crcp,sd);
endp
8.20 Tokenパケットの送信 257
8.20 Tokenパケットの送信
{ ==================================================================== }{ 05J08DTokenパケットの送信 }{ ==================================================================== }procedure sendToken
8.20.1 入力
{ -------------------------------------------------------------------- }{ 入力 }{ -------------------------------------------------------------------- }input sen; { 送信有効 }input spid[8]; { 送信パケットの PID }input address[7]; { デバイスアドレス }input endpoint[4]; { エンドポイント }input fn[11]; { フレーム番号 }input sbp;
8.20.2 出力
{ -------------------------------------------------------------------- }{ 出力 }{ -------------------------------------------------------------------- }output Q[24];
8.20.3 内部信号
{ -------------------------------------------------------------------- }{ 内部信号 }{ -------------------------------------------------------------------- }bitr sbc[4];bitr sst[3];bitn sd;bitn seop;bitn seope;bitn seops;bitn bp;bitn scrc5en;bitn scrc5n[5];bitn crcp;bitr psp[2];
258 第 8章 手続き
8.20.4 出力代入
{ -------------------------------------------------------------------- }{ 出力代入 }{ -------------------------------------------------------------------- }
Q.0=sd;Q.1=seop;Q.2=seope;Q.3:5=sst;Q.6=bp;Q.7=seops;Q.8=0;Q.9:13=scrc5n;Q.14:15=psp;Q.16:19=sbc;Q.20:21=0;Q.22=scrc5en;Q.23=crcp;
8.20.5 パケット開始起点
{ -------------------------------------------------------------------- }{ パケット開始起点 }{ -------------------------------------------------------------------- }
if (sen)if (!seop)
switch(psp)case 0: if (bp) psp=1; endifcase 1: psp=2;default: psp=psp;
endswitchendif
endif
8.20.6 eopの開始点
{ -------------------------------------------------------------------- }{ eopの開始点 }{ -------------------------------------------------------------------- }
if ((sst==3)&(sbc==0)&sbp) seops=1; endif
8.20.7 eopの終了点
8.20 Tokenパケットの送信 259
{ -------------------------------------------------------------------- }{ eopの終了点 }{ -------------------------------------------------------------------- }
if ((sst==3)&(sbc==2)&sbp) seope=1; endif
8.20.8 送信ビット計数
{ -------------------------------------------------------------------- }{ 送信ビット計数 }{ -------------------------------------------------------------------- }
if (sen)if (sbp)
if (sst==2)sbc=sbc+1;
elseif (sbc==7)
sbc=0;else
sbc=sbc+1;endif
endifelse
sbc=sbc;endif
endif
8.20.9 バイト送信起点
{ -------------------------------------------------------------------- }{ バイト送信起点 }{ -------------------------------------------------------------------- }
if ((sbc==7)|(sbc==15))if (sbp) bp=1; endif
endif
8.20.10 送信状態制御
{ -------------------------------------------------------------------- }{ 送信状態制御 }{ -------------------------------------------------------------------- }
if (sen)if (bp) { バイト送信起点 }
switch(sst)case 0: { SYNC }
sst=1;
260 第 8章 手続き
case 1: { PID }if (spid.0:1==2) { Handshake パケット }
sst=5;else
sst=2;endif
case 2: { データと CRC }if (sbc==15)
sst=3;else
sst=sst;endif
case 3: { EOP }sst=4;
case 4:sst=sst;
endswitchelse
sst=sst;endif
endif
8.20.11 送信ビットデータ
{ -------------------------------------------------------------------- }{ 送信ビットデータ }{ -------------------------------------------------------------------- }
if (sen)switch(sst)
case 0: { SYNC }switch(sbc)
case 0: sd=0;case 1: sd=0;case 2: sd=0;case 3: sd=0;case 4: sd=0;case 5: sd=0;case 6: sd=0;case 7: sd=1;
endswitchcase 1: { PID }
switch(sbc)case 0: sd=spid.0;case 1: sd=spid.1;case 2: sd=spid.2;case 3: sd=spid.3;case 4: sd=spid.4;case 5: sd=spid.5;case 6: sd=spid.6;case 7: sd=spid.7;
endswitchcase 2: { DATAと CRC }
if (spid==5)switch(sbc)
case 0: sd=fn.0;case 1: sd=fn.1;case 2: sd=fn.2;case 3: sd=fn.3;case 4: sd=fn.4;
8.20 Tokenパケットの送信 261
case 5: sd=fn.5;case 6: sd=fn.6;case 7: sd=fn.7;case 8: sd=fn.8;case 9: sd=fn.9;case 10: sd=fn.10;case 11: sd=scrc5n.0;case 12: sd=scrc5n.1;case 13: sd=scrc5n.2;case 14: sd=scrc5n.3;case 15: sd=scrc5n.4;
endswitchelse
switch(sbc)case 0: sd=address.0;case 1: sd=address.1;case 2: sd=address.2;case 3: sd=address.3;case 4: sd=address.4;case 5: sd=address.5;case 6: sd=address.6;case 7: sd=endpoint.0;case 8: sd=endpoint.1;case 9: sd=endpoint.2;case 10: sd=endpoint.3;case 11: sd=scrc5n.0;case 12: sd=scrc5n.1;case 13: sd=scrc5n.2;case 14: sd=scrc5n.3;case 15: sd=scrc5n.4;
endswitchendif
case 3: { EOP }sd=0;
endswitchelse
sd=0;endif
8.20.12 送信 EOP
{ -------------------------------------------------------------------- }{ 送信 EOP }{ -------------------------------------------------------------------- }
if (sen)if (sst==3)
switch(sbc)case 0: seop=1;case 1: seop=1;
endswitchendif
endif
8.20.13 送信 CRC16
262 第 8章 手続き
{ -------------------------------------------------------------------- }{ 送信 CRC16 }{ -------------------------------------------------------------------- }
if (sst>=2)scrc5en=0;
elsescrc5en=1;
endif
8.20.14 CRC計算点
{ -------------------------------------------------------------------- }{ CRC計算点 }{ -------------------------------------------------------------------- }
if (sst==2) crcp=sbp; endif
8.20.15 手続き crc16引用
{ -------------------------------------------------------------------- }{ 手続き crc16引用 }{ -------------------------------------------------------------------- }
scrc5n=crc5(scrc5en,crcp,sd);
endp
endlogic
265
第 9章
論理譜
{ ========================================================= }{ テストベンチ }{ 2005.12.23 }{ ========================================================= }logicname testbench
9.1 ライブラリ
{ ========================================================= }{ 06A02Bライブラリ }{ ========================================================= }library usbdevcont; { デバイスコントローラ }library usbhostcont; { ホストコントローラ }
9.2 手続き
{ ========================================================= }{ 06A02C手続き }{ ========================================================= }procedure memoryinput reset;input cs;input we;input address[4];input data[8];input seg[4];output q[8];
bitr memorydata[8];
q=memorydata;
if (reset)memorydata=0;
266 第 9章 論理譜
elseif (cs&we)
if (address==seg)memorydata=data;
elsememorydata=memorydata;
endifelse
memorydata=memorydata;endif
endifendp
9.3 実効譜
{ ========================================================= }{ 06A11AZ実効譜 }{ ========================================================= }entity main
9.3.1 入力
{ --------------------------------------------------------- }{ 入力 }{ --------------------------------------------------------- }input reset;input edatain[8];input cs;input re;input we;input rs[6];input hostdatain[8];input dp;input dm;
9.3.2 出力
{ --------------------------------------------------------- }{ 出力 }{ --------------------------------------------------------- }output rdp;output rdm;output d_rp;
9.3.3 内部信号
9.3 実効譜 267
{ --------------------------------------------------------- }{ 内部信号 }{ --------------------------------------------------------- }bitr CHA0MEM[8];bitr CHA1MEM[8];bitr CHA2MEM[8];bitr CHA3MEM[8];bitr CHA4MEM[8];bitr CHA5MEM[8];bitr CHA6MEM[8];bitr CHA7MEM[8];
bitn QD[317];bitn QH[221];bitn ddp;bitn ddm;bitn hdp;bitn hdm;bitn chadatain[8];bitn chbdatain[8];bitn chcdatain[8];bitn chddatain[8];bitn chedatain[8];bitn chfdatain[8];bitn chgdatain[8];bitn chhdatain[8];
9.3.4 検査端子
{ --------------------------------------------------------- }{ 検査端子 }{ --------------------------------------------------------- }output T0P[8]; T0P=CHA0MEM;output T1P[8]; T1P=CHA1MEM;output T2P[8]; T2P=CHA2MEM;output T3P[8]; T3P=CHA3MEM;output T4P[8]; T4P=CHA4MEM;output T5P[8]; T5P=CHA5MEM;output T6P[8]; T6P=CHA6MEM;output T7P[8]; T7P=CHA7MEM;
output T8P[4]; T8P=QH.29:32;output T9P; T9P=QH.20;output T10P[8]; T10P=QH.3:10;output T11P; T11P=QH.0;output T12P; T12P=QH.1;output T13P; T13P=QH.2;output T14DP; T14DP=QD.0;output T15DP; T15DP=QD.1;output T16DP; T16DP=QD.2;output T17DP[5]; T17DP=QD.30:34;output T18DP[5]; T18DP=QD.72:76;output T19DP[8]; T19DP=QD.22:29;output T20P[4]; T20P=QH.40:43;output T21P[11]; T21P=QH.44:54;
268 第 9章 論理譜
output T22P[4]; T22P=QH.55:58;output T23P[8]; T23P=QH.59:66;output T24P[11]; T24P=QH.67:77;output T25P[12]; T25P=QH.78:89;output T26P[8]; T26P=QH.90:97;output T27P; T27P=QH.19;output T28P[8]; T28P=QH.98:105;output T29P[8]; T29P=QH.106:113;output T30P[8]; T30P=QH.114:121;output T31P[8]; T31P=QH.122:129;output T32P[8]; T32P=QH.130:137;output T33P[8]; T33P=QH.138:145;output T34P[8]; T34P=QH.146:153;output T35P[8]; T35P=QH.154:161;output T36P[8]; T36P=QH.162:169;output T37P[8]; T37P=QH.170:177;output T38P[8]; T38P=QH.178:185;output T39P[4]; T39P=QH.186:189;output T40DP[16]; T40DP=QD.249:264;output T41DP; T41DP=QD.265;output T42DP; T42DP=QD.35;output T43P[4]; T43P=QH.190:193;output T44DP[8]; T44DP=QD.266:273;output T45DP; T45DP=QD.143;output T46DP; T46DP=QD.224;output T47DP[8]; T47DP=QD.159:166;output T48DP[8]; T48DP=QD.274:281;output T49P; T49P=QH.194;output T50P[3]; T50P=QH.195:197;output T51P[3]; T51P=QH.198:200;output T52P[6]; T52P=QH.201:206;output T53P[2]; T53P=QH.207:208;output T54P; T54P=QH.209;output T55P; T55P=QH.210;output T56DP; T56DP=QD.282;output T57DP; T57DP=QD.283;output T58DP; T58DP=QD.284;output T59DP[11]; T59DP=QD.236:246;output T60DP[16]; T60DP=QD.285:300;output T61DP[16]; T61DP=QD.301:316;output T62DP[3]; T62DP=QD.69:71;output T63DP; T63DP=QD.9;output T64DP; T64DP=QD.10;output T65DP[8]; T65DP=QD.11:18;output T66DP[4]; T66DP=QD.3:6;output T67DP; T67DP=QD.167;output T68P; T68P=QH.212;output T69P[8]; T69P=QH.213:220;
9.3.5 デバイスコントローラ導入
{ --------------------------------------------------------- }{ デバイスコントローラ導入 }{ --------------------------------------------------------- }
QD=usbdevcont(reset,ddp,ddm,edatain);
QD.317=1;
9.3 実効譜 269
9.3.6 ホストコントローラ導入
{ --------------------------------------------------------- }{ ホストコントローラ導入 }{ --------------------------------------------------------- }
QH=usbhostcont(reset,cs,re,we,rs,hdp,hdm,hostdatain,chadatain,chbdatain,chcdatain,chddatain,chedatain,chfdatain,chgdatain,chhdatain);
QH.221=1;
9.3.7 ホストからデバイス
{ --------------------------------------------------------- }{ ホストからデバイス }{ --------------------------------------------------------- }
if (QH.2)ddp=QH.0;ddm=QH.1;
elseddp=1;ddm=0;
endif
9.3.8 デバイスからホスト
{ --------------------------------------------------------- }{ デバイスからホスト }{ --------------------------------------------------------- }
if (QD.2)hdp=QD.0;hdm=QD.1;
elsehdp=dp;hdm=dm;
endif
9.3.9 USB端子
{ --------------------------------------------------------- }{ USB端子 }{ --------------------------------------------------------- }
270 第 9章 論理譜
if (QH.2)rdp=QH.0;rdm=QH.1;
elseif (QD.2)
rdp=QD.0;rdm=QD.1;
elserdp=dp;rdm=dm;
endifendif
9.3.10 デバイスコントローラ rp端子
{ --------------------------------------------------------- }{ デバイスコントローラ rp端子 }{ --------------------------------------------------------- }d_rp=QD.10;
9.3.11 チャネル A メモリ
{ --------------------------------------------------------- }{ チャネル Aメモリ }{ --------------------------------------------------------- }
CHA0MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,0);CHA1MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,1);CHA2MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,2);CHA3MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,3);CHA4MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,4);CHA5MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,5);CHA6MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,6);CHA7MEM=memory(reset,QH.33,QH.35,QH.29:32,QH.11:18,7);
if (QH.33&QH.34)switch(QH.29:32)
case 0: chadatain=CHA0MEM;case 1: chadatain=CHA1MEM;case 2: chadatain=CHA2MEM;case 3: chadatain=CHA3MEM;case 4: chadatain=CHA4MEM;case 5: chadatain=CHA5MEM;case 6: chadatain=CHA6MEM;case 7: chadatain=CHA7MEM;
endswitchendif
ende
9.4 GetDescriptor
9.4 GetDescriptor 271
FL06A02P.lzh{ ========================================================= }{ 06A02PGetDescriptor }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.4.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.4.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.4.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
272 第 9章 論理譜
9.4.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ----------------------------------------------------------------- }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ----------------------------------------------------------------- }
switch(tc)case 15: rs=0x07; hostdatain=0x80;case 16: rs=0x07; hostdatain=0x80; cs=1; we=1;case 17: rs=0x07; hostdatain=0x80;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x06;case 21: rs=0x07; hostdatain=0x06; cs=1; we=1;case 22: rs=0x07; hostdatain=0x06;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x00;case 26: rs=0x07; hostdatain=0x00; cs=1; we=1;case 27: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x01;case 31: rs=0x07; hostdatain=0x01; cs=1; we=1;case 32: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x55;case 36: rs=0x07; hostdatain=0x55; cs=1; we=1;case 37: rs=0x07; hostdatain=0x55;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0xaa;case 41: rs=0x07; hostdatain=0xaa; cs=1; we=1;case 42: rs=0x07; hostdatain=0xaa;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x08;case 46: rs=0x07; hostdatain=0x08; cs=1; we=1;case 47: rs=0x07; hostdatain=0x08;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.4.5 割り込みマスクを解除して割り込み許可
9.4 GetDescriptor 273
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.4.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.4.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.4.8 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.4.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.4.10 パケット数を 1にする
274 第 9章 論理譜
9.4.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.4.12 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
9.4.13 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.4.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.4.15 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;
9.4 GetDescriptor 275
case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.4.16 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.4.17 Dataステージ No.1
{ ---------------------------------------------------------------- }{ Dataステージ No.1 }{ ---------------------------------------------------------------- }
9.4.18 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.4.19 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0;case 1261: rs=0x12; hostdatain=0; cs=1; we=1;case 1262: rs=0x12; hostdatain=0;
endswitch
9.4.20 チャネル Aのデータ位置を初期化
switch(tc)case 1265: rs=0x08; hostdatain=1;case 1266: rs=0x08; hostdatain=1; cs=1; we=1;case 1267: rs=0x08; hostdatain=1;
endswitch
276 第 9章 論理譜
9.4.21 パケット数を 5にする
switch(tc)case 1270: rs=0x13; hostdatain=0x50;case 1271: rs=0x13; hostdatain=0x50; cs=1; we=1;case 1272: rs=0x13; hostdatain=0x50;
endswitch
9.4.22 チャネル Aの通信を有効にする
switch(tc)case 1275: rs=0x00; hostdatain=1;case 1276: rs=0x00; hostdatain=1; cs=1; we=1;case 1277: rs=0x00; hostdatain=1;
endswitch
9.4.23 Dataステージ No.2
{ ---------------------------------------------------------------- }{ Dataステージ No.2 }{ ---------------------------------------------------------------- }
9.4.24 チャネル Aのデータ位置を初期化
switch(tc)case 2100: rs=0x08; hostdatain=1;case 2101: rs=0x08; hostdatain=1; cs=1; we=1;case 2102: rs=0x08; hostdatain=1;
endswitch
9.4.25 チャネル Aの通信済みを解除する
switch(tc)case 2105: rs=0x01; hostdatain=1;case 2106: rs=0x01; hostdatain=1; cs=1; we=1;case 2107: rs=0x01; hostdatain=1;
endswitch
9.4 GetDescriptor 277
9.4.26 チャネル Aの通信を有効にする
switch(tc)case 2110: rs=0x00; hostdatain=1;case 2111: rs=0x00; hostdatain=1; cs=1; we=1;case 2112: rs=0x00; hostdatain=1;
endswitch
9.4.27 Dataステージ No.3
{ ---------------------------------------------------------------- }{ Dataステージ No.3 }{ ---------------------------------------------------------------- }
9.4.28 チャネル Aのデータ位置を初期化
switch(tc)case 3000: rs=0x08; hostdatain=1;case 3001: rs=0x08; hostdatain=1; cs=1; we=1;case 3002: rs=0x08; hostdatain=1;
endswitch
9.4.29 チャネル Aの通信済みを解除する
switch(tc)case 3005: rs=0x01; hostdatain=1;case 3006: rs=0x01; hostdatain=1; cs=1; we=1;case 3007: rs=0x01; hostdatain=1;
endswitch
9.4.30 チャネル Aの通信を有効にする
switch(tc)case 3010: rs=0x00; hostdatain=1;case 3011: rs=0x00; hostdatain=1; cs=1; we=1;case 3012: rs=0x00; hostdatain=1;
endswitch
278 第 9章 論理譜
9.4.31 Dataステージ No.4
{ ---------------------------------------------------------------- }{ Dataステージ No.4 }{ ---------------------------------------------------------------- }
9.4.32 チャネル Aのデータ位置を初期化
switch(tc)case 3900: rs=0x08; hostdatain=1;case 3901: rs=0x08; hostdatain=1; cs=1; we=1;case 3902: rs=0x08; hostdatain=1;
endswitch
9.4.33 チャネル Aの通信済みを解除する
switch(tc)case 3905: rs=0x01; hostdatain=1;case 3906: rs=0x01; hostdatain=1; cs=1; we=1;case 3907: rs=0x01; hostdatain=1;
endswitch
9.4.34 チャネル Aの通信を有効にする
switch(tc)case 3910: rs=0x00; hostdatain=1;case 3911: rs=0x00; hostdatain=1; cs=1; we=1;case 3912: rs=0x00; hostdatain=1;
endswitch
ende
9.5 デバイス接続
FL06A03A.lzh
9.5 デバイス接続 279
{ ========================================================= }{ 06A03Aデバイス接続 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.5.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.5.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.5.3 デバイスの接続と切断
{ --------------------------------------------------------- }{ デバイスの接続と切断 }{ --------------------------------------------------------- }
if ((tc>20)&(tc<350)) dp=1; endif
9.5.4 割り込みマスクを解除して割り込み許可
280 第 9章 論理譜
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.5.5 デバイス接続認識
{ --------------------------------------------------------- }{ デバイス接続認識 }{ --------------------------------------------------------- }
9.5.6 割り込み発生のため IRを読む
switch(tc)case 310: rs=4;case 311: rs=4; cs=1; re=1;case 312: rs=4;
endswitch
9.5.7 IRでデバイスの接続を認識したので DETARを読む
switch(tc)case 315: rs=2;case 316: rs=2; cs=1; re=1;case 317: rs=2;
endswitch
9.5.8 割り込みを解除する
switch(tc)case 320: rs=2; hostdatain=1;case 321: rs=2; hostdatain=1; cs=1; we=1;case 322: rs=2; hostdatain=1;
endswitch
9.6 デバイス切断 281
9.5.9 デバイス切断認識
{ --------------------------------------------------------- }{ デバイス切断認識 }{ --------------------------------------------------------- }
9.5.10 割り込みを解除する
switch(tc)case 500: rs=3; hostdatain=1;case 501: rs=3; hostdatain=1; cs=1; we=1;case 502: rs=3; hostdatain=1;
endswitch
ende
9.6 デバイス切断
FL06A03B.lzh{ ========================================================= }{ 06A03Bデバイス切断 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.6.1 クロック
{ --------------------------------------------------------- }{ クロック }
282 第 9章 論理譜
{ --------------------------------------------------------- }tc=tc+1;
if (tc<5) reset=1; endif
9.6.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.6.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.6.4 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.6.5 デバイス認識
{ --------------------------------------------------------- }{ デバイス認識 }{ --------------------------------------------------------- }
9.6.6 割り込み発生のため IRを読む
9.7 SetConfiguration 283
switch(tc)case 310: rs=4;case 311: rs=4; cs=1; re=1;case 312: rs=4;
endswitch
9.6.7 IRでデバイスの接続を認識したので DETARを読む
switch(tc)case 315: rs=2;case 316: rs=2; cs=1; re=1;case 317: rs=2;
endswitch
ende
9.7 SetConfiguration
FL06A04A.lzh{ ========================================================= }{ 06A04ASetConfiguration }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.7.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
284 第 9章 論理譜
if (tc<5) reset=1; endif
9.7.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.7.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.7.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ----------------------------------------------------------------- }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ----------------------------------------------------------------- }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x09;case 21: rs=0x07; hostdatain=0x09; cs=1; we=1;case 22: rs=0x07; hostdatain=0x09;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)
9.7 SetConfiguration 285
case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.7.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.7.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.7.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.7.8 チャネル Aの設定レジスタのデータ数を 8にする
286 第 9章 論理譜
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.7.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.7.10 パケット数を 1にする
9.7.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.7.12 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
9.7.13 チャネル Aの通信を有効にする
9.7 SetConfiguration 287
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.7.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.7.15 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.7.16 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.7.17 Dataステージ No.1
{ ---------------------------------------------------------------- }{ Dataステージ No.1 }{ ---------------------------------------------------------------- }
9.7.18 チャネル Aの設定レジスタ 2の I/Oを 0にする
288 第 9章 論理譜
9.7.19 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.7.20 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
ende
9.8 SetAddress
FL06A04X.lzh{ ========================================================= }{ 06A04XSetAddress }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.8.1 クロック
9.8 SetAddress 289
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.8.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.8.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.8.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x05;case 21: rs=0x07; hostdatain=0x05; cs=1; we=1;case 22: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
290 第 9章 論理譜
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.8.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.8.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.8.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.8 SetAddress 291
9.8.8 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.8.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.8.10 パケット数を 1にする
9.8.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.8.12 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
292 第 9章 論理譜
9.8.13 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.8.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.8.15 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.8.16 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.8.17 Dataステージ No.1
{ ---------------------------------------------------------------- }
9.9 SetInterface 293
{ Dataステージ No.1 }{ ---------------------------------------------------------------- }
9.8.18 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.8.19 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.8.20 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
ende
9.9 SetInterface
FL06A05A.lzh{ ========================================================= }{ 06A05ASetInterface }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;
294 第 9章 論理譜
output rdm;
bitr tc[16];
9.9.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.9.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.9.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.9.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x01;case 16: rs=0x07; hostdatain=0x01; cs=1; we=1;case 17: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x0b;case 21: rs=0x07; hostdatain=0x0b; cs=1; we=1;
9.9 SetInterface 295
case 22: rs=0x07; hostdatain=0x0b;endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x12;case 26: rs=0x07; hostdatain=0x12; cs=1; we=1;case 27: rs=0x07; hostdatain=0x12;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.9.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.9.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }
296 第 9章 論理譜
{ --------------------------------------------------------- }
9.9.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.9.8 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.9.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.9.10 パケット数を 1にする
9.9.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.9.12 チャネル Aを端子 0のセグメント 0に登録する
9.9 SetInterface 297
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
9.9.13 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.9.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.9.15 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.9.16 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
298 第 9章 論理譜
9.9.17 Dataステージ No.1
{ ---------------------------------------------------------------- }{ Dataステージ No.1 }{ ---------------------------------------------------------------- }
9.9.18 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.9.19 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.9.20 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
ende
9.10 Syncframe
FL06A07B.lzh{ ========================================================= }{ 06A07BSyncframe }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;
9.10 Syncframe 299
output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.10.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.10.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.10.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.10.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)
300 第 9章 論理譜
case 15: rs=0x07; hostdatain=0x02;case 16: rs=0x07; hostdatain=0x02; cs=1; we=1;case 17: rs=0x07; hostdatain=0x02;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x0c;case 21: rs=0x07; hostdatain=0x0c; cs=1; we=1;case 22: rs=0x07; hostdatain=0x0c;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x00;case 26: rs=0x07; hostdatain=0x00; cs=1; we=1;case 27: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x01;case 36: rs=0x07; hostdatain=0x01; cs=1; we=1;case 37: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x02;case 46: rs=0x07; hostdatain=0x02; cs=1; we=1;case 47: rs=0x07; hostdatain=0x02;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.10.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.10 Syncframe 301
9.10.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.10.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.10.8 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.10.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.10.10 パケット数を 1にする
9.10.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;
302 第 9章 論理譜
case 332: rs=0x13; hostdatain=0x10;endswitch
9.10.12 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
9.10.13 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.10.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.10.15 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.10.16 チャネル Aのメモリにフレーム番号をを書き込む
9.10 Syncframe 303
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにフレーム番号を書き込む }{ ------------------------------------------------------------------ }
9.10.17 チャネル Aのデータ位置を初期化
switch(tc)case 1260: rs=0x08; hostdatain=0x01;case 1261: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1262: rs=0x08; hostdatain=0x01;
endswitch
9.10.18 フレーム番号の下位
switch(tc)case 1265: rs=0x07; hostdatain=0x34;case 1266: rs=0x07; hostdatain=0x34; cs=1; we=1;case 1267: rs=0x07; hostdatain=0x34;
endswitch
9.10.19 フレーム番号の上位
switch(tc)case 1270: rs=0x07; hostdatain=0x12;case 1271: rs=0x07; hostdatain=0x12; cs=1; we=1;case 1272: rs=0x07; hostdatain=0x12;
endswitch
9.10.20 Dataステージ No.1
{ ---------------------------------------------------------------- }{ Dataステージ No.1 }{ ---------------------------------------------------------------- }
9.10.21 チャネル Aの設定レジスタ 2の I/Oを 1にする
304 第 9章 論理譜
9.10.22 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1275: rs=0x12; hostdatain=0x84;case 1276: rs=0x12; hostdatain=0x84; cs=1; we=1;case 1277: rs=0x12; hostdatain=0x84;
endswitch
9.10.23 チャネル Aのデータ位置を初期化
switch(tc)case 1280: rs=0x08; hostdatain=0x01;case 1281: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1282: rs=0x08; hostdatain=0x01;
endswitch
9.10.24 パケット数を 1にする
9.10.25 Tokenを OUTにする
switch(tc)case 1285: rs=0x13; hostdatain=0x18;case 1286: rs=0x13; hostdatain=0x18; cs=1; we=1;case 1287: rs=0x13; hostdatain=0x18;
endswitch
9.10.26 チャネル Aの通信を有効にする
switch(tc)case 1290: rs=0x00; hostdatain=1;case 1291: rs=0x00; hostdatain=1; cs=1; we=1;case 1292: rs=0x00; hostdatain=1;
endswitch
9.10 Syncframe 305
9.10.27 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.10.28 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.10.29 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 2130: rs=0x12; hostdatain=0x80;case 2131: rs=0x12; hostdatain=0x80; cs=1; we=1;case 2132: rs=0x12; hostdatain=0x80;
endswitch
9.10.30 通信済みの割り込みを解除する
switch(tc)case 2135: rs=0x01; hostdatain=1;case 2136: rs=0x01; hostdatain=1; cs=1; we=1;case 2137: rs=0x01; hostdatain=1;
endswitch
9.10.31 チャネル Aの通信を有効にする
switch(tc)case 2140: rs=0x00; hostdatain=1;case 2141: rs=0x00; hostdatain=1; cs=1; we=1;case 2142: rs=0x00; hostdatain=1;
endswitch
ende
306 第 9章 論理譜
9.11 GetConfiguration
FL06A07AK.lzh{ ========================================================= }{ 06A07AKGetConfiguration }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.11.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.11.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.11.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
9.11 GetConfiguration 307
if (tc>20) dp=1; endif
9.11.4 チャネル Aのメモリにデバイスリクエスト SetConfigurationを書き込む
{ ----------------------------------------------------------------- }{ チャネル Aのメモリにデバイスリクエスト SetConfigurationを書き込む }{ ----------------------------------------------------------------- }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x09;case 21: rs=0x07; hostdatain=0x09; cs=1; we=1;case 22: rs=0x07; hostdatain=0x09;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.11.5 割り込みマスクを解除して割り込み許可
308 第 9章 論理譜
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.11.6 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.11.7 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.11.8 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 320: rs=0x12; hostdatain=0x84;case 321: rs=0x12; hostdatain=0x84; cs=1; we=1;case 322: rs=0x12; hostdatain=0x84;
endswitch
9.11.9 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.11.10 パケット数を 1にする
9.11 GetConfiguration 309
9.11.11 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.11.12 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;case 337: rs=0x20; hostdatain=0;
endswitch
9.11.13 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.11.14 接続検出の割り込みを解除する
switch(tc)case 345: rs=0x02; hostdatain=1;case 346: rs=0x02; hostdatain=1; cs=1; we=1;case 347: rs=0x02; hostdatain=1;
endswitch
9.11.15 通信済みの割り込みを解除する
310 第 9章 論理譜
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.11.16 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.11.17 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.11.18 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.11.19 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.11.20 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.11 GetConfiguration 311
9.11.21 SetConfiguration終了処理
{ ---------------------------------------------------------------- }{ SetConfiguration終了処理 }{ ---------------------------------------------------------------- }
9.11.22 通信済みの割り込みを解除する
switch(tc)case 1850: rs=0x01; hostdatain=1;case 1851: rs=0x01; hostdatain=1; cs=1; we=1;case 1852: rs=0x01; hostdatain=1;
endswitch
9.11.23 フレームの割り込みを解除する
switch(tc)case 1855: rs=0x04; hostdatain=0xc4;case 1856: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1857: rs=0x04; hostdatain=0xc4;
endswitch
9.11.24 チャネル Aのデータ位置を初期化
switch(tc)case 1860: rs=0x08; hostdatain=0x01;case 1861: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1862: rs=0x08; hostdatain=0x01;
endswitch
9.11.25 チャネル Aのメモリにデバイスリクエスト GetConfigurationを書き込む
{ ----------------------------------------------------------------- }{ チャネル Aのメモリにデバイスリクエスト GetConfigurationを書き込む }
312 第 9章 論理譜
{ ----------------------------------------------------------------- }switch(tc)
case 1865: rs=0x07; hostdatain=0x80;case 1866: rs=0x07; hostdatain=0x80; cs=1; we=1;case 1867: rs=0x07; hostdatain=0x80;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0x08;case 1871: rs=0x07; hostdatain=0x08; cs=1; we=1;case 1872: rs=0x07; hostdatain=0x08;
endswitch
switch(tc)case 1875: rs=0x07; hostdatain=0x00;case 1876: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1877: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1880: rs=0x07; hostdatain=0x00;case 1881: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1882: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1885: rs=0x07; hostdatain=0x00;case 1886: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1887: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1890: rs=0x07; hostdatain=0x00;case 1891: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1892: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1895: rs=0x07; hostdatain=0x01;case 1896: rs=0x07; hostdatain=0x01; cs=1; we=1;case 1897: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 1900: rs=0x07; hostdatain=0x00;case 1901: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1902: rs=0x07; hostdatain=0x00;
endswitch
9.11.26 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.11.27 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.11 GetConfiguration 313
9.11.28 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1905: rs=0x12; hostdatain=0x84;case 1906: rs=0x12; hostdatain=0x84; cs=1; we=1;case 1907: rs=0x12; hostdatain=0x84;
endswitch
9.11.29 チャネル Aのデータ位置を初期化
switch(tc)case 1910: rs=0x08; hostdatain=0x01;case 1911: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1912: rs=0x08; hostdatain=0x01;
endswitch
9.11.30 パケット数を 1にする
9.11.31 Tokenを SETUPにする
switch(tc)case 1915: rs=0x13; hostdatain=0x10;case 1916: rs=0x13; hostdatain=0x10; cs=1; we=1;case 1917: rs=0x13; hostdatain=0x10;
endswitch
9.11.32 チャネル Aの通信を有効にする
switch(tc)case 1920: rs=0x00; hostdatain=1;case 1921: rs=0x00; hostdatain=1; cs=1; we=1;case 1922: rs=0x00; hostdatain=1;
endswitch
314 第 9章 論理譜
9.11.33 Setupステージ終了処理
{ ---------------------------------------------------------------- }{ Setupステージ終了処理 }{ ---------------------------------------------------------------- }
9.11.34 通信済みの割り込みを解除する
switch(tc)case 2800: rs=0x01; hostdatain=1;case 2801: rs=0x01; hostdatain=1; cs=1; we=1;case 2802: rs=0x01; hostdatain=1;
endswitch
9.11.35 チャネル Aのデータ位置を初期化
switch(tc)case 2805: rs=0x08; hostdatain=0x01;case 2806: rs=0x08; hostdatain=0x01; cs=1; we=1;case 2807: rs=0x08; hostdatain=0x01;
endswitch
9.11.36 Dataステージ no.1
{ ---------------------------------------------------------------- }{ Dataステージ no.1 }{ ---------------------------------------------------------------- }
9.11.37 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.11.38 チャネル Aの設定レジスタのデータ数を 8にする
9.11 GetConfiguration 315
switch(tc)case 2810: rs=0x12; hostdatain=0x04;case 2811: rs=0x12; hostdatain=0x04; cs=1; we=1;case 2812: rs=0x12; hostdatain=0x04;
endswitch
9.11.39 チャネル Aの通信を有効にする
switch(tc)case 2815: rs=0x00; hostdatain=1;case 2816: rs=0x00; hostdatain=1; cs=1; we=1;case 2817: rs=0x00; hostdatain=1;
endswitch
9.11.40 Dataステージ no.1 終了処理
{ ---------------------------------------------------------------- }{ Dataステージ no.1 終了処理 }{ ---------------------------------------------------------------- }
9.11.41 通信済みの割り込みを解除する
switch(tc)case 3620: rs=0x01; hostdatain=1;case 3621: rs=0x01; hostdatain=1; cs=1; we=1;case 3622: rs=0x01; hostdatain=1;
endswitch
9.11.42 Dataステージ no.2
{ ---------------------------------------------------------------- }{ Dataステージ no.2 }{ ---------------------------------------------------------------- }
9.11.43 チャネル Aの通信を有効にする
316 第 9章 論理譜
switch(tc)case 3625: rs=0x00; hostdatain=1;case 3626: rs=0x00; hostdatain=1; cs=1; we=1;case 3627: rs=0x00; hostdatain=1;
endswitch
ende
9.12 GetStatus
FL06A08B.lzh{ ========================================================= }{ 06A08BGetStatus }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.12.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.12.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.12 GetStatus 317
9.12.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.12.4 チャネル Aのメモリにデバイスリクエスト GetStatusを書き込む
{ ----------------------------------------------------------------- }{ チャネル Aのメモリにデバイスリクエスト GetStatusを書き込む }{ ----------------------------------------------------------------- }
switch(tc)case 15: rs=0x07; hostdatain=0x82;case 16: rs=0x07; hostdatain=0x82; cs=1; we=1;case 17: rs=0x07; hostdatain=0x82;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x00;case 21: rs=0x07; hostdatain=0x00; cs=1; we=1;case 22: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x00;case 26: rs=0x07; hostdatain=0x00; cs=1; we=1;case 27: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x05;case 36: rs=0x07; hostdatain=0x05; cs=1; we=1;case 37: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x02;case 46: rs=0x07; hostdatain=0x02; cs=1; we=1;case 47: rs=0x07; hostdatain=0x02;
318 第 9章 論理譜
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.12.5 チャネル Aのデータ位置を初期化
switch(tc)case 55: rs=0x08; hostdatain=0x01;case 56: rs=0x08; hostdatain=0x01; cs=1; we=1;case 57: rs=0x08; hostdatain=0x01;
endswitch
9.12.6 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 60: rs=4; hostdatain=0xc0;case 61: rs=4; hostdatain=0xc0; cs=1; we=1;case 62: rs=4; hostdatain=0xc0;
endswitch
9.12.7 接続検出後処理
{ --------------------------------------------------------- }{ 接続検出後処理 }{ --------------------------------------------------------- }
9.12.8 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
endswitch
9.12 GetStatus 319
9.12.9 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.12.10 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.12.11 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 325: rs=0x12; hostdatain=0x84;case 326: rs=0x12; hostdatain=0x84; cs=1; we=1;case 327: rs=0x12; hostdatain=0x84;
endswitch
9.12.12 パケット数を 1にする
9.12.13 Tokenを SETUPにする
switch(tc)case 330: rs=0x13; hostdatain=0x10;case 331: rs=0x13; hostdatain=0x10; cs=1; we=1;case 332: rs=0x13; hostdatain=0x10;
endswitch
9.12.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 335: rs=0x20; hostdatain=0;case 336: rs=0x20; hostdatain=0; cs=1; we=1;
320 第 9章 論理譜
case 337: rs=0x20; hostdatain=0;endswitch
9.12.15 チャネル Aの通信を有効にする
switch(tc)case 340: rs=0x00; hostdatain=1;case 341: rs=0x00; hostdatain=1; cs=1; we=1;case 342: rs=0x00; hostdatain=1;
endswitch
9.12.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.12.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.12.18 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.12.19 チャネル Aのデータ位置を初期化
switch(tc)
9.12 GetStatus 321
case 1260: rs=0x08; hostdatain=0x01;case 1261: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1262: rs=0x08; hostdatain=0x01;
endswitch
9.12.20 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.12.21 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.12.22 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1265: rs=0x12; hostdatain=0x00;case 1266: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1267: rs=0x12; hostdatain=0x00;
endswitch
9.12.23 チャネル Aの通信を有効にする
switch(tc)case 1270: rs=0x00; hostdatain=1;case 1271: rs=0x00; hostdatain=1; cs=1; we=1;case 1272: rs=0x00; hostdatain=1;
endswitch
9.12.24 GetStatus終了処理
{ ---------------------------------------------------------------- }{ GetStatus終了処理 }{ ---------------------------------------------------------------- }
322 第 9章 論理譜
9.12.25 通信済みの割り込みを解除する
switch(tc)case 2100: rs=0x01; hostdatain=1;case 2101: rs=0x01; hostdatain=1; cs=1; we=1;case 2102: rs=0x01; hostdatain=1;
endswitch
9.12.26 フレームの割り込みを解除する
switch(tc)case 2105: rs=0x04; hostdatain=0xc4;case 2106: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 2107: rs=0x04; hostdatain=0xc4;
endswitch
9.12.27 チャネル Aのデータ位置を初期化
switch(tc)case 2110: rs=0x08; hostdatain=0x01;case 2111: rs=0x08; hostdatain=0x01; cs=1; we=1;case 2112: rs=0x08; hostdatain=0x01;
endswitch
ende
9.13 GetInterface
FL06A09A.lzh{ ========================================================= }{ 06A09AGetInterface }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];
9.13 GetInterface 323
output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.13.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.13.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.13.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.13.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x01;case 16: rs=0x07; hostdatain=0x01; cs=1; we=1;case 17: rs=0x07; hostdatain=0x01;
endswitch
324 第 9章 論理譜
switch(tc)case 20: rs=0x07; hostdatain=0x0b;case 21: rs=0x07; hostdatain=0x0b; cs=1; we=1;case 22: rs=0x07; hostdatain=0x0b;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x12;case 26: rs=0x07; hostdatain=0x12; cs=1; we=1;case 27: rs=0x07; hostdatain=0x12;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.13.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.13.6 接続検出後処理
9.13 GetInterface 325
{ --------------------------------------------------------- }{ 接続検出後処理 }{ --------------------------------------------------------- }
9.13.7 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
endswitch
9.13.8 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.13.9 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.13.10 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 325: rs=0x12; hostdatain=0x84;case 326: rs=0x12; hostdatain=0x84; cs=1; we=1;case 327: rs=0x12; hostdatain=0x84;
endswitch
9.13.11 チャネル Aのデータ位置を初期化
switch(tc)case 330: rs=0x08; hostdatain=0x01;case 331: rs=0x08; hostdatain=0x01; cs=1; we=1;case 332: rs=0x08; hostdatain=0x01;
endswitch
326 第 9章 論理譜
9.13.12 パケット数を 1にする
9.13.13 Tokenを SETUPにする
switch(tc)case 335: rs=0x13; hostdatain=0x10;case 336: rs=0x13; hostdatain=0x10; cs=1; we=1;case 337: rs=0x13; hostdatain=0x10;
endswitch
9.13.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 340: rs=0x20; hostdatain=0;case 341: rs=0x20; hostdatain=0; cs=1; we=1;case 342: rs=0x20; hostdatain=0;
endswitch
9.13.15 チャネル Aの通信を有効にする
switch(tc)case 345: rs=0x00; hostdatain=1;case 346: rs=0x00; hostdatain=1; cs=1; we=1;case 347: rs=0x00; hostdatain=1;
endswitch
9.13.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.13 GetInterface 327
9.13.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.13.18 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.13.19 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.13.20 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.13.21 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.13.22 チャネル Aの通信を有効にする
328 第 9章 論理譜
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.13.23 Statusステージ後処理
{ --------------------------------------------------------- }{ Statusステージ後処理 }{ --------------------------------------------------------- }
9.13.24 通信済みの割り込みを解除する
switch(tc)case 1820: rs=0x01; hostdatain=1;case 1821: rs=0x01; hostdatain=1; cs=1; we=1;case 1822: rs=0x01; hostdatain=1;
endswitch
9.13.25 フレームの割り込みを解除する
switch(tc)case 1825: rs=0x04; hostdatain=0xc4;case 1826: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1827: rs=0x04; hostdatain=0xc4;
endswitch
9.13.26 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
9.13.27 チャネル Aのデータ位置を初期化
9.13 GetInterface 329
switch(tc)case 1830: rs=0x08; hostdatain=0x01;case 1831: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1832: rs=0x08; hostdatain=0x01;
endswitch
switch(tc)case 1835: rs=0x07; hostdatain=0x81;case 1836: rs=0x07; hostdatain=0x81; cs=1; we=1;case 1837: rs=0x07; hostdatain=0x81;
endswitch
switch(tc)case 1840: rs=0x07; hostdatain=0x0a;case 1841: rs=0x07; hostdatain=0x0a; cs=1; we=1;case 1842: rs=0x07; hostdatain=0x0a;
endswitch
switch(tc)case 1845: rs=0x07; hostdatain=0x00;case 1846: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1847: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1850: rs=0x07; hostdatain=0x00;case 1851: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1852: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1855: rs=0x07; hostdatain=0x00;case 1856: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1857: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1860: rs=0x07; hostdatain=0x00;case 1861: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1862: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 1865: rs=0x07; hostdatain=0x01;case 1866: rs=0x07; hostdatain=0x01; cs=1; we=1;case 1867: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0x00;case 1871: rs=0x07; hostdatain=0x00; cs=1; we=1;case 1872: rs=0x07; hostdatain=0x00;
endswitch
9.13.28 チャネル Aのデータ位置を初期化
330 第 9章 論理譜
switch(tc)case 1875: rs=0x08; hostdatain=0x01;case 1876: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1877: rs=0x08; hostdatain=0x01;
endswitch
9.13.29 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.13.30 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.13.31 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1880: rs=0x12; hostdatain=0x84;case 1881: rs=0x12; hostdatain=0x84; cs=1; we=1;case 1882: rs=0x12; hostdatain=0x84;
endswitch
9.13.32 パケット数を 1にする
9.13.33 Tokenを SETUPにする
switch(tc)case 1885: rs=0x13; hostdatain=0x10;case 1886: rs=0x13; hostdatain=0x10; cs=1; we=1;case 1887: rs=0x13; hostdatain=0x10;
endswitch
9.13.34 チャネル Aの通信を有効にする
9.13 GetInterface 331
switch(tc)case 1890: rs=0x00; hostdatain=1;case 1891: rs=0x00; hostdatain=1; cs=1; we=1;case 1892: rs=0x00; hostdatain=1;
endswitch
9.13.35 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.13.36 通信済みの割り込みを解除する
switch(tc)case 2790: rs=0x01; hostdatain=1;case 2791: rs=0x01; hostdatain=1; cs=1; we=1;case 2792: rs=0x01; hostdatain=1;
endswitch
9.13.37 フレームの割り込みを解除する
switch(tc)case 2795: rs=0x04; hostdatain=0xc4;case 2796: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 2797: rs=0x04; hostdatain=0xc4;
endswitch
9.13.38 チャネル Aのデータ位置を初期化
switch(tc)case 2800: rs=0x08; hostdatain=0x01;case 2801: rs=0x08; hostdatain=0x01; cs=1; we=1;case 2802: rs=0x08; hostdatain=0x01;
endswitch
332 第 9章 論理譜
9.13.39 Dataステージ no.1
{ ---------------------------------------------------------------- }{ Dataステージ no.1 }{ ---------------------------------------------------------------- }
9.13.40 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.13.41 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 2805: rs=0x12; hostdatain=0x04;case 2806: rs=0x12; hostdatain=0x04; cs=1; we=1;case 2807: rs=0x12; hostdatain=0x04;
endswitch
9.13.42 チャネル Aの通信を有効にする
switch(tc)case 2810: rs=0x00; hostdatain=1;case 2811: rs=0x00; hostdatain=1; cs=1; we=1;case 2812: rs=0x00; hostdatain=1;
endswitch
9.13.43 Dataステージ no.1 後処理
{ --------------------------------------------------------- }{ Dataステージ no.1 後処理 }{ --------------------------------------------------------- }
9.13.44 通信済みの割り込みを解除する
9.13 GetInterface 333
switch(tc)case 3620: rs=0x01; hostdatain=1;case 3621: rs=0x01; hostdatain=1; cs=1; we=1;case 3622: rs=0x01; hostdatain=1;
endswitch
9.13.45 フレームの割り込みを解除する
switch(tc)case 3625: rs=0x04; hostdatain=0xc4;case 3626: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 3627: rs=0x04; hostdatain=0xc4;
endswitch
9.13.46 チャネル Aのデータ位置を初期化
switch(tc)case 3630: rs=0x08; hostdatain=0x01;case 3631: rs=0x08; hostdatain=0x01; cs=1; we=1;case 3632: rs=0x08; hostdatain=0x01;
endswitch
9.13.47 Dataステージ no.2
{ ---------------------------------------------------------------- }{ Dataステージ no.2 }{ ---------------------------------------------------------------- }
9.13.48 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.13.49 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 3635: rs=0x12; hostdatain=0x04;case 3636: rs=0x12; hostdatain=0x04; cs=1; we=1;case 3637: rs=0x12; hostdatain=0x04;
endswitch
334 第 9章 論理譜
9.13.50 チャネル Aの通信を有効にする
switch(tc)case 3640: rs=0x00; hostdatain=1;case 3641: rs=0x00; hostdatain=1; cs=1; we=1;case 3642: rs=0x00; hostdatain=1;
endswitch
ende
9.14 インタラプト転送送信
FL06A10B.lzh{ ========================================================= }{ 06A10Bインタラプト転送送信 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.14.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.14.2 実効譜引用
9.14 インタラプト転送送信 335
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.14.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.14.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x05;case 21: rs=0x07; hostdatain=0x05; cs=1; we=1;case 22: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;
336 第 9章 論理譜
case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.14.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.14.6 デバイス接続検出後処理
{ --------------------------------------------------------- }{ デバイス接続検出後処理 }{ --------------------------------------------------------- }
9.14.7 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
endswitch
9.14.8 チャネル Aのデータ位置を初期化
9.14 インタラプト転送送信 337
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.14.9 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.14.10 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.14.11 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 330: rs=0x12; hostdatain=0x84;case 331: rs=0x12; hostdatain=0x84; cs=1; we=1;case 332: rs=0x12; hostdatain=0x84;
endswitch
9.14.12 パケット数を 1にする
9.14.13 Tokenを SETUPにする
switch(tc)case 335: rs=0x13; hostdatain=0x10;case 336: rs=0x13; hostdatain=0x10; cs=1; we=1;case 337: rs=0x13; hostdatain=0x10;
endswitch
338 第 9章 論理譜
9.14.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 340: rs=0x20; hostdatain=0;case 341: rs=0x20; hostdatain=0; cs=1; we=1;case 342: rs=0x20; hostdatain=0;
endswitch
9.14.15 チャネル Aの通信を有効にする
switch(tc)case 345: rs=0x00; hostdatain=1;case 346: rs=0x00; hostdatain=1; cs=1; we=1;case 347: rs=0x00; hostdatain=1;
endswitch
9.14.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.14.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.14.18 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.14 インタラプト転送送信 339
9.14.19 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.14.20 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.14.21 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.14.22 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.14.23 Statusステージ後処理
{ --------------------------------------------------------- }{ Statusステージ後処理 }{ --------------------------------------------------------- }
9.14.24 通信済みの割り込みを解除する
340 第 9章 論理譜
switch(tc)case 1820: rs=0x01; hostdatain=1;case 1821: rs=0x01; hostdatain=1; cs=1; we=1;case 1822: rs=0x01; hostdatain=1;
endswitch
9.14.25 フレームの割り込みを解除する
switch(tc)case 1825: rs=0x04; hostdatain=0xc4;case 1826: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1827: rs=0x04; hostdatain=0xc4;
endswitch
9.14.26 インタラプト転送データ準備
{ --------------------------------------------------------- }{ インタラプト転送データ準備 }{ --------------------------------------------------------- }
9.14.27 チャネル Aのデータ位置を初期化
switch(tc)case 1830: rs=0x08; hostdatain=0x01;case 1831: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1832: rs=0x08; hostdatain=0x01;
endswitch
9.14.28 チャネル Aにデータを書き込む
switch(tc)case 1835: rs=0x07; hostdatain=0x12;case 1836: rs=0x07; hostdatain=0x12; cs=1; we=1;case 1837: rs=0x07; hostdatain=0x12;
endswitch
switch(tc)case 1840: rs=0x07; hostdatain=0x34;case 1841: rs=0x07; hostdatain=0x34; cs=1; we=1;case 1842: rs=0x07; hostdatain=0x34;
9.14 インタラプト転送送信 341
endswitch
switch(tc)case 1845: rs=0x07; hostdatain=0x56;case 1846: rs=0x07; hostdatain=0x56; cs=1; we=1;case 1847: rs=0x07; hostdatain=0x56;
endswitch
switch(tc)case 1850: rs=0x07; hostdatain=0x78;case 1851: rs=0x07; hostdatain=0x78; cs=1; we=1;case 1852: rs=0x07; hostdatain=0x78;
endswitch
switch(tc)case 1855: rs=0x07; hostdatain=0x9a;case 1856: rs=0x07; hostdatain=0x9a; cs=1; we=1;case 1857: rs=0x07; hostdatain=0x9a;
endswitch
switch(tc)case 1860: rs=0x07; hostdatain=0xbc;case 1861: rs=0x07; hostdatain=0xbc; cs=1; we=1;case 1862: rs=0x07; hostdatain=0xbc;
endswitch
switch(tc)case 1865: rs=0x07; hostdatain=0xde;case 1866: rs=0x07; hostdatain=0xde; cs=1; we=1;case 1867: rs=0x07; hostdatain=0xde;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0xf0;case 1871: rs=0x07; hostdatain=0xf0; cs=1; we=1;case 1872: rs=0x07; hostdatain=0xf0;
endswitch
9.14.29 チャネル Aのデータ位置を初期化
switch(tc)case 1875: rs=0x08; hostdatain=0x01;case 1876: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1877: rs=0x08; hostdatain=0x01;
endswitch
9.14.30 インタラプト転送準備
{ --------------------------------------------------------- }{ インタラプト転送準備 }{ --------------------------------------------------------- }
342 第 9章 論理譜
9.14.31 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.14.32 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1880: rs=0x12; hostdatain=0x84;case 1881: rs=0x12; hostdatain=0x84; cs=1; we=1;case 1882: rs=0x12; hostdatain=0x84;
endswitch
9.14.33 パケット数を 1にする
9.14.34 Tokenを OUTにする
switch(tc)case 1885: rs=0x13; hostdatain=0x18;case 1886: rs=0x13; hostdatain=0x18; cs=1; we=1;case 1887: rs=0x13; hostdatain=0x18;
endswitch
9.14.35 エンドポイントを 1にする
switch(tc)case 1890: rs=0x10; hostdatain=0x01;case 1891: rs=0x10; hostdatain=0x01; cs=1; we=1;case 1892: rs=0x10; hostdatain=0x01;
endswitch
9.14.36 デバイスアドレスを 1にする
switch(tc)
9.15 インタラプト転送受信 343
case 1895: rs=0x14; hostdatain=0x01;case 1896: rs=0x14; hostdatain=0x01; cs=1; we=1;case 1897: rs=0x14; hostdatain=0x01;
endswitch
9.14.37 インタラプト転送送信開始
{ --------------------------------------------------------- }{ インタラプト転送送信開始 }{ --------------------------------------------------------- }
9.14.38 チャネル Aの通信を有効にする
switch(tc)case 1900: rs=0x00; hostdatain=1;case 1901: rs=0x00; hostdatain=1; cs=1; we=1;case 1902: rs=0x00; hostdatain=1;
endswitch
ende
9.15 インタラプト転送受信
FL06A11K.lzh{ ========================================================= }{ 06A11Kインタラプト転送受信 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];bitr T0B[4];bitn d_rp;
344 第 9章 論理譜
9.15.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.15.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm,d_rp)
9.15.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.15.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x05;case 21: rs=0x07; hostdatain=0x05; cs=1; we=1;case 22: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)
9.15 インタラプト転送受信 345
case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.15.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.15.6 デバイス接続検出後処理
{ --------------------------------------------------------- }{ デバイス接続検出後処理 }{ --------------------------------------------------------- }
346 第 9章 論理譜
9.15.7 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
endswitch
9.15.8 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.15.9 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.15.10 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.15.11 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 330: rs=0x12; hostdatain=0x84;case 331: rs=0x12; hostdatain=0x84; cs=1; we=1;case 332: rs=0x12; hostdatain=0x84;
endswitch
9.15.12 パケット数を 1にする
9.15 インタラプト転送受信 347
9.15.13 Tokenを SETUPにする
switch(tc)case 335: rs=0x13; hostdatain=0x10;case 336: rs=0x13; hostdatain=0x10; cs=1; we=1;case 337: rs=0x13; hostdatain=0x10;
endswitch
9.15.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 340: rs=0x20; hostdatain=0;case 341: rs=0x20; hostdatain=0; cs=1; we=1;case 342: rs=0x20; hostdatain=0;
endswitch
9.15.15 チャネル Aの通信を有効にする
switch(tc)case 345: rs=0x00; hostdatain=1;case 346: rs=0x00; hostdatain=1; cs=1; we=1;case 347: rs=0x00; hostdatain=1;
endswitch
9.15.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.15.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;
348 第 9章 論理譜
case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.15.18 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.15.19 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.15.20 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.15.21 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.15.22 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.15 インタラプト転送受信 349
9.15.23 Statusステージ後処理
{ --------------------------------------------------------- }{ Statusステージ後処理 }{ --------------------------------------------------------- }
9.15.24 通信済みの割り込みを解除する
switch(tc)case 1820: rs=0x01; hostdatain=1;case 1821: rs=0x01; hostdatain=1; cs=1; we=1;case 1822: rs=0x01; hostdatain=1;
endswitch
9.15.25 フレームの割り込みを解除する
switch(tc)case 1825: rs=0x04; hostdatain=0xc4;case 1826: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1827: rs=0x04; hostdatain=0xc4;
endswitch
9.15.26 インタラプト転送データ準備
{ --------------------------------------------------------- }{ インタラプト転送データ準備 }{ --------------------------------------------------------- }
9.15.27 チャネル Aのデータ位置を初期化
switch(tc)case 1830: rs=0x08; hostdatain=0x01;case 1831: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1832: rs=0x08; hostdatain=0x01;
endswitch
350 第 9章 論理譜
9.15.28 チャネル Aにデータを書き込む
switch(tc)case 1835: rs=0x07; hostdatain=0x12;case 1836: rs=0x07; hostdatain=0x12; cs=1; we=1;case 1837: rs=0x07; hostdatain=0x12;
endswitch
switch(tc)case 1840: rs=0x07; hostdatain=0x34;case 1841: rs=0x07; hostdatain=0x34; cs=1; we=1;case 1842: rs=0x07; hostdatain=0x34;
endswitch
switch(tc)case 1845: rs=0x07; hostdatain=0x56;case 1846: rs=0x07; hostdatain=0x56; cs=1; we=1;case 1847: rs=0x07; hostdatain=0x56;
endswitch
switch(tc)case 1850: rs=0x07; hostdatain=0x78;case 1851: rs=0x07; hostdatain=0x78; cs=1; we=1;case 1852: rs=0x07; hostdatain=0x78;
endswitch
switch(tc)case 1855: rs=0x07; hostdatain=0x9a;case 1856: rs=0x07; hostdatain=0x9a; cs=1; we=1;case 1857: rs=0x07; hostdatain=0x9a;
endswitch
switch(tc)case 1860: rs=0x07; hostdatain=0xbc;case 1861: rs=0x07; hostdatain=0xbc; cs=1; we=1;case 1862: rs=0x07; hostdatain=0xbc;
endswitch
switch(tc)case 1865: rs=0x07; hostdatain=0xde;case 1866: rs=0x07; hostdatain=0xde; cs=1; we=1;case 1867: rs=0x07; hostdatain=0xde;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0xf0;case 1871: rs=0x07; hostdatain=0xf0; cs=1; we=1;case 1872: rs=0x07; hostdatain=0xf0;
endswitch
9.15.29 チャネル Aのデータ位置を初期化
switch(tc)case 1875: rs=0x08; hostdatain=0x01;case 1876: rs=0x08; hostdatain=0x01; cs=1; we=1;
9.15 インタラプト転送受信 351
case 1877: rs=0x08; hostdatain=0x01;endswitch
9.15.30 インタラプト転送準備
{ --------------------------------------------------------- }{ インタラプト転送準備 }{ --------------------------------------------------------- }
9.15.31 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.15.32 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1880: rs=0x12; hostdatain=0x04;case 1881: rs=0x12; hostdatain=0x04; cs=1; we=1;case 1882: rs=0x12; hostdatain=0x04;
endswitch
9.15.33 エンドポイントを 1にする
switch(tc)case 1885: rs=0x10; hostdatain=0x01;case 1886: rs=0x10; hostdatain=0x01; cs=1; we=1;case 1887: rs=0x10; hostdatain=0x01;
endswitch
9.15.34 デバイスアドレスを 1にする
switch(tc)case 1890: rs=0x14; hostdatain=0x01;case 1891: rs=0x14; hostdatain=0x01; cs=1; we=1;case 1892: rs=0x14; hostdatain=0x01;
endswitch
352 第 9章 論理譜
9.15.35 インタラプト転送受信開始 a
{ --------------------------------------------------------- }{ インタラプト転送受信開始 a }{ --------------------------------------------------------- }
9.15.36 チャネル Aの通信を有効にする
switch(tc)case 1895: rs=0x00; hostdatain=1;case 1896: rs=0x00; hostdatain=1; cs=1; we=1;case 1897: rs=0x00; hostdatain=1;
endswitch
9.15.37 割り込み解除
{ --------------------------------------------------------- }{ 割り込み解除 }{ --------------------------------------------------------- }
9.15.38 通信済みの割り込みを解除する
switch(tc)case 2750: rs=0x01; hostdatain=1;case 2751: rs=0x01; hostdatain=1; cs=1; we=1;case 2752: rs=0x01; hostdatain=1;
endswitch
9.15.39 フレームの割り込みを解除する
switch(tc)case 2755: rs=0x04; hostdatain=0xc4;case 2756: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 2757: rs=0x04; hostdatain=0xc4;
endswitch
9.15 インタラプト転送受信 353
9.15.40 インタラプト転送受信開始 b
{ --------------------------------------------------------- }{ インタラプト転送受信開始 b }{ --------------------------------------------------------- }
9.15.41 チャネル Aのデータ位置を初期化
switch(tc)case 2760: rs=0x08; hostdatain=0x01;case 2761: rs=0x08; hostdatain=0x01; cs=1; we=1;case 2762: rs=0x08; hostdatain=0x01;
endswitch
9.15.42 チャネル Aの通信を有効にする
switch(tc)case 2765: rs=0x00; hostdatain=1;case 2766: rs=0x00; hostdatain=1; cs=1; we=1;case 2767: rs=0x00; hostdatain=1;
endswitch
9.15.43 エンドポイントの読み出しの計数
{ --------------------------------------------------------- }{ エンドポイントの読み出しの計数 }{ --------------------------------------------------------- }
if (tc<5)T0B=0;
elseif (d_rp)
T0B=T0B+1;else
T0B=T0B;endif
endif
9.15.44 エンドポイントの読み出しのデータ
354 第 9章 論理譜
{ --------------------------------------------------------- }{ エンドポイントの読み出しのデータ }{ --------------------------------------------------------- }
switch(T0B)case 0: edatain=0x11;case 1: edatain=0x22;case 2: edatain=0x33;case 3: edatain=0x44;case 4: edatain=0x55;case 5: edatain=0x66;case 6: edatain=0x77;case 7: edatain=0x88;case 8: edatain=0x99;case 9: edatain=0xaa;case 10: edatain=0xbb;case 11: edatain=0xcc;case 12: edatain=0xdd;case 13: edatain=0xee;case 14: edatain=0xff;case 15: edatain=0x12;
endswitch
ende
9.16 アイソクロナス転送送信
FL06A11BF.lzh{ ========================================================= }{ 06A11BFアイソクロナス転送送信 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];
9.16.1 クロック
{ --------------------------------------------------------- }{ クロック }
9.16 アイソクロナス転送送信 355
{ --------------------------------------------------------- }tc=tc+1;
if (tc<5) reset=1; endif
9.16.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm)
9.16.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.16.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x05;case 21: rs=0x07; hostdatain=0x05; cs=1; we=1;case 22: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
356 第 9章 論理譜
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.16.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
9.16.6 デバイス接続検出後処理
{ --------------------------------------------------------- }{ デバイス接続検出後処理 }{ --------------------------------------------------------- }
9.16.7 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
9.16 アイソクロナス転送送信 357
endswitch
9.16.8 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.16.9 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.16.10 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.16.11 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 330: rs=0x12; hostdatain=0x84;case 331: rs=0x12; hostdatain=0x84; cs=1; we=1;case 332: rs=0x12; hostdatain=0x84;
endswitch
9.16.12 パケット数を 1にする
9.16.13 Tokenを SETUPにする
358 第 9章 論理譜
switch(tc)case 335: rs=0x13; hostdatain=0x10;case 336: rs=0x13; hostdatain=0x10; cs=1; we=1;case 337: rs=0x13; hostdatain=0x10;
endswitch
9.16.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 340: rs=0x20; hostdatain=0;case 341: rs=0x20; hostdatain=0; cs=1; we=1;case 342: rs=0x20; hostdatain=0;
endswitch
9.16.15 チャネル Aの通信を有効にする
switch(tc)case 345: rs=0x00; hostdatain=1;case 346: rs=0x00; hostdatain=1; cs=1; we=1;case 347: rs=0x00; hostdatain=1;
endswitch
9.16.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }{ --------------------------------------------------------- }
9.16.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.16.18 フレームの割り込みを解除する
9.16 アイソクロナス転送送信 359
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.16.19 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.16.20 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.16.21 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.16.22 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.16.23 Statusステージ後処理
{ --------------------------------------------------------- }{ Statusステージ後処理 }
360 第 9章 論理譜
{ --------------------------------------------------------- }
9.16.24 通信済みの割り込みを解除する
switch(tc)case 1820: rs=0x01; hostdatain=1;case 1821: rs=0x01; hostdatain=1; cs=1; we=1;case 1822: rs=0x01; hostdatain=1;
endswitch
9.16.25 フレームの割り込みを解除する
switch(tc)case 1825: rs=0x04; hostdatain=0xc4;case 1826: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1827: rs=0x04; hostdatain=0xc4;
endswitch
9.16.26 アイソクロナス転送データ準備
{ --------------------------------------------------------- }{ アイソクロナス転送データ準備 }{ --------------------------------------------------------- }
9.16.27 チャネル Aのデータ位置を初期化
switch(tc)case 1830: rs=0x08; hostdatain=0x01;case 1831: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1832: rs=0x08; hostdatain=0x01;
endswitch
9.16.28 チャネル Aにデータを書き込む
switch(tc)case 1835: rs=0x07; hostdatain=0x12;case 1836: rs=0x07; hostdatain=0x12; cs=1; we=1;
9.16 アイソクロナス転送送信 361
case 1837: rs=0x07; hostdatain=0x12;endswitch
switch(tc)case 1840: rs=0x07; hostdatain=0x34;case 1841: rs=0x07; hostdatain=0x34; cs=1; we=1;case 1842: rs=0x07; hostdatain=0x34;
endswitch
switch(tc)case 1845: rs=0x07; hostdatain=0x56;case 1846: rs=0x07; hostdatain=0x56; cs=1; we=1;case 1847: rs=0x07; hostdatain=0x56;
endswitch
switch(tc)case 1850: rs=0x07; hostdatain=0x78;case 1851: rs=0x07; hostdatain=0x78; cs=1; we=1;case 1852: rs=0x07; hostdatain=0x78;
endswitch
switch(tc)case 1855: rs=0x07; hostdatain=0x9a;case 1856: rs=0x07; hostdatain=0x9a; cs=1; we=1;case 1857: rs=0x07; hostdatain=0x9a;
endswitch
switch(tc)case 1860: rs=0x07; hostdatain=0xbc;case 1861: rs=0x07; hostdatain=0xbc; cs=1; we=1;case 1862: rs=0x07; hostdatain=0xbc;
endswitch
switch(tc)case 1865: rs=0x07; hostdatain=0xde;case 1866: rs=0x07; hostdatain=0xde; cs=1; we=1;case 1867: rs=0x07; hostdatain=0xde;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0xf0;case 1871: rs=0x07; hostdatain=0xf0; cs=1; we=1;case 1872: rs=0x07; hostdatain=0xf0;
endswitch
9.16.29 チャネル Aのデータ位置を初期化
switch(tc)case 1875: rs=0x08; hostdatain=0x01;case 1876: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1877: rs=0x08; hostdatain=0x01;
endswitch
9.16.30 アイソクロナス転送準備
362 第 9章 論理譜
{ --------------------------------------------------------- }{ アイソクロナス転送準備 }{ --------------------------------------------------------- }
9.16.31 チャネル Aの設定レジスタ 2の転送形式を 3にする
9.16.32 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.16.33 チャネル Aの設定レジスタのデータ数を 8にする
switch(tc)case 1880: rs=0x12; hostdatain=0xb4;case 1881: rs=0x12; hostdatain=0xb4; cs=1; we=1;case 1882: rs=0x12; hostdatain=0xb4;
endswitch
9.16.34 パケット数を 1にする
9.16.35 Tokenを OUTにする
switch(tc)case 1885: rs=0x13; hostdatain=0x18;case 1886: rs=0x13; hostdatain=0x18; cs=1; we=1;case 1887: rs=0x13; hostdatain=0x18;
endswitch
9.16.36 エンドポイントを 2にする
switch(tc)
9.17 アイソクロナス転送受信 363
case 1890: rs=0x10; hostdatain=0x02;case 1891: rs=0x10; hostdatain=0x02; cs=1; we=1;case 1892: rs=0x10; hostdatain=0x02;
endswitch
9.16.37 デバイスアドレスを 1にする
switch(tc)case 1895: rs=0x14; hostdatain=0x01;case 1896: rs=0x14; hostdatain=0x01; cs=1; we=1;case 1897: rs=0x14; hostdatain=0x01;
endswitch
9.16.38 アイソクロナス転送送信開始
{ --------------------------------------------------------- }{ アイソクロナス転送送信開始 }{ --------------------------------------------------------- }
9.16.39 チャネル Aの通信を有効にする
switch(tc)case 1900: rs=0x00; hostdatain=1;case 1901: rs=0x00; hostdatain=1; cs=1; we=1;case 1902: rs=0x00; hostdatain=1;
endswitch
ende
9.17 アイソクロナス転送受信
FL06A12A.lzh{ ========================================================= }{ 06A12Aアイソクロナス転送受信 }{ ========================================================= }entity simoutput reset;output edatain[8];output cs;output re;output we;output rs[6];
364 第 9章 論理譜
output p[4];output hostdatain[8];output dp;output dm;output rdp;output rdm;
bitr tc[16];bitr T0B[4];bitn d_rp;
9.17.1 クロック
{ --------------------------------------------------------- }{ クロック }{ --------------------------------------------------------- }
tc=tc+1;
if (tc<5) reset=1; endif
9.17.2 実効譜引用
{ --------------------------------------------------------- }{ 実効譜引用 }{ --------------------------------------------------------- }
part main(reset,edatain,cs,re,we,rs,hostdatain,dp,dm,rdp,rdm,d_rp)
9.17.3 デバイス接続
{ --------------------------------------------------------- }{ デバイス接続 }{ --------------------------------------------------------- }
if (tc>20) dp=1; endif
9.17.4 チャネル Aのメモリにデバイスリクエストを書き込む
{ ------------------------------------------------------------------ }{ チャネル Aのメモリにデバイスリクエストを書き込む }{ ------------------------------------------------------------------ }
switch(tc)
9.17 アイソクロナス転送受信 365
case 15: rs=0x07; hostdatain=0x00;case 16: rs=0x07; hostdatain=0x00; cs=1; we=1;case 17: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 20: rs=0x07; hostdatain=0x05;case 21: rs=0x07; hostdatain=0x05; cs=1; we=1;case 22: rs=0x07; hostdatain=0x05;
endswitch
switch(tc)case 25: rs=0x07; hostdatain=0x01;case 26: rs=0x07; hostdatain=0x01; cs=1; we=1;case 27: rs=0x07; hostdatain=0x01;
endswitch
switch(tc)case 30: rs=0x07; hostdatain=0x00;case 31: rs=0x07; hostdatain=0x00; cs=1; we=1;case 32: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 35: rs=0x07; hostdatain=0x00;case 36: rs=0x07; hostdatain=0x00; cs=1; we=1;case 37: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 40: rs=0x07; hostdatain=0x00;case 41: rs=0x07; hostdatain=0x00; cs=1; we=1;case 42: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 45: rs=0x07; hostdatain=0x00;case 46: rs=0x07; hostdatain=0x00; cs=1; we=1;case 47: rs=0x07; hostdatain=0x00;
endswitch
switch(tc)case 50: rs=0x07; hostdatain=0x00;case 51: rs=0x07; hostdatain=0x00; cs=1; we=1;case 52: rs=0x07; hostdatain=0x00;
endswitch
9.17.5 割り込みマスクを解除して割り込み許可
{ --------------------------------------------------------- }{ 割り込みマスクを解除して割り込み許可 }{ --------------------------------------------------------- }
switch(tc)case 55: rs=4; hostdatain=0xc0;case 56: rs=4; hostdatain=0xc0; cs=1; we=1;case 57: rs=4; hostdatain=0xc0;
endswitch
366 第 9章 論理譜
9.17.6 デバイス接続検出後処理
{ --------------------------------------------------------- }{ デバイス接続検出後処理 }{ --------------------------------------------------------- }
9.17.7 接続検出の割り込みを解除する
switch(tc)case 320: rs=0x02; hostdatain=1;case 321: rs=0x02; hostdatain=1; cs=1; we=1;case 322: rs=0x02; hostdatain=1;
endswitch
9.17.8 チャネル Aのデータ位置を初期化
switch(tc)case 325: rs=0x08; hostdatain=0x01;case 326: rs=0x08; hostdatain=0x01; cs=1; we=1;case 327: rs=0x08; hostdatain=0x01;
endswitch
9.17.9 Setupステージ
{ --------------------------------------------------------- }{ Setupステージ }{ --------------------------------------------------------- }
9.17.10 チャネル Aの設定レジスタ 2の I/Oを 1にする
9.17.11 チャネル Aの設定レジスタのデータ数を 8にする
9.17 アイソクロナス転送受信 367
switch(tc)case 330: rs=0x12; hostdatain=0x84;case 331: rs=0x12; hostdatain=0x84; cs=1; we=1;case 332: rs=0x12; hostdatain=0x84;
endswitch
9.17.12 パケット数を 1にする
9.17.13 Tokenを SETUPにする
switch(tc)case 335: rs=0x13; hostdatain=0x10;case 336: rs=0x13; hostdatain=0x10; cs=1; we=1;case 337: rs=0x13; hostdatain=0x10;
endswitch
9.17.14 チャネル Aを端子 0のセグメント 0に登録する
switch(tc)case 340: rs=0x20; hostdatain=0;case 341: rs=0x20; hostdatain=0; cs=1; we=1;case 342: rs=0x20; hostdatain=0;
endswitch
9.17.15 チャネル Aの通信を有効にする
switch(tc)case 345: rs=0x00; hostdatain=1;case 346: rs=0x00; hostdatain=1; cs=1; we=1;case 347: rs=0x00; hostdatain=1;
endswitch
9.17.16 Setupステージ後処理
{ --------------------------------------------------------- }{ Setupステージ後処理 }
368 第 9章 論理譜
{ --------------------------------------------------------- }
9.17.17 通信済みの割り込みを解除する
switch(tc)case 1250: rs=0x01; hostdatain=1;case 1251: rs=0x01; hostdatain=1; cs=1; we=1;case 1252: rs=0x01; hostdatain=1;
endswitch
9.17.18 フレームの割り込みを解除する
switch(tc)case 1255: rs=0x04; hostdatain=0xc4;case 1256: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1257: rs=0x04; hostdatain=0xc4;
endswitch
9.17.19 Statusステージ
{ ---------------------------------------------------------------- }{ Statusステージ }{ ---------------------------------------------------------------- }
9.17.20 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.17.21 チャネル Aの設定レジスタのデータ数を 0にする
switch(tc)case 1260: rs=0x12; hostdatain=0x00;case 1261: rs=0x12; hostdatain=0x00; cs=1; we=1;case 1262: rs=0x12; hostdatain=0x00;
endswitch
9.17 アイソクロナス転送受信 369
9.17.22 チャネル Aの通信を有効にする
switch(tc)case 1265: rs=0x00; hostdatain=1;case 1266: rs=0x00; hostdatain=1; cs=1; we=1;case 1267: rs=0x00; hostdatain=1;
endswitch
9.17.23 Statusステージ後処理
{ --------------------------------------------------------- }{ Statusステージ後処理 }{ --------------------------------------------------------- }
9.17.24 通信済みの割り込みを解除する
switch(tc)case 1820: rs=0x01; hostdatain=1;case 1821: rs=0x01; hostdatain=1; cs=1; we=1;case 1822: rs=0x01; hostdatain=1;
endswitch
9.17.25 フレームの割り込みを解除する
switch(tc)case 1825: rs=0x04; hostdatain=0xc4;case 1826: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 1827: rs=0x04; hostdatain=0xc4;
endswitch
9.17.26 アイソクロナス転送データ準備
{ --------------------------------------------------------- }{ アイソクロナス転送データ準備 }{ --------------------------------------------------------- }
370 第 9章 論理譜
9.17.27 チャネル Aのデータ位置を初期化
switch(tc)case 1830: rs=0x08; hostdatain=0x01;case 1831: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1832: rs=0x08; hostdatain=0x01;
endswitch
9.17.28 チャネル Aにデータを書き込む
switch(tc)case 1835: rs=0x07; hostdatain=0x12;case 1836: rs=0x07; hostdatain=0x12; cs=1; we=1;case 1837: rs=0x07; hostdatain=0x12;
endswitch
switch(tc)case 1840: rs=0x07; hostdatain=0x34;case 1841: rs=0x07; hostdatain=0x34; cs=1; we=1;case 1842: rs=0x07; hostdatain=0x34;
endswitch
switch(tc)case 1845: rs=0x07; hostdatain=0x56;case 1846: rs=0x07; hostdatain=0x56; cs=1; we=1;case 1847: rs=0x07; hostdatain=0x56;
endswitch
switch(tc)case 1850: rs=0x07; hostdatain=0x78;case 1851: rs=0x07; hostdatain=0x78; cs=1; we=1;case 1852: rs=0x07; hostdatain=0x78;
endswitch
switch(tc)case 1855: rs=0x07; hostdatain=0x9a;case 1856: rs=0x07; hostdatain=0x9a; cs=1; we=1;case 1857: rs=0x07; hostdatain=0x9a;
endswitch
switch(tc)case 1860: rs=0x07; hostdatain=0xbc;case 1861: rs=0x07; hostdatain=0xbc; cs=1; we=1;case 1862: rs=0x07; hostdatain=0xbc;
endswitch
switch(tc)case 1865: rs=0x07; hostdatain=0xde;case 1866: rs=0x07; hostdatain=0xde; cs=1; we=1;case 1867: rs=0x07; hostdatain=0xde;
endswitch
switch(tc)case 1870: rs=0x07; hostdatain=0xf0;case 1871: rs=0x07; hostdatain=0xf0; cs=1; we=1;
9.17 アイソクロナス転送受信 371
case 1872: rs=0x07; hostdatain=0xf0;endswitch
9.17.29 チャネル Aのデータ位置を初期化
switch(tc)case 1875: rs=0x08; hostdatain=0x01;case 1876: rs=0x08; hostdatain=0x01; cs=1; we=1;case 1877: rs=0x08; hostdatain=0x01;
endswitch
9.17.30 アイソクロナス転送準備
{ --------------------------------------------------------- }{ アイソクロナス転送準備 }{ --------------------------------------------------------- }
9.17.31 チャネル Aの設定レジスタ 2の転送形式を 3にする
9.17.32 チャネル Aの設定レジスタ 2の I/Oを 0にする
9.17.33 チャネル Aの設定レジスタ 2のデータ数を 8にする
switch(tc)case 1880: rs=0x12; hostdatain=0x34;case 1881: rs=0x12; hostdatain=0x34; cs=1; we=1;case 1882: rs=0x12; hostdatain=0x34;
endswitch
9.17.34 パケット数を 1にする
372 第 9章 論理譜
switch(tc)case 1885: rs=0x13; hostdatain=0x18;case 1886: rs=0x13; hostdatain=0x18; cs=1; we=1;case 1887: rs=0x13; hostdatain=0x18;
endswitch
9.17.35 エンドポイントを 2にする
switch(tc)case 1890: rs=0x10; hostdatain=0x02;case 1891: rs=0x10; hostdatain=0x02; cs=1; we=1;case 1892: rs=0x10; hostdatain=0x02;
endswitch
9.17.36 デバイスアドレスを 1にする
switch(tc)case 1895: rs=0x14; hostdatain=0x01;case 1896: rs=0x14; hostdatain=0x01; cs=1; we=1;case 1897: rs=0x14; hostdatain=0x01;
endswitch
9.17.37 アイソクロナス転送送信開始 a
{ --------------------------------------------------------- }{ アイソクロナス転送送信開始 a }{ --------------------------------------------------------- }
9.17.38 チャネル Aの通信を有効にする
switch(tc)case 1900: rs=0x00; hostdatain=1;case 1901: rs=0x00; hostdatain=1; cs=1; we=1;case 1902: rs=0x00; hostdatain=1;
endswitch
9.17.39 割り込み解除と次の準備
9.17 アイソクロナス転送受信 373
{ --------------------------------------------------------- }{ 割り込み解除と次の準備 }{ --------------------------------------------------------- }
9.17.40 チャネル Aのデータ位置を初期化
switch(tc)case 2670: rs=0x08; hostdatain=0x01;case 2671: rs=0x08; hostdatain=0x01; cs=1; we=1;case 2672: rs=0x08; hostdatain=0x01;
endswitch
9.17.41 通信済みの割り込みを解除する
switch(tc)case 2675: rs=0x01; hostdatain=1;case 2676: rs=0x01; hostdatain=1; cs=1; we=1;case 2677: rs=0x01; hostdatain=1;
endswitch
9.17.42 フレームの割り込みを解除する
switch(tc)case 2680: rs=0x04; hostdatain=0xc4;case 2681: rs=0x04; hostdatain=0xc4; cs=1; we=1;case 2682: rs=0x04; hostdatain=0xc4;
endswitch
9.17.43 アイソクロナス転送送信開始 b
{ --------------------------------------------------------- }{ アイソクロナス転送送信開始 b }{ --------------------------------------------------------- }
9.17.44 チャネル Aの通信を有効にする
374 第 9章 論理譜
switch(tc)case 2685: rs=0x00; hostdatain=1;case 2686: rs=0x00; hostdatain=1; cs=1; we=1;case 2687: rs=0x00; hostdatain=1;
endswitch
9.17.45 エンドポイントの読み出しの計数
{ --------------------------------------------------------- }{ エンドポイントの読み出しの計数 }{ --------------------------------------------------------- }
if (tc<5)T0B=0;
elseif (d_rp)
T0B=T0B+1;else
T0B=T0B;endif
endif
9.17.46 エンドポイントの読み出しのデータ
{ --------------------------------------------------------- }{ エンドポイントの読み出しのデータ }{ --------------------------------------------------------- }
switch(T0B)case 0: edatain=0x11;case 1: edatain=0x22;case 2: edatain=0x33;case 3: edatain=0x44;case 4: edatain=0x55;case 5: edatain=0x66;case 6: edatain=0x77;case 7: edatain=0x88;case 8: edatain=0x99;case 9: edatain=0xaa;case 10: edatain=0xbb;case 11: edatain=0xcc;case 12: edatain=0xdd;case 13: edatain=0xee;case 14: edatain=0xff;case 15: edatain=0x12;
endswitch
ende
endlogic