acassis commented on a change in pull request #2628:
URL: https://github.com/apache/incubator-nuttx/pull/2628#discussion_r551313793



##########
File path: include/nuttx/efuse/efuse.h
##########
@@ -0,0 +1,294 @@
+/****************************************************************************
+ * include/nuttx/efuse/efuse.h
+ *
+ * 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 __INCLUDE_NUTTX_EFUSE_EFUSE_H
+#define __INCLUDE_NUTTX_EFUSE_EFUSE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/fs/ioctl.h>
+
+#include <signal.h>
+#include <stdint.h>
+
+#ifdef CONFIG_EFUSE
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Command:     EFUSEIOC_READ_FIELD_BLOB
+ * Description: Read a blob of bits from an efuse field.
+ * Arguments:   A structure containing the field[], a dst pointer, and size
+ *              of bits to be read from efuses.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_READ_FIELD_BLOB      _EFUSEIOC(0x0001)
+
+/* Command:     EFUSEIOC_READ_FIELD_BIT
+ * Description: Read of state of an efuse bit.
+ * Arguments:   A structure containing the field to be read.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_READ_FIELD_BIT       _EFUSEIOC(0x0002)
+
+/* Command:     EFUSEIOC_WRITE_FIELD_BLOB
+ * Description: Write a blob of bits to an efuse's field
+ * Arguments:   A structure containing the field[], the src memory and the
+ *              amount of bits to write.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_WRITE_FIELD_BLOB     _EFUSEIOC(0x0003)
+
+/* Command:     EFUSEIOC_WRITE_FIELD_BIT
+ * Description: Write a bit to an efuse (burn it).
+ * Arguments:   A structure containing bit field.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_WRITE_FIELD_BIT      _EFUSEIOC(0x0004)
+
+/* Command:     EFUSEIOC_GET_FIELD_SIZE
+ * Description: Get the length of the field in bits.
+ * Arguments:   A structure containing the fields.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_GET_FIELD_SIZE       _EFUSEIOC(0x0005)
+
+/* Command:     EFUSEIOC_READ_REG
+ * Description: Read an efuse register.
+ * Arguments:   A structure containing the block number and the register to
+ *              be read.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_READ_REG             _EFUSEIOC(0x0006)
+
+/* Command:     EFUSEIOC_WRITE_REG
+ * Description: Write an efuse register.
+ * Arguments:   A structure containing the block number, the register to
+ *              write and value to be written.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_WRITE_REG            _EFUSEIOC(0x0007)
+
+/* Command:     EFUSEIOC_READ_BLOCK
+ * Description: Read a key from efuse's block.
+ * Arguments:   A structure containing the block number, the dst_key pointer,
+ *              the offset in bits and the amount of bits to read.
+ * Return:      Zero (OK) on success.  Minus one will be returned on failure
+ *              with the errno value set appropriately.
+ */
+
+#define EFUSEIOC_READ_BLOCK           _EFUSEIOC(0x0008)

Review comment:
       Hi @xiaoxiang781216 read/write a field bit will work with fields of a 
single bit (a single fuse itself), the operation over reg will take care of 32 
fuses just like a ordinary 32-bit register and finally block is an arbitrary 
size of fuse. This driver was based on existing Espressif eFuse driver, but I 
agree with you, we could come up with a single operation that will ignore these 
differences.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to