hal/rtl8192e/pci/rtl8192ee_xmit.c
void update_txdesc_buf(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
{
	_adapter			*padapter = pxmitframe->padapter;
	struct dvobj_priv	*pdvobjpriv = adapter_to_dvobj(padapter);
	dma_addr_t		mapping;
	u32				i = 0;
	u16				seg_num = ((TX_BUFFER_SEG_NUM == 0) ? 2 : ((TX_BUFFER_SEG_NUM == 1) ? 4 : 8));
	u16				tx_page_size_reg = 2;
	u16				page_size_length = 0;
	HAL_DATA_TYPE	*pHalData = GET_HAL_DATA(padapter);


	mapping = pci_map_single(pdvobjpriv->ppcidev, pxmitframe->buf_addr , sz + TX_WIFI_INFO_SIZE, PCI_DMA_TODEVICE);

	/* Calculate page size. Total buffer length including TX_WIFI_INFO and PacketLen */
	if (tx_page_size_reg > 0) {
		page_size_length = (sz + TX_WIFI_INFO_SIZE) / (tx_page_size_reg * 128);
		if (((sz + TX_WIFI_INFO_SIZE) % (tx_page_size_reg * 128)) > 0)
			page_size_length++;
	}


	/* Reset all tx buffer desciprtor content */
	/* -- Reset first element */
	SET_TX_BUFF_DESC_LEN_0_92E(pmem, 0);
	SET_TX_BUFF_DESC_PSB_92E(pmem, 0);
	SET_TX_BUFF_DESC_OWN_92E(pmem, 0);
	/* -- Reset second and other element */
	for (i = 1 ; i < seg_num ; i++) {
		SET_TXBUFFER_DESC_LEN_WITH_OFFSET(pmem, i, 0);
		SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(pmem, i, 0);
		SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(pmem, i, 0);
	}

	/* Fill buffer length of the first buffer, */
	/* For 8192ee, it is requried that TX_WIFI_INFO is put in first segment, and the size */
	/*		of the first segment cannot be larger than TX_WIFI_INFO_SIZE. */
	SET_TX_BUFF_DESC_LEN_0_92E(pmem, TX_WIFI_INFO_SIZE);
	SET_TX_BUFF_DESC_PSB_92E(pmem, page_size_length);
	SET_TX_BUFF_DESC_ADDR_LOW_0_92E(pmem, mapping);

	/* It is assumed that in linux implementation, packet is coalesced in only one buffer */
	/* Extension mode is not supported here */
	SET_TXBUFFER_DESC_LEN_WITH_OFFSET(pmem, 1, sz);
	SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(pmem, 1, 0); /* don't using extendsion mode. */
	SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(pmem, 1, mapping + TX_WIFI_INFO_SIZE);


	/* 8192EE_TODO */
	if (0) {
		int i, j;
		u8 *buf = pxmitframe->buf_addr + TX_WIFI_INFO_SIZE;
		RTW_INFO("##############%s###############\n", __FUNCTION__);
		buf[4] = 0x01;
		buf[5] = 0x02;
		buf[6] = 0x03;
		buf[7] = 0x04;
		buf[8] = 0x05;
		buf[9] = 0x06;
		buf[16] = 0x07;
		buf[17] = 0x08;
		buf[18] = 0x09;
		buf[19] = 0x0a;
		buf[20] = 0x0b;
		buf[21] = 0x0c;
		for (i = 0; i < 32; i++) {
			if ((i % 16 == 0) && (i != 0))
				_dbgdump("\n");
			_dbgdump("%02X ", *(buf + i));

			if (i % 4 == 3)
				_dbgdump("\t");
		}
		RTW_INFO("\n#############################\n");

	}
	/* 8192EE_TODO */

	buf_desc_debug("TX:%s, tx_buf_desc = 0x%08x\n", __FUNCTION__, (u32)pmem);
	buf_desc_debug("TX:%s, Offset00(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem)));
	buf_desc_debug("TX:%s, Offset04(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 4)));
	buf_desc_debug("TX:%s, Offset08(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 8)));
	buf_desc_debug("TX:%s, Offset12(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 12)));

}
/*
 * Fill tx buffer desciptor. Map each buffer address in tx buffer descriptor segment
 * Designed for tx buffer descriptor architecture
 * Input *pmem: pointer to the Tx Buffer Descriptor
 */
Fill tx buffer desciptor. Map each buffer address in tx buffer descriptor segment
Designed for tx buffer descriptor architecture
Input *pmem: pointer to the Tx Buffer Descriptor
Fill tx buffer desciptor . Map each buffer address in tx buffer descriptor segment Designed for tx buffer descriptor architecture Input * pmem : pointer to the Tx Buffer Descriptor
void update_txdesc_buf(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz)
{
	_adapter			*padapter = pxmitframe->padapter;
	struct dvobj_priv	*pdvobjpriv = adapter_to_dvobj(padapter);
	dma_addr_t		mapping;
	u32				i = 0;
	u16				seg_num = ((TX_BUFFER_SEG_NUM == 0) ? 2 : ((TX_BUFFER_SEG_NUM == 1) ? 4 : 8));
	u16				tx_page_size_reg = 2;
	u16				page_size_length = 0;
	HAL_DATA_TYPE	*pHalData = GET_HAL_DATA(padapter);
	mapping = pci_map_single(pdvobjpriv->ppcidev, pxmitframe->buf_addr , sz + TX_WIFI_INFO_SIZE, PCI_DMA_TODEVICE);
	if (tx_page_size_reg > 0) {
		page_size_length = (sz + TX_WIFI_INFO_SIZE) / (tx_page_size_reg * 128);
		if (((sz + TX_WIFI_INFO_SIZE) % (tx_page_size_reg * 128)) > 0)
			page_size_length++;
	}
	SET_TX_BUFF_DESC_LEN_0_92E(pmem, 0);
	SET_TX_BUFF_DESC_PSB_92E(pmem, 0);
	SET_TX_BUFF_DESC_OWN_92E(pmem, 0);
	for (i = 1 ; i < seg_num ; i++) {
		SET_TXBUFFER_DESC_LEN_WITH_OFFSET(pmem, i, 0);
		SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(pmem, i, 0);
		SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(pmem, i, 0);
	}
	SET_TX_BUFF_DESC_LEN_0_92E(pmem, TX_WIFI_INFO_SIZE);
	SET_TX_BUFF_DESC_PSB_92E(pmem, page_size_length);
	SET_TX_BUFF_DESC_ADDR_LOW_0_92E(pmem, mapping);
	SET_TXBUFFER_DESC_LEN_WITH_OFFSET(pmem, 1, sz);
	SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(pmem, 1, 0); 
	SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(pmem, 1, mapping + TX_WIFI_INFO_SIZE);
	if (0) {
		int i, j;
		u8 *buf = pxmitframe->buf_addr + TX_WIFI_INFO_SIZE;
		RTW_INFO("##############%s###############\n", __FUNCTION__);
		buf[4] = 0x01;
		buf[5] = 0x02;
		buf[6] = 0x03;
		buf[7] = 0x04;
		buf[8] = 0x05;
		buf[9] = 0x06;
		buf[16] = 0x07;
		buf[17] = 0x08;
		buf[18] = 0x09;
		buf[19] = 0x0a;
		buf[20] = 0x0b;
		buf[21] = 0x0c;
		for (i = 0; i < 32; i++) {
			if ((i % 16 == 0) && (i != 0))
				_dbgdump("\n");
			_dbgdump("%02X ", *(buf + i));
			if (i % 4 == 3)
				_dbgdump("\t");
		}
		RTW_INFO("\n#############################\n");
	}
	buf_desc_debug("TX:%s, tx_buf_desc = 0x%08x\n", __FUNCTION__, (u32)pmem);
	buf_desc_debug("TX:%s, Offset00(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem)));
	buf_desc_debug("TX:%s, Offset04(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 4)));
	buf_desc_debug("TX:%s, Offset08(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 8)));
	buf_desc_debug("TX:%s, Offset12(0x%08x)\n", __FUNCTION__, *((u32 *)(pmem + 12)));
}
void update_txdesc_buf ( struct xmit_frame * pxmitframe , u8 * pmem , s32 sz ) { _adapter * padapter = pxmitframe -> padapter ; struct dvobj_priv * pdvobjpriv = adapter_to_dvobj ( padapter ) ; dma_addr_t mapping ; u32 i = 0 ; u16 seg_num = ( ( TX_BUFFER_SEG_NUM == 0 ) ? 2 : ( ( TX_BUFFER_SEG_NUM == 1 ) ? 4 : 8 ) ) ; u16 tx_page_size_reg = 2 ; u16 page_size_length = 0 ; HAL_DATA_TYPE * pHalData = GET_HAL_DATA ( padapter ) ; mapping = pci_map_single ( pdvobjpriv -> ppcidev , pxmitframe -> buf_addr , sz + TX_WIFI_INFO_SIZE , PCI_DMA_TODEVICE ) ; if ( tx_page_size_reg > 0 ) { page_size_length = ( sz + TX_WIFI_INFO_SIZE ) / ( tx_page_size_reg * 128 ) ; if ( ( ( sz + TX_WIFI_INFO_SIZE ) % ( tx_page_size_reg * 128 ) ) > 0 ) page_size_length ++ ; } SET_TX_BUFF_DESC_LEN_0_92E ( pmem , 0 ) ; SET_TX_BUFF_DESC_PSB_92E ( pmem , 0 ) ; SET_TX_BUFF_DESC_OWN_92E ( pmem , 0 ) ; for ( i = 1 ; i < seg_num ; i ++ ) { SET_TXBUFFER_DESC_LEN_WITH_OFFSET ( pmem , i , 0 ) ; SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET ( pmem , i , 0 ) ; SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET ( pmem , i , 0 ) ; } SET_TX_BUFF_DESC_LEN_0_92E ( pmem , TX_WIFI_INFO_SIZE ) ; SET_TX_BUFF_DESC_PSB_92E ( pmem , page_size_length ) ; SET_TX_BUFF_DESC_ADDR_LOW_0_92E ( pmem , mapping ) ; SET_TXBUFFER_DESC_LEN_WITH_OFFSET ( pmem , 1 , sz ) ; SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET ( pmem , 1 , 0 ) ; SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET ( pmem , 1 , mapping + TX_WIFI_INFO_SIZE ) ; if ( 0 ) { int i , j ; u8 * buf = pxmitframe -> buf_addr + TX_WIFI_INFO_SIZE ; RTW_INFO ( " \n " , __FUNCTION__ ) ; buf [ 4 ] = 0x01 ; buf [ 5 ] = 0x02 ; buf [ 6 ] = 0x03 ; buf [ 7 ] = 0x04 ; buf [ 8 ] = 0x05 ; buf [ 9 ] = 0x06 ; buf [ 16 ] = 0x07 ; buf [ 17 ] = 0x08 ; buf [ 18 ] = 0x09 ; buf [ 19 ] = 0x0a ; buf [ 20 ] = 0x0b ; buf [ 21 ] = 0x0c ; for ( i = 0 ; i < 32 ; i ++ ) { if ( ( i % 16 == 0 ) && ( i != 0 ) ) _dbgdump ( " \n " ) ; _dbgdump ( " " , * ( buf + i ) ) ; if ( i % 4 == 3 ) _dbgdump ( " \t " ) ; } RTW_INFO ( " \n \n " ) ; } buf_desc_debug ( " \n " , __FUNCTION__ , ( u32 ) pmem ) ; buf_desc_debug ( " \n " , __FUNCTION__ , * ( ( u32 * ) ( pmem ) ) ) ; buf_desc_debug ( " \n " , __FUNCTION__ , * ( ( u32 * ) ( pmem + 4 ) ) ) ; buf_desc_debug ( " \n " , __FUNCTION__ , * ( ( u32 * ) ( pmem + 8 ) ) ) ; buf_desc_debug ( " \n " , __FUNCTION__ , * ( ( u32 * ) ( pmem + 12 ) ) ) ; }
Fill tx buffer desciptor.
Fill tx buffer desciptor .
/* Calculate page size. Total buffer length including TX_WIFI_INFO and PacketLen */ /* Reset all tx buffer desciprtor content */ /* -- Reset first element */ /* -- Reset second and other element */ /* Fill buffer length of the first buffer, */ /* For 8192ee, it is requried that TX_WIFI_INFO is put in first segment, and the size */ /*		of the first segment cannot be larger than TX_WIFI_INFO_SIZE. */ /* It is assumed that in linux implementation, packet is coalesced in only one buffer */ /* Extension mode is not supported here */ /* don't using extendsion mode. */ /* 8192EE_TODO */ /* 8192EE_TODO */