亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ethloop.c

?? Cirrus Logic EP7312處理器部分控制程序。
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):
//****************************************************************************
//
// File Name: EthLoop.c
//
// Purpose: The LoopTest program performs two tests:
// 1. EEPROM Test: 
//    -Write and verifies reset and driver configuration blocks.
//    -Reset the CS8900
//    -Verifies that the registers read in by the reset configuration block 
//     are correct.
// 2. LoopBack Test:
//    -Sets up the CS8900 registers for loop back.
//    -Bids for and transmits a frame.
//    -Polls teh receive register for the receive frame
//    -Verifies that the data is correct.
//
// Copyright (c) 2001 Cirrus Logic, Inc.
//
//*****************************************************************************
//
// The following is the basic flow of the loopback test program
//
// This procedure assumes you are using 10B-T.  Use a "loopback" cable,
// included in the EDB7312 evaluation kit in a small bag with the title
// "Ethernet Loopback Connector for EthLoop.c Code".  
// A regular 10B-T cable connected to a hub will not work.
//
// Configure RxCTL for Promiscious mode, RxOK 
// (1) Write 0x0104 to IOBase+0xA (PacketPage Pointer)
// (2) Write 0x0180h to IOBase+0xC (PacketPage Data Port)
//
// Configure TestCTL (FDX, DisableLT)
// (3) Write 0x0118 to IOBase+0xA (PacketPage Pointer)
// (4) Write 0x4080 to IOBase+0xC (PacketPage Data Port)
//
// Set 10BaseT, SerRxOn, SerTxOn in LineCTL
// (5) Write 0x0112 to IOBase+0xA (PacketPage Pointer)
// (6) Write 0x00C0 to IOBase+0xC (PacketPage Data Port)
//
// Write the TX command
// (7) Write 00C0h to IOBase+0x4 (PacketPage Pointer)
//
// Write the frame length  (XX = number of bytes to TX)
// (8) Write 00XXh to IOBase+0x6 (PacketPage Pointer)
//
// Read BusST to verify it is set as 0x0118 (Rdy4TxNow is set)
// (9) Write 0x0138 to IOBase+0xA (PacketPage Pointer)
// (10) Read IOBase+0xC  Should read 0x0118
//
// Copy the TX frame to the on-chip buffer 
// (11) Write XX/2 words to IOBase+0x0 (TX Data Port)
//
// At this point frame should go out on the wire.
//
// To read the TX'd frame:
//
// Read RxEvent for RxOK (0x0104)
// (12) Write 0x0124 to IOBase+0xA (PacketPage Pointer)
// (13) Read IOBase+0xC  Should read 0x0104 or 0x0504h
//
// Read IOBase+0  This will be the RxStatus (RxEvent) word again.
// Read IOBase+0 again.  This will be the RxLength (number of bytes received).
// Read IOBase+0 (RxLength/2) times to read complete frame.
//
//************************************************************************
#include "EthLoop.h"
#include "EpromDat.h"
#include "ep7312.h"
#include <stdio.h>

int entry( void );
void reset( void);
int LoopBackTest( void );

//***********************************************************************
//
// entry() - calls the EEPROM test and the loop back test.
//
//***********************************************************************
int entry( void )
{
	unsigned long *pulPtr = (unsigned long *)HwBaseAddress;
	unsigned long test;

	// Initialize CS2 for 16-bit 4 wait states.
	// start by clearing the CS2 field
	pulPtr[HwMemConfig1 >> 2] &= 0xff00ffff;


	// now get the boot width and set CS4 accordingly
	// boot width is in bits 27 and 28 of HwStatus
	test = (pulPtr[HwStatus >> 2] >> 27) & 0x3;		// boot width is in bits 27 and 28 of HwStatus
	switch(test)
	{
		case 0:	// we booted in 32-bit mode
			pulPtr[HwMemConfig1 >> 2] |= (0x00000090 | (1 << 16)); 
			break;

		case 1:	// we booted in 8-bit mode
			pulPtr[HwMemConfig1 >> 2] |= (0x00000090 | (3 << 16)); 
			break;

		case 2:	// we booted in 16-bit mode
/*          The correct setting for CS[2] here is 0x00. This is the current value from above */
/*          So, I don't know why this assignment is here. */
/*          It's presence causes the processor to hang at the assignment.       */
/*			pulPtr[HwMemConfig1 >> 2] |= (0x00000090 | (0 << 16));  -Gabriel Field */


			break;
	}


  EepromTest();
  LoopBackTest( );

  return(0);
}

