您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DRIVER_DATA函数代码示例

51自学网 2021-06-01 20:23:38
  C++
这篇教程C++ DRIVER_DATA函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DRIVER_DATA函数的典型用法代码示例。如果您正苦于以下问题:C++ DRIVER_DATA函数的具体用法?C++ DRIVER_DATA怎么用?C++ DRIVER_DATA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DRIVER_DATA函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: arygon_firmware

voidarygon_firmware(nfc_device *pnd, char *str){  const uint8_t arygon_firmware_version_cmd[] = { DEV_ARYGON_PROTOCOL_ARYGON_ASCII, 'a', 'v' };  uint8_t abtRx[16];  size_t szRx = sizeof(abtRx);  int res = uart_send(DRIVER_DATA(pnd)->port, arygon_firmware_version_cmd, sizeof(arygon_firmware_version_cmd), 0);  if (res != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to send ARYGON firmware command.");    return;  }  res = uart_receive(DRIVER_DATA(pnd)->port, abtRx, szRx, 0, 0);  if (res != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to retrieve ARYGON firmware version.");    return;  }  if (0 == memcmp(abtRx, arygon_error_none, 6)) {    uint8_t *p = abtRx + 6;    unsigned int szData;    sscanf((const char *)p, "%02x%9s", &szData, p);    if (szData > 9)      szData = 9;    memcpy(str, p, szData);    *(str + szData) = '/0';  }}
开发者ID:Euphorix,项目名称:libnfc,代码行数:29,


示例2: arygon_reset_tama

