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

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

?? aal5_sar.c

?? MPC860SAR源代碼
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*----------------------------------------------------------------------
*
* FILE:  aal5_atm.c
*
* DESCRIPTION: 
*
*  This program sets up the MPC860SAR to transmit and receive 2 
*  Frames over channel 1 using ATM Adaptation Layer #5 (AAL5).  
*
*  The user can select which SCC to use by configuring a variable,
*  SCC_num. This program uses SCC #4 by default, but the user can 
*  change SCC_num in main():
*
*  SCC_num = SCC1; uses SCC #1
*  SCC_num = SCC2; uses SCC #2
*  SCC_num = SCC3; uses SCC #3
*  SCC_num = SCC4; uses SCC #4
*
*  The user can also select how many frames and the length of the
*  frame by modifying NUM_FRAMES and FRAME_LENGTH respectively in 
*  sar.h.  Each Frame will have an incremental pattern, i.e. frame 
*  1 will have all 1's, frame 2 will have all 2's, frame 3 all 3's 
*  and so on.
*
*  The data path is internally looped back via the DIAG (Diagnostic
*  mode bits in the GSMR (General SCC Mode Register, Low). 
*
*  The transmitted data is compared to the received data. If there 
*  is an error (data mismatch) then the Ethernet LED on the ADS 860
*  board will be flashed. If the transfer of data was successful the 
*  LED will stay lit constantly.
*
*  For a high level explanation, please refer to the applications 
*  document for this example. This is included in the Zip file you 
*  received. If you are interested in a ADS 860 development/evaluation 
*  system, please contact your local sales representative.
*              
*
* NOTES  <<<IMPORTANT:  PLEASE READ>>>:
*
*     1) Specifically Designed to run on 860 ADS board.
*
*     2) DISABLE Data Cache for pages containing Rx/Tx buffers.
*
*     3) This sample code tests the transmitted information against the 
*	 received and turns on the ETH LED on the ADS board if there is 
*	 an exact match. If there is not a match, then the ETH LED will 
*	 flash.
*
*     4) If this program is run under BDM, you must first clear the 
*        EXTIE bit in the DER. Otherwise, the interrupt from the SCC 
*        will trap you back into the debugger.  You can use the following
* 	 MPC8BUG command to do this: rms der extie 0
*        
*
* REFERENCES: 
*
*      1) MPC860 Users Manual
*      2) MPC860SAR Communications Controller (Supplement to User's Manual)
*      3) PowerPC Microprocessor Family: The Programming Environments for 
*         32-Bit Microprocessors
*
* HISTORY:
*
* April 1998 jes	Initial Version. 
*-----------------------------------------------------------------------------*/

#include <string.h>
#include <stdlib.h>        
#include "netcomm.h"       /* global defines */
#include "mpc860.h"        /* IMMR definitions and declarations */
#include "sar.h"           /* Local header file */
#include "masks860.h"      /* Global masks header file */


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

EPPC  *IMMR;      /* IMMR base pointer */

UBYTE SCC_num;	  /* Variable identifying SCC to run sample on */ 

UHWORD Event_register;  /* Variable containing copy of event register */

UWORD *Ptr_int_queue; /* Interrupt queue pointer */ 

UBYTE *Received_frames;	/* Pointer to received frame buffers */
UBYTE *Frames_to_xmit;	/* Pointer to xmit frame buffers     */
UBYTE *Raw_cells;	/* Pointer to received raw cell buffers */

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

UHWORD RxGood;         /* Successful RX flag */
UBYTE  RxProcIndex;     /* keeps track of next BD to process */   
UBYTE  RxCount;		/* Received Frame Count */

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

extern UWORD ExtIntTable[];

/***********************/
/* Function Prototypes */
/***********************/
                       
void     InterruptInit(UWORD *, UWORD[]);
void     InitBDs(void);
void     InitCTs(void);
void     InitAPC(void);
void     SCC_init(void);
void     ExtIntHandler(UWORD);
void     Main(void);
void     InitBuffers(void);
UHWORD   BDEmpty(UHWORD);
UHWORD   LastBD(UHWORD);
void     Ethled(UHWORD);
void     FlashEthled(void);



/*----------------------------------------------------------------------------
*
* FUNCTION NAME:  main 
*
* DESCRIPTION:
*
*  This is the main function for the AAL5 example code.  It is responsible
*  for calling the respective initialization routines.  After all the 
*  parameters have been initialized, it waits for the receiver to achieve 
*  synchronization and then enables the APC controller, which starts the 
*  transmission of the frames.
*
* EXTERNAL EFFECT: 
*                 
* PARAMETERS:  None
*
* RETURNS: None
*
*---------------------------------------------------------------------------*/

void Main()

{

   RxGood = TRUE;   /* initialize as good (reception of frames is OK) */
   RxProcIndex = 0; /* start with the first Rx buffer                 */   
   RxCount = 0;	    /* Indicate No Frames have been received */

   Event_register = 0;	/* Clear the event register */

   UWORD mask = 0x3;  	/* Default to SCC1 mask */


   /*------------------------*/
   /* Establish IMMR pointer */
   /*------------------------*/
   
   IMMR = (EPPC *)(GetIMMR() & 0xFFFF0000);  /* MPC8xx internal register
                                                map  */

   /*------------------------*/
   /* Turn LED OFF           */
   /*------------------------*/

   Ethled(OFF);

   /*------------------------------------*/
   /* Select SCC to use for this example */ 
   /*------------------------------------*/
   SCC_num = SCC3; 

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

   InterruptInit((UWORD *) EXT_INT_VECTOR, ExtIntTable);

   /*--------------------------------------------------------------------*/
   /* First let's ensure the SCCx functions are off while we program the */
   /* buffer descriptors and the parameter ram.                          */
   /*--------------------------------------------------------------------*/

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

    IMMR->scc_regs[SCC_num].scc_gsmr_l &= ~(GSMR_L1_ENT | GSMR_L1_ENR); 

   /*------------------------------------------------------------*/
   /* Initialize and enable the selected SCC for reception/      */
   /* transmission of AAL5 type cells (SCCx is internally looped */
   /* back).                                                     */
   /*------------------------------------------------------------*/

   SCC_init();

   InitBuffers(); /* Initialize contents of Rx & Tx Buffers (frames) */

   InitCTs(); /* Initialize the Connection Tables */

   InitBDs(); /* Initialize RX and TX BDs */

   InitAPC(); /* Initialize ATM Pace Controller & Timers */ 
  
   /*-------------------------------------------------------------*/
   /* Set the ENT/ENR bits in the GSMR -- Enable Transmit/Receive */
   /* and internal loopback                                       */ 
   /*-------------------------------------------------------------*/

   IMMR->scc_regs[SCC_num].scc_gsmr_l |= GSMR_L1_ENT | GSMR_L1_ENR; 

   IMMR->scc_regs[SCC_num].scc_gsmr_l |= GSMR_L1_INT_LB;

   /* 
    * Now that we've enabled the transmitter, receiver and loopback
    * wait until the reciever has achieved synchronization and gained 
    * cell delineation. 
   */ 

   while((!(Event_register & SAR_SERIAL_SCCE_SYNC)) && 
           (!(IMMR->PRAM[SCC_num].sar.astatus & 0x1)));

   /* 
    * OK, everything has been initialized.  Lets get things 
    * started by enabling Timer 4 (starts ATM pace controller)
   */ 

   IMMR->timer_tgcr |= 0x1000;

   /*----------------------------------------------------------------------*/
   /* Issue SAR_ACT_XMIT_CHAN (activate transmit channel) command to the   */
   /* CP.								   */
   /*----------------------------------------------------------------------*/

   while ((IMMR->cp_cr & CPCR_FLG) != READY_TO_RX_CMD); 

   /* Select the channel number in SCC Parameter RAM */
   IMMR->PRAM[SCC_num].sar.comm_ch = 0x1;

   IMMR->cp_cr = CPCR_SAR_CMD | SAR_ACT_XMIT_CHAN |
                 (0x40 * SCC_num) | 
                 CPCR_FLG;              /* ISSUE COMMAND */

   /* Wait for the CPM to finish executing command */
   while ((IMMR->cp_cr & CPCR_FLG) != READY_TO_RX_CMD); 

   /*------------------------------------------------------------------*/
   /* Come in to the loop and wait until all frames have been sent and */
   /* received. The Ethernet LED on the ADS board will stay lit until  */
   /* all frames have been received and checked. If there were any     */
   /* errors the LED will flash. This action is initiated in the       */
   /* interrupt handler where the checking takes place.                */
   /* 								       */
   /* NOTE:  If you are using the SDS Monitor, set a break point at    */
   /*        the Ethled(ON) line in the while(1) loop below.  SDS will */
   /*        will not respond to the STOP if it reaches the while()    */
   /*        loop.                    				       */
   /*------------------------------------------------------------------*/

   while (1) 
   
   {

      /*-----------------------------------------------------------------*/
      /* stay in this tight loop if the transfer of data was successful. */
      /* If there wasn't success, stay in a tight loop in the external   */
      /* interrupt handler.                                              */
      /*-----------------------------------------------------------------*/

      while ((RxGood == TRUE) && (RxCount == NUM_FRAMES))  

      {
         /*-------------------------------------------------------*/
         /* Turn On Ethernet LED to indicate error-free reception */
         /*-------------------------------------------------------*/

         IMMR->timer_tgcr &= 0xEFFF;   /* Test done, disable APC */
         Ethled(ON);
      }
   }

}  /* End Main */

