mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2025-12-08 07:14:03 +00:00
The official RTL8192EU linux driver from D-Link Australia
Version information: 20140812_rtl8192EU_linux_v4.3.1.1_11320 2014-08-12 version 4.3.1.1_11320 Source: ftp://files.dlink.com.au/products/DWA-131/REV_E/Drivers/DWA-131_Linux_driver_v4.3.1.1.zip This version does not currently work on newer kernels, but it does contain USB ID 2001:3319, which a lot of other repos in GitHub does not.
This commit is contained in:
250
hal/rtl8192e/usb/rtl8192eu_led.c
Normal file
250
hal/rtl8192e/usb/rtl8192eu_led.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8192E_LED_C_
|
||||
|
||||
//#include <drv_types.h>
|
||||
#include <rtl8192e_hal.h>
|
||||
|
||||
|
||||
//================================================================================
|
||||
// LED object.
|
||||
//================================================================================
|
||||
|
||||
|
||||
//================================================================================
|
||||
// Prototype of protected function.
|
||||
//================================================================================
|
||||
|
||||
|
||||
//================================================================================
|
||||
// LED_819xUsb routines.
|
||||
//================================================================================
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Turn on LED according to LedPin specified.
|
||||
//
|
||||
static void
|
||||
SwLedOn_8192EU(
|
||||
PADAPTER padapter,
|
||||
PLED_USB pLed
|
||||
)
|
||||
{
|
||||
u8 LedCfg;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( RT_GetInterfaceSelection(padapter) == INTF_SEL2_MINICARD ||
|
||||
RT_GetInterfaceSelection(padapter) == INTF_SEL3_USB_Solo ||
|
||||
RT_GetInterfaceSelection(padapter) == INTF_SEL4_USB_Combo)
|
||||
{
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG2);
|
||||
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("In SwLedON,LedAddr:%X LEDPIN=%d\n",REG_LEDCFG2, pLed->LedPin));
|
||||
switch(pLed->LedPin)
|
||||
{
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
|
||||
case LED_PIN_LED0:
|
||||
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("In SwLedOn,LedAddr:%X LEDPIN=%d\n",REG_LEDCFG1, pLed->LedPin));
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG0);
|
||||
rtw_write8(padapter, REG_LEDCFG1, (LedCfg&~BIT7)); // SW control led1 on.
|
||||
break;
|
||||
|
||||
case LED_PIN_LED1:
|
||||
PHY_SetMacReg(padapter, 0x64, BIT1, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT15, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT10|BIT9|BIT8, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT11, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(pLed->LedPin)
|
||||
{
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
|
||||
case LED_PIN_LED0: //8192EU don't have LED0, so we jump this case to set LED1
|
||||
LedCfg = rtw_read8(padapter, (REG_LEDCFG1));
|
||||
rtw_write8(padapter, (REG_LEDCFG1), (LedCfg&~BIT7)); // SW control led1 on.
|
||||
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedOn LED1 0x%x\n", rtw_read32(padapter, REG_LEDCFG1)));
|
||||
break;
|
||||
|
||||
case LED_PIN_LED1:
|
||||
PHY_SetMacReg(padapter, 0x64, BIT1, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT15, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT10|BIT9|BIT8, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT11, 0);
|
||||
break;
|
||||
|
||||
case LED_PIN_LED2:
|
||||
LedCfg = rtw_read8(padapter, (REG_LEDCFG2));
|
||||
rtw_write8(padapter, (REG_LEDCFG2), (LedCfg&~BIT7)); // SW control led1 on.
|
||||
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedOn LED2 0x%x\n", rtw_read32(padapter, REG_LEDCFG2)));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pLed->bLedOn = _TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Turn off LED according to LedPin specified.
|
||||
//
|
||||
static void
|
||||
SwLedOff_8192EU(
|
||||
PADAPTER padapter,
|
||||
PLED_USB pLed
|
||||
)
|
||||
{
|
||||
u8 LedCfg;
|
||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||
|
||||
if(padapter->bSurpriseRemoved == _TRUE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( RT_GetInterfaceSelection(padapter) == INTF_SEL2_MINICARD ||
|
||||
RT_GetInterfaceSelection(padapter) == INTF_SEL3_USB_Solo ||
|
||||
RT_GetInterfaceSelection(padapter) == INTF_SEL4_USB_Combo)
|
||||
{
|
||||
RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("In SwLedOff,LedAddr:%X LEDPIN=%d\n",REG_LEDCFG2, pLed->LedPin));
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG2);
|
||||
|
||||
// 2009/10/23 MH Issau eed to move the LED GPIO from bit 0 to bit3.
|
||||
// 2009/10/26 MH Issau if tyhe device is 8c DID is 0x8176, we need to enable bit6 to
|
||||
// enable GPIO8 for controlling LED.
|
||||
// 2010/07/02 Supprt Open-drain arrangement for controlling the LED. Added by Roger.
|
||||
//
|
||||
switch(pLed->LedPin)
|
||||
{
|
||||
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
|
||||
case LED_PIN_LED0: //8192EU don't have LED0, so we jump this case to set LED1
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG1);
|
||||
rtw_write8(padapter, REG_LEDCFG1, LedCfg|BIT7);
|
||||
break;
|
||||
|
||||
case LED_PIN_LED1:
|
||||
PHY_SetMacReg(padapter, 0x64, BIT1, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT15, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT10|BIT9|BIT8, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT11, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(pLed->LedPin)
|
||||
{
|
||||
case LED_PIN_GPIO0:
|
||||
break;
|
||||
|
||||
case LED_PIN_LED0://8192EU don't have LED0, so we jump this case to set LED1
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG1);
|
||||
rtw_write8(padapter, REG_LEDCFG1, LedCfg|BIT7);
|
||||
break;
|
||||
|
||||
case LED_PIN_LED1:
|
||||
PHY_SetMacReg(padapter, 0x64, BIT1, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT15, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT10|BIT9|BIT8, 0);
|
||||
PHY_SetMacReg(padapter, 0x4C, BIT11, 1);
|
||||
break;
|
||||
|
||||
case LED_PIN_LED2:
|
||||
LedCfg = rtw_read8(padapter, REG_LEDCFG2);
|
||||
rtw_write8(padapter, REG_LEDCFG2, LedCfg|BIT7);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pLed->bLedOn = _FALSE;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
// Interface to manipulate LED objects.
|
||||
//================================================================================
|
||||
|
||||
|
||||
//================================================================================
|
||||
// Default LED behavior.
|
||||
//================================================================================
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Initialize all LED_871x objects.
|
||||
//
|
||||
void
|
||||
rtl8192eu_InitSwLeds(
|
||||
_adapter *padapter
|
||||
)
|
||||
{
|
||||
struct led_priv *pledpriv = &(padapter->ledpriv);
|
||||
|
||||
pledpriv->LedControlHandler = LedControlUSB;
|
||||
|
||||
pledpriv->SwLedOn = SwLedOn_8192EU;
|
||||
pledpriv->SwLedOff = SwLedOff_8192EU;
|
||||
|
||||
InitLed(padapter, &(pledpriv->SwLed0), LED_PIN_LED0);
|
||||
|
||||
InitLed(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Description:
|
||||
// DeInitialize all LED_819xUsb objects.
|
||||
//
|
||||
void
|
||||
rtl8192eu_DeInitSwLeds(
|
||||
_adapter *padapter
|
||||
)
|
||||
{
|
||||
struct led_priv *ledpriv = &(padapter->ledpriv);
|
||||
|
||||
DeInitLed( &(ledpriv->SwLed0) );
|
||||
DeInitLed( &(ledpriv->SwLed1) );
|
||||
}
|
||||
|
||||
213
hal/rtl8192e/usb/rtl8192eu_recv.c
Normal file
213
hal/rtl8192e/usb/rtl8192eu_recv.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of version 2 of the GNU General Public License as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
#define _RTL8192E_RECV_C_
|
||||
|
||||
//#include <drv_types.h>
|
||||
#include <rtl8192e_hal.h>
|
||||
|
||||
|
||||
void rtl8192eu_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf)
|
||||
{
|
||||
|
||||
precvbuf->transfer_len = 0;
|
||||
|
||||
precvbuf->len = 0;
|
||||
|
||||
precvbuf->ref_cnt = 0;
|
||||
|
||||
if(precvbuf->pbuf)
|
||||
{
|
||||
precvbuf->pdata = precvbuf->phead = precvbuf->ptail = precvbuf->pbuf;
|
||||
precvbuf->pend = precvbuf->pdata + MAX_RECVBUF_SZ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int rtl8192eu_init_recv_priv(_adapter *padapter)
|
||||
{
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
int i, res = _SUCCESS;
|
||||
struct recv_buf *precvbuf;
|
||||
|
||||
#ifdef CONFIG_RECV_THREAD_MODE
|
||||
_rtw_init_sema(&precvpriv->recv_sema, 0);//will be removed
|
||||
_rtw_init_sema(&precvpriv->terminate_recvthread_sema, 0);//will be removed
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
tasklet_init(&precvpriv->recv_tasklet,
|
||||
(void(*)(unsigned long))rtl8192eu_recv_tasklet,
|
||||
(unsigned long)padapter);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
precvpriv->int_in_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||
if(precvpriv->int_in_urb == NULL){
|
||||
res= _FAIL;
|
||||
DBG_8192C("alloc_urb for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
precvpriv->int_in_buf = rtw_zmalloc(INTERRUPT_MSG_FORMAT_LEN);
|
||||
if(precvpriv->int_in_buf == NULL){
|
||||
res= _FAIL;
|
||||
DBG_8192C("alloc_mem for interrupt in endpoint fail !!!!\n");
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
|
||||
//init recv_buf
|
||||
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
|
||||
|
||||
#ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
_rtw_init_queue(&precvpriv->recv_buf_pending_queue);
|
||||
#endif // CONFIG_USE_USB_BUFFER_ALLOC_RX
|
||||
|
||||
precvpriv->pallocated_recv_buf = rtw_zmalloc(NR_RECVBUFF *sizeof(struct recv_buf) + 4);
|
||||
if(precvpriv->pallocated_recv_buf==NULL){
|
||||
res= _FAIL;
|
||||
RT_TRACE(_module_rtl871x_recv_c_,_drv_err_,("alloc recv_buf fail!\n"));
|
||||
goto exit;
|
||||
}
|
||||
_rtw_memset(precvpriv->pallocated_recv_buf, 0, NR_RECVBUFF *sizeof(struct recv_buf) + 4);
|
||||
|
||||
precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4);
|
||||
|
||||
precvbuf = (struct recv_buf*)precvpriv->precv_buf;
|
||||
|
||||
for(i=0; i < NR_RECVBUFF ; i++)
|
||||
{
|
||||
_rtw_init_listhead(&precvbuf->list);
|
||||
|
||||
_rtw_spinlock_init(&precvbuf->recvbuf_lock);
|
||||
|
||||
precvbuf->alloc_sz = MAX_RECVBUF_SZ;
|
||||
|
||||
res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
|
||||
if(res==_FAIL)
|
||||
break;
|
||||
|
||||
precvbuf->ref_cnt = 0;
|
||||
precvbuf->adapter =padapter;
|
||||
|
||||
|
||||
//rtw_list_insert_tail(&precvbuf->list, &(precvpriv->free_recv_buf_queue.queue));
|
||||
|
||||
precvbuf++;
|
||||
|
||||
}
|
||||
|
||||
precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF;
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
skb_queue_head_init(&precvpriv->rx_skb_queue);
|
||||
|
||||
#ifdef CONFIG_PREALLOC_RECV_SKB
|
||||
{
|
||||
int i;
|
||||
SIZE_PTR tmpaddr=0;
|
||||
SIZE_PTR alignment=0;
|
||||
struct sk_buff *pskb=NULL;
|
||||
|
||||
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
|
||||
|
||||
for(i=0; i<NR_PREALLOC_RECV_SKB; i++)
|
||||
{
|
||||
pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
|
||||
|
||||
if(pskb)
|
||||
{
|
||||
pskb->dev = padapter->pnetdev;
|
||||
|
||||
tmpaddr = (SIZE_PTR)pskb->data;
|
||||
alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
|
||||
skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
|
||||
|
||||
skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
|
||||
}
|
||||
|
||||
pskb=NULL;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
exit:
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
void rtl8192eu_free_recv_priv (_adapter *padapter)
|
||||
{
|
||||
int i;
|
||||
struct recv_buf *precvbuf;
|
||||
struct recv_priv *precvpriv = &padapter->recvpriv;
|
||||
|
||||
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
|
||||
|
||||
for(i=0; i < NR_RECVBUFF ; i++)
|
||||
{
|
||||
rtw_os_recvbuf_resource_free(padapter, precvbuf);
|
||||
precvbuf++;
|
||||
}
|
||||
|
||||
if(precvpriv->pallocated_recv_buf)
|
||||
rtw_mfree(precvpriv->pallocated_recv_buf, NR_RECVBUFF *sizeof(struct recv_buf) + 4);
|
||||
|
||||
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
#ifdef PLATFORM_LINUX
|
||||
if(precvpriv->int_in_urb)
|
||||
{
|
||||
usb_free_urb(precvpriv->int_in_urb);
|
||||
}
|
||||
#endif//PLATFORM_LINUX
|
||||
|
||||
if(precvpriv->int_in_buf)
|
||||
rtw_mfree(precvpriv->int_in_buf, INTERRUPT_MSG_FORMAT_LEN);
|
||||
#endif//CONFIG_USB_INTERRUPT_IN_PIPE
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
||||
if (skb_queue_len(&precvpriv->rx_skb_queue)) {
|
||||
DBG_8192C(KERN_WARNING "rx_skb_queue not empty\n");
|
||||
}
|
||||
|
||||
rtw_skb_queue_purge(&precvpriv->rx_skb_queue);
|
||||
|
||||
#ifdef CONFIG_PREALLOC_RECV_SKB
|
||||
|
||||
if (skb_queue_len(&precvpriv->free_recv_skb_queue)) {
|
||||
DBG_8192C(KERN_WARNING "free_recv_skb_queue not empty, %d\n", skb_queue_len(&precvpriv->free_recv_skb_queue));
|
||||
}
|
||||
|
||||
rtw_skb_queue_purge(&precvpriv->free_recv_skb_queue);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
1217
hal/rtl8192e/usb/rtl8192eu_xmit.c
Normal file
1217
hal/rtl8192e/usb/rtl8192eu_xmit.c
Normal file
File diff suppressed because it is too large
Load Diff
2708
hal/rtl8192e/usb/usb_halinit.c
Normal file
2708
hal/rtl8192e/usb/usb_halinit.c
Normal file
File diff suppressed because it is too large
Load Diff
1215
hal/rtl8192e/usb/usb_ops_linux.c
Normal file
1215
hal/rtl8192e/usb/usb_ops_linux.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user