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. linux - 流量切分线路

    流量切分线路方式 # 程序判断进入IP线路,设置服务器路由规则控制返回 vi /etc/iproute2/rt_tables #添加一条策略 bgp2 #注意策略的序号顺序 ip route add ...

  2. Jenkins mac pkg安装 后默认配置文件/启动路径

    自启动文件路径 /Library/LaunchDaemons/org.jenkins-ci.plist jenkins.war 执行文件路径 /Applications/Jenkins/jenkins ...

  3. 【配置】Spring和MyBatis整合

    spring配置文件: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="h ...

  4. Aho-Corasick 多模式匹配算法、AC自动机详解

    Aho-Corasick算法是多模式匹配中的经典算法,目前在实际应用中较多. Aho-Corasick算法对应的数据结构是Aho-Corasick自动机,简称AC自动机. 搞编程的一般都应该知道自动机 ...

  5. Linux下USB转串口的驱动【转】

    转自:http://www.linuxidc.com/Linux/2011-02/32218.htm Linux发行版自带usb to serial驱动,以模块方式编译驱动,在内核源代码目录下运行Ma ...

  6. android的USB MTP && USB CDC/USBnet(ECM, NCM, ACM) && USB gardget

    MTP的全称是Media Transfer Protocol(媒体传输协议),它是微软公司提出的一套媒体文件传输协议.早在智能手机普及前,数码相机和MP3播放器等都使用了MTP的前身PTP(Pictu ...

  7. elasticsearch常见异常及解决办法

    报错信息:Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 20602552 ...

  8. AC自动机算法学习

    KMP+TRIE int val[1000100][31],tot; int tr[1000100]; int fail[1000100]; struct AC_Trie{ void clean(){ ...

  9. Intellij Idea 使用时总是打开上次的项目

    Appearance&Behaviour-->>System Settings-->>Startup&Shutdown-->>Reopen last ...

  10. appium入门级教程(2)—— 安装Appium-Server

    前言 ==================== web自动化测试的路线是这样的:编程语言基础--->测试框架--->webdriver API--->开发自动化测试项目. 移动自动化 ...