//###########################################################################
//
// FILE: clear_program_flash.c
//
// TITLE:
//
// NOTES:
// 1)
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// ======|=============|============|========================================
// 00 05 04 2015 HPCS
//
// Texas Instruments, Inc
// Copyright Texas Instruments 2008. All rights reserved.
//###########################################################################
#include "system_defines.h"
#include "cyclone_device.h"
#include "variables.h"
#include "function_definitions.h"
#include "software_interrupts.h"
#define program_flash_integrity_word (*((volatile unsigned long *) 0x7ffc))
//last word in flash, when executing from Flash. used to store integrity code
void clear_program_flash(void)
{
DecRegs.PFLASHCTRL.bit.MASS_ERASE = 1; //erase it all
while(DecRegs.PFLASHCTRL.bit.BUSY != 0)
{
; //do nothing while it programs
}
//now reset processor.
// TimerRegs.WDCTRL.bit.CPU_RESET_EN = 1; // Make sure the watchdog is enabled.
// TimerRegs.WDCTRL.bit.WD_PERIOD = 1; // Set WD period to timeout faster.
return;
}
void zero_out_integrity_word(void)
{
DecRegs.FLASHILOCK.all = 0x42DC157E;// Write key to Program Flash Interlock Register
DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K; //enable program flash write
program_flash_integrity_word = 0;
DecRegs.MFBALR1.all = MFBALRX_BYTE0_BLOCK_SIZE_32K + //expand program flash out to 4x real size
MFBALRX_BYTE0_RONLY;
while(DecRegs.PFLASHCTRL.bit.BUSY != 0)
{
; //do nothing while it programs
}
SysRegs.SYSECR.bit.RESET = 2; //reset device
return;
}
没有合适的资源?快使用搜索试试~ 我知道了~
【UCD3138 学习笔记之二】
共23个文件
h:19个
cmd:2个
c:1个
需积分: 0 0 下载量 163 浏览量
2023-07-13
16:16:00
上传
评论
收藏 50KB ZIP 举报
温馨提示
3138编译需要的.cmd文件
资源推荐
资源详情
资源评论
收起资源包目录
UCD3138.zip (23个子文件)
UCD3138
Header
cyclone_sys.h 7KB
cyclone_dpwm.h 32KB
cyclone_gio.h 12KB
cyclone_mmc.h 6KB
cyclone_fault_mux.h 46KB
cyclone_dec.h 11KB
cyclone_uart.h 10KB
device.h 44B
cyclone_misc_analog.h 21KB
cyclone_filter.h 19KB
cyclone_cim.h 14KB
cyclone_timer.h 15KB
cyclone_defines.h 9KB
cyclone_loop_mux.h 29KB
device_dep.h 44B
cyclone_adc.h 18KB
cyclone_device.h 3KB
cyclone_pmbus.h 13KB
cyclone_fe_ctrl.h 17KB
Linker
cyclone.cmd 7KB
cyclone_headers.cmd 4KB
Source
load_UCD3138.asm 7KB
clear_program_flash.c 2KB
共 23 条
- 1
资源评论
莫得感情123
- 粉丝: 46
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功