LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
sys_arch.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2001, Swedish Institute of Computer Science.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the Institute nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * This file is part of the lwIP TCP/IP stack.
30 *
31 * Author: Adam Dunkels <adam@sics.se>
32 *
33 * $Id: sys_arch.c,v 1.1 2007/03/19 20:10:27 tmbinc Exp $
34 */
35
36#include "lwip/sys.h"
37#include "lwip/def.h"
38#include "lwip/timers.h"
39#include "ppc/time.h"
40
41static tb_t startTime;
42//struct sys_timeouts timeouts;
44
45/*-----------------------------------------------------------------------------------*/
46void
48{
49 int i;
50 for (i=0; i< time*1000; ++i) ;
51}
52/*-----------------------------------------------------------------------------------*/
53//sys_mbox_t
54//sys_mbox_new(void)
55//{
56// return SYS_MBOX_NULL;
57//}
59//void
60//sys_mbox_free(sys_mbox_t mbox)
61//{
62// return;
63//}
65//void
66//sys_mbox_post(sys_mbox_t mbox, void *data)
67//{
68// return;
69//}
70/*-----------------------------------------------------------------------------------*/
73{
74 sys_arch_block(timeout);
75 return 0;
76}
77/*-----------------------------------------------------------------------------------*/
80{
81 sys_arch_block(timeout);
82 return 0;
83}
85//sys_sem_t
86//sys_sem_new(u8_t count)
87//{
88// return 0;
89//}
91//u16_t
92//sys_arch_sem_wait(sys_sem_t sem, u16_t timeout)
93//{
94// sys_arch_block(timeout);
95// return 0;
96//}
98//void
99//sys_sem_signal(sys_sem_t sem)
100//{
101// return;
102//}
104//void
105//sys_sem_free(sys_sem_t sem)
106//{
107// return;
108//}
110
111void
113{
115 mftb(&startTime);
116 return;
117}
118/*-----------------------------------------------------------------------------------*/
119struct sys_timeo *
121{
122 return &timeouts;
123}
124
128{
129 tb_t now;
130 mftb(&now);
131 return (u32_t) tb_diff_msec(&now, &startTime);
132}
133
134u32_t sys_jiffies(void) /* since power up. */
135{
136 //static int count = 0;
137 //return ++count;
138 //tb_t now;
139 //mftb(&now);
140 //return (u32_t) now.l;
141
142 return sys_now();
143
144}
145
146/*-----------------------------------------------------------------------------------*/
147/*
148void
149sys_thread_new(void (* function)(void *arg), void *arg)
150{
151}
152*/
153
154//
155//sys_thread_t
156//sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio)
157//
158// return 0;
159//}
160
161/*-----------------------------------------------------------------------------------*/
unsigned int u32_t
Definition: cc.h:42
unsigned short u16_t
Definition: cc.h:40
#define NULL
Definition: def.h:47
u32_t time
Definition: timers.h:69
struct sys_timeo * next
Definition: timers.h:68
u32_t sys_now(void)
Definition: sys_arch.c:127
void sys_arch_block(u16_t time)
Definition: sys_arch.c:47
u16_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u16_t timeout)
--------------------------------------------------------------------------------—‍/
Definition: sys_arch.c:72
struct sys_timeo timeouts
Definition: sys_arch.c:43
u32_t sys_jiffies(void)
Definition: sys_arch.c:134
struct sys_timeo * sys_arch_timeouts(void)
Definition: sys_arch.c:120
void sys_init(void)
--------------------------------------------------------------------------------—‍/
Definition: sys_arch.c:112
u16_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **data, u16_t timeout)
Definition: sys_arch.c:79
int sys_mbox_t
Definition: sys_arch.h:42
union @15 data