From 2fc1b6c047454133af6b564fa6bb8d8134c0a3dd Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sun, 20 Sep 2009 21:09:57 +0200 Subject: [PATCH] ISI exception fixed. as expected, a sync fail. however, done head is null. why? --- usb/core/core.c | 1 - usb/host/at90usb1287-hcd.c | 260 --------------------------- usb/host/at90usb1287.h | 89 ---------- usb/host/ohci.c | 48 +++-- usb/host/sl811hs-hcd.c | 351 ------------------------------------- usb/host/sl811hs.h | 169 ------------------ 6 files changed, 30 insertions(+), 888 deletions(-) delete mode 100644 usb/host/at90usb1287-hcd.c delete mode 100644 usb/host/at90usb1287.h delete mode 100644 usb/host/sl811hs-hcd.c delete mode 100644 usb/host/sl811hs.h diff --git a/usb/core/core.c b/usb/core/core.c index 1301e0a..14600ff 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -277,7 +277,6 @@ u16 usb_submit_irp(usb_irp *irp) /* control message are always 8 bytes */ td->actlen = 8; - memcpy(mybuf, td->buffer, td->actlen); togl = 0; /* start with data0 */ diff --git a/usb/host/at90usb1287-hcd.c b/usb/host/at90usb1287-hcd.c deleted file mode 100644 index 2ba0cae..0000000 --- a/usb/host/at90usb1287-hcd.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - // - * Copyright (c) 2007, Benedikt Sauter - * All rights reserved. - * - * Short descripton of file: at90usb1287-hcdi.c - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the FH Augsburg nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "host.h" -#include -#include - -#include "at90usb1287.h" -#include - -#include "uart.h" -#include "wait.h" - -#include -#include - -void at90usb1287_roothub_probe(); -void at90usb1287_roothub_check(); - -void at90usb1287_start_transfer(); - -usb_device * device_on_downstream; - - -/* cuurent transferdescriptor on port a and port b */ -usb_transfer_descriptor * td_usba; -usb_transfer_descriptor * td_usbb; - -usb_driver at90usb1287_roothub = { - .name = "at90usb1287_roothub", - .probe = at90usb1287_roothub_probe, - .check = at90usb1287_roothub_check, - .data = NULL, -}; - -usb_device * device_on_downstream; - -/** - * Find and initial root hub - */ -void at90usb1287_roothub_probe() -{ - // called on n every new enumeration and at usb_register_driver - // der sollte nach dem ersten aufruf igonriert werden - #if DEBUG - core.stdout("Probe: AT90USB1287 Root Hub\r\n"); - #endif -} - -/** - * This function is called periodical, to notice - * port changes after an hub - */ -void at90usb1287_roothub_check() -{ - //USART_WriteHex(UHINT); - //UHINT = 0x00; - // disconnect - if(UHINT & 0x02) { - device_on_downstream=NULL; - #if DEBUG - core.stdout("Device: Removed!\r\n"); - #endif - //UHINT &= ~(1<pid) { - case USB_PID_SETUP: - break; - - case USB_PID_IN: - break; - - case USB_PID_OUT: - break; - } - - -} - - diff --git a/usb/host/at90usb1287.h b/usb/host/at90usb1287.h deleted file mode 100644 index eb2ed07..0000000 --- a/usb/host/at90usb1287.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _AT90USB_H -#define _AT90USB_H -// AT90USB/usb_drv.h -// Macros for access to USB registers of Atmels AT90USB microcontrollers -// This file contains low level register stuff as described in -// Atmels AT90USB datasheet 7593D-AVR-07/06 -// S. Salewski 21-MAR-2007 -// B. Sauter (modified for usb host stack) 2007 - - -// A few macros for bit fiddling -#define SetBit(adr, bit) (adr |= (1<>18)&1); printf("********************************************************\n"); } -#endif static void general_td_fill(struct general_td *dest, const usb_transfer_descriptor *src) { - dest->cbp = LE(virt_to_phys(src->buffer)); - - /* save virtual address here */ - dest->bufaddr = (u32) src->buffer; + if(src->actlen) { + dest->cbp = LE(virt_to_phys(src->buffer)); + dest->be = LE(LE(dest->cbp) + src->actlen - 1); + /* save virtual address here */ + dest->bufaddr = (u32) src->buffer; + } + else { + dest->cbp = dest->be = LE(0); + dest->bufaddr = 0; + } - dest->be = src->actlen ? LE(LE(dest->cbp) + src->actlen - 1) : LE(0); dest->buflen = src->actlen; dest->flags &= LE(~OHCI_TD_DIRECTION_PID_MASK); @@ -230,6 +233,9 @@ void hcdi_fire() { printf("<^> <^> <^> hcdi_fire(start)\n"); + if(edhead == 0) + return; + control_quirk(); //required? YES! :O ... erm... or no? :/ ... in fact I have no idea write32(OHCI0_HC_CTRL_HEAD_ED, virt_to_phys(edhead)); @@ -244,7 +250,7 @@ void hcdi_fire() dump_address(x, sizeof(struct general_td), "x(before)"); if(x->buflen > 0) { - sync_after_write((void*) x->cbp, x->buflen); + sync_after_write((void*) phys_to_virt(LE(x->cbp)), x->buflen); dump_address((void*) phys_to_virt(LE(x->cbp)), x->buflen, "x->cbp(before)"); } x = phys_to_virt(LE(x->nexttd)); @@ -270,24 +276,23 @@ void hcdi_fire() u32 current = read32(OHCI0_HC_CTRL_CURRENT_ED); printf("current: 0x%08X\n", current); printf("+++++++++++++++++++++++++++++\n"); - udelay(100000); + udelay(1000000); #endif sync_before_read(&hcca_oh0, sizeof(hcca_oh0)); struct general_td *n = phys_to_virt(LE(hcca_oh0.done_head) & ~1); printf("done_head: 0x%08X\n", n); -#if 1 + struct general_td *prev = 0, *next = 0; /* reverse done queue */ while(virt_to_phys(n)) { + sync_before_read((void*) n, sizeof(struct general_td)); printf("n: 0x%08X\n", n); printf("next: 0x%08X\n", next); printf("prev: 0x%08X\n", prev); - next = n; - - sync_before_read((void*) n, sizeof(struct general_td)); - n = (struct general_td*) phys_to_virt(LE(next->nexttd)); + next = n; + n = (struct general_td*) phys_to_virt(LE(n->nexttd)); next->nexttd = (u32) prev; prev = next; } @@ -298,16 +303,23 @@ void hcdi_fire() if(prev) { free(prev); } + dump_address(n, sizeof(struct general_td), "n(after)"); - sync_before_read((void*) n->bufaddr, n->buflen); - dump_address((void*) n->bufaddr, n->buflen, "n->bufaddr(after)"); + if(n->buflen > 0) { + sync_before_read((void*) n->bufaddr, n->buflen); + dump_address((void*) n->bufaddr, n->buflen, "n->bufaddr(after)"); + } dbg_td_flag(LE(n->flags)); - n = prev = (struct general_td*) n->nexttd; + prev = n; + n = (struct general_td*) n->nexttd; + } + if(prev) { + free(prev); } + hcca_oh0.done_head = 0; sync_after_write(&hcca_oh0, sizeof(hcca_oh0)); -#endif write32(OHCI0_HC_CONTROL, read32(OHCI0_HC_CONTROL)&~OHCI_CTRL_CLE); diff --git a/usb/host/sl811hs-hcd.c b/usb/host/sl811hs-hcd.c deleted file mode 100644 index 2270384..0000000 --- a/usb/host/sl811hs-hcd.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2007, Benedikt Sauter - * All rights reserved. - * - * Short descripton of file: sl811hs-hcdi.c - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the FH Augsburg nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "host.h" -#include "sl811hs.h" -#include -#include - -#include "uart.h" -#include "wait.h" - -#include -//#include -#include - -void sl811_roothub_probe(); -void sl811_roothub_check(); - -void sl811_start_transfer(); - -usb_device * device_on_downstream; - - -/* cuurent transferdescriptor on port a and port b */ -usb_transfer_descriptor * td_usba; -usb_transfer_descriptor * td_usbb; - -usb_driver sl811_roothub = { - .name = "sl811_roothub", - .probe = sl811_roothub_probe, - .check = sl811_roothub_check, - .data = NULL, -}; - -/** - * Find and initial root hub - */ -void sl811_roothub_probe() -{ - // called on n every new enumeration and at usb_register_driver - // der sollte nach dem ersten aufruf igonriert werden - // oder diese funktion bleibt einfach leer - #if DEBUG - core.stdout("Probe: SL811 Root Hub\r\n"); - #endif -} - - -/** - * This function is called periodical, to notice - * port changes after an hub - */ -void sl811_roothub_check() -{ - /* hier muss man nur dafuer sorgen wenn ein geaert angesteckt - * wird, dass der entsprechende port auf reset gesetzt wird - * damit das device die adresse 0 annimmt - * und dann muss man usb_add_device aufrufen - * - * wenn ein geraet entfernt wird muss man nur usb_remove_device aufrufen - * und es muss dabei das richtige geraet angegeben werden. - * dieses muss man sich wahrscheinlich intern im treiber - * merken... - */ - // check for new device - u16 *port_change = (u16*)sl811_roothub.data; - - u8 status = sl811_read(SL811_ISR); - sl811_write(SL811_ISR,SL811_ISR_DATA | SL811_ISR_SOFTIMER); - - #define HUB_PORTSTATUS_C_PORT_CONNECTION 1 - if((status & SL811_ISR_RESET)) { // TODO und bit x von CTRL - // remove device if neccessary - if(device_on_downstream!=NULL){ - #if USBMON - core.stdout("Remove Device!\r\n"); - #endif - usb_remove_device(device_on_downstream); - device_on_downstream=NULL; - } - - sl811_write(SL811_ISR,SL811_ISR_RESET); - } else { - if((port_change[0] & HUB_PORTSTATUS_C_PORT_CONNECTION)){ - #if USBMON - core.stdout("Find new Device!\r\n"); - #endif - - /* init sof currently for fullspeed (datasheet page 11)*/ - sl811_write(SL811_CSOF,0xAE); - sl811_write(SL811_DATA,0xE0); - - /* reset device that function can answer to address 0 */ - sl811_write(SL811_IER,0x00); - sl811_write(SL811_CTRL,SL811_CTRL_ENABLESOF|SL811_CTRL_RESETENGINE); - sl811_write(SL811_ISR,0xff); - wait_ms(20); - - /* start SOF generation */ - sl811_write(SL811_CTRL,SL811_CTRL_ENABLESOF); - sl811_write(SL811_ISR,0xff); - sl811_write(SL811_E0BASE,SL811_EPCTRL_ARM); - wait_ms(50); - - device_on_downstream = usb_add_device(); - - /* set internate port state 1=device is online */ - port_change[0]=0x00; - - } - } - - if((status & SL811_ISR_INSERT)){ - port_change[0] |= HUB_PORTSTATUS_C_PORT_CONNECTION; - sl811_write(SL811_ISR,SL811_ISR_INSERT); - } - -} - - -void hcdi_init() -{ - /* find and initial host controller */ - sl811_init(); - u8 rev = sl811_read(SL811_REV)>>4; - - switch(rev) { - case 1: - #if USBMON - core.stdout("Host: SL811HS v1.2 found\r\n"); - #endif - break; - case 2: - #if USBMON - core.stdout("Host: SL811HS v1.5 found\r\n"); - #endif - break; - default: - #if USBMON - core.stdout("Can't find SL811!\r\n"); - #endif - return; - } - - /* Disable interrupt, then wait 40 ms */ - sl811_write(SL811_IER,0x00); - - /* Initialize controller */ - //sl811_write(SL811_CSOF,0xae); - sl811_write(SL811_CSOF,SL811_CSOF_MASTER); - - /* clear interrupt status register with one read operation */ - sl811_write(SL811_ISR,0xff); - - /* data = hub flags */ - u16 *port_change = (u16*)malloc(sizeof(u16)); - port_change[0] = 0x00; - port_change[1] = 0x00; - sl811_roothub.data = (void*)port_change; - device_on_downstream = NULL; - - - /* register virtual root hub driver */ - usb_register_driver(&sl811_roothub); - - - /* activate interrupts */ - sl811_write(SL811_IER,SL811_IER_USBA); -} - -/** - * hcdi_enqueue takes usb_irp and split it into - * several usb packeges (SETUP,IN,OUT) - * In the usbstack they are transported with the - * usb_transfer_descriptor data structure. - */ - -u8 hcdi_enqueue(usb_transfer_descriptor *td) -{ - #if LIBMODE - td_usba = td; - sl811_start_transfer(); - #endif - return 1; -} - - -u8 hcdi_dequeue(usb_transfer_descriptor *td) -{ - return 1; -} - - - -void hcdi_irq() -{ - core.stdout("interrupt\r\n"); - u8 state; - state = sl811_read(SL811_ISR); - if(state & SL811_ISR_USBA) { - core.stdout("a done\r\n"); - } - if(state & SL811_ISR_USBB) { - core.stdout("b done\r\n"); - } - if(state & SL811_ISR_RESET) { - core.stdout("reset\r\n"); - } - - if(state & SL811_ISR_INSERT) { - core.stdout("insert\r\n"); - } - - sl811_write(SL811_ISR,0xFF); -} - - - -void sl811_start_transfer() -{ - usb_transfer_descriptor * td; - - #if LIBMODE - /* choose next free port */ - td = td_usba; - /* disable a done interrupt */ - sl811_write(SL811_IER,0x00); - #endif - - #if USBMON - //core.stdout(""); - #endif - - sl811_write(SL811_E0CONT,td->devaddress); /* device address */ - sl811_write(SL811_E0LEN,td->actlen); /* number of bytes to transfer */ - sl811_write(SL811_E0ADDR,cMemStart); /* set address to buffer in sl811 ram */ - - switch(td->pid) { - case USB_PID_SETUP: - //core.stdout("*setup\r\n"); - /* copy data into ram of sl811 */ - sl811_write_buf(cMemStart,(unsigned char *)td->buffer,td->actlen); - - sl811_write(SL811_E0STAT,PID_SETUP|td->endpoint); /* set pid and ep */ - sl811_write(SL811_E0CTRL,DATA0_WR); /* send setup packet with DATA0 */ - - td->state = USB_TRANSFER_DESCR_SEND; - - /* wait ack */ - #if LIBMODE - while((sl811_read(SL811_ISR)&SL811_ISR_USBA)==0); - //wait_ms(1); - #endif - - break; - - case USB_PID_IN: - //core.stdout("*in\r\n"); - #if LIBMODE - wait_ms(2); - #endif - - sl811_write(SL811_E0STAT,PID_IN|td->endpoint); /* set pid and ep */ - sl811_write(SL811_ISR,0xff); - - /* choose data0 or data1 */ - if(td->togl) - sl811_write(SL811_E0CTRL,DATA1_RD); /* send setup packet with DATA0 */ - else - sl811_write(SL811_E0CTRL,DATA0_RD); /* send setup packet with DATA0 */ - - td->state = USB_TRANSFER_DESCR_SEND; - - /* wait ack */ - #if LIBMODE - while((sl811_read(SL811_ISR)&SL811_ISR_USBA)==0); - //wait_ms(1); - - /* copy received data from internal sl811 ram */ - sl811_read_buf(cMemStart,(unsigned char *)td->buffer,td->actlen); - - #endif - - break; - - case USB_PID_OUT: - //core.stdout("*out\r\n"); - #if LIBMODE - wait_ms(2); - #endif - - /* copy data into ram of sl811 */ - if(td->actlen>0) - sl811_write_buf(cMemStart,(unsigned char *)td->buffer,td->actlen); - - sl811_write(SL811_E0STAT,PID_OUT|td->endpoint); /* set pid and ep */ - - /* choose data0 or data1 */ - if(td->togl) - sl811_write(SL811_E0CTRL,DATA1_WR); /* send setup packet with DATA0 */ - else - sl811_write(SL811_E0CTRL,DATA0_WR); /* send setup packet with DATA0 */ - - td->state = USB_TRANSFER_DESCR_SEND; - - /* wait ack */ - #if LIBMODE - while((sl811_read(SL811_ISR)&SL811_ISR_USBA)==0); - //wait_ms(1); - #endif - - break; - - - } - - -} - - diff --git a/usb/host/sl811hs.h b/usb/host/sl811hs.h deleted file mode 100644 index b5d8ab4..0000000 --- a/usb/host/sl811hs.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2007, Benedikt Sauter - * All rights reserved. - * - * Short descripton of file (sl811hs.h): - * Register definitions of SL811, created from the datasheet - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the FH Augsburg nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SL811HS_H -#define _SL811HS_H - -/* prototypes for communication functions */ -void sl811_init(); -void sl811_reset(); -void sl811_write(u8 addr, u8 data); -u8 sl811_read(u8 addr); - -void sl811_write_burst(u8 data); -u8 sl811_read_burst(); - -void sl811_write_buf(u8 addr, unsigned char *buffer,u8 size); -void sl811_read_buf(u8 addr, unsigned char *buffer,u8 size); - -/* - * * ScanLogic SL811HS/T USB Host Controller - * */ - -#define SL811_IDX_ADDR (0x00) -#define SL811_IDX_DATA (0x01) -#define SL811_PORTSIZE (0x02) - -#define SL811_E0BASE (0x00) /* Base of Control0 */ -#define SL811_E0CTRL (0x00) /* Host Control Register */ -#define SL811_E0ADDR (0x01) /* Host Base Address */ -#define SL811_E0LEN (0x02) /* Host Base Length */ -#define SL811_E0STAT (0x03) /* USB Status (Read) */ -#define SL811_E0PID SL811_E0STAT /* Host PID, Device Endpoint (Write) */ -#define SL811_E0CONT (0x04) /* Transfer Count (Read) */ -#define SL811_E0DEV SL811_E0CONT /* Host Device Address (Write) */ - -#define SL811_E1BASE (0x08) /* Base of Control1 */ -#define SL811_E1CTRL (SL811_E1BASE + SL811_E0CTRL) -#define SL811_E1ADDR (SL811_E1BASE + SL811_E0ADDR) -#define SL811_E1LEN (SL811_E1BASE + SL811_E0LEN) -#define SL811_E1STAT (SL811_E1BASE + SL811_E0STAT) -#define SL811_E1PID (SL811_E1BASE + SL811_E0PID) -#define SL811_E1CONT (SL811_E1BASE + SL811_E0CONT) -#define SL811_E1DEV (SL811_E1BASE + SL811_E0DEV) - -#define SL811_CTRL (0x05) /* Control Register1 */ -#define SL811_IER (0x06) /* Interrupt Enable Register */ -#define SL811_ISR (0x0d) /* Interrupt Status Register */ -#define SL811_DATA (0x0e) /* SOF Counter Low (Write) */ -#define SL811_REV SL811_DATA /* HW Revision Register (Read) */ -#define SL811_CSOF (0x0f) /* SOF Counter High(R), Control2(W) */ -#define SL811_MEM (0x10) /* Memory Buffer (0x10 - 0xff) */ - -#define SL811_EPCTRL_ARM (0x01) -#define SL811_EPCTRL_ENABLE (0x02) -#define SL811_EPCTRL_DIRECTION (0x04) -#define SL811_EPCTRL_ISO (0x10) -#define SL811_EPCTRL_SOF (0x20) -#define SL811_EPCTRL_DATATOGGLE (0x40) -#define SL811_EPCTRL_PREAMBLE (0x80) - -#define SL811_EPPID_PIDMASK (0xf0) -#define SL811_EPPID_EPMASK (0x0f) - -#define SL811_EPSTAT_ACK (0x01) -#define SL811_EPSTAT_ERROR (0x02) -#define SL811_EPSTAT_TIMEOUT (0x04) -#define SL811_EPSTAT_SEQUENCE (0x08) -#define SL811_EPSTAT_SETUP (0x10) -#define SL811_EPSTAT_OVERFLOW (0x20) -#define SL811_EPSTAT_NAK (0x40) -#define SL811_EPSTAT_STALL (0x80) - -#define SL811_CTRL_ENABLESOF (0x01) -#define SL811_CTRL_EOF2 (0x04) -#define SL811_CTRL_RESETENGINE (0x08) -#define SL811_CTRL_JKSTATE (0x10) -#define SL811_CTRL_LOWSPEED (0x20) -#define SL811_CTRL_SUSPEND (0x40) - -#define SL811_IER_USBA (0x01) /* USB-A done */ -#define SL811_IER_USBB (0x02) /* USB-B done */ -#define SL811_IER_BABBLE (0x04) /* Babble detection */ -#define SL811_IER_SOFTIMER (0x10) /* 1ms SOF timer */ -#define SL811_IER_INSERT (0x20) /* Slave Insert/Remove detection */ -#define SL811_IER_RESET (0x40) /* USB Reset/Resume */ - -#define SL811_ISR_USBA (0x01) /* USB-A done */ -#define SL811_ISR_USBB (0x02) /* USB-B done */ -#define SL811_ISR_BABBLE (0x04) /* Babble detection */ -#define SL811_ISR_SOFTIMER (0x10) /* 1ms SOF timer */ -#define SL811_ISR_INSERT (0x20) /* Slave Insert/Remove detection */ -#define SL811_ISR_RESET (0x40) /* USB Reset/Resume */ -#define SL811_ISR_DATA (0x80) /* Value of the Data+ pin */ - -#define SL811_REV_USBA (0x01) /* USB-A */ -#define SL811_REV_USBB (0x02) /* USB-B */ -#define SL811_REV_REVMASK (0xf0) /* HW Revision */ -#define SL811_REV_REVSL811H (0x00) /* HW is SL811H */ -#define SL811_REV_REVSL811HS (0x10) /* HW is SL811HS */ - -#define SL811_CSOF_SOFMASK (0x3f) /* SOF High Counter */ -#define SL811_CSOF_POLARITY (0x40) /* Change polarity */ -#define SL811_CSOF_MASTER (0x80) /* Master/Slave selection */ - - -#define cMemStart 0x10 -#define ubufA 0x80 -#define ubufB 0xc0 -#define uxferLen 0x40 -#define sMemSize 0xc0 -#define cMemEnd 256 - - -#define EP0Buf 0x40 -#define EP0Len 0x40 - -#define DATA0_WR 0x07 -#define DATA1_WR 0x47 - -#define ZDATA0_WR 0x05 -#define ZDATA1_WR 0x45 - -#define DATA0_RD 0x03 -#define DATA1_RD 0x43 - -#define PID_SOF 0x50 -#define PID_SETUP 0xd0 -#define PID_IN 0x90 -#define PID_OUT 0x10 -#define PID_PRE 0xc0 -#define PID_NAK 0xa0 -#define PID_STALL 0xe0 -#define PID_DATA0 0x30 -#define PID_DATA1 0xb0 - - -#endif /* _SL811HS_H */ - -- 2.25.1