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:
parent
e9edc8f82d
commit
2aefbf7549
1 changed files with 12 additions and 8 deletions
|
|
@ -96,6 +96,7 @@ static const char mmc_thread_name[] = "mmc";
|
|||
static struct event_queue mmc_queue;
|
||||
#endif
|
||||
static bool initialized = false;
|
||||
static bool new_mmc_circuit;
|
||||
static bool delayed_write = false;
|
||||
static unsigned char delayed_sector[SECTOR_SIZE];
|
||||
static int delayed_sector_num;
|
||||
|
|
@ -122,7 +123,7 @@ static int current_card = 0;
|
|||
static bool last_mmc_status = false;
|
||||
static int countdown; /* for mmc switch debouncing */
|
||||
static bool usb_activity; /* monitoring the USB bridge */
|
||||
static long last_activity;
|
||||
static long last_usb_activity;
|
||||
|
||||
/* 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
|
||||
* 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 */
|
||||
else
|
||||
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 */
|
||||
return (usb_activity ||
|
||||
TIME_BEFORE(current_tick, last_activity+delayticks));
|
||||
TIME_BEFORE(current_tick, last_usb_activity + delayticks));
|
||||
}
|
||||
|
||||
static void mmc_tick(void)
|
||||
{
|
||||
bool current_status;
|
||||
|
||||
/* USB bridge activity is 0 on idle, ~527 on active */
|
||||
current_status = adc_read(ADC_USB_ACTIVE) > 0x100;
|
||||
if (new_mmc_circuit)
|
||||
/* 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)
|
||||
{
|
||||
last_activity = current_tick;
|
||||
}
|
||||
last_usb_activity = current_tick;
|
||||
usb_activity = current_status;
|
||||
|
||||
current_status = mmc_detect();
|
||||
|
|
@ -947,6 +950,7 @@ int ata_init(void)
|
|||
|
||||
if ( !initialized )
|
||||
{
|
||||
new_mmc_circuit = ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0);
|
||||
#ifdef HAVE_HOTSWAP
|
||||
queue_init(&mmc_queue);
|
||||
create_thread(mmc_thread, mmc_stack,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue