1 /* This file contains functions that are hidden from the user. These are
2  * protocol specific functions used to read and write TRAX registers
3  * and the trace memory
4  */
5 
6 /*
7  * Copyright (c) 2012-2013 Tensilica Inc.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27  */
28 #ifndef _TRAX_PROTO_H
29 #define _TRAX_PROTO_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /* Function to read register
36  *
37  * regno	: The register number to be read (not ERI addressed)
38  * data		: Location where the read value is kept
39  *
40  * returns	: 0 if successful, -1 if unsuccessful
41  */
42 int trax_read_register_eri (int regno, unsigned *data);
43 
44 /* Function to write a value into a register
45  *
46  * regno	: The register number to be written (not ERI addressed)
47  * value	: The value to be written at that register location
48  *
49  * returns	: 0 if successful, -1 if unsuccessful
50  */
51 int trax_write_register_eri (int regno, unsigned value);
52 
53 /* Function to read memory
54  *
55  * address	: Address of the TraceRAM memory, each location has a word
56  * len		: Amount of memory in bytes, to be read
57  * data		: buffer in which the read memory is stored
58  * final_address: Next address to be read in the following call to this
59  * 		  function (trace save mechanism)
60  *
61  * returns	: 0 if successful, -1 if unsuccessful
62  */
63 int trax_read_memory_eri (unsigned address, int len, int *data,
64 			  unsigned *final_address);
65 
66 /* Function to write a value to the memory address
67  *
68  * address	: Address of the TraceRAM memory
69  * value	: The value to be written inside that location
70  *
71  * returns	: 0 if successful, -1 if unsuccessful
72  */
73 int trax_write_memory_eri (int address, unsigned value);
74 
75 /* Function to write to a  subfield of the register.
76  * Called by set and show parameter functions.
77  *
78  * regno	: Register number
79  * regmask	: Mask in order to toggle appropriate bits
80  * value	: Value to be written in the masked location
81  *
82  * returns	: 0 if successful, -1 if unsuccessful
83  */
84 int trax_write_register_field_eri (int regno, unsigned regmask,
85 				   unsigned value);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif
92