summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r--firmware/drivers/ata.c68
1 files changed, 0 insertions, 68 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 4b365a50ab..355ff37900 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -79,74 +79,6 @@
79static unsigned int ata_thread_id = 0; 79static unsigned int ata_thread_id = 0;
80#endif 80#endif
81 81
82#if defined(MAX_PHYS_SECTOR_SIZE) && MEMORYSIZE == 64
83/* Hack - what's the deal with 5g? */
84struct ata_lock
85{
86 struct thread_entry *thread;
87 int count;
88 volatile unsigned char locked;
89 IF_COP( struct corelock cl; )
90};
91
92static void ata_lock_init(struct ata_lock *l)
93{
94 corelock_init(&l->cl);
95 l->locked = 0;
96 l->count = 0;
97 l->thread = NULL;
98}
99
100static void ata_lock_lock(struct ata_lock *l)
101{
102 struct thread_entry * const current = thread_self_entry();
103
104 if (current == l->thread)
105 {
106 l->count++;
107 return;
108 }
109
110 corelock_lock(&l->cl);
111
112 IF_PRIO( current->skip_count = -1; )
113
114 while (l->locked != 0)
115 {
116 corelock_unlock(&l->cl);
117 switch_thread();
118 corelock_lock(&l->cl);
119 }
120
121 l->locked = 1;
122 l->thread = current;
123 corelock_unlock(&l->cl);
124}
125
126static void ata_lock_unlock(struct ata_lock *l)
127{
128 if (l->count > 0)
129 {
130 l->count--;
131 return;
132 }
133
134 corelock_lock(&l->cl);
135
136 IF_PRIO( l->thread->skip_count = 0; )
137
138 l->thread = NULL;
139 l->locked = 0;
140
141 corelock_unlock(&l->cl);
142}
143
144#define mutex ata_lock
145#define mutex_init ata_lock_init
146#define mutex_lock ata_lock_lock
147#define mutex_unlock ata_lock_unlock
148#endif /* MAX_PHYS_SECTOR_SIZE */
149
150#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB) 82#if defined(HAVE_USBSTACK) && defined(USE_ROCKBOX_USB)
151#define ALLOW_USB_SPINDOWN 83#define ALLOW_USB_SPINDOWN
152#endif 84#endif