Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Stuff
Saturday, March 3rd, 2007 at 10:05:53pm UTC 

  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  * $Id: usb-pp.c 12360 2007-02-17 21:54:17Z bagder $
  9.  *
  10.  * Copyright (C) 2002 by Linus Nielsen Feltzing
  11.  *
  12.  * iPod driver based on code from the ipodlinux project - http://ipodlinux.org
  13.  * Adapted for Rockbox in January 2006
  14.  * Original file: podzilla/usb.c
  15.  * Copyright (C) 2005 Adam Johnston
  16.  *
  17.  * All files in this archive are subject to the GNU General Public License.
  18.  * See the file COPYING in the source tree root for full license agreement.
  19.  *
  20.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21.  * KIND, either express or implied.
  22.  *
  23.  ****************************************************************************/
  24. #include "config.h"
  25. #include "cpu.h"
  26. #include "kernel.h"
  27. #include "thread.h"
  28. #include "system.h"
  29. #include "debug.h"
  30. #include "ata.h"
  31. #include "fat.h"
  32. #include "disk.h"
  33. #include "panic.h"
  34. #include "lcd.h"
  35. #include "adc.h"
  36. #include "usb.h"
  37. #include "button.h"
  38. #include "sprintf.h"
  39. #include "string.h"
  40. #include "hwcompat.h"
  41.  
  42. #include "usb-target.h"
  43. #include "arcotg_udc.h"
  44.  
  45. void usb_init_device(void)
  46. {
  47.     int r0;
  48.     outl(inl(0x70000084) | 0x200, 0x70000084);
  49.  
  50.     outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
  51.     DEV_EN |= DEV_USB;
  52.  
  53.     DEV_RS |= DEV_USB; /* reset usb start */
  54.     DEV_RS &=~DEV_USB;/* reset usb end */
  55.  
  56.     DEV_INIT |= INIT_USB;
  57.     while ((inl(0x70000028) & 0x80) == 0);
  58.  
  59.     UDC_PORTSC1 |= PORTSCX_PORT_RESET;
  60.     while ((UDC_PORTSC1 & PORTSCX_PORT_RESET) != 0);
  61.  
  62.     UDC_OTGSC |= 0x5F000000;
  63.     if( (UDC_OTGSC & 0x100) == 0) {
  64.         UDC_USBMODE &=~ USB_MODE_CTRL_MODE_HOST;
  65.         UDC_USBMODE |= USB_MODE_CTRL_MODE_DEVICE;
  66.         outl(inl(0x70000028) | 0x4000, 0x70000028);
  67.         outl(inl(0x70000028) | 0x2, 0x70000028);
  68.     } else {
  69.         UDC_USBMODE |= USB_MODE_CTRL_MODE_DEVICE;
  70.         outl(inl(0x70000028) &~0x4000, 0x70000028);
  71.         outl(inl(0x70000028) | 0x2, 0x70000028);
  72.     }
  73.    
  74.    
  75.     UDC_USBCMD |= USB_CMD_CTRL_RESET;
  76.     while((UDC_USBCMD & USB_CMD_CTRL_RESET) != 0);
  77.    
  78.     r0 = UDC_PORTSC1;
  79.  
  80.     /* Note from IPL source (referring to next 5 lines of code:
  81.        THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
  82.     DEV_INIT |= INIT_USB;
  83.     DEV_EN |= DEV_USB;
  84.     while ((inl(0x70000028) & 0x80) == 0);
  85.     outl(inl(0x70000028) | 0x2, 0x70000028);
  86.  
  87.     udelay(0x186A0);
  88.  
  89.  
  90. }
  91.  
  92. void usb_enable(bool on)
  93. {
  94.     (void)on;
  95. }
  96.  
  97. bool usb_detect(void)
  98. {
  99.     return false;
  100. }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus