Adds a common E-Fuse driver to be used by Espressif Xtensa devices. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
142 lines
4.2 KiB
C
142 lines
4.2 KiB
C
/****************************************************************************
|
|
* arch/xtensa/src/common/espressif/esp_efuse.h
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership. The
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __ARCH_XTENSA_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H
|
|
#define __ARCH_XTENSA_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H
|
|
|
|
/****************************************************************************
|
|
* Included Files
|
|
****************************************************************************/
|
|
|
|
#include <nuttx/efuse/efuse.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#undef EXTERN
|
|
#if defined(__cplusplus)
|
|
#define EXTERN extern "C"
|
|
extern "C"
|
|
{
|
|
#else
|
|
#define EXTERN extern
|
|
#endif
|
|
|
|
/****************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
#define ESP_EFUSE_BLK_LEN 256
|
|
|
|
/****************************************************************************
|
|
* Public Types
|
|
****************************************************************************/
|
|
|
|
/* E-Fuse block and bit definitions can be found on the Technical Reference
|
|
* Manual or on the ESP-IDF documentation.
|
|
*/
|
|
|
|
#ifdef CONFIG_ARCH_CHIP_ESP32
|
|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if
|
|
|
|
/****************************************************************************
|
|
* Public Functions Prototypes
|
|
****************************************************************************/
|
|
|
|
/****************************************************************************
|
|
* Name: esp_efuse_initialize
|
|
*
|
|
* Description:
|
|
* Initialize the efuse driver. The efuse is initialized
|
|
* and registered as 'devpath'
|
|
*
|
|
* Input Parameters:
|
|
* devpath - The full path to the efuse device.
|
|
* This should be of the form /dev/efuse
|
|
*
|
|
* Returned Value:
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
*
|
|
****************************************************************************/
|
|
|
|
int esp_efuse_initialize(const char *devpath);
|
|
|
|
#undef EXTERN
|
|
#if defined(__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
#endif /* __ARCH_XTENSA_SRC_COMMON_ESPRESSIF_ESP_EFUSE_H */
|