//**************************************************************************
//  LoopBackTest()
//**************************************************************************
int LoopBackTest( void )
{
   unsigned short int i, j, receive_frame_size, temp;

   printf("\nBegin LoopBack test..............\n");

   // Initialize the part
   //
   // Configure RxCTL for Promiscious mode, RxOK 
   // (1) Write 0x0104 to IOBase+0xA (PacketPage Pointer)
   // (2) Write 0x0180h to IOBase+0xC (PacketPage Data Port)
   //
   outport( (IO_BASE + PP_POINTER ), 0x0104 );
   outport( (IO_BASE + PP_DATA ), 0x0180 );

   //
   // Configure TestCTL (FDX, DisableLT, ENDEC loop ) */
   // (3) Write 0x0118 to IOBase+0xA (PacketPage Pointer)
   // (4) Write 0x4080 to IOBase+0xC (PacketPage Data Port)*/
   //
   outport( (IO_BASE + PP_POINTER ), 0x0118 );
   outport( (IO_BASE + PP_DATA ), 0x4000 );

   //
   // Set 10BaseT, SerRxOn, SerTxOn in LineCTL 
   // (5) Write 0x0112 to IOBase+0xA (PacketPage Pointer)
   // (6) Write 0x00C0 to IOBase+0xC (PacketPage Data Port)
   //
   outport( (IO_BASE + PP_POINTER ), 0x0112 );
   outport( (IO_BASE + PP_DATA ), 0x00c0 );


   for (i = 0; i < NO_FRAMES_TO_SEND ; i++)
   {
      //
      // Write the TX command 
      // (7) Write 00C0h to IOBase+0x4 
      //
      outport( (IO_BASE + TX_CMD ), 0x00c0 );

      //
      // Write the frame length  (XX = number of bytes to TX)
      //(8) Write 00XXh to IOBase+0x6 
      //
      outport( ( IO_BASE + TX_LENGTH ), SIZE_OF_FRAME * 2 ); 

      // 
      //(9) Write 0x0138 to IOBase+0xA (PacketPage Pointer)
      //
      outport( (IO_BASE + PP_POINTER), 0x0138 );

      //
      // delay for a while
      //
      for ( j = 0; j < 10000; j++);

      //
      // (10) Read IOBase+0xC,  Should read 0x0118 to indicate Ready
      // for a transfer now.
      //  
      if ( (temp=inport(IO_BASE + PP_DATA)) !=  0x0118)
      {
         printf("\n\n Bid for transmit failed");
         printf("\nRegister PP_DATA = %4.4x", temp);
         return(FAILURE);
      }


      //
      // Copy the TX frame to the on-chip buffer 
      // (11) Write XX/2 words to IOBase+0x0 (TX Data Port) 
      
      for (j = 0; j < SIZE_OF_FRAME; j++)
      {
         outport( IO_BASE , WORD_DATA );
      }

      // 
      // Delay for a while
      //
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++);
      for ( j = 0; j < 30000; j++); 


      //
      // Read RxEvent for RxOK (0x0104) 
      // (12) Write 0x0124 to IOBase+0xA (PacketPage Pointer)
      // (13) Read IOBase+0xC  Should read 0x0104h or 0x0504h
      //
      outport ( (IO_BASE + PP_POINTER), 0x0124);
      if ((temp = inport (IO_BASE + PP_DATA)) != 0x0104)
      {
         printf("\n\n Frame not received");
         printf("\nRegister 0x0124 PP_DATA = %4.4x \n", temp);
         reset();
         return( FAILURE );
      }

      //
      // Read IOBase+0  This should be the RxStatus (RxEvent) word again.
      //
      if ( (temp = inport ( IO_BASE )) != 0x0104)
      {
         printf("\n\n Frame not received -- reading data port");
         printf("\nRegister 0x0124 PP_DATA = %4.4x", temp);
         reset();
         return( FAILURE );
      }

      //
      // Read IOBase+0 again.  This should be the RxLength (number of bytes received).
      //
      receive_frame_size = inport( IO_BASE );
      if (SIZE_OF_FRAME < 30)  /*size in words, i.e. pad characters added*/
      	if (receive_frame_size != 60)  /* size in bytes because of pad characters*/
      	{
      		printf("\n\n Frame received is not the right size < 60");
            printf("\n\n receive_frame_size = %4.4x", receive_frame_size);
            reset();
            return(FAILURE);
         }
      if (SIZE_OF_FRAME >= 30)
      	if (receive_frame_size != (SIZE_OF_FRAME * 2))
			{
      		printf("\n\n Frame received is not the right size >= 60");
            printf("\n\n receive_frame_size = %4.4x ; Should be %4.4x", 
                    receive_frame_size, (SIZE_OF_FRAME * 2));
            reset();
            return(FAILURE);
         }

      //
      // Read IOBase+0 (RxLength/2) times to read complete frame.
      //
      for (j = 0; j < SIZE_OF_FRAME ; j++ )
      {
      	if ( (temp = inport( IO_BASE )) != WORD_DATA)
         {
         	printf("\n\nFrame data does not match what was sent");
            printf("\n Received Data  = %4.4x", temp);
		reset();
            return(FAILURE);
         }
      }
      if (SIZE_OF_FRAME < 30) /* need to issue a skip to flush pad chars*/
      {
         outport( IO_BASE + PP_POINTER , 0x0102);
         temp = inport ( IO_BASE + PP_DATA );
         outport( IO_BASE + PP_DATA , ( temp | SKIP ) );
      }

   }
   reset();
   printf("\nLoopback Test Completed Successfully!\n");

   return(SUCCESS);
}

