⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dm643_led.c

📁 基于ccs2(6000)开发环境,通过这个程序可以修改板上EEPROM 的MAC 地址.
💻 C
字号:
/*
 *  Copyright 2003 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 */
 
/*
 *  ======== dm643_led.c ========
 *  LED module for the DM643
 */
 
#include <csl.h>
//#include <csl_mcasp.h>
//#include <csl_gpio.h>

#include "dm643.h"
#include "dm643_led.h"



void DM643_LED_init()
{
    *(Uint32 *)MAPEN |= 0x4a000080;
    *(Uint32 *)MAPDIR |= 0x4a000080;
    /* Turn all LEDs off */
    *(Uint32 *)MAPDOUT |= 0x4a000000;
}

void DM643_LED_off(Uint32 ledNum)
{
   switch(ledNum)
    {
       case 0: *(Uint32 *)MAPDOUT |= 0x4a000000; break;
       case 1: *(Uint32 *)MAPDOUT |= 0x40000000; break;
       case 2: *(Uint32 *)MAPDOUT |= 0x2000000; break;
       case 3: *(Uint32 *)MAPDOUT |= 0x8000000; break;       
       default: return;
     }
}	

void DM643_LED_on(Uint32 ledNum)
{
	switch(ledNum)
    {
       case 0: *(Uint32 *)MAPDOUT &= 0xb5ffffff; break;
       case 1: *(Uint32 *)MAPDOUT &= 0xbfffffff; break;
       case 2: *(Uint32 *)MAPDOUT &= 0xfdffffff; break;
       case 3: *(Uint32 *)MAPDOUT &= 0xf7ffffff; break;       
       default: return;
     }  
}

void DM643_LED_toggle(Uint32 ledNum)
{
	Int32 ledstate;
	switch(ledNum)
    {
       case 0: ledstate=*(Uint32 *)MAPDIN & 0x4a000000; break; 
       case 1: ledstate=*(Uint32 *)MAPDIN & 0x40000000; break;       
       case 2: ledstate=*(Uint32 *)MAPDIN & 0x2000000; break; 
       case 3: ledstate=*(Uint32 *)MAPDIN & 0x8000000; break;       
       default: return;
     }  
     
     if (ledstate > 0)
		DM643_LED_on(ledNum);
	 else
		DM643_LED_off(ledNum);
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -