1
0
Fork 0
forked from len0rd/rockbox

Correctly display USB activity on Ondios with old bridge. (Added blindly, please test.) Slight code cleanup, removed DOS line endings.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6025 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-02-20 00:21:20 +00:00
parent e9edc8f82d
commit 2aefbf7549

View file

@ -96,6 +96,7 @@ static const char mmc_thread_name[] = "mmc";
static struct event_queue mmc_queue; static struct event_queue mmc_queue;
#endif #endif
static bool initialized = false; static bool initialized = false;
static bool new_mmc_circuit;
static bool delayed_write = false; static bool delayed_write = false;
static unsigned char delayed_sector[SECTOR_SIZE]; static unsigned char delayed_sector[SECTOR_SIZE];
static int delayed_sector_num; static int delayed_sector_num;
@ -122,7 +123,7 @@ static int current_card = 0;
static bool last_mmc_status = false; static bool last_mmc_status = false;
static int countdown; /* for mmc switch debouncing */ static int countdown; /* for mmc switch debouncing */
static bool usb_activity; /* monitoring the USB bridge */ static bool usb_activity; /* monitoring the USB bridge */
static long last_activity; static long last_usb_activity;
/* private function declarations */ /* private function declarations */
@ -153,7 +154,7 @@ void mmc_select_clock(int card_no)
{ {
/* set clock gate for external card / reset for internal card if the /* set clock gate for external card / reset for internal card if the
* MMC clock polarity bit is 0, vice versa if it is 1 */ * MMC clock polarity bit is 0, vice versa if it is 1 */
if ((card_no != 0) ^ ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0)) if ((card_no != 0) ^ new_mmc_circuit)
or_b(0x10, &PADRH); /* set clock gate PA12 */ or_b(0x10, &PADRH); /* set clock gate PA12 */
else else
and_b(~0x10, &PADRH); /* clear clock gate PA12 */ and_b(~0x10, &PADRH); /* clear clock gate PA12 */
@ -848,19 +849,21 @@ bool mmc_usb_active(int delayticks)
{ {
/* reading "inactive" is delayed by user-supplied monoflop value */ /* reading "inactive" is delayed by user-supplied monoflop value */
return (usb_activity || return (usb_activity ||
TIME_BEFORE(current_tick, last_activity+delayticks)); TIME_BEFORE(current_tick, last_usb_activity + delayticks));
} }
static void mmc_tick(void) static void mmc_tick(void)
{ {
bool current_status; bool current_status;
/* USB bridge activity is 0 on idle, ~527 on active */ if (new_mmc_circuit)
current_status = adc_read(ADC_USB_ACTIVE) > 0x100; /* USB bridge activity is 0 on idle, ~527 on active */
current_status = adc_read(ADC_USB_ACTIVE) > 0x100;
else
current_status = adc_read(ADC_USB_ACTIVE) < 0x190;
if (!current_status && usb_activity) if (!current_status && usb_activity)
{ last_usb_activity = current_tick;
last_activity = current_tick;
}
usb_activity = current_status; usb_activity = current_status;
current_status = mmc_detect(); current_status = mmc_detect();
@ -947,6 +950,7 @@ int ata_init(void)
if ( !initialized ) if ( !initialized )
{ {
new_mmc_circuit = ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0);
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
queue_init(&mmc_queue); queue_init(&mmc_queue);
create_thread(mmc_thread, mmc_stack, create_thread(mmc_thread, mmc_stack,