//*************************************************************************
//
// reset()
//
//*************************************************************************
void reset()
{
   unsigned short int temp,j;

   //
   // Reset the CS8900A device
   //
   outport( ( IO_BASE + PP_POINTER ), 0x0114 );
   outport( ( IO_BASE + PP_DATA ), 0x0040 );

   //
   // delay for a while
   //
   for (j=0; j<30000; j++);

   //
   // Wait for reset complete
   //
   for (;;) {
      outport ( (IO_BASE + PP_POINTER), 0x0136);
      if(((temp=inport(IO_BASE + PP_DATA)) & 0x0080) != 0) break;
	}
}



//*************************************************************************
//
// EepromTest()
//
//*************************************************************************
int EepromTest( void )
{
   printf("Reset CS8900.\n");
   reset();

   printf("Begin EEPROM test...........\n");

   if ( initEEPROM() == FAILURE ) {
      return(FAILURE);
   }

   parse_lines(EepromData);
   printf("Write data into EEPROM\n");
   if ( burn_it() != SUCCESS ) {
		return(FAILURE);
   }

   printf("Reset CS8900.\n");
   reset();

   printf("Read back EERPOM data and verify it.\n");
   readBack();

   return(SUCCESS);
}

//*************************************************************************
// initEEPROM(): 
//*************************************************************************
int initEEPROM( )
{
   unsigned short int temp;

   //
   // Check the SelfST register, bit 9, for EEPROM present.
   //
   outport( (IO_BASE + PP_POINTER), 0x0136);
   temp=inport(IO_BASE + PP_DATA);
    
   if ( (temp & 0x0200) == 0 ) {
         printf("CS8900 - EEPROM not present.\n");
	   return(FAILURE);
   }
   printf("CS8900 - EEPROM present.\n");

   //
   // Check Self Status register, bit 10, for checksum error.
   // 1 = Checksum ok, 0 = checksum error
   //
   if ( (temp & 0x0400) == 0 ) {
         printf("EEPROM CheckSum Error.\n");
   }
   else {
      printf("EEPROM CheckSum Correct.\n");
   }
  
   return(SUCCESS);
}




/**************************************************************************
 * ReadEE(): 
 * Returns word from EEPROM from address EE_word_offset
 *************************************************************************/