/*-----------------------------------------------------------------------------
*
* FUNCTION NAME:  InitCTs
*
*
* DESCRIPTION:
*
*  Initializes the transmit and receive Connection Tables (CTs).  For this 
*  example, 2 sets of CTs are initialized. The raw cell Connection Table and 
*  Ch 1 connection table. The RISC Timer (for time stamp) is also initialized
*  by this function.
*
* EXTERNAL EFFECTS: Initialize CTs in DPR.
*
* PARAMETERS: None
*
* RETURNS: None
*
*-----------------------------------------------------------------------------*/

void InitCTs()
{

   /* Temp pointers used by this function */

   UWORD *ptr_word, *ptr_word2;
   UHWORD *ptr_start;
   UBYTE *ptr_char; 

   struct timer_pram *ptr_risc_timer;	/* Pointer to RISC timer */

   Ct *ptr_ct;	/* Temp pointer to connection tables */

   Cell_header_xmit header_xmit;  /* Little endian cell header */
   Cell_header_rcv header_rcv;;   /* Big endian cell header */


   /*-------------------------------------------------------------------*/
   /* Initialize the Receive/Transmit Conncetion Tables (CT)            */
   /*-------------------------------------------------------------------*/

   ptr_char = (UBYTE *)(IMMR->udata_bd_ucode) + 
              IMMR->PRAM[SCC_num].sar.ctbase;

   ptr_ct = (Ct *)(ptr_char);	/* Get starting address of CT */

   /* Initialize the raw cell RCT/TCT entry (channel 0) */

   ptr_ct->r_status = 0x0;
   ptr_ct->rbalen = 0; 
   ptr_ct->rcrc = 0; 
   ptr_ct->rb_ptr = 0; 
   ptr_ct->tstamp = 0; 

   ptr_ct->rbase = (UHWORD)(RAW_RBD_ADDR >> 2);
   ptr_ct->rbd_ptr = ptr_ct->rbase; 

   /*************************************************************/
   /* For this example the only event we care about is the BSY  */
   /* event (BUSY), which indicates there are no raw cell buf-  */
   /* fer available.                                            */
   /*************************************************************/

   ptr_ct->imask = 0x0004; 

   ptr_ct->rtmlen = 0; 

   ptr_ct->t_status = 0x0;
   ptr_ct->tbalen = 0x0;
   ptr_ct->tcrc = 0;
   ptr_ct->ttmlen = 0;
   ptr_ct->tb_ptr = 0;
   ptr_ct->tbase = 0;
   ptr_ct->tbd_ptr = 0; 

   ++ptr_ct; 

   /*----------*/
   /* RCT init */ 
   /*----------*/

   /* Configure this as an AAL5 Type Connection */
   ptr_ct->r_status = 0x0001;

   ptr_ct->rbalen = 0; 
   ptr_ct->rcrc = 0; 
   ptr_ct->rb_ptr = 0; 
   ptr_ct->tstamp = 0; 

   /* Initialize the offset from the start of the RBD memory */
   /* where this channel's BD list starts                    */
   ptr_ct->rbase = (UHWORD)(RBD_ADDR >> 2);

   /* Initialize the BD pointer to the base offset (beginning of BD list */
   ptr_ct->rbd_ptr = ptr_ct->rbase; 

   /*************************************************************/
   /* Interrupt on the following events: Transmit Buffer and    */
   /* Receive Frame.                                            */
   /*************************************************************/

   /* Enable Channel 1 interrupts */
   ptr_ct->imask = 0x000A; 

   /* Initialize the receive buffer count to zero */ 
   ptr_ct->rtmlen = 0; 

   /*----------*/
   /* TCT init */ 
   /*----------*/

   /* Configure this as an AAL5 Type Connection */
   ptr_ct->t_status = 0x0001;

   /****************************************************/
   /* The transmit buffer available lenght is initia-  */
   /* lized to a known value.  NOTE: This is not re-   */
   /* quired, it was done as a debugging tool. If the  */
   /* transmitter is working, this parameter will be   */
   /* zero when it is done transmitting.               */
   /****************************************************/

   ptr_ct->tbalen = 0xDEAD;

   /* Initialize the offset from the start of the TBD memory */
   /* where this channel's BD list starts                    */
   ptr_ct->tbase = (UHWORD)(TBD_ADDR >> 2);

   /* Initialize the BD pointer to the base offset (beginning of BD list */
   ptr_ct->tbd_ptr = ptr_ct->tbase; 

   /* Initialize Cell Header to be used whith this channel */

   header_rcv.gfc = header_xmit.gfc = 0; 	/* Initialize GFC to zero */
   header_rcv.vpi = header_xmit.vpi = 0; 	/* Initialize VPI */ 
   header_rcv.vci = header_xmit.vci = 0x060; 	/* Initialize VCI */ 
   header_rcv.pti = header_xmit.pti = 0; 	/* Initialize PTI */ 
   header_rcv.clp = header_xmit.clp = 0; 	/* Initialize CLP */ 

   ptr_word = (UWORD *)&header_xmit; 

   /* Write the header to the TCT */
   ptr_ct->chead = *ptr_word; 

   /* Initialize APC Link to indicate that, initially, this is an */
   /* idle channel.                                               */

   ptr_ct->apcl = 0xFFFF; 

   /* Initialize the APC remainder to zero */

   ptr_ct->apcpr = 0; 

   /* Set APC Pace to 1 and fraction to zero */

   ptr_ct->apcp = 1; 
   ptr_ct->apcpf = 0; 

   /*-----------------------------------------------------------------*/
   /* Now, initialize the Address pointing table.  This table points  */
   /* to the corresponding RCT of the received cell.                  */ 
   /*-----------------------------------------------------------------*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久女同性恋中文字幕| 精品欧美乱码久久久久久 | 国产麻豆91精品| 色香蕉成人二区免费| 精品免费国产二区三区| 一区二区三区中文字幕精品精品 | 激情另类小说区图片区视频区| 成人va在线观看| 精品久久久久久久久久久久久久久| 亚洲欧美日韩系列| 国产69精品一区二区亚洲孕妇| 欧美日韩免费电影| 亚洲免费观看视频| 成人动漫av在线| 久久精品视频在线免费观看| 免费人成精品欧美精品| 欧美性猛交xxxx乱大交退制版| 国产精品美女久久久久久久久久久 | 午夜精品久久一牛影视| 日本二三区不卡| 亚洲欧美在线观看| 国产成人综合视频| 国产日韩欧美精品在线| 国产露脸91国语对白| 欧美v国产在线一区二区三区| 日韩av在线免费观看不卡| 欧美日韩成人一区| 日欧美一区二区| 在线不卡的av| 日韩av中文字幕一区二区| 欧美一级片在线观看| 免费三级欧美电影| 亚洲精品一区二区在线观看| 久久99精品一区二区三区| 欧美成人乱码一区二区三区| 久久电影国产免费久久电影| 日韩欧美国产一区在线观看| 激情欧美日韩一区二区| 久久精品视频免费| 成人av小说网| 亚洲美女屁股眼交| 欧美精品tushy高清| 美女性感视频久久| 久久精品水蜜桃av综合天堂| 99免费精品在线| 亚洲第一在线综合网站| 欧美一区二区三区四区在线观看 | 久久精品国产久精国产| 精品免费视频.| 懂色av一区二区在线播放| 亚洲天堂a在线| 欧美日韩久久久一区| 麻豆国产91在线播放| 国产婷婷色一区二区三区| 99久精品国产| 丝瓜av网站精品一区二区| 精品国产91久久久久久久妲己 | 国产suv精品一区二区三区| 国产精品美女久久久久高潮| 色综合夜色一区| 蜜臀久久99精品久久久久久9 | 91福利在线播放| 麻豆成人综合网| 中文字幕在线播放不卡一区| 欧美日韩亚洲另类| 国产不卡免费视频| 亚洲mv大片欧洲mv大片精品| 国产亚洲精品aa| 欧美日韩午夜在线| 国产盗摄一区二区三区| 亚洲午夜三级在线| 久久精品一级爱片| 欧美日韩和欧美的一区二区| 国产精品18久久久久| 天天色 色综合| 国产精品久久久久久久岛一牛影视 | 久久久蜜桃精品| 欧美日韩国产区一| 北条麻妃国产九九精品视频| 日韩精品五月天| 亚洲欧美另类久久久精品2019| 欧美成人一区二区三区| 欧美一a一片一级一片| 成人手机电影网| 九色|91porny| 亚洲成人黄色小说| 亚洲另类春色校园小说| 久久久五月婷婷| 亚洲精品一区二区三区精华液| 日本韩国欧美在线| 懂色中文一区二区在线播放| 老司机午夜精品| 午夜不卡av免费| 亚洲夂夂婷婷色拍ww47| 国产精品久久久久久久蜜臀| 日韩免费视频一区| 777亚洲妇女| 欧美视频一区二区三区四区| 91小视频免费观看| 粉嫩嫩av羞羞动漫久久久 | 国产精品网站导航| 久久欧美中文字幕| 欧美精品一区二区三区蜜桃 | 国产精品一区二区免费不卡| 免费在线看成人av| 免费欧美高清视频| 麻豆91在线观看| 久久精品国产999大香线蕉| 肉肉av福利一精品导航| 五月婷婷色综合| 首页国产欧美日韩丝袜| 午夜精品在线看| 丝袜美腿高跟呻吟高潮一区| 日韩电影一区二区三区| 日韩国产精品久久久久久亚洲| 亚洲电影在线播放| 亚洲va天堂va国产va久| 五月天欧美精品| 日本美女一区二区三区视频| 毛片av中文字幕一区二区| 麻豆专区一区二区三区四区五区| 日韩电影在线一区二区| 捆绑调教一区二区三区| 久久国产三级精品| 国产电影一区在线| 99久久精品免费观看| 欧美视频一区在线| 日韩一级片在线播放| 精品国产91亚洲一区二区三区婷婷 | 视频一区二区不卡| 久久9热精品视频| 国产精品1区2区3区在线观看| 菠萝蜜视频在线观看一区| 97久久精品人人爽人人爽蜜臀| 色又黄又爽网站www久久| 欧美日韩国产区一| 久久久99免费| 亚洲精品国久久99热| 天天综合网 天天综合色| 国内外成人在线视频| fc2成人免费人成在线观看播放| 色猫猫国产区一区二在线视频| 在线成人免费观看| 国产精品五月天| 日日摸夜夜添夜夜添国产精品 | 久久激情综合网| 99视频精品在线| 欧美一级午夜免费电影| 国产精品美女久久久久久2018 | 亚洲国产视频网站| 狠狠色综合日日| 在线亚洲高清视频| 日韩精品中文字幕一区二区三区| 国产精品网站在线观看| 奇米色一区二区| 一本大道av伊人久久综合| 欧美一级爆毛片| 亚洲黄色尤物视频| 国产乱码精品一区二区三区忘忧草 | 久久精品欧美日韩精品| 亚洲观看高清完整版在线观看| 国产在线精品一区二区| 欧美性猛交xxxx黑人交 | 国产日韩成人精品| 视频一区欧美精品| 色婷婷av一区二区三区之一色屋| 精品理论电影在线| 天堂成人免费av电影一区| 99天天综合性| 中文字幕欧美激情| 极品少妇一区二区| 欧美高清视频www夜色资源网| 中文字幕在线视频一区| 蜜臂av日日欢夜夜爽一区| 欧美日韩国产a| 一区二区三区中文字幕电影| 成人自拍视频在线观看| 26uuu国产在线精品一区二区| 亚洲成人7777| 在线观看日韩精品| 亚洲欧美一区二区三区极速播放| 精品在线观看视频| 欧美一区二区免费视频| 亚洲大片在线观看| 色欧美片视频在线观看 | 日本黄色一区二区| 亚洲免费资源在线播放| 91日韩在线专区| 国产精品久久福利| 丰满亚洲少妇av| 中文在线免费一区三区高中清不卡| 久久国产尿小便嘘嘘尿| 日韩你懂的在线观看| 蜜臀久久99精品久久久久久9| 欧美精品三级日韩久久| 午夜久久久久久电影| 在线播放91灌醉迷j高跟美女| 亚洲成人1区2区| 91麻豆精品国产无毒不卡在线观看| 性做久久久久久|