source: trunk/libs/newlib/src/newlib/libc/machine/spu/include/spu_timer.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.9 KB
Line 
1/*
2(C) Copyright IBM Corp. 2008
3
4All rights reserved.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9* Redistributions of source code must retain the above copyright notice,
10this list of conditions and the following disclaimer.
11* Redistributions in binary form must reproduce the above copyright
12notice, this list of conditions and the following disclaimer in the
13documentation and/or other materials provided with the distribution.
14* Neither the name of IBM nor the names of its contributors may be
15used to endorse or promote products derived from this software without
16specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
29*/
30
31#ifndef _SPU_TIMER_H_
32#define _SPU_TIMER_H_
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#include <stdint.h>
39
40/* Clock services.  */
41extern void spu_clock_start (void);
42extern int spu_clock_stop (void);
43extern uint64_t spu_clock_read (void);
44
45/* Timer services.  */
46extern int spu_timer_alloc (int interval, void (*func) (int));
47extern int spu_timer_free (int id);
48extern int spu_timer_start (int id);
49extern int spu_timer_stop (int id);
50extern unsigned spu_timebase (void);
51
52/* Interrupt services.  */
53extern void spu_slih_register (unsigned event_mask,
54                               unsigned (*slih) (unsigned));
55extern unsigned spu_clock_slih (unsigned event_mask);
56
57/* Number of supported timers.  */
58#define SPU_TIMER_NTIMERS               4
59
60/* Recommended minimun spu timer interval time from (cat /proc/cpuinfo)
61    * QS20       100/14318000  = 6.98 usec
62    * QS21/QS22  100/26666666  = 3.75 usec
63    * PS3        100/79800000  = 1.25 usec  */
64#define SPU_TIMER_MIN_INTERVAL          100
65
66/* Clock error codes.  */
67#define SPU_CLOCK_ERR_NOT_RUNNING       -2
68#define SPU_CLOCK_ERR_STILL_RUNNING     -3
69#define SPU_CLOCK_ERR_TIMERS_ACTIVE     -4
70
71/* Timer error codes.  */
72#define SPU_TIMER_ERR_INVALID_PARM      -10
73#define SPU_TIMER_ERR_NONE_FREE         -11
74#define SPU_TIMER_ERR_INVALID_ID        -12
75#define SPU_TIMER_ERR_ACTIVE            -13
76#define SPU_TIMER_ERR_NOT_ACTIVE        -14
77#define SPU_TIMER_ERR_NOCLOCK           -15
78#define SPU_TIMER_ERR_FREE              -16
79#define SPU_TIMER_ERR_NOT_STOPPED       -17
80
81#ifdef __cplusplus
82}
83#endif
84
85#endif
Note: See TracBrowser for help on using the repository browser.