make sure the arm implementation struct is aligned
[AROS.git] / arch / arm-native / soc / broadcom / 283x / usb / usb2otg / usb2otg_intr.c
blob1d5446130b50212d0c6e2b89e2e371f24c77ff84
1 /*
2 Copyright © 2013-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
7 #include <aros/debug.h>
9 #include <proto/exec.h>
10 #include <proto/kernel.h>
11 #include <proto/utility.h>
13 #include "usb2otg_intern.h"
15 AROS_INTH1(FNAME_DEV(PendingInt), struct USB2OTGUnit *, otg_Unit)
17 AROS_INTFUNC_INIT
19 D(bug("[USB2OTG] ## Pending Work Interupt\n"));
21 /* **************** PROCESS DONE TRANSFERS **************** */
23 FNAME_ROOTHUB(PendingIO)(otg_Unit);
25 // uhciHandleFinishedTDs(otg_Unit);
27 if (otg_Unit->hu_CtrlXFerQueue.lh_Head->ln_Succ)
29 // uhciScheduleCtrlTDs(otg_Unit);
32 if (otg_Unit->hu_IntXFerQueue.lh_Head->ln_Succ)
34 // uhciScheduleIntTDs(otg_Unit);
37 if (otg_Unit->hu_BulkXFerQueue.lh_Head->ln_Succ)
39 // uhciScheduleBulkTDs(otg_Unit);
42 D(bug("[USB2OTG] ## Pending Work Processed\n"));
44 return FALSE;
46 AROS_INTFUNC_EXIT
49 AROS_INTH1(FNAME_DEV(NakTimeoutInt), struct USB2OTGUnit *, otg_Unit)
51 AROS_INTFUNC_INIT
53 struct IOUsbHWReq *ioreq;
55 D(bug("[USB2OTG] ## NakTimeout Interupt\n"));
57 // ULONG framecnt;
58 // uhciUpdateFrameCounter(hc);
59 // framecnt = hc->hc_FrameCounter;
60 #if (0)
61 ioreq = (struct IOUsbHWReq *) otg_Unit->hu_TDQueue.lh_Head;
62 while(((struct Node *) ioreq)->ln_Succ)
64 if(ioreq->iouh_Flags & UHFF_NAKTIMEOUT)
66 /* uqh = (struct UhciQH *) ioreq->iouh_DriverPrivate1;
67 if(uqh)
69 KPRINTF(1, ("Examining IOReq=%p with UQH=%p\n", ioreq, uqh));
70 devadrep = (ioreq->iouh_DevAddr<<5) + ioreq->iouh_Endpoint + ((ioreq->iouh_Dir == UHDIR_IN) ? 0x10 : 0);
71 linkelem = READMEM32_LE(&uqh->uqh_Element);
72 if(linkelem & UHCI_TERMINATE)
74 KPRINTF(1, ("UQH terminated %08lx\n", linkelem));
75 if(framecnt > unit->hu_NakTimeoutFrame[devadrep])
77 // give the thing the chance to exit gracefully
78 KPRINTF(20, ("Terminated? NAK timeout %ld > %ld, IOReq=%p\n", framecnt, unit->hu_NakTimeoutFrame[devadrep], ioreq));
79 causeint = TRUE;
81 } else {
82 utd = (struct UhciTD *) (((IPTR)linkelem & UHCI_PTRMASK) - hc->hc_PCIVirtualAdjust - 16); // struct UhciTD starts 16 before physical TD
83 ctrlstatus = READMEM32_LE(&utd->utd_CtrlStatus);
84 if(ctrlstatus & UTCF_ACTIVE)
86 if(framecnt > unit->hu_NakTimeoutFrame[devadrep])
88 // give the thing the chance to exit gracefully
89 KPRINTF(20, ("NAK timeout %ld > %ld, IOReq=%p\n", framecnt, unit->hu_NakTimeoutFrame[devadrep], ioreq));
90 ctrlstatus &= ~UTCF_ACTIVE;
91 WRITEMEM32_LE(&utd->utd_CtrlStatus, ctrlstatus);
92 causeint = TRUE;
94 } else {
95 if(framecnt > unit->hu_NakTimeoutFrame[devadrep])
97 // give the thing the chance to exit gracefully
98 KPRINTF(20, ("Terminated? NAK timeout %ld > %ld, IOReq=%p\n", framecnt, unit->hu_NakTimeoutFrame[devadrep], ioreq));
99 causeint = TRUE;
105 ioreq = (struct IOUsbHWReq *) ((struct Node *) ioreq)->ln_Succ;
108 // uhciCheckPortStatusChange(hc);
109 #endif
110 FNAME_ROOTHUB(PendingIO)(otg_Unit);
112 otg_Unit->hu_NakTimeoutReq.tr_time.tv_micro = 150 * 1000;
113 SendIO((APTR) &otg_Unit->hu_NakTimeoutReq);
115 D(bug("[USB2OTG] ## NakTimeout Processed\n"));
117 return FALSE;
119 AROS_INTFUNC_EXIT