bdk: fuse: add sense function

This commit is contained in:
CTCaer
2025-11-11 13:28:44 +02:00
parent 602945d918
commit 260e28e628
2 changed files with 22 additions and 0 deletions

View File

@@ -22,6 +22,7 @@
#include <mem/heap.h>
#include <sec/se.h>
#include <sec/se_t210.h>
#include <soc/clock.h>
#include <soc/fuse.h>
#include <soc/hw_init.h>
#include <soc/pmc.h>
@@ -173,6 +174,25 @@ void fuse_wait_idle()
;
}
void fuse_sense()
{
clock_enable_fuse(false);
FUSE(FUSE_CTRL) = (FUSE(FUSE_CTRL) & (~FUSE_CMD_MASK)) | FUSE_SENSE;
usleep(1);
fuse_wait_idle();
FUSE(FUSE_PRIV2INTFC) = FUSE_PRIV2INTFC_SKIP_RECORDS | FUSE_PRIV2INTFC_START_DATA;
usleep(1);
while (!(FUSE(FUSE_CTRL) & BIT(30)) || ((FUSE(FUSE_CTRL) >> 16) & 0x1F) != FUSE_STATUS_IDLE)
;
clock_enable_fuse(true);
}
u32 fuse_read(u32 addr)
{
FUSE(FUSE_ADDR) = addr;