C H A P T E R 4 |
Programming the User LED |
This chapter describes how to use the Alarm/User LED. The Alarm/User LED is located on the front panel of the Netra CP2300 cPSB board. The bi-colored LED is red and green in color (see FIGURE 4-1 for the location of the Alarm/User LED on the board front panel).
In order to use the LED function, a SPARC V9 64-bit C library and the led.h file are required. The library and the file are available in the SUNWcp23u package. The Application Programming Interface (API) for the user is documented in the led.h file. See Files and Packages Required to Support the Alarm/User LED for more information.
To use the Alarm/User LED feature, the user should update the firmware with the appropriate firmware version that supports this feature on the Netra board.
Note - To check the current firmware version and for instructions on how to update the firmware, refer to the technical reference manual of the Netra board that you are using. |
The list of packages that are required are as follows:
Ensure that the following driver is also there, as needed:
A typical example of ${PLATFORM} is SUNW,Netra-CP2300 for the Netra CP2300 board. An example for the library directory is:
/usr/platform/SUNW,Netra-CP2300 /lib
This section provides the application programming interface (API) to control the command combination of the Alarm/User LED, and instructions on how to compile and link the information.
The supported LED and command combinations are shown in TABLE 4-1.
As you compile your application, you need to use the compiler command (cc) flag
-I, to include the sys/led.h file named in Files and Packages Required to Support the Alarm/User LED. Specify 64-bit binaries by setting the
-xarch=v9 and -D__sparcv9 compiler flags.
-xCC -xarch=v9 -D__sparcv9 -I/usr/platform/SUNW,Netra-CP2300/include/ |
To create a link to the library named (libcp2300.so.1) listed in Files and Packages Required to Support the Alarm/User LED, use the linker flag -L command.
-L /usr/platform/SUNW,Netra-CP2300/lib |
This section presents a sample test.c application to turn the LED on, off, and blink.
Copyright © 2003, Sun Microsystems, Inc. All rights reserved.