Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / devs / networks / etherlink3 / pccard.c
bloba697ee90aeed511d0fd652af97c59e6744c179d3
1 /*
3 Copyright (C) 2000-2005 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,
18 MA 02111-1307, USA.
23 #include <exec/types.h>
24 #include <utility/tagitem.h>
25 #include <libraries/pccard.h>
27 #include <proto/exec.h>
28 #include <proto/utility.h>
29 #include <proto/cardres.h>
30 #include <proto/pccard.h>
32 #include "device.h"
33 /*#include "io.h"*/
35 #include "pccard_protos.h"
36 #include "unit_protos.h"
38 #define MAX_TUPLE_SIZE 0xff
39 #define TUPLE_BUFFER_SIZE (MAX_TUPLE_SIZE + 8)
40 #define HANDLE_PRIORITY 10
41 #define IO_WINDOW_SIZE 0x10
44 struct BusContext
46 struct DevUnit *unit;
47 struct CardHandle *card_handle;
48 UBYTE *tuple_buffer;
49 UPINT config_base;
50 UPINT io_base;
51 UWORD resource_version;
52 BOOL have_card;
56 /* Private prototypes */
58 static struct DevUnit *FindPCCardUnit(ULONG index, struct DevBase *base);
59 static struct DevUnit *CreatePCCardUnit(ULONG index,
60 struct DevBase *base);
61 static struct BusContext *AllocCard(struct DevBase *base);
62 static VOID FreeCard(struct BusContext *context, struct DevBase *base);
63 static BOOL IsCardCompatible(struct BusContext *context,
64 struct DevBase *base);
65 static BOOL InitialiseCard(struct BusContext *context,
66 struct DevBase *base);
67 static VOID CardRemovedHook(struct BusContext *context,
68 struct DevBase *base);
69 static BOOL CardInsertedHook(struct BusContext *context,
70 struct DevBase *base);
71 static VOID CardRemovedInt(REG(a1, struct BusContext *context),
72 REG(a6, APTR int_code));
73 static VOID CardInsertedInt(REG(a1, struct BusContext *context),
74 REG(a6, APTR int_code));
75 static UBYTE CardStatusInt(REG(d0, UBYTE mask),
76 REG(a1, struct BusContext *context), REG(a6, APTR int_code));
77 static UBYTE ByteInHook(struct BusContext *context, ULONG offset);
78 static ULONG LongInHook(struct BusContext *context, ULONG offset);
79 static VOID ByteOutHook(struct BusContext *context, ULONG offset,
80 UBYTE value);
81 static VOID WordOutHook(struct BusContext *context, ULONG offset,
82 UWORD value);
83 static VOID LongOutHook(struct BusContext *context, ULONG offset,
84 ULONG value);
85 static VOID LongsInHook(struct BusContext *context, ULONG offset,
86 ULONG *buffer, ULONG count);
87 static VOID LongsOutHook(struct BusContext *context, ULONG offset,
88 const ULONG *buffer, ULONG count);
89 static VOID BEWordOutHook(struct BusContext *context, ULONG offset,
90 UWORD value);
91 static UWORD LEWordInHook(struct BusContext *context, ULONG offset);
92 static ULONG LELongInHook(struct BusContext *context, ULONG offset);
93 static VOID LEWordOutHook(struct BusContext *context, ULONG offset,
94 UWORD value);
95 static VOID LELongOutHook(struct BusContext *context, ULONG offset,
96 ULONG value);
99 static const ULONG product_codes[] =
101 0x01010035,
102 0x0101003d,
103 0x01010562,
104 0x01010589,
109 static const struct TagItem unit_tags[] =
111 {IOTAG_ByteIn, (UPINT)ByteInHook},
112 {IOTAG_LongIn, (UPINT)LongInHook},
113 {IOTAG_ByteOut, (UPINT)ByteOutHook},
114 {IOTAG_WordOut, (UPINT)WordOutHook},
115 {IOTAG_LongOut, (UPINT)LongOutHook},
116 {IOTAG_LongsIn, (UPINT)LongsInHook},
117 {IOTAG_LongsOut, (UPINT)LongsOutHook},
118 {IOTAG_BEWordOut, (UPINT)BEWordOutHook},
119 {IOTAG_LEWordIn, (UPINT)LEWordInHook},
120 {IOTAG_LELongIn, (UPINT)LELongInHook},
121 {IOTAG_LEWordOut, (UPINT)LEWordOutHook},
122 {IOTAG_LELongOut, (UPINT)LELongOutHook},
123 {TAG_END, 0}
127 /****i* etherlink3.device/GetPCCardCount ***********************************
129 * NAME
130 * GetPCCardCount -- Get the number of compatible PC Cards.
132 * SYNOPSIS
133 * count = GetPCCardCount()
135 * ULONG GetPCCardCount();
137 ****************************************************************************
141 ULONG GetPCCardCount(struct DevBase *base)
143 ULONG count = 0;
144 struct BusContext *context;
146 if(CardResource != NULL)
148 if(FindPCCardUnit(0, base) != NULL)
149 count = 1;
150 else
152 context = AllocCard(base);
153 if(context != NULL)
155 count = 1;
156 FreeCard(context, base);
161 return count;
165 /****i* etherlink3.device/GetPCCardUnit ************************************
167 * NAME
168 * GetPCCardUnit -- Get a unit by number.
170 * SYNOPSIS
171 * unit = GetPCCardUnit(index)
173 * struct DevUnit *GetPCCardUnit(ULONG);
175 ****************************************************************************
179 struct DevUnit *GetPCCardUnit(ULONG index, struct DevBase *base)
181 struct DevUnit *unit;
183 unit = FindPCCardUnit(index, base);
185 if(unit == NULL)
187 unit = CreatePCCardUnit(index, base);
188 if(unit != NULL)
189 AddTail((APTR)&base->pccard_units, (APTR)unit);
192 return unit;
197 /****i* etherlink3.device/FindPCCardUnit ***********************************
199 * NAME
200 * FindPCCardUnit -- Find a unit by number.
202 * SYNOPSIS
203 * unit = FindPCCardUnit(unit_num)
205 * struct DevUnit *FindPCCardUnit(ULONG);
207 ****************************************************************************
211 static struct DevUnit *FindPCCardUnit(ULONG index, struct DevBase *base)
213 struct DevUnit *unit, *tail;
215 unit = (APTR)base->pccard_units.mlh_Head;
216 tail = (APTR)&base->pccard_units.mlh_Tail;
217 if(unit == tail)
218 unit = NULL;
220 return unit;
225 /****i* etherlink3.device/CreatePCCardUnit *********************************
227 * NAME
228 * CreatePCCardUnit -- Create a unit.
230 * SYNOPSIS
231 * unit = CreatePCCardUnit(index)
233 * struct DevUnit *CreatePCCardUnit(ULONG);
235 * FUNCTION
236 * Creates a new unit.
238 ****************************************************************************
242 static struct DevUnit *CreatePCCardUnit(ULONG index,
243 struct DevBase *base)
245 BOOL success = TRUE;
246 struct BusContext *context;
247 struct DevUnit *unit;
249 /* Get card from system */
251 context = AllocCard(base);
252 if(context == NULL)
253 success = FALSE;
255 /* Prepare card for use */
257 if(success)
259 if(!InitialiseCard(context, base))
260 success = FALSE;
263 /* Create device driver unit */
265 if(success)
267 context->unit = unit =
268 CreateUnit(index, context, unit_tags, SECOND_GEN,
269 PCCARD_BUS, base);
270 if(unit == NULL)
271 success = FALSE;
274 if(success)
276 unit->insertion_function = (APTR)CardInsertedHook;
277 unit->removal_function = (APTR)CardRemovedHook;
280 if(!success)
282 if(context != NULL)
284 DeleteUnit(context->unit, base);
285 FreeCard(context, base);
287 unit = NULL;
290 return unit;
295 /****i* etherlink3.device/DeletePCCardUnit *********************************
297 * NAME
298 * DeletePCCardUnit -- Delete a unit.
300 * SYNOPSIS
301 * DeletePCCardUnit(unit)
303 * VOID DeletePCCardUnit(struct DevUnit *);
305 * FUNCTION
306 * Deletes a unit.
308 * INPUTS
309 * unit - Device unit (may be NULL).
311 * RESULT
312 * None.
314 ****************************************************************************
318 VOID DeletePCCardUnit(struct DevUnit *unit, struct DevBase *base)
320 struct BusContext *context;
322 if(unit != NULL)
324 context = unit->card;
325 DeleteUnit(unit, base);
326 FreeCard(context, base);
329 return;
334 /****i* etherlink3.device/AllocCard ****************************************
336 * NAME
337 * AllocCard -- Get card from system.
339 * SYNOPSIS
340 * unit = AllocCard()
342 * struct BusContext *AllocCard();
344 ****************************************************************************
348 static struct BusContext *AllocCard(struct DevBase *base)
350 BOOL success = TRUE, have_card = FALSE;
351 struct BusContext *context;
352 struct CardHandle *card_handle;
353 struct Interrupt *card_removed_int, *card_inserted_int, *card_status_int;
355 context = AllocMem(sizeof(struct BusContext), MEMF_PUBLIC | MEMF_CLEAR);
356 if(context == NULL)
357 success = FALSE;
359 if(success)
361 context->resource_version =
362 ((struct Library *)base->card_base)->lib_Version;
363 context->card_handle = card_handle =
364 AllocMem(sizeof(struct CardHandle), MEMF_PUBLIC | MEMF_CLEAR);
365 context->tuple_buffer =
366 AllocVec(TUPLE_BUFFER_SIZE, MEMF_PUBLIC);
368 if(card_handle == NULL || context->tuple_buffer == NULL)
369 success = FALSE;
372 if(success)
374 /* Set up card handle */
376 card_handle->cah_CardNode.ln_Pri = HANDLE_PRIORITY;
377 card_handle->cah_CardNode.ln_Name =
378 base->device.dd_Library.lib_Node.ln_Name;
379 /* card_handle->cah_CardFlags = CARDF_IFAVAILABLE | CARDF_POSTSTATUS;*/
380 card_handle->cah_CardFlags = CARDF_POSTSTATUS;
382 card_handle->cah_CardRemoved = card_removed_int =
383 AllocVec(sizeof(struct Interrupt), MEMF_PUBLIC | MEMF_CLEAR);
385 card_handle->cah_CardInserted = card_inserted_int =
386 AllocVec(sizeof(struct Interrupt), MEMF_PUBLIC | MEMF_CLEAR);
388 card_handle->cah_CardStatus = card_status_int =
389 AllocVec(sizeof(struct Interrupt), MEMF_PUBLIC | MEMF_CLEAR);
391 if(card_removed_int == NULL || card_inserted_int == NULL
392 || card_status_int == NULL)
393 success = FALSE;
396 if(success)
398 /* Try to gain access to card */
400 card_removed_int->is_Code = CardRemovedInt;
401 card_removed_int->is_Data = context;
402 card_inserted_int->is_Code = CardInsertedInt;
403 card_inserted_int->is_Data = context;
404 card_status_int->is_Code = (APTR)CardStatusInt;
405 card_status_int->is_Data = context;
407 if(OwnCard(card_handle) != 0)
408 success = FALSE;
411 if(success)
413 have_card = TRUE;
414 if(!IsCardCompatible(context, base))
415 success = FALSE;
418 if(!success)
420 FreeCard(context, base);
421 context = NULL;
423 return context;
428 /****i* etherlink3.device/FreeCard *****************************************
430 * NAME
431 * FreeCard
433 * SYNOPSIS
434 * FreeCard(context)
436 * VOID FreeCard(struct BusContext *);
438 ****************************************************************************
442 static VOID FreeCard(struct BusContext *context, struct DevBase *base)
444 struct CardHandle *card_handle;
446 if(context != NULL)
448 card_handle = context->card_handle;
450 if(context->have_card)
452 CardMiscControl(card_handle, 0);
453 CardResetCard(card_handle);
455 ReleaseCard(card_handle, CARDF_REMOVEHANDLE);
457 FreeVec(card_handle->cah_CardStatus);
458 FreeVec(card_handle->cah_CardInserted);
459 FreeVec(card_handle->cah_CardRemoved);
460 FreeVec(context->tuple_buffer);
461 FreeMem(card_handle, sizeof(struct CardHandle));
463 FreeMem(context, sizeof(struct BusContext));
466 return;
471 /****i* etherlink3.device/IsCardCompatible *********************************
473 * NAME
474 * IsCardCompatible
476 * SYNOPSIS
477 * compatible = IsCardCompatible(context)
479 * BOOL IsCardCompatible(struct BusContext *);
481 ****************************************************************************
485 static BOOL IsCardCompatible(struct BusContext *context,
486 struct DevBase *base)
488 BOOL success = TRUE;
489 struct CardHandle *card_handle;
490 UBYTE *tuple_buffer;
491 const struct TagItem *tuple_tags = NULL;
492 ULONG code;
493 const ULONG *p;
494 UWORD maker = 0, product = 0;
496 card_handle = context->card_handle;
497 tuple_buffer = context->tuple_buffer;
499 /* Get card's make and model */
501 if(CopyTuple(card_handle, tuple_buffer, PCCARD_TPL_MANFID,
502 MAX_TUPLE_SIZE))
504 tuple_tags = PCCard_GetTupleInfo(tuple_buffer);
505 if(tuple_tags != NULL)
507 maker = GetTagData(PCCARD_Maker, 0, tuple_tags);
508 product = GetTagData(PCCARD_Product, 0, tuple_tags);
512 /* Check this is a card we can use */
514 code = maker << 16 | product;
515 for(success = FALSE, p = product_codes; *p != 0; p++)
516 if(*p == code)
517 success = TRUE;
518 PCCard_FreeTupleInfo(tuple_tags);
520 return success;
525 /****i* etherlink3.device/InitialiseCard ***********************************
527 * NAME
528 * InitialiseCard
530 * SYNOPSIS
531 * success = InitialiseCard(context)
533 * BOOL InitialiseCard(struct BusContext *);
535 ****************************************************************************
539 static BOOL InitialiseCard(struct BusContext *context,
540 struct DevBase *base)
542 BOOL success = TRUE;
543 struct CardHandle *card_handle;
544 struct CardMemoryMap *card_map;
545 UBYTE config_value, i, window_count, *tuple_buffer;
546 const struct TagItem *tuple_tags = NULL;
547 ULONG *io_bases, *io_lengths, io_base_offset = 0, config_base_offset;
549 /* Wake up card's I/O functionality */
551 card_handle = context->card_handle;
552 tuple_buffer = context->tuple_buffer;
553 CardMiscControl(card_handle,
554 CARD_ENABLEF_DIGAUDIO | CARD_DISABLEF_WP);
556 /* Get configuration data */
558 if(!CopyTuple(card_handle, tuple_buffer, PCCARD_TPL_CONFIG,
559 MAX_TUPLE_SIZE))
560 success = FALSE;
562 if(success)
564 PCCard_FreeTupleInfo(tuple_tags);
565 tuple_tags = PCCard_GetTupleInfo(tuple_buffer);
566 if(tuple_tags == NULL)
567 success = FALSE;
570 if(success)
572 config_base_offset = GetTagData(PCCARD_RegisterBase, 0, tuple_tags);
574 PCCard_FreeTupleInfo(tuple_tags);
575 tuple_tags = NULL;
577 /* Get IO base */
579 if(!CopyTuple(card_handle, tuple_buffer, PCCARD_TPL_CFTABLEENTRY,
580 MAX_TUPLE_SIZE))
581 success = FALSE;
584 if(success)
586 tuple_tags = PCCard_GetTupleInfo(tuple_buffer);
587 if(tuple_tags == NULL)
588 success = FALSE;
591 if(success)
593 config_value = GetTagData(PCCARD_ModeNo, 0, tuple_tags);
595 io_bases =
596 (APTR)GetTagData(PCCARD_IOWinBases, (UPINT)NULL, tuple_tags);
597 if(io_bases == NULL)
598 success = FALSE;
601 /* Find the appropriate IO window */
603 if(success)
605 io_lengths =
606 (APTR)GetTagData(PCCARD_IOWinLengths, (UPINT)NULL, tuple_tags);
608 window_count = GetTagData(PCCARD_IOWinCount, 0, tuple_tags);
610 for(i = 0; (i < window_count) && (io_base_offset == 0); i++)
611 if(io_lengths[i] == IO_WINDOW_SIZE)
612 io_base_offset = io_bases[i];
615 PCCard_FreeTupleInfo(tuple_tags);
617 /* Configure card */
619 if(success)
621 card_map = GetCardMap();
622 context->config_base =
623 (UPINT)card_map->cmm_AttributeMemory + config_base_offset;
625 context->io_base = (UPINT)card_map->cmm_IOMemory + io_base_offset;
626 BYTEOUT(context->config_base + PCCARD_REG_COR, config_value);
627 BYTEOUT(context->config_base + PCCARD_REG_CCSR,
628 BYTEIN(context->config_base + PCCARD_REG_CCSR)
629 | PCCARD_REG_CCSRF_AUDIOENABLE);
632 return success;
637 /****i* etherlink3.device/CardRemovedHook **********************************
639 * NAME
640 * CardRemovedHook
642 * SYNOPSIS
643 * CardRemovedHook(context)
645 * VOID CardRemovedHook(struct BusContext *);
647 ****************************************************************************
651 static VOID CardRemovedHook(struct BusContext *context,
652 struct DevBase *base)
654 ReleaseCard(context->card_handle, 0);
656 return;
661 /****i* etherlink3.device/CardInsertedHook *********************************
663 * NAME
664 * CardInsertedHook
666 * SYNOPSIS
667 * success = CardInsertedHook(context)
669 * BOOL CardInsertedHook(struct BusContext *);
671 ****************************************************************************
675 static BOOL CardInsertedHook(struct BusContext *context,
676 struct DevBase *base)
678 BOOL success = TRUE;
680 success = IsCardCompatible(context, base);
682 if(success)
683 success = InitialiseCard(context, base);
685 if(success)
686 success = InitialiseAdapter(context->unit, TRUE, base);
688 if(!success)
689 ReleaseCard(context->card_handle, 0);
691 return success;
696 /****i* etherlink3.device/CardRemovedInt ***********************************
698 * NAME
699 * CardRemovedInt
701 * SYNOPSIS
702 * CardRemovedInt(unit)
704 * VOID CardRemovedInt(struct DevUnit *);
706 ****************************************************************************
710 static VOID CardRemovedInt(REG(a1, struct BusContext *context),
711 REG(a6, APTR int_code))
713 struct DevBase *base;
714 struct DevUnit *unit;
716 /* Record loss of card and get our task to call ReleaseCard() */
718 unit = context->unit;
719 base = unit->device;
720 if((unit->flags & UNITF_ONLINE) != 0)
721 unit->flags |= UNITF_WASONLINE;
722 unit->flags &= ~(UNITF_HAVEADAPTER | UNITF_ONLINE);
723 context->have_card = FALSE;
724 Signal(unit->task, unit->card_removed_signal);
726 return;
731 /****i* etherlink3.device/CardInsertedInt **********************************
733 * NAME
734 * CardInsertedInt
736 * SYNOPSIS
737 * CardInsertedInt(unit)
739 * VOID CardInsertedInt(struct DevUnit *);
741 ****************************************************************************
745 static VOID CardInsertedInt(REG(a1, struct BusContext *context),
746 REG(a6, APTR int_code))
748 struct DevBase *base;
749 struct DevUnit *unit;
751 unit = context->unit;
752 base = unit->device;
753 context->have_card = TRUE;
754 Signal(unit->task, unit->card_inserted_signal);
756 return;
761 /****i* etherlink3.device/CardStatusInt ************************************
763 * NAME
764 * CardStatusInt
766 * SYNOPSIS
767 * mask = CardStatusInt(mask, unit)
769 * UBYTE CardStatusInt(UBYTE mask, struct DevUnit *);
771 ****************************************************************************
773 * We pretend the int_code parameter goes in A6 rather than A5 because 68k
774 * GCC can't cope with A5 and we know the parameter isn't used in this case.
778 static UBYTE CardStatusInt(REG(d0, UBYTE mask),
779 REG(a1, struct BusContext *context), REG(a6, APTR int_code))
781 if(context->resource_version < 39)
783 /* Work around gayle interrupt bug */
785 *((volatile UBYTE *)0xda9000) = (mask ^ 0x2c) | 0xc0;
786 mask = 0;
789 if(context->unit != NULL)
790 StatusInt(context->unit, StatusInt);
792 return mask;
797 /****i* etherlink3.device/ByteInHook ***************************************
799 * NAME
800 * ByteInHook
802 * SYNOPSIS
803 * value = ByteInHook(context, offset)
805 * UBYTE ByteInHook(struct BusContext *, ULONG);
807 ****************************************************************************
811 static UBYTE ByteInHook(struct BusContext *context, ULONG offset)
813 return BYTEIN(context->io_base + offset);
818 /****i* etherlink3.device/LongInHook ***************************************
820 * NAME
821 * LongInHook
823 * SYNOPSIS
824 * value = LongInHook(context, offset)
826 * ULONG LongInHook(struct BusContext *, ULONG);
828 ****************************************************************************
832 static ULONG LongInHook(struct BusContext *context, ULONG offset)
834 return LONGIN(context->io_base + offset);
839 /****i* etherlink3.device/ByteOutHook **************************************
841 * NAME
842 * ByteOutHook
844 * SYNOPSIS
845 * ByteOutHook(context, offset, value)
847 * VOID ByteOutHook(struct BusContext *, ULONG, UBYTE);
849 ****************************************************************************
853 static VOID ByteOutHook(struct BusContext *context, ULONG offset,
854 UBYTE value)
856 BYTEOUT(context->io_base + offset, value);
858 return;
863 /****i* etherlink3.device/WordOutHook **************************************
865 * NAME
866 * WordOutHook
868 * SYNOPSIS
869 * WordOutHook(context, offset, value)
871 * VOID WordOutHook(struct BusContext *, ULONG, UWORD);
873 ****************************************************************************
877 static VOID WordOutHook(struct BusContext *context, ULONG offset,
878 UWORD value)
880 WORDOUT(context->io_base + offset, value);
882 return;
887 /****i* etherlink3.device/LongOutHook **************************************
889 * NAME
890 * LongOutHook
892 * SYNOPSIS
893 * LongOutHook(context, offset, value)
895 * VOID LongOutHook(struct BusContext *, ULONG, ULONG);
897 ****************************************************************************
901 static VOID LongOutHook(struct BusContext *context, ULONG offset,
902 ULONG value)
904 LONGOUT(context->io_base + offset, value);
906 return;
911 /****i* etherlink3.device/LongsInHook **************************************
913 * NAME
914 * LongsInHook
916 * SYNOPSIS
917 * LongsInHook(context, offset, buffer, count)
919 * VOID LongsInHook(struct BusContext *, ULONG, ULONG *, ULONG);
921 ****************************************************************************
925 static VOID LongsInHook(struct BusContext *context, ULONG offset,
926 ULONG *buffer, ULONG count)
928 LONGSIN(context->io_base + offset, buffer, count);
930 return;
935 /****i* etherlink3.device/LongsOutHook *************************************
937 * NAME
938 * LongsOutHook
940 * SYNOPSIS
941 * LongsOutHook(context, offset, buffer, count)
943 * VOID LongsOutHook(struct BusContext *, ULONG, const ULONG *, ULONG);
945 ****************************************************************************
949 static VOID LongsOutHook(struct BusContext *context, ULONG offset,
950 const ULONG *buffer, ULONG count)
952 LONGSOUT(context->io_base + offset, buffer, count);
954 return;
959 /****i* etherlink3.device/BEWordOutHook ************************************
961 * NAME
962 * BEWordOutHook
964 * SYNOPSIS
965 * BEWordOutHook(context, offset, value)
967 * VOID BEWordOutHook(struct BusContext *, ULONG, UWORD);
969 ****************************************************************************
973 static VOID BEWordOutHook(struct BusContext *context, ULONG offset,
974 UWORD value)
976 BEWORDOUT(context->io_base + offset, value);
978 return;
983 /****i* etherlink3.device/LEWordInHook *************************************
985 * NAME
986 * LEWordInHook
988 * SYNOPSIS
989 * value = LEWordInHook(context, offset)
991 * UWORD LEWordInHook(struct BusContext *, ULONG);
993 ****************************************************************************
997 static UWORD LEWordInHook(struct BusContext *context, ULONG offset)
999 return LEWORDIN(context->io_base + offset);
1004 /****i* etherlink3.device/LELongInHook ***************************************
1006 * NAME
1007 * LELongInHook
1009 * SYNOPSIS
1010 * value = LELongInHook(context, offset)
1012 * ULONG LELongInHook(struct BusContext *, ULONG);
1014 ****************************************************************************
1018 static ULONG LELongInHook(struct BusContext *context, ULONG offset)
1020 return LELONGIN(context->io_base + offset);
1025 /****i* etherlink3.device/LEWordOutHook ************************************
1027 * NAME
1028 * LEWordOutHook
1030 * SYNOPSIS
1031 * LEWordOutHook(context, offset, value)
1033 * VOID LEWordOutHook(struct BusContext *, ULONG, UWORD);
1035 ****************************************************************************
1039 static VOID LEWordOutHook(struct BusContext *context, ULONG offset,
1040 UWORD value)
1042 LEWORDOUT(context->io_base + offset, value);
1044 return;
1049 /****i* etherlink3.device/LELongOutHook ************************************
1051 * NAME
1052 * LELongOutHook
1054 * SYNOPSIS
1055 * LELongOutHook(context, offset, value)
1057 * VOID LELongOutHook(struct BusContext *, ULONG, ULONG);
1059 ****************************************************************************
1063 static VOID LELongOutHook(struct BusContext *context, ULONG offset,
1064 ULONG value)
1066 LELONGOUT(context->io_base + offset, value);
1068 return;