3
* Copyright (C) 2005, AVM GmbH. All rights reserved.
5
* This Software is free software. You can redistribute and/or
6
* modify such free software under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* The free software is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this Software; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, or see
18
* http://www.opensource.org/licenses/lgpl-license.html
20
* Contact: AVM GmbH, Alt-Moabit 95, 10559 Berlin, Germany, email: info@avm.de
23
#include <asm/atomic.h>
24
#include <asm-generic/bug.h>
25
#include <linux/timer.h>
26
#include <linux/jiffies.h>
27
#include <linux/delay.h>
28
#include <linux/usb.h>
29
#include <linux/percpu.h>
39
#define PRINTF_BUFFER_SIZE 1024
42
# define LOG_INTERFACE
45
/*---------------------------------------------------------------------------*\
47
* Interface from stack
49
\*---------------------------------------------------------------------------*/
51
/*---------------------------------------------------------------------------*\
53
\*---------------------------------------------------------------------------*/
55
static int nl_needed = 1;
58
__attr void report (char *fmt, va_list args) {
61
char buffer[PRINTF_BUFFER_SIZE];
62
char * bufptr = buffer;
69
count = vsnprintf (bufptr, sizeof (buffer), fmt, args);
70
if ('\n' == buffer[0]) {
73
if ('\n' != buffer[count - 1]) {
74
assert (count < (int) (sizeof (buffer) - 2));
75
buffer[count++] = '\n';
76
buffer[count] = (char) 0;
86
/*---------------------------------------------------------------------------*\
87
\*---------------------------------------------------------------------------*/
88
__attr void os_debug_printf (char *fmt, ...) {
90
char buffer [PRINTF_BUFFER_SIZE];
93
vsnprintf (buffer, sizeof (buffer), fmt, args);
98
/*---------------------------------------------------------------------------*\
100
\*---------------------------------------------------------------------------*/
101
__attr void *os_memory_alloc (void *os_context, unsigned int size) {
104
LOG("os_memory_alloc called.\n");
106
return hmalloc (size);
109
/*---------------------------------------------------------------------------*\
110
\*---------------------------------------------------------------------------*/
111
__attr void *os_memory_calloc (
117
LOG("os_memory_calloc called.\n");
119
return hcalloc (number * size);
122
/*static __attr void *os_memory_zero (
125
unsigned int length) {
127
LOG("os_memory_calloc called.\n");
131
/*static __attr void os_memory_copy (
137
LOG("os_memory_copy called.\n");
140
/*static __attr void os_memory_move (
146
LOG("os_memory_copy called.\n");
149
/*---------------------------------------------------------------------------*\
150
\*---------------------------------------------------------------------------*/
151
__attr void os_memory_free (
157
LOG("os_memory_free called.\n");
163
/*attr int os_memory_compare (
173
/*---------------------------------------------------------------------------*\
174
* Timer functions and data structures
175
\*---------------------------------------------------------------------------*/
179
struct timer_list *timer;
180
void (__attr2 *routine) (void*);
183
unsigned int delay_jiffies;
184
} timer_data_t, *timer_data_p;
186
/*---------------------------------------------------------------------------*\
187
\*---------------------------------------------------------------------------*/
188
static void generic_timer_function (unsigned long timer_handle) {
190
timer_data_p timer_data = (timer_data_p)timer_handle;
191
struct timer_list *timer = timer_data->timer;
195
LOG("Timer expired (%p).\n", timer_data);
198
if ((atomic_read (&timer_data->pdc->shutdown)) ||
199
(*wlan_lib->get_built_in_test_status_param) (wlan_card->stack_ctx)) {
200
LOG("Timer callback interruption.\n");
203
os_protect_lock (wlan_card, wlan_card->system_lock);
204
(*timer_data->routine) (timer_data->timer_context);
205
os_protect_unlock (wlan_card, wlan_card->system_lock);
208
if (timer_data->periodic) {
209
timer->expires = jiffies + timer_data->delay_jiffies;
210
spin_lock_irqsave (&timer_data->lock, flags);
211
if (timer_pending (timer)) {
213
ERROR("Active timer in own timer function!\n");
214
ERROR("(Perhaps callback started periodic timer?)\n");
218
spin_unlock_irqrestore (&timer_data->lock, flags);
222
/*---------------------------------------------------------------------------*\
223
\*---------------------------------------------------------------------------*/
224
__attr void *os_timer_create (
226
void (__attr2 *p_routine) (void*),
229
timer_data_p timer_data = (timer_data_p)hmalloc(sizeof(timer_data_t));
230
struct timer_list *timer = (struct timer_list*) hmalloc(sizeof(struct timer_list));
233
LOG("os_timer_create called (%p).\n", timer_data);
236
if (!timer_data || !timer)
239
timer_data->pdc = (card_p)os_context;
240
spin_lock_init (&timer_data->lock);
241
timer_data->timer = timer;
242
timer_data->routine = p_routine;
243
timer_data->timer_context = context;
246
timer->function = &generic_timer_function;
247
timer->data = (unsigned long)timer_data;
249
return (void*)timer_data;
252
/*---------------------------------------------------------------------------*\
253
\*---------------------------------------------------------------------------*/
254
__attr void os_timer_destroy (void *os_context, void *timer_handle) {
257
LOG("os_timer_destroy called (%p).\n", timer_handle);
260
timer_data_p timer_data = (timer_data_p)timer_handle;
261
struct timer_list *timer = timer_data->timer;
263
if (timer_pending (timer))
264
del_timer_sync (timer);
270
/*---------------------------------------------------------------------------*\
271
\*---------------------------------------------------------------------------*/
272
__attr void os_timer_start (
275
unsigned int delay_ms,
279
LOG("os_timer_start called (%p).\n", timer_handle);
282
timer_data_p timer_data = (timer_data_p)timer_handle;
283
struct timer_list *timer = timer_data->timer;
286
if ((atomic_read (&timer_data->pdc->shutdown)) ||
287
(*wlan_lib->get_built_in_test_status_param) (wlan_card->stack_ctx)) {
288
LOG("Start of timer interrupted.\n");
292
timer_data->periodic = b_periodic;
293
timer_data->delay_jiffies = (MSEC2JIFF(delay_ms));
295
spin_lock_irqsave (&timer_data->lock, flags);
296
if (timer_pending (timer)) {
298
LOG("Trying to start active timer!\n");
300
timer->expires = jiffies + timer_data->delay_jiffies;
303
spin_unlock_irqrestore (&timer_data->lock, flags);
306
/*---------------------------------------------------------------------------*\
307
\*---------------------------------------------------------------------------*/
308
__attr void os_timer_stop (void *os_context, void *timer_handle) {
311
LOG("os_timer_stop called (%p).\n", timer_handle);
314
timer_data_p timer_data = (timer_data_p)timer_handle;
315
struct timer_list *timer = timer_data->timer;
317
if (timer_pending (timer))
318
del_timer_sync (timer);
321
/*---------------------------------------------------------------------------*\
322
\*---------------------------------------------------------------------------*/
323
__attr unsigned int os_time_stamp_ms (void *os_context) {
326
LOG("os_time_stamp_ms called.\n");
328
return (JIFF2MSEC((unsigned int) jiffies_64));
331
/*---------------------------------------------------------------------------*\
332
\*---------------------------------------------------------------------------*/
333
__attr unsigned int os_time_stamp_us (void *os_context) {
336
LOG("os_time_stamp_us called.\n");
341
/*---------------------------------------------------------------------------*\
342
* Protection services
343
\*---------------------------------------------------------------------------*/
344
__attr void *os_atomic_create (void *os_context, int value) {
349
LOG("os_atomic_init called.\n");
352
atomic = (atomic_t*) hmalloc (sizeof (atomic_t));
357
atomic_set (atomic, value);
359
return (void*)atomic;
362
__attr void os_atomic_destroy (void *os_context, void *atomic_context) {
367
LOG("os_atomic_destroy called.\n");
370
atomic = (atomic_t*) atomic_context;
374
__attr int os_atomic_inc (void *os_context, void *atomic_context) {
379
LOG("os_atomic_inc called.\n");
382
atomic = (atomic_t*) atomic_context;
384
return atomic_add_return (1, atomic);
387
__attr int os_atomic_dec (void *os_context, void *atomic_context) {
392
LOG("os_atomic_dec called.\n");
395
atomic = (atomic_t*) atomic_context;
397
return atomic_sub_return (1, atomic);
403
#if !defined (NDEBUG)
406
} lock_data_t, *lock_data_p;
408
/*---------------------------------------------------------------------------*\
409
\*---------------------------------------------------------------------------*/
410
__attr void *os_protect_create (void *os_context) {
413
LOG("os_protect_create called.\n");
416
lock_data_p lock_data = (lock_data_p) hmalloc (sizeof (lock_data_t));
418
if (lock_data == NULL)
421
spin_lock_init (&lock_data->lock);
422
#if !defined (NDEBUG)
423
lock_data->lock_count = (int*) alloc_percpu (int);
424
if (lock_data->lock_count == NULL) {
430
return (void*)lock_data;
433
/*---------------------------------------------------------------------------*\
434
\*---------------------------------------------------------------------------*/
435
__attr void os_protect_destroy (void *os_context, void* protect_context) {
438
LOG("os_protect_destroy called.\n");
441
lock_data_p lock_data = (lock_data_p)protect_context;
443
#if !defined (NDEBUG)
444
free_percpu (lock_data->lock_count);
449
/*---------------------------------------------------------------------------*\
450
\*---------------------------------------------------------------------------*/
451
__attr void os_protect_lock (void* os_context, void *protect_context) {
454
LOG("os_protect_lock called.\n");
457
unsigned long local_flags;
458
#if !defined (NDEBUG)
459
int cpu = get_cpu ();
462
lock_data_p lock_data = (lock_data_p)(protect_context);
464
#if !defined (NDEBUG)
465
if (spin_trylock_irqsave (&lock_data->lock, local_flags)) {
466
goto OS_PROTECT_LOCK_OUT;
468
if (*(int*) per_cpu_ptr (lock_data->lock_count, cpu)) {
469
ERROR("System lock already locked on this (%d) cpu!\n", get_cpu ());
471
goto OS_PROTECT_LOCK_OUT;
475
spin_lock_irqsave (&lock_data->lock, local_flags);
476
lock_data->flags = local_flags;
477
#if !defined (NDEBUG)
479
(*(int*) per_cpu_ptr (lock_data->lock_count, cpu))++;
484
/*---------------------------------------------------------------------------*\
485
\*---------------------------------------------------------------------------*/
486
__attr void os_protect_unlock (void *os_context, void *protect_context) {
489
LOG("os_protect_unlock called.\n");
492
lock_data_p lock_data = (lock_data_p)(protect_context);
493
#if !defined (NDEBUG)
494
int cpu = get_cpu ();
497
#if !defined (NDEBUG)
498
if (!*(int*) per_cpu_ptr (lock_data->lock_count, cpu)) {
499
ERROR("System lock not locked!\n");
505
(*(int*) per_cpu_ptr (lock_data->lock_count, cpu))--;
506
if (*(int*) per_cpu_ptr (lock_data->lock_count, cpu)) {
507
NOTE("Removing lock protection on cpu %d.\n", get_cpu ());
515
spin_unlock_irqrestore (&lock_data->lock, lock_data->flags);
518
/*---------------------------------------------------------------------------*\
519
* Hardware access functions
520
\*---------------------------------------------------------------------------*/
521
__attr void *os_hw_get_registers_addr (void *os_context) {
524
LOG("os_hw_get_register_addr called.\n");
526
/*TODO: Is this sufficient?*/
530
/*---------------------------------------------------------------------------*\
531
\*---------------------------------------------------------------------------*/
532
__attr void *os_hw_get_memory_addr (void *os_context) {
535
LOG("os_hw_get_memory_addr called.\n");
537
/*TODO: Is this sufficient?*/
541
/*---------------------------------------------------------------------------*\
542
* Register access functions
543
\*---------------------------------------------------------------------------*/
544
__attr void os_stall_u_sec (void *os_context, unsigned int u_sec) {
547
LOG("os_stall_u_sec called.\n");
550
LOG("Waiting for %d usec.\n", u_sec);
552
mdelay((unsigned int)(u_sec/1000));
557
/*---------------------------------------------------------------------------*\
558
\*---------------------------------------------------------------------------*/
559
__attr int os_receive_packet (
562
unsigned short length) {
565
LOG("\n\nos_receive_packet called.\n\n\n");
568
card_p pdc = (card_p)os_context;
570
return net_rx (pdc->net_dev, p_packet, length);
573
/*---------------------------------------------------------------------------*\
574
\*---------------------------------------------------------------------------*/
575
__attr int os_get_eeeprom_image (
577
unsigned char **p_bufffer,
578
unsigned int *length) {
581
LOG("os_get_eeeprom_image called.\n");
586
/*---------------------------------------------------------------------------*\
587
\*---------------------------------------------------------------------------*/
588
__attr void os_power_state_busy (void *os_context) {
591
LOG("os_power_state_busy called.\n");
595
/*---------------------------------------------------------------------------*\
596
\*---------------------------------------------------------------------------*/
597
__attr void os_power_state_idle (void *os_context) {
600
LOG("os_power_state_idle called.\n");
604
/*---------------------------------------------------------------------------*\
605
\*---------------------------------------------------------------------------*/
606
__attr void os_set_wake_on_gpio (void *os_context) {
609
LOG("os_set_wake_on_gpio called.\n");
613
/*---------------------------------------------------------------------------*\
614
\*---------------------------------------------------------------------------*/
615
__attr void os_reset_wake_on_gpio (void *os_context) {
618
LOG("os_reset_wake_on_gpio called.\n");
622
/*---------------------------------------------------------------------------*\
624
\*---------------------------------------------------------------------------*/
625
#define GET_PIPE(dir,type,usb_dev,ep) (usb_##dir##type##pipe(usb_dev, ep))
626
__attr unsigned int os_usb_write (
629
usb_caller_extension_p p_caller_ext,
630
usb_caller_extension_p p_caller_err) {
633
LOG("os_usb_write called.\n");
636
struct usb_device *dev;
639
assert(adapter != NULL);
640
info(p_caller_ext == NULL);
642
card = (card_p)adapter;
645
pipe = GET_PIPE(snd, bulk, dev, 1);
646
return usb_write_async (dev, pipe, msdu, card->epwrite->wMaxPacketSize,
647
p_caller_ext, p_caller_err);
650
/*---------------------------------------------------------------------------*\
651
\*---------------------------------------------------------------------------*/
652
__attr unsigned char *os_usb_rx_buf_get (
654
unsigned int *n_bytes_read,
655
unsigned int *p_handle) {
658
LOG("os_usb_rx_buf_get called.\n");
666
if (unlist_urb_for_data (wlan_card->rx_pool, &purb, &ptr)) {
668
LOG("os_usb_rx_buf_get: Getting data from URB %p\n", purb);
670
*n_bytes_read = purb->actual_length;
671
/*FIXME: Not 64 bit ready!*/
672
*p_handle = (unsigned int)purb;
673
ret = (unsigned char*)purb->transfer_buffer;
674
pctx = (urb_context_p)ptr;
675
atomic_set (&pctx->ref, 1);
677
ERROR("os_usb_rx_buf_get: No URB with data pending!\n");
679
*p_handle = (unsigned int)NULL;
684
LOG("%x %d\n", ret, *n_bytes_read);
690
/*---------------------------------------------------------------------------*\
691
\*---------------------------------------------------------------------------*/
692
__attr unsigned int os_usb_rx_buf_inc_ref (unsigned int handle) {
695
LOG("os_usb_rx_buf_inc_ref called.\n");
698
struct urb *purb = (struct urb*)handle;
703
ERROR("os_usb_rx_buf_inc_ref: NULL pointer URB!");
708
LOG("Increment reference count for URB %p.\n", purb);
711
get_ctx (purb, wlan_card->rx_pool, &ptr);
712
pctx = (urb_context_p)ptr;
713
atomic_inc (&pctx->ref);
715
return atomic_read (&pctx->ref);
718
/*---------------------------------------------------------------------------*\
719
\*---------------------------------------------------------------------------*/
720
__attr int os_usb_rx_buf_free (void* p_adapter, unsigned int handle) {
723
LOG("os_usb_rx_buf_free called.\n");
726
/*FIXME: Not 64 bit ready!*/
727
struct urb *purb = (struct urb*)handle;
732
ERROR("os_usb_rx_buf_free: NULL pointer URB!\n");
736
get_ctx (purb, wlan_card->rx_pool, &ptr);
737
pctx = (urb_context_p)ptr;
738
atomic_dec (&pctx->ref);
739
if (atomic_read (&pctx->ref) > 0) {
741
LOG("os_usb_rx_buf_free: Freeing URB %p rejected.\n", purb);
747
LOG("os_usb_rx_buf_free: Releasing URB %p\n", purb);
750
release_urb (wlan_card->rx_pool, purb);
752
usb_start_read (wlan_card);
757
/*---------------------------------------------------------------------------*\
758
\*---------------------------------------------------------------------------*/
759
__attr unsigned int os_usb_write_cmd_sync (
761
unsigned char *in_buffer,
762
unsigned int n_bytes_to_write,
763
unsigned char *out_buffer,
764
unsigned int n_bytes_to_read,
765
unsigned int *n_bytes_read) {
768
LOG("os_usb_write_cmd_sync called.\n");
771
struct usb_device *dev;
772
unsigned int pipe, n_bytes_written, res = STACK_USB_ERROR;
774
assert(adapter != NULL);
776
card = (card_p)adapter;
779
pipe = GET_PIPE(snd, ctrl, dev, 0);
780
if (!(res = usb_read_write_sync (
781
dev, pipe, in_buffer, n_bytes_to_write,
782
&n_bytes_written, HZ))) {
783
pipe = GET_PIPE(rcv, ctrl, dev, 0);
784
res = usb_read_write_sync (
785
dev, pipe, out_buffer, n_bytes_to_read,
792
/*---------------------------------------------------------------------------*\
793
\*---------------------------------------------------------------------------*/
794
__attr unsigned int os_usb_write_cmd_async (
796
unsigned char *in_buffer,
797
unsigned int n_bytes_write,
798
unsigned char *out_buffer,
799
unsigned int *n_bytes_read,
800
usb_caller_extension_p caller_ext) {
803
LOG("os_usb_write_cmd_async called.\n");
806
struct usb_device *dev;
807
unsigned int pipe, res = STACK_USB_ERROR;
809
assert (adapter!=NULL);
811
card = (card_p)adapter;
814
assert (in_buffer != NULL);
815
assert (card != NULL);
816
assert (dev != NULL);
818
pipe = GET_PIPE (snd, ctrl, dev, 0);
819
if ((res = usb_read_write_cmd_async (dev, pipe, in_buffer,
820
n_bytes_write, NULL)) == STACK_USB_OK) {
821
if (out_buffer != NULL) {
822
pipe = GET_PIPE (rcv, ctrl, dev, 0);
823
res = usb_read_write_cmd_async (
824
dev, pipe, out_buffer, MAX_EP0_IN, caller_ext);
831
/*---------------------------------------------------------------------------*\
832
\*---------------------------------------------------------------------------*/
833
__attr unsigned int os_usb_write_sync (
836
unsigned char *buffer,
837
unsigned int n_bytes_to_write,
838
unsigned int *n_bytes_written) {
841
LOG("os_usb_write_sync called.\n");
844
struct usb_device *dev;
847
assert(adapter != NULL);
849
card = (card_p)adapter;
854
pipe = GET_PIPE(snd, ctrl, dev, ep);
857
pipe = GET_PIPE(snd, bulk, dev, ep);
860
pipe = GET_PIPE(rcv, bulk, dev, ep);
861
ERROR("\nos_usb_write_sync called with in endpoint?\n\n");
864
ERROR("Unkown Endpoint.\n");
865
goto ERROR_WRITE_SYNC;
868
return usb_read_write_sync (
869
dev, pipe, buffer, n_bytes_to_write,
870
n_bytes_written, HZ);
873
return STACK_USB_ERROR;
876
/*---------------------------------------------------------------------------*\
877
\*---------------------------------------------------------------------------*/
878
__attr unsigned int os_usb_read_sync (
881
unsigned char *buffer,
882
unsigned int n_bytes_to_read,
883
unsigned int timeout_ms,
884
unsigned int *n_bytes_read) {
887
LOG("os_usb_read_sync called.\n");
890
struct usb_device *dev;
893
assert(adapter != NULL);
895
card = (card_p)adapter;
900
pipe = GET_PIPE(rcv, ctrl, dev, ep);
903
pipe = GET_PIPE(snd, bulk, dev, ep);
904
ERROR("\nos_usb_read_sync called with out endpoint?\n\n");
907
pipe = GET_PIPE(rcv, bulk, dev, ep);
910
ERROR("Unkown Endpoint.\n");
911
goto ERROR_READ_SYNC;
914
return usb_read_write_sync (
915
dev, pipe, (void*)buffer, n_bytes_to_read,
916
n_bytes_read, MSEC2JIFF(timeout_ms));
919
return STACK_USB_ERROR;
922
/*---------------------------------------------------------------------------*\
923
\*---------------------------------------------------------------------------*/
924
__attr int os_usb_is_alive (void *adapter) {
927
LOG("os_usb_is_alive called.\n");
933
/*---------------------------------------------------------------------------*\
934
\*---------------------------------------------------------------------------*/
935
__attr int os_usb_write_available (void *adapter) {
938
LOG("os_usb_write_availbale called.\n");
942
assert (adapter != NULL);
944
pdc = (card_p)adapter;
946
if (!POOL_GET_FREE(pdc->tx_pool))
952
/*---------------------------------------------------------------------------*\
953
\*---------------------------------------------------------------------------*/
954
__attr unsigned int os_usb_write_check_size (void *adapter) {
957
LOG("os_usb_write_check_size called.\n");
960
card_p pdc = (card_p)adapter;
962
return POOL_GET_FREE(pdc->tx_pool);
966
/*---------------------------------------------------------------------------*\
967
\*---------------------------------------------------------------------------*/
968
__attr int os_usb_need_file_padding (
970
unsigned int total_file_xfer_size,
971
unsigned int xfer_size) {
973
card_p pdc = (card_p)p_adapter;
974
unsigned long packets;
977
LOG("os_usb_need_file_padding called.\n");
980
packets = ((total_file_xfer_size - 1) / pdc->epwrite->wMaxPacketSize) + 1;
989
/*---------------------------------------------------------------------------*\
990
\*---------------------------------------------------------------------------*/
991
__attr int os_usb_start_recovery_worker (
993
int (__attr2 *recovery_worker_routine) (void*, void*),
996
return start_recovery_worker (
998
recovery_worker_routine,
1002
/*---------------------------------------------------------------------------*\
1004
\*---------------------------------------------------------------------------*/
1005
__attr int os_ipc_event_send (
1007
fwlanusb_event_t event,
1009
unsigned int event_data_size) {
1011
#ifdef LOG_INTERFACE
1012
LOG("os_ipc_event_send called.\n");
1014
wext_event_send (h_adapter, event, event_data, event_data_size);
1019
/*---------------------------------------------------------------------------*\
1020
\*---------------------------------------------------------------------------*/
1021
__attr int os_ipc_unbound_event_send (void *h_adapter) {
1023
#ifdef LOG_INTERFACE
1024
LOG("os_ipc_unbound_event_send called.\n");
1030
#ifndef __WITHOUT_INTERFACE__
1031
/*---------------------------------------------------------------------------*\
1032
* Interface initialisation
1033
\*---------------------------------------------------------------------------*/
1034
static lib_callback_t * lib = NULL;
1035
static lib_interface_t libif = {
1038
.dprintf = &os_debug_printf,
1039
.memory_alloc = &os_memory_alloc,
1040
.memory_calloc = &os_memory_calloc,
1041
.memory_free = &os_memory_free,
1042
.timer_create = &os_timer_create,
1043
.timer_destroy = &os_timer_destroy,
1044
.timer_start = &os_timer_start,
1045
.timer_stop = &os_timer_stop,
1046
.time_stamp_ms = &os_time_stamp_ms,
1047
.time_stamp_us = &os_time_stamp_us,
1048
.atomic_create = &os_atomic_create,
1049
.atomic_destroy = &os_atomic_destroy,
1050
.atomic_inc = &os_atomic_inc,
1051
.atomic_dec = &os_atomic_dec,
1052
.protect_create = &os_protect_create,
1053
.protect_destroy = &os_protect_destroy,
1054
.protect_lock = &os_protect_lock,
1055
.protect_unlock = &os_protect_unlock,
1056
.hw_get_registers_addr = &os_hw_get_registers_addr,
1057
.hw_get_memory_addr = &os_hw_get_memory_addr,
1058
.stall_u_sec = &os_stall_u_sec,
1059
.receive_packet = &os_receive_packet,
1060
.get_eeeprom_image = &os_get_eeeprom_image,
1061
.power_state_busy = &os_power_state_busy,
1062
.power_state_idle = &os_power_state_idle,
1063
.set_wake_on_gpio = &os_set_wake_on_gpio,
1064
.reset_wake_on_gpio = &os_reset_wake_on_gpio,
1065
.usb_write = &os_usb_write,
1066
.usb_rx_buf_get = &os_usb_rx_buf_get,
1067
.usb_rx_buf_inc_ref = &os_usb_rx_buf_inc_ref,
1068
.usb_rx_buf_free = &os_usb_rx_buf_free,
1069
.usb_write_cmd_sync = &os_usb_write_cmd_sync,
1070
.usb_write_cmd_async = &os_usb_write_cmd_async,
1071
.usb_write_sync = &os_usb_write_sync,
1072
.usb_read_sync = &os_usb_read_sync,
1073
.usb_is_alive = &os_usb_is_alive,
1074
.usb_write_available = &os_usb_write_available,
1075
.usb_write_check_size = &os_usb_write_check_size,
1076
.usb_need_file_padding = &os_usb_need_file_padding,
1077
.usb_start_recovery_worker = &os_usb_start_recovery_worker,
1078
.ipc_event_send = &os_ipc_event_send,
1079
.ipc_unbound_event_send = &os_ipc_unbound_event_send,
1085
/*---------------------------------------------------------------------------*\
1086
* Interface functions
1087
\*---------------------------------------------------------------------------*/
1088
lib_callback_t * get_library (void) {
1093
/*---------------------------------------------------------------------------*\
1094
\*---------------------------------------------------------------------------*/
1095
lib_callback_t * link_library (void * context) {
1097
LOG("Interface exchange... (%d)\n", sizeof (lib_interface_t));
1098
return (lib = avm_lib_attach (&libif, context));
1099
} /* link_library */
1101
/*---------------------------------------------------------------------------*\
1102
\*---------------------------------------------------------------------------*/
1103
void free_library (void) {
1107
avm_lib_detach (&libif);
1109
} /* free_library */