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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ethernet.c

?? 網口收發程序
?? C
?? 第 1 頁 / 共 3 頁
字號:

/*--------------------------------------------------------------------------                            
*
* FILE: ethernet.c
*
* DESCRIPTION: 
*
*  Exercises SCC1 Ethernet transmit/receive functions, using RX interrupts. 
*  This program sends 8 Ethernet frames, with each frame containing a 
*  different data pattern. SCC1 will receive all 8 frames and then vector 
*  to the external interrupt. In this interrupt, all 8 Rx frames will be 
*  checked against it's corresponding Tx frame. It also checks for Rx 
*  errors. If any errors or mismatches exist then red GPL2 on the ADS 
*  board will be lit. If the transfer of data was successful the green 
*  signalling GPL1 on the ADS board will stay lit constantly.
*
*  For a complete high level explanation, please refer to the applications 
*  document for this example which is included in the .zip file you received.
*  If you are interested in a MPC8272ADS development/evaluation 
*  system, please contact your local sales representative.
*              
* NOTES  <<<IMPORTANT:  PLEASE READ>>>:
*
*     1) Specifically Designed to run on MPC8272ADS board.
*
*     2) Make sure that data and BDs are either in global (snooped) areas
*        of memory or that data cache is disabled for that area.
*
*     3) Using the internal loopback Mode, the driver tests the transmitted 
*        information against the received and turns on the green GPL1 on 
*        the ADS board if there is an exact match. If there is not a 
*        match, then the red GPL2 on the ADS board will be lit.
*
*     4) This driver also takes an external interrupt on a full ethernet
*        packet reception.  If the interrupt handler does not see Received
*        Full status (RXF) in the SCC Event register i.e. an unanticapted
*        external interrupt occurs other then SCC1 the red GPL2 on the 
*        ADS board will flash to signal an error condition.
*
*
* REFERENCES: 
*
*      1) MPC8272 Users Manual
*      2) MPC603e Users Manual
*      3) PowerPC Microprocessor Family: The Programming Environments for
*         32-bit Microprocessors
*      
*
* HISTORY:
*
* 07 JAN 99  pdw        Initial Version. Created from 860 SCC Example
* 10 FEB 99  pdw        Updated ISR and re-tested on 8260 VADS board.
* 23 NOV 99  jms        Modified code for PILOT Rev boards.  The code now reads
*                       BCSR2 for the board revision and then chooses the correct
*                       bit positionings for BCSR0 and BCSR1. 
* 24 JUN 04  ddc  	Modified code to run in MPC8272 environment, and removed
*						revision modifications
*-------------------------------------------------------------------------*/

#include <string.h>
#include <stdlib.h>        
#include "netcomm.h"        /* global defines                   */
#include "mpc8260.h"        /* IMM definitions and declarations */
#include "ethernet.h"       /* Local header file                */
#include "masks8260.h"      /* Global mask header file          */


/***********************/
/* Global Declarations */
/***********************/

t_PQ2IMM *IMM;         /* Internal memory map base pointer */
BDRINGS *RxTxBD;       /* buffer descriptors base pointer  */

t_BCSR *CSR;

/*-----------------------------------------------*/
/* Set of Data Buffers for Ethernet transmit and */
/* receive data.                                 */
/*-----------------------------------------------*/

TXB TxBufferPool[NUM_TXBDS];
RXB RxBufferPool[NUM_RXBDS];

/*---------------------------------------------------------*/
/* Status parameters of the receive and transmit processes */
/*---------------------------------------------------------*/

UHWORD RxGood;        /* Successful RX flag                */
UBYTE  RxProcIndex;   /* Used in Interrupt Hnadler */    
UBYTE  NotDone;          /* Not done processing all eight frames */     

/*-----------------------------------------------------*/
/* Interrupt Handler Code to be moved to Address 0x500 */
/*-----------------------------------------------------*/

extern UWORD ExtIntTable[];

/***********************/
/* Function Prototypes */
/***********************/
		       
void     InterruptInit(UWORD *, UWORD[]); 
void     InitBDs(void); 
void     InitParallelPorts(void);
void     InterruptControlInit(void);
void     SCC1EtherInit(void);
void     ExtIntHandler(UWORD); 
void     main(void);
void     LoadTxBuffers(void);
UHWORD   BDEmpty(UHWORD); 
UHWORD   LastBD(UHWORD);
void     Led(UHWORD);
void     FlashLed(void);




/*--------------------------------------------------------------------------
*
* FUNCTION NAME:  main 
*
* DESCRIPTION:
*
*  Main function for PQ2 Ethernet example code.
*
* EXTERNAL EFFECT: 
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*-------------------------------------------------------------------------*/

void main()

{

   RxGood = TRUE;   /* Successful RX flag */
   NotDone = TRUE;  /* Not Done processing all eight ethernet frames/BDs */
   RxProcIndex = 0; /* Used in the interrupt handler */
   
   /*------------------------------------*/
   /* Establish IMM pointer at 0x4700000 */
   /*------------------------------------*/
      
   IMM =  (t_PQ2IMM *)(0x4700000);
   CSR = (t_BCSR *)(IMM->mem_regs[1].memc_br & 0xFFFF8000);

   /*---------------------------*/
   /* Turn Off Green & Red LEDs */
   /*---------------------------*/

   
   Led(OFF);
  

   /*--------------------------------------------------------*/
   /* Place External Interrupt Handler Code to Address 0x500 */
   /*--------------------------------------------------------*/

   InterruptInit((UWORD *) EXT_INT_VECTOR, ExtIntTable); 

   /***********************************************************/
   /* Establish base pointer for Tx and Rx buffer descriptors */
   /* Get pointer to BD area in DPRAM                         */
   /***********************************************************/   
   
   RxTxBD = (BDRINGS *)(BASE_OF_BDS);    

   /*------------------------------------------------*/
   /* Load the Tx buffer pool with the test patterns */
   /*------------------------------------------------*/

   LoadTxBuffers();

   /*-------------------------------------------------------------------*/
   /* This function defines a number of buffers for an RX and TX buffer */
   /* pool, but does not attempt to manage memory.  It uses the first   */
   /*  half of the BD pool for RX and the second half for TX.           */ 
   /*-------------------------------------------------------------------*/
   
   InitBDs(); /* Initialize RX and TX BDs */

   /*----------------------------------------*/
   /* Initialize the parallel port I/O ports */
   /*----------------------------------------*/

   InitParallelPorts(); 


   /*------------------------------------------*/
   /* Initialize Interrupt Controller for SCC1 */
   /*------------------------------------------*/

   InterruptControlInit();   
  

   /*--------------------------------------------------*/
   /* Setup BRG clock,  Initialize and enable SCC1 for */
   /* Ethernet operation in internal loopback mode     */
   /*--------------------------------------------------*/

   SCC1EtherInit();


   /*------------------------------------------------------------------*/
   /* Come in to the loop and wait until all frames have been sent and */
   /* received. The green general purpose LED GP0 on the ADS           */
   /* board will stay lit until  all frames have been received and     */
   /* checked. If frames are not received properly then the  red       */
   /* general purpose LED GP1 will be lit. If an interrupt external to */
   /* to SCC1 is received the red  general purpose LED GP1 will be     */
   /* flashed. This action is initiated in the interrupt handler where */
   /* the checking takes place.                                        */
   /*------------------------------------------------------------------*/

while (NotDone);   /* Spin here until reception is done */
   
   /*---------------------------------------------------------------------*/
   /* All eight frames were successfully received. Illuminate General     */
   /* Signalling LED #0 green.                                            */
   /*---------------------------------------------------------------------*/

     
      while (1)  

      {
	 /*--------------------------------------*/
	 /* Turn ON Green general purpose LED GP0 */
	 /* to indicate error-free reception     */
	 /*--------------------------------------*/

       Led(GREEN);

      }


}  /* End Main */


/*--------------------------------------------------------------------------
*
* FUNCTION NAME:  InitBDs
*
*
* DESCRIPTION:
*
*  Initializes BD rings to point RX BDs to first half of buffer pool and 
*  TX BDs to second half of buffer pool. This function also initializes the 
*  buffer descriptors control and data length fields. It also insures that 
*  transmit and recieve functions are disabled before buffer descriptors 
*  are initialized.
*
*   
* EXTERNAL EFFECTS: Disable Tx/Rx functions. Changes BDs in dual port ram.
*
* PARAMETERS: None
*
* RETURNS: None
*
*-------------------------------------------------------------------------*/

void InitBDs()

{
   
   UHWORD index;

   /*********************************************/
   /* Disable SCC1 while we program the buffer  */
   /* descriptors                               */
   /*********************************************/

   /*----------------------------------------------------------------*/
   /* Clear the ENT/ENR bits in the GSMR -- disable Transmit/Receive */
   /*----------------------------------------------------------------*/

    IMM->scc_regs[SCC1].gsmr_l &= DISABLE_TX_RX;

   /*--------------------------------------*/
   /* Issue Init Stop TX Command for SCC1. */
   /*--------------------------------------*/

   while ((IMM->cpm_cpcr & CPCR_FLG) != READY_TO_RX_CMD); 

	IMM->cpm_cpcr = CPCR_STOP_TX |
		 SCC1_PAGE_SUBBLOCK | 
		 CPCR_FLG;              /* ISSUE COMMAND */

   while ((IMM->cpm_cpcr & CPCR_FLG) != READY_TO_RX_CMD); 


   /*-------------------*/
   /* Initialize RxBDs. */
   /*-------------------*/

   for (index = 0; index < NUM_RXBDS; index++) 
    
   {
      /*--------------------------*/
      /* Allocate Receive Buffers */
      /*--------------------------*/

      RxTxBD->RxBD[index].bd_addr = (UBYTE *)&RxBufferPool[index];
      RxTxBD->RxBD[index].bd_length = 0;             /* reset */

      if( index != (NUM_RXBDS-1) )

      {
		 RxTxBD->RxBD[index].bd_cstatus = 0x8000;    /* Empty */
      }

      else

      {
	   /*-----------------------------------------------------*/
	   /* Last RX BD. Set the Empty, Wrap, and Interrupt bits */
	   /*-----------------------------------------------------*/

	   RxTxBD->RxBD[index].bd_cstatus = 0xB000;  
      }
   }

   /*-------------------*/
   /* Initialize TxBDs  */
   /*-------------------*/

   for (index=0; index < NUM_TXBDS; index++) 
   
   {
      /*------------------------*/
      /* load the buffer length */
      /*------------------------*/

      RxTxBD->TxBD[index].bd_length = (TX_BUFFER_SIZE-4); 

      /*--------------------------------------------------------*/
      /* load the address of the data buffer in external memory */
      /*--------------------------------------------------------*/

      RxTxBD->TxBD[index].bd_addr = (UBYTE *)&TxBufferPool[index];

      /*------------------------------------------*/
      /* If this is not the final BD in the table */
      /*------------------------------------------*/

      if( index != (NUM_TXBDS-1) )   

      {
		/*-------------------------------*/
		/* Set Ready, PAD, Last, TC bits */
		/*-------------------------------*/

		RxTxBD->TxBD[index].bd_cstatus = 0xCC00;     
      }

      /*------------------------------------------------------- */
      /*  If this is the final BD in the table set the WRAP bit */
      /*------------------------------------------------------- */ 

      else 
      {
	 /*-----------------------------------------*/
	 /* Set Ready, PAD, Wrap, Last, and TC bits */
	 /*-----------------------------------------*/

		 RxTxBD->TxBD[index].bd_cstatus = 0xEC00;     
      }
   }


} /* end InitBDs */


/*-------------------------------------------------------------------------
*
* FUNCTION NAME:  LoadTxBuffers
*
*                       
* DESCRIPTION:
*
*  This function loads all 8 Tx buffers with Ethernet header 
*  information, followed by the following data patterns:
*
*     Buffer 0: 0x55
*     Buffer 1: 0xAA
*     Buffer 2: 0x00
*     Buffer 3: 0xFF
*     Buffer 4: Increasing Walking Ones
*     Buffer 5: Decreasing Walking Ones
*     Buffer 6: Increment from 0
*     Buffer 7: Decrement from 255
*
*       The Tx buffers are initialized as shown:
*
*                   |             |              |
*        DEST ADDR  | SOURCE ADDR |  TYPE\LENGTH |    DATA
*        (6 bytes)  |  (6 bytes)  |   (2 bytes)  | (238 bytes)
*
*  This results in a total of 252 bytes. Ethernet's 32-bit CRC is 
*  transmitted after the last data byte, so the Rx buffers receive 
*  252 + 4 = 256 bytes.                                                                                                  
*
* EXTERNAL EFFECTS:
*
*  BufferPool
*
* PARAMETERS: none
*
*  RETURNS: none
*
*-------------------------------------------------------------------------*/

