hw/nvram: Implement ESP32-S3 eFuse
Co-authored-by: Omar Chebib <omar.chebib@espressif.com>
This commit is contained in:
committed by
Ivan Grokhotkov
parent
015a0fbc4f
commit
8ab216a956
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* ESP32-S3 eFuse emulation
|
||||
*
|
||||
* Copyright (c) 2024 Espressif Systems (Shanghai) Co. Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/nvram/esp32s3_efuse.h"
|
||||
|
||||
|
||||
static void esp32s3_efuse_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
ESP32S3EfuseClass* esp32s3_class = ESP32S3_EFUSE_GET_CLASS(dev);
|
||||
|
||||
esp32s3_class->parent_realize(dev, errp);
|
||||
}
|
||||
|
||||
|
||||
static void esp32s3_efuse_init(Object *obj)
|
||||
{
|
||||
}
|
||||
|
||||
static void esp32s3_efuse_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
ESP32S3EfuseClass* esp32s3_efuse = ESP32S3_EFUSE_CLASS(klass);
|
||||
|
||||
device_class_set_parent_realize(dc, esp32s3_efuse_realize, &esp32s3_efuse->parent_realize);
|
||||
}
|
||||
|
||||
static const TypeInfo esp32s3_efuse_info = {
|
||||
.name = TYPE_ESP32S3_EFUSE,
|
||||
.parent = TYPE_ESP_EFUSE,
|
||||
.instance_size = sizeof(ESP32S3EfuseState),
|
||||
.instance_init = esp32s3_efuse_init,
|
||||
.class_init = esp32s3_efuse_class_init,
|
||||
.class_size = sizeof(ESP32S3EfuseClass)
|
||||
};
|
||||
|
||||
static void esp32s3_efuse_register_types(void)
|
||||
{
|
||||
type_register_static(&esp32s3_efuse_info);
|
||||
}
|
||||
|
||||
type_init(esp32s3_efuse_register_types)
|
||||
@@ -10,6 +10,7 @@ system_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_otp.c'))
|
||||
system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_nvm.c'))
|
||||
system_ss.add(when: 'CONFIG_XTENSA_ESP32', if_true: files('esp32_efuse.c'))
|
||||
system_ss.add(when: 'CONFIG_RISCV_ESP32C3', if_true: files('esp32c3_efuse.c', 'esp_efuse.c'))
|
||||
system_ss.add(when: 'CONFIG_XTENSA_ESP32S3', if_true: files('esp32s3_efuse.c', 'esp_efuse.c'))
|
||||
system_ss.add(when: 'CONFIG_XLNX_EFUSE_CRC', if_true: files('xlnx-efuse-crc.c'))
|
||||
system_ss.add(when: 'CONFIG_XLNX_EFUSE', if_true: files('xlnx-efuse.c'))
|
||||
system_ss.add(when: 'CONFIG_XLNX_EFUSE_VERSAL', if_true: files(
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* ESP32-S3 eFuse emulation
|
||||
*
|
||||
* Copyright (c) 2023-2024 Espressif Systems (Shanghai) Co. Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "esp_efuse.h"
|
||||
|
||||
#define TYPE_ESP32S3_EFUSE "nvram.esp32s3.efuse"
|
||||
#define ESP32S3_EFUSE(obj) OBJECT_CHECK(ESP32S3EfuseState, (obj), TYPE_ESP32S3_EFUSE)
|
||||
#define ESP32S3_EFUSE_GET_CLASS(obj) OBJECT_GET_CLASS(ESP32S3EfuseClass, obj, TYPE_ESP32S3_EFUSE)
|
||||
#define ESP32S3_EFUSE_CLASS(klass) OBJECT_CLASS_CHECK(ESP32S3EfuseClass, klass, TYPE_ESP32S3_EFUSE)
|
||||
|
||||
|
||||
typedef struct ESP32S3EfuseState {
|
||||
ESPEfuseState parent;
|
||||
} ESP32S3EfuseState;
|
||||
|
||||
|
||||
typedef struct ESP32S3EfuseClass {
|
||||
ESPEfuseClass parent_class;
|
||||
DeviceRealize parent_realize;
|
||||
} ESP32S3EfuseClass;
|
||||
|
||||
Reference in New Issue
Block a user