Mbed Host Tests
__init__.py
Go to the documentation of this file.
1"""
2mbed SDK
3Copyright (c) 2011-2015 ARM Limited
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17Author: Przemyslaw Wirkus <Przemyslaw.Wirkus@arm.com>
18"""
19
20"""! @package mbed-host-test-plugins
21
22This package contains plugins used by host test to reset, flash devices etc.
23This package can be extended with new packages to add more generic functionality
24
25"""
26
27from . import host_test_registry
28
29# This plugins provide 'flashing' and 'reset' methods to host test scripts
30from . import module_copy_shell
31from . import module_copy_mbed
32from . import module_reset_mbed
33from . import module_power_cycle_mbed
34
35# Additional, non standard platforms
36from . import module_copy_silabs
37from . import module_reset_silabs
38from . import module_copy_stlink
39from . import module_reset_stlink
40from . import module_copy_ublox
41from . import module_reset_ublox
42from . import module_reset_mps2
43from . import module_copy_mps2
44#import module_copy_jn51xx
45#import module_reset_jn51xx
46
47
48# Plugin registry instance
49HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry()
50
51# Static plugin registration
52# Some plugins are commented out if they are not stable or not commonly used
53HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin())
54HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin())
55HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
56
57# Extra platforms support
58HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mps2.load_plugin())
59HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin())
60HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_silabs.load_plugin())
61HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
62HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_stlink.load_plugin())
63HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_stlink.load_plugin())
64HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_power_cycle_mbed.load_plugin())
65HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_ublox.load_plugin())
66HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_ublox.load_plugin())
67#HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_jn51xx.load_plugin())
68#HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_jn51xx.load_plugin())
69
70# TODO: extend plugin loading to files with name module_*.py loaded ad-hoc
71
72###############################################################################
73# Functional interface for host test plugin registry
74###############################################################################
75def call_plugin(type, capability, *args, **kwargs):
76 """! Interface to call plugin registry functional way
77 @param capability Plugin capability we want to call
78 @param args Additional parameters passed to plugin
79 @param kwargs Additional parameters passed to plugin
80 @return Returns return value from call_plugin call
81 """
82 return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
83
85 """! Get list of all capabilities for plugin family with the same type
86 @param type Type of a plugin
87 @return Returns list of all capabilities for plugin family with the same type. If there are no capabilities empty list is returned
88 """
89 return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type)
90
92 """! Return plugins information
93 @return Dictionary HOST_TEST_PLUGIN_REGISTRY
94 """
95 return HOST_TEST_PLUGIN_REGISTRY.get_dict()
96
98 """! Prints plugins' information in user friendly way
99 """
100 print(HOST_TEST_PLUGIN_REGISTRY)
def get_plugin_caps(type)
Get list of all capabilities for plugin family with the same type.
Definition: __init__.py:84
def get_plugin_info()
Return plugins information.
Definition: __init__.py:91
def print_plugin_info()
Prints plugins' information in user friendly way.
Definition: __init__.py:97