unsigned short int readEE(unsigned short int EE_word_offset )
{	
   unsigned short int j, temp;

   //
   // Wait until SIBUSY is clear.  Check bit 8 if Self Status register.
   // 1 = busy, 0 = not busy
   //
   for (;;) {
      outport( (IO_BASE + PP_POINTER), 0x0136);
      if (((temp=inport(IO_BASE + PP_DATA)) & 0x0100) == 0) break;
   }

   //
   // Send EEPROM command
   //
   outport( ( IO_BASE + PP_POINTER ), 0x0040 );
   outport( ( IO_BASE + PP_DATA ), (0x0200+EE_word_offset));

   //
   // Wait until SIBUSY is clear
   //
   for (;;) {
     outport( (IO_BASE + PP_POINTER), 0x0136);
     if(((temp=inport(IO_BASE + PP_DATA)) & 0x0100) == 0) break;
   }
   
   //
   // delay for a while
   //
   for (j=0; j<30000; j++);

   //
   // Read data from EEPROM and return.
   //
   outport( (IO_BASE + PP_POINTER), 0x0042);
   temp=inport(IO_BASE + PP_DATA);

   return(temp);
}


/**************************************************************************
 * WriteEE(): 
 * Writes outword to the EEPROM @ address EE_Word_offset.  Returns a
 * read back of the word just written.
 *************************************************************************/
unsigned short int writeEE(unsigned short int EE_word_offset,
				   unsigned short int outword )
{
   unsigned short int j,temp;

   //
   // Wait until SIBUSY is clear. Check bit 8 of Self Status register.
   // 1 = busy, 0 = not busy
   //
   for (;;) {
     outport( (IO_BASE + PP_POINTER), 0x0136);
     if(((temp=inport(IO_BASE + PP_DATA)) & 0x0100) == 0) break;
   }


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区在线播放视频| 一区二区理论电影在线观看| 色猫猫国产区一区二在线视频| 午夜精品久久久久久久久| 久久久国产精品不卡| 欧美亚洲一区三区| 成人黄色在线网站| 久久99精品久久久久久动态图 | 99麻豆久久久国产精品免费| 日韩高清不卡在线| 一区二区三区视频在线看| 国产亚洲综合色| 日韩一二三区视频| 欧美日韩精品专区| 色94色欧美sute亚洲线路二| 成人看片黄a免费看在线| 免费欧美在线视频| 亚洲国产精品视频| 亚洲男人的天堂一区二区| 国产亚洲短视频| 精品国产一区二区三区久久久蜜月 | 欧美日韩电影在线播放| 色婷婷综合视频在线观看| 国产精品1区2区3区| 久久精品国产亚洲一区二区三区| 偷偷要91色婷婷| 亚洲国产一二三| 亚洲一区影音先锋| 亚洲综合在线五月| 一区二区三区四区激情| 中文字幕亚洲一区二区va在线| 国产欧美一区二区三区沐欲 | 久久精品视频一区二区| 日韩女优av电影在线观看| 欧美一区二区网站| 这里只有精品电影| 在线不卡一区二区| 欧美日本一区二区在线观看| 欧美日韩一区二区三区高清| 欧美在线综合视频| 欧美性色黄大片| 欧美精品三级日韩久久| 欧美精品成人一区二区三区四区| 欧美色大人视频| 欧美日本视频在线| 欧美一卡在线观看| 亚洲精品一区二区三区精华液 | 日本韩国欧美一区二区三区| 色综合久久中文综合久久97 | 欧美在线观看视频在线| 91精品1区2区| 欧美麻豆精品久久久久久| 欧美久久久久久久久久 | 亚洲一区电影777| 日日嗨av一区二区三区四区| 日韩精品成人一区二区在线| 美女视频免费一区| 国产美女精品人人做人人爽| 成人一级片网址| 91丨porny丨户外露出| 欧美亚洲国产一卡| 欧美一区二区三区小说| 久久亚洲精精品中文字幕早川悠里| 久久免费精品国产久精品久久久久| 久久看人人爽人人| 亚洲同性同志一二三专区| 午夜精品久久久久久久久| 久久国内精品自在自线400部| 国产精品综合网| 色呦呦国产精品| 日韩视频123| 国产精品美女久久久久av爽李琼 | 91精品国产综合久久久久久| 精品国产91亚洲一区二区三区婷婷| 亚洲国产成人私人影院tom| 亚洲色图清纯唯美| 日韩av网站在线观看| 岛国精品在线播放| 欧美人牲a欧美精品| 国产婷婷色一区二区三区四区| 亚洲精品美腿丝袜| 久草在线在线精品观看| 97久久超碰国产精品电影| 日韩一卡二卡三卡国产欧美| 国产精品久久二区二区| 视频在线观看一区二区三区| 国产91丝袜在线播放0| 欧美日韩一区视频| 国产日韩精品视频一区| 日韩电影在线免费看| 成人av免费在线| 日韩欧美高清在线| 亚洲女同ⅹxx女同tv| 国产一区免费电影| 欧美日韩国产综合一区二区 | 欧美区在线观看| 国产精品久久久久久久久图文区| 免费的国产精品| 91亚洲精品乱码久久久久久蜜桃| 欧美成人精品二区三区99精品| 亚洲色图制服丝袜| 国产成人免费视频网站高清观看视频| 精品视频资源站| 综合亚洲深深色噜噜狠狠网站| 久久综合综合久久综合| 欧美日高清视频| 尤物视频一区二区| 成人99免费视频| 久久亚洲欧美国产精品乐播| 天天爽夜夜爽夜夜爽精品视频| 91在线码无精品| 国产精品嫩草影院av蜜臀| 黑人精品欧美一区二区蜜桃| 91精品国产福利在线观看| 亚洲一区二区三区中文字幕| av日韩在线网站| 亚洲国产成人在线| 成人午夜碰碰视频| 久久久久久久国产精品影院| 美女网站在线免费欧美精品| 欧美精品在线一区二区| 亚洲高清一区二区三区| 91丨九色丨蝌蚪丨老版| 中文字幕精品一区二区三区精品| 国内不卡的二区三区中文字幕 | 欧美mv和日韩mv国产网站| 亚州成人在线电影| 欧美日韩高清一区二区三区| 亚洲综合视频在线| 精品视频一区二区不卡| 亚洲在线视频一区| 欧美亚洲动漫另类| 午夜日韩在线电影| 91精品国产一区二区三区| 免费在线视频一区| 日韩视频在线你懂得| 免费看精品久久片| 久久亚洲一区二区三区明星换脸 | 国产精品美女久久久久久久久久久 | 91精品国产综合久久香蕉麻豆| 亚洲一级二级三级在线免费观看| 在线观看视频欧美| 亚洲国产日韩精品| 制服丝袜在线91| 久久爱www久久做| 国产亚洲欧美日韩在线一区| 成人激情电影免费在线观看| 亚洲婷婷在线视频| 欧美日韩在线不卡| 麻豆国产精品官网| 国产日产欧美一区| 91老司机福利 在线| 亚洲在线免费播放| 欧美一区二区三区在线看| 国产一区视频导航| 日韩一区有码在线| 欧美午夜寂寞影院| 美女国产一区二区三区| 久久久久久久久久久久电影| 99久久er热在这里只有精品66| 亚洲午夜在线视频| 精品少妇一区二区三区视频免付费| 国产伦精品一区二区三区免费| 国产精品素人一区二区| 91久久精品午夜一区二区| 日韩专区在线视频| 国产欧美日韩亚州综合 | 欧美日韩中文字幕精品| 精品一区二区在线视频| 中文字幕巨乱亚洲| 欧美日本精品一区二区三区| 国产精品99久久久久久似苏梦涵| 日韩毛片高清在线播放| 9191成人精品久久| 国产成人精品免费一区二区| 亚洲激情av在线| 精品免费99久久| 91免费国产在线| 精品在线你懂的| 亚洲黄网站在线观看| 精品99一区二区三区| 91国偷自产一区二区开放时间 | 亚洲激情综合网| 精品国产成人在线影院| 色综合久久久久久久| 精品一区二区三区不卡| 亚洲精品老司机| 国产午夜亚洲精品理论片色戒| 欧美色窝79yyyycom| 丁香一区二区三区| 午夜在线成人av| 亚洲婷婷在线视频| 久久免费的精品国产v∧| 欧美色倩网站大全免费| 不卡视频在线看| 国产一区在线不卡| 蜜芽一区二区三区| 亚洲永久精品国产| 国产精品国产三级国产普通话99| 欧美一级黄色录像|