1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #include "nrf_gzp.h"
- #include "nrf_nvmc.h"
- void gzp_host_chip_id_read(uint8_t *dst, uint8_t n)
- {
- uint8_t i;
- uint8_t random_number;
- if ( *((uint8_t*)(GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1)) == 0xff)
- {
- nrf_nvmc_write_byte((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1) , 0x00);
- for (i = 0; i < n; i++)
- {
- gzp_random_numbers_generate(&random_number, 1);
- nrf_nvmc_write_byte((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i) , random_number);
- }
- }
- for (i = 0; i < n; i++)
- {
- *(dst++) = *((uint8_t*)(GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i));
- }
- }
|