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

📄 sysled.c

📁 powerPC866 系列平台BSP移植开发的参考代码
💻 C
字号:
/* sysLed.c - Wind River PPMC 8260 User LED driver */

/* Copyright 1984-2001 Wind River Systems, Inc. */
/* Copyright 2001-2004 Embedded Planet, LLC. */

#include "copyright_wrs.h"

/*
modification history
--------------------
02a,06Jul03,gad  first release for VxWorks 5.5
01a,10oct01,gev  created
*/

/* includes */
#include "sysLed.h"
#include "rpx.h"
#include "ep8xx.h"

/**************************************************************************
*
* sysLedInit - Initialize LEDs.
*
* This routine initializes the LED variable to one and clears
* all LEDs.
*
* SEE ALSO: sysLedOn(), sysLedOff(), sysLedControl().
*
* RETURNS: N/A.
*/

void sysLedInit()
    {
    EPCFG *cfg  = getEpCfg();

    /*
     * Write to LED.
     */
/*    *(char*)BCSR0 |= COMMON_BCSR_LED4 >> 24;
    *(char*)BCSR0 |= COMMON_BCSR_LED5 >> 24;
*/
    }

/**************************************************************************
*
* sysLedOff - Turn selected LED off.
*
* This routine set the selected LED to off.
*
* SEE ALSO: sysLedInit(), sysLedOff(), sysLedControl().
*
* RETURNS: N/A.
*/

void sysLedOff(UINT8 led)
    {

    /*
     * Write to LED.
     */
/*     switch(led)
    {
		 case 0:
			    *(char*)BCSR0 |= COMMON_BCSR_LED4 >> 24;
			    break;
		 case 1:
			    *(char*)BCSR0 |= COMMON_BCSR_LED5 >> 24;
			    break;
	}
*/
    }

/**************************************************************************
*
* sysLedOn - Turn selected LED on.
*
* This routine set the selected LED to on.
*
* SEE ALSO: sysLedInit(), sysLedOn(), sysLedControl().
*
* RETURNS: N/A.
*/

void sysLedOn(UINT8 led)
    {

    /*
     * Write to LED.
     */
/*     switch(led)
     {
		 case 0:
			    *(char*)BCSR0 &= (~COMMON_BCSR_LED4) >> 24;
			    break;
		 case 1:
			    *(char*)BCSR0 &= (~COMMON_BCSR_LED5) >> 24;
			    break;
	}
*/
    }

/**************************************************************************
*
* sysLedControl - Turn selected LED(s) on or off.
*
* This routine sets the selected LED on or off.
*
* SEE ALSO: sysLedInit(), sysLedOff(), sysLedOn().
*
* RETURNS: N/A.
*/

void sysLedControl(int led_on, UINT8 led)
    {

    /*
     * Write to LED.
     */
/*     switch(led)
     {
		 case 0:
		 		if(led_on)
			    	*(char*)BCSR0 &= (~COMMON_BCSR_LED4) >> 24;
			    else
			    	*(char*)BCSR0 |= COMMON_BCSR_LED4 >> 24;
			    break;
		 case 1:
		 		if(led_on)
			    	*(char*)BCSR0 &= (~COMMON_BCSR_LED5) >> 24;
			    else
			    	*(char*)BCSR0 |= COMMON_BCSR_LED5 >> 24;
			    break;
	}

*/
    }

/**************************************************************************
*
* sysLedFlash - Flash selected LED.
*
* This routine set/clears the selected LED to flash the LED.
*
* SEE ALSO: sysLedInit(), sysLedOn(), sysLedControl().
*
* RETURNS: N/A.
*/

void sysLedFlash(int flashes, UINT8 led)
    {
	int i;

	for(i = 0; i < flashes; i++)
	{
		sysLedOn(led);
		taskDelay(10);
		sysLedOff(led);
		taskDelay(10);
	}
    }

⌨️ 快捷键说明

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