Commit 8c0b4351 authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: gptimers: use unsigned timer/group ids

Since we always use these ids as unsigned values, and we have some assert
code to make sure they don't exceed a limit, avoid signed issues.
Reported-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent dbc5e698
......@@ -172,25 +172,25 @@
/* The actual gptimer API */
void set_gptimer_pwidth(int timer_id, uint32_t width);
uint32_t get_gptimer_pwidth(int timer_id);
void set_gptimer_period(int timer_id, uint32_t period);
uint32_t get_gptimer_period(int timer_id);
uint32_t get_gptimer_count(int timer_id);
int get_gptimer_intr(int timer_id);
void clear_gptimer_intr(int timer_id);
int get_gptimer_over(int timer_id);
void clear_gptimer_over(int timer_id);
void set_gptimer_config(int timer_id, uint16_t config);
uint16_t get_gptimer_config(int timer_id);
int get_gptimer_run(int timer_id);
void set_gptimer_pulse_hi(int timer_id);
void clear_gptimer_pulse_hi(int timer_id);
void set_gptimer_pwidth(unsigned int timer_id, uint32_t width);
uint32_t get_gptimer_pwidth(unsigned int timer_id);
void set_gptimer_period(unsigned int timer_id, uint32_t period);
uint32_t get_gptimer_period(unsigned int timer_id);
uint32_t get_gptimer_count(unsigned int timer_id);
int get_gptimer_intr(unsigned int timer_id);
void clear_gptimer_intr(unsigned int timer_id);
int get_gptimer_over(unsigned int timer_id);
void clear_gptimer_over(unsigned int timer_id);
void set_gptimer_config(unsigned int timer_id, uint16_t config);
uint16_t get_gptimer_config(unsigned int timer_id);
int get_gptimer_run(unsigned int timer_id);
void set_gptimer_pulse_hi(unsigned int timer_id);
void clear_gptimer_pulse_hi(unsigned int timer_id);
void enable_gptimers(uint16_t mask);
void disable_gptimers(uint16_t mask);
void disable_gptimers_sync(uint16_t mask);
uint16_t get_enabled_gptimers(void);
uint32_t get_gptimer_status(int group);
void set_gptimer_status(int group, uint32_t value);
uint32_t get_gptimer_status(unsigned int group);
void set_gptimer_status(unsigned int group, uint32_t value);
#endif
......@@ -137,7 +137,7 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
#endif
};
void set_gptimer_pwidth(int timer_id, uint32_t value)
void set_gptimer_pwidth(unsigned int timer_id, uint32_t value)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
timer_regs[timer_id]->width = value;
......@@ -145,14 +145,14 @@ void set_gptimer_pwidth(int timer_id, uint32_t value)
}
EXPORT_SYMBOL(set_gptimer_pwidth);
uint32_t get_gptimer_pwidth(int timer_id)
uint32_t get_gptimer_pwidth(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return timer_regs[timer_id]->width;
}
EXPORT_SYMBOL(get_gptimer_pwidth);
void set_gptimer_period(int timer_id, uint32_t period)
void set_gptimer_period(unsigned int timer_id, uint32_t period)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
timer_regs[timer_id]->period = period;
......@@ -160,28 +160,28 @@ void set_gptimer_period(int timer_id, uint32_t period)
}
EXPORT_SYMBOL(set_gptimer_period);
uint32_t get_gptimer_period(int timer_id)
uint32_t get_gptimer_period(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return timer_regs[timer_id]->period;
}
EXPORT_SYMBOL(get_gptimer_period);
uint32_t get_gptimer_count(int timer_id)
uint32_t get_gptimer_count(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return timer_regs[timer_id]->counter;
}
EXPORT_SYMBOL(get_gptimer_count);
uint32_t get_gptimer_status(int group)
uint32_t get_gptimer_status(unsigned int group)
{
tassert(group < BFIN_TIMER_NUM_GROUP);
return group_regs[group]->status;
}
EXPORT_SYMBOL(get_gptimer_status);
void set_gptimer_status(int group, uint32_t value)
void set_gptimer_status(unsigned int group, uint32_t value)
{
tassert(group < BFIN_TIMER_NUM_GROUP);
group_regs[group]->status = value;
......@@ -189,42 +189,42 @@ void set_gptimer_status(int group, uint32_t value)
}
EXPORT_SYMBOL(set_gptimer_status);
int get_gptimer_intr(int timer_id)
int get_gptimer_intr(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]);
}
EXPORT_SYMBOL(get_gptimer_intr);
void clear_gptimer_intr(int timer_id)
void clear_gptimer_intr(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id];
}
EXPORT_SYMBOL(clear_gptimer_intr);
int get_gptimer_over(int timer_id)
int get_gptimer_over(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]);
}
EXPORT_SYMBOL(get_gptimer_over);
void clear_gptimer_over(int timer_id)
void clear_gptimer_over(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id];
}
EXPORT_SYMBOL(clear_gptimer_over);
int get_gptimer_run(int timer_id)
int get_gptimer_run(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]);
}
EXPORT_SYMBOL(get_gptimer_run);
void set_gptimer_config(int timer_id, uint16_t config)
void set_gptimer_config(unsigned int timer_id, uint16_t config)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
timer_regs[timer_id]->config = config;
......@@ -232,7 +232,7 @@ void set_gptimer_config(int timer_id, uint16_t config)
}
EXPORT_SYMBOL(set_gptimer_config);
uint16_t get_gptimer_config(int timer_id)
uint16_t get_gptimer_config(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
return timer_regs[timer_id]->config;
......@@ -280,7 +280,7 @@ void disable_gptimers_sync(uint16_t mask)
}
EXPORT_SYMBOL(disable_gptimers_sync);
void set_gptimer_pulse_hi(int timer_id)
void set_gptimer_pulse_hi(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
timer_regs[timer_id]->config |= TIMER_PULSE_HI;
......@@ -288,7 +288,7 @@ void set_gptimer_pulse_hi(int timer_id)
}
EXPORT_SYMBOL(set_gptimer_pulse_hi);
void clear_gptimer_pulse_hi(int timer_id)
void clear_gptimer_pulse_hi(unsigned int timer_id)
{
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
timer_regs[timer_id]->config &= ~TIMER_PULSE_HI;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment