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

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

?? nbuf.c

?? Modbus協(xié)議的源代碼 Modbus協(xié)議的源代碼、 Modbus協(xié)議的源代碼 Modbus協(xié)議的源代碼
?? C
字號:
/*
 * Copyright (c) 2006 Christian Walter
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 * OF SUCH DAMAGE.
 *
 * Note: Most of the network buffer code is based on the MCF5235 examples from
 *   Freescale.
 *
 * File: $Id: nbuf.c,v 1.1 2006/08/30 23:18:07 wolti Exp $
 */

/* ------------------------ Platform includes ----------------------------- */
#include "mcf5xxx.h"
#include "mcf523x.h"

#include "nbuf.h"

/* ------------------------ Static variables ------------------------------ */

/* Buffer descriptor indexes */
static uint8    tx_bd_idx;
static uint8    rx_bd_idx;

/* Buffer Descriptors -- must be aligned on a 4-byte boundary but a
 * 16-byte boundary is recommended. */
static nbuf_t   tx_nbuf[sizeof( nbuf_t ) * NUM_TXBDS] ATTR_FECMEM;
static nbuf_t   rx_nbuf[sizeof( nbuf_t ) * NUM_RXBDS] ATTR_FECMEM;

/* Data Buffers -- must be aligned on a 16-byte boundary. */
static uint8    tx_buf[TX_BUFFER_SIZE * NUM_TXBDS] ATTR_FECMEM;
static uint8    rx_buf[RX_BUFFER_SIZE * NUM_RXBDS] ATTR_FECMEM;

/* ------------------------ Start implementation -------------------------- */
void
nbuf_init(  )
{

    uint8           i;

    /* Initialize receive descriptor ring */
    for( i = 0; i < NUM_RXBDS; i++ )
    {
        rx_nbuf[i].status = RX_BD_E;
        rx_nbuf[i].length = 0;
        rx_nbuf[i].data = &rx_buf[i * RX_BUFFER_SIZE];
    }

    /* Set the Wrap bit on the last one in the ring */
    rx_nbuf[NUM_RXBDS - 1].status |= RX_BD_W;

    /* Initialize transmit descriptor ring */
    for( i = 0; i < NUM_TXBDS; i++ )
    {
        tx_nbuf[i].status = TX_BD_L | TX_BD_TC;
        tx_nbuf[i].length = 0;
        tx_nbuf[i].data = &tx_buf[i * TX_BUFFER_SIZE];
    }

    /* Set the Wrap bit on the last one in the ring */
    tx_nbuf[NUM_TXBDS - 1].status |= TX_BD_W;

    /* Initialize the buffer descriptor indexes */
    tx_bd_idx = rx_bd_idx = 0;

    return;
}


/********************************************************************/
uint32
nbuf_get_start( uint8 direction )
{
    /*
     * Return the address of the first buffer descriptor in the ring.
     * This routine is needed by the FEC of the MPC860T , MCF5282, and MCF523x
     * in order to write the Rx/Tx descriptor ring start registers
     */
    switch ( direction )
    {
    case NBUF_RX:
        return ( uint32 ) rx_nbuf;
    case NBUF_TX:
    default:
        return ( uint32 ) tx_nbuf;
    }
}


/********************************************************************/
nbuf_t         *
nbuf_rx_allocate(  )
{
    /* This routine alters shared data. Disable interrupts! */
    int             old_ipl = asm_set_ipl( 6 );

    /* Return a pointer to the next empty Rx Buffer Descriptor */
    int             i = rx_bd_idx;


    /* Check to see if the ring of BDs is full */
    if( rx_nbuf[i].status & RX_BD_INUSE )
        return NULL;

    /* Mark the buffer as in use */
    rx_nbuf[i].status |= RX_BD_INUSE;

    /* increment the circular index */
    rx_bd_idx = ( uint8 ) ( ( rx_bd_idx + 1 ) % NUM_RXBDS );

    /* Restore previous IPL */
    asm_set_ipl( old_ipl );

    return &rx_nbuf[i];
}


/********************************************************************/
nbuf_t         *
nbuf_tx_allocate(  )
{
    /* This routine alters shared data. Disable interrupts! */
    int             old_ipl = asm_set_ipl( 6 );

    /* Return a pointer to the next empty Tx Buffer Descriptor */
    int             i = tx_bd_idx;

    /* Check to see if ring of BDs is full */
    if( ( tx_nbuf[i].status & TX_BD_INUSE ) || ( tx_nbuf[i].status & TX_BD_R ) )
        return NULL;

    /* Mark the buffer as Ready (in use) */
    /* FEC must set R bit in transmit routine */
    tx_nbuf[i].status |= TX_BD_INUSE;

    /* increment the circular index */
    tx_bd_idx = ( uint8 ) ( ( tx_bd_idx + 1 ) % NUM_TXBDS );

    /* Restore previous IPL */
    asm_set_ipl( old_ipl );

    return &tx_nbuf[i];
}


/********************************************************************/
void
nbuf_rx_release( nbuf_t * pNbuf )
{
    /* This routine alters shared data. Disable interrupts! */
    int             old_ipl = asm_set_ipl( 6 );

    /* Mark the buffer as empty and not in use */
    pNbuf->status |= RX_BD_E;
    pNbuf->status &= ~RX_BD_INUSE;

    /* Restore previous IPL */
    asm_set_ipl( old_ipl );
}

/********************************************************************/
void
nbuf_tx_release( nbuf_t * pNbuf )
{
    /* This routine alters shared data. Disable interrupts! */
    int             old_ipl = asm_set_ipl( 6 );

    /* Mark the buffer as not in use */
    pNbuf->status &= ~TX_BD_INUSE;

    /* Restore previous IPL */
    asm_set_ipl( old_ipl );
}

/********************************************************************/
int
nbuf_rx_next_ready(  )
{
    /****************************************************************
 This function checks the EMPTY bit of the next Rx buffer to be
 allocated. If the EMPTY bit is cleared, then the next buffer in
 the ring has been filled by the FEC and has not already been
 allocated and passed up the stack. In this case, the next buffer
 in the ring is ready to be allocated. Otherwise, the  buffer is
 either empty or not empty but still in use by a higher level
 protocol. The FEC receive routine uses this function to determine
 if multiple buffers where filled by the FEC during a single
 interrupt event.
 ****************************************************************/

    return ( !( rx_nbuf[rx_bd_idx].status & RX_BD_E ) );
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品乱码一区二区三区软件| 成人午夜av影视| 欧美一区二区在线免费播放| 亚洲777理论| 欧美一级夜夜爽| 激情丁香综合五月| 中文字幕成人网| 在线视频国产一区| 日韩影院免费视频| 国产亚洲一本大道中文在线| 成人av在线资源| 亚洲免费av网站| 欧美日韩国产美| 日日噜噜夜夜狠狠视频欧美人 | 亚洲国产精品自拍| 3751色影院一区二区三区| 蜜桃av噜噜一区| 欧美经典一区二区三区| 色网站国产精品| 秋霞午夜av一区二区三区| 久久中文字幕电影| 色综合久久久久网| 蜜臀av国产精品久久久久| 久久久电影一区二区三区| 色婷婷综合中文久久一本| 麻豆国产欧美日韩综合精品二区| 久久久久国产成人精品亚洲午夜| 日本乱码高清不卡字幕| 九九**精品视频免费播放| 亚洲欧美一区二区三区国产精品| 欧美丝袜第三区| 国产一区二区三区国产| 亚洲自拍都市欧美小说| 国产欧美精品区一区二区三区 | 久久99精品国产91久久来源| 亚洲色图视频免费播放| 欧美成人性战久久| 在线免费观看日韩欧美| 国产美女精品在线| 亚洲gay无套男同| 亚洲天堂中文字幕| 欧美videofree性高清杂交| 色噜噜偷拍精品综合在线| 韩国一区二区视频| 亚洲成av人影院在线观看网| 国产精品女同一区二区三区| 日韩一区二区三区高清免费看看 | 国产精品一区一区三区| 午夜a成v人精品| 亚洲九九爱视频| 中文无字幕一区二区三区| 日韩一区二区麻豆国产| 欧美怡红院视频| 99视频精品免费视频| 国产精品乡下勾搭老头1| 日日夜夜精品视频免费| 一区二区三区毛片| 亚洲色图欧美在线| 中文字幕欧美区| 久久伊99综合婷婷久久伊| 911精品产国品一二三产区| 91精品1区2区| 91蜜桃视频在线| 成人性视频免费网站| 国产一区二区精品久久| 亚洲图片一区二区| 亚洲成人动漫在线免费观看| 亚洲色欲色欲www| 国产精品日日摸夜夜摸av| 久久久久国产精品麻豆ai换脸| 欧美哺乳videos| 日韩一区二区三区在线| 日韩亚洲欧美中文三级| 69精品人人人人| 欧美日韩国产在线播放网站| 色婷婷综合激情| 在线一区二区三区做爰视频网站| 99久久99久久综合| 91视频在线看| 欧美中文字幕久久| 欧美日韩成人一区| 制服丝袜一区二区三区| 5858s免费视频成人| 欧美刺激午夜性久久久久久久| 日韩一区二区电影在线| 精品久久99ma| wwww国产精品欧美| 日本一区二区三区四区| 18欧美亚洲精品| 一区二区三区四区不卡在线| 艳妇臀荡乳欲伦亚洲一区| 亚洲一区二区三区不卡国产欧美| 性做久久久久久免费观看| 欧美96一区二区免费视频| 国产一区二区网址| 国产91露脸合集magnet| 91网站视频在线观看| 欧美日韩三级在线| 精品国产伦一区二区三区免费| 国产喂奶挤奶一区二区三区| 国产精品剧情在线亚洲| 亚洲午夜视频在线观看| 日本色综合中文字幕| 国产成人精品一区二区三区四区 | 国内精品免费**视频| 国产激情精品久久久第一区二区| aaa欧美大片| 欧美男人的天堂一二区| 精品欧美乱码久久久久久1区2区| 亚洲国产成人一区二区三区| 亚洲午夜在线视频| 国产老肥熟一区二区三区| 色偷偷成人一区二区三区91| 日韩视频免费直播| 国产精品素人一区二区| 香蕉久久夜色精品国产使用方法| 国产自产2019最新不卡| 色天天综合久久久久综合片| 日韩一区二区不卡| 亚洲精品菠萝久久久久久久| 蜜桃一区二区三区在线| 99精品久久久久久| 精品精品欲导航| 亚洲综合偷拍欧美一区色| 激情欧美一区二区| 欧美日韩精品二区第二页| 国产日韩欧美精品在线| 亚洲成人动漫av| av电影在线观看一区| 精品国产精品网麻豆系列| 亚洲国产成人av网| 成人动漫av在线| 日韩免费看网站| 午夜视频在线观看一区二区| 成人爱爱电影网址| 日韩精品一区在线观看| 亚洲一区二区在线免费观看视频| 国产91高潮流白浆在线麻豆| 日韩免费性生活视频播放| 亚洲国产欧美另类丝袜| 91日韩一区二区三区| 国产色综合久久| 99re热视频这里只精品| 精品不卡在线视频| 美脚の诱脚舐め脚责91| 欧美日韩成人激情| 亚洲永久免费视频| 91在线视频网址| 国产清纯白嫩初高生在线观看91 | 国产成人免费视频网站 | 国产精品综合在线视频| 91精品国产综合久久国产大片| 亚洲精品久久久蜜桃| 99国产精品久久久| 国产精品蜜臀av| 国产高清不卡一区| 久久精品男人天堂av| 经典三级一区二区| 欧美不卡一区二区三区| 久久精品久久综合| 欧美一区二区黄色| 日本亚洲电影天堂| 欧美人与z0zoxxxx视频| 丝袜亚洲精品中文字幕一区| 欧美在线观看你懂的| 亚洲小少妇裸体bbw| 欧美日韩中文国产| 午夜视频在线观看一区二区三区| 欧洲另类一二三四区| 亚洲自拍偷拍欧美| 欧美专区亚洲专区| 午夜a成v人精品| 欧美一区二区三区精品| 久久国产精品露脸对白| 久久亚洲精华国产精华液| 国v精品久久久网| 欧美国产日本视频| jlzzjlzz亚洲女人18| 亚洲欧美国产三级| 欧美三级日韩三级| 三级一区在线视频先锋| 日韩美女一区二区三区| 国产精品一级黄| 国产精品免费观看视频| 91啪亚洲精品| 日韩va欧美va亚洲va久久| 日韩欧美一级精品久久| 韩国成人精品a∨在线观看| 亚洲国产精品t66y| 在线精品视频免费观看| 日日夜夜精品视频免费| 国产午夜亚洲精品羞羞网站| 99热精品国产| 日韩高清一区在线| 国产亚洲欧美色| 97超碰欧美中文字幕| 日一区二区三区| 国产欧美日产一区| 欧美在线免费播放| 久久se精品一区二区|