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. shell 检测安装包

    检测 wget 是否存在 rpm -q wget >/dev/null ];then echo "install wget,Please wait..." yum -y in ...

  2. FPGA学习笔记. DDS

    DDS原理 直接数字式频率合成器(Direct Digital Synthesizer) 频率计算公式 Fout = FW * Fclk / 2^N Fout 输出频率, Fw 频率控制字, N 位数 ...

  3. 【Windows编程】大量病毒分析报告辅助工具编写

    解决重复劳动 是否在分析单个病毒时很爽,分析N个病毒写报告很机械的情况.. 1)样本下载多个文件,这些文件写报告时要加上这些文件的MD5 2)写报告时明明是17个MD5,实际样本有18个的情况.不知道 ...

  4. 基于 Apache 在本地配置多个虚拟主机

    如何使用 Apache 在本地配置出多个虚拟主机呢?而且使用不同的“域名”来访问本地不同的站点呢? 一般情况下,咱们都使用 localhost 来访问本机上的服务器,在我们的 C:/WINDOWS/s ...

  5. ***实用函数:PHP explode()函数用法、切分字符串,作用,将字符串打散成数组

    下面是根据explode()函数写的切分分割字符串的php函数,主要php按开始和结束截取中间数据,很实用 代码如下: <? // ### 切分字符串 #### function jb51net ...

  6. Redux架构

    深入Redux架构   阅读目录 关于redux API 中间件与异步操作 异步操作的基本思路 React-Redux的用法 回到顶部 关于redux 之前写了一篇通过一个demo了解Redux,但对 ...

  7. zookeeper命令行客户端

    前提条件:搭建好zookeeper服务器集群<Zookeeper深入认识>,并且集群成功开启. 执行zkServer.sh,客户端连接上服务器hadoop1. 都有哪些命令行操作呢?(见下 ...

  8. 007 jquery过滤选择器-----------(屬性过滤选择器)

    1.介紹 2.程序 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...

  9. springboot工程pom的两种配置方式

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  10. Vue.js学以致用之遇到的那些坑

    前段时间的react授权许可的闹剧告诉大家一个问题,只有自己的东西用着才放心.各大巨头也逐渐明白使用自家东西的优势.本来vue的生态就愈加火热,这次的闹剧无疑又加速了vue的发展.当下,国内越来越多的 ...