LPC18xx/43xx OTP Controller driver

/*
* @brief LPC18xx/43xx OTP Controller driver
*
* @note
* Copyright(C) NXP Semiconductors, 2012
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/ #include "chip.h" /*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/ #define BOOTROM_BASE 0x10400100
#define OTP_API_TABLE_OFFSET 0x1 static unsigned long *BOOTROM_API_TABLE; /*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/ /*****************************************************************************
* Private functions
****************************************************************************/ static uint32_t (*Otp_ProgBootSrc)(CHIP_OTP_BOOT_SRC_T BootSrc);
static uint32_t (*Otp_ProgJTAGDis)(void);
static uint32_t (*Otp_ProgUSBID)(uint32_t ProductID, uint32_t VendorID);
static uint32_t (*Otp_ProgGP0)(uint32_t Data, uint32_t Mask);
static uint32_t (*Otp_ProgGP1)(uint32_t Data, uint32_t Mask);
static uint32_t (*Otp_ProgGP2)(uint32_t Data, uint32_t Mask);
static uint32_t (*Otp_ProgKey1)(uint8_t *key);
static uint32_t (*Otp_ProgKey2)(uint8_t *key);
static uint32_t (*Otp_GenRand)(void); /*****************************************************************************
* Public functions
****************************************************************************/ /* CHIP OTP Initialisation function */
uint32_t Chip_OTP_Init(void)
{
uint32_t (*ROM_otp_Init)(void); BOOTROM_API_TABLE = *((unsigned long * *) BOOTROM_BASE + OTP_API_TABLE_OFFSET); ROM_otp_Init = (uint32_t (*)(void))BOOTROM_API_TABLE[];
Otp_ProgBootSrc = (uint32_t (*)(CHIP_OTP_BOOT_SRC_T BootSrc))BOOTROM_API_TABLE[];
Otp_ProgJTAGDis = (uint32_t (*)(void))BOOTROM_API_TABLE[];
Otp_ProgUSBID = (uint32_t (*)(uint32_t ProductID, uint32_t VendorID))BOOTROM_API_TABLE[];
Otp_ProgGP0 = (uint32_t (*)(uint32_t Data, uint32_t Mask))BOOTROM_API_TABLE[];
Otp_ProgGP1 = (uint32_t (*)(uint32_t Data, uint32_t Mask))BOOTROM_API_TABLE[];
Otp_ProgGP2 = (uint32_t (*)(uint32_t Data, uint32_t Mask))BOOTROM_API_TABLE[];
Otp_ProgKey1 = (uint32_t (*)(uint8_t *key))BOOTROM_API_TABLE[];
Otp_ProgKey2 = (uint32_t (*)(uint8_t *key))BOOTROM_API_TABLE[];
Otp_GenRand = (uint32_t (*)(void))BOOTROM_API_TABLE[]; return ROM_otp_Init();
} /* Program boot source in OTP Controller */
uint32_t Chip_OTP_ProgBootSrc(CHIP_OTP_BOOT_SRC_T BootSrc)
{
return Otp_ProgBootSrc(BootSrc);
} /* Program the JTAG bit in OTP Controller */
uint32_t Chip_OTP_ProgJTAGDis(void)
{
return Otp_ProgJTAGDis();
} /* Program USB ID in OTP Controller */
uint32_t Chip_OTP_ProgUSBID(uint32_t ProductID, uint32_t VendorID)
{
return Otp_ProgUSBID(ProductID, VendorID);
} /* Program OTP GP Word memory */
uint32_t Chip_OTP_ProgGPWord(uint32_t WordNum, uint32_t Data, uint32_t Mask)
{
uint32_t status; switch (WordNum) {
case :
status = Otp_ProgGP1(Data, Mask);
break; case :
status = Otp_ProgGP2(Data, Mask);
break; case :
default:
status = Otp_ProgGP0(Data, Mask);
break;
} return status;
} /* Program AES Key */
uint32_t Chip_OTP_ProgKey(uint32_t KeyNum, uint8_t *key)
{
uint32_t status; if (KeyNum) {
status = Otp_ProgKey2(key);
}
else {
status = Otp_ProgKey1(key);
}
return status;
} /* Generate Random Number using HW Random Number Generator */
uint32_t Chip_OTP_GenRand(void)
{
return Otp_GenRand();
}

