diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-02-20 00:21:20 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-02-20 00:21:20 +0000 |
commit | 2aefbf7549cdc99785282986b2b7691cf7b02ea2 (patch) | |
tree | 38a29733f6f6891511a7f02feb0795159ee56fef | |
parent | e9edc8f82df2c182c2453720a79ad37c55e6ef4b (diff) | |
download | rockbox-2aefbf7549cdc99785282986b2b7691cf7b02ea2.tar.gz rockbox-2aefbf7549cdc99785282986b2b7691cf7b02ea2.zip |
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
-rw-r--r-- | firmware/drivers/ata_mmc.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 2ba465f63d..17ec9774c4 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -96,6 +96,7 @@ static const char mmc_thread_name[] = "mmc"; | |||
96 | static struct event_queue mmc_queue; | 96 | static struct event_queue mmc_queue; |
97 | #endif | 97 | #endif |
98 | static bool initialized = false; | 98 | static bool initialized = false; |
99 | static bool new_mmc_circuit; | ||
99 | static bool delayed_write = false; | 100 | static bool delayed_write = false; |
100 | static unsigned char delayed_sector[SECTOR_SIZE]; | 101 | static unsigned char delayed_sector[SECTOR_SIZE]; |
101 | static int delayed_sector_num; | 102 | static int delayed_sector_num; |
@@ -122,7 +123,7 @@ static int current_card = 0; | |||
122 | static bool last_mmc_status = false; | 123 | static bool last_mmc_status = false; |
123 | static int countdown; /* for mmc switch debouncing */ | 124 | static int countdown; /* for mmc switch debouncing */ |
124 | static bool usb_activity; /* monitoring the USB bridge */ | 125 | static bool usb_activity; /* monitoring the USB bridge */ |
125 | static long last_activity; | 126 | static long last_usb_activity; |
126 | 127 | ||
127 | /* private function declarations */ | 128 | /* private function declarations */ |
128 | 129 | ||
@@ -153,7 +154,7 @@ void mmc_select_clock(int card_no) | |||
153 | { | 154 | { |
154 | /* set clock gate for external card / reset for internal card if the | 155 | /* set clock gate for external card / reset for internal card if the |
155 | * MMC clock polarity bit is 0, vice versa if it is 1 */ | 156 | * MMC clock polarity bit is 0, vice versa if it is 1 */ |
156 | if ((card_no != 0) ^ ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0)) | 157 | if ((card_no != 0) ^ new_mmc_circuit) |
157 | or_b(0x10, &PADRH); /* set clock gate PA12 */ | 158 | or_b(0x10, &PADRH); /* set clock gate PA12 */ |
158 | else | 159 | else |
159 | and_b(~0x10, &PADRH); /* clear clock gate PA12 */ | 160 | and_b(~0x10, &PADRH); /* clear clock gate PA12 */ |
@@ -848,19 +849,21 @@ bool mmc_usb_active(int delayticks) | |||
848 | { | 849 | { |
849 | /* reading "inactive" is delayed by user-supplied monoflop value */ | 850 | /* reading "inactive" is delayed by user-supplied monoflop value */ |
850 | return (usb_activity || | 851 | return (usb_activity || |
851 | TIME_BEFORE(current_tick, last_activity+delayticks)); | 852 | TIME_BEFORE(current_tick, last_usb_activity + delayticks)); |
852 | } | 853 | } |
853 | 854 | ||
854 | static void mmc_tick(void) | 855 | static void mmc_tick(void) |
855 | { | 856 | { |
856 | bool current_status; | 857 | bool current_status; |
857 | 858 | ||
858 | /* USB bridge activity is 0 on idle, ~527 on active */ | 859 | if (new_mmc_circuit) |
859 | current_status = adc_read(ADC_USB_ACTIVE) > 0x100; | 860 | /* USB bridge activity is 0 on idle, ~527 on active */ |
861 | current_status = adc_read(ADC_USB_ACTIVE) > 0x100; | ||
862 | else | ||
863 | current_status = adc_read(ADC_USB_ACTIVE) < 0x190; | ||
864 | |||
860 | if (!current_status && usb_activity) | 865 | if (!current_status && usb_activity) |
861 | { | 866 | last_usb_activity = current_tick; |
862 | last_activity = current_tick; | ||
863 | } | ||
864 | usb_activity = current_status; | 867 | usb_activity = current_status; |
865 | 868 | ||
866 | current_status = mmc_detect(); | 869 | current_status = mmc_detect(); |
@@ -947,6 +950,7 @@ int ata_init(void) | |||
947 | 950 | ||
948 | if ( !initialized ) | 951 | if ( !initialized ) |
949 | { | 952 | { |
953 | new_mmc_circuit = ((read_hw_mask() & MMC_CLOCK_POLARITY) != 0); | ||
950 | #ifdef HAVE_HOTSWAP | 954 | #ifdef HAVE_HOTSWAP |
951 | queue_init(&mmc_queue); | 955 | queue_init(&mmc_queue); |
952 | create_thread(mmc_thread, mmc_stack, | 956 | create_thread(mmc_thread, mmc_stack, |