@@ -2458,12 +2458,14 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)
24582458
24592459// Read command functions
24602460
2461+ #if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS )
24612462/** \brief Executes Read command, which reads either 4 or 32 bytes of data from
24622463 * a given slot, configuration zone, or the OTP zone.
24632464 *
24642465 * When reading a slot or OTP, data zone must be locked and the slot
24652466 * configuration must not be secret for a slot to be successfully read.
24662467 *
2468+ * \param[in] device Device context
24672469 * \param[in] zone Zone to be read from device. Options are
24682470 * ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
24692471 * \param[in] slot Slot number for data zone and ignored for other zones.
@@ -2475,16 +2477,15 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)
24752477 *
24762478 * returns ATCA_SUCCESS on success, otherwise an error code.
24772479 */
2478- #if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS )
2479- ATCA_STATUS atcab_read_zone (uint8_t zone , uint16_t slot , uint8_t block , uint8_t offset , uint8_t * data , uint8_t len )
2480+ ATCA_STATUS atcab_read_zone_ext (ATCADevice device , uint8_t zone , uint16_t slot , uint8_t block , uint8_t offset , uint8_t * data , uint8_t len )
24802481{
24812482 ATCA_STATUS status = ATCA_UNIMPLEMENTED ;
2482- ATCADeviceType dev_type = atcab_get_device_type ( );
2483+ ATCADeviceType dev_type = atcab_get_device_type_ext ( device );
24832484
24842485 if (atcab_is_ca_device (dev_type ) || atcab_is_ca2_device (dev_type ))
24852486 {
24862487#if ATCA_CA_SUPPORT
2487- status = calib_read_zone_ext (g_atcab_device_ptr , zone , slot , block , offset , data , len );
2488+ status = calib_read_zone_ext (device , zone , slot , block , offset , data , len );
24882489#endif
24892490 }
24902491 else if (atcab_is_ta_device (dev_type ))
@@ -2497,6 +2498,28 @@ ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t
24972498 }
24982499 return status ;
24992500}
2501+
2502+ /** \brief Executes Read command, which reads either 4 or 32 bytes of data from
2503+ * a given slot, configuration zone, or the OTP zone.
2504+ *
2505+ * When reading a slot or OTP, data zone must be locked and the slot
2506+ * configuration must not be secret for a slot to be successfully read.
2507+ *
2508+ * \param[in] zone Zone to be read from device. Options are
2509+ * ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
2510+ * \param[in] slot Slot number for data zone and ignored for other zones.
2511+ * \param[in] block 32 byte block index within the zone.
2512+ * \param[in] offset 4 byte work index within the block. Ignored for 32 byte
2513+ * reads.
2514+ * \param[out] data Read data is returned here.
2515+ * \param[in] len Length of the data to be read. Must be either 4 or 32.
2516+ *
2517+ * returns ATCA_SUCCESS on success, otherwise an error code.
2518+ */
2519+ ATCA_STATUS atcab_read_zone (uint8_t zone , uint16_t slot , uint8_t block , uint8_t offset , uint8_t * data , uint8_t len )
2520+ {
2521+ return atcab_read_zone_ext (atcab_get_device (), zone , slot , block , offset , data , len );
2522+ }
25002523#endif /* ATCAB_READ_EN */
25012524
25022525#ifdef ATCA_USE_ATCAB_FUNCTIONS
0 commit comments