LPC18xx/43xx OTP Controller driver的更多相关文章

  1. Linux内核中的GPIO系统之(3):pin controller driver代码分析

    一.前言 对于一个嵌入式软件工程师,我们的软件模块经常和硬件打交道,pin control subsystem也不例外,被它驱动的硬件叫做pin controller(一般ARM soc的datash ...

  2. Linux内核中的GPIO系统之(3):pin controller driver代码分析--devm_kzalloc使用【转】

    转自:http://www.wowotech.net/linux_kenrel/pin-controller-driver.html 一.前言 对于一个嵌入式软件工程师,我们的软件模块经常和硬件打交道 ...

  3. NXP LPC18xx LPC43xx OTP ID Boot

    static LPC_DEVICE_TYPE LPCtypes[] = { { , , , , , , , , , CHIP_VARIANT_NONE }, /* unknown */ // id, ...

  4. LPC18xx/43xx SWD/JTAG Debug Connector

  5. OpenHCI - Open Host Controller Operational Registers

    The Host Controller (HC) contains a set of on-chip operational registers which are mapped into a non ...

  6. Using a USB host controller security extension for controlling changes in and auditing USB topology

    Protecting computer systems from attacks that attempt to change USB topology and for ensuring that t ...

  7. PatentTips - Universal RAID Class Driver

    BACKGROUND OF THE INVENTION The present invention relates to the field of data storage devices. Comp ...

  8. Linux芯片驱动之SPI Controller

    针对一款新的芯片,芯片厂商如何基于Linux编写对应的 SPI controller 驱动? 我们先看看 Linux SPI 的整体框架: 可以看到,最底层是硬件层,对应芯片内部 SPI contro ...

  9. LPC1800 and LPC4300 MCUs

    LPC1800 Series microcontrollers At 180 MHz, LPC1800 Series microcontrollers combine the industry's f ...

随机推荐

  1. CS229 笔记06

    CS229 笔记06 朴素贝叶斯 事件模型 事件模型与普通的朴素贝叶斯算法不同的是,在事件模型中,假设文本词典一共有 \(k\) 个词,训练集一共有 \(m\) 封邮件,第 \(i\) 封邮件的词的个 ...

  2. HDU 1728 逃离迷宫 BFS题

    题目描述:输入一个m*n的地图,地图上有两种点,一种是 . 表示这个点是空地,是可以走的,另一种是 * ,表示是墙,是不能走的,然后输入一个起点和一个终点,另外有一个k输入,现在要你确定能否在转k次弯 ...

  3. 修改input placeholder样式

    <style> /* 通用 */ ::-webkit-input-placeholder { color: rgb(235, 126, 107); } ::-moz-placeholder ...

  4. vue-cli 3.0 开启 Gzip 方法

    vue.config.js const path = require('path') const CompressionWebpackPlugin = require('compression-web ...

  5. keepalived vrrp_script脚本不执行解决办法

    首先打开日志观察: tail -f /var/log/messages 然后新开一个客户端重启keepalived , systemctl restart keepalived.service 看日志 ...

  6. js自定制周期函数

    function mySetInterval(fn, milliSec,count){ function interval(){ if(typeof count==='undefined'||coun ...

  7. .NET C#错误:所生成项目的处理器框架“MSIL”与引用“wdapi_dotnet1021”的处理器架构“AMD64”不匹配

    .NET C#错误:所生成项目的处理器框架“MSIL”与引用“wdapi_dotnet1021”的处理器架构“AMD64”不匹配. 直接在项目右键属性->生成->x64. 即可解决

  8. 浅介HTML DOM

    什么是DOM? DOM是Document Object Model(文档对象模型)的缩写. DOM是W3C(万维网联盟)的标准. DOM定义了访问HTML和XML文档的标准: “W3C文档对象模型(D ...

  9. File /data/binlog/mysql-bin.index' not found (Errcode: 13)

    [问题] 需要开启bin-log备份/恢复数据库,但是因为本身bin-log保存的位置存储太小,并且归类性也不好,所以自己新创建了/data/binlog来保存二进制日志 在/etc/my.cnf增加 ...

  10. 一次“ora-12170 tns 连接超时”的经历

      win7    64位系统 oracle  10g   64位 plsql之前连接是好使的,突然连接不上,提示错误“ora-12170 tns 连接超时” 1.ping IP    没有问题 2. ...