OTP

[中文]

1 Functional Overview

  • For theoretical background on OTP, see: OTP Driver

Note

  • By default, OTP is enabled on the CP side, but not on the AP side. If users need to use OTP on AP, they must manually enable OTP configuration.

2 Code Paths

  • Demo path:
    ap\components\bk_cli\cli_otp.c
  • Driver source path:
    ap\middleware\driver\otp\otp_driver_v1_1.c

Note

  • otp_driver_v1_1.c: OTP driver implementation

  • cli_otp.c: OTP feature test command implementation

3 Key OTP Data Structures

typedef enum{
    OTP_READ_WRITE = 0,
    OTP_READ_ONLY,
    OTP_NO_ACCESS,
} otp_privilege_t;

typedef enum{
    OTP_BUSY = 0x1,
    OTP_ERROR = 0x2,
    OTP_WARNING = 0x4,
    OTP_WRONG = 0x8,
    OTP_FORBID = 0x10,
} otp_status_t;

Description: - OTP permissions include: Read/Write, Read-Only, No Access, corresponding to command parameters 0/1/2.

  • OTP status information includes: Busy, Error, Warning, Wrong, Forbidden, corresponding to parameters 1/2/4/8/16.

4 CLI Command Overview

Demo macro configuration dependencies:

NAME

Description

File

Value

CONFIG_OTP_V1

Enable OTP

ap\middleware\soc\bk7236\bk7236.defconfig

n

CONFIG_OTP_TEST

Enable OTP test command

ap\middleware\soc\bk7236\bk7236.defconfig

n

Supported CLI Commands:

Command

Param

Description

otp_apb self_test

none

self-test of OTP function in ATE mode

otp_apb read_permission [item_id]

item_id: item id

Check the read permission in the OTP1 area

otp_apb write_permission [item_id][permission]

item_id: item id

Update the write permissions

in the OTP1 section

permission: RW/RO/NA

otp_apb read [item_id][size]

item_id: item id

Read the data content in the

OTP1 area

size: size of each item

otp_apb write [item_id][size][data]

item_id: item id

Update the data content in the

OTP1 area

size: size of each item

data: need write data

otp_ahb self_test

none

self-test of OTP function in ATE mode

otp_ahb read_permission [item_id]

item_id: item id

Check the read permission in the OTP2 area

otp_ahb write_permission [item_id][permission]

item_id: item id

Update the write permissions

in the OTP1 section

permission: RW/RO/NA

otp_ahb read [item_id][size]

item_id: item id

Read the data content in the

OTP1 area

size: size of each item

otp_ahb write [item_id][size][data]

item_id: item id

Update the data content in the

OTP1 area

size: size of each item

data: need write data