/* This function reserves GTM timer for later use. It returns gtm_timer structure to use with the rest of GTM API, you should use timer->irq to manage timer interrupt.  */
struct gtm_timer* gtm_get_timer16(void)
/* This function reserves GTM timer for later use. It returns gtm_timer structure to use with the rest of GTM API, you should use timer->irq to manage timer interrupt.  */
struct gtm_timer* gtm_get_timer16(void)
{
	struct gtm *gtm = NULL;
	int i;
	list_for_each_entry(gtm, &gtms, list_node) {
		spin_lock_irq(&gtm->lock);
		for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
			if (!gtm->timers[i].requested) {
				gtm->timers[i].requested = true;
				spin_unlock_irq(&gtm->lock);
				return &gtm->timers[i];
			}
		}
		spin_unlock_irq(&gtm->lock);
	}
	if (gtm)
		return ERR_PTR(-EBUSY);
	return ERR_PTR(-ENODEV);
}