chips/pn53x: drivers now uses pn53x_data_new() and pn53x_data_free() to handle strcut pn53x_data allocation, initialization and freeing.

This commit is contained in:
Romuald Conty
2011-05-25 10:25:17 +00:00
parent c45d4e685a
commit 22e25a8b1e
8 changed files with 22 additions and 8 deletions
+1
View File
@@ -245,6 +245,7 @@ acr122_disconnect (nfc_device_t * pnd)
SCardDisconnect (DRIVER_DATA (pnd)->hCard, SCARD_LEAVE_CARD);
acr122_free_scardcontext ();
pn53x_data_free (pnd);
nfc_device_free (pnd);
}
+6 -3
View File
@@ -175,11 +175,13 @@ arygon_connect (const nfc_device_desc_t * pndd)
pnd->driver_data = malloc(sizeof(struct arygon_data));
DRIVER_DATA (pnd)->port = sp;
pnd->chip_data = malloc(sizeof(struct pn53x_data));
// Alloc and init chip's data
pn53x_data_new (pnd, &arygon_tama_io);
// The PN53x chip connected to ARYGON MCU doesn't seems to be in SLEEP mode
// The PN53x chip connected to ARYGON MCU doesn't seems to be in LowVBat mode
CHIP_DATA (pnd)->power_mode = NORMAL;
CHIP_DATA (pnd)->io = &arygon_tama_io;
// empirical tuning
CHIP_DATA (pnd)->timer_correction = 46;
pnd->driver = &arygon_driver;
@@ -220,6 +222,7 @@ arygon_disconnect (nfc_device_t * pnd)
close (DRIVER_DATA (pnd)->iAbortFds[1]);
#endif
pn53x_data_free(pnd);
nfc_device_free (pnd);
}
+4 -3
View File
@@ -163,10 +163,11 @@ pn532_uart_connect (const nfc_device_desc_t * pndd)
pnd->driver_data = malloc(sizeof(struct pn532_uart_data));
DRIVER_DATA(pnd)->port = sp;
pnd->chip_data = malloc(sizeof(struct pn53x_data));
CHIP_DATA(pnd)->type = PN532;
// Alloc and init chip's data
pn53x_data_new (pnd, &pn532_uart_io);
// This device starts in LowVBat mode
CHIP_DATA(pnd)->power_mode = LOWVBAT;
CHIP_DATA(pnd)->io = &pn532_uart_io;
// empirical tuning
CHIP_DATA(pnd)->timer_correction = 48;
pnd->driver = &pn532_uart_driver;
+1
View File
@@ -365,6 +365,7 @@ pn53x_usb_disconnect (nfc_device_t * pnd)
if ((res = usb_close (DRIVER_DATA (pnd)->pudh)) < 0) {
ERR ("usb_close failed (%i)", res);
}
pn53x_data_free (pnd);
nfc_device_free (pnd);
}