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

📄 evm.h

📁 56f8300E系列dsp的BOOTloader
💻 H
📖 第 1 页 / 共 2 页
字号:
/*******************************************************************************
*
* Motorola Inc.
* (c) Copyright 2002 Motorola, Inc.
* ALL RIGHTS RESERVED.
*
* $Element: /project/dsp568_sdk/sdk/src/dsp56838evm/nos/include/led.h $ 
* $Author: saa $ 
* $Revision: /main/2 $ 
* $VOB: /project/dsp568_sdk $ 
* $OS: solaris $ 
*
* Description:  EVM Led device
*
* Notes:          
*
******************************************************************************/
#ifndef __LED_H
#define __LED_H



#include "port.h"
#include "bsp.h"


#include "io.h"


#ifdef __cplusplus
extern "C" {
#endif

#if defined (INCLUDE_LED_PWM)
	#if defined(INCLUDE_PWM)
		#error  INCLUDE_PWM must be excluded from  appconfig.h to initialize the LED_PWM
	#endif
#endif

enum io_led 
{
  LED_ON 	 =   IO_OFFSET(io_sInterface, pIoctl[0] ),
  LED_OFF     =   IO_OFFSET(io_sInterface, pIoctl[1] ),
  LED_TOGGLE  =   IO_OFFSET(io_sInterface, pIoctl[2] ),
  INVERT_DIRECTION	 =   IO_OFFSET(io_sInterface, pIoctl[3] )
};



 #define LED_RED 	 (0)
 #define LED_YELLOW  (1)
 #define LED_GREEN   (2)

 #define LED_RED2	 (3)
 #define LED_YELLOW2 (4)
 #define LED_GREEN2  (5)
 
/******************************************************************************
*
*                      LED Interface Description
*
*  The LED interface manipulates the light emitting diodes. 
*  
******************************************************************************/

/******************************************************************************
*
*  LED Interfaces
* 
*     The LED interface can be used at two alternative levels, a low level
*     LED driver interface and the common IO layer interface.  The common IO 
*     layer interface invokes the lower level LED driver interface. 
*
*     The low level LED driver provides a non-standard interface that is
*     potentially more efficient that the IO layer calls, but less portable.  
*     The IO layer calls to the LED interface are standard and more 
*     portable than the low level LED interface, but potentially less efficient.
*    
*     Your application may use either the low level LED driver interface or
*     the IO layer interface to the LED driver, depending on your specific
*     goals for efficiency and portability.
*
*     The low level LED driver interface defines functions as follows:
*  
*          int  ledOpen  (const char *pName, int OFlags);
*          void ledIoctl (int FileDesc, UWord16 Cmd, UWord16 led, const char * ledDevice); 
*          int  ledClose (int FileDesc);  
*
*     The IO layer interface defines functions as follows:
*
*          int     open  (const char *pName, int OFlags, ...);
*          UWord16 ioctl (int FileDesc, UWord16 Cmd, void * pParams);      
*          int     close (int FileDesc);  
*
******************************************************************************/



/*****************************************************************************
* 
* IO Layer Interface to the LED Driver
*
*   General Description:
*
*      A LED device is configured by the following:
*  
*  		  1)  The device is created and initialized by selecting it by defining
*             both the INCLUDE_LED variable and the INCLUDE_IO variable in the 
*             appconfig.h file associated with the SDK Embedded Project created 
*             in CodeWarrior. 
*
*         2)  An "open" call is made to initialize the LED device
*
*         3)  The LEDs are configured via "ioctl" calls.
*             See "IOCTL" call below.
*
*         4)  After all LED operations are completed, the LED device
*             is closed via a "close" call.
*
*
*
*   OPEN
*
*      int open(const char *pName, int OFlags, ...);
*
*         Semantics:
*            Opens the LED driver for operation. Argument pName is the name of 
*            a particular bank of LEDs;  see the bsp.h file for specific device name
*            definitions. The LED driver needs to be 'open'ed before
*            configuring the LED with IOCTL calls.
*
*         Parameters:
*            pName    - device name. See the bsp.h file for LED names, which
*                    are typically:
*                       BSP_DEVICE_NAME_LED_0
*
*            OFlags   - open mode flags. Ignored. 
* 
*         Return Value: 
*            If open is successful, a file descriptor is returned.  This file
*            descriptor is used in subsequent calls to ioctl and close. 
*
*            If open is unsuccessful, a -1 value is returned.
*     
*         Example:
*
*            int LedFD; 
* 
*            LedFD = open(BSP_DEVICE_NAME_LED_0, 0);
*
*
*   IOCTL
*
*      UWord16 ioctl(int FileDesc, UWord16 Cmd, void * pParams); 
*
*         Semantics:
*            Modify LED state. The LED ioctl call supports the following commands:
*
*               LED_OFF      -  Turn the LED off
*
*               LED_ON       -  Turn the LED on
*
*               LED_TOGGLE   -  Toggle the state of the LED
*
*            The pParams must be set to the following led designations:
*               LED_RED
*               LED_YELLOW
*               LED_GREEN
*            or other LED defined in the specific driver for this board
*               (see leddrv.h)
*
*        Parameters:
*           FileDesc    - LED Device descriptor returned by "open" call.
*           Cmd         - command for driver 
*           pParam      - NULL
*
*        Return Value: 
*           Although the ioctl function is specified to return a UWord16 value, 
*           this return value is not returned by this driver and should not be 
*           checked by the application.  
*
*        Example:
*
*           // Turn the Red LED on
*           ioctl(LedFD, LED_ON, LED_RED); 
*     
*           // Toggle the Green LED 
*           ioctl(LedFD, LED_TOGGLE, LED_GREEN); 
*     
*
*   CLOSE
*
*      int close(int FileDesc);  
*
*         Semantics:
*            Close LED device.
*
*         Parameters:
*            FileDesc    - File descriptor returned by "open" call.
*
*         Return Value: 
*            Zero
*
*         Example:
*
*            // Close the LED driver
*            close(LedFD); 
*
*****************************************************************************/
/*****************************************************************************
* flags defifnitions
*****************************************************************************/
#define O_INVERT_DIRECTION 	0x8000


enum io_switch
{
  
  SWITCH_GET_STATE	 =   IO_OFFSET(io_sInterface, pIoctl[0] )
};
/******************************************************************************
*
*                      Switch Interface Description
*
*  The Switch interface reads the state of the run/stop switch on the EVM 
*  board. 
*  
******************************************************************************/

/******************************************************************************
*
*  SWITCH Interfaces
* 
*     The SWITCH interface can be used at two alternative levels, a low level
*     SWITCH driver interface and the common IO layer interface.  The common IO 
*     layer interface invokes the lower level SWITCH driver interface. 
*
*     The low level SWITCH driver provides a non-standard interface that is
*     potentially more efficient that the IO layer calls, but less portable.  
*     The IO layer calls to the SWITCH interface are standard and more 
*     portable than the low level SWITCH interface, but potentially less efficient.
*    
*     Your application may use either the low level SWITCH driver interface or
*     the IO layer interface to the SWITCH driver, depending on your specific
*     goals for efficiency and portability.
*
*     The low level SWITCH driver interface defines functions as follows:
*  
*          int  switchOpen  (const char *pName, int OFlags);
*          void switchIoctl (int FileDesc, UWord16 Cmd, void * pParams, const char * Device); 
*          int  switchClose (int FileDesc);  
*
*     The IO layer interface defines functions as follows:
*
*          int     open  (const char *pName, int OFlags, ...);
*          UWord16 ioctl (int FileDesc, UWord16 Cmd, void * pParams);      
*          int     close (int FileDesc);  
*
******************************************************************************/

/*****************************************************************************
*
* LOW LEVEL SWITCH DRIVER INTERFACE
*
*   General Description:
*
*      The Low Level SWITCH Driver is configured by the following:
*  
*         1)  The device is created and initialized by selecting it through defining the 
*             INCLUDE_SWITCH variable in the appconfig.h file associated with the SDK Embedded 
*             Project created in CodeWarrior. 
*
*         2)  An "switchOpen" call is made to open the SWITCH device
*
*         3)  The LED device is read via "switchIoctl" calls.
*             See "swtichIoctl" call below.
*
*         4)  After all SWITCH operations are completed, the SWITCH device
*             is closed via a "switchClose" call.
*
*
*   switchOpen
*
*      int switchOpen(const char *pName, int OFlags);
*
*         Semantics:
*            Opens a particular SWITCH device. Argument pName is the 
*            particular device name. The SWITCH device needs to be opened before
*            configuring the port with switchIoctl calls.
*
*         Parameters:
*            pName    - device name. See bsp.h for device names specific to this 
*                       platform.  Typically, the SWITCH device name is
*                          BSP_DEVICE_NAME_SWITCH_0
*            OFlags   - open mode flags. Ignored. 
* 
*         Return Value: 
*            Port file descriptor if open is successful.
*            -1 value if open failed.
*     
*         Example:
*
*            int switchFD; 
* 
*            switchFD = switchOpen(BSP_DEVICE_NAME_SWITCH_0, 0);
*
*
*   switchIoctl
*
*      void switchIoctl (int FileDesc, UWord16 Cmd, void * pParams, const char * Device); 
*
*         Semantics:
*            Read the state of the SWITCH
*
*         Parameters:
*            FileDesc  - The value returned by the switchOpen call
*
*            Cmd       - command for driver ioctl command;  these commands
*                        are listed in the description of the IO Layer ioctl 
*                        interface
*
*            pParams   - not used
*
*            Device    - the SWITCH device name from bsp.h;  typically,
*                        BSP_DEVICE_NAME_SWITCH_0
*
*         Return Value: 
*            void 
*
*         Example:
*
*            // read the state of the switch
*            int SwitchState;
*          
*            SwitchState = switchIoctl(switchFD, SWITCH_GET_STATE, 0, BSP_DEVICE_NAME_SWITCH_0); 
*     
*     
*   switchClose
*
*      int switchClose(int FileDesc);  
*
*         Semantics:
*            Close SWITCH device.
*  
*         Parameters:
*            FileDesc    - File descriptor returned by "switchOpen" call.
*
*         Example:
*
*            // Close the SWITCH driver 
*            switchClose(switchFD); 
* 
*         Return Value: 
*            Zero
*
*
* 
* IO Layer Interface to the SWITCH Driver
*
*   General Description:
*
*      A SWITCH device is configured by the following:
*  

⌨️ 快捷键说明

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