#ident "@(#) NEC r98led.c 1.5 95/06/19 11:36:14" /*++ Copyright (c) 1994 Kobe NEC Software Module Name: r98led.c Abstract: This module implements the Led output routines for R98 Author: Environment: Kernel mode Revision History: S001 9/26/94 By T.Samezima Add Debug Print A002 1995/6/17 ataka@oa2.kb.nec.co.jp - resolve compile error. --*/ #include "halp.h" // // Set table size // #define SEGMENT_TABLE_SIZE 16 // // Define spin lock // KSPIN_LOCK HalpLedLock; // // Define flag of initialize led // ULONG HalpLedInitFlg = 0; // // Buffer of output data at port // UCHAR HalpSegmentDisplayData[4] = { 0, 0, 0, 0 }; // // Define character table // UCHAR HalpSegmentCharTableL[] = "0123456789abcdef"; UCHAR HalpSegmentCharTableU[] = "0123456789ABCDEF"; // // Define table of change from output character data to output port data // UCHAR HalpSegmentPatternTable[] = { 0xfa, 0x30, 0xdc, 0x7c, //0-3 0x36, 0x6e, 0xee, 0x3a, //4-7 0xfe, 0x7e, 0xfc, 0xe6, //8-b 0xc4, 0xf4, 0xce, 0x8e, //c-f 0x04 }; //err VOID HalpOutputSegment( IN ULONG Number, IN UCHAR Data ) /*++ Routine Description: This routine is output a character data in led segment. Arguments: Number - Segment number(range 0-3.) Data - Output data on port. Return Value: none. --*/ { ULONG lednumber; // // Get segment number. // lednumber = Number & 0x3; if(HalpLedInitFlg == 0){ KeInitializeSpinLock(&HalpLedLock); HalpLedInitFlg = 1; } KiAcquireSpinLock(&HalpLedLock); // // Display data. // HalpSegmentDisplayData[Number] = Data; WRITE_REGISTER_UCHAR( &MRC_CONTROL->LedData3, HalpSegmentDisplayData[3] ); WRITE_REGISTER_UCHAR( &MRC_CONTROL->LedData2, HalpSegmentDisplayData[2] ); WRITE_REGISTER_UCHAR( &MRC_CONTROL->LedData1, HalpSegmentDisplayData[1] ); WRITE_REGISTER_UCHAR( &MRC_CONTROL->LedData0, HalpSegmentDisplayData[0] ); KiReleaseSpinLock(&HalpLedLock); return; } VOID HalpDisplaySegment( IN ULONG Number, IN UCHAR Data ) /*++ Routine Description: This routine is display a character in led segment. Arguments: Number - Segment number(range 0-3.) Data - Output data character on port. Return Value: none. --*/ { ULONG counter; // // Search character data. // for( counter=0 ; counter= R98DebugLevel) { if (DebugOutput & DBG_LED) { // Message is "1-a-f" for(p=(char *)DebugMessageLed,LedNumber=0; LedNumber<4;p++,LedNumber++) // A002 HalpDisplaySegment(LedNumber,*p); } // sdk/inc/crt/stdarg.h va_start(ap, DebugMessage); // stdlib ?? (sdk/inc/crt/stdio.h) (VOID) vsprintf(buffer, DebugMessage, ap); // if (DebugOutput & DBG_SERIAL) { DbgPrint(buffer); } // Console =Vram Write // if (DebugOutput & DBG_COLOR) { HalDisplayString(buffer); } } va_end(ap); } #endif // End S001