mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Moving EF_VP to more generic EF_PHY, which stores PHY aspects from the chip.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -41,6 +41,9 @@ extern uint8_t flash_read_uint8(uintptr_t addr);
|
|||||||
extern uint8_t *flash_read(uintptr_t addr);
|
extern uint8_t *flash_read(uintptr_t addr);
|
||||||
extern void low_flash_available();
|
extern void low_flash_available();
|
||||||
|
|
||||||
|
file_t sef_phy = {.fid = EF_PHY, .parent = 5, .name = NULL, .type = FILE_TYPE_INTERNAL_EF | FILE_DATA_FLASH | FILE_PERSISTENT, .data = NULL, .ef_structure = FILE_EF_TRANSPARENT, .acl = {0xff}};
|
||||||
|
file_t *ef_phy = &sef_phy;
|
||||||
|
|
||||||
//puts FCI in the RAPDU
|
//puts FCI in the RAPDU
|
||||||
void process_fci(const file_t *pe, int fmd) {
|
void process_fci(const file_t *pe, int fmd) {
|
||||||
res_APDU_size = 0;
|
res_APDU_size = 0;
|
||||||
@@ -265,8 +268,6 @@ void scan_region(bool persistent) {
|
|||||||
void wait_flash_finish();
|
void wait_flash_finish();
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
extern uint16_t usb_vid, usb_pid;
|
extern uint16_t usb_vid, usb_pid;
|
||||||
file_t sef_vp = {.fid = EF_VP, .parent = 5, .name = NULL, .type = FILE_TYPE_INTERNAL_EF | FILE_DATA_FLASH | FILE_PERSISTENT, .data = NULL, .ef_structure = FILE_EF_TRANSPARENT, .acl = {0xff}};
|
|
||||||
file_t *ef_vp = &sef_vp;
|
|
||||||
#endif
|
#endif
|
||||||
void scan_flash() {
|
void scan_flash() {
|
||||||
initialize_flash(false); //soft initialization
|
initialize_flash(false); //soft initialization
|
||||||
@@ -284,10 +285,10 @@ void scan_flash() {
|
|||||||
scan_region(true);
|
scan_region(true);
|
||||||
scan_region(false);
|
scan_region(false);
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
if (file_has_data(ef_vp) && file_get_size(ef_vp) >= 4) {
|
if (file_has_data(ef_phy) && file_get_size(ef_phy) >= 4) {
|
||||||
uint8_t *data = file_get_data(ef_vp);
|
uint8_t *data = file_get_data(ef_phy);
|
||||||
usb_vid = (data[0] << 8) | data[1];
|
usb_vid = (data[PHY_VID] << 8) | data[PHY_VID+1];
|
||||||
usb_pid = (data[2] << 8) | data[3];
|
usb_pid = (data[PHY_PID] << 8) | data[PHY_PID+1];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,9 +67,11 @@
|
|||||||
#define EF_SKDFS 0x6045
|
#define EF_SKDFS 0x6045
|
||||||
#define EF_META 0xE010
|
#define EF_META 0xE010
|
||||||
|
|
||||||
#ifndef ENABLE_EMULATION
|
#define EF_PHY 0xE020
|
||||||
#define EF_VP 0xE020
|
|
||||||
#endif
|
#define PHY_VID 0x0
|
||||||
|
#define PHY_PID 0x2
|
||||||
|
#define PHY_LED_GPIO 0x4
|
||||||
|
|
||||||
#define MAX_DEPTH 4
|
#define MAX_DEPTH 4
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@ extern int meta_add(uint16_t fid, const uint8_t *data, uint16_t len);
|
|||||||
extern int delete_file(file_t *ef);
|
extern int delete_file(file_t *ef);
|
||||||
|
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
extern file_t *ef_vp;
|
extern file_t *ef_phy;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _FILE_H_
|
#endif // _FILE_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user