Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

772 lines
20 KiB

  1. /*
  2. ************************************************************************
  3. *
  4. * DONGLE.C
  5. *
  6. * Portions Copyright (C) 1996-2001 National Semiconductor Corp.
  7. * All rights reserved.
  8. * Copyright (C) 1996-2001 Microsoft Corporation. All Rights Reserved.
  9. *
  10. * Auto Dongle Setup
  11. *
  12. * Author: Kishor Padmanabhan
  13. *
  14. * This file has routines that implements Franco Iacobelli's vision
  15. * of dongle interface. Recommand reading this document before going
  16. * ahead.
  17. *
  18. *
  19. *************************************************************************
  20. */
  21. #ifdef DPRINT
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <time.h>
  25. #include <dos.h>
  26. #endif
  27. #include "newdong.h"
  28. #ifdef NDIS50_MINIPORT
  29. #include "nsc.h"
  30. #else
  31. extern void NSC_WriteBankReg(UINT ComPort, const iBank, int iRegNum, UCHAR iVal);
  32. extern UCHAR NSC_ReadBankReg(UINT ComPort,const iBank, int iRegNum);
  33. #endif
  34. //////////////////////////////////////////////////////////////////////////
  35. // //
  36. // Function prototypes //
  37. //////////////////////////////////////////////////////////////////////////
  38. //DongleParam *GetDongleCapabilities(UIR Com);
  39. //int SetDongleCapabilities(UIR Com);
  40. void delay(unsigned int period); // a delay loop
  41. // Called from SetDongleCapabilities
  42. int SetReqMode(const UIR * Com,DongleParam *Dingle);
  43. void SetHpDongle(PUCHAR UirPort,int Mode);
  44. void SetTemicDongle(PUCHAR UirPort,int Mode);
  45. void SetSharpDongle(PUCHAR UirPort,int Mode);
  46. void SetDellDongle(PUCHAR UirPort,int Mode);
  47. void SetHpMuxDongle(PUCHAR UirPort, int Mode);
  48. void SetIbmDongle (PUCHAR UirPort, int Mode);
  49. // Pauses for a specified number of microseconds.
  50. void Sleep( ULONG wait );
  51. void PrintDongleParam(DongleParam *Dongle);
  52. //////////////////////////////////////////////////////////////////////////
  53. // //
  54. // Function: GetDongleCapabilities //
  55. // //
  56. // Description: //
  57. // //
  58. // This routine fill up the DongleParam structure interpreting the //
  59. // dongle oem's code and returns a pointer the structure. //
  60. // //
  61. // Input : UIR structure with XcvrNumber ,Com Port and IR mode //
  62. // offset //
  63. // OutPut : DongleParam Structure //
  64. // //
  65. //////////////////////////////////////////////////////////////////////////
  66. DongleParam *GetDongleCapabilities(PSYNC_DONGLE SyncDongle)
  67. {
  68. const UIR * Com=SyncDongle->Com;
  69. DongleParam *Dingle=SyncDongle->Dingle;
  70. UINT Signature;
  71. char TEMP1 ;
  72. // Check for validity of the Com port address
  73. if(Com->ComPort == 0) return(NULL);
  74. // Com->XcvrNum only has either 0 or 1
  75. // Check for validity of the Port Number address
  76. //if(Com->XcvrNum > 1) return(NULL);
  77. // Check for first time
  78. if(Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG)
  79. return(&Dingle[Com->XcvrNum]);
  80. // Signature is a word long ID information
  81. // bit 15 = 1 -- Plug and Play
  82. // bit 0, 1, 2, 3 -- ID number for different Manufactures
  83. Signature = Com->Signature;
  84. Dingle[Com->XcvrNum].PlugPlay = 0;
  85. Dingle[Com->XcvrNum].WORD0.bits.GCERR = 0;
  86. if(GetBit(Com->Signature, 15)) //is dongle PnP ?
  87. {
  88. // Make the Pins IRSL1-2 as Inputs
  89. NSC_WriteBankReg(Com->ComPort, BANK7, 7, 0x00);
  90. NdisStallExecution(50); //Wait 50 us
  91. // Check whether Disconnect
  92. // ID/IRSL(2-1) as Input upon READ bit 0-3 return the logic
  93. // level of the pins(allowing external devices to identify
  94. // themselves.)
  95. if(((Signature = NSC_ReadBankReg(Com->ComPort, BANK7, 4) & 0x0f)) == 0x0f) {
  96. Dingle[Com->XcvrNum].WORD0.bits.GCERR = XCVR_DISCONNECT;
  97. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 0;
  98. return(&Dingle[Com->XcvrNum]);
  99. }
  100. Dingle[Com->XcvrNum].PlugPlay = 1;
  101. #ifdef DPRINT
  102. printf(" Plug and Play Dongle\n");
  103. printf(" Sig %x\n",Signature);
  104. #endif
  105. }
  106. // Dongle Identification
  107. switch(Signature & 0x1f) {
  108. case 0:
  109. case 1:
  110. #ifdef DPRINT
  111. printf(" Serial Adapter with diff. signaling");
  112. #endif
  113. return(NULL);
  114. break;
  115. case 6:
  116. #ifdef DPRINT
  117. printf(" Serial Adapter with single ended signaling");
  118. #endif
  119. return(NULL);
  120. break;
  121. case 7:
  122. #ifdef DPRINT
  123. printf(" Consumer-IR only");
  124. #endif
  125. return(NULL);
  126. break;
  127. case 2:
  128. case 3:
  129. case 5:
  130. case 0xa:
  131. #ifdef DPRINT
  132. printf(" Reserved");
  133. #endif
  134. return(NULL);
  135. break;
  136. case 4:
  137. #ifdef DPRINT
  138. printf(" Sharp RY5HD01 or RY5KD01 transceiver");
  139. #endif
  140. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  141. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = SharpRY5HD01;
  142. Dingle[Com->XcvrNum].WORD4.Data = SharpRecovery;
  143. Dingle[Com->XcvrNum].WORD6.Data = SharpBofs;
  144. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  145. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  146. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  147. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  148. break;
  149. case 0x8:
  150. #ifdef DPRINT
  151. printf(" HP HSDL-2300/3600 transceiver");
  152. #endif
  153. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  154. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Hp2300;
  155. Dingle[Com->XcvrNum].WORD4.Data = HpRecovery;
  156. Dingle[Com->XcvrNum].WORD6.Data = HpBofs;
  157. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  158. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  159. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  160. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  161. break;
  162. case 0x9:
  163. #ifdef DPRINT
  164. printf(" Vishay TFDS6000, IBM31T1100, Siemens IRMS/T6400");
  165. #endif
  166. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  167. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Temic6000;
  168. Dingle[Com->XcvrNum].WORD4.Data = TemicRecovery;
  169. Dingle[Com->XcvrNum].WORD6.Data = TemicBofs;
  170. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  171. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  172. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  173. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  174. break;
  175. case 0x0B:
  176. #ifdef DPRINT
  177. printf(" Vishay TFDS6500");
  178. #endif
  179. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  180. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Temic6500;
  181. Dingle[Com->XcvrNum].WORD4.Data = TemicRecovery;
  182. Dingle[Com->XcvrNum].WORD6.Data = TemicBofs;
  183. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  184. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  185. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  186. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  187. break;
  188. case 0xc:
  189. case 0xd:
  190. #ifdef DPRINT
  191. printf(" HP HSDL-1100/2100 or TI TSLM1100 or Sharp RY6FD11E/RY6FD1SE");
  192. #endif
  193. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  194. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Hp1100;
  195. Dingle[Com->XcvrNum].WORD4.Data = HpRecovery;
  196. Dingle[Com->XcvrNum].WORD6.Data = HpBofs;
  197. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  198. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  199. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  200. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  201. break;
  202. case 0xe:
  203. #ifdef DPRINT
  204. printf(" SIR Only");
  205. #endif
  206. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  207. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = SirOnly;
  208. Dingle[Com->XcvrNum].WORD4.Data = TemicRecovery;
  209. Dingle[Com->XcvrNum].WORD6.Data = TemicBofs;
  210. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  211. break;
  212. case 0xf:
  213. #ifdef DPRINT
  214. printf(" No Dongle present");
  215. #endif
  216. return(NULL);
  217. break;
  218. case 0x10:
  219. #ifdef DPRINT
  220. printf("DELL Titanium with two TEMIC transceivers");
  221. #endif
  222. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  223. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Dell1997;
  224. Dingle[Com->XcvrNum].WORD4.Data = TemicRecovery;
  225. Dingle[Com->XcvrNum].WORD6.Data = TemicBofs;
  226. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  227. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  228. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  229. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  230. break;
  231. case 0x11:
  232. #ifdef DPRINT
  233. printf("IBM SouthernCross with two IBM transceivers");
  234. #endif
  235. Dingle[Com->XcvrNum].WORD0.bits.DSVFLAG = 1;
  236. Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode = Ibm20H2987;
  237. Dingle[Com->XcvrNum].WORD4.Data = TemicRecovery;
  238. Dingle[Com->XcvrNum].WORD6.Data = TemicBofs;
  239. Dingle[Com->XcvrNum].WORD7.bits.FIR = TRUE;
  240. Dingle[Com->XcvrNum].WORD7.bits.MIR = TRUE;
  241. Dingle[Com->XcvrNum].WORD7.bits.SIR = TRUE;
  242. Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR = TRUE;
  243. break;
  244. default:
  245. return(NULL);
  246. break;
  247. }
  248. // Everything O.K return the structure
  249. return(&Dingle[Com->XcvrNum]);
  250. }
  251. //////////////////////////////////////////////////////////////////////////
  252. // //
  253. // Function: SetDongleCapabilities //
  254. // //
  255. // Description: //
  256. // //
  257. // Input : UIR structure with XcvrNumber ,Com Port and IR mode offset //
  258. // Result : If successfull will set the dongle to the appropriate mode. //
  259. // Returns TRUE for success and error codes defined in dongle.h//
  260. // UNSUPPORTED 2 //
  261. // ERROR_GETCAPAB 7 //
  262. // //
  263. //////////////////////////////////////////////////////////////////////////
  264. int SetDongleCapabilities(PSYNC_DONGLE SyncDongle)
  265. {
  266. const UIR * Com=SyncDongle->Com;
  267. DongleParam *Dingle=SyncDongle->Dingle;
  268. DongleParam *Dongle;
  269. Dongle = GetDongleCapabilities(SyncDongle);
  270. // Check whether Dongle is NULL
  271. if(Dongle == NULL) {
  272. #ifdef DPRINT
  273. printf(" Returning ERROR");
  274. #endif
  275. return(ERROR_GETCAPAB);
  276. }
  277. if(Dingle[Com->XcvrNum].WORD0.bits.GCERR != 0)
  278. return(ERROR_GETCAPAB);
  279. return(SetReqMode(Com,Dingle));
  280. }
  281. //////////////////////////////////////////////////////////////////////////
  282. // //
  283. // Function: SetRegMode //
  284. // //
  285. // Description: //
  286. // //
  287. // Input : Structure Com with ComPort, ModeReq and XcvrNum set. //
  288. // OutPut : True if successfull //
  289. // UNIMPLEMENTED if so //
  290. // //
  291. // //
  292. //////////////////////////////////////////////////////////////////////////
  293. int SetReqMode(const UIR * Com,DongleParam *Dingle)
  294. {
  295. UINT trcode ;
  296. #ifdef DPRINT
  297. printf("ModeReq %d ",Com->ModeReq);
  298. #endif
  299. trcode = Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode;
  300. if ((trcode == Hp1100) || (trcode == Dell1997))
  301. // Make the Pins IRSL1-2 as output
  302. NSC_WriteBankReg(Com->ComPort, BANK7, 7, 0x08);
  303. else
  304. // Make the Pins IRSL0-2 as output
  305. NSC_WriteBankReg(Com->ComPort, BANK7, 7, 0x28);
  306. NSC_WriteBankReg(Com->ComPort, BANK7, 4, 0x00); //set IRSL1,2 low
  307. if(Com->ModeReq > 3)
  308. return(UNSUPPORTED) ;
  309. switch(Com->ModeReq) {
  310. case 0x0: // Setup SIR mode
  311. if(!Dingle[Com->XcvrNum].WORD7.bits.SIR)
  312. return(UNSUPPORTED);
  313. NSC_WriteBankReg(Com->ComPort, BANK7, 4, 0);
  314. Dingle[Com->XcvrNum].WORD1.bits.CurSelMode = Com->ModeReq;
  315. Dingle[Com->XcvrNum].WORD0.bits.MVFLAG = 1;
  316. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == SirOnly) {
  317. return(TRUE);
  318. }
  319. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Hp1100) {
  320. SetHpDongle(Com->ComPort, 1);
  321. return(TRUE);
  322. }
  323. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Hp2300)
  324. {
  325. SetHpMuxDongle(Com->ComPort,0);
  326. return(TRUE);
  327. }
  328. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Temic6000) {
  329. SetTemicDongle(Com->ComPort, 0);
  330. return(TRUE);
  331. }
  332. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Temic6500) {
  333. SetTemicDongle(Com->ComPort, 0);
  334. return(TRUE);
  335. }
  336. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == SharpRY5HD01) {
  337. return(TRUE);
  338. }
  339. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Dell1997) {
  340. SetDellDongle(Com->ComPort, 0);
  341. return(TRUE);
  342. }
  343. if(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode == Ibm20H2987) {
  344. SetIbmDongle(Com->ComPort, 0);
  345. return(TRUE);
  346. }
  347. break;
  348. case 1: /* Setup MIR mode */
  349. if(!Dingle[Com->XcvrNum].WORD7.bits.MIR)
  350. return(UNSUPPORTED);
  351. // Set the current mode to the mode requested
  352. Dingle[Com->XcvrNum].WORD1.bits.CurSelMode = Com->ModeReq;
  353. Dingle[Com->XcvrNum].WORD0.bits.MVFLAG = 1;
  354. switch(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode) {
  355. case Hp1100:
  356. SetHpDongle(Com->ComPort, 1);
  357. return(TRUE);
  358. case Hp2300:
  359. SetHpMuxDongle(Com->ComPort,1);
  360. return(TRUE);
  361. case Temic6000:
  362. SetTemicDongle(Com->ComPort, 0);
  363. return(TRUE);
  364. case Temic6500:
  365. SetTemicDongle(Com->ComPort, 1);
  366. return(TRUE);
  367. case SharpRY5HD01:
  368. return(TRUE);
  369. case Dell1997:
  370. SetDellDongle(Com->ComPort, 1);
  371. return(TRUE);
  372. case Ibm20H2987:
  373. SetIbmDongle(Com->ComPort, 1);
  374. return(TRUE);
  375. }
  376. break;
  377. case 2: // Setup FIR mode
  378. if(!Dingle[Com->XcvrNum].WORD7.bits.FIR)
  379. return(UNSUPPORTED);
  380. // Set the current mode to the mode requested
  381. Dingle[Com->XcvrNum].WORD1.bits.CurSelMode = Com->ModeReq;
  382. Dingle[Com->XcvrNum].WORD0.bits.MVFLAG = 1;
  383. switch(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode) {
  384. case Hp1100:
  385. SetHpDongle(Com->ComPort, 1);
  386. return(TRUE);
  387. case Hp2300:
  388. SetHpMuxDongle(Com->ComPort,1);
  389. return(TRUE);
  390. case Temic6000:
  391. case Temic6500:
  392. SetTemicDongle(Com->ComPort, 1);
  393. return(TRUE);
  394. case SharpRY5HD01:
  395. return(TRUE);
  396. case Dell1997:
  397. SetDellDongle(Com->ComPort, 1);
  398. return(TRUE);
  399. case Ibm20H2987:
  400. SetIbmDongle(Com->ComPort, 1);
  401. return(TRUE);
  402. }
  403. break;
  404. case 3: // Setup Sharp-IR mode
  405. if(!Dingle[Com->XcvrNum].WORD7.bits.Sharp_IR)
  406. return(UNSUPPORTED);
  407. // Set the current mode to the mode requested
  408. Dingle[Com->XcvrNum].WORD1.bits.CurSelMode = Com->ModeReq;
  409. Dingle[Com->XcvrNum].WORD0.bits.MVFLAG = 1;
  410. switch(Dingle[Com->XcvrNum].WORD0.bits.TrcvrCode) {
  411. case Hp1100:
  412. SetHpDongle(Com->ComPort, 0);
  413. return(TRUE);
  414. case Hp2300:
  415. SetHpMuxDongle(Com->ComPort, 1);
  416. return(TRUE);
  417. case Temic6000:
  418. SetTemicDongle(Com->ComPort, 0);
  419. return(TRUE);
  420. case Temic6500:
  421. SetTemicDongle(Com->ComPort, 1);
  422. return(TRUE);
  423. case SharpRY5HD01:
  424. return(TRUE);
  425. case Dell1997:
  426. SetDellDongle(Com->ComPort, 1);
  427. return(TRUE);
  428. case Ibm20H2987:
  429. SetIbmDongle(Com->ComPort, 1);
  430. return(TRUE);
  431. }
  432. break;
  433. default:
  434. return(UNSUPPORTED);
  435. }
  436. return(UNSUPPORTED);
  437. }
  438. //////////////////////////////////////////////////////////////////////////
  439. // //
  440. // Function: SetHpMuxDongle //
  441. // //
  442. // Description: //
  443. // //
  444. // Input : Mode = 1 for FIR,MIR and SIR . //
  445. // Mode = 0 for SIR //
  446. // //
  447. //////////////////////////////////////////////////////////////////////////
  448. void SetHpMuxDongle(PUCHAR UirPort,int Mode)
  449. {
  450. if (Mode == 1)
  451. NSC_WriteBankReg(UirPort,BANK7,4,0x1); //select MIR or FIR
  452. }
  453. //////////////////////////////////////////////////////////////////////////
  454. // //
  455. // Function: SetHpDongle //
  456. // //
  457. // Description: //
  458. // //
  459. // Input : Mode = 1 for FIR,MIR and SIR . //
  460. // Mode = 0 for Sharp, CIR_OS //
  461. // //
  462. //////////////////////////////////////////////////////////////////////////
  463. void SetHpDongle(PUCHAR UirPort,int Mode)
  464. {
  465. UCHAR val;
  466. if(Mode) {
  467. // MIR , FIR and SIR Mode . And Oversampling Low speed
  468. // Bank 5/offset 4/Bit 4 (AUX_IRRX) = 0
  469. val = (UCHAR) (NSC_ReadBankReg(UirPort,BANK5,4) & 0xef);
  470. NSC_WriteBankReg(UirPort,BANK5,4,val);
  471. NSC_WriteBankReg(UirPort,BANK7,7,0x48);
  472. }
  473. else {
  474. // Sharp IR , Oversampling Med and hi speed cir
  475. val =(UCHAR) NSC_ReadBankReg(UirPort,BANK5,4) | 0x10;
  476. NSC_WriteBankReg(UirPort,BANK5,4,val);
  477. }
  478. }
  479. //////////////////////////////////////////////////////////////////////////
  480. // //
  481. // Function: Sleep //
  482. // //
  483. // Description: //
  484. // //
  485. // Pauses for a specified number of microseconds. //
  486. // //
  487. //////////////////////////////////////////////////////////////////////////
  488. void Sleep( ULONG usecToWait )
  489. {
  490. #ifdef NDIS50_MINIPORT
  491. do {
  492. UINT usec = (usecToWait > 8000) ? 8000 : usecToWait;
  493. NdisStallExecution(usec);
  494. usecToWait -= usec;
  495. } while (usecToWait > 0);
  496. #else
  497. clock_t goal;
  498. goal = usecToWait + clock();
  499. while( goal >= clock() ) ;
  500. #endif
  501. }
  502. //////////////////////////////////////////////////////////////////////////
  503. // //
  504. // Function: Delay //
  505. // //
  506. // Description: //
  507. // //
  508. // Simple delay loop. //
  509. // //
  510. //////////////////////////////////////////////////////////////////////////
  511. void delay(unsigned int usecToWait)
  512. {
  513. #ifdef NDIS50_MINIPORT
  514. do {
  515. UINT usec = (usecToWait > 8000) ? 8000 : usecToWait;
  516. NdisStallExecution(usec);
  517. usecToWait -= usec;
  518. } while (usecToWait > 0);
  519. #else
  520. while(usecToWait--);
  521. #endif
  522. }
  523. #ifdef DPRINT
  524. void PrintDongleParam(DongleParam *Dongle)
  525. {
  526. printf(" Dongle Structure: \n");
  527. printf(" Word0 : %x \n",Dongle->WORD0.Data);
  528. printf(" Word1 : %x \n",Dongle->WORD1.Data);
  529. printf(" Word2 : %x \n",Dongle->WORD2.Data);
  530. printf(" Word3 : %x \n",Dongle->WORD3.Data);
  531. printf(" Word4 : %x \n",Dongle->WORD4.Data);
  532. printf(" Word5 : %x \n",Dongle->WORD5.Data);
  533. printf(" Word6 : %x \n",Dongle->WORD6.Data);
  534. printf(" Word7 : %x \n",Dongle->WORD7.Data);
  535. printf(" Word8 : %x \n",Dongle->WORD8.Data);
  536. printf(" Word9 : %x \n",Dongle->WORD9.Data);
  537. printf(" Word10 : %x \n",Dongle->WORD10.Data);
  538. printf(" Word11 : %x \n",Dongle->WORD11.Data);
  539. }
  540. #endif
  541. //////////////////////////////////////////////////////////////////////////
  542. // //
  543. // Function: SetTemicDongle //
  544. // Transceivers: Temic TFDS-6000/6500, IBM31T1100 //
  545. // //
  546. // Description: //
  547. // Set the IBM Transceiver mode //
  548. // Mode = 0 - SIR, MIR //
  549. // Mode = 1 - MIR, FIR, Sharp-IR //
  550. // Mode = 2 - Low Power Mode //
  551. // //
  552. //////////////////////////////////////////////////////////////////////////
  553. void SetTemicDongle(PUCHAR UirPort,int Mode)
  554. {
  555. switch( Mode ) {
  556. case 0:
  557. NSC_WriteBankReg(UirPort, BANK7, 4, 0x00);
  558. NdisStallExecution(10);
  559. // Trigger the Bandwidth line from high to low
  560. NSC_WriteBankReg(UirPort, BANK7, 4, 0x01);
  561. NdisStallExecution( 20 );
  562. NSC_WriteBankReg(UirPort,BANK7,4,0x00);
  563. NdisStallExecution( 1000 );
  564. break;
  565. case 1:
  566. NSC_WriteBankReg(UirPort, BANK7, 4, 0x01);
  567. NdisStallExecution( 20 );
  568. NSC_WriteBankReg(UirPort, BANK7, 4, 0x81);
  569. NdisStallExecution(10);
  570. NSC_WriteBankReg(UirPort, BANK7, 4, 0x80);
  571. NdisStallExecution( 1000 );
  572. break;
  573. case 2:
  574. NSC_WriteBankReg(UirPort, BANK7, 4, 0x1);
  575. break;
  576. default:
  577. break;
  578. }
  579. }
  580. //////////////////////////////////////////////////////////////////////////
  581. // //
  582. // Function: SetDellDongle //
  583. // //
  584. // Description: //
  585. // Set the Dell Transceiver mode //
  586. // Mode = 0 - SIR, MIR //
  587. // Mode = 1 - FIR //
  588. // Mode = 2 - Low Power Mode //
  589. // //
  590. //////////////////////////////////////////////////////////////////////////
  591. void SetDellDongle(PUCHAR UirPort,int Mode)
  592. {
  593. switch( Mode ) {
  594. case 0:
  595. NSC_WriteBankReg(UirPort,BANK7,4,0x02);
  596. NdisStallExecution( 20 );
  597. NSC_WriteBankReg(UirPort, BANK7, 4, 0x00);
  598. NdisStallExecution( 1000 );
  599. break;
  600. case 1:
  601. NSC_WriteBankReg(UirPort, BANK7, 4, 0x2);
  602. NdisStallExecution( 20 );
  603. NSC_WriteBankReg(UirPort, BANK7, 4, 0x82);
  604. NdisStallExecution( 10 );
  605. NSC_WriteBankReg(UirPort, BANK7, 4, 0x80);
  606. NdisStallExecution( 1000 );
  607. break;
  608. case 2:
  609. NSC_WriteBankReg(UirPort, BANK7, 4, 0x2);
  610. break;
  611. default:
  612. break;
  613. }
  614. }
  615. //////////////////////////////////////////////////////////////////////////
  616. // //
  617. // Function: SetIbmDongle //
  618. // Transceivers: two IBM31T1100 with IRSL0 selecting the mode for both //
  619. // transceivers. IRSL1 low selects front transceiver. //
  620. // IRSL2 low selects rear transceiver. //
  621. // Selection is thru the SouthernCross ASIC 0000020H2987 //
  622. // //
  623. // Description: //
  624. // Set the Ibm Transceiver mode //
  625. // Mode = 0 - SIR //
  626. // Mode = 1 - MIR, FIR, Sharp-IR //
  627. // Mode = 2 - Low Power Mode //
  628. // //
  629. //////////////////////////////////////////////////////////////////////////
  630. void SetIbmDongle (PUCHAR UirPort, int Mode)
  631. {
  632. switch( Mode ) {
  633. case 0:
  634. NSC_WriteBankReg(UirPort,BANK7,4,0x00);
  635. NdisStallExecution( 10 );
  636. NSC_WriteBankReg(UirPort,BANK7,4,0x01);
  637. NdisStallExecution( 20 );
  638. NSC_WriteBankReg(UirPort, BANK7, 4, 0x06);
  639. NdisStallExecution( 1000 );
  640. break;
  641. case 1:
  642. NSC_WriteBankReg(UirPort, BANK7, 4, 0x01);
  643. NdisStallExecution( 20 );
  644. NSC_WriteBankReg(UirPort, BANK7, 4, 0x81);
  645. NdisStallExecution( 10 );
  646. NSC_WriteBankReg(UirPort, BANK7, 4, 0x86);
  647. NdisStallExecution( 1000 );
  648. break;
  649. case 2:
  650. NSC_WriteBankReg(UirPort, BANK7, 4, 0x01);
  651. break;
  652. default:
  653. break;
  654. }
  655. }