Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -uPrb Org/readme_mod.txt Mod/readme_mod.txt
- --- Org/readme_mod.txt 1970-01-01 09:00:00.000000000 +0900
- +++ Mod/readme_mod.txt 2014-11-14 00:07:37.000000000 +0900
- @@ -0,0 +1,56 @@
- +Bulldog チューナー用 BonDriver 改変パッチ当てMODソース @ 2014/11/14
- +
- + 以下の2ファイルを BonDriver_Bulldog.dll と同じ場所において使用する。
- +
- + BonDriver_Bulldog.ini ; 設定ファル
- + BonDriver_Bulldog.ch.txt ; チャンネル定義ファイル
- +
- + オプティマイズで配布しているカメレオンUSBFX2のID書きツール(FX2WRID)を
- + 利用すると大量のBulldogチューナーを同時利用することもできる筈だが未検証。
- +
- + <例> ID=0 のチューナー
- + BonDriver_Bulldog_0.dll ; BonDriver_Bulldog.dll を複製したもの
- + BonDriver_Bulldog_0.ini ; BonDriver_Bulldog.ini を複製したもの
- + BonDriver_Bulldog_0.ch.txt ; BonDriver_Bulldog.ch.txt を複製したもの
- +
- + <例> ID=1 のチューナー
- + BonDriver_Bulldog_1.dll ; BonDriver_Bulldog.dll を複製したもの
- + BonDriver_Bulldog_1.ini ; BonDriver_Bulldog.ini を複製したもの
- + BonDriver_Bulldog_1.ch.txt ; BonDriver_Bulldog.ch.txt を複製したもの
- +
- + <例> ID=2 のチューナー
- + BonDriver_Bulldog_2.dll ; BonDriver_Bulldog.dll を複製したもの
- + BonDriver_Bulldog_2.ini ; BonDriver_Bulldog.ini を複製したもの
- + BonDriver_Bulldog_2.ch.txt ; BonDriver_Bulldog.ch.txt を複製したもの
- +
- +2014/10/24 からの修正内容
- +
- + ・FX2側のバッファ待機処理にマルチスレッドレベルで最適化できる処理を追加
- + ( ドロップが稀に発生する環境で効果を発揮 )
- +
- + ini に TSDualThreading = 1 と書くことで有効化
- + (※非力PCでは 0 かコメントアウト推奨)
- +
- + ・FX2側のバッファ待機限界秒数を500msから1000msに初期値を変更
- + ( ini に TSThreadWait=2000 などと書くことによって待機時間を別途変更可能 )
- + ・FX2側の待機スレッドの優先順位を変えることのできるパラメータを ini に追加
- +
- + TSThreadPriority = -15 ~ 15
- + 15 : TimeCritical(最高)
- + 2 : Highest(高い) ※デフォルト
- + 1 : Higher(やや高い)
- + 0 : Normal(普通)
- + -1 : Lower(やや低い)
- + -2 : Lowest(低い)
- + -15 : Idle(最低)
- +
- +2014/1/26 からの修正内容
- +
- + ・CATV C22 チャンネル周波数修正
- +
- +2013/12/28 からの修正内容
- +
- + ・チューナーを開いた時に発生するUSB抜き差し音の除去(OpenDriver)
- + ・チャンネルファイルを書換えた場合の受信レベル表示修正(GetCN/GetBER)
- + ・Spinel用バッファ待機最適化(WaitTsStream)
- +
- diff -uPrb Org/BonDriver_Bulldog.ch - MHz.txt Mod/BonDriver_Bulldog.ch - MHz.txt
- --- Org/BonDriver_Bulldog.ch - MHz.txt 1970-01-01 09:00:00.000000000 +0900
- +++ Mod/BonDriver_Bulldog.ch - MHz.txt 2014-10-24 09:39:38.000000000 +0900
- @@ -0,0 +1,191 @@
- +; Bulldog 用 チャンネルファイル 周波数MHz表記修正版rev3 (2014/10/24)
- +;
- +; チャンネル情報を変更する場合は、このファイルを編集して
- +; プレフィックスが同じ名前のドライバと同ディレクトリに
- +; 拡張子 .ch.txt としてこのファイルを置くこと。
- +;
- +; ※ スペースの名前と順番は間違えてはいけないと思います。
- +;
- +; スペース名, サービスID, 物理チャンネル番号or周波数MHz, TSID, チャンネル名
- +
- + ; VHF
- +
- +VHF, 0, 93.143MHz,0x0000, 1
- +VHF, 0, 99.143MHz,0x0000, 2
- +VHF, 0,105.143MHz,0x0000, 3
- +VHF, 0,173.143MHz,0x0000, 4
- +VHF, 0,179.143MHz,0x0000, 5
- +VHF, 0,185.143MHz,0x0000, 6
- +VHF, 0,191.143MHz,0x0000, 7
- +VHF, 0,195.143MHz,0x0000, 8
- +VHF, 0,201.143MHz,0x0000, 9
- +VHF, 0,207.143MHz,0x0000,10
- +VHF, 0,213.143MHz,0x0000,11
- +VHF, 0,219.143MHz,0x0000,12
- +
- + ; UHF
- +
- +UHF, 0,473.143MHz,0x0000,13
- +UHF, 0,479.143MHz,0x0000,14
- +UHF, 0,485.143MHz,0x0000,15
- +UHF, 0,491.143MHz,0x0000,16
- +UHF, 0,497.143MHz,0x0000,17
- +UHF, 0,503.143MHz,0x0000,18
- +UHF, 0,509.143MHz,0x0000,19
- +UHF, 0,515.143MHz,0x0000,20
- +UHF, 0,521.143MHz,0x0000,21
- +UHF, 0,527.143MHz,0x0000,22
- +UHF, 0,533.143MHz,0x0000,23
- +UHF, 0,539.143MHz,0x0000,24
- +UHF, 0,545.143MHz,0x0000,25
- +UHF, 0,551.143MHz,0x0000,26
- +UHF, 0,557.143MHz,0x0000,27
- +UHF, 0,563.143MHz,0x0000,28
- +UHF, 0,569.143MHz,0x0000,29
- +UHF, 0,575.143MHz,0x0000,30
- +UHF, 0,581.143MHz,0x0000,31
- +UHF, 0,587.143MHz,0x0000,32
- +UHF, 0,593.143MHz,0x0000,33
- +UHF, 0,599.143MHz,0x0000,34
- +UHF, 0,605.143MHz,0x0000,35
- +UHF, 0,611.143MHz,0x0000,36
- +UHF, 0,617.143MHz,0x0000,37
- +UHF, 0,623.143MHz,0x0000,38
- +UHF, 0,629.143MHz,0x0000,39
- +UHF, 0,635.143MHz,0x0000,40
- +UHF, 0,641.143MHz,0x0000,41
- +UHF, 0,647.143MHz,0x0000,42
- +UHF, 0,653.143MHz,0x0000,43
- +UHF, 0,659.143MHz,0x0000,44
- +UHF, 0,665.143MHz,0x0000,45
- +UHF, 0,671.143MHz,0x0000,46
- +UHF, 0,677.143MHz,0x0000,47
- +UHF, 0,683.143MHz,0x0000,48
- +UHF, 0,689.143MHz,0x0000,49
- +UHF, 0,695.143MHz,0x0000,50
- +UHF, 0,701.143MHz,0x0000,51
- +UHF, 0,707.143MHz,0x0000,52
- +UHF, 0,713.143MHz,0x0000,53
- +UHF, 0,719.143MHz,0x0000,54
- +UHF, 0,725.143MHz,0x0000,55
- +UHF, 0,731.143MHz,0x0000,56
- +UHF, 0,737.143MHz,0x0000,57
- +UHF, 0,743.143MHz,0x0000,58
- +UHF, 0,749.143MHz,0x0000,59
- +UHF, 0,755.143MHz,0x0000,60
- +UHF, 0,761.143MHz,0x0000,61
- +UHF, 0,767.143MHz,0x0000,62
- +
- + ; CATV
- +
- +CATV, 0,111.143MHz,0x0000,C13
- +CATV, 0,117.143MHz,0x0000,C14
- +CATV, 0,123.143MHz,0x0000,C15
- +CATV, 0,129.143MHz,0x0000,C16
- +CATV, 0,135.143MHz,0x0000,C17
- +CATV, 0,141.143MHz,0x0000,C18
- +CATV, 0,147.143MHz,0x0000,C19
- +CATV, 0,153.143MHz,0x0000,C20
- +CATV, 0,159.143MHz,0x0000,C21
- +CATV, 0,167.143MHz,0x0000,C22
- +CATV, 0,225.143MHz,0x0000,C23
- +CATV, 0,231.143MHz,0x0000,C24
- +CATV, 0,237.143MHz,0x0000,C25
- +CATV, 0,243.143MHz,0x0000,C26
- +CATV, 0,249.143MHz,0x0000,C27
- +CATV, 0,255.143MHz,0x0000,C28
- +CATV, 0,261.143MHz,0x0000,C29
- +CATV, 0,267.143MHz,0x0000,C30
- +CATV, 0,273.143MHz,0x0000,C31
- +CATV, 0,279.143MHz,0x0000,C32
- +CATV, 0,285.143MHz,0x0000,C33
- +CATV, 0,291.143MHz,0x0000,C34
- +CATV, 0,297.143MHz,0x0000,C35
- +CATV, 0,303.143MHz,0x0000,C36
- +CATV, 0,309.143MHz,0x0000,C37
- +CATV, 0,315.143MHz,0x0000,C38
- +CATV, 0,321.143MHz,0x0000,C39
- +CATV, 0,327.143MHz,0x0000,C40
- +CATV, 0,333.143MHz,0x0000,C41
- +CATV, 0,339.143MHz,0x0000,C42
- +CATV, 0,345.143MHz,0x0000,C43
- +CATV, 0,351.143MHz,0x0000,C44
- +CATV, 0,357.143MHz,0x0000,C45
- +CATV, 0,363.143MHz,0x0000,C46
- +CATV, 0,369.143MHz,0x0000,C47
- +CATV, 0,375.143MHz,0x0000,C48
- +CATV, 0,381.143MHz,0x0000,C49
- +CATV, 0,387.143MHz,0x0000,C50
- +CATV, 0,393.143MHz,0x0000,C51
- +CATV, 0,399.143MHz,0x0000,C52
- +CATV, 0,405.143MHz,0x0000,C53
- +CATV, 0,411.143MHz,0x0000,C54
- +CATV, 0,417.143MHz,0x0000,C55
- +CATV, 0,423.143MHz,0x0000,C56
- +CATV, 0,429.143MHz,0x0000,C57
- +CATV, 0,435.143MHz,0x0000,C58
- +CATV, 0,441.143MHz,0x0000,C59
- +CATV, 0,447.143MHz,0x0000,C60
- +CATV, 0,453.143MHz,0x0000,C61
- +CATV, 0,459.143MHz,0x0000,C62
- +CATV, 0,465.143MHz,0x0000,C63
- +
- + ; BS (ストリームが重複するチャンネルはコメントアウトしている)
- +
- +BS, 151, 1049.48MHz,0x4010,BS1/TS0 ;BS朝日
- +BS, 161, 1049.48MHz,0x4011,BS1/TS1 ;BS-TBS
- +BS, 191, 1087.84MHz,0x4030,BS3/TS0 ;WOWOWプライム
- +;BS, 791, 1356.36MHz,0x4030,BS3/TS0 ;navi
- +BS, 171, 1087.84MHz,0x4031,BS3/TS1 ;BSジャパン
- +BS, 192, 1126.20MHz,0x4450,BS5/TS0 ;WOWOWライブ
- +BS, 193, 1126.20MHz,0x4451,BS5/TS1 ;WOWOWシネマ
- +BS, 201, 1164.56MHz,0x4470,BS7/TS0 ;スター・チャンネル2
- +;BS, 202, 1164.56MHz,0x4470,BS7/TS0 ;スター・チャンネル3
- +BS, 236, 1164.56MHz,0x4671,BS7/TS1 ;BSアニマックス
- +BS, 256, 1164.56MHz,0x4672,BS7/TS2 ;ディズニー・チャンネル
- +BS, 211, 1202.92MHz,0x4090,BS9/TS0 ;BS11
- +BS, 200, 1202.92MHz,0x4091,BS9/TS1 ;スター・チャンネル1
- +BS, 222, 1202.92MHz,0x4092,BS9/TS2 ;TwellV
- +BS, 238, 1241.28MHz,0x46B0,BS11/TS0 ;FOX bs238
- +BS, 241, 1241.28MHz,0x46B1,BS11/TS1 ;BSスカパー!
- +BS, 231, 1241.28MHz,0x46B2,BS11/TS2 ;放送大学BS1
- +;BS, 232, 1241.28MHz,0x46B2,BS11/TS2 ;放送大学BS2
- +;BS, 233, 1241.28MHz,0x46B2,BS11/TS2 ;放送大学BS3
- +BS, 141, 1279.64MHz,0x40D0,BS13/TS0 ;BS日テレ
- +BS, 181, 1279.64MHz,0x40D1,BS13/TS1 ;BSフジ
- +BS, 101, 1318.00MHz,0x40F1,BS15/TS1 ;NHKBS1
- +BS, 103, 1318.00MHz,0x40F2,BS15/TS2 ;NHKBSプレミアム
- +;BS, 910, 1356.36MHz,0x40F2,BS15/TS2 ;WNI・910
- +BS, 291, 1356.36MHz,0x4310,BS17/TS1 ;NHK総合・東京
- +;BS, 292, 1356.36MHz,0x4310,BS17/TS1 ;NHKEテレ東京
- +BS, 294, 1356.36MHz,0x4311,BS17/TS2 ;日テレ
- +;BS, 295, 1356.36MHz,0x4311,BS17/TS2 ;テレビ朝日
- +;BS, 296, 1356.36MHz,0x4311,BS17/TS2 ;TBS
- +;BS, 297, 1356.36MHz,0x4311,BS17/TS2 ;テレビ東京
- +;BS, 298, 1356.36MHz,0x4310,BS17/TS1 ;フジテレビ
- +;BS, 531, 1356.36MHz,0x46B2,BS11/TS2 放送大学ラジオ
- +BS, 234, 1394.72MHz,0x4730,BS19/TS0 ;グリーンチャンネル
- +BS, 242, 1394.72MHz,0x4731,BS19/TS1 ;J SPORTS 1
- +BS, 243, 1394.72MHz,0x4732,BS19/TS2 ;J SPORTS 2
- +BS, 252, 1433.08MHz,0x4750,BS21/TS0 ;IMAGICA BS
- +BS, 244, 1433.08MHz,0x4751,BS21/TS1 ;J SPORTS 3
- +BS, 245, 1433.08MHz,0x4752,BS21/TS2 ;J SPORTS 4
- +BS, 251, 1471.44MHz,0x4770,BS23/TS0 ;BS釣りビジョン
- +BS, 255, 1471.44MHz,0x4771,BS23/TS1 ;日本映画専門チャンネル
- +BS, 258, 1471.44MHz,0x4772,BS23/TS2 ;D-Life
- +
- + ; CS110
- +
- +CS110, 0, 1613.0MHz, 0x6020, ND2
- +CS110, 0, 1653.0MHz, 0x7040, ND4
- +CS110, 0, 1693.0MHz, 0x7060, ND6
- +CS110, 0, 1733.0MHz, 0x6080, ND8
- +CS110, 0, 1773.0MHz, 0x60A0, ND10
- +CS110, 0, 1813.0MHz, 0x70C0, ND12
- +CS110, 0, 1853.0MHz, 0x70E0, ND14
- +CS110, 0, 1893.0MHz, 0x7100, ND16
- +CS110, 0, 1933.0MHz, 0x7120, ND18
- +CS110, 0, 1973.0MHz, 0x7140, ND20
- +CS110, 0, 2013.0MHz, 0x7160, ND22
- +CS110, 0, 2053.0MHz, 0x7180, ND24
- +
- diff -uPrb Org/BonDriver_Bulldog.ch.txt Mod/BonDriver_Bulldog.ch.txt
- --- Org/BonDriver_Bulldog.ch.txt 1970-01-01 09:00:00.000000000 +0900
- +++ Mod/BonDriver_Bulldog.ch.txt 2013-12-29 03:12:37.000000000 +0900
- @@ -0,0 +1,206 @@
- +; Bulldog 用 チャンネルファイル (2013/12/28)
- +;
- +; チャンネル情報を変更する場合は、このファイルを編集して
- +; プレフィックスが同じ名前のドライバと同ディレクトリに
- +; 拡張子 .ch.txt としてこのファイルを置くこと。
- +;
- +; ※ スペースの名前と順番は間違えてはいけないと思います。
- +;
- +; スペース名, サービスID, 物理チャンネル番号or周波数MHz, TSID, チャンネル名
- +
- + ; VHF
- +
- +VHF, 0, 1,0x0000, 1
- +VHF, 0, 2,0x0000, 2
- +VHF, 0, 3,0x0000, 3
- +VHF, 0, 4,0x0000, 4
- +VHF, 0, 5,0x0000, 5
- +VHF, 0, 6,0x0000, 6
- +VHF, 0, 7,0x0000, 7
- +VHF, 0, 8,0x0000, 8
- +VHF, 0, 9,0x0000, 9
- +VHF, 0,10,0x0000,10
- +VHF, 0,11,0x0000,11
- +VHF, 0,12,0x0000,12
- +
- + ; UHF
- +
- +UHF, 0,13,0x0000,13
- +UHF, 0,14,0x0000,14
- +UHF, 0,15,0x0000,15
- +UHF, 0,16,0x0000,16
- +UHF, 0,17,0x0000,17
- +UHF, 0,18,0x0000,18
- +UHF, 0,19,0x0000,19
- +UHF, 0,20,0x0000,20
- +UHF, 0,21,0x0000,21
- +UHF, 0,22,0x0000,22
- +UHF, 0,23,0x0000,23
- +UHF, 0,24,0x0000,24
- +UHF, 0,25,0x0000,25
- +UHF, 0,26,0x0000,26
- +UHF, 0,27,0x0000,27
- +UHF, 0,28,0x0000,28
- +UHF, 0,29,0x0000,29
- +UHF, 0,30,0x0000,30
- +UHF, 0,31,0x0000,31
- +UHF, 0,32,0x0000,32
- +UHF, 0,33,0x0000,33
- +UHF, 0,34,0x0000,34
- +UHF, 0,35,0x0000,35
- +UHF, 0,36,0x0000,36
- +UHF, 0,37,0x0000,37
- +UHF, 0,38,0x0000,38
- +UHF, 0,39,0x0000,39
- +UHF, 0,40,0x0000,40
- +UHF, 0,41,0x0000,41
- +UHF, 0,42,0x0000,42
- +UHF, 0,43,0x0000,43
- +UHF, 0,44,0x0000,44
- +UHF, 0,45,0x0000,45
- +UHF, 0,46,0x0000,46
- +UHF, 0,47,0x0000,47
- +UHF, 0,48,0x0000,48
- +UHF, 0,49,0x0000,49
- +UHF, 0,50,0x0000,50
- +UHF, 0,51,0x0000,51
- +UHF, 0,52,0x0000,52
- +UHF, 0,53,0x0000,53
- +UHF, 0,54,0x0000,54
- +UHF, 0,55,0x0000,55
- +UHF, 0,56,0x0000,56
- +UHF, 0,57,0x0000,57
- +UHF, 0,58,0x0000,58
- +UHF, 0,59,0x0000,59
- +UHF, 0,60,0x0000,60
- +UHF, 0,61,0x0000,61
- +UHF, 0,62,0x0000,62
- +
- + ; CATV
- +
- +CATV, 0,113,0x0000,C13
- +CATV, 0,114,0x0000,C14
- +CATV, 0,115,0x0000,C15
- +CATV, 0,116,0x0000,C16
- +CATV, 0,117,0x0000,C17
- +CATV, 0,118,0x0000,C18
- +CATV, 0,119,0x0000,C19
- +CATV, 0,120,0x0000,C20
- +CATV, 0,121,0x0000,C21
- +CATV, 0,122,0x0000,C22
- +CATV, 0,123,0x0000,C23
- +CATV, 0,124,0x0000,C24
- +CATV, 0,125,0x0000,C25
- +CATV, 0,126,0x0000,C26
- +CATV, 0,127,0x0000,C27
- +CATV, 0,128,0x0000,C28
- +CATV, 0,129,0x0000,C29
- +CATV, 0,130,0x0000,C30
- +CATV, 0,131,0x0000,C31
- +CATV, 0,132,0x0000,C32
- +CATV, 0,133,0x0000,C33
- +CATV, 0,134,0x0000,C34
- +CATV, 0,135,0x0000,C35
- +CATV, 0,136,0x0000,C36
- +CATV, 0,137,0x0000,C37
- +CATV, 0,138,0x0000,C38
- +CATV, 0,139,0x0000,C39
- +CATV, 0,140,0x0000,C40
- +CATV, 0,141,0x0000,C41
- +CATV, 0,142,0x0000,C42
- +CATV, 0,143,0x0000,C43
- +CATV, 0,144,0x0000,C44
- +CATV, 0,145,0x0000,C45
- +CATV, 0,146,0x0000,C46
- +CATV, 0,147,0x0000,C47
- +CATV, 0,148,0x0000,C48
- +CATV, 0,149,0x0000,C49
- +CATV, 0,150,0x0000,C50
- +CATV, 0,151,0x0000,C51
- +CATV, 0,152,0x0000,C52
- +CATV, 0,153,0x0000,C53
- +CATV, 0,154,0x0000,C54
- +CATV, 0,155,0x0000,C55
- +CATV, 0,156,0x0000,C56
- +CATV, 0,157,0x0000,C57
- +CATV, 0,158,0x0000,C58
- +CATV, 0,159,0x0000,C59
- +CATV, 0,160,0x0000,C60
- +CATV, 0,161,0x0000,C61
- +CATV, 0,162,0x0000,C62
- +CATV, 0,163,0x0000,C63
- +
- + ; BS (ストリームが重複するチャンネルはコメントアウトしている)
- +
- +BS, 151, 1,0x4010,BS1/TS0 ;BS朝日
- +BS, 161, 1,0x4011,BS1/TS1 ;BS-TBS
- +BS, 191, 3,0x4030,BS3/TS0 ;WOWOWプライム
- +;BS, 791,17,0x4030,BS3/TS0 ;navi
- +BS, 171, 3,0x4031,BS3/TS1 ;BSジャパン
- +BS, 192, 5,0x4450,BS5/TS0 ;WOWOWライブ
- +BS, 193, 5,0x4451,BS5/TS1 ;WOWOWシネマ
- +BS, 201, 7,0x4470,BS7/TS0 ;スター・チャンネル2
- +;BS, 202, 7,0x4470,BS7/TS0 ;スター・チャンネル3
- +BS, 236, 7,0x4671,BS7/TS1 ;BSアニマックス
- +BS, 256, 7,0x4672,BS7/TS2 ;ディズニー・チャンネル
- +BS, 211, 9,0x4090,BS9/TS0 ;BS11
- +BS, 200, 9,0x4091,BS9/TS1 ;スター・チャンネル1
- +BS, 222, 9,0x4092,BS9/TS2 ;TwellV
- +BS, 238,11,0x46B0,BS11/TS0 ;FOX bs238
- +BS, 241,11,0x46B1,BS11/TS1 ;BSスカパー!
- +BS, 231,11,0x46B2,BS11/TS2 ;放送大学BS1
- +;BS, 232,11,0x46B2,BS11/TS2 ;放送大学BS2
- +;BS, 233,11,0x46B2,BS11/TS2 ;放送大学BS3
- +BS, 141,13,0x40D0,BS13/TS0 ;BS日テレ
- +BS, 181,13,0x40D1,BS13/TS1 ;BSフジ
- +BS, 101,15,0x40F1,BS15/TS1 ;NHKBS1
- +BS, 103,15,0x40F2,BS15/TS2 ;NHKBSプレミアム
- +;BS, 910,17,0x40F2,BS15/TS2 ;WNI・910
- +BS, 291,17,0x4310,BS17/TS1 ;NHK総合・東京
- +;BS, 292,17,0x4310,BS17/TS1 ;NHKEテレ東京
- +BS, 294,17,0x4311,BS17/TS2 ;日テレ
- +;BS, 295,17,0x4311,BS17/TS2 ;テレビ朝日
- +;BS, 296,17,0x4311,BS17/TS2 ;TBS
- +;BS, 297,17,0x4311,BS17/TS2 ;テレビ東京
- +;BS, 298,17,0x4310,BS17/TS1 ;フジテレビ
- +;BS, 531,17,0x46B2,BS11/TS2 放送大学ラジオ
- +BS, 234,19,0x4730,BS19/TS0 ;グリーンチャンネル
- +BS, 242,19,0x4731,BS19/TS1 ;J SPORTS 1
- +BS, 243,19,0x4732,BS19/TS2 ;J SPORTS 2
- +BS, 252,21,0x4750,BS21/TS0 ;IMAGICA BS
- +BS, 244,21,0x4751,BS21/TS1 ;J SPORTS 3
- +BS, 245,21,0x4752,BS21/TS2 ;J SPORTS 4
- +BS, 251,23,0x4770,BS23/TS0 ;BS釣りビジョン
- +BS, 255,23,0x4771,BS23/TS1 ;日本映画専門チャンネル
- +BS, 258,23,0x4772,BS23/TS2 ;D-Life
- +
- + ; CS110
- +
- +CS110, 0, 2,0x6020,ND2
- +CS110, 0, 4,0x7040,ND4
- +CS110, 0, 6,0x7060,ND6
- +CS110, 0, 8,0x6080,ND8
- +CS110, 0,10,0x60A0,ND10
- +CS110, 0,12,0x70C0,ND12
- +CS110, 0,14,0x70E0,ND14
- +CS110, 0,16,0x7100,ND16
- +CS110, 0,18,0x7120,ND18
- +CS110, 0,20,0x7140,ND20
- +CS110, 0,22,0x7160,ND22
- +CS110, 0,24,0x7180,ND24
- +
- + ; CS110 ( MHz で記述する場合の例 )
- +
- +;CS110, 0, 1613.0MHz, 0x6020, ND2
- +;CS110, 0, 1653.0MHz, 0x7040, ND4
- +;CS110, 0, 1693.0MHz, 0x7060, ND6
- +;CS110, 0, 1733.0MHz, 0x6080, ND8
- +;CS110, 0, 1773.0MHz, 0x60A0, ND10
- +;CS110, 0, 1813.0MHz, 0x70C0, ND12
- +;CS110, 0, 1853.0MHz, 0x70E0, ND14
- +;CS110, 0, 1893.0MHz, 0x7100, ND16
- +;CS110, 0, 1933.0MHz, 0x7120, ND18
- +;CS110, 0, 1973.0MHz, 0x7140, ND20
- +;CS110, 0, 2013.0MHz, 0x7160, ND22
- +;CS110, 0, 2053.0MHz, 0x7180, ND24
- +
- diff -uPrb Org/BonDriver_Bulldog.ini Mod/BonDriver_Bulldog.ini
- --- Org/BonDriver_Bulldog.ini 2012-03-17 13:01:48.000000000 +0900
- +++ Mod/BonDriver_Bulldog.ini 2014-11-13 19:02:01.000000000 +0900
- @@ -1,205 +1,21 @@
- -[BonDriverAKB02]
- -
- -
- -//Channel=ServiceID,PhysicalChannel,TSID,Name
- -[VHF]
- -0= 0, 1,0x0000,1
- -1= 0, 2,0x0000,2
- -2= 0, 3,0x0000,3
- -3= 0, 4,0x0000,4
- -4= 0, 5,0x0000,5
- -5= 0, 6,0x0000,6
- -6= 0, 7,0x0000,7
- -7= 0, 8,0x0000,8
- -8= 0, 9,0x0000,9
- -9= 0,10,0x0000,10
- -10= 0,11,0x0000,11
- -11= 0,12,0x0000,12
- -
- -[UHF]
- -0= 0,13,0x0000,13
- -1= 0,14,0x0000,14
- -2= 0,15,0x0000,15
- -3= 0,16,0x0000,16
- -4= 0,17,0x0000,17
- -5= 0,18,0x0000,18
- -6= 0,19,0x0000,19
- -7= 0,20,0x0000,20
- -8= 0,21,0x0000,21
- -9= 0,22,0x0000,22
- -10= 0,23,0x0000,23
- -11= 0,24,0x0000,24
- -12= 0,25,0x0000,25
- -13= 0,26,0x0000,26
- -14= 0,27,0x0000,27
- -15= 0,28,0x0000,28
- -16= 0,29,0x0000,29
- -17= 0,30,0x0000,30
- -18= 0,31,0x0000,31
- -19= 0,32,0x0000,32
- -20= 0,33,0x0000,33
- -21= 0,34,0x0000,34
- -22= 0,35,0x0000,35
- -23= 0,36,0x0000,36
- -24= 0,37,0x0000,37
- -25= 0,38,0x0000,38
- -26= 0,39,0x0000,39
- -27= 0,40,0x0000,40
- -28= 0,41,0x0000,41
- -29= 0,42,0x0000,42
- -30= 0,43,0x0000,43
- -31= 0,44,0x0000,44
- -32= 0,45,0x0000,45
- -33= 0,46,0x0000,46
- -34= 0,47,0x0000,47
- -35= 0,48,0x0000,48
- -36= 0,49,0x0000,49
- -37= 0,50,0x0000,50
- -38= 0,51,0x0000,51
- -39= 0,52,0x0000,52
- -40= 0,53,0x0000,53
- -41= 0,54,0x0000,54
- -42= 0,55,0x0000,55
- -43= 0,56,0x0000,56
- -44= 0,57,0x0000,57
- -45= 0,58,0x0000,58
- -46= 0,59,0x0000,59
- -47= 0,60,0x0000,60
- -48= 0,61,0x0000,61
- -49= 0,62,0x0000,62
- -
- -[CATV]
- -0= 0,113,0x0000,C13
- -1= 0,114,0x0000,C14
- -2= 0,115,0x0000,C15
- -3= 0,116,0x0000,C16
- -4= 0,117,0x0000,C17
- -5= 0,118,0x0000,C18
- -6= 0,119,0x0000,C19
- -7= 0,120,0x0000,C20
- -8= 0,121,0x0000,C21
- -9= 0,122,0x0000,C22
- -10= 0,123,0x0000,C23
- -11= 0,124,0x0000,C24
- -12= 0,125,0x0000,C25
- -13= 0,126,0x0000,C26
- -14= 0,127,0x0000,C27
- -15= 0,128,0x0000,C28
- -16= 0,129,0x0000,C29
- -17= 0,130,0x0000,C30
- -18= 0,131,0x0000,C31
- -19= 0,132,0x0000,C32
- -20= 0,123,0x0000,C33
- -21= 0,124,0x0000,C34
- -22= 0,125,0x0000,C35
- -23= 0,126,0x0000,C36
- -24= 0,127,0x0000,C37
- -25= 0,128,0x0000,C38
- -26= 0,129,0x0000,C39
- -27= 0,130,0x0000,C40
- -28= 0,131,0x0000,C41
- -29= 0,132,0x0000,C42
- -30= 0,123,0x0000,C43
- -31= 0,124,0x0000,C44
- -32= 0,125,0x0000,C45
- -33= 0,126,0x0000,C46
- -34= 0,127,0x0000,C47
- -35= 0,128,0x0000,C48
- -36= 0,129,0x0000,C49
- -37= 0,130,0x0000,C50
- -38= 0,131,0x0000,C51
- -39= 0,132,0x0000,C52
- -40= 0,123,0x0000,C53
- -41= 0,124,0x0000,C54
- -42= 0,125,0x0000,C55
- -43= 0,126,0x0000,C56
- -44= 0,127,0x0000,C57
- -45= 0,128,0x0000,C58
- -46= 0,129,0x0000,C59
- -47= 0,130,0x0000,C60
- -48= 0,131,0x0000,C61
- -49= 0,132,0x0000,C62
- -50= 0,123,0x0000,C63
- -
- -[BS]
- -0= 151, 1,0x4010,BS1/TS0 BS朝日
- -1= 161, 1,0x4011,BS1/TS1 BS-TBS
- -2= 191, 3,0x4030,BS3/TS0 WOWOWプライム
- -3= 791,17,0x4030,BS3/TS0 navi
- -4= 171, 3,0x4031,BS3/TS1 BSジャパン
- -5= 192, 5,0x4450,BS5/TS0 WOWOWライブ
- -6= 193, 5,0x4451,BS5/TS1 WOWOWシネマ
- -7= 201, 7,0x4470,BS7/TS0 スター・チャンネル2
- -8= 202, 7,0x4470,BS7/TS0 スター・チャンネル3
- -9= 236, 7,0x4671,BS7/TS1 BSアニマックス
- -10=256, 7,0x4672,BS7/TS2 ディズニー・チャンネル
- -11=211, 9,0x4090,BS9/TS0 BS11
- -12=200, 9,0x4091,BS9/TS1 スター・チャンネル1
- -13=222, 9,0x4092,BS9/TS2 TwellV
- -14=238,11,0x46B0,BS11/TS0 FOX bs238
- -15=241,11,0x46B1,BS11/TS1 BSスカパー!
- -16=231,11,0x46B2,BS11/TS2 放送大学BS1
- -17=232,11,0x46B2,BS11/TS2 放送大学BS2
- -18=233,11,0x46B2,BS11/TS2 放送大学BS3
- -19=141,13,0x40D0,BS13/TS0 BS日テレ
- -20=181,13,0x40D1,BS13/TS1 BSフジ
- -21=101,15,0x40F1,BS15/TS1 NHKBS1
- -22=103,15,0x40F2,BS15/TS2 NHKBSプレミアム
- -23=910,17,0x40F2,BS15/TS2 WNI・910
- -24=291,17,0x4310,BS17/TS1 NHK総合・東京
- -25=292,17,0x4310,BS17/TS1 NHKEテレ東京
- -26=294,17,0x4311,BS17/TS2 日テレ
- -27=295,17,0x4311,BS17/TS2 テレビ朝日
- -28=296,17,0x4311,BS17/TS2 TBS
- -29=297,17,0x4311,BS17/TS2 テレビ東京
- -30=298,17,0x4310,BS17/TS1 フジテレビ
- -31=531,17,0x46B2,BS11/TS2 放送大学ラジオ
- -32=234,19,0x4730,BS19/TS0 グリーンチャンネル
- -33=242,19,0x4731,BS19/TS1 J SPORTS 1
- -34=243,19,0x4732,BS19/TS2 J SPORTS 2
- -35=252,21,0x4750,BS21/TS0 IMAGICA BS
- -36=244,21,0x4751,BS21/TS1 J SPORTS 3
- -37=245,21,0x4752,BS21/TS2 J SPORTS 4
- -38=251,23,0x4770,BS23/TS0 BS釣りビジョン
- -39=255,23,0x4771,BS23/TS1 日本映画専門チャンネル
- -40=258,23,0x4772,BS23/TS2 D-Life
- -
- -
- -0= 101,15,0x40F1,NHKBS1
- -1= 102,15,0x40F1,NHK BS2
- -2= 103,15,0x40F2,NHK BSプレミアム
- -3= 141,13,0x40D0,BS日テレ
- -4= 151, 1,0x4010,BS朝日1
- -5= 161, 1,0x4011,BS-TBS
- -6= 171, 3,0x4031,BSジャパン
- -7= 181,13,0x40D1,BSフジ・181
- -8= 191, 3,0x4030,WOWOWプライム
- -9= 200, 9,0x4470,スター・チャンネル1,
- -10=211, 9,0x4090,BS11
- -11=222, 9,0x4092,TwellV
- -12=192, 5,0x4030,WOWOWライブ
- -13=193, 5,0x4030,WOWOWシネマ
- -14=201, 7,0x4470,スター・チャンネル2
- -15=202, 7,0x4470,スター・チャンネル3
- -16=231,11,0x46B2,放送大学テレビ
- -17=234,19,0x4730,グリーンチャンネル
- -18=236, 7,0x4671,BSアニマックス
- -19=238,11,0x46B0,FOX bs238
- -20=241,11,0x46B1,BSスカパー!
- -21=242,19,0x4731,J SPORTS 1
- -22=243,19,0x4732,J SPORTS 2
- -
- -[CS110]
- -0= 0, 2,0x6020,ND2
- -1= 0, 4,0x7040,ND4
- -2= 0, 6,0x7060,ND6
- -3= 0, 8,0x6080,ND8
- -4= 0,10,0x60A0,ND10
- -5= 0,12,0x70C0,ND12
- -6= 0,14,0x70E0,ND14
- -7= 0,16,0x7100,ND16
- -8= 0,18,0x7120,ND18
- -9= 0,20,0x7140,ND20
- -10=0,22,0x7160,ND22
- -11=0,24,0x7180,ND24
- +[BonTuner]
- +TSDataSize=65536
- +TSQueueNum=16
- +ASyncTSQueueNum=512
- +TSThreadWait=750
- +
- +; Windows7以降の新OS用の推奨設定
- +;TSDataSize=131072
- +;TSQueueNum=64
- +;ASyncTSQueueNum=1024
- +;TSThreadWait=1000
- +
- +; TSバッファリング処理を複数のスレッドを利用して効率化するかどうか
- +; ( シングルCPU環境や非力PC環境の場合はコメントアウト推奨 )
- +TSDualThreading=1
- +
- +ISDBTCommandSendTimes=2
- +ISDBTCommandSendWait=100
- +ISDBSCommandSendTimes=2
- +ISDBSCommandSendWait=100
- diff -uPrb Org/BonTuner.cpp Mod/BonTuner.cpp
- --- Org/BonTuner.cpp 2012-04-07 16:37:52.000000000 +0900
- +++ Mod/BonTuner.cpp 2014-11-14 00:03:42.000000000 +0900
- @@ -20,15 +20,23 @@
- // 定数定義
- //////////////////////////////////////////////////////////////////////
- -// ミューテックス名
- -#define MUTEX_NAME TEXT("BonDriver Bulldog")
- -
- // 受信サイズ
- -#define TSDATASIZE 65536UL // TSデータのサイズ
- +DWORD TSDATASIZE = 65536UL ; // TSデータのサイズ
- +DWORD TSQUEUENUM = 16UL ; // TSデータの環状ストック数
- +DWORD TSTHREADWAIT = 1000UL ; // TSスレッドキュー毎に待つ最大時間
- +int TSTHREADPRIORITY = THREAD_PRIORITY_HIGHEST ; // TSスレッドの優先度
- +BOOL TSDUALTHREADING = FALSE ; // TSスレッドキュー待ちのマルチスレッド効率化
- +
- +
- // FIFOバッファ設定
- -#define ASYNCBUFFTIME 4UL // バッファ長 = 4秒
- -#define ASYNCBUFFSIZE ( 0x400000 / TSDATASIZE * ASYNCBUFFTIME ) // 平均32Mbpsとする
- +DWORD ASYNCTSQUEUENUM = 256UL ; // 非同期TSデータの環状ストック数
- +
- +// ウェイト
- +DWORD ISDBTCOMMANDSENDTIMES = 2 ;
- +DWORD ISDBTCOMMANDSENDWAIT = 100 ;
- +DWORD ISDBSCOMMANDSENDTIMES = 2 ;
- +DWORD ISDBSCOMMANDSENDWAIT = 100 ;
- // エンドポイントインデックス
- #define EPINDEX_IN 0UL
- @@ -75,12 +83,12 @@
- _T("151, 1,0x4010,BS1/TS0 BS朝日"),
- _T("161, 1,0x4011,BS1/TS1 BS-TBS"),
- _T("191, 3,0x4030,BS3/TS0 WOWOWプライム"),
- -_T("791,17,0x4030,BS3/TS0 navi"),
- +//_T("791,17,0x4030,BS3/TS0 navi"),
- _T("171, 3,0x4031,BS3/TS1 BSジャパン"),
- _T("192, 5,0x4450,BS5/TS0 WOWOWライブ"),
- _T("193, 5,0x4451,BS5/TS1 WOWOWシネマ"),
- _T("201, 7,0x4470,BS7/TS0 スター・チャンネル2"),
- -_T("202, 7,0x4470,BS7/TS0 スター・チャンネル3"),
- +//_T("202, 7,0x4470,BS7/TS0 スター・チャンネル3"),
- _T("236, 7,0x4671,BS7/TS1 BSアニマックス"),
- _T("256, 7,0x4672,BS7/TS2 ディズニー・チャンネル"),
- _T("211, 9,0x4090,BS9/TS0 BS11"),
- @@ -89,21 +97,21 @@
- _T("238,11,0x46B0,BS11/TS0 FOX bs238"),
- _T("241,11,0x46B1,BS11/TS1 BSスカパー!"),
- _T("231,11,0x46B2,BS11/TS2 放送大学BS1"),
- -_T("232,11,0x46B2,BS11/TS2 放送大学BS2"),
- -_T("233,11,0x46B2,BS11/TS2 放送大学BS3"),
- +//_T("232,11,0x46B2,BS11/TS2 放送大学BS2"),
- +//_T("233,11,0x46B2,BS11/TS2 放送大学BS3"),
- _T("141,13,0x40D0,BS13/TS0 BS日テレ"),
- _T("181,13,0x40D1,BS13/TS1 BSフジ"),
- _T("101,15,0x40F1,BS15/TS1 NHKBS1"),
- _T("103,15,0x40F2,BS15/TS2 NHKBSプレミアム"),
- -_T("910,17,0x40F2,BS15/TS2 WNI・910"),
- +//_T("910,17,0x40F2,BS15/TS2 WNI・910"),
- _T("291,17,0x4310,BS17/TS1 NHK総合・東京"),
- -_T("292,17,0x4310,BS17/TS1 NHKEテレ東京"),
- +//_T("292,17,0x4310,BS17/TS1 NHKEテレ東京"),
- _T("294,17,0x4311,BS17/TS2 日テレ"),
- -_T("295,17,0x4311,BS17/TS2 テレビ朝日"),
- -_T("296,17,0x4311,BS17/TS2 TBS"),
- -_T("297,17,0x4311,BS17/TS2 テレビ東京"),
- -_T("298,17,0x4310,BS17/TS1 フジテレビ"),
- -_T("531,17,0x46B2,BS11/TS2 放送大学ラジオ"),
- +//_T("295,17,0x4311,BS17/TS2 テレビ朝日"),
- +//_T("296,17,0x4311,BS17/TS2 TBS"),
- +//_T("297,17,0x4311,BS17/TS2 テレビ東京"),
- +//_T("298,17,0x4310,BS17/TS1 フジテレビ"),
- +//_T("531,17,0x46B2,BS11/TS2 放送大学ラジオ"),
- _T("234,19,0x4730,BS19/TS0 グリーンチャンネル"),
- _T("242,19,0x4731,BS19/TS1 J SPORTS 1"),
- _T("243,19,0x4732,BS19/TS2 J SPORTS 2"),
- @@ -134,6 +142,7 @@
- NULL
- };
- +using namespace std ;
- //////////////////////////////////////////////////////////////////////
- // インスタンス生成メソッド
- @@ -151,6 +160,41 @@
- //////////////////////////////////////////////////////////////////////
- +// ユーティリティ
- +//////////////////////////////////////////////////////////////////////
- +
- +template<class String> String inline trim(const String &str)
- +{
- + String str2 ; str2.clear() ;
- + for(typename String::size_type i=0;i<str.size();i++) {
- + if(unsigned(str[i])>0x20UL) {
- + str2 = str.substr(i,str.size()-i) ;
- + break ;
- + }
- + }
- + if(str2.empty()) return str2 ;
- + for(typename String::size_type i=str2.size();i>0;i--) {
- + if(unsigned(str2[i-1])>0x20UL) {
- + return str2.substr(0,i) ;
- + }
- + }
- + str2.clear() ;
- + return str2 ;
- +}
- +
- +static wstring mbcs2wcs(string src)
- +{
- + if(src.empty()) return wstring(L"") ;
- + wchar_t *wcs = new wchar_t[src.length()*2 + 2];
- + size_t wLen = 0;
- + setlocale(LC_ALL,"japanese");
- + mbstowcs_s(&wLen, wcs, src.length()*2+1 , src.c_str(), _TRUNCATE);
- + wstring result = wcs ;
- + delete [] wcs;
- + return result ;
- +}
- +
- +//////////////////////////////////////////////////////////////////////
- // 構築/消滅
- //////////////////////////////////////////////////////////////////////
- @@ -164,14 +208,16 @@
- : m_pUsbFx2Driver(NULL)
- , m_hOnStreamEvent(NULL)
- , m_hMutex(NULL)
- + , is_channel_valid(FALSE)
- {
- - char bf[256];
- - char key[8];
- + //char bf[256];
- + //char key[8];
- m_pThis = this;
- fOpened=false;
- - LoadIni();
- + m_yFx2Id = 0 ;
- + InitTunerProperty();
- }
- //***** Destructor *****
- @@ -192,7 +238,6 @@
- const BOOL CBonTuner::OpenTuner()
- {
- - FILE *fp;
- int sz;
- // OutputDebugString(_T("OpenTuner\n"));
- @@ -204,6 +249,9 @@
- m_pUsbFx2Driver = new CUsbFx2Driver(this);
- if(!m_pUsbFx2Driver)return false;
- + // ストリーム一時停止
- + is_channel_valid = FALSE ;
- +
- // FX2の初期化シーケンス
- try{
- // FIFOバッファ確保
- @@ -215,6 +263,8 @@
- sz=sizeof(DefBulldogFW);
- memcpy(BulldogFirmWare,DefBulldogFW,sz);
- + #ifdef _DEBUG
- + FILE *fp;
- fopen_s(&fp, "Bulldog.fw","rb");
- if (fp)
- {
- @@ -227,9 +277,10 @@
- }
- fclose(fp);
- }
- + #endif
- // ドライバオープン
- - if(!m_pUsbFx2Driver->OpenDriver(0x00U, BulldogFirmWare, sz,"Bulldog_FIFO"))throw (const DWORD)__LINE__; //xxxxx
- + if(!m_pUsbFx2Driver->OpenDriver(m_yFx2Id, BulldogFirmWare, sz,/*"Bulldog_FIFO"*/"FX2_FIFO"))throw (const DWORD)__LINE__; //xxxxx
- // エンドポイント追加
- if(!m_pUsbFx2Driver->AddEndPoint(0x81U))throw (const DWORD)__LINE__; // EPINDEX_IN
- @@ -241,14 +292,14 @@
- if(!m_pUsbFx2Driver->TransmitFormatedData(EPINDEX_OUT, 6UL, CMD_PORT_CFG, 0x00U, PIO_START, CMD_MODE_IDLE, CMD_IFCONFIG, 0xE3U))throw (const DWORD)__LINE__;
- // スレッド起動
- - if(!m_pUsbFx2Driver->CreateFifoThread(0x86U, NULL, TSDATASIZE))throw (const DWORD)__LINE__;
- + if(!m_pUsbFx2Driver->CreateFifoThread(0x86U, &m_dwFifoThreadIndex, TSDATASIZE, TSQUEUENUM, TSTHREADWAIT, TSTHREADPRIORITY, TSDUALTHREADING))throw (const DWORD)__LINE__;
- // 開始コマンド送信
- // if(!m_pUsbFx2Driver->TransmitFormatedData(EPINDEX_OUT, 3UL, CMD_EP6IN_START, CMD_PORT_WRITE, PIO_START | PIO_IR_OUT | PIO_TS_BACK))throw (const DWORD)__LINE__;
- if(!m_pUsbFx2Driver->TransmitFormatedData(EPINDEX_OUT, 3UL, CMD_EP6IN_START, CMD_PORT_WRITE, PIO_START))throw (const DWORD)__LINE__;
- // ミューテックス作成
- - if(!(m_hMutex = ::CreateMutex(NULL, TRUE, MUTEX_NAME)))throw (const DWORD)__LINE__;
- + if(!(m_hMutex = ::CreateMutex(NULL, TRUE, m_szTunerName)))throw (const DWORD)__LINE__;
- // 成功
- }
- @@ -316,11 +367,14 @@
- ch:13-62 UHF
- ch:113-163 ケーブルTV
- */
- -void CBonTuner::SetISDBTChannel(int ch)
- +void CBonTuner::SetISDBTChannel(int ch,float MegaHz)
- {
- - SetMxl5007(ch);
- - SetTC90502(ISDB_T);
- - Sleep(100);
- + for(DWORD i=0;i<ISDBTCOMMANDSENDTIMES;i++) {
- + //if(i) Sleep(100) ;
- + SetMxl5007(ch,MegaHz);
- + //if(TC90502_OK==SetTC90502(ISDB_T)) break ;
- + Sleep(ISDBTCOMMANDSENDWAIT);
- + }
- }
- //***** Set ISDB-S Channel *****
- @@ -329,14 +383,16 @@
- ch:1-23 (奇数) BS
- ch:2-24 (偶数) CS
- */
- -void CBonTuner::SetISDBSChannel(int ch,int tsid)
- +void CBonTuner::SetISDBSChannel(int ch,int tsid,float MegaHz)
- {
- - SetStv6110a(ch);
- + for(DWORD i=0;i<ISDBSCOMMANDSENDTIMES;i++) {
- + SetStv6110a(ch,MegaHz);
- SetTC90502(ISDB_S);
- SetTSID(tsid);
- WriteReg(DEMODSADRS,0x03,0x01); //同期シーケンス開始
- - Sleep(100);
- + Sleep(ISDBSCOMMANDSENDWAIT);
- + }
- /*
- DWORD tm=GetTickCount()+3000;
- @@ -384,10 +440,12 @@
- CLockStatus CBonTuner::IsLock(void)
- {
- - if (m_dwCurSpace<3)
- + DWORD ch = GetCurSerialChannel() ;
- + if (m_Channels[ch].isISDBT())
- return(IsLockISDBT());
- -
- + else if (m_Channels[ch].isISDBS())
- return(IsLockISDBS());
- + return stUnknown ;
- }
- //***** Get C/N *****
- @@ -399,10 +457,12 @@
- double cn;
- double p,p2,p3,p4;
- - if (fOpened==false)
- + if (!fOpened||!is_channel_valid)
- return(0);
- - if (m_dwCurSpace<3) //ISDB-T
- + DWORD ch = GetCurSerialChannel() ;
- +
- + if (m_Channels[ch].isISDBT()) //ISDB-T
- {
- I2CRead(DEMODTADRS,0x8B,3,Data);
- cndata=(Data[0]<<16) | (Data[1]<<8) | Data[2];
- @@ -412,7 +472,7 @@
- p4=p3*p;
- cn=(double)0.000024*p4-0.0016*p3+0.0398*p2+0.5491*p+3.0965;
- }
- - else { //BS/CS
- + else if(m_Channels[ch].isISDBS()) { //BS/CS
- I2CRead(DEMODSADRS,0xBC,2,Data);
- cndata=(Data[0]<<8) | Data[1];
- if (cndata>=3000)
- @@ -423,6 +483,8 @@
- else {
- cn=0;
- }
- + }else {
- + cn = 0 ;
- }
- if ((cn<0) || (cndata==0))
- @@ -439,14 +501,18 @@
- int berdata,packetcycle;
- double ber;
- - if (m_dwCurSpace<3)
- + DWORD ch = GetCurSerialChannel() ;
- +
- + if (m_Channels[ch].isISDBT()) //ISDB-T
- {
- I2CRead(DEMODTADRS,0xA0,3,darray);
- I2CRead(DEMODTADRS,0xA6,2,carray);
- }
- - else {
- + else if(m_Channels[ch].isISDBS()) { //BS/CS
- I2CRead(DEMODTADRS+1,0xEB,3,darray);
- I2CRead(DEMODTADRS+1,0xEE,2,carray);
- + }else {
- + return 0.0 ;
- }
- packetcycle=(carray[0]<<8) | carray[1];
- @@ -459,22 +525,59 @@
- return(ber);
- }
- +
- +//***** SetChannelSub *****
- +
- +const BOOL CBonTuner::SetChannelSub(const DWORD dwCh)
- +{
- + //ストリーム一時停止
- + is_channel_valid = FALSE;
- +
- + // 撮り溜めたTSストリームの破棄
- + PurgeTsStream();
- +
- + if(dwCh >= m_Channels.size()){
- + return FALSE;
- + }
- +
- + //チューニング
- + if(m_Channels[dwCh].isISDBT()) { // 地上波
- + SetISDBTChannel(m_Channels[dwCh].Channel,m_Channels[dwCh].MegaHz) ;
- + }else if(m_Channels[dwCh].isISDBS()) { // BS/CS
- + SetISDBSChannel(m_Channels[dwCh].Channel,
- + m_Channels[dwCh].TSID,m_Channels[dwCh].MegaHz) ;
- + }else {
- + return FALSE ;
- + }
- +
- + //ストリーム再開
- + is_channel_valid = TRUE;
- +
- + return TRUE ;
- +}
- +
- +
- //***** Set Channel *****
- const BOOL CBonTuner::SetChannel(const BYTE ch)
- {
- - if (ch<12)
- - m_dwCurSpace = 0;
- - else if (ch<63)
- - m_dwCurSpace = 1;
- - else if (ch<200)
- - m_dwCurSpace = 2;
- + if(!SetChannelSub(ch)) return FALSE ;
- - m_dwCurChannel = ch;
- -
- - SetISDBTChannel(ch);
- + // チャンネル情報を更新
- + m_dwCurSpace=0;
- + m_dwCurChannel=0;
- + wstring space;
- + for(int i=0;i<ch;i++) {
- + if(!i) space = m_Channels[ch].Space ;
- + else if (m_Channels[ch].Space!=space) {
- + space = m_Channels[ch].Space ;
- + m_dwCurSpace++,m_dwCurChannel=0 ;
- + continue ;
- + }
- + m_dwCurChannel++;
- + }
- - return TRUE;
- + return TRUE ;
- }
- //***** Get Signal Level *****
- @@ -486,7 +589,7 @@
- return((float)d);
- /*
- // FIFOバッファのFullnessを返す
- - return ((float)m_FifoBuffer.size() / (float)ASYNCBUFFSIZE * 100.0f);
- + return ((float)m_FifoBuffer.size() / (float)ASYNCTSQUEUENUM * 100.0f);
- */
- }
- @@ -495,11 +598,14 @@
- const DWORD CBonTuner::WaitTsStream(const DWORD dwTimeOut)
- {
- // OutputDebugString(_T("WaitTsStream\n"));
- - return 0UL;
- +// return 0UL;
- // 終了チェック
- if(!m_pUsbFx2Driver)return WAIT_ABANDONED;
- + // バッファ済みの場合は無駄に待機せずに制御を戻す @ 2014/01/26(Sun)
- + if(!m_FifoBuffer.empty()) return WAIT_OBJECT_0;
- +
- // イベントがシグナル状態になるのを待つ
- const DWORD dwRet = ::WaitForSingleObject(m_hOnStreamEvent, (dwTimeOut)? dwTimeOut : INFINITE);
- @@ -542,7 +648,7 @@
- {
- if(*pdwSize)
- {
- - ::CopyMemory(pDst, pSrc, *pdwSize);
- + CopyMemory(pDst, pSrc, *pdwSize);
- }
- return TRUE;
- @@ -564,20 +670,19 @@
- return FALSE;
- // TSデータをバッファから取り出す
- - if(m_FifoBuffer.size())
- - {
- + if(m_FifoBuffer.size()){
- // データコピー
- - if(pdwSize)*pdwSize = TSDATASIZE;
- - if(ppDst)*ppDst = m_FifoBuffer.front();
- + *pdwSize = m_FifoBuffer.front().second; // TSDATASIZE;
- + *ppDst = m_FifoBuffer.front().first;
- m_FifoBuffer.pop();
- - if(pdwRemain)
- - *pdwRemain = m_FifoBuffer.size();
- + *pdwRemain = m_FifoBuffer.size() ;
- +
- return TRUE;
- }
- else{
- // 取り出し可能なデータがない
- - if(pdwSize)*pdwSize = 0UL;
- - if(pdwRemain)*pdwRemain = 0UL;
- + *pdwSize = 0;
- + *pdwRemain = 0;
- return TRUE;
- }
- @@ -602,15 +707,16 @@
- LPCTSTR CBonTuner::GetTunerName(void)
- {
- // チューナ名を返す
- - return TEXT("Bulldog");
- + return m_szTunerName ;
- }
- //***** Is Tuner Opening *****
- const BOOL CBonTuner::IsTunerOpening(void)
- {
- +#if 1
- // チューナの使用中の有無を返す(全プロセスを通して)
- - HANDLE hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, MUTEX_NAME);
- + HANDLE hMutex = ::OpenMutex(MUTEX_ALL_ACCESS, FALSE, m_szTunerName);
- if(hMutex)
- {
- @@ -622,95 +728,72 @@
- // チューナは開かれていない
- return FALSE;
- }
- +#else
- + return fOpened ? TRUE : FALSE ;
- +#endif
- }
- //***** Enum Tuning Space *****
- LPCTSTR CBonTuner::EnumTuningSpace(const DWORD dwSpace)
- {
- - // 使用可能なチューニング空間を返す
- - switch(dwSpace)
- - {
- - case 0UL : return TEXT("VHF");
- - case 1UL : return TEXT("UHF");
- - case 2UL : return TEXT("CATV");
- - case 3UL : return TEXT("BS");
- - case 4UL : return TEXT("CS110");
- - default : return NULL;
- + // 0は最初の空間を返す
- + if ( dwSpace == 0 ) return m_Channels[0].Space.c_str() ;
- + // 次の空間名を探す
- + DWORD dwSpcIdx = 0 ;
- + int nIdx0 = 0 ;
- + for ( CHANNELS::size_type nIdx = 0 ; nIdx < m_Channels.size() ; nIdx++ ) {
- + if ( m_Channels[nIdx0].Space == m_Channels[nIdx].Space ) continue ;
- + nIdx0 = nIdx ;
- + dwSpcIdx++ ;
- + if ( dwSpace == dwSpcIdx ) return m_Channels[nIdx].Space.c_str() ;
- }
- + return NULL ;
- }
- //***** Enum Channel Name *****
- LPCTSTR CBonTuner::EnumChannelName(const DWORD dwSpace, const DWORD dwChannel)
- {
- - // 使用可能なチャンネルを返す
- - switch(dwSpace)
- - {
- - case 0UL : //VHF
- - if (dwChannel>=VHFNumChannel)
- - return(NULL);
- - return((LPCTSTR)VHFChInfo[dwChannel].Name);
- - case 1UL : //UHF
- - if (dwChannel>=UHFNumChannel)
- - return(NULL);
- - return((LPCTSTR)UHFChInfo[dwChannel].Name);
- - case 2UL : //CATV
- - if (dwChannel>=CATVNumChannel)
- - return(NULL);
- - return((LPCTSTR)CATVChInfo[dwChannel].Name);
- - case 3UL : //BS
- - if (dwChannel>=BSNumChannel)
- - return(NULL);
- - return((LPCTSTR)BSChInfo[dwChannel].Name);
- - case 4UL : //CS110
- - if (dwChannel>=CSNumChannel)
- - return(NULL);
- - return((LPCTSTR)CSChInfo[dwChannel].Name);
- - default :
- - // 非対応のチューニング空間
- - return NULL;
- + // 空間名を取得する
- + LPCTSTR pszSpace = EnumTuningSpace( dwSpace ) ;
- + if ( !pszSpace ) return NULL ;
- + wstring space = wstring(pszSpace) ;
- + // 空間名の一致するチャンネルを探す
- + DWORD dwChIdx = 0 ;
- + for ( CHANNELS::size_type nIdx = 0 ; nIdx < m_Channels.size() ; nIdx++ ) {
- + if ( space != m_Channels[nIdx].Space ) continue ;
- + if ( dwChIdx == dwChannel ) return m_Channels[nIdx].Name.c_str() ;
- + dwChIdx++ ;
- }
- + return NULL ;
- }
- //***** Set Channel *****
- const BOOL CBonTuner::SetChannel(const DWORD dwSpace, const DWORD dwChannel)
- {
- - switch(dwSpace)
- - {
- - case 0: //VHF
- - if (dwChannel>=VHFNumChannel)
- - return(FALSE);
- - SetISDBTChannel(VHFChInfo[dwChannel].Channel);
- - break;
- - case 1: //UHF
- - if (dwChannel>=UHFNumChannel)
- - return(FALSE);
- - SetISDBTChannel(UHFChInfo[dwChannel].Channel);
- - break;
- - case 2: //CATV
- - if (dwChannel>=CATVNumChannel)
- - return(FALSE);
- - SetISDBTChannel(CATVChInfo[dwChannel].Channel);
- - break;
- - case 3: //BS
- - if (dwChannel>=CATVNumChannel)
- - return(FALSE);
- - SetISDBSChannel(BSChInfo[dwChannel].Channel,BSChInfo[dwChannel].TSID);
- - break;
- - case 4: //CS
- - if (dwChannel>=CATVNumChannel)
- - return(FALSE);
- - SetISDBSChannel(CSChInfo[dwChannel].Channel,CSChInfo[dwChannel].TSID);
- - break;
- - default:
- - return(FALSE);
- - }
- + // 空間名を取得する
- + LPCTSTR pszSpace = EnumTuningSpace( dwSpace ) ;
- + if ( !pszSpace ) return FALSE ;
- + wstring space = wstring(pszSpace) ;
- + // 空間名の一致するチャンネルを探す
- + DWORD dwChIdx = 0 ;
- + for ( CHANNELS::size_type nIdx = 0 ; nIdx < m_Channels.size() ; nIdx++ ) {
- + if ( space != m_Channels[nIdx].Space ) continue ;
- + if ( dwChIdx == dwChannel ) {
- + // チャンネルを設定する
- + if( SetChannelSub(nIdx) ){
- m_dwCurSpace = dwSpace;
- m_dwCurChannel = dwChannel;
- -
- return TRUE;
- + }else{
- + return FALSE;
- + }
- + }
- + dwChIdx++ ;
- + }
- + return FALSE ;
- }
- //***** Get Current Space *****
- @@ -729,6 +812,26 @@
- return m_dwCurChannel;
- }
- +//***** Get Cur Serial Channel *****
- +
- +DWORD CBonTuner::GetCurSerialChannel()
- +{
- + wstring wsSpace ;
- + DWORD dwSpace,dwChannel ;
- + for(CHANNELS::size_type ch=0;ch<m_Channels.size();ch++) {
- + if(!ch) {
- + wsSpace = m_Channels[ch].Space ;
- + dwSpace = dwChannel = 0 ;
- + }else if(wsSpace!=m_Channels[ch].Space) {
- + dwSpace++; dwChannel=0; wsSpace=m_Channels[ch].Space;
- + }else
- + dwChannel++;
- + if(dwSpace==m_dwCurSpace&&dwChannel==m_dwCurChannel)
- + return ch ;
- + }
- + return 0 ;
- +}
- +
- //***** Release *****
- void CBonTuner::Release()
- @@ -741,13 +844,16 @@
- const bool CBonTuner::OnRecvFifoData(const DWORD dwThreadIndex, const BYTE *pData, const DWORD dwLen, CUsbFx2Driver *pDriver)
- {
- + if (dwThreadIndex == m_dwFifoThreadIndex) {
- CBlockLock Lock(&m_CriticalLock);
- -
- + //有効なチャンネルが選択されている時に限って
- + if(is_channel_valid){
- // FIFOバッファにプッシュ
- PushFifoBuff(pData,dwLen);
- -
- + }
- // イベントセット
- ::SetEvent(m_hOnStreamEvent);
- + }
- return(true);
- }
- @@ -760,9 +866,9 @@
- PurgeTsStream();
- // バッファプールを確保する
- - m_BufferPool.resize(ASYNCBUFFSIZE);
- + m_BufferPool.resize(ASYNCTSQUEUENUM);
- - for(DWORD dwPos = 0UL ; dwPos < ASYNCBUFFSIZE ; dwPos++){
- + for(DWORD dwPos = 0UL ; dwPos < ASYNCTSQUEUENUM ; dwPos++){
- m_BufferPool[dwPos].resize(TSDATASIZE);
- }
- @@ -782,170 +888,178 @@
- //***** Push Fifo Buffer *****
- -void CBonTuner::PushFifoBuff(const BYTE *pData,DWORD len)
- +void CBonTuner::PushFifoBuff(const BYTE *pData,DWORD dwLen)
- {
- // バッファプールの最大数を超える場合は最後尾を切り捨てる
- - while(m_FifoBuffer.size() >= ASYNCBUFFSIZE)
- - {
- + while(m_FifoBuffer.size() >= ASYNCTSQUEUENUM){
- m_FifoBuffer.pop();
- }
- // バッファプールにデータコピー
- - BYTE *pWritePointer = &m_BufferPool[m_dwEmptyFifoPos][0];
- - ::CopyMemory(pWritePointer, pData, len/*TSDATASIZE*/);
- + m_BufferPool[m_dwEmptyFifoPos].resize(dwLen) ;
- + BYTE *pWritePointer = static_cast<BYTE*>(m_BufferPool[m_dwEmptyFifoPos].top()) ;
- + CopyMemory(pWritePointer, pData, dwLen );
- // FIFOバッファにプッシュ
- - m_FifoBuffer.push(pWritePointer);
- + m_FifoBuffer.push(make_pair(pWritePointer,dwLen));
- // バッファプール位置更新
- - if(++m_dwEmptyFifoPos >= ASYNCBUFFSIZE)m_dwEmptyFifoPos = 0UL;
- + if(++m_dwEmptyFifoPos >= ASYNCTSQUEUENUM)m_dwEmptyFifoPos = 0UL;
- }
- -//***** Load Ini File *****
- -void CBonTuner::LoadIni(void)
- +//***** Init Tuner Property *****
- +
- +void CBonTuner::InitTunerProperty()
- {
- - _TCHAR IniName[256];
- - _TCHAR bf[256];
- - _TCHAR key[32];
- - _TCHAR *p;
- - int i;
- + //自分の名前を取得
- + char szMyPath[_MAX_PATH] ;
- + GetModuleFileNameA( m_hModule, szMyPath, _MAX_PATH ) ;
- + char szMyDrive[_MAX_FNAME] ;
- + char szMyDir[_MAX_FNAME] ;
- + char szMyName[_MAX_FNAME] ;
- + _splitpath_s( szMyPath, szMyDrive, _MAX_FNAME,szMyDir, _MAX_FNAME, szMyName, _MAX_FNAME, NULL, 0 ) ;
- + _strupr_s( szMyName, sizeof(szMyName) ) ;
- - memset(VHFChInfo,0x00,sizeof(TChannelInfo)*VHFMAXCHANNELS);
- - memset(UHFChInfo,0x00,sizeof(TChannelInfo)*UHFMAXCHANNELS);
- - memset(CATVChInfo,0x00,sizeof(TChannelInfo)*CATVMAXCHANNELS);
- - memset(BSChInfo,0x00,sizeof(TChannelInfo)*BSMAXCHANNELS);
- - memset(CSChInfo,0x00,sizeof(TChannelInfo)*CSMAXCHANNELS);
- - VHFNumChannel=0;
- - UHFNumChannel=0;
- - CATVNumChannel=0;
- - BSNumChannel=0;
- - CSNumChannel=0;
- -
- - GetModuleFileName(NULL, IniName, MAX_PATH);
- - p=_tcsrchr(IniName, _T('\\'));
- - if (p)
- - *p=0;
- - _tcscat(IniName,_T("\\BonDriver_Bulldog.ini"));
- + // Fx2 の ID を決定
- + int nFx2Id=0 ;
- + sscanf_s( szMyName, "BONDRIVER_BULLDOG_%1d", &nFx2Id ) ;
- + m_yFx2Id = BYTE(nFx2Id) ;
- - if (GetFileAttributes(IniName)==-1)
- - {
- - for(i=1; i<=12; i++)
- - {
- - _stprintf(bf,_T("0,%d,0x0000,%d"),i,i);
- - GetChannelInfo(bf,&VHFChInfo[i-1]);
- - }
- - VHFNumChannel=i-1;
- - for(i=13; i<=62; i++)
- - {
- - _stprintf(bf,_T("0,%d,0x0000,%d"),i,i);
- - GetChannelInfo(bf,&UHFChInfo[i-13]);
- - }
- - UHFNumChannel=i-13;
- - for(i=13; i<=63; i++)
- - {
- - _stprintf(bf,_T("0,%d,0x0000,C%d"),i+100,i);
- - GetChannelInfo(bf,&CATVChInfo[i-13]);
- - }
- - CATVNumChannel=i-13;
- - for(i=0; DefBSChInfo[i] != NULL; i++)
- - {
- - GetChannelInfo(DefBSChInfo[i],&BSChInfo[i]);
- - }
- - BSNumChannel=i;
- - for(i=0; DefCSChInfo[i] != NULL; i++)
- - {
- - GetChannelInfo(DefCSChInfo[i],&CSChInfo[i]);
- - }
- - CSNumChannel=i;
- + //チューナー名を決定
- + _stprintf_s( m_szTunerName, 100, TEXT("%s(ID=%d)"), TEXT("ブルドッグ"), nFx2Id ) ;
- - return;
- + // Ini ファイルをロード
- + LoadIniFile(string(szMyDrive)+string(szMyDir)+"BonDriver_Bulldog.ini") ;
- + LoadIniFile(string(szMyDrive)+string(szMyDir)+string(szMyName)+".ini") ;
- +
- + // Channel ファイルをロード
- + if(!LoadChannelFile(string(szMyDrive)+string(szMyDir)+string(szMyName)+".ch.txt")) {
- + if(!LoadChannelFile(string(szMyDrive)+string(szMyDir)+"BonDriver_Bulldog.ch.txt"))
- + InitChannelToDefault() ;
- }
- +}
- -//Channel=ServiceID,PhysicalChannel,TSID,Name
- +//***** Laod Ini File *****
- - for(i=0; i<VHFMAXCHANNELS; i++)
- - {
- - _stprintf(key,_T("%d"),i);
- - GetPrivateProfileString(_T("VHF"),key,_T(""),bf,256,IniName);
- - if (bf[0]==0)
- - break;
- +bool CBonTuner::LoadIniFile(std::string strIniFileName)
- +{
- + if(GetFileAttributesA(strIniFileName.c_str())==-1) return false ;
- + #define LOADINT(key) do { \
- + key = GetPrivateProfileIntA("BonTuner",#key, \
- + key,strIniFileName.c_str()) ; \
- + }while(0)
- + LOADINT(TSDATASIZE) ;
- + LOADINT(TSQUEUENUM) ;
- + LOADINT(TSTHREADWAIT) ;
- + LOADINT(TSTHREADPRIORITY) ;
- + LOADINT(TSDUALTHREADING) ;
- + LOADINT(ASYNCTSQUEUENUM) ;
- + LOADINT(ISDBTCOMMANDSENDTIMES) ;
- + LOADINT(ISDBTCOMMANDSENDWAIT) ;
- + LOADINT(ISDBSCOMMANDSENDTIMES) ;
- + LOADINT(ISDBSCOMMANDSENDWAIT) ;
- + #undef LOADINT
- + return true ;
- +}
- - GetChannelInfo(bf,&VHFChInfo[i]);
- - }
- - VHFNumChannel=i;
- +//***** Load Channel File *****
- - for(i=0; i<UHFMAXCHANNELS; i++)
- - {
- - _stprintf(key,_T("%d"),i);
- - GetPrivateProfileString(_T("UHF"),key,_T(""),bf,256,IniName);
- - if (bf[0]==0)
- - break;
- +bool CBonTuner::LoadChannelFile(std::string strChannelFileName)
- +{
- + FILE *st=NULL ;
- + fopen_s(&st,strChannelFileName.c_str(),"rt") ;
- + if(!st) return false;
- + char s[512] ;
- - GetChannelInfo(bf,&UHFChInfo[i]);
- + m_Channels.clear() ;
- + while(!feof(st)) {
- + s[0]='\0' ;
- + fgets(s,512,st) ;
- + string strLine = trim(string(s)) ;
- + wstring wstrLine = mbcs2wcs(strLine) ;
- + AddChannel(wstrLine) ;
- + //DBGOUT("%s",s) ;
- }
- - UHFNumChannel=i;
- - for(i=0; i<CATVMAXCHANNELS; i++)
- - {
- - _stprintf(key,_T("%d"),i);
- - GetPrivateProfileString(_T("CATV"),key,_T(""),bf,256,IniName);
- - if (bf[0]==0)
- - break;
- + fclose(st) ;
- +
- + return true ;
- - GetChannelInfo(bf,&CATVChInfo[i]);
- +}
- +
- +//***** Init Channel To Default *****
- +
- +void CBonTuner::InitChannelToDefault()
- +{
- + wchar_t bf[256];
- +
- + m_Channels.clear() ;
- +
- + for(int i=1; i<=12; i++)
- + {
- + swprintf_s(bf,_countof(bf),_T("VHF,0,%d,0x0000,%d"),i,i);
- + AddChannel(bf);
- }
- - CATVNumChannel=i;
- - for(i=0; i<BSMAXCHANNELS; i++)
- + for(int i=13; i<=62; i++)
- {
- - _stprintf(key,_T("%d"),i);
- - GetPrivateProfileString(_T("BS"),key,_T(""),bf,256,IniName);
- - if (bf[0]==0)
- - break;
- + swprintf_s(bf,_countof(bf),_T("UHF,0,%d,0x0000,%d"),i,i);
- + AddChannel(bf);
- + }
- - GetChannelInfo(bf,&BSChInfo[i]);
- + for(int i=13; i<=63; i++)
- + {
- + swprintf_s(bf,_countof(bf),_T("CATV,0,%d,0x0000,C%d"),i+100,i);
- + AddChannel(bf);
- }
- - BSNumChannel=i;
- - for(i=0; i<CSMAXCHANNELS; i++)
- + for(int i=0; DefBSChInfo[i] != NULL; i++)
- {
- - _stprintf(key,_T("%d"),i);
- - GetPrivateProfileString(_T("CS110"),key,_T(""),bf,256,IniName);
- - if (bf[0]==0)
- - break;
- + swprintf_s(bf,_countof(bf),_T("BS,%s"),DefBSChInfo[i]);
- + AddChannel(bf);
- + }
- - GetChannelInfo(bf,&CSChInfo[i]);
- + for(int i=0; DefCSChInfo[i] != NULL; i++)
- + {
- + swprintf_s(bf,_countof(bf),_T("CS110,%s"),DefCSChInfo[i]);
- + AddChannel(bf);
- }
- - CSNumChannel=i;
- -}
- -//***** Get Channel Info *****
- +}
- -//Channel=ServiceID,PhysicalChannel,TSID,Name
- +//***** Add Channel *****
- -void CBonTuner::GetChannelInfo(_TCHAR *bf,TChannelInfo *ChInfo)
- +bool CBonTuner::AddChannel(std::wstring wstrLine)
- {
- - _TCHAR *p,*q;
- -
- - memset(ChInfo,0x00,sizeof(TChannelInfo));
- -
- - ChInfo->ServiceID=_tcstol(bf,&q,10);
- - if ((q) && (*q==_T(',')))
- - {
- - p=q+1;
- - ChInfo->Channel=_tcstol(p,&q,10);
- - if ((q) && (*q==_T(',')))
- - {
- - p=q+1;
- - ChInfo->TSID=_tcstol(p,&q,16);
- - if ((q) && (*q==_T(',')))
- - {
- - p=q+1;
- - _tcsncpy(ChInfo->Name,p,256);
- + int t=0 ;
- + wstring params[5] ;
- + params[0] = params[1] = params[2] = params[3] = params[4] = L"" ;
- + for(size_t i=0;i<wstrLine.length();i++) {
- + if(wstrLine[i]==L';') break ;
- + else if(wstrLine[i]==L',') {
- + t++ ; if(t==5) break ;
- + }else params[t] += wstrLine[i] ;
- }
- + if(t>=4) {
- + for(int i=0;i<5;i++) params[i] = trim(params[i]) ;
- + int ServiceID = 0 ;
- + int Channel = 0 ;
- + float MegaHz = 0.f ;
- + int TSID = 0 ;
- + swscanf_s(params[1].c_str(),L"%i",&ServiceID,sizeof(ServiceID)) ;
- + if( params[2].length()>3&&
- + params[2].substr(params[2].length()-3)==L"MHz" ) {
- + swscanf_s(params[2].c_str(),L"%fMHz",&MegaHz) ;
- + }else {
- + swscanf_s(params[2].c_str(),L"%i",&Channel,sizeof(Channel)) ;
- }
- + swscanf_s(params[3].c_str(),L"%i",&TSID,sizeof(TSID)) ;
- + m_Channels.push_back(
- + CHANNEL(params[0],ServiceID,Channel,TSID,params[4],MegaHz)) ;
- + return true ;
- }
- + return false ;
- }
- //***** I2C Write *****
- @@ -981,7 +1095,7 @@
- {
- BYTE cmd[64];
- DWORD cmd_len=0;
- - int i;
- + //int i;
- cmd[cmd_len++]=CMD_I2C_READ;
- cmd[cmd_len++]=adrs;
- @@ -1004,7 +1118,7 @@
- {
- BYTE cmd[64];
- DWORD cmd_len=0;
- - int i;
- + //int i;
- cmd[cmd_len++]=CMD_I2C_WRITE;
- cmd[cmd_len++]=adrs;
- @@ -1032,7 +1146,7 @@
- {
- BYTE cmd[64];
- DWORD cmd_len=0;
- - int i;
- + //int i;
- cmd[cmd_len++]=CMD_I2C_WRITE;
- cmd[cmd_len++]=adrs;
- diff -uPrb Org/BonTuner.h Mod/BonTuner.h
- --- Org/BonTuner.h 2012-02-22 16:36:04.000000000 +0900
- +++ Mod/BonTuner.h 2014-01-26 07:44:09.000000000 +0900
- @@ -10,29 +10,92 @@
- #include "UsbFx2Driver.h"
- #include <vector>
- #include <queue>
- -
- -using std::vector;
- -using std::queue;
- -
- -#define VHFMAXCHANNELS 12
- -#define UHFMAXCHANNELS 50
- -#define CATVMAXCHANNELS 51
- -#define BSMAXCHANNELS 64
- -#define CSMAXCHANNELS 256
- -
- -
- -typedef struct {
- - WORD ServiceID;
- - int Channel;
- - WORD TSID;
- - _TCHAR Name[256];
- -} TChannelInfo;
- +#include <string>
- typedef enum CLockStatus {stLock, stLostLock, stNoSignal, stUnknown };
- class CBonTuner : public IBonDriver2,
- protected IUsbFx2DriverHost
- {
- +private:
- + // CHANNEL/CHANNELS
- + struct CHANNEL {
- + std::wstring Space ;
- + WORD ServiceID;
- + int Channel;
- + float MegaHz ;
- + WORD TSID;
- + std::wstring Name ;
- + bool isISDBT() { return TSID==0 ; }
- + bool isISDBS() { return !isISDBT() ; }
- + bool isChannelTuning() { return Channel!=0 ; }
- + bool isMegaHzTuning() { return !isChannelTuning() ; }
- + CHANNEL(std::wstring _Space, WORD _ServiceID,int _Channel,WORD _TSID,
- + std::wstring _Name, float _MegaHz=0.f) {
- + Space = _Space ;
- + ServiceID = _ServiceID ;
- + Channel = _Channel ;
- + TSID = _TSID ;
- + Name = _Name ;
- + MegaHz = _MegaHz ;
- + }
- + CHANNEL(const CHANNEL &_Src) {
- + Space = _Src.Space ;
- + ServiceID = _Src.ServiceID ;
- + Channel = _Src.Channel ;
- + TSID = _Src.TSID ;
- + Name = _Src.Name ;
- + MegaHz = _Src.MegaHz ;
- + }
- + } ;
- + typedef std::vector<CHANNEL> CHANNELS ;
- + // BUFFER/BUFFERPOOL
- + struct BUFFER {
- + BUFFER() : _buffer(NULL), _size(0UL) {}
- + BUFFER(const BUFFER &src )
- + : _buffer(NULL), _size(0UL) {
- + *this = src ;
- + }
- + BUFFER(const void *buffer, size_t size)
- + : _buffer(NULL), _size(0UL) {
- + resize(size) ;
- + if(_buffer&&_size==size)
- + CopyMemory(_buffer,buffer,size) ;
- + }
- + ~BUFFER() {
- + if(_buffer) std::free(_buffer) ;
- + }
- + BUFFER &operator =(const BUFFER &src) {
- + resize(src._size) ;
- + if(_buffer&&_size==src._size)
- + CopyMemory(_buffer,src._buffer,src._size) ;
- + return *this ;
- + }
- + void resize(size_t size) {
- + if(_size!=size) {
- + if(!size) {
- + if(_buffer) {
- + free(_buffer) ;
- + _buffer=NULL ;
- + }
- + }else {
- + if(_buffer) {
- + _buffer = std::realloc(_buffer,size) ;
- + }else {
- + _buffer = std::malloc(size) ;
- + }
- + }
- + if(_buffer) _size = size ;
- + else _size = 0UL ;
- + }
- + }
- + void *top() const { return _buffer ; }
- + size_t size() const { return _size ; }
- + private:
- + void *_buffer ;
- + size_t _size ;
- + };
- + typedef std::vector<BUFFER> BUFFERPOOL ;
- public:
- CBonTuner();
- virtual ~CBonTuner();
- @@ -42,8 +105,8 @@
- int I2CRead(unsigned char adrs,unsigned char reg,int len,unsigned char *data);
- int I2CRead(unsigned char adrs,unsigned tadrs,unsigned char reg,int len,unsigned char *data);
- void SetTSID(int tsid);
- - void SetISDBTChannel(int ch);
- - void SetISDBSChannel(int ch,int tsid);
- + void SetISDBTChannel(int ch,float MegaHz=0.f);
- + void SetISDBSChannel(int ch,int tsid,float MegaHz=0.f);
- CLockStatus IsLockISDBT(void);
- CLockStatus IsLockISDBS(void);
- CLockStatus IsLock(void);
- @@ -88,34 +151,36 @@
- void AllocFifoBuff(void);
- void FreeFifoBuff(void);
- - inline void PushFifoBuff(const BYTE *pData,DWORD len);
- + inline void PushFifoBuff(const BYTE *pData,DWORD dwLen);
- - void LoadIni(void);
- - void GetChannelInfo(_TCHAR *bf,TChannelInfo *ChInfo);
- + void InitTunerProperty() ;
- + bool LoadIniFile(std::string strIniFileName);
- + bool LoadChannelFile(std::string strChannelFileName);
- + void InitChannelToDefault() ;
- + bool AddChannel(std::wstring wstrLine) ;
- + const BOOL SetChannelSub(const DWORD dwCh) ;
- CUsbFx2Driver *m_pUsbFx2Driver;
- CCriticalLock m_CriticalLock;
- HANDLE m_hOnStreamEvent;
- - queue<BYTE *> m_FifoBuffer;
- - vector<vector<BYTE>> m_BufferPool;
- + std::queue< std::pair<BYTE *,size_t> > m_FifoBuffer;
- + BUFFERPOOL m_BufferPool ;
- DWORD m_dwEmptyFifoPos;
- + DWORD m_dwFifoThreadIndex;
- bool fOpened;
- HANDLE m_hMutex;
- DWORD m_dwCurSpace;
- DWORD m_dwCurChannel;
- + DWORD GetCurSerialChannel() ;
- +
- + // チューナーのプロパティ
- + BYTE m_yFx2Id ;
- + TCHAR m_szTunerName[100] ;
- + CHANNELS m_Channels ;
- +
- + BOOL is_channel_valid ;
- - TChannelInfo VHFChInfo[VHFMAXCHANNELS];
- - TChannelInfo UHFChInfo[UHFMAXCHANNELS];
- - TChannelInfo CATVChInfo[CATVMAXCHANNELS];
- - TChannelInfo BSChInfo[BSMAXCHANNELS];
- - TChannelInfo CSChInfo[CSMAXCHANNELS];
- -
- - int VHFNumChannel;
- - int UHFNumChannel;
- - int CATVNumChannel;
- - int BSNumChannel;
- - int CSNumChannel;
- };
- diff -uPrb Org/Cusb2/cusb2.cpp Mod/Cusb2/cusb2.cpp
- --- Org/Cusb2/cusb2.cpp 2012-02-22 15:36:26.000000000 +0900
- +++ Mod/Cusb2/cusb2.cpp 2014-11-13 20:58:35.000000000 +0900
- @@ -65,6 +65,8 @@
- wchar_t wcs[64];
- size_t n;
- mbstowcs_s(&n, wcs, 64, (char *)string1, 64);
- + TRACE(L"fwload: Manufacturer=\"%s\", Compare=\"%s\"\r\n"
- + ,USBDevice->Manufacturer,wcs) ;
- if(wcscmp(USBDevice->Manufacturer, wcs) == 0)
- return true;
- }
- @@ -166,7 +168,17 @@
- return(ep->XferData(buf, len));
- }
- -// Modified by 拡張ツール中の人
- +struct DUAL_TRANSFER_CONTEXT
- +{
- + HANDLE evDataAvailable ;
- + HANDLE evTransferCompleted ;
- + int *len ;
- + OVERLAPPED *ovlp ;
- + PUCHAR *data ;
- + PUCHAR *context ;
- +};
- +
- +// Modified by 拡張ツール中の人 ( Fixed by ◆PRY8EAlByw )
- void cusb2::thread_proc(cusb2_tcb *tcb)
- {
- u32 i;
- @@ -175,36 +187,70 @@
- LONG len;
- CCyUSBEndPoint *ep;
- + tcb->idTh = ::GetCurrentThreadId() ;
- ep = tcb->ep;
- tcb->nsuccess = 0;
- tcb->nfailure = 0;
- tcb->looping = true;
- - tcb->fTerminate=false;
- +
- + tcb->fTerminate = false ;
- OVERLAPPED *ovlp = new OVERLAPPED[tcb->ques];
- PUCHAR *data = new PUCHAR[tcb->ques];
- PUCHAR *context = new PUCHAR[tcb->ques];
- ep->SetXferSize(tcb->xfer);
- - BOOL ret=SetThreadPriority(tcb->th, THREAD_PRIORITY_HIGHEST);
- + BOOL ret=SetThreadPriority(tcb->th, tcb->prior);
- +
- + const DWORD WAIT_MSEC_LIMIT = tcb->wait ;
- +
- + DUAL_TRANSFER_CONTEXT *dtc = NULL ;
- + HANDLE thData = NULL ;
- +
- + const bool incoming = (tcb->epaddr & 0x80) ? true : false ;
- + const bool dual = tcb->fDualTransfer && tcb->looping && incoming ;
- +
- + if(dual) { // Setup the dual transfer threading context.
- + dtc = new DUAL_TRANSFER_CONTEXT ;
- + dtc->len = new int[tcb->ques] ;
- + dtc->evDataAvailable = CreateEvent(NULL,false,false,NULL) ;
- + dtc->evTransferCompleted = CreateEvent(NULL,false,false,NULL) ;
- + dtc->ovlp = ovlp ;
- + dtc->data = data ;
- + dtc->context = context ;
- + tcb->lpDualTransferContext = (LPVOID) dtc ;
- + thData = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)cusb2::data_transfer_thread_proc, tcb, CREATE_SUSPENDED, NULL) ;
- + SetThreadPriority(thData,tcb->prior) ;
- + }
- - if(tcb->epaddr & 0x80)
- + if(incoming)
- { //IN(FX2->PC)転送
- for(i=0; i<tcb->ques; i++)
- {
- data[i] = new UCHAR[tcb->xfer];
- + if(dual) dtc->len[i] = -1 ; // Init all to no data available.
- ovlp[i].hEvent = CreateEvent(NULL, false, false, NULL);
- context[i] = ep->BeginDataXfer(data[i], tcb->xfer, &(ovlp[i]));
- qnum++;
- }
- - for(i=0;;)
- + if(dual) {
- + // Start a data transfer threading process.
- + ::ResumeThread(thData) ;
- + }
- + for(i=0;!tcb->fTerminate;)
- {
- - if (tcb->fTerminate)
- - break;
- - if(!ep->WaitForXfer(&(ovlp[i]),500))
- + if(dual&&tcb->looping) {
- + while(dtc->len[i]>=0) { // Wait for a data transfer completed event.
- + WaitForSingleObject(dtc->evTransferCompleted,WAIT_MSEC_LIMIT) ;
- + if(tcb->fTerminate||!tcb->looping) break ;
- + }
- + if(tcb->fTerminate) break ;
- + }
- +
- + if(!ep->WaitForXfer(&(ovlp[i]),WAIT_MSEC_LIMIT))
- {
- ep->Abort();
- - WaitForSingleObject(&(ovlp[i]),500);
- + //WaitForSingleObject(&(ovlp[i]),WAIT_MSEC_LIMIT);
- }
- len = tcb->xfer;
- @@ -215,20 +261,31 @@
- {
- if(tcb->looping)
- {
- - if(!tcb->cb_func(data[i], (u32)len))
- + if(dual) {
- + dtc->len[i] = len ;
- + }else {
- + if(!tcb->cb_func(data[i], (u32)len, tcb->idTh))
- {
- tcb->looping = false;
- }
- }
- + }
- tcb->nsuccess++;
- }
- else
- {
- + if(dual) {
- + dtc->len[i] = 0 ;
- + }
- tcb->nfailure++;
- }
- + // Notify the transfer thread that one of new data is available.
- + if(dual) SetEvent(dtc->evDataAvailable) ;
- +
- if(tcb->looping)
- {
- + if(!dual)
- context[i] = ep->BeginDataXfer(data[i], tcb->xfer, &(ovlp[i]));
- qnum++;
- }
- @@ -249,7 +306,7 @@
- ovlp[i].hEvent = CreateEvent(NULL, false, false, NULL);
- if(tcb->looping)
- {
- - if(!tcb->cb_func(data[i], (u32)tcb->xfer))
- + if(!tcb->cb_func(data[i], (u32)tcb->xfer, tcb->idTh))
- {
- tcb->looping = false;
- }
- @@ -257,14 +314,12 @@
- context[i] = ep->BeginDataXfer(data[i], tcb->xfer, &(ovlp[i]));
- qnum++;
- }
- - for(i=0;;)
- + for(i=0;!tcb->fTerminate;)
- {
- - if (tcb->fTerminate)
- - break;
- - if(!ep->WaitForXfer(&(ovlp[i]),500))
- + if(!ep->WaitForXfer(&(ovlp[i]),WAIT_MSEC_LIMIT))
- {
- ep->Abort();
- - WaitForSingleObject(&(ovlp[i]),500);
- + //WaitForSingleObject(&(ovlp[i]),WAIT_MSEC_LIMIT);
- }
- len = tcb->xfer;
- @@ -282,7 +337,7 @@
- if(tcb->looping)
- {
- - if(!tcb->cb_func(data[i], (u32)tcb->xfer))
- + if(!tcb->cb_func(data[i], (u32)tcb->xfer, tcb->idTh))
- {
- tcb->looping = false;
- }
- @@ -299,6 +354,20 @@
- }
- }
- + tcb->fTerminate = true ;
- +
- + if(dual) {
- + // Destroy the dual transfer threading context.
- + SetEvent(dtc->evDataAvailable) ;
- + WaitForSingleObject(thData, INFINITE);
- + CloseHandle(thData) ;
- + CloseHandle(dtc->evDataAvailable) ;
- + CloseHandle(dtc->evTransferCompleted) ;
- + delete [] dtc->len ;
- + delete dtc ;
- + tcb->lpDualTransferContext = NULL ;
- + }
- +
- for(i=0; i<tcb->ques; i++)
- {
- CloseHandle(ovlp[i].hEvent);
- @@ -307,12 +376,40 @@
- delete [] context;
- delete [] data;
- delete [] ovlp;
- +}
- -// _endthreadex( 0 );
- -// return(0);
- +// Appended by ◆PRY8EAlByw
- +void cusb2::data_transfer_thread_proc(cusb2_tcb *tcb)
- +{
- + DUAL_TRANSFER_CONTEXT *dtc = (DUAL_TRANSFER_CONTEXT *) tcb->lpDualTransferContext ;
- + const DWORD WAIT_MSEC_LIMIT = tcb->wait ;
- + for(u32 i=0;!tcb->fTerminate;i++) {
- + if(i>=tcb->ques) i=0 ;
- + while(dtc->len[i]<0) { // Wait for a data available event.
- + WaitForSingleObject(dtc->evDataAvailable,WAIT_MSEC_LIMIT) ;
- + if(tcb->fTerminate||!tcb->looping) break ;
- + }
- + if(tcb->fTerminate||!tcb->looping) break ;
- + int len = dtc->len[i] ;
- + if(len>=0) {
- + if(len>0) {
- + if(tcb->looping&&!tcb->cb_func(dtc->data[i], (u32)len, tcb->idTh)) {
- + tcb->fTerminate = true ; // error
- + }
- + }
- + }else tcb->fTerminate = true ; // error
- + dtc->len[i] = -1 ;
- + if(!tcb->fTerminate&&tcb->looping) {
- + dtc->context[i] = tcb->ep->BeginDataXfer(dtc->data[i], tcb->xfer, &(dtc->ovlp[i]));
- + }
- + // Notify the main thread that one of new data transfering is completed.
- + SetEvent(dtc->evTransferCompleted) ;
- + if(!tcb->looping) break ;
- + }
- }
- -cusb2_tcb* cusb2::start_thread(u8 epaddr, u32 xfer, s32 ques, bool (*cb_func)(u8 *, u32))
- +
- +cusb2_tcb* cusb2::start_thread(u8 epaddr, u32 xfer, s32 ques, u32 wait, int prior, cb_func_t cb_func)
- {
- cusb2_tcb *tcb = new cusb2_tcb;
- tcb->epaddr = epaddr;
- @@ -320,19 +417,18 @@
- tcb->epaddr = epaddr;
- tcb->xfer = xfer;
- tcb->ques = ques;
- + tcb->wait = wait;
- + tcb->prior = prior;
- tcb->cb_func = cb_func; // Modified by 拡張ツール中の人
- tcb->th = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)cusb2::thread_proc, tcb, 0, NULL);
- -// tcb->th = (HANDLE)_beginthreadex(NULL,0,thread_proc,(void*)tcb,0/*CREATE_SUSPENDED*/,(unsigned*)&tcb->ThreadID);
- Sleep(100);
- return tcb;
- }
- void cusb2::delete_thread(cusb2_tcb *tcb)
- {
- - tcb->fTerminate=true;
- - WaitForSingleObject(tcb->th, 3000);
- -// WaitForSingleObject(tcb->th, INFINITE);
- -// CloseHandle(tcb->th);
- + tcb->fTerminate = true ;
- + WaitForSingleObject(tcb->th, INFINITE);
- delete tcb;
- }
- diff -uPrb Org/Cusb2/cusb2.h Mod/Cusb2/cusb2.h
- --- Org/Cusb2/cusb2.h 2012-02-22 15:34:52.000000000 +0900
- +++ Mod/Cusb2/cusb2.h 2014-11-13 20:58:35.000000000 +0900
- @@ -15,18 +15,44 @@
- #define CUSB_DEBUG 0
- +typedef bool (*cb_func_t)(u8 *data, u32 ln, u32 idTh) ;
- +
- struct _cusb2_tcb
- {
- HANDLE th;
- + DWORD idTh;
- CCyUSBEndPoint *ep;
- u8 epaddr;
- LONG xfer;
- u32 ques;
- - bool (*cb_func)(u8 *, u32);
- + cb_func_t cb_func ;
- bool looping;
- u32 nsuccess;
- u32 nfailure;
- bool fTerminate;
- + //---- wait & thread priority -----
- + u32 wait ;
- + int prior ;
- + //---- dual transfer threading -----
- + bool fDualTransfer ;
- + void *lpDualTransferContext ;
- + //----
- + _cusb2_tcb() {
- + th = 0 ;
- + idTh = 0 ;
- + ep = 0 ;
- + epaddr = 0 ;
- + xfer = 0 ;
- + cb_func = 0 ;
- + looping = 0 ;
- + nsuccess = 0 ;
- + nfailure = 0 ;
- + fTerminate = 0 ;
- + wait = 500 ;
- + prior = 0 ;
- + fDualTransfer = 0 ;
- + lpDualTransferContext = 0 ;
- + }
- };
- typedef struct _cusb2_tcb cusb2_tcb;
- @@ -47,13 +73,14 @@
- bool fwload(u8 id, u8 *fw, u8 *string1);
- CCyUSBEndPoint* get_endpoint(u8 addr);
- bool xfer(CCyUSBEndPoint *ep, PUCHAR buf, LONG &len);
- - cusb2_tcb *start_thread(u8 epaddr, u32 xfer, s32 ques, bool (*cb_func)(u8 *, u32));
- + cusb2_tcb *start_thread(u8 epaddr, u32 xfer, s32 ques, u32 wait, int prior, cb_func_t cb_func );
- void delete_thread(cusb2_tcb *tcb);
- bool PnpEvent(WPARAM wParam, LPARAM lParam);
- -// Modified by 拡張ツール中の人
- +// Modified by 拡張ツール中の人 ( Fixed by ◆PRY8EAlByw )
- protected:
- static void thread_proc(cusb2_tcb *tcb);
- + static void data_transfer_thread_proc(cusb2_tcb *tcb);
- private:
- s32 check_fx2(u8 id);
- diff -uPrb Org/Cusb2/UsbFx2Dirver.cpp Mod/Cusb2/UsbFx2Dirver.cpp
- --- Org/Cusb2/UsbFx2Dirver.cpp 2012-02-22 15:50:18.000000000 +0900
- +++ Mod/Cusb2/UsbFx2Dirver.cpp 2014-11-13 18:48:34.000000000 +0900
- @@ -12,10 +12,7 @@
- #define new DEBUG_NEW
- #endif
- -
- -// FX2のファームウェアサイズ
- -#define FIRMWARE_SIZE (3893UL) //(3367UL)
- -
- +using namespace std ;
- CUsbFx2Driver *CUsbFx2Driver::m_pThis = NULL;
- @@ -31,7 +28,9 @@
- CloseDriver();
- }
- -const bool CUsbFx2Driver::OpenDriver(const BYTE byDeviceID, const BYTE *pFirmWare, int size,const char *lpszFirmName)
- +const bool CUsbFx2Driver::OpenDriver(
- + const BYTE byDeviceID, const BYTE *pFirmWare,
- + const DWORD FIRMWARE_SIZE, const char *lpszFirmName)
- {
- if(!pFirmWare)return false;
- @@ -39,26 +38,27 @@
- CloseDriver();
- // ファームウェアをコピーする(cusb2内で書き換えられるため)
- - BYTE *abyFirmBuffer=new BYTE[size]; //[FIRMWARE_SIZE];
- - ::CopyMemory(abyFirmBuffer, pFirmWare, size);
- + BYTE *abyFirmBuffer = new BYTE[FIRMWARE_SIZE] ;
- + memcpy(abyFirmBuffer, pFirmWare, FIRMWARE_SIZE);
- // ファームウェアのダウンロードを行う
- - return fwload(byDeviceID, abyFirmBuffer, (BYTE *)lpszFirmName);
- + bool result = fwload(byDeviceID, abyFirmBuffer, (BYTE *)lpszFirmName);
- +
- + delete [] abyFirmBuffer ;
- + return result ;
- }
- void CUsbFx2Driver::CloseDriver(void)
- {
- // 全てのスレッドを終了させる
- - for(DWORD dwIndex = 0UL ; dwIndex < m_ThreadArray.size() ; dwIndex++)
- - {
- + for(DWORD dwIndex = 0UL ; dwIndex < m_ThreadArray.size() ; dwIndex++){
- if(!m_ThreadArray[dwIndex].pThreadTcb->looping)continue;
- // スレッド終了シグナルセット
- m_ThreadArray[dwIndex].pThreadTcb->looping = false;
- // スレッド終了を待つ
- - if(::WaitForSingleObject(m_ThreadArray[dwIndex].pThreadTcb->th, 3000UL) != WAIT_OBJECT_0)
- - {
- + if(::WaitForSingleObject(m_ThreadArray[dwIndex].pThreadTcb->th, 1000UL) != WAIT_OBJECT_0){
- // スレッド強制終了
- ::TerminateThread(m_ThreadArray[dwIndex].pThreadTcb->th, 0UL);
- }
- @@ -70,6 +70,7 @@
- // 内部状態をクリアする
- m_EndPointArray.clear();
- m_ThreadArray.clear();
- + m_PidIndicesMap.clear();
- }
- const bool CUsbFx2Driver::AddEndPoint(const BYTE byAddress, DWORD *pdwEpIndex)
- @@ -123,7 +124,10 @@
- return TransmitData(dwEpIndex, abySendBuffer, dwLen);
- }
- -const bool CUsbFx2Driver::CreateFifoThread(const BYTE byAddress, DWORD *pdwThreadIndex, const DWORD dwBufLen, const DWORD dwQueNum)
- +const bool CUsbFx2Driver::CreateFifoThread(
- + const BYTE byAddress, DWORD *pdwThreadIndex, const DWORD dwBufLen,
- + const DWORD dwQueNum, const DWORD dwWait, const int iPrior,
- + const BOOL bDualTransferThreading )
- {
- // スレッド起動
- TAG_THREADINFO ThreadInfo;
- @@ -136,13 +140,19 @@
- ThreadInfo.pThreadTcb->ep = get_endpoint(byAddress);
- ThreadInfo.pThreadTcb->xfer = dwBufLen;
- ThreadInfo.pThreadTcb->ques = dwQueNum;
- + ThreadInfo.pThreadTcb->wait = dwWait ;
- + ThreadInfo.pThreadTcb->prior = iPrior ;
- ThreadInfo.pThreadTcb->cb_func = CUsbFx2Driver::FifoRecvCallback;
- + ThreadInfo.pThreadTcb->fDualTransfer = bDualTransferThreading ? true : false ;
- ThreadInfo.pThreadTcb->th = ::CreateThread(NULL, 0UL, (LPTHREAD_START_ROUTINE)cusb2::thread_proc, (LPVOID)ThreadInfo.pThreadTcb, CREATE_SUSPENDED, &ThreadInfo.dwThreadID);
- if(!ThreadInfo.pThreadTcb->th)return false;
- +
- // リストに登録
- - if(pdwThreadIndex)*pdwThreadIndex = m_ThreadArray.size();
- + DWORD dwThreadIndex = m_ThreadArray.size() ;
- + if(pdwThreadIndex)*pdwThreadIndex = dwThreadIndex ;
- + m_PidIndicesMap[ThreadInfo.dwThreadID] = dwThreadIndex ;
- m_ThreadArray.push_back(ThreadInfo);
- // レジューム
- @@ -151,19 +161,20 @@
- return true;
- }
- -bool CUsbFx2Driver::FifoRecvCallback(u8 *pData, u32 dwLen)
- +bool CUsbFx2Driver::FifoRecvCallback(u8 *pData, u32 dwLen, u32 dwThreadID)
- {
- + #if 0
- // 呼び出し元を特定するためにスレッドIDを取得
- - const DWORD dwThreadID = ::GetCurrentThreadId();
- -
- - for(DWORD dwIndex = 0UL ; dwIndex < m_pThis->m_ThreadArray.size() ; dwIndex++)
- - {
- - if(m_pThis->m_ThreadArray[dwIndex].dwThreadID == dwThreadID)
- - {
- + for(DWORD dwIndex = 0UL ; dwIndex < m_pThis->m_ThreadArray.size() ; dwIndex++){
- + if(m_pThis->m_ThreadArray[dwIndex].dwThreadID == dwThreadID){
- // インタフェースを呼び出す
- return m_pThis->m_pDriverHost->OnRecvFifoData(dwIndex, pData, dwLen, m_pThis);
- }
- }
- -
- + #else
- + map<u32,int>::iterator pos=m_pThis->m_PidIndicesMap.find(dwThreadID) ;
- + if(pos!=m_pThis->m_PidIndicesMap.end())
- + return m_pThis->m_pDriverHost->OnRecvFifoData(pos->second, pData, dwLen, m_pThis);
- + #endif
- return false;
- }
- diff -uPrb Org/Cusb2/UsbFx2Driver.h Mod/Cusb2/UsbFx2Driver.h
- --- Org/Cusb2/UsbFx2Driver.h 2012-02-18 15:46:56.000000000 +0900
- +++ Mod/Cusb2/UsbFx2Driver.h 2014-11-13 18:30:03.000000000 +0900
- @@ -6,15 +6,18 @@
- #include <vector>
- +#include <map>
- #include "cusb2.h"
- -using std::vector;
- +//using std::vector;
- // デフォルトのFIFOバッファパラメータ設定
- #define DEF_BUFLEN (1024UL * 64UL) // cap_stsから
- -#define DEF_QUENUM (16UL) // cap_stsから
- +#define DEF_QUENUM 16UL // cap_stsから
- +#define DEF_WAIT 500UL
- +#define DEF_PRIOR THREAD_PRIORITY_HIGHEST
- /////////////////////////////////////////////////////////////////////////////
- @@ -36,22 +39,26 @@
- // cusb2 ラッパークラス
- /////////////////////////////////////////////////////////////////////////////
- -class CUsbFx2Driver : public cusb2
- +class CUsbFx2Driver : private cusb2
- {
- public:
- CUsbFx2Driver(IUsbFx2DriverHost *pHostClass, HWND hHostHwnd = NULL);
- ~CUsbFx2Driver();
- - const bool OpenDriver(const BYTE byDeviceID, const BYTE *pFirmWare, int size,const char *lpszFirmName = NULL);
- + const bool OpenDriver(const BYTE byDeviceID, const BYTE *pFirmWare,
- + const DWORD FIRMWARE_SIZE, const char *lpszFirmName = NULL);
- void CloseDriver(void);
- const bool AddEndPoint(const BYTE byAddress, DWORD *pdwEpIndex = NULL);
- const bool TransmitData(const DWORD dwEpIndex, BYTE *pData, DWORD &dwLen);
- const bool TransmitFormatedData(const DWORD dwEpIndex, const DWORD dwDataNum, ...);
- - const bool CreateFifoThread(const BYTE byAddress, DWORD *pdwThreadIndex = NULL, const DWORD dwBufLen = DEF_BUFLEN, const DWORD dwQueNum = DEF_QUENUM);
- + const bool CreateFifoThread(
- + const BYTE byAddress, DWORD *pdwThreadIndex = NULL, const DWORD dwBufLen = DEF_BUFLEN,
- + const DWORD dwQueNum = DEF_QUENUM, const DWORD dwWait = DEF_WAIT, const int iPrior = DEF_PRIOR,
- + const BOOL bDualTransferThreading = FALSE );
- protected:
- - static bool FifoRecvCallback(u8 *pData, u32 dwLen);
- + static bool FifoRecvCallback(u8 *pData, u32 dwLen, u32 dwThreadID);
- struct TAG_THREADINFO
- {
- @@ -63,6 +70,7 @@
- IUsbFx2DriverHost *m_pDriverHost;
- - vector<CCyUSBEndPoint *> m_EndPointArray;
- - vector<TAG_THREADINFO> m_ThreadArray;
- + std::vector<CCyUSBEndPoint *> m_EndPointArray;
- + std::vector<TAG_THREADINFO> m_ThreadArray;
- + std::map<u32/*pid*/,int/*index*/> m_PidIndicesMap ;
- };
- diff -uPrb Org/stdafx.cpp Mod/stdafx.cpp
- --- Org/stdafx.cpp 2008-02-12 01:10:02.000000000 +0900
- +++ Mod/stdafx.cpp 2014-01-10 03:55:10.000000000 +0900
- @@ -3,7 +3,11 @@
- // stdafx.obj にはプリコンパイル済み型情報が含まれます。
- #include "stdafx.h"
- -#include <Stdio.h>
- +#include <cstring>
- +#include <cstdio>
- +#include <cstdlib>
- +#include <cstdarg>
- +#include <clocale>
- // TODO: このファイルではなく、STDAFX.H で必要な
- // 追加ヘッダーを参照してください。
- @@ -18,6 +22,44 @@
- ::wvsprintf(szTempStr, szFormat, Args);
- va_end(Args);
- - ::OutputDebugString(szTempStr);
- + #ifndef DEBUG_TO_X_DRIVE
- + ::OutputDebugString(szTempStr) ;
- + #else
- + FILE *fp = NULL ;
- + fopen_s(&fp,"X:\\Debug.txt","a+t") ;
- + if(fp) {
- + size_t ln = wcslen(szTempStr) ;
- + if(ln) {
- + char *mbcs = new char[ln*2 + 2] ;
- + size_t mbLen = 0 ;
- + setlocale(LC_ALL,"japanese");
- + wcstombs_s(&mbLen, mbcs, ln*2+1, szTempStr, _TRUNCATE);
- + std::fputs(mbcs,fp) ;
- + delete [] mbcs;
- + }
- + std::fclose(fp) ;
- + }
- + #endif
- + }
- +#endif
- +
- +#ifdef _DEBUG
- + void DBGOUT( const char* pszFormat,... )
- + {
- + std::va_list marker ;
- + char edit_str[1024] ;
- + va_start( marker, pszFormat ) ;
- + vsprintf_s( edit_str, sizeof(edit_str), pszFormat, marker ) ;
- + va_end( marker ) ;
- + #ifndef DEBUG_TO_X_DRIVE
- + OutputDebugStringA(edit_str) ;
- + #else
- + FILE *fp = NULL ;
- + fopen_s(&fp,"X:\\Debug.txt","a+t") ;
- + if(fp) {
- + std::fputs(edit_str,fp) ;
- + std::fclose(fp) ;
- + }
- + #endif
- }
- #endif
- diff -uPrb Org/stdafx.h Mod/stdafx.h
- --- Org/stdafx.h 2008-02-12 01:09:46.000000000 +0900
- +++ Mod/stdafx.h 2014-01-04 03:30:32.000000000 +0900
- @@ -20,6 +20,21 @@
- #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
- #endif
- +#ifndef __BORLANDC__
- + #ifdef _MSC_VER
- + #if _MSC_VER <= 1200 // VC++ 6.0 以下
- + //色々と問題が多いコンパイラなので、場合分け用のフラグを設定しておく
- + #define __MSVC_1200__
- + //VC++ for構文のインライン変数除去マクロ
- + #define for if(0) ; else for
- + #endif
- + // C4786 警告を除去
- + #pragma warning (disable : 4786)
- + #endif
- +#endif
- +
- +#define DEBUG_TO_X_DRIVE
- +
- // トレース出力
- #ifdef _DEBUG
- #define TRACE MYTARACEFUNC
- @@ -27,3 +42,11 @@
- #else
- #define TRACE __noop
- #endif
- +
- +// DBGOUT
- +#ifdef _DEBUG
- + void DBGOUT( const char* pszFormat,... ) ;
- +#else
- + #define DBGOUT __noop
- +#endif
- +
- diff -uPrb Org/TC90532/MxL5007.cpp Mod/TC90532/MxL5007.cpp
- --- Org/TC90532/MxL5007.cpp 2011-11-27 21:03:48.000000000 +0900
- +++ Mod/TC90532/MxL5007.cpp 2014-11-13 21:58:49.000000000 +0900
- @@ -315,7 +315,7 @@
- case MxL_MODE_CABLE:
- myIRV = IRV_Init_Cable;
- SetIRVBit(myIRV, 0x09, 0xFF, 0xC1);
- - SetIRVBit(myIRV, 0x0A, 0xFF, 8-IF_Diff_Out_Level);
- + SetIRVBit(myIRV, 0x0A, 0xFF, UINT8(8-IF_Diff_Out_Level));
- SetIRVBit(myIRV, 0x0B, 0xFF, 0x17);
- break;
- }
- diff -uPrb Org/TC90532/tc90532.cpp Mod/TC90532/tc90532.cpp
- --- Org/TC90532/tc90532.cpp 2012-02-18 11:44:48.000000000 +0900
- +++ Mod/TC90532/tc90532.cpp 2014-11-13 21:58:49.000000000 +0900
- @@ -13,8 +13,6 @@
- #include "MxL5007.h"
- #include "tc90532.h"
- -#define TC90502_OK 0
- -#define TC90502_ERR 1
- #define CH_MAX 62//-13 //The Ch maximum number
- @@ -61,18 +59,18 @@
- float BS_table[12] =
- {
- - 1049.48, //CH 1
- - 1087.84, //CH 3
- - 1126.20, //CH 5
- - 1164.56, //CH 7
- - 1202.92, //CH 9
- - 1241.28, //CH 11
- - 1279.64, //CH 13
- - 1318.00, //CH 15
- - 1356.36, //CH 17
- - 1394.72, //CH 19
- - 1433.08, //CH 21
- - 1471.44 //CH 23
- + 1049.48f, //CH 1
- + 1087.84f, //CH 3
- + 1126.20f, //CH 5
- + 1164.56f, //CH 7
- + 1202.92f, //CH 9
- + 1241.28f, //CH 11
- + 1279.64f, //CH 13
- + 1318.00f, //CH 15
- + 1356.36f, //CH 17
- + 1394.72f, //CH 19
- + 1433.08f, //CH 21
- + 1471.44f //CH 23
- };
- float CS_table[12] =
- @@ -91,28 +89,34 @@
- 2053 //CH 24
- };
- -UINT8 SetMxl5007(UINT8 CH)
- +UINT8 SetMxl5007(UINT8 CH, float MegaHz)
- {
- - UINT32 freq, x;
- MxL_ERR_MSG Status = MxL_OK;
- BOOL RFSynthLock, REFSynthLock;
- - SINT32 RF_Input_Level;
- + //SINT32 RF_Input_Level;
- MxL5007_TunerConfigS myTuner;
- unsigned long rf;
- - unsigned char bw;
- - x = CH;
- -
- - if(CH < 4) freq = 93000 + (x - 1) * 6000;
- - else if(CH < 8) freq = 173000 + (x - 4) * 6000;
- - else if(CH < 13) freq = 195000 + (x - 8) * 6000;
- - else if(CH < 63) freq = 473143 + (x - 13) * 6000;
- - else if(CH < 123) freq = 111143 + (x - 113) * 6000;
- - else if(CH < 136) freq = 225143 + (x - 123) * 6000;
- - else freq = 303143 + (x - 136) * 6000;
- -
- - rf = freq * 1000UL;
- - bw = 6;
- + if(!CH) {
- + rf = UINT32(MegaHz * 1000000.f) ;
- + }else {
- + if(CH < 4) rf = 93UL + (CH - 1) * 6UL ;
- + else if(CH < 8) rf = 173UL + (CH - 4) * 6UL ;
- + else if(CH < 13) rf = 195UL + (CH - 8) * 6UL ;
- + else if(CH < 63) rf = 473UL + (CH - 13) * 6UL ;
- + else if(CH < 122) rf = 111UL + (CH - 113) * 6UL ;
- + else if(CH ==122) rf = 167UL ; // C22
- + #if 0
- + else if(CH ==123) rf = 225UL ;
- + else if(CH < 128) rf = 233UL + (CH - 124) * 6UL ;
- + else if(CH < 136) rf = 255UL + (CH - 128) * 6UL ;
- + #else
- + else if(CH < 136) rf = 225UL + (CH - 123) * 6UL ;
- + #endif
- + else rf = 303UL + (CH - 136) * 6UL ;
- + rf *= 1000000UL ;
- + rf += 142857UL ;
- + }
- myTuner.DemodAddr = DEMODTADRS;
- //Set Tuner's I2C Address
- @@ -142,7 +146,7 @@
- //Init Tuner fail
- }
- //Tune Tuner
- - if(Status == MxL_Tuner_RFTune(&myTuner, rf, (MxL5007_BW_MHz)bw))
- + if(Status == MxL_Tuner_RFTune(&myTuner, rf, MxL_BW_6MHz))
- {
- //Tune Tuner fail
- }
- @@ -162,7 +166,7 @@
- return 0;
- }
- -UINT8 SetStv6110a(UINT8 BSCh)
- +UINT8 SetStv6110a(UINT8 BSCh,float MegaHz)
- {
- UINT8 STB6110A[8] = {0x07,0x13,0xdc,0x85,0x17,0x01,0xe6,0x1e};
- UINT8 K;
- @@ -173,14 +177,18 @@
- int rDivOpt = 0;
- int pCalc, i;
- UINT8 CF;
- - UINT8 buffer;
- + //UINT8 buffer;
- float RF;
- - float symb = 28.86;
- + float symb = 28.86f;
- + if(!BSCh) {
- + RF = MegaHz ;
- + }else {
- if (BSCh & 1)
- RF = BS_table[BSCh/2];
- else
- RF = CS_table[BSCh/2-1];
- + }
- for(i=0; i<8; i++)
- {
- @@ -231,7 +239,7 @@
- divider = (UINT16)(((RF * (float)r * pow(2.0,(double)(P+1)) * 10.0 / (float)XTAL) + 5.0) / 10.0) ;
- STB6110A[2] = divider & 0x00ff;
- - STB6110A[3] = ((rDivOpt & 0x3) << 6) | (Presc << 5) | (P << 4) | ((divider & 0x700) >> 8);
- + STB6110A[3] = ((rDivOpt & 0x3) << 6) | (Presc << 5) | (P << 4) | ((divider & 0xF00) >> 8);
- if(WriteTuner(DemodAddress+1,0xC6,0x02,STB6110A[2]) != 0)
- return 1;
- diff -uPrb Org/TC90532/tc90532.h Mod/TC90532/tc90532.h
- --- Org/TC90532/tc90532.h 2012-02-07 20:05:32.000000000 +0900
- +++ Mod/TC90532/tc90532.h 2014-11-13 22:01:10.000000000 +0900
- @@ -2,6 +2,9 @@
- #ifndef TC90532_H
- #define TC90532_H
- +#define TC90502_OK 0
- +#define TC90502_ERR 1
- +
- #define DemodAddress 0x10
- #define DEMODTADRS 0x10
- @@ -14,9 +17,10 @@
- #define ISDB_S 2
- -UINT8 SetMxl5007(UINT8 CH);
- -UINT8 SetStv6110a(UINT8 BSCh);
- +UINT8 SetMxl5007(UINT8 CH,float MegaHz=0);
- +UINT8 SetStv6110a(UINT8 BSCh,float MegaHz=0);
- UINT8 SetTC90502(UINT8 TS);
- #endif //TC90532_H
- +// Fixed by ◆PRY8EAlByw
- +// hyrolean-dtv@yahoo.co.jp
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement