3 Copyright (C) 2010-2012 Neil Cafferkey
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 #include <exec/memory.h>
29 #include <proto/exec.h>
30 #include <proto/timer.h>
33 #include <aros/debug.h>
40 static int ath_hal_debug
= 1;
43 int ath_hal_dma_beacon_response_time
= 2; /* in TU's */
44 int ath_hal_sw_beacon_response_time
= 10; /* in TU's */
45 int ath_hal_additional_swba_backoff
= 0; /* in TU's */
47 struct DevBase
*hal_dev_base
;
49 #define base hal_dev_base
52 void ath_hal_vprintf(APTR ah
, const char* fmt
, va_list ap
)
58 void ath_hal_printf(APTR ah
, const char* fmt
, ...)
64 void HALDEBUG(APTR ah
, unsigned int mask
, const char* fmt
, ...)
69 kprintf("[atheros] ");
72 ath_hal_vprintf(ah
, fmt
, ap
);
79 const char *ath_hal_ether_sprintf(const UBYTE
*mac
)
81 static char etherbuf
[18];
83 snprintf(etherbuf
, sizeof(etherbuf
), "%02x:%02x:%02x:%02x:%02x:%02x",
84 mac
[0], mac
[1], mac
[2], mac
[3], mac
[4], mac
[5]);
93 void ath_hal_delay(int n
)
95 struct timeval time
, end_time
;
97 GetSysTime(&end_time
);
100 AddTime(&end_time
, &time
);
102 while(CmpTime(&end_time
, &time
) < 0)
110 ULONG
ath_hal_getuptime(APTR ah
)
116 return time
.tv_secs
* 1000 + time
.tv_micro
/ 1000;
121 void *ath_hal_malloc(size_t size
)
123 return AllocVec(size
, MEMF_PUBLIC
| MEMF_CLEAR
);
128 void ath_hal_free(void* p
)
135 void ath_hal_memzero(void *dst
, size_t n
)
145 void *ath_hal_memcpy(void *dst
, const void *src
, size_t n
)
147 CopyMem(src
, dst
, n
);
154 int ath_hal_memcmp(const void *a
, const void *b
, size_t n
)
156 const UBYTE
*ba
= a
, *bb
= b
;
158 while(n
!= 0 && *ba
== *bb
)