OLD | NEW |
(Empty) | |
| 1 //------------------------------------------------------------------------------ |
| 2 // <copyright file="hci_bridge.c" company="Atheros"> |
| 3 // Copyright (c) 2009 Atheros Corporation. All rights reserved. |
| 4 // |
| 5 // This program is free software; you can redistribute it and/or modify |
| 6 // it under the terms of the GNU General Public License version 2 as |
| 7 // published by the Free Software Foundation; |
| 8 // |
| 9 // Software distributed under the License is distributed on an "AS |
| 10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 11 // implied. See the License for the specific language governing |
| 12 // rights and limitations under the License. |
| 13 // |
| 14 // |
| 15 //------------------------------------------------------------------------------ |
| 16 //============================================================================== |
| 17 // HCI bridge implementation |
| 18 // |
| 19 // Author(s): ="Atheros" |
| 20 //============================================================================== |
| 21 #include <a_config.h> |
| 22 #include <athdefs.h> |
| 23 #include "a_types.h" |
| 24 #include "a_osapi.h" |
| 25 #include "htc_api.h" |
| 26 #include "a_drv.h" |
| 27 #include "hif.h" |
| 28 #include "common_drv.h" |
| 29 #include "a_debug.h" |
| 30 #include "hci_transport_api.h" |
| 31 |
| 32 #include "AR6002/hw4.0/hw/apb_athr_wlan_map.h" |
| 33 #include "AR6002/hw4.0/hw/uart_reg.h" |
| 34 #include "AR6002/hw4.0/hw/rtc_wlan_reg.h" |
| 35 |
| 36 HCI_TRANSPORT_HANDLE (*_HCI_TransportAttach)(void *HTCHandle, HCI_TRANSPORT_CONF
IG_INFO *pInfo); |
| 37 void (*_HCI_TransportDetach)(HCI_TRANSPORT_HANDLE HciTrans); |
| 38 A_STATUS (*_HCI_TransportAddReceivePkts)(HCI_TRANSPORT_HANDLE HciTrans, HTC_P
ACKET_QUEUE *pQueue); |
| 39 A_STATUS (*_HCI_TransportSendPkt)(HCI_TRANSPORT_HANDLE HciTrans, HTC_PACKET *
pPacket, A_BOOL Synchronous); |
| 40 void (*_HCI_TransportStop)(HCI_TRANSPORT_HANDLE HciTrans); |
| 41 A_STATUS (*_HCI_TransportStart)(HCI_TRANSPORT_HANDLE HciTrans); |
| 42 A_STATUS (*_HCI_TransportEnableDisableAsyncRecv)(HCI_TRANSPORT_HANDLE HciTran
s, A_BOOL Enable); |
| 43 A_STATUS (*_HCI_TransportRecvHCIEventSync)(HCI_TRANSPORT_HANDLE HciTrans, |
| 44 HTC_PACKET *pPacket, |
| 45 int MaxPollMS); |
| 46 |
| 47 extern HCI_TRANSPORT_CALLBACKS ar6kHciTransCallbacks; |
| 48 |
| 49 A_STATUS ar6000_register_hci_transport(HCI_TRANSPORT_CALLBACKS *hciTransCallback
s) |
| 50 { |
| 51 ar6kHciTransCallbacks = *hciTransCallbacks; |
| 52 |
| 53 _HCI_TransportAttach = HCI_TransportAttach; |
| 54 _HCI_TransportDetach = HCI_TransportDetach; |
| 55 _HCI_TransportAddReceivePkts = HCI_TransportAddReceivePkts; |
| 56 _HCI_TransportSendPkt = HCI_TransportSendPkt; |
| 57 _HCI_TransportStop = HCI_TransportStop; |
| 58 _HCI_TransportStart = HCI_TransportStart; |
| 59 _HCI_TransportEnableDisableAsyncRecv = HCI_TransportEnableDisableAsyncRecv; |
| 60 _HCI_TransportRecvHCIEventSync = HCI_TransportRecvHCIEventSync; |
| 61 |
| 62 return A_OK; |
| 63 } |
| 64 |
| 65 A_STATUS |
| 66 ar6000_get_hif_dev(HIF_DEVICE *device, void *config) |
| 67 { |
| 68 A_STATUS status; |
| 69 |
| 70 status = HIFConfigureDevice(device, |
| 71 HIF_DEVICE_GET_OS_DEVICE, |
| 72 (HIF_DEVICE_OS_DEVICE_INFO *)config, |
| 73 sizeof(HIF_DEVICE_OS_DEVICE_INFO)); |
| 74 return status; |
| 75 } |
| 76 |
| 77 A_STATUS ar6000_set_uart_config(HIF_DEVICE *hifDevice, |
| 78 A_UINT32 scale, |
| 79 A_UINT32 step) |
| 80 { |
| 81 A_UINT32 regAddress; |
| 82 A_UINT32 regVal; |
| 83 A_STATUS status; |
| 84 |
| 85 regAddress = WLAN_UART_BASE_ADDRESS | UART_CLKDIV_ADDRESS; |
| 86 regVal = ((A_UINT32)scale << 16) | step; |
| 87 /* change the HCI UART scale/step values through the diagnostic window */ |
| 88 status = ar6000_WriteRegDiag(hifDevice, ®Address, ®Val);
|
| 89 |
| 90 return status; |
| 91 } |
| 92 |
| 93 A_STATUS ar6000_get_core_clock_config(HIF_DEVICE *hifDevice, A_UINT32 *data) |
| 94 { |
| 95 A_UINT32 regAddress; |
| 96 A_STATUS status; |
| 97 |
| 98 regAddress = WLAN_RTC_BASE_ADDRESS | WLAN_CPU_CLOCK_ADDRESS; |
| 99 /* read CPU clock settings*/ |
| 100 status = ar6000_ReadRegDiag(hifDevice, ®Address, data); |
| 101 |
| 102 return status; |
| 103 } |
| 104 |
| 105 EXPORT_SYMBOL(ar6000_register_hci_transport); |
| 106 EXPORT_SYMBOL(ar6000_get_hif_dev); |
| 107 EXPORT_SYMBOL(ar6000_set_uart_config); |
| 108 EXPORT_SYMBOL(ar6000_get_core_clock_config); |
| 109 EXPORT_SYMBOL(_HCI_TransportAttach); |
| 110 EXPORT_SYMBOL(_HCI_TransportDetach); |
| 111 EXPORT_SYMBOL(_HCI_TransportAddReceivePkts); |
| 112 EXPORT_SYMBOL(_HCI_TransportSendPkt); |
| 113 EXPORT_SYMBOL(_HCI_TransportStop); |
| 114 EXPORT_SYMBOL(_HCI_TransportStart); |
| 115 EXPORT_SYMBOL(_HCI_TransportEnableDisableAsyncRecv); |
| 116 EXPORT_SYMBOL(_HCI_TransportRecvHCIEventSync); |
OLD | NEW |