grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / usb / pciusbhc / ohci / buffer.c
blobe0c698388eac199ef5575eadcce14d365c02b44e
1 /*
2 Copyright © 2002-2009, Chris Hodges. All rights reserved.
3 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
4 $Id$
5 */
7 #include <devices/usbhardware.h>
8 #include <exec/memory.h>
10 #include <proto/exec.h>
12 #if __WORDSIZE == 64
14 APTR usbGetBuffer(APTR data, ULONG len, UWORD dir)
16 APTR ret = data;
18 if (((IPTR) data + len - 1) >> 32)
20 ret = AllocVec(len, MEMF_31BIT | MEMF_PUBLIC);
22 if (ret && (dir == UHDIR_OUT))
23 CopyMem(data, ret, len);
26 return ret;
29 void usbReleaseBuffer(APTR buffer, APTR data, ULONG len, UWORD dir)
31 if (buffer && (buffer != data))
33 if (len && (dir == UHDIR_IN))
34 CopyMem(buffer, data, len);
36 FreeVec(buffer);
40 #endif