2 * Copyright Droids Corporation
3 * Olivier Matz <zer0@droids-corp.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * Revision : $Id: main.c,v 1.10 2009-11-08 17:24:33 zer0 Exp $
25 /* initialize hostsim uart framework */
26 int hostsim_uart_init(void);
28 /* exit hostsim framework (should be called when program exits) */
29 int hostsim_uart_exit(void);
31 /* replacement for wait_ms() */
32 void host_wait_ms(int ms);
35 void hostsim_sei(void);
38 void hostsim_cli(void);
40 /* lock emulated IRQ and return the previous state */
41 uint8_t hostsim_irq_save(void);
43 /* restore the state given as parameter */
44 void hostsim_irq_restore(uint8_t flags);
46 /* return 1 if emulated IRQ are locked */
47 uint8_t hostsim_irq_locked(void);
49 /* Add a new timer: loaded at init and cannot be unloaded. The resolution is
50 * specified later in hostsim_ittimer_enable(). If a value lower than the
51 * resolution is given, the timer handler will be called several times from the
52 * signal handler. However it's not advised as some callbacks can be lost the
53 * signal occurs when irq are locked.
55 * This function must be called before hostsim_ittimer_enable(). Once
56 * hostsim_ittimer_enable() is called, no timer should be added. */
57 struct hostsim_ittimer *hostsim_ittimer_add(void (*handler)(void),
60 /* enable loaded ittimers
61 * 'timer_resolution_us' is the resolution of timer events that can be
62 * loaded. The advised value is 100 (us). */
63 int hostsim_ittimer_enable(unsigned timer_resolution_us);