intarygon_reset_tama(nfc_device *pnd){  const uint8_t arygon_reset_tama_cmd[] = { DEV_ARYGON_PROTOCOL_ARYGON_ASCII, 'a', 'r' };  uint8_t abtRx[10]; // Attempted response is 10 bytes long  size_t szRx = sizeof(abtRx);  int res;  uart_send(DRIVER_DATA(pnd)->port, arygon_reset_tama_cmd, sizeof(arygon_reset_tama_cmd), 500);  // Two reply are possible from ARYGON device: arygon_error_none (ie. in case the byte is well-sent)  // or arygon_error_unknown_mode (ie. in case of the first byte was bad-transmitted)  res = uart_receive(DRIVER_DATA(pnd)->port, abtRx, szRx, 0, 1000);  if (res != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "No reply to 'reset TAMA' command.");    pnd->last_error = res;    return pnd->last_error;  }  if (0 != memcmp(abtRx, arygon_error_none, sizeof(arygon_error_none) - 1)) {    pnd->last_error = NFC_EIO;    return pnd->last_error;  }  return NFC_SUCCESS;}
开发者ID:Euphorix,项目名称:libnfc,代码行数:26,


示例3: pn532_uart_send

static intpn532_uart_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout){  int res = 0;  // Before sending anything, we need to discard from any junk bytes  uart_flush_input(DRIVER_DATA(pnd)->port);  switch (CHIP_DATA(pnd)->power_mode) {    case LOWVBAT: {      /** PN532C106 wakeup. */      if ((res = pn532_uart_wakeup(pnd)) < 0) {        return res;      }      // According to PN532 application note, C106 appendix: to go out Low Vbat mode and enter in normal mode we need to send a SAMConfiguration command      if ((res = pn532_SAMConfiguration(pnd, PSM_NORMAL, 1000)) < 0) {        return res;      }    }    break;    case POWERDOWN: {      if ((res = pn532_uart_wakeup(pnd)) < 0) {        return res;      }    }    break;    case NORMAL:      // Nothing to do :)      break;  };  uint8_t  abtFrame[PN532_BUFFER_LEN] = { 0x00, 0x00, 0xff };       // Every packet must start with "00 00 ff"  size_t szFrame = 0;  if ((res = pn53x_build_frame(abtFrame, &szFrame, pbtData, szData)) < 0) {    pnd->last_error = res;    return pnd->last_error;  }  res = uart_send(DRIVER_DATA(pnd)->port, abtFrame, szFrame, timeout);  if (res != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to transmit data. (TX)");    pnd->last_error = res;    return pnd->last_error;  }  uint8_t abtRxBuf[6];  res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 6, 0, timeout);  if (res != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "Unable to read ACK");    pnd->last_error = res;    return pnd->last_error;  }  if (pn53x_check_ack_frame(pnd, abtRxBuf, sizeof(abtRxBuf)) == 0) {    // The PN53x is running the sent command  } else {    return pnd->last_error;  }  return NFC_SUCCESS;}
开发者ID:bobylive,项目名称:libnfc,代码行数:60,


示例4: acr122_usb_init

intacr122_usb_init(nfc_device *pnd){  int res = 0;  int i;  uint8_t  abtRxBuf[255 + sizeof(struct ccid_header)];  /*  // See ACR122 manual: "Bi-Color LED and Buzzer Control" section  uint8_t acr122u_get_led_state_frame[] = {    0x6b, // CCID    0x09, // lenght of frame    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // padding    // frame:    0xff, // Class    0x00, // INS    0x40, // P1: Get LED state command    0x00, // P2: LED state control    0x04, // Lc    0x00, 0x00, 0x00, 0x00, // Blinking duration control  };  log_put (LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "ACR122 Get LED state");  if ((res = acr122_usb_bulk_write (DRIVER_DATA (pnd), (uint8_t *) acr122u_get_led_state_frame, sizeof (acr122u_get_led_state_frame), 1000)) < 0)    return res;  if ((res = acr122_usb_bulk_read (DRIVER_DATA (pnd), abtRxBuf, sizeof (abtRxBuf), 1000)) < 0)    return res;  */  if ((res = pn53x_set_property_int(pnd, NP_TIMEOUT_COMMAND, 1000)) < 0)    return res;  // Power On ICC  uint8_t ccid_frame[] = {    PC_to_RDR_IccPowerOn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00  };  if ((res = acr122_usb_bulk_write(DRIVER_DATA(pnd), ccid_frame, sizeof(struct ccid_header), 1000)) < 0)    return res;  if ((res = acr122_usb_bulk_read(DRIVER_DATA(pnd), abtRxBuf, sizeof(abtRxBuf), 1000)) < 0)    return res;  log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "ACR122 PICC Operating Parameters");  if ((res = acr122_usb_send_apdu(pnd, 0x00, 0x51, 0x00, NULL, 0, 0, abtRxBuf, sizeof(abtRxBuf))) < 0)    return res;  res = 0;  for (i = 0; i < 3; i++) {    if (res < 0)      log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "PN532 init failed, trying again...");    if ((res = pn53x_init(pnd)) >= 0)      break;  }  if (res < 0)    return res;  return NFC_SUCCESS;}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:59,


示例5: acr122_open

nfc_device *acr122_open (const nfc_connstring connstring){  struct acr122_descriptor ndd;  int connstring_decode_level = acr122_connstring_decode (connstring, &ndd);  if (connstring_decode_level < 2) {    return NULL;  }  // FIXME: acr122_open() does not take care about bus index  char   *pcFirmware;  nfc_device *pnd = nfc_device_new (connstring);  pnd->driver_data = malloc (sizeof (struct acr122_data));  // Alloc and init chip's data  pn53x_data_new (pnd, &acr122_io);  SCARDCONTEXT *pscc;    log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Attempt to open %s", ndd.pcsc_device_name);  // Test if context succeeded  if (!(pscc = acr122_get_scardcontext ()))    goto error;  // Test if we were able to connect to the "emulator" card  if (SCardConnect (*pscc, ndd.pcsc_device_name, SCARD_SHARE_EXCLUSIVE, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &(DRIVER_DATA (pnd)->hCard), (void *) &(DRIVER_DATA (pnd)->ioCard.dwProtocol)) != SCARD_S_SUCCESS) {    // Connect to ACR122 firmware version >2.0    if (SCardConnect (*pscc, ndd.pcsc_device_name, SCARD_SHARE_DIRECT, 0, &(DRIVER_DATA (pnd)->hCard), (void *) &(DRIVER_DATA (pnd)->ioCard.dwProtocol)) != SCARD_S_SUCCESS) {      // We can not connect to this device.      log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "PCSC connect failed");      goto error;    }  }  // Configure I/O settings for card communication  DRIVER_DATA (pnd)->ioCard.cbPciLength = sizeof (SCARD_IO_REQUEST);  // Retrieve the current firmware version  pcFirmware = acr122_firmware (pnd);  if (strstr (pcFirmware, FIRMWARE_TEXT) != NULL) {    // Done, we found the reader we are looking for    snprintf (pnd->name, sizeof (pnd->name), "%s / %s", ndd.pcsc_device_name, pcFirmware);    // 50: empirical tuning on Touchatag    // 46: empirical tuning on ACR122U    CHIP_DATA (pnd)->timer_correction = 50;    pnd->driver = &acr122_driver;    pn53x_init (pnd);    return pnd;  }error:  nfc_device_free (pnd);  return NULL;}
开发者ID:copacetic,项目名称:tabulator,代码行数:59,


示例6: pn53x_usb_init

intpn53x_usb_init (nfc_device *pnd){  int res = 0;  // Sometimes PN53x USB doesn't reply ACK one the first frame, so we need to send a dummy one...  //pn53x_check_communication (pnd); // Sony RC-S360 doesn't support this command for now so let's use a get_firmware_version instead:  const uint8_t abtCmd[] = { GetFirmwareVersion };  pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, 0, 0);  // ...and we don't care about error  pnd->last_error = 0;  if (SONY_RCS360 == DRIVER_DATA (pnd)->model) {    log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "SONY RC-S360 initialization.");    const uint8_t abtCmd2[] = { 0x18, 0x01 };    pn53x_transceive (pnd, abtCmd2, sizeof (abtCmd2), NULL, 0, 0);    pn53x_usb_ack (pnd);  }  if ((res = pn53x_init (pnd)) < 0)    return res;  if (ASK_LOGO == DRIVER_DATA (pnd)->model) {    log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "%s", "ASK LoGO initialization.");    /* Internal registers */    /* Disable 100mA current limit, Power on Secure IC (SVDD) */    pn53x_write_register (pnd, PN53X_REG_Control_switch_rng, 0xFF, SYMBOL_CURLIMOFF | SYMBOL_SIC_SWITCH_EN | SYMBOL_RANDOM_DATAREADY);    /* Select the signal to be output on SIGOUT: Modulation signal (envelope) from the internal coder */    pn53x_write_register (pnd, PN53X_REG_CIU_TxSel, 0xFF, 0x14);    /* SFR Registers */    /* Setup push-pulls for pins from P30 to P35 */    pn53x_write_register (pnd, PN53X_SFR_P3CFGB, 0xFF, 0x37);/*On ASK LoGO hardware:  LEDs port bits definition:    * LED 1: bit 2 (P32)   * LED 2: bit 1 (P31)   * LED 3: bit 0 or 3 (depending of hardware revision) (P30 or P33)   * LED 4: bit 5 (P35)  Notes:    * Set logical 0 to switch LED on; logical 1 to switch LED off.    * Bit 4 should be maintained at 1 to keep RF field on.  Progressive field activation:   The ASK LoGO hardware can progressively power-up the antenna.   To use this feature we have to switch on the field by switching on   the field on PN533 (RFConfiguration) then set P34 to '1', and cut-off the    field by switching off the field on PN533 then set P34 to '0'.*/    /* Set P30, P31, P33, P35 to logic 1 and P32, P34 to 0 logic */    /* ie. Switch LED1 on and turn off progressive field */    pn53x_write_register (pnd, PN53X_SFR_P3, 0xFF, _BV (P30) | _BV (P31) | _BV (P33) | _BV (P35));  }  return NFC_SUCCESS;}
开发者ID:copacetic,项目名称:tabulator,代码行数:57,


示例7: acr122_build_frame_from_tama

static intacr122_build_frame_from_tama(nfc_device *pnd, const uint8_t *tama, const size_t tama_len){  if (tama_len > sizeof(DRIVER_DATA(pnd)->tama_frame.tama_payload))    return NFC_EINVARG;  DRIVER_DATA(pnd)->tama_frame.ccid_header.dwLength = htole32(tama_len + sizeof(struct apdu_header) + 1);  DRIVER_DATA(pnd)->tama_frame.apdu_header.bLen = tama_len + 1;  memcpy(DRIVER_DATA(pnd)->tama_frame.tama_payload, tama, tama_len);  return (sizeof(struct ccid_header) + sizeof(struct apdu_header) + 1 + tama_len);}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:11,


示例8: acr122_led_red

boolacr122_led_red (nfc_device *pnd, bool bOn){  uint8_t  abtLed[9] = { 0xFF, 0x00, 0x40, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00 };  uint8_t  abtBuf[2];  DWORD dwBufLen = sizeof (abtBuf);  (void) bOn;  if (DRIVER_DATA (pnd)->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED) {    return (SCardControl (DRIVER_DATA (pnd)->hCard, IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, abtLed, sizeof (abtLed), abtBuf, dwBufLen, &dwBufLen) == SCARD_S_SUCCESS);  } else {    return (SCardTransmit (DRIVER_DATA (pnd)->hCard, &(DRIVER_DATA (pnd)->ioCard), abtLed, sizeof (abtLed), NULL, abtBuf, &dwBufLen) == SCARD_S_SUCCESS);  }}
开发者ID:copacetic,项目名称:tabulator,代码行数:13,


示例9: pn532_uart_abort_command

intpn532_uart_abort_command (nfc_device *pnd){  if (pnd) {#ifndef WIN32    close (DRIVER_DATA (pnd)->iAbortFds[0]);    pipe (DRIVER_DATA (pnd)->iAbortFds);#else    DRIVER_DATA (pnd)->abort_flag = true;#endif  }  return NFC_SUCCESS;}
开发者ID:copacetic,项目名称:tabulator,代码行数:13,


示例10: acr122_usb_send_apdu

static intacr122_usb_send_apdu(nfc_device *pnd,                     const uint8_t ins, const uint8_t p1, const uint8_t p2, const uint8_t *const data, size_t data_len, const uint8_t le,                     uint8_t *out, const size_t out_size){  int res;  size_t frame_len = acr122_build_frame_from_apdu(pnd, ins, p1, p2, data, data_len, le);  if ((res = acr122_usb_bulk_write(DRIVER_DATA(pnd), (unsigned char *) & (DRIVER_DATA(pnd)->apdu_frame), frame_len, 1000)) < 0)    return res;  if ((res = acr122_usb_bulk_read(DRIVER_DATA(pnd), out, out_size, 1000)) < 0)    return res;  return res;}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:13,


示例11: acr122_usb_ack

intacr122_usb_ack(nfc_device *pnd){  (void) pnd;  int res = 0;  uint8_t acr122_ack_frame[] = { GetFirmwareVersion }; // We can't send a PN532's ACK frame, so we use a normal command to cancel current command  log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "ACR122 Abort");  if ((res = acr122_build_frame_from_tama(pnd, acr122_ack_frame, sizeof(acr122_ack_frame))) < 0)    return res;  if ((res = acr122_usb_bulk_write(DRIVER_DATA(pnd), (unsigned char *) & (DRIVER_DATA(pnd)->tama_frame), res, 1000)) < 0)    return res;  uint8_t  abtRxBuf[255 + sizeof(struct ccid_header)];  res = acr122_usb_bulk_read(DRIVER_DATA(pnd), abtRxBuf, sizeof(abtRxBuf), 1000);  return res;}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:15,


示例12: arygon_close_step2

static voidarygon_close_step2(nfc_device *pnd){  // Release UART port  uart_close(DRIVER_DATA(pnd)->port);#ifndef WIN32  // Release file descriptors used for abort mecanism  close(DRIVER_DATA(pnd)->iAbortFds[0]);  close(DRIVER_DATA(pnd)->iAbortFds[1]);#endif  pn53x_data_free(pnd);  nfc_device_free(pnd);}
开发者ID:Euphorix,项目名称:libnfc,代码行数:15,


示例13: arygon_abort_command

static intarygon_abort_command(nfc_device *pnd){  if (pnd) {#ifndef WIN32    close(DRIVER_DATA(pnd)->iAbortFds[0]);    if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {      return NFC_ESOFT;    }#else    DRIVER_DATA(pnd)->abort_flag = true;#endif  }  return NFC_SUCCESS;}
开发者ID:Euphorix,项目名称:libnfc,代码行数:15,


示例14: acr122_usb_send

static intacr122_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, const int timeout){  int res;  if ((res = acr122_build_frame_from_tama(pnd, pbtData, szData)) < 0) {    pnd->last_error = NFC_EINVARG;    return pnd->last_error;  }  if ((res = acr122_usb_bulk_write(DRIVER_DATA(pnd), (unsigned char *) & (DRIVER_DATA(pnd)->tama_frame), res, timeout)) < 0) {    pnd->last_error = res;    return pnd->last_error;  }  return NFC_SUCCESS;}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:15,


示例15: arygon_tama_send

static intarygon_tama_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout){  int res = 0;  // Before sending anything, we need to discard from any junk bytes  uart_flush_input(DRIVER_DATA(pnd)->port, false);  uint8_t abtFrame[ARYGON_TX_BUFFER_LEN] = { DEV_ARYGON_PROTOCOL_TAMA, 0x00, 0x00, 0xff };     // Every packet must start with "0x32 0x00 0x00 0xff"  size_t szFrame = 0;  if (szData > PN53x_NORMAL_FRAME__DATA_MAX_LEN) {    // ARYGON Reader with PN532 equipped does not support extended frame (bug in ARYGON firmware?)    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "ARYGON device does not support more than %d bytes as payload (requested: %" PRIdPTR ")", PN53x_NORMAL_FRAME__DATA_MAX_LEN, szData);    pnd->last_error = NFC_EDEVNOTSUPP;    return pnd->last_error;  }  if ((res = pn53x_build_frame(abtFrame + 1, &szFrame, pbtData, szData)) < 0) {    pnd->last_error = res;    return pnd->last_error;  }  if ((res = uart_send(DRIVER_DATA(pnd)->port, abtFrame, szFrame + 1, timeout)) != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to transmit data. (TX)");    pnd->last_error = res;    return pnd->last_error;  }  uint8_t abtRxBuf[PN53x_ACK_FRAME__LEN];  if ((res = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, sizeof(abtRxBuf), 0, timeout)) != 0) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Unable to read ACK");    pnd->last_error = res;    return pnd->last_error;  }  if (pn53x_check_ack_frame(pnd, abtRxBuf, sizeof(abtRxBuf)) == 0) {    // The PN53x is running the sent command  } else if (0 == memcmp(arygon_error_unknown_mode, abtRxBuf, sizeof(abtRxBuf))) {    log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Bad frame format.");    // We have already read 6 bytes and arygon_error_unknown_mode is 10 bytes long    // so we have to read 4 remaining bytes to be synchronized at the next receiving pass.    pnd->last_error = uart_receive(DRIVER_DATA(pnd)->port, abtRxBuf, 4, 0, timeout);    return pnd->last_error;  } else {    return pnd->last_error;  }  return NFC_SUCCESS;}
开发者ID:Euphorix,项目名称:libnfc,代码行数:48,


示例16: pn53x_usb_set_property_bool

intpn53x_usb_set_property_bool (nfc_device *pnd, const nfc_property property, const bool bEnable){  int res = 0;  if ((res = pn53x_set_property_bool (pnd, property, bEnable)) < 0)    return res;  switch (DRIVER_DATA (pnd)->model) {    case ASK_LOGO:      if (NP_ACTIVATE_FIELD == property) {        /* Switch on/off LED2 and Progressive Field GPIO according to ACTIVATE_FIELD option */        log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Switch progressive field %s", bEnable ? "On" : "Off");        if ((res = pn53x_write_register (pnd, PN53X_SFR_P3, _BV(P31) | _BV(P34), bEnable ? _BV (P34) : _BV (P31))) < 0)          return NFC_ECHIP;      }      break;    case SCM_SCL3711:      if (NP_ACTIVATE_FIELD == property) {        // Switch on/off LED according to ACTIVATE_FIELD option        if ((res = pn53x_write_register (pnd, PN53X_SFR_P3, _BV (P32), bEnable ? 0 : _BV (P32))) < 0)          return res;      }      break;    default:      break;  }  return NFC_SUCCESS;}
开发者ID:copacetic,项目名称:tabulator,代码行数:28,


示例17: rc522_uart_close

void rc522_uart_close(nfc_device * pnd) {	rc522_powerdown(pnd);	// Release UART port	uart_close(DRIVER_DATA(pnd)->port);	rc522_data_free(pnd);	nfc_device_free(pnd);}
开发者ID:anon1338,项目名称:libnfc,代码行数:7,


示例18: ne2k_interrupt_handler

void ne2k_interrupt_handler(ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call){	nic_t *nic_data = DRIVER_DATA(dev);	ne2k_interrupt(nic_data, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call));	async_answer_0(iid, EOK);}
开发者ID:pratikmankawde,项目名称:HelenOS_Nano,代码行数:7,


示例19: rc522_uart_upgrade_baud_rate

int rc522_uart_upgrade_baud_rate(struct nfc_device * pnd) {	int ret;	uint32_t userBaudRate = DRIVER_DATA(pnd)->baudrate;	if (userBaudRate == BOOT_BAUD_RATE) {		return NFC_SUCCESS;	}	log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Upgrading baud rate to user-specified %d bps.", userBaudRate);	/*	MODIF !!!	CHK(uart_set_speed(DRIVER_DATA(pnd)->port, userBaudRate));	*/	uart_set_speed(DRIVER_DATA(pnd)->port, userBaudRate);	CHK(rc522_send_baudrate(pnd, userBaudRate));	return NFC_SUCCESS;}
开发者ID:anon1338,项目名称:libnfc,代码行数:17,


示例20: pn53x_usb_send

static intpn53x_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, const int timeout){  uint8_t  abtFrame[PN53X_USB_BUFFER_LEN] = { 0x00, 0x00, 0xff };  // Every packet must start with "00 00 ff"  size_t szFrame = 0;  int res = 0;  if ((res = pn53x_build_frame(abtFrame, &szFrame, pbtData, szData)) < 0) {    pnd->last_error = res;    return pnd->last_error;  }  if ((res = pn53x_usb_bulk_write(DRIVER_DATA(pnd), abtFrame, szFrame, timeout)) < 0) {    pnd->last_error = res;    return pnd->last_error;  }  uint8_t abtRxBuf[PN53X_USB_BUFFER_LEN];  if ((res = pn53x_usb_bulk_read(DRIVER_DATA(pnd), abtRxBuf, sizeof(abtRxBuf), timeout)) < 0) {    // try to interrupt current device state    pn53x_usb_ack(pnd);    pnd->last_error = res;    return pnd->last_error;  }  if (pn53x_check_ack_frame(pnd, abtRxBuf, res) == 0) {    // The PN53x is running the sent command  } else {    // For some reasons (eg. send another command while a previous one is    // running), the PN533 sometimes directly replies the response packet    // instead of ACK frame, so we send a NACK frame to force PN533 to resend    // response packet. With this hack, the nextly executed function (ie.    // pn53x_usb_receive()) will be able to retreive the correct response    // packet.    // FIXME Sony reader is also affected by this bug but NACK is not supported    if ((res = pn53x_usb_bulk_write(DRIVER_DATA(pnd), (uint8_t *)pn53x_nack_frame, sizeof(pn53x_nack_frame), timeout)) < 0) {      pnd->last_error = res;      // try to interrupt current device state      pn53x_usb_ack(pnd);      return pnd->last_error;    }  }  return NFC_SUCCESS;}
开发者ID:IndisBuilding,项目名称:indisbuilding,代码行数:45,


示例21: acr122_close

voidacr122_close (nfc_device *pnd){  SCardDisconnect (DRIVER_DATA (pnd)->hCard, SCARD_LEAVE_CARD);  acr122_free_scardcontext ();  pn53x_data_free (pnd);  nfc_device_free (pnd);}
开发者ID:copacetic,项目名称:tabulator,代码行数:9,


示例22: pn532_uart_wakeup

intpn532_uart_wakeup(nfc_device *pnd){  /* High Speed Unit (HSU) wake up consist to send 0x55 and wait a "long" delay for PN532 being wakeup. */  const uint8_t pn532_wakeup_preamble[] = { 0x55, 0x55, 0x00, 0x00, 0x00 };  int res = uart_send(DRIVER_DATA(pnd)->port, pn532_wakeup_preamble, sizeof(pn532_wakeup_preamble), 0);  CHIP_DATA(pnd)->power_mode = NORMAL; // PN532 should now be awake  return res;}
开发者ID:bobylive,项目名称:libnfc,代码行数:9,


示例23: rc522_uart_reset_baud_rate

int rc522_uart_reset_baud_rate(struct nfc_device * pnd) {	log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Restoring baud rate to default of %d bps.", BOOT_BAUD_RATE);	/*	MODIF !!!	return uart_set_speed(DRIVER_DATA(pnd)->port, BOOT_BAUD_RATE);	*/	uart_set_speed(DRIVER_DATA(pnd)->port, BOOT_BAUD_RATE);	return 0;}
开发者ID:anon1338,项目名称:libnfc,代码行数:9,


示例24: pn532_uart_ack

intpn532_uart_ack(nfc_device *pnd){  int res = 0;  if (POWERDOWN == CHIP_DATA(pnd)->power_mode) {    if ((res = pn532_uart_wakeup(pnd)) < 0) {      return res;    }  }  return (uart_send(DRIVER_DATA(pnd)->port, pn53x_ack_frame, sizeof(pn53x_ack_frame),  0));}
开发者ID:bobylive,项目名称:libnfc,代码行数:11,


示例25: arygon_abort

static intarygon_abort(nfc_device *pnd){  // Send a valid TAMA packet to wakup the PN53x (we will not have an answer, according to Arygon manual)  uint8_t dummy[] = { 0x32, 0x00, 0x00, 0xff, 0x09, 0xf7, 0xd4, 0x00, 0x00, 0x6c, 0x69, 0x62, 0x6e, 0x66, 0x63, 0xbe, 0x00 };  uart_send(DRIVER_DATA(pnd)->port, dummy, sizeof(dummy), 0);  // Using Arygon device we can't send ACK frame to abort the running command  return pn53x_check_communication(pnd);}
开发者ID:Euphorix,项目名称:libnfc,代码行数:11,


示例26: acr122_firmware

char   *acr122_firmware (nfc_device *pnd){  uint8_t  abtGetFw[5] = { 0xFF, 0x00, 0x48, 0x00, 0x00 };  uint32_t uiResult;  static char abtFw[11];  DWORD dwFwLen = sizeof (abtFw);  memset (abtFw, 0x00, sizeof (abtFw));  if (DRIVER_DATA (pnd)->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED) {    uiResult = SCardControl (DRIVER_DATA (pnd)->hCard, IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, abtGetFw, sizeof (abtGetFw), (uint8_t *) abtFw, dwFwLen-1, &dwFwLen);  } else {    uiResult = SCardTransmit (DRIVER_DATA (pnd)->hCard, &(DRIVER_DATA (pnd)->ioCard), abtGetFw, sizeof (abtGetFw), NULL, (uint8_t *) abtFw, &dwFwLen);  }  if (uiResult != SCARD_S_SUCCESS) {    log_put (LOG_CATEGORY, NFC_PRIORITY_ERROR, "No ACR122 firmware received, Error: %08x", uiResult);  }  return abtFw;}
开发者ID:copacetic,项目名称:tabulator,代码行数:21,


示例27: rc522_uart_write

int rc522_uart_write(struct nfc_device * pnd, uint8_t reg, const uint8_t * data, size_t size) {	uint8_t cmd = rc522_uart_pack(reg, WRITE);	int ret;	while (size > 0) {		// First: send write request		if ((ret = uart_send(DRIVER_DATA(pnd)->port, &cmd, 1, IO_TIMEOUT)) < 0) {			goto error;		}		// Second: wait for a reply		uint8_t reply;		if ((ret = uart_receive(DRIVER_DATA(pnd)->port, &reply, 1, NULL, IO_TIMEOUT)) < 0) {			return ret;		}		// Third: compare sent and received. They must match.		if (cmd != reply) {			log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "rc522_uart_write ack does not match (sent %02X, received %02X)", cmd, reply);			ret = NFC_ECHIP;			goto error;		}		// Fourth: send register data		if ((ret = uart_send(DRIVER_DATA(pnd)->port, data, 1, IO_TIMEOUT)) < 0) {			goto error;		}		size--;		data++;	}	return NFC_SUCCESS;error:	uart_flush_input(DRIVER_DATA(pnd)->port, true);	return ret;}
开发者ID:anon1338,项目名称:libnfc,代码行数:38,


示例28: rc522_uart_read

int rc522_uart_read(struct nfc_device * pnd, uint8_t reg, uint8_t * data, size_t size) {	uint8_t cmd = rc522_uart_pack(reg, READ);	int ret;	while (size > 0) {		if ((ret = uart_send(DRIVER_DATA(pnd)->port, &cmd, 1, IO_TIMEOUT)) < 0) {			goto error;		}		if ((ret = uart_receive(DRIVER_DATA(pnd)->port, data, 1, NULL, IO_TIMEOUT)) < 0) {			goto error;		}		size--;		data++;	}	return NFC_SUCCESS;error:	uart_flush_input(DRIVER_DATA(pnd)->port, true);	return ret;}
开发者ID:anon1338,项目名称:libnfc,代码行数:23,


示例29: ne2k_set_address

static int ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address){	nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun));	int rc = nic_report_address(nic_data, address);	if (rc != EOK) {		return EINVAL;	}	/* Note: some frame with previous physical address may slip to NIL here	 * (for a moment the filtering is not exact), but ethernet should be OK with	 * that. Some frames may also be lost, but this is not a problem.	 */	ne2k_set_physical_address((ne2k_t *) nic_get_specific(nic_data), address);	return EOK;}
开发者ID:pratikmankawde,项目名称:HelenOS_Nano,代码行数:14,


示例30: acr122_build_frame_from_apdu

static intacr122_build_frame_from_apdu(nfc_device *pnd, const uint8_t ins, const uint8_t p1, const uint8_t p2, const uint8_t *data, const size_t data_len, const uint8_t le){  if (data_len > sizeof(DRIVER_DATA(pnd)->apdu_frame.apdu_payload))    return NFC_EINVARG;  if ((data == NULL) && (data_len != 0))    return NFC_EINVARG;  DRIVER_DATA(pnd)->apdu_frame.ccid_header.dwLength = htole32(data_len + sizeof(struct apdu_header));  DRIVER_DATA(pnd)->apdu_frame.apdu_header.bIns = ins;  DRIVER_DATA(pnd)->apdu_frame.apdu_header.bP1 = p1;  DRIVER_DATA(pnd)->apdu_frame.apdu_header.bP2 = p2;  if (data) {    // bLen is Lc when data != NULL    DRIVER_DATA(pnd)->apdu_frame.apdu_header.bLen = data_len;    memcpy(DRIVER_DATA(pnd)->apdu_frame.apdu_payload, data, data_len);  } else {    // bLen is Le when no data.    DRIVER_DATA(pnd)->apdu_frame.apdu_header.bLen = le;  }  return (sizeof(struct ccid_header) + sizeof(struct apdu_header) + data_len);}
开发者ID:h4ck3rm1k3,项目名称:php5-nfc,代码行数:22,



注:本文中的DRIVER_DATA函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DRIVER_INIT_CALL函数代码示例
C++ DRD_函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。