00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is confidential property of Nordic 00004 * Semiconductor ASA.Terms and conditions of usage are described in detail 00005 * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRENTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 * $LastChangedRevision: 133 $ 00012 */ 00013 00019 #include "nrf24le1.h" 00020 #include <gzp.h> 00021 #include "hal_rng.h" 00022 #include "hal_flash.h" 00023 #include "memdefs.h" 00024 00025 __no_init xdata uint8_t gzp_session_token[GZP_SESSION_TOKEN_LENGTH]; 00026 __no_init xdata uint8_t gzp_dyn_key[GZP_DYN_KEY_LENGTH]; 00027 00028 void gzp_host_chip_id_read(uint8_t *dst, uint8_t n) 00029 { 00030 uint8_t i; 00031 00032 if(hal_flash_byte_read(GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1) == 0xff) 00033 { 00034 hal_flash_byte_write((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 1), 0x00); 00035 hal_rng_power_up(true); 00036 for(i = 0; i < n; i++) 00037 { 00038 while(!hal_rng_data_ready()) 00039 ; 00040 hal_flash_byte_write((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i), hal_rng_read()); 00041 } 00042 hal_rng_power_up(false); 00043 } 00044 00045 for(i = 0; i < n; i++) 00046 { 00047 *(dst++) = hal_flash_byte_read((GZP_PARAMS_STORAGE_ADR + GZP_HOST_ID_LENGTH + 2 + i)); 00048 } 00049 }