per test
[rattatechess.git] / platform.h
blobdf27f04c15de5de9bd9c7cc03983b973644c2df6
1 /***************************************************************************
2 platform.h - Platoform dependent utilities
3 -------------------
4 begin : Fri Sep 28 2007
5 copyright : (C) 2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef __PLATFORM_H__
19 #define __PLATFORM_H__
21 #include <stdio.h>
22 #include <inttypes.h>
24 /* map and unmap a file in memory. */
25 void *map_file(const char *file_name, uint32_t* size);
26 void unmap_file(void*addr, uint32_t size);
28 /* return the current time in centiseconds */
29 int current_time();
31 /* Initialize some information about stdin */
32 void init_stdin();
34 /* return if there is input available */
35 bool input_available();
37 /* execute and initialize another xboard engine (only for testing) */
38 bool start_engine(const char *prog, FILE **in, FILE **out);
40 /* get the cycle counter (only for profiling) */
41 inline uint64_t rdtsc()
43 uint64_t r;
44 asm volatile ("rdtsc\n\t" : "=A" (r));
45 return r;
48 #endif //__PLATFORM_H__