int restart_gpt(unsigned int id) { unsigned long save_flags; struct gpt_device *dev = id_to_dev(id); if (!dev) return -EINVAL; if (!(dev->flags & GPT_IN_USE)) { printk(KERN_ERR "%s: GPT%d is not in use!\n", __func__, id); return -EBUSY; } gpt_update_lock(save_flags); __gpt_start(dev); gpt_update_unlock(save_flags); return 0; }
static void setup_gpt_dev_locked(struct gpt_device *dev, unsigned int mode, unsigned int clksrc, unsigned int clkdiv, unsigned int cmp, void (*func)(unsigned long), unsigned int flags) { __gpt_set_flags(dev, flags | GPT_IN_USE); __gpt_set_mode(dev, mode & GPT_OPMODE_MASK); __gpt_set_clk(dev, clksrc & GPT_CLKSRC_MASK, clkdiv & GPT_CLKDIV_MASK); if (func) __gpt_set_handler(dev, func); if (dev->mode != GPT_FREE_RUN) { __gpt_set_cmp(dev, cmp, 0); if (!(dev->flags & GPT_NOIRQEN)) __gpt_enable_irq(dev); } if (!(dev->flags & GPT_NOAUTOEN)) __gpt_start(dev); }
static inline void start_syscnt_assist(void) { struct gpt_device *dev = id_to_dev(GPT_SYSCNT_ASSIST_ID); __gpt_start(dev); }
static void __gpt_start_from_zero(struct gpt_device *dev) { //DRV_SetReg32(dev->base_addr + GPT_CON, GPT_CON_ENABLE | GPT_CON_CLRCNT); __gpt_clrcnt(dev); __gpt_start(dev); }