当前位置: 首页>>代码示例>>C++>>正文


C++ TX_DESC_CTRL函数代码示例

本文整理汇总了C++中TX_DESC_CTRL函数的典型用法代码示例。如果您正苦于以下问题:C++ TX_DESC_CTRL函数的具体用法?C++ TX_DESC_CTRL怎么用?C++ TX_DESC_CTRL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TX_DESC_CTRL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EMAC_SendPacket

BOOL_32 EMAC_SendPacket(void *pPacket, UNS_32 size)
{
	UNS_32 	Index;
	UNS_32	IndexNext = LPC_EMAC->TxProduceIndex + 1;
	
  if(size == 0)
  {
    return(TRUE);
  }
  if(IndexNext > LPC_EMAC->TxDescriptorNumber)
  {
    IndexNext = 0;
  }
 
  if(IndexNext == LPC_EMAC->TxConsumeIndex)
  {
    return(FALSE);
  }
  Index = LPC_EMAC->TxProduceIndex;
  if (size > ETH_FRAG_SIZE)
  	size = ETH_FRAG_SIZE;

  memcpy((unsigned int *)TX_BUF(Index),pPacket,size);  
  TX_DESC_CTRL(Index) &= ~0x7ff;
  TX_DESC_CTRL(Index) |= (size - 1) & 0x7ff; 

  LPC_EMAC->TxProduceIndex = IndexNext;

  return(TRUE);
}
开发者ID:marcelommcouto,项目名称:FTPUploader_Bootloader,代码行数:30,代码来源:lpc17xx_emac.c

示例2: lpc17xx_emac_tx

/* transmit packet. */
rt_err_t lpc17xx_emac_tx( rt_device_t dev, struct pbuf* p)
{
	rt_uint32_t Index, IndexNext;
	struct pbuf *q;
	rt_uint8_t *ptr;

	/* calculate next index */
	IndexNext = LPC_EMAC->TxProduceIndex + 1;
	if(IndexNext > LPC_EMAC->TxDescriptorNumber) IndexNext = 0;

	/* check whether block is full */
	while (IndexNext == LPC_EMAC->TxConsumeIndex)
	{
		rt_err_t result;
		rt_uint32_t recved;
		
		/* there is no block yet, wait a flag */
		result = rt_event_recv(&tx_event, 0x01, 
			RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, &recved);

		RT_ASSERT(result == RT_EOK);
	}

	/* lock EMAC device */
	rt_sem_take(&sem_lock, RT_WAITING_FOREVER);

	/* get produce index */
	Index = LPC_EMAC->TxProduceIndex;

	/* calculate next index */
	IndexNext = LPC_EMAC->TxProduceIndex + 1;
	if(IndexNext > LPC_EMAC->TxDescriptorNumber)
		IndexNext = 0;

	/* copy data to tx buffer */
	q = p;
	ptr = (rt_uint8_t*)TX_BUF(Index);
	while (q)
	{
		memcpy(ptr, q->payload, q->len);
		ptr += q->len;
		q = q->next;
	}

	TX_DESC_CTRL(Index) &= ~0x7ff;
	TX_DESC_CTRL(Index) |= (p->tot_len - 1) & 0x7ff;

	/* change index to the next */
	LPC_EMAC->TxProduceIndex = IndexNext;

	/* unlock EMAC device */
	rt_sem_release(&sem_lock);

	return RT_EOK;
}
开发者ID:304471720,项目名称:rt-thread,代码行数:56,代码来源:emac.c

示例3: sendTxEthFrame

/**
 * Ethernetパケットを送信します。
 * allocTxBufで得たバッファを指定すること。
 * <p>関数仕様</p>
 * この関数は、i_bufが
 * </div>
 */
static void sendTxEthFrame(void* i_buf,unsigned short i_size)
{
	NyLPC_TUInt32	IndexNext,Index;
	struct NyLPC_TTxBufferHeader* bh=NyLPC_TTxBufferHeader_getBufferHeaderAddr(i_buf);

	//サイズ0なら送信の必要なし
	if(i_size == 0)
	{
		return;
	}
	//送信デスクリプタの反映
	IndexNext =waitForTxEthFrameEmpty();

	//送信対象のメモリブロックを送信中に設定。
//	b=(i_buf+1);
	//送信中のメモリブロックなら無視
	if(bh->is_lock){
		return;
	}
	//送信中にセット
	bh->is_lock=NyLPC_TUInt8_TRUE;

	//送信データのセット
	Index = LPC_EMAC->TxProduceIndex;
	if (i_size > ETH_FRAG_SIZE){
		i_size = ETH_FRAG_SIZE;
	}
	//送信処理
	TX_DESC_PACKET( Index ) = ( unsigned long )i_buf;
	//See UM10360.pdf Table 181. Transmit descriptor control word
	TX_DESC_CTRL( Index ) = ((i_size-1) | TCTRL_LAST | TCTRL_INT );
	LPC_EMAC->TxProduceIndex = IndexNext;
	return;
}
开发者ID:nyatla,项目名称:mbedJS-dev,代码行数:41,代码来源:EthDev_LPC4088.c

示例4: RequestSend

void RequestSend(unsigned short FrameSize)
{
  unsigned int index;
  index  = LPC_EMAC->TxProduceIndex;
  txptr = (unsigned short *)TX_DESC_PACKET(index);
  TX_DESC_CTRL(index) = FrameSize | TCTRL_LAST;
}
开发者ID:TiddoLangerak,项目名称:mmc_test,代码行数:7,代码来源:ethmac.c

示例5: vEMAC_ISR

void vEMAC_ISR( void )
{
    unsigned long ulStatus;
    long lHigherPriorityTaskWoken = pdFALSE;

    ulStatus = EMAC->IntStatus;

    /* Clear the interrupt. */
    EMAC->IntClear = ulStatus;

    if( ulStatus & INT_RX_DONE ) {
        /* Ensure the uIP task is not blocked as data has arrived. */
        xSemaphoreGiveFromISR( xEMACSemaphore, &lHigherPriorityTaskWoken );
    }

    if( ulStatus & INT_TX_DONE ) {
        if( usSendLen > 0 ) {
            /* Send the data again, using the second descriptor.  As there are
            only two descriptors the index is set back to 0. */
            TX_DESC_PACKET( ( emacTX_DESC_INDEX + 1 ) ) = TX_DESC_PACKET( emacTX_DESC_INDEX );
            TX_DESC_CTRL( ( emacTX_DESC_INDEX + 1 ) ) = ( usSendLen | TCTRL_LAST | TCTRL_INT );
            EMAC->TxProduceIndex = ( emacTX_DESC_INDEX );

            /* This is the second Tx so set usSendLen to 0 to indicate that the
            Tx descriptors will be free again. */
            usSendLen = 0UL;
        } else {
            /* The Tx buffer is no longer required. */
            prvReturnBuffer( ( unsigned char * ) TX_DESC_PACKET( emacTX_DESC_INDEX ) );
            TX_DESC_PACKET( emacTX_DESC_INDEX ) = ( unsigned long ) NULL;
        }
    }

    portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:35,代码来源:emac.c

示例6: vSendEMACTxData

void vSendEMACTxData( unsigned short usTxDataLen )
{
unsigned long ulAttempts = 0UL;

	/* Check to see if the Tx descriptor is free, indicated by its buffer being
	NULL. */
	while( TX_DESC_PACKET( emacTX_DESC_INDEX ) != ( unsigned long ) NULL )
	{
		/* Wait for the Tx descriptor to become available. */
		vTaskDelay( emacBUFFER_WAIT_DELAY );

		ulAttempts++;
		if( ulAttempts > emacBUFFER_WAIT_ATTEMPTS )
		{
			/* Something has gone wrong as the Tx descriptor is still in use.
			Clear it down manually, the data it was sending will probably be
			lost. */
			prvReturnBuffer( ( unsigned char * ) TX_DESC_PACKET( emacTX_DESC_INDEX ) );
			break;
		}
	}

	/* Setup the Tx descriptor for transmission.  Remember the length of the
	data being sent so the second descriptor can be used to send it again from
	within the ISR. */
	usSendLen = usTxDataLen;
	TX_DESC_PACKET( emacTX_DESC_INDEX ) = ( unsigned long ) uip_buf;
	TX_DESC_CTRL( emacTX_DESC_INDEX ) = ( usTxDataLen | TCTRL_LAST | TCTRL_INT );
	EMAC->TxProduceIndex = ( emacTX_DESC_INDEX + 1 );

	/* uip_buf is being sent by the Tx descriptor.  Allocate a new buffer. */
	uip_buf = prvGetNextBuffer();
}
开发者ID:wugsh,项目名称:wgs,代码行数:33,代码来源:emac.c

示例7: DoSend_EMAC

void DoSend_EMAC(unsigned short FrameSize)
{
    unsigned int idx;

    idx = MAC_TXPRODUCEINDEX;
    TX_DESC_CTRL(idx) = FrameSize | TCTRL_LAST;
    if (++idx == NUM_TX_FRAG) idx = 0;
    MAC_TXPRODUCEINDEX = idx;
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:9,代码来源:emac.c

示例8: DoSend_EMAC

void DoSend_EMAC(unsigned short FrameSize)
{
  unsigned int idx;

  idx = TxProduceIndex;
  TX_DESC_CTRL(idx) = FrameSize | TCTRL_LAST;
  if (++idx == NUM_TX_FRAG) idx = 0;
  TxProduceIndex = idx;
}
开发者ID:darknesmonk,项目名称:freertos-5.1.2-lpc23xx,代码行数:9,代码来源:emac.c

示例9: low_level_output

static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
  struct pbuf *q;
  uint32_t Index, IndexNext;
  uint8_t *ptr;

  /* calculate next index */
  IndexNext = LPC_EMAC->TxProduceIndex + 1;
  if(IndexNext > LPC_EMAC->TxDescriptorNumber)
    IndexNext = 0;
#if 0
	/* check whether block is full */
	while (IndexNext == LPC_EMAC->TxConsumeIndex)
	{
		err_t result;
		uint32_t recved;

		/* there is no block yet, wait a flag */
		result = rt_event_recv(&tx_event, 0x01,
			RT_EVENT_FLAG_AND | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, &recved);
	}
#endif
  
	Index = LPC_EMAC->TxProduceIndex;

	/* calculate next index */
	IndexNext = LPC_EMAC->TxProduceIndex + 1;
	if(IndexNext > LPC_EMAC->TxDescriptorNumber)
		IndexNext = 0;

#if ETH_PAD_SIZE
  pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif

	/* copy data to tx buffer */
	ptr = (uint8_t*)TX_BUF(Index);
  for(q = p; q != NULL; q = q->next) {
		MEMCPY(ptr, q->payload, q->len);
		ptr += q->len;
  }

	TX_DESC_CTRL(Index) = (p->tot_len - 1) & 0x7ff | EMAC_TCTRL_INT | EMAC_TCTRL_LAST;

	/* change index to the next */
	LPC_EMAC->TxProduceIndex = IndexNext;

#if ETH_PAD_SIZE
  pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
  
  LINK_STATS_INC(link.xmit);

  return ERR_OK;
}
开发者ID:Liu1992,项目名称:GasSub_LPC1788,代码行数:55,代码来源:ethernetif.c

示例10: tx_descr_init

// Keil: function added to initialize Tx Descriptors
void tx_descr_init (void)
{
  unsigned int i;

  for (i = 0; i < NUM_TX_DESC; i++) {						// Take it out!!!!
	 TX_DESC_STAT(i) = 0;
	 TX_DESC_CTRL(i) = 0;
	 TX_BUFADDR(i) = 0;
  }

  for (i = 0; i < NUM_TX_DESC; i++) {
    TX_DESC_STAT(i) = TX_LAST_SEGM | TX_FIRST_SEGM;
	TX_DESC_CTRL(i) = 0;
	TX_BUFADDR(i) = TX_BUF(i); 
	if (i == (NUM_TX_DESC-1)) 		   // Last Descriptor?
	  TX_DESC_STAT(i) |= TX_END_RING;
  }

  /* Set Starting address of RX Descriptor list */
  LPC_ETHERNET->DMA_TRANS_DES_ADDR = TX_DESC_BASE;
}
开发者ID:Andriiy,项目名称:Circuit-Boards,代码行数:22,代码来源:emac.c

示例11: LPC24XX_EMAC_lwip_xmit

err_t LPC24XX_EMAC_lwip_xmit ( struct netif *pNetIf, struct pbuf *pPBuf )
{
    UINT32 bytes_out,idx;
    UINT32 * dst;
    UINT32 * src;
    
    LPC24XX_EMAC & ENET = *(LPC24XX_EMAC *)LPC24XX_EMAC::c_EMAC_Base;
    
    /* Disable intrrupts */
    GLOBAL_LOCK(irq);
    
    if (!pNetIf || !pPBuf)
    {
        return ERR_ARG;
    }
    
    bytes_out = pPBuf->tot_len;
    if( bytes_out > ETH_MAX_FLEN )
    {
        debug_printf("LPC24XX_EMAC_xmit - Ehernet Frame truncated");
        bytes_out = ETH_MAX_FLEN;   /* What's the point of sending less data! */
    }
    idx = ENET.MAC_TXPRODUCEINDEX;
    /* Check if a Tx descriptor is available */
    if ( ENET.MAC_TXCONSUMEINDEX == (idx + 1) )
    {
        /* Tx descriptor not available */
        return ERR_IF;
    }
    dst = (UINT32 *)TX_DESC_PACKET(idx);
    while (pPBuf)
    {
        /* TODO - can LWIP word align input buffer ? If so we could use FastCopy */
        // src = (UINT32 *)pPBuf->payload;
        // LPC24XX_EMAC_lwip_FastCopy(dst, src, bytes_out);
        memcpy(dst, pPBuf->payload, pPBuf->len);
        pPBuf = pPBuf->next;
        dst += pPBuf->len;
    }
    
    TX_DESC_CTRL(idx) = bytes_out | TCTRL_LAST | TCTRL_INT;
    idx++;
    /* Reset the index if last descriptor */
    if (idx == NUM_TX_FRAG) 
    {
        idx = 0;
    }
    ENET.MAC_TXPRODUCEINDEX = idx;

    return ERR_OK;
}
开发者ID:Sorcha,项目名称:NETMF-LPC,代码行数:51,代码来源:LPC24XX_EMAC_lwip.cpp

示例12: prevTxDescriptor

/**
 * 送信デスクリプタを準備します。
 */
static void prevTxDescriptor(void)
{
	long x;
	//デスクリプタの設定
	for( x = 0; x < NUM_TX_FRAG; x++ )
	{
		TX_DESC_PACKET( x ) = ( unsigned long ) NULL;
		TX_DESC_CTRL( x ) = 0;
		TX_STAT_INFO( x ) = 0;
	}
	/* Set LPC_EMAC Transmit Descriptor Registers. */
	LPC_EMAC->TxDescriptor =TX_DESC_BASE;
	LPC_EMAC->TxStatus = TX_STAT_BASE;
	LPC_EMAC->TxDescriptorNumber = NUM_TX_FRAG - 1;
}
开发者ID:nyatla,项目名称:mbedJS-dev,代码行数:18,代码来源:EthDev_LPC4088.c

示例13: tx_descr_init

static void tx_descr_init (void) {
  UNS_32 i;

  for (i = 0; i < NUM_TX_FRAG; i++) {
    TX_DESC_PACKET(i) = TX_BUF(i);
    TX_DESC_CTRL(i)   = (1<<31) | (1<<30) | (1<<29) | (1<<28) | (1<<26) | (ETH_FRAG_SIZE-1);
    TX_STAT_INFO(i)   = 0;
  }

  /* Set EMAC Transmit Descriptor Registers. */
  LPC_EMAC->TxDescriptor    = TX_DESC_BASE;
  LPC_EMAC->TxStatus        = TX_STAT_BASE;
  LPC_EMAC->TxDescriptorNumber = NUM_TX_FRAG-1;

  /* Tx Descriptors Point to 0 */
  LPC_EMAC->TxProduceIndex  = 0;
}
开发者ID:marcelommcouto,项目名称:FTPUploader_Bootloader,代码行数:17,代码来源:lpc17xx_emac.c

示例14: tx_descr_init

// Keil: function added to initialize Tx Descriptors
void tx_descr_init (void) {
  unsigned int i;

  for (i = 0; i < NUM_TX_FRAG; i++) {
    TX_DESC_PACKET(i) = TX_BUF(i);
    TX_DESC_CTRL(i)   = 0;
    TX_STAT_INFO(i)   = 0;
  }

  /* Set EMAC Transmit Descriptor Registers. */
  TxDescriptor    = TX_DESC_BASE;
  TxStatus        = TX_STAT_BASE;
  TxDescriptorNumber = NUM_TX_FRAG-1;

  /* Tx Descriptors Point to 0 */
  TxProduceIndex  = 0;
}
开发者ID:darknesmonk,项目名称:freertos-5.1.2-lpc23xx,代码行数:18,代码来源:emac.c

示例15: tx_descr_init

		// Keil: function added to initialize Tx Descriptors
		void tx_descr_init (void) {
		  unsigned int i;
		
		  for (i = 0; i < NUM_TX_FRAG; i++) {
		    TX_DESC_PACKET(i) = TX_BUF(i);
		    TX_DESC_CTRL(i)   = 0;
		    TX_STAT_INFO(i)   = 0;
		  }
		
		  /* Set EMAC Transmit Descriptor Registers. */
		  MAC_TXDESCRIPTOR    = TX_DESC_BASE;
		  MAC_TXSTATUS        = TX_STAT_BASE;
		  MAC_TXDESCRIPTORNUM = NUM_TX_FRAG-1;//Minus 1 Encoding
		
		  /* Tx Descriptors Point to 0 */
		  MAC_TXPRODUCEINDEX  = 0;
		}
开发者ID:tsuckow,项目名称:CST417_Networks,代码行数:18,代码来源:ethernet_driver_lpc23xx.hpp


注:本文中的TX_DESC_CTRL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。