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. 20155339 2016-2017-2 《Java程序设计》第8周学习总结

    20155339 2016-2017-2 <Java程序设计>第8周学习总结 教材学习内容总结 第十四章NIO与NIO2 NIO使用频道来衔接数据节点,在处理数据时,NIO可以让你设定缓冲 ...

  2. 目标检测--Selective Search for Object Recognition(IJCV, 2013)

    Selective Search for Object Recognition 作者: J. R. R. Uijlings, K. E. A. van de Sande, T. Gevers, A. ...

  3. java 添加自己的工具包

    一. 在添加工具包前环境变量要定位到当前目录, export CLASSPATH=.:/home/share/ 添加工具类 我的目录\\192.168.1.101\share\share\net\fe ...

  4. A Connection to the remote computer could not be established

    Go to device manager: uninstall WAN Miniport (IP), Wan Miniport(IPv6) and Wan Miniport (PPTP). Refre ...

  5. zabbix 自动发现

    转自:https://blog.csdn.net/yyy72999/article/details/76065374 zabbix自动发现/zabbix自动发现规则 置顶2017年07月25日 14: ...

  6. MongoDB 安全配置

    前言 随着MongoDB使用人群企业越来越广泛,黑客的注意力也转移到了其中.比如去年很火热的MongoDB劫持事件,很多人对MongoDB的安全也越来越重视.今天,我们就简单总结一些MongoDB的安 ...

  7. 030 RDD Join中宽依赖与窄依赖的判断

    1.规律 如果JoinAPI之前被调用的RDD API是宽依赖(存在shuffle), 而且两个join的RDD的分区数量一致,join结果的rdd分区数量也一样,这个时候join api是窄依赖 除 ...

  8. H5的简介

    1.H5的诞生 2.介绍 HTML5 将成为 HTML.XHTML 以及 HTML DOM 的新标准. HTML5 是 W3C 与 WHATWG 合作的结果. WHATWG 致力于 web 表单和应用 ...

  9. 阿里云Linux服务器,配置JDK,MySQL

    云服务器配置:低配 Linux CentOS 7.4 64位 选择空白镜像: 安装图形界面 yum groups install "MATE Desktop" yum groups ...

  10. SOA和Web Servcie的区别

    soa(Service-Oriented Architecture)是服务对服务的,web service是服务对客户端的. 都提供服务.  服务接口都是基于开发的.  服务接口和服务的具体实现都是分 ...