summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-02-02 17:14:53 +0000
committerJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-02-02 17:14:53 +0000
commit93a34f017a48ffe72f4dc2b3cba63e03de4720ac (patch)
tree1188f6298697b2cd09a7b5a68ecc8ab7aed651b7
parent5dc8ff6b8c0b6a08b600c063c0595da715dab8ef (diff)
downloadrockbox-93a34f017a48ffe72f4dc2b3cba63e03de4720ac.tar.gz
rockbox-93a34f017a48ffe72f4dc2b3cba63e03de4720ac.zip
Tentative USB support for gmini
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5739 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/usb.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/firmware/usb.c b/firmware/usb.c
index b29344ecc3..f1c8f37541 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -80,6 +80,20 @@ static struct event_queue usb_queue;
80static bool last_usb_status; 80static bool last_usb_status;
81static bool usb_monitor_enabled; 81static bool usb_monitor_enabled;
82 82
83#ifdef USB_GMINISTYLE
84static int getSMSCVer(void) {
85 int v;
86 int* smscVerAddr = (int*)0x4C20;
87 __asm__ ("ldc %0, @%1" : "=r"(v) : "a"(smscVerAddr));
88 v &= 0xFF;
89 if (v < 4 || v == 0xFF) {
90 return 3;
91 }
92 return v;
93}
94
95#endif
96
83static void usb_enable(bool on) 97static void usb_enable(bool on)
84{ 98{
85#ifdef USB_ENABLE_ONDIOSTYLE 99#ifdef USB_ENABLE_ONDIOSTYLE
@@ -103,6 +117,34 @@ static void usb_enable(bool on)
103 } 117 }
104 or_b(0x28, &PAIORL); /* output for USB enable and card detect */ 118 or_b(0x28, &PAIORL); /* output for USB enable and card detect */
105#else /* standard HD Jukebox */ 119#else /* standard HD Jukebox */
120#ifdef USB_GMINISTYLE
121 {
122 int i;
123 int smscVer = getSMSCVer();
124 if (on) {
125 if (smscVer < 4) {
126 P6 &= ~0x04;
127 P10 &= ~0x20;
128
129 for (i=0; i < 20; i++)
130 ;
131
132 P6 |= 0x08;
133 P10 |= 0x20;
134
135 for (i=0; i < 20; i++)
136 ;
137 }
138 P6 |= 0x10;
139 } else {
140 P6 &= ~0x10;
141 if (smscVer < 4) {
142 P6 &= ~0x04;
143 P10 &= ~0x20;
144 }
145 }
146 }
147#else
106#ifdef HAVE_LCD_BITMAP 148#ifdef HAVE_LCD_BITMAP
107 if(read_hw_mask() & USB_ACTIVE_HIGH) 149 if(read_hw_mask() & USB_ACTIVE_HIGH)
108 on = !on; 150 on = !on;
@@ -117,6 +159,7 @@ static void usb_enable(bool on)
117 } 159 }
118 or_b(0x04, &PAIORH); 160 or_b(0x04, &PAIORH);
119#endif 161#endif
162#endif
120} 163}
121 164
122static void usb_slave_mode(bool on) 165static void usb_slave_mode(bool on)
@@ -300,6 +343,9 @@ bool usb_detect(void)
300#ifdef IRIVER_H100 343#ifdef IRIVER_H100
301 current_status = (GPIO1_READ & 0x80)?true:false; 344 current_status = (GPIO1_READ & 0x80)?true:false;
302#endif 345#endif
346#ifdef USB_GMINISTYLE
347 current_status = (P5 & 0x80)?true:false;
348#endif
303 return current_status; 349 return current_status;
304} 350}
305 351