亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ds8007.lst

?? dallas公司的ds8007芯片源代碼。絕對好用。可以兼容tda8007.
?? LST
?? 第 1 頁 / 共 5 頁
字號:
 246   1              EDC = generateEDC(type,PCB,EDC);
 247   1              writeByte(length);
 248   1              EDC = generateEDC(type,length,EDC);
 249   1              for (i=0;i<length;i++)
 250   1              {
 251   2                      writeByte(buffer[i]);
 252   2                      EDC = generateEDC(type,buffer[i],EDC);
 253   2              }
 254   1      
 255   1              if (type == EDC_TYPE_LRC)
 256   1              {
 257   2                      writeLastByte(EDC);
 258   2              }
 259   1              else // type = CRC
 260   1              {
 261   2                      writeByte(EDC);
 262   2                  writeLastByte(EDC>>8);
 263   2              }
 264   1      }
 265          
 266          /*
 267          Receive a T=1 formatted block.
 268          This does a raw receive, it does not check sequence numbers.
 269          */
 270          int16_t receiveBlock(uint8_t *rNAD,uint8_t *rPCB,uint8_t *rLEN,uint8_t *buffer,uint8_t type)
 271          {
 272   1              int16_t retval;
 273   1              int16_t index = 0;
 274   1              uint16_t EDC;
 275   1              int16_t i;
 276   1              uint8_t expectedLength;
 277   1      
 278   1              // Get NAD, PCB, and Length
 279   1              retval = readByte();
 280   1              if (retval < 0) return retval;
 281   1              *rNAD = retval;
 282   1              retval = readByte();
 283   1              if (retval < 0) return retval;
 284   1              *rPCB = retval;
 285   1              retval = readByte();
 286   1              if (retval < 0) return retval;
 287   1              *rLEN = retval;
 288   1      
 289   1      
 290   1              // Add one to length for LRC
 291   1              expectedLength = *rLEN+1;
 292   1              // Add additional byte if using CRC
 293   1              if (type == EDC_TYPE_CRC)
 294   1                      expectedLength++;
 295   1      
 296   1              // Get all data bytes plus EDC (1 or 2 bytes at end)
 297   1              for (i = 0;i < expectedLength;i++)
 298   1              {
 299   2                      retval = readByte();
 300   2                      if (retval < 0)
 301   2                      {
 302   3                              return retval;
C51 COMPILER V8.08   DS8007                                                                10/26/2007 09:32:25 PAGE 6   

 303   3                      }
 304   2                      buffer[index++] = retval;
 305   2              }
 306   1      
 307   1              // Check the LRC or CRC
 308   1              if (type == EDC_TYPE_LRC)
 309   1              {
 310   2                      EDC = 0;
 311   2                      EDC = generateEDC(EDC_TYPE_LRC,*rNAD,EDC);
 312   2                      EDC = generateEDC(EDC_TYPE_LRC,*rPCB,EDC);
 313   2                      EDC = generateEDC(EDC_TYPE_LRC,*rLEN,EDC);
 314   2                      for (i = 0;i < index;i++)
 315   2                      {
 316   3                              EDC = generateEDC(EDC_TYPE_LRC,buffer[i],EDC);
 317   3                      }
 318   2                      if (EDC != 0)
 319   2                      {
 320   3                              return ERR_RECEIVE_LRC;
 321   3                      }
 322   2              }
 323   1              else // EDC is CRC
 324   1              {
 325   2                      EDC = 0xFFFF;
 326   2                      EDC = generateEDC(EDC_TYPE_LRC,*rNAD,EDC);
 327   2                      EDC = generateEDC(EDC_TYPE_LRC,*rPCB,EDC);
 328   2                      EDC = generateEDC(EDC_TYPE_LRC,*rLEN,EDC);
 329   2                      for (i = 0;i < (index-2);i++)
 330   2                      {
 331   3                              EDC = generateEDC(EDC_TYPE_CRC,buffer[i],EDC);
 332   3                      }
 333   2          
 334   2                      if (((EDC >> 8) != buffer[index-2]) ||
 335   2                              ((EDC & 0xFF) != buffer[index-1]))
 336   2                  {
 337   3                              return ERR_RECEIVE_CRC;
 338   3                      }
 339   2              }
 340   1              return *rLEN;
 341   1      }
 342          
 343          /*
 344          Send an S block for setting IFSD (card terminal buffer size)
 345          */
 346          int16_t dssc_sendsblockIFSD(uint8_t IFSD)
 347          {
 348   1              uint8_t buffer[1];
 349   1              uint8_t rNAD,rPCB,rLEN;
 350   1              uint8_t rbuffer[100];
 351   1      
 352   1              buffer[0] = IFSD;
 353   1              sendBlock(0,0xC1,1,buffer,EDCtype[currentSlot]);
 354   1              receiveBlock(&rNAD,&rPCB,&rLEN,rbuffer,EDCtype[currentSlot]);
 355   1      
 356   1              // If we do not get a confirmation response, fail.
 357   1              if ((rPCB == 0xE1) && (rLEN == 1) && (rbuffer[0] == IFSD))
 358   1                      return 0;
 359   1              else
 360   1                      return ERR_SETIFSD_FAILURE;
 361   1      }
 362          
 363          /*
 364          Set Node address info for this card
C51 COMPILER V8.08   DS8007                                                                10/26/2007 09:32:25 PAGE 7   

 365          */
 366          void dssc_setNAD(uint8_t value)
 367          {
 368   1              NAD[currentSlot] = value;
 369   1      }
 370          
 371          /*
 372          Send a message using T=1 protocol
 373          */
 374          int16_t dssc_sendAPDUT1(uint8_t *buffer,int16_t length,uint8_t *rbuffer)
 375          {
 376   1              int16_t maxSegLength = IFSC[currentSlot];  // Set by ATR (TA3), or default to 0x20
 377   1              int16_t retval;
 378   1              uint8_t sequenceNumber = 0;
 379   1              uint8_t rNAD,rPCB,rLEN;
 380   1              uint8_t tempbuffer[512];
 381   1      
 382   1              while (length > maxSegLength)
 383   1              {
 384   2                      // Send block with chaining mode, current sequence number, and maximum length.
 385   2                      sendBlock(NAD[currentSlot],sequenceNumber|0x20,maxSegLength,buffer,EDCtype[currentSlot]);
 386   2                      retval = receiveBlock(&rNAD,&rPCB,&rLEN,tempbuffer,EDCtype[currentSlot]);
 387   2                      if (retval < 0) return retval;
 388   2                      // Check for bad sequence number return
 389   2                      if ((rPCB ^ ((sequenceNumber>>2) ^ 0x10)) != 0x80)
 390   2                      {
 391   3                              return ERR_RECEIVE_SEQUENCENUM;
 392   3                      }
 393   2                      sequenceNumber ^= 0x40;
 394   2                      buffer += maxSegLength;
 395   2                      length -= maxSegLength;
 396   2              }
 397   1      
 398   1              // Send last (or only) block.  Then, we can wait for the receive side.
 399   1              sendBlock(NAD[currentSlot],sequenceNumber,length,buffer,EDCtype[currentSlot]);
 400   1      
 401   1              retval = receiveBlock(&rNAD,&rPCB,&rLEN,tempbuffer,EDCtype[currentSlot]);
 402   1              if (retval < 0) return retval;
 403   1      
 404   1              memcpy(rbuffer,tempbuffer,rLEN);
 405   1      
 406   1              return retval;
 407   1      }
 408          
 409          /*
 410          Send a message using T=0 protocol
 411          */
 412          int16_t dssc_sendAPDUT0(uint8_t *buffer,int16_t length,uint8_t *rbuffer)
 413          {
 414   1              int index;
 415   1              int16_t rindex = 0;
 416   1              uint8_t val;
 417   1              uint8_t INS = buffer[1];
 418   1              int retval;
 419   1      
 420   1              // Write 5 byte command header
 421   1              for (index = 0;index < 4;)
 422   1                      writeByte(buffer[index++]);
 423   1              writeLastByte(buffer[index++]);
 424   1      
 425   1              while (1)
 426   1              {
C51 COMPILER V8.08   DS8007                                                                10/26/2007 09:32:25 PAGE 8   

 427   2              // Get procedure byte
 428   2                      retval = readByte();
 429   2                      if (retval < 0)
 430   2                      {
 431   3                              return retval;
 432   3                      }
 433   2                      val = retval;
 434   2      
 435   2                      if ((val & 0xFE) == INS)
 436   2                      {
 437   3                              // ACK, send/receive all remaining bytes
 438   3                              if (index < length)
 439   3                              {
 440   4                                      for (;index < (length-1);index++)
 441   4                                      writeByte(buffer[index]);
 442   4                                      if (index < length)
 443   4                                              writeLastByte(buffer[index++]);
 444   4                                      // NOTE: Does not support VPP state change
 445   4                              }
 446   3                              else
 447   3                              {
 448   4                                      // Read bytes up to Lc/P3 + 2
 449   4                                      rindex = 0;
 450   4                                      while ( (rindex < (buffer[4] + 2)) && ((retval = readByte()) >= 0) )
 451   4                                      {
 452   5                                              rbuffer[rindex++] = retval;
 453   5                                      }
 454   4                              // return any error.
 455   4                              if (retval < 0)
 456   4                                      return retval;
 457   4                              break;
 458   4                              }
 459   3                      }
 460   2              else if ((val & 0xFE) == ~INS)
 461   2                      {
 462   3                      if (index < length)
 463   3                      {
 464   4                              // ACK, send/receive one remaining byte
 465   4                              if (index < length)
 466   4                                      writeLastByte(buffer[index++]);
 467   4                              // NOTE: Does not support VPP state change
 468   4                      }
 469   3                      else
 470   3                      {
 471   4                                      // Read one byte or timeout????
 472   4                              retval = readByte();
 473   4                              if (retval < 0)
 474   4                              {
 475   5                                      // If we get anything other than a timeout, return the error.
 476   5                                      if (retval != ERR_RECEIVE_TIMEOUT)
 477   5                                      return retval;
 478   5                                      break;
 479   5                              }
 480   4                              else
 481   4                              rbuffer[rindex++] = retval;
 482   4                      }
 483   3              }
 484   2              else if (val == 0x60)
 485   2              {
 486   3              // NULL
 487   3              }
 488   2              else if (((val & 0xF0) == 0x60) || ((val & 0xF0) == 0x90))
C51 COMPILER V8.08   DS8007                                                                10/26/2007 09:32:25 PAGE 9   

 489   2              {
 490   3                      // SW1, get SW2
 491   3                      rbuffer[rindex++]=val;
 492   3                      val = readByte();
 493   3                      if (retval < 0) return retval;
 494   3                      rbuffer[rindex++]=val;
 495   3                      break;
 496   3              }
 497   2      
 498   2              }
 499   1      
 500   1              return rindex;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精彩视频在线观看不卡| 国产成人三级在线观看| 国产综合色视频| 99久久精品免费精品国产| 欧美一区二区免费观在线| 最新国产精品久久精品| 精品亚洲aⅴ乱码一区二区三区| 99久久精品免费看| 久久久国产午夜精品| 日韩激情av在线| 色婷婷综合久色| 国产精品女上位| 国产一区二区三区视频在线播放| 欧美系列一区二区| 亚洲卡通动漫在线| 9i在线看片成人免费| 久久精品视频网| 久久精品国产99久久6| 在线综合亚洲欧美在线视频| 一区二区三区不卡在线观看| 成人黄色一级视频| 国产日本亚洲高清| 国产成人超碰人人澡人人澡| 精品国产伦一区二区三区免费| 日本伊人精品一区二区三区观看方式| 91福利社在线观看| 亚洲女女做受ⅹxx高潮| 91在线一区二区三区| 中文字幕在线一区二区三区| 成人av午夜影院| 中文字幕日本不卡| 91丨porny丨国产| 一区二区三区在线视频免费| 一本到不卡免费一区二区| 亚洲天堂av老司机| 色乱码一区二区三区88| 亚洲国产精品视频| 欧美剧在线免费观看网站| 日韩国产高清影视| 欧美哺乳videos| 国产一二精品视频| 日本一区二区视频在线| 成人美女视频在线观看18| 中文字幕亚洲区| 欧美性大战久久久久久久蜜臀| 香蕉久久夜色精品国产使用方法| 欧美日韩成人在线| 蜜臀99久久精品久久久久久软件| 日韩一区二区在线免费观看| 黄网站免费久久| 国产精品国产自产拍高清av王其| 色综合久久九月婷婷色综合| 亚洲综合久久久久| 亚洲欧美日韩系列| 精品视频在线免费观看| 美女脱光内衣内裤视频久久影院| 精品福利在线导航| 91一区二区三区在线播放| 亚洲国产精品自拍| 欧美电影免费观看高清完整版在线 | 亚洲h在线观看| 欧美一区二区在线免费观看| 国产剧情一区二区| 一区二区成人在线| 日韩午夜小视频| 不卡av在线免费观看| 亚洲第一成年网| 久久久精品2019中文字幕之3| 色综合色狠狠综合色| 精品一区二区三区蜜桃| 一区二区三区四区视频精品免费| 日韩视频一区二区在线观看| 成人av电影免费观看| 免费观看30秒视频久久| 中文字幕制服丝袜成人av| 日韩午夜精品电影| 在线视频一区二区三区| 经典三级一区二区| 亚洲综合激情另类小说区| 精品免费一区二区三区| 91成人网在线| 成人精品视频一区二区三区| 日本成人在线不卡视频| 亚洲三级免费观看| 国产欧美一区二区三区在线看蜜臀| 91国偷自产一区二区开放时间| 久久99精品久久久久婷婷| 亚洲精品高清在线观看| 国产日韩三级在线| 欧美va亚洲va| 91精品国产一区二区三区香蕉| 一本久久a久久精品亚洲| 丁香网亚洲国际| 精品一区二区三区在线播放 | 国产黄色91视频| 老司机精品视频导航| 性做久久久久久| 亚洲一二三四区不卡| 亚洲视频香蕉人妖| 欧美国产日韩在线观看| 精品国产一区二区三区不卡| 欧美一区二区播放| 91精品国产一区二区人妖| 欧美日韩专区在线| 欧美日韩中文字幕一区| 欧美性视频一区二区三区| 一本色道久久综合亚洲91| 99精品欧美一区二区蜜桃免费| 国产美女娇喘av呻吟久久| 久久国产精品色| 欧美少妇xxx| 欧美亚洲一区二区在线| 在线观看精品一区| 欧美性生活久久| 欧美狂野另类xxxxoooo| 欧美一二三区在线| 欧美成人福利视频| 久久精品视频网| 中文字幕一区二区三区在线播放 | 国产精品美女久久福利网站| 欧美激情综合网| 国产精品毛片久久久久久| 国产精品久久久久久久久久久免费看| 国产日产精品1区| 国产精品国产三级国产普通话蜜臀 | 色悠悠亚洲一区二区| 色偷偷成人一区二区三区91| 日本黄色一区二区| 7777精品伊人久久久大香线蕉完整版 | 国产精品日韩成人| **欧美大码日韩| 亚洲成人自拍偷拍| 免费在线观看不卡| 国产九色sp调教91| 91啪亚洲精品| 欧美老人xxxx18| 久久久精品蜜桃| 亚洲精品第1页| 美女www一区二区| 成人ar影院免费观看视频| 色国产综合视频| 日韩欧美一级在线播放| 中国色在线观看另类| 一区二区三区美女视频| 免费成人在线播放| 成人免费高清在线| 欧美一区二区三区小说| 国产精品无遮挡| 日本女优在线视频一区二区| 成人黄色国产精品网站大全在线免费观看| proumb性欧美在线观看| 欧美日本不卡视频| 国产午夜精品一区二区三区四区| 亚洲人成电影网站色mp4| 日本欧美韩国一区三区| 99久久99久久精品免费观看| 欧美精三区欧美精三区| 中文在线一区二区| 日本中文字幕一区二区有限公司| 丰满放荡岳乱妇91ww| 欧美电影一区二区| 亚洲视频一二三区| 狠狠久久亚洲欧美| 欧美日本在线一区| 亚洲欧美在线观看| 国内精品第一页| 欧美日本一区二区在线观看| 国产精品三级av在线播放| 美女视频一区在线观看| 91天堂素人约啪| 久久久亚洲精品石原莉奈| 亚洲高清久久久| 久久精品一区二区三区四区| 日本亚洲电影天堂| 欧美日韩一区久久| 亚洲丝袜制服诱惑| 国产电影一区二区三区| 日韩三级av在线播放| 亚洲电影中文字幕在线观看| av在线不卡电影| 国产丝袜欧美中文另类| 久久99精品久久久久久国产越南| 欧美日韩国产精选| 亚洲综合精品久久| 色婷婷综合视频在线观看| 日韩一区在线看| 风间由美一区二区三区在线观看| 日韩欧美成人午夜| 视频一区免费在线观看| 欧美日韩久久久| 一区二区三区在线观看欧美| 91视频免费观看| 中文字幕一区二区三区在线不卡| 国产·精品毛片| 中文字幕精品在线不卡| 国产麻豆午夜三级精品| 精品国产一区a| 国产精品夜夜嗨| 国产欧美一区二区三区鸳鸯浴| 国产福利一区在线|