]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/workspace_tools/host_tests/host_tests_plugins/module_reset_mps2.py
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / workspace_tools / host_tests / host_tests_plugins / module_reset_mps2.py
1 """
2 mbed SDK
3 Copyright (c) 2011-2013 ARM Limited
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 """
17
18 import os
19 from host_test_plugins import HostTestPluginBase
20
21 # Note: This plugin is not fully functional, needs improvements
22
23 class HostTestPluginResetMethod_MPS2(HostTestPluginBase):
24 """ Plugin used to reset ARM_MPS2 platform
25 Supports:
26 reboot.txt - startup from standby state, reboots when in run mode.
27 shutdown.txt - shutdown from run mode.
28 reset.txt - reset FPGA during run mode.
29 """
30 def touch_file(self, path):
31 """ Touch file and set timestamp to items
32 """
33 with open(path, 'a'):
34 os.utime(path, None)
35
36 # Plugin interface
37 name = 'HostTestPluginResetMethod_MPS2'
38 type = 'ResetMethod'
39 capabilities = ['reboot.txt', 'shutdown.txt', 'reset.txt']
40 required_parameters = ['disk']
41
42 def setup(self, *args, **kwargs):
43 """ Prepare / configure plugin to work.
44 This method can receive plugin specific parameters by kwargs and
45 ignore other parameters which may affect other plugins.
46 """
47 return True
48
49 def execute(self, capabilitity, *args, **kwargs):
50 """ Executes capability by name.
51 Each capability may directly just call some command line
52 program or execute building pythonic function
53 """
54 result = False
55 if self.check_parameters(capabilitity, *args, **kwargs) is True:
56
57 if capabilitity == 'reboot.txt':
58 # TODO: Implement touch file for reboot
59 pass
60
61 elif capabilitity == 'shutdown.txt':
62 # TODO: Implement touch file for shutdown
63 pass
64
65 elif capabilitity == 'reset.txt':
66 # TODO: Implement touch file for reset
67 pass
68
69 return result
70
71 def load_plugin():
72 """ Returns plugin available in this module
73 """
74 return HostTestPluginResetMethod_MPS2()
Imprint / Impressum