浮名此生分享 http://blog.sciencenet.cn/u/hailangww 工学博士

博文

[转载]解除代码安全模式

已有 1212 次阅读 2022-9-28 13:58 |系统分类:科研笔记|文章来源:转载

//---------------------------------------------------------------------------

// Example: CsmUnlock:

//---------------------------------------------------------------------------

// This function unlocks the CSM. User must replace 0xFFFF's with current

// password for the DSP. Returns 1 if unlock is successful.


#define STATUS_FAIL          0

#define STATUS_SUCCESS       1


Uint16 CsmUnlock()

{

    volatile Uint16 temp;


    // Load the key registers with the current password. The 0xFFFF's are dummy

   // passwords.  User should replace them with the correct password for the DSP.


    EALLOW;

    CsmRegs.KEY0 = 0xFFFF;

    CsmRegs.KEY1 = 0xFFFF;

    CsmRegs.KEY2 = 0xFFFF;

    CsmRegs.KEY3 = 0xFFFF;

    CsmRegs.KEY4 = 0xFFFF;

    CsmRegs.KEY5 = 0xFFFF;

    CsmRegs.KEY6 = 0xFFFF;

    CsmRegs.KEY7 = 0xFFFF;

    EDIS;


    // Perform a dummy read of the password locations

    // if they match the key values, the CSM will unlock


    temp = CsmPwl.PSWD0;

    temp = CsmPwl.PSWD1;

    temp = CsmPwl.PSWD2;

    temp = CsmPwl.PSWD3;

    temp = CsmPwl.PSWD4;

    temp = CsmPwl.PSWD5;

    temp = CsmPwl.PSWD6;

    temp = CsmPwl.PSWD7;


    // If the CSM unlocked, return succes, otherwise return

    // failure.

    if (CsmRegs.CSMSCR.bit.SECURE == 0) return STATUS_SUCCESS;

    else return STATUS_FAIL;


}

转自《C2000手册》



https://blog.sciencenet.cn/blog-54347-1357212.html

上一篇:[转载]官方锁相环初始化例程
下一篇:[转载]中断服务程序
收藏 IP: 58.34.184.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-23 20:55

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部