void  LoadTxBuffers()

{

   UHWORD   index, pattern, bufcount;

   /*---------------------------------------------------*/
   /* Load buffers 0 through 3 with the following data  */
   /* patterns:                                         */
   /*                                                   */
   /* Buffer[0] = 0x55                                  */
   /* Buffer[1] = 0xAA                                  */
   /* Buffer[2] = 0x00                                  */
   /* Buffer[3] = 0xFF                                  */
   /*---------------------------------------------------*/
    
   for (index = 12; index < (TX_BUFFER_SIZE-4); index++)

   {
	 TxBufferPool[0][index] = 0x55;
	 TxBufferPool[1][index] = 0xAA;
	 TxBufferPool[2][index] = 0x00;
	 TxBufferPool[3][index] = 0xFF;          
   }     
 

   /*-----------------------------------------*/
   /* Buffer[4]: Load increasing walking ones */
   /*-----------------------------------------*/
 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩视频免费观看高清完整版在线观看 | 欧美男女性生活在线直播观看| 国产精品国产三级国产三级人妇 | 欧美一区欧美二区| 久久精品久久久精品美女| 精品免费国产二区三区| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 盗摄精品av一区二区三区| 成人欧美一区二区三区1314| 91久久精品网| 日韩av不卡在线观看| 亚洲精品一区二区三区精华液| 国产精品资源在线| 亚洲精品视频在线看| 在线播放亚洲一区| 激情都市一区二区| 成人免费一区二区三区在线观看| 色综合久久综合网欧美综合网 | 日韩不卡一区二区三区| 2019国产精品| 91色porny在线视频| 污片在线观看一区二区| 久久精品欧美一区二区三区麻豆| 99久久精品免费精品国产| 婷婷六月综合亚洲| 国产精品丝袜久久久久久app| 欧美影院一区二区三区| 国产一区二区伦理| 亚洲成a人v欧美综合天堂| 精品国一区二区三区| 色香蕉久久蜜桃| 久久97超碰色| 亚洲国产精品久久人人爱蜜臀| 亚洲精品一区二区三区福利 | 日韩精品电影在线| 国产日韩精品一区二区三区在线| 欧亚一区二区三区| 国产福利不卡视频| 天天综合色天天综合| 国产精品麻豆视频| 日韩限制级电影在线观看| 99re成人精品视频| 国产精品996| 午夜精品福利视频网站| 亚洲三级久久久| 久久久精品国产免大香伊| 精品视频一区三区九区| caoporn国产精品| 久久99久久99| 天天影视色香欲综合网老头| 亚洲女同一区二区| 日本一区二区三区国色天香 | gogogo免费视频观看亚洲一| 国产综合成人久久大片91| 亚洲成av人综合在线观看| 亚洲日本在线观看| 国产精品热久久久久夜色精品三区| 日韩西西人体444www| 欧美男男青年gay1069videost | 在线播放国产精品二区一二区四区 | 精品一区二区综合| 日韩1区2区3区| 性感美女极品91精品| 亚洲美女精品一区| 综合电影一区二区三区 | 韩国三级在线一区| 日本91福利区| 日韩精品五月天| 亚洲精品菠萝久久久久久久| 一区精品在线播放| 国产精品久久久久9999吃药| 国产校园另类小说区| 88在线观看91蜜桃国自产| 国产99久久久久久免费看农村| 日日噜噜夜夜狠狠视频欧美人 | 在线观看欧美精品| 欧日韩精品视频| 欧美视频日韩视频| 欧美亚一区二区| 欧美在线观看你懂的| 在线观看亚洲成人| 7777精品伊人久久久大香线蕉的 | 欧美电影一区二区三区| 欧美精品久久久久久久久老牛影院| 欧美午夜精品久久久| 欧美日韩极品在线观看一区| 精品一区二区免费看| 日韩二区三区在线观看| 一区二区成人在线| 一区二区不卡在线视频 午夜欧美不卡在| ㊣最新国产の精品bt伙计久久| 最新不卡av在线| 亚洲精品你懂的| 视频一区二区三区中文字幕| 日日摸夜夜添夜夜添精品视频| 男男成人高潮片免费网站| 经典一区二区三区| 国产69精品久久久久毛片| 99久久免费国产| 欧美这里有精品| 91精品免费观看| 精品久久久久一区二区国产| 欧美国产在线观看| 亚洲激情自拍偷拍| 日韩av高清在线观看| 国产成人精品午夜视频免费| 99久久综合国产精品| 欧美撒尿777hd撒尿| 日韩免费电影网站| 国产精品久久久一本精品| 一区二区国产盗摄色噜噜| 欧美精品亚洲一区二区在线播放| 久久久国产精品午夜一区ai换脸| 久久一区二区三区国产精品| 国产欧美综合在线| 亚洲欧美一区二区久久| 热久久久久久久| 粉嫩嫩av羞羞动漫久久久| 精品视频123区在线观看| 精品久久国产老人久久综合| 亚洲丝袜美腿综合| 男男视频亚洲欧美| 一本一道波多野结衣一区二区| 91精品欧美久久久久久动漫| 国产精品国产三级国产普通话三级| 亚洲午夜激情网页| 国产成人在线网站| 337p亚洲精品色噜噜噜| 国产精品久久免费看| 亚洲午夜久久久久久久久久久 | 另类小说视频一区二区| 一道本成人在线| 国产日韩欧美亚洲| 秋霞影院一区二区| av不卡免费电影| 精品日韩99亚洲| 欧美精品在线观看播放| 久久久久久久综合狠狠综合| 一区二区三区国产| 国产一区二区福利| 欧美日韩在线综合| 亚洲欧美综合另类在线卡通| 国产精品一区2区| 91精品国产色综合久久不卡蜜臀| 国产精品国产a级| 国产精品一区二区久激情瑜伽| 欧美老肥妇做.爰bbww| 亚洲黄网站在线观看| 成人h精品动漫一区二区三区| 日韩欧美久久一区| 丝袜a∨在线一区二区三区不卡| 高清不卡一区二区| 久久综合狠狠综合久久激情| 美女看a上一区| 欧美一区永久视频免费观看| 午夜精品久久久久久久久久 | 亚洲精品日韩专区silk| 99热这里都是精品| 亚洲欧洲日本在线| 成人99免费视频| 国产精品国产自产拍高清av王其 | 欧美精品一区二区三区蜜桃| 亚洲r级在线视频| 欧美日韩亚洲高清一区二区| 一区二区视频在线| 日本久久一区二区| 亚洲日本青草视频在线怡红院| 99riav久久精品riav| 亚洲色图.com| 欧美视频在线一区二区三区| 亚洲一区二区偷拍精品| 欧美日韩高清一区二区三区| 婷婷成人综合网| 日韩欧美电影一区| 国产成人亚洲综合a∨婷婷| 国产婷婷色一区二区三区四区 | 亚洲色图欧美在线| 欧美影片第一页| 丝袜a∨在线一区二区三区不卡 | 久久久国产精品麻豆| 国产风韵犹存在线视精品| 中文字幕在线视频一区| 色综合一个色综合亚洲| 亚洲午夜电影网| 欧美一区永久视频免费观看| 韩国精品主播一区二区在线观看| 国产三区在线成人av| 99麻豆久久久国产精品免费 | 日韩精品一二三| 精品毛片乱码1区2区3区| 国产精一区二区三区| 亚洲欧洲日韩综合一区二区| 91福利精品视频| 日本免费在线视频不卡一不卡二 | 91在线观看高清| 视频一区欧美精品| 中文字幕第一区二区| 欧美最猛黑人xxxxx猛交| 精品一区二区三区欧美| 亚洲视频一区二区在线|