亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美国产欧美综合| 亚洲精选一二三| 色综合色综合色综合| 日韩av中文字幕一区二区| 精品播放一区二区| 在线看不卡av| 成人久久视频在线观看| 九九精品视频在线看| 一区二区三区免费观看| 国产亚洲一区二区三区在线观看 | 亚洲欧洲成人精品av97| 欧美一区国产二区| 色素色在线综合| 成人不卡免费av| 国产乱子伦一区二区三区国色天香| 亚洲夂夂婷婷色拍ww47| 国产精品高潮久久久久无| www成人在线观看| 欧美一卡二卡在线| 欧美男人的天堂一二区| 色综合久久中文综合久久97| 国产成人av一区二区| 免费观看一级欧美片| 亚洲bt欧美bt精品| 夜夜精品视频一区二区| 综合久久国产九一剧情麻豆| 欧美国产日本视频| 国产欧美日韩综合精品一区二区| 7777精品伊人久久久大香线蕉超级流畅 | 精品播放一区二区| 欧美一级搡bbbb搡bbbb| 欧美久久久影院| 欧美性大战久久久久久久| 色婷婷亚洲精品| 一本大道久久a久久精品综合| 91精品国产乱| 4438x成人网最大色成网站| 欧美日韩在线播放一区| 欧美无乱码久久久免费午夜一区 | 91麻豆高清视频| 91在线看国产| 色诱视频网站一区| 欧美在线你懂的| 欧美日韩精品一区二区| 欧美精品tushy高清| 欧美一区二区二区| 欧美电视剧在线观看完整版| 日韩精品专区在线影院观看| 精品久久人人做人人爰| 精品国产91久久久久久久妲己 | 成人综合激情网| av不卡免费电影| 一本色道亚洲精品aⅴ| 在线观看日韩毛片| 欧美日韩中文字幕精品| 91精品国产美女浴室洗澡无遮挡| 日韩欧美在线综合网| 2021中文字幕一区亚洲| 中文子幕无线码一区tr| 亚洲丝袜精品丝袜在线| 视频一区二区欧美| 精品一区二区三区免费毛片爱| 黄色日韩网站视频| 99re这里只有精品6| 欧洲一区二区三区免费视频| 777午夜精品免费视频| 精品国产免费久久| 专区另类欧美日韩| 日韩国产精品91| 成人三级在线视频| 88在线观看91蜜桃国自产| 久久精品人人做人人综合| 亚洲欧美日韩精品久久久久| 日韩成人dvd| 不卡视频一二三| 91精品国产一区二区三区| 久久精品一级爱片| 樱花草国产18久久久久| 精品在线观看免费| 91女神在线视频| 精品区一区二区| 亚洲精品菠萝久久久久久久| 奇米一区二区三区av| eeuss鲁片一区二区三区在线看| 欧美色倩网站大全免费| 久久一区二区三区四区| 夜夜嗨av一区二区三区网页| 国产乱码一区二区三区| 欧美特级限制片免费在线观看| 精品久久久久久久久久久院品网| 亚洲欧美区自拍先锋| 麻豆精品国产传媒mv男同| 91色在线porny| 久久亚洲精品国产精品紫薇| 亚洲一区自拍偷拍| 福利电影一区二区| 这里只有精品99re| 又紧又大又爽精品一区二区| 国产一本一道久久香蕉| 欧美少妇bbb| 国产精品黄色在线观看| 狠狠色综合日日| 欧美日韩综合在线免费观看| 国产精品久久一级| 狠狠网亚洲精品| 欧美一区中文字幕| 亚洲成av人片在线观看| 99久久综合99久久综合网站| 日韩美女一区二区三区| 亚洲国产色一区| 91精品1区2区| 亚洲视频在线一区二区| 国产精品一二三四五| 精品久久五月天| 久久疯狂做爰流白浆xx| 日韩一二三四区| 三级不卡在线观看| 欧美日韩视频一区二区| 亚洲黄色小说网站| 色综合久久88色综合天天6| 91精选在线观看| 琪琪久久久久日韩精品| 日韩精品一区二区三区老鸭窝| 亚洲成人精品在线观看| a美女胸又www黄视频久久| 欧美一区二区三区免费在线看| 日韩精品久久理论片| 欧美撒尿777hd撒尿| 国产精品国模大尺度视频| 色婷婷综合久久久中文一区二区| 午夜精品在线视频一区| 丝袜诱惑亚洲看片| 欧美午夜在线观看| 亚洲一区二区三区在线播放 | 东方aⅴ免费观看久久av| 久久综合网色—综合色88| 另类小说视频一区二区| 日韩欧美一区中文| 激情文学综合插| 国产视频亚洲色图| 成人自拍视频在线| 成人免费在线视频观看| 99久久婷婷国产精品综合| 亚洲美女淫视频| 91成人国产精品| 午夜a成v人精品| 欧美电影免费观看高清完整版在| 精品一区二区免费看| 欧美精品一区二区在线观看| 国产成人夜色高潮福利影视| 亚洲国产成人自拍| a级精品国产片在线观看| 亚洲欧美国产三级| 欧洲国内综合视频| 日韩vs国产vs欧美| 精品成人a区在线观看| 国产99精品视频| 亚洲精品乱码久久久久久黑人| 在线综合视频播放| 久久99国产精品久久| 国产欧美日本一区二区三区| aaa亚洲精品一二三区| 亚洲一本大道在线| 欧美tickling挠脚心丨vk| 国产a级毛片一区| 亚洲一区二区在线播放相泽| 在线成人av网站| 国产福利精品导航| 亚洲一区成人在线| 亚洲精品一线二线三线无人区| 成人激情小说乱人伦| 亚洲一区二区在线播放相泽| 精品国产一区二区精华| 不卡一二三区首页| 蜜乳av一区二区| 亚洲欧洲日韩av| 日韩一区二区免费高清| 99精品久久久久久| 奇米影视一区二区三区小说| 国产精品国产三级国产aⅴ原创 | 5858s免费视频成人| 国产盗摄女厕一区二区三区| 1000精品久久久久久久久| 日韩一区二区免费高清| 91在线云播放| 日本va欧美va精品发布| 亚洲日本中文字幕区| 日韩欧美亚洲国产另类| 不卡电影一区二区三区| 人禽交欧美网站| 亚洲精品中文字幕在线观看| 色网站国产精品| 亚洲一区二区精品3399| 中文字幕一区二区三区av| 亚洲最大的成人av| 乱中年女人伦av一区二区| 欧美日韩精品一区视频| 日韩欧美亚洲国产另类| 久久久久97国产精华液好用吗| 国产精品久久久久影院色老大 |