1 /* This file contains utility functions that can be used for polling TRAX
2  * or executing higher level save functionality
3  * It assumes that print subroutines and file I/O routines are available
4  * on the system
5  */
6 
7 /*
8  * Copyright (c) 2012-2013 Tensilica Inc.
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 
30 #ifndef _TRAX_UTIL_H
31 #define _TRAX_UTIL_H
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /* User can use this function if he wants to generate a tracefile output.
39  * Internally it calls trax_get_trace in a loop until it realizes that
40  * the entire trace has been read.
41  *
42  * context	: pointer to structure which contains information about the
43  * 		  current TRAX session
44  * filename	: user specified output trace file name. If the file does not
45  * 		  exist, it would create the new file, else would append to it
46  *
47  * returns      : 0 if successful, -1 if unsuccessful
48  */
49 int trax_save (trax_context *context, char *filename);
50 
51 /* Displays a brief machine readable status.
52  *
53  * context	: pointer to structure which contains information about the
54  * 		  current TRAX session
55  * returns      : 0 if successful, -1 if unsuccessful
56  */
57 int trax_poll (trax_context *context);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif
64