Project

General

Profile

Plugins Python API » History » Version 14

Alexis Jeandet, 21/09/2015 03:29 PM

1 1 Alexis Jeandet
h1. Plugins Python API
2
3
All SocExplorer plugins expose some common functions and their own functions to the embedded Python terminal.
4
5
h2. Common Functions
6
7
All this functions are either implemented in the base class *socexplorerplugin* or in the plugin itself.
8
9
Function list:
10 2 Alexis Jeandet
* %{color:green}QVariantList% *[[Plugins_Python_API#Read|Read]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count);
11
* %{color:blue}void% *[[Plugins_Python_API#Write|Write]]* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList);
12
* %{color:blue}void% *[[Plugins_Python_API#closeMe|closeMe]]* ();
13
* %{color:blue}void% *[[Plugins_Python_API#activate|activate]]* (%{color:green}bool% flag);
14
* %{color:blue}void% *[[Plugins_Python_API#setInstanceName|setInstanceName]]* (%{color:green}const QString% & newName);
15
* %{color:green}bool%  *[[Plugins_Python_API#dumpMemory|dumpMemory]]*  (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file);
16
* %{color:green}bool%  *[[Plugins_Python_API#memSet|memSet]]* (%{color:green}unsigned int% address, %{color:green}int% value, %{color:green}unsigned int% count);
17
* %{color:green}bool%  *[[Plugins_Python_API#loadbin|loadbin]]*  (%{color:green}unsigned int% address, %{color:green}QString% file);
18
* %{color:green}bool%  *[[Plugins_Python_API#loadfile|loadfile]]*  (%{color:green}abstractBinFile% * file);
19
* %{color:green}bool%  *[[Plugins_Python_API#dumpMemory|dumpMemory]]*  (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file, %{color:green}const QString% & format);
20 1 Alexis Jeandet
21 5 Alexis Jeandet
----
22
23
----
24
25 2 Alexis Jeandet
h2(#Read). %{color:green}QVariantList% *Read* (%{color:green}unsigned int% address, %{color:green}unsigned int% count) 
26 1 Alexis Jeandet
27 4 Alexis Jeandet
Reads target memory at given address and return its content. On any root plugin it will read system memory and by default on child plugin it will forward request to parent plugin util it reach root plugin and read system bus. 
28 1 Alexis Jeandet
Note that this function could be re-implemented on a child plugin and have a different behavior.
29 4 Alexis Jeandet
30
The returned list is a *Word* list which means that the smallest data you can read is a word(32 bits) and *count* is the number of words to read. The function respect host endianness so it will convert data depending on target endianness.
31
32 7 Alexis Jeandet
*See also*  %{color:blue}void% *[[Plugins_Python_API#Write|Write]]* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList);
33 3 Alexis Jeandet
34 9 Alexis Jeandet
----
35
36 2 Alexis Jeandet
h2(#Write). %{color:blue}void% *Write* (%{color:green}unsigned int% address, %{color:green}QList<QVariant>% dataList)
37
38 8 Alexis Jeandet
Writes given *datalist* at given *address* in target system bus. On any root plugin it will writes system memory and by default on child plugin it will forward request to parent plugin util it reach root plugin and writes system bus. 
39
Note that this function could be re-implemented on a child plugin and have a different behavior.
40
The given list is a Word list which means that the smallest data you can write is a word(32 bits). The function respect host endianness so it will convert data depending on target endianness.
41
42 10 Alexis Jeandet
Example:
43
44
Let's consider we have a Leon3 with some RAM at 0x40000000 and we want to write 1 2 3 and 0xffffffff. We are connected to the target through *rootplugin* which can be replaced by the plugin are using.
45
46
<pre><code class="python">
47
  rootplugin.Write(0x40000000,[1,2,3,0xffffffff])
48
</code></pre>
49
50 8 Alexis Jeandet
See also %{color:green}QVariantList% *[[Plugins_Python_API#Read|Read]]* (%{color:green}unsigned int% address, %{color:green}unsigned int% count);
51
52 9 Alexis Jeandet
----
53
54 2 Alexis Jeandet
h2(#closeMe). %{color:blue}void% *closeMe* ()
55
56 11 Alexis Jeandet
Closes the plugin.
57
58 9 Alexis Jeandet
----
59
60 2 Alexis Jeandet
h2(#activate). %{color:blue}void% *activate* (%{color:green}bool% flag)
61
62 13 Alexis Jeandet
Activates the plugin GUI, this function is called by *SocExplorer* you may not call this function unless you know exactly what you do. By default if the plugin GUI is disabled, it means that the root plugin isn't connected to the target and that any operation on child plugin are forbidden.
63 12 Alexis Jeandet
64 9 Alexis Jeandet
----
65
66 2 Alexis Jeandet
h2(#setInstanceName). %{color:blue}void% *setInstanceName* (%{color:green}const QString% & newName)
67
68 14 Alexis Jeandet
This method will be removed from python context since it may not be used from python terminal.
69
70 9 Alexis Jeandet
----
71
72 2 Alexis Jeandet
h2(#dumpMemory). %{color:green}bool%  *dumpMemory*  (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file)
73
74 9 Alexis Jeandet
----
75
76 2 Alexis Jeandet
h2(#memSet). %{color:green}bool%  *memSet* (%{color:green}unsigned int% address, %{color:green}int% value, %{color:green}unsigned int% count)
77
78 9 Alexis Jeandet
----
79
80 2 Alexis Jeandet
h2(#loadbin). %{color:green}bool%  *loadbin*  (%{color:green}unsigned int% address, %{color:green}QString% file)
81
82 9 Alexis Jeandet
----
83
84 2 Alexis Jeandet
h2(#loadfile). %{color:green}bool%  *loadfile*  (%{color:green}abstractBinFile% * file)
85
86 9 Alexis Jeandet
----
87
88 2 Alexis Jeandet
h2(#dumpMemory). %{color:green}bool%  *dumpMemory*  (%{color:green}unsigned int% address, %{color:green}unsigned int% count, %{color:green}QString% file, %{color:green}const QString% & format)
89 9 Alexis Jeandet
90
----