mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
05e180a130
commit
12375d1d3a
38 changed files with 294 additions and 311 deletions
|
|
@ -74,7 +74,7 @@ static int datacount = 0;
|
|||
static volatile int cur_touch = 0;
|
||||
static volatile bool pen_down = false;
|
||||
static struct mutex battery_mtx;
|
||||
static struct wakeup battery_wkup;
|
||||
static struct semaphore battery_done;
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ unsigned int battery_adc_voltage(void)
|
|||
|
||||
REG_SADC_ENA |= SADC_ENA_PBATEN;
|
||||
|
||||
wakeup_wait(&battery_wkup, HZ/4);
|
||||
semaphore_wait(&battery_done, HZ/4);
|
||||
bat_val = REG_SADC_BATDAT;
|
||||
|
||||
logf("%d %d", bat_val, (bat_val * BATTERY_SCALE_FACTOR) / 4096);
|
||||
|
|
@ -268,7 +268,7 @@ void SADC(void)
|
|||
if(state & SADC_CTRL_PBATRDYM)
|
||||
{
|
||||
/* Battery AD IRQ */
|
||||
wakeup_signal(&battery_wkup);
|
||||
semaphore_release(&battery_done);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ void adc_init(void)
|
|||
REG_SADC_ENA = SADC_ENA_TSEN;
|
||||
|
||||
mutex_init(&battery_mtx);
|
||||
wakeup_init(&battery_wkup);
|
||||
semaphore_init(&battery_done, 1, 0);
|
||||
}
|
||||
|
||||
void adc_close(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue