source: UsbWattMeter/trunk/lwip-1.4.1/ports/asp_dcre/arch/sys_arch.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 2.7 KB
Line 
1/*
2 * ‘æ3‰ñ TOPPERSŠˆ—pƒAƒCƒfƒAEƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJ”­ƒRƒ“ƒeƒXƒg
3 * ¼‰Y Œõ—m‚³‚ñ‚́ulwIP ‚̈ڐAv‚ðƒx[ƒX‚É‚µ‚Ü‚µ‚½B
4 * http://www.toppers.jp/contest.html
5 *
6 * @(#) $Id: sys_arch.h 164 2016-03-07 11:33:50Z coas-nagasima $
7 */
8#ifndef __ARCH_SYS_ARCH_H__
9#define __ARCH_SYS_ARCH_H__
10
11#include <kernel.h>
12#include <stdio.h>
13#include <stdlib.h>
14#ifndef _MSC_VER
15#include <sys/types.h>
16#include <sys/time.h>
17#else
18#include <time.h>
19#include <io.h>
20#endif // _MSC_VER
21#include <ff.h>
22
23typedef ID sys_sem_t;
24typedef ID sys_mbox_t;
25typedef ID sys_thread_t;
26
27#define sys_sem_valid( x ) ( ( ( *x ) == (sys_sem_t)NULL) ? 0 : 1 )
28#define sys_sem_set_invalid( x ) ( ( *x ) = (sys_sem_t)NULL )
29#define sys_mbox_valid( x ) ( ( ( *x ) == (sys_mbox_t)NULL) ? 0 : 1 )
30#define sys_mbox_set_invalid( x ) ( ( *x ) = (sys_mbox_t)NULL )
31
32extern void *sys_malloc(size_t size);
33extern void *sys_calloc(size_t count, size_t size);
34extern void *sys_realloc(void *ptr, size_t size);
35extern void sys_free(void *mem);
36extern void *sys_trim(void *mem, size_t size);
37
38extern void sys_sleep(uint32_t ms);
39
40/* let sys.h use binary semaphores for mutexes */
41#define LWIP_COMPAT_MUTEX 1
42
43extern FIL *sys_fopen(const char *, const char *);
44#define fopen sys_fopen
45extern long sys_fseek(FIL *, long, long);
46#define fseek sys_fseek
47extern long sys_lseek(FIL *, long offset, int origin);
48#define lseek sys_lseek
49extern long sys_ftell(FIL *);
50#define ftell sys_ftell
51extern long sys_fclose(FIL *);
52#define fclose sys_fclose
53extern size_t sys_fread(void *, size_t, size_t, FIL *);
54#define fread sys_fread
55extern size_t sys_fwrite(const void *, size_t, size_t, FIL *);
56#define fwrite sys_fwrite
57extern long sys_fputs(const char *, FIL *);
58#define fputs sys_fputs
59extern long sys_fputc(long, FIL *);
60#define fputc sys_fputc
61extern long sys_fflush(FIL *);
62#define fflush sys_fflush
63extern char *sys_fgets(char *, long, FIL *);
64#define fgets sys_fgets
65extern long sys_ferror(FIL *);
66#define ferror sys_ferror
67extern long sys_rewind(FIL *);
68#define rewind sys_rewind
69extern long sys_fprintf(FIL *, const char *, ...);
70#define fprintf sys_fprintf
71
72extern void sys_exit(int error);
73#define exit sys_exit
74
75#undef stdin
76extern FIL *sys_stdin;
77#define stdin sys_stdin
78#undef stdout
79extern FIL *sys_stdout;
80#define stdout sys_stdout
81#undef stderr
82extern FIL *sys_stderr;
83#define stderr sys_stderr
84#define FILE FIL
85
86#define malloc(sz) sys_malloc(sz)
87#define calloc(cnt, sz) sys_calloc(cnt, sz)
88#define realloc(ptr, sz) sys_realloc(ptr, sz)
89#define free(ptr) sys_free(ptr)
90
91extern time_t sys_time(time_t *t);
92#define time sys_time
93extern struct tm *sys_gmtime(const time_t *pt);
94#define gmtime sys_gmtime
95struct tm *gmtime_r(const time_t *pt, struct tm* tm);
96extern void sys_set_system_time(time_t t);
97
98#endif /* __ARCH_SYS_ARCH_H__ */
Note: See TracBrowser for help on using the repository browser.