3Copyright (c) 2011-2015 ARM Limited
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
9 http://www.apache.org/licenses/LICENSE-2.0
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.
17Author: Przemyslaw Wirkus <Przemyslaw.Wirkus
@arm.com>
20"""!
@package mbed-host-test-plugins
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
27from . import host_test_registry
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
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
48# Plugin registry instance
49HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry()
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())
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())
70# TODO: extend plugin loading to files with name module_*.py loaded ad-hoc
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
82 return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
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
89 return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type)
92 """! Return plugins information
93 @return Dictionary HOST_TEST_PLUGIN_REGISTRY
95 return HOST_TEST_PLUGIN_REGISTRY.get_dict()
98 """! Prints plugins' information in user friendly way
100 print(HOST_TEST_PLUGIN_REGISTRY)
def get_plugin_caps(type)
Get list of all capabilities for plugin family with the same type.
def get_plugin_info()
Return plugins information.
def print_plugin_info()
Prints plugins' information in user friendly way.