TT-System-Firmware APIs 19.13.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
bh_efuse.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Tenstorrent AI ULC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_MISC_BH_EFUSE_H_
8#define ZEPHYR_INCLUDE_DRIVERS_MISC_BH_EFUSE_H_
9
10#include <errno.h>
11#include <stdint.h>
12
13#include <zephyr/device.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
25
30
31__subsystem struct tt_efuse_driver_api {
32 int (*read)(const struct device *dev, enum tt_bh_efuse_access_type acc_type,
33 enum tt_bh_efuse_box_id box_id, uint32_t offset, uint32_t *value);
34};
35
36static inline int tt_bh_efuse_read(const struct device *dev, enum tt_bh_efuse_access_type acc_type,
37 enum tt_bh_efuse_box_id box_id, uint32_t offset, uint32_t *value)
38{
39 if (value == NULL) {
40 return -EINVAL;
41 }
42
43 if (dev == NULL || !device_is_ready(dev)) {
44 return -ENODEV;
45 }
46
47 const struct tt_efuse_driver_api *api = DEVICE_API_GET(tt_efuse, dev);
48
49 if (api == NULL || api->read == NULL) {
50 return -ENOSYS;
51 }
52
53 return api->read(dev, acc_type, box_id, offset, value);
54}
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif /* ZEPHYR_INCLUDE_DRIVERS_MISC_BH_EFUSE_H_ */
#define NULL
Definition avs.c:45
tt_bh_efuse_access_type
Definition bh_efuse.h:26
@ TT_BH_EFUSE_ACCESS_INDIRECT
Definition bh_efuse.h:27
@ TT_BH_EFUSE_ACCESS_DIRECT
Definition bh_efuse.h:28
tt_bh_efuse_box_id
Definition bh_efuse.h:19
@ TT_BH_EFUSE_BOX_ID_NUM
Definition bh_efuse.h:23
@ TT_BH_EFUSE_BOX_DFT0
Definition bh_efuse.h:20
@ TT_BH_EFUSE_BOX_FUNC
Definition bh_efuse.h:22
@ TT_BH_EFUSE_BOX_DFT1
Definition bh_efuse.h:21
static int tt_bh_efuse_read(const struct device *dev, enum tt_bh_efuse_access_type acc_type, enum tt_bh_efuse_box_id box_id, uint32_t offset, uint32_t *value)
Definition bh_efuse.h:36
#define DEVICE_API_GET(_class, _dev)
bool device_is_ready(const struct device *dev)
#define EINVAL
#define ENOSYS
#define ENODEV
__UINT32_TYPE__ uint32_t
Definition bh_efuse.h:31
int(* read)(const struct device *dev, enum tt_bh_efuse_access_type acc_type, enum tt_bh_efuse_box_id box_id, uint32_t offset, uint32_t *value)
Definition bh_efuse.h:32