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

📄 play.c

📁 epson 13506 driver code
💻 C
📖 第 1 页 / 共 5 页
字号:
            if (szArg[1] == '?')
               exit(0);
            else
               DISPLAY_WHAT;

            RepeatLastCommand = FALSE;
            break;
   
         default:
            DISPLAY_WHAT;
            RepeatLastCommand = FALSE;
            break;
      }
   } while (RepeatLastCommand);
}

/*-----------------------------------------------------------------------*/

/*
** DisplayCopyright()
*/ 
void DisplayCopyright( void )
{
   const char *szHALVer;
   const char *szHALStatus;
   const char *szHALStatusRev;

   seGetHalVersion( &szHALVer, &szHALStatus, &szHALStatusRev );

   printf( "\n13506PLAY - test utility - version %s (HAL %s%s%s)",
            szVersion, szHALVer, szHALStatus, szHALStatusRev );
   printf( "\nCopyright (c) 1997, 2001 Epson Research and Development, Inc.");
   printf( "\nAll Rights Reserved.\n\n");

   printf("Register Start Addr:       ");
   if (HalInfo.dwRegisterAddress == 0)
      printf("Configured by system\n");
   else
      printf("%08lX\n", HalInfo.dwRegisterAddress);

   printf("Display Memory Start Addr: ");
   if (HalInfo.dwDisplayMemoryAddress == 0)
      printf("Configured by system\n");
   else
      printf("%08lX\n", HalInfo.dwDisplayMemoryAddress);
}

/*
** DisplayMainHelp() - displays the primary help screen.
*/
void DisplayMainHelp( void )
{
   printf( "\n 13506PLAY - General Command Format" );
   printf( "\n" );
   printf( "\n CLKI [?] iFreq              - select preset clock frequency for CLKI" );
   printf( "\n CLKI2 [?] iFreq             - select preset clock frequency for CLKI2" );
   printf( "\n CW word                     - send 24 bit word to programmable clock" );
   printf( "\n F addr addr data            - Fill BYTE range with data" );
   printf( "\n FW addr addr data           - Fill WORD range with data" );
   printf( "\n FD addr addr data           - Fill DWORD range with data" );
   printf( "\n H [lines]                   - Halt after [lines] of display (0 to disable)" );
   printf( "\n I [?] {[LCD][CRT|TV]}");
   printf( "\n   [d=iCrtTv] [COMP|SVIDEO]");
   printf( "\n   [FLICKER=ON|OFF]          - Init registers (use 'I ?' for more info)" );
   printf( "\n IC {LCD|CRT|TV}             - Init cursor for given display" );
   printf( "\n II {LCD|CRT|TV}             - Init ink layer for given display" );
   printf( "\n L {LCD|CRT|TV} index");
   printf( "\n   [red green blue]          - Read/[Write] LUT values" );
   printf( "\n LA {LCD|CRT|TV}             - Read all LUT values" );
   printf( "\n LCD [ON|OFF]                - Implement LCD power up/power down sequence" );
   printf( "\n M [?] {LCD|CRT|TV} [bpp]    - Get/Set the pixel mode; display basic info" );
   printf( "\n MC [?] {LCD|CRT|TV} [bpp]   - Get/Set the pixel mode; display extended info" );
   printf( "\n P [ON|OFF]                  - Implement powersave power up/power down sequence" );
   printf( "\n Q                           - Quit" );

   printf( "\n\n Press <ENTER> to continue...");
   getchar();

   printf( "\n R addr [count]              - Read [count] BYTES from addr" );
   printf( "\n RW addr [count]             - Read [count] WORDS from addr" );
   printf( "\n RD addr [count]             - Read [count] DWORDS from addr" );
   printf(" \n S {CLKI|CLKI2|BUSCLK} freq  - Set PCLK source frequency (in kHz)" );
#if defined(INTEL_W32) || defined(INTEL_DOS)
   printf( "\n V                           - Calc frame rate from VNDP count");
#endif
   printf( "\n W addr data ...             - Write BYTES of data to addr" );
   printf( "\n WW addr data ...            - Write WORDS of data to addr" );
   printf( "\n WD addr data ...            - Write DWORDS of data to addr" );
   printf( "\n X index [data]              - Read/[Write] BYTE(s) to reg" );
   printf( "\n XW index [data]             - Read/[Write] WORD(s) to reg" );
   printf( "\n XD index [data]             - Read/[Write] DWORD(s) to reg" );
   printf( "\n XA                          - Read all registers" );
   printf( "\n ?                           - Displays help screens" );
   printf( "\n\nNOTE: To repeat a command forever, put '!' in front of command.");
   printf(   "\n      All values default to hexadecimal (or put h at end of number).");
   printf(   "\n      To enter decimal numbers, put t at end of number (eg. 100t).");
   printf(   "\n      To enter binary numbers, put 'b at end of number (eg. 11110000'b).");
}

/*
** ThrottleDisplay()
**
** Displays a prompt if more than gnLineCount lines have been displayed.
*/
BOOL ThrottleDisplay( void )
{
   int ch;
   BOOL bStop;
   bStop = FALSE;

   gnLineCount++;
   if ((gnLineCount == gnHaltCount) && (0 != gnHaltCount)) 
   {
      gnLineCount = 0;

      printf( "\nPress any key to continue." );

      ch = getch();

      if ((0 == ch) || (0xE0 == ch))  /* We have an extended keystroke */
         ch = getch();

      if (ESC == ch)
         bStop = TRUE;
   }
   return bStop;
}

/*-- Conversion Functions -----------------------------------------------*/

/*
** IntToBin - INTeger TO BINary ASCII conversion.
**
** Returns a binary string representing the passed in
** integer (eg. '5' becomes '00000101')
*/
void IntToBin( DWORD nVal, int nWidth, PCHAR szStr )
{
   nWidth--;
   while (nWidth >= 0)
   {
      if (nVal & (1L << nWidth))
         *szStr = '1';
      else
         *szStr = '0';

      szStr++;

      if ((nWidth > 1) && (nWidth % 4 == 0))
         *szStr++ = '-';

      nWidth--;
   }
   *szStr = '\0';
}

/*
** AscToUpper()
**
** This function converts an ASCII string to upper case.
*/
void AscToUpper(PCHAR szAscii)
{
   while (*szAscii != 0)
      {
      if ((*szAscii <= 'z') && (*szAscii >= 'a'))
         *szAscii -= 'a' - 'A';

      ++szAscii;
      }
}

/*
** AscToLong()
**
** This function converts an ASCII string to a long integer.
** This function should work the same as atol() with the exception
** that the input string is scanned for radix modifiers and handled
** appropriately.
**
** If not specified the input value is assumed to be HEX.
** Octal values are not handled.
**
** Returns:
** 0 if the calls fails - A very broken interface but it follows atol().
*/
long AscToLong( PCHAR szAscii )
{
   PCHAR ptr;
   ptr = szAscii;

   /*
   ** Scan for a radix modifier.
   */
   while (!isspace( (int) *ptr ) && ('\0' != *ptr))
   ptr++;

   /*
   ** Handle the appropriate base.
   */
   switch (toupper( *(ptr - 1) ))
   {
   case 'T':
      return atol( szAscii );
      break;

   case 'B':
      if (DELIM == *(ptr - 2))
      return btol( szAscii );
      else
      return htol( szAscii );
      break;

   case 'H':
      default:
      return htol( szAscii );
      break;
   }
}

/*
** btol() - Binary ASCII TO Long integer.
*/
long btol( PCHAR  szAscii )
{
   long lTmp = 0;
   char ch;
   int count;

   SKIP_WHITESPACE( szAscii );

   for (count = 0; (count < 33) && (DELIM != *szAscii); ++count)
   {
      ch = *szAscii;

      if ((ch != '0') && (ch != '1'))
         return 0;

      lTmp = (lTmp << 1) + (ch - '0');

      szAscii++;
   }

   /*
   ** Check that we have no more than 32 'bits' of argument.
   */
   if (count > 32)
      return 0;
   else
      return lTmp;
}

/*
** htol() - Hexadecimal ASCII to Long integer.
*/
long htol( PCHAR szAscii )
{
   long lTmp;
   char ch;
   int count;

   lTmp = 0;
   SKIP_WHITESPACE( szAscii );

   for (count = 0; (count < 9) && (!isspace( (int) *szAscii ) &&
                   ('\0' != *szAscii) && ('h' != *szAscii) && ('H' != *szAscii));
                   ++count)
   {
      ch = (char)toupper( *szAscii );

      if (!isxdigit( (int) ch ))
         return 0;

      if ((ch >= 'A') && (ch <= 'F'))
         lTmp = lTmp * 16 + 10 + (ch - 'A');
      else
         lTmp = lTmp * 16 + (ch - '0');

      szAscii++;
   }

   /*
   ** Check that we have no more than 32 'bits' of argument.
   */
   if (count > 8)
      return 0;
   else
      return lTmp;
}

/*
** ArgLen()
**
** Returns:
** The length of the argument pointed to by szArg but
** does not include the final delimiter in the length.
*/
int ArgLen( PCHAR szArg )
{
   int nLen = 0;

   while (!isspace( (int) *szArg ) && ('\0' != *szArg))
   {
      szArg++;
      nLen++;
   }
   return nLen;
}

/*-----------------------------------------------------------------------*/

/*
** FindNextArg()
**
** This function scans the input string to see if there is another argument,
** separated by a whitespace, in the string. If an argument is found szArg
** is updated to point to the start of non-whitespace forming the argument.
**
** Returns:
** TRUE  - if another argument is found - szArg is updated.
** FALSE - if no other arguments found - szArg is not updated.
*/
BOOL FindNextArg( char ** szArg )
{
   PCHAR ptr = *szArg;

   /*
   ** Look for the first whitespace.
   */
   while (!isspace((int) *ptr) && (*ptr != '\0'))
      ptr++;
   if (*ptr == '\0')
      return FALSE;

   /*
   ** Look for the first non-whitespace.
   */
   while (isspace((int) *ptr) && (*ptr != '\0') && (*ptr != ';'))
      ptr++;

   /*
   ** If we came to an EOL or a comment then return FALSE.
   */
   if (('\0' == *ptr) || (';' == *ptr))
      return FALSE;

   /*
   ** Return TRUE if we didn't hit an EOL.
   */
   *szArg = ptr;
   return TRUE;
}

/*-----------------------------------------------------------------------*/

void ShowCurrentDisplaySurface(void)
{
   unsigned DisplayMode;
   int tmp;

   /*
   ** "Disp Surface:    0=LCD, 1=CRT"
   */
   printf("Disp Surface:    0=");

   DisplayMode = GetSurfaceDisplayMode(0);

   tmp = 0;

   if (DisplayMode & LCD)
      {
      printf("LCD");
      ++tmp;
      }

   if (DisplayMode & TV)
      {
      if (tmp > 0)
         printf("&");

      printf("TV");
      ++tmp;
      }
   else if (DisplayMode & CRT)
      {
      if (tmp > 0)
         printf("&");

      printf("CRT");
      ++tmp;
      }

   if (tmp == 0)
      printf("NONE");

   printf(", 1=");

   DisplayMode = GetSurfaceDisplayMode(1);

   tmp = 0;

   if (DisplayMode & LCD)
      {
      printf("LCD");
      ++tmp;
      }

   if (DisplayMode & TV)
      {
      if (tmp > 0)
         printf("&");

      printf("TV");
      ++tmp;
      }
   else if (DisplayMode & CRT)
      {
      if (tmp > 0)
         printf("&");

      printf("CRT");
      ++tmp;
      }

   if (tmp == 0)
      printf("NONE");
}

/*-----------------------------------------------------------------------*/

/*
** DisplayAllLutEntries()
**
** This function reads the entire internal LUT and
** diplays the results to stdout.
**
** NOTE:
** This routine reads the absolute index.
** (i.e. There is no attempt to have a read from index 0 come
**           from the 0th index of the currently active LUT area)
*/
void DisplayAllLutEntries( PCHAR szArg )
{
   BYTE LUT[NUM_LUT][3];
   unsigned DisplayMode;
   int index;
   int count, line;

   /*
   ** Get display type
   */
   if (FALSE != FindNextArg(&szArg))
      {
      if (!strncmp(szArg, "LCD", 3))
         DisplayMode = LCD;
      else if (!strncmp(szArg, "CRT", 3))
         DisplayMode = CRT;
      else if (!strncmp(szArg, "TV", 2))
         DisplayMode = TV;
      else
         {
         DISPLAY_WHAT;
         return;
         }
      }
   else
      {
      DISPLAY_WHAT;
      return;
      }


   if (DisplayMode & CRT)
      {
      printf("\nCRT     ");
      seReadCrtLut(&LUT[0][0], NUM_LUT);
      }
   else if (DisplayMode & TV)
      {
      printf("\nTV      ");
      seReadTvLut(&LUT[0][0], NUM_LUT);
      }
   else
      {
      printf("\nLCD     ");
      seReadLcdLut(&LUT[0][0], NUM_LUT);
      }

   for (count = 0; count < 16; ++count)
      {
      printf("RGB");

      if (count != 15)
         printf("|");
      }

   printf("\n");

   for (count = 0; count < 71; ++count)
      printf("-");


   index = 0;
   for (line = 0; line < 16; ++line)
      {
      printf("\nLUT[%02X] ", index);

      for (count = 0; count < 16; ++count, ++index)
         {
         printf("%X%X%X", LUT[index][0] >> 4, LUT[index][1] >> 4, LUT[index][2] >> 4);

         if (count != 15)
            printf("|");
         }
      }
}

/*-----------------------------------------------------------------------*/

/*
** DisplayAllRegisters()
**
** This function reads and displays the contents of all the 13506
** control registers. No interpretation is done.
*/
void DisplayAllRegisters( void )
{
   unsigned val;
   int count, count2;
   int addr;
   int LastAddr;

   const WORD RegStartAddr[] =
      { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
        0x100, 0x110, 0x1e0, 0x1f0, 0x1000 };

   LastAddr = RegStartAddr[0];

   for (count = 0; count < sizeof(RegStartAddr) / sizeof(WORD); ++count)
      {
      addr = RegStartAddr[count];

⌨️ 快捷键说明

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