the other jimmy / mbed-sdk-tools

Fork of mbed-sdk-tools by mbed official

Committer:
The Other Jimmy
Date:
Wed Jan 04 11:58:24 2017 -0600
Revision:
32:8ea194f6145b
Parent:
0:66f3b5499f7f
Update tools to follow mbed-os tools release 5.3.1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:66f3b5499f7f 1 """
screamer 0:66f3b5499f7f 2 mbed SDK
screamer 0:66f3b5499f7f 3 Copyright (c) 2011-2013 ARM Limited
screamer 0:66f3b5499f7f 4
screamer 0:66f3b5499f7f 5 Licensed under the Apache License, Version 2.0 (the "License");
screamer 0:66f3b5499f7f 6 you may not use this file except in compliance with the License.
screamer 0:66f3b5499f7f 7 You may obtain a copy of the License at
screamer 0:66f3b5499f7f 8
screamer 0:66f3b5499f7f 9 http://www.apache.org/licenses/LICENSE-2.0
screamer 0:66f3b5499f7f 10
screamer 0:66f3b5499f7f 11 Unless required by applicable law or agreed to in writing, software
screamer 0:66f3b5499f7f 12 distributed under the License is distributed on an "AS IS" BASIS,
screamer 0:66f3b5499f7f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
screamer 0:66f3b5499f7f 14 See the License for the specific language governing permissions and
screamer 0:66f3b5499f7f 15 limitations under the License.
screamer 0:66f3b5499f7f 16 """
screamer 0:66f3b5499f7f 17
screamer 0:66f3b5499f7f 18 import host_test_registry
screamer 0:66f3b5499f7f 19
screamer 0:66f3b5499f7f 20 # This plugins provide 'flashing' methods to host test scripts
screamer 0:66f3b5499f7f 21 import module_copy_mbed
screamer 0:66f3b5499f7f 22 import module_copy_shell
screamer 0:66f3b5499f7f 23 import module_copy_silabs
screamer 0:66f3b5499f7f 24
screamer 0:66f3b5499f7f 25 try:
screamer 0:66f3b5499f7f 26 import module_copy_smart
screamer 0:66f3b5499f7f 27 except:
screamer 0:66f3b5499f7f 28 pass
screamer 0:66f3b5499f7f 29
screamer 0:66f3b5499f7f 30 #import module_copy_firefox
screamer 0:66f3b5499f7f 31 import module_copy_mps2
screamer 0:66f3b5499f7f 32
screamer 0:66f3b5499f7f 33 # Plugins used to reset certain platform
screamer 0:66f3b5499f7f 34 import module_reset_mbed
screamer 0:66f3b5499f7f 35 import module_reset_silabs
screamer 0:66f3b5499f7f 36 import module_reset_mps2
screamer 0:66f3b5499f7f 37
screamer 0:66f3b5499f7f 38
screamer 0:66f3b5499f7f 39 # Plugin registry instance
screamer 0:66f3b5499f7f 40 HOST_TEST_PLUGIN_REGISTRY = host_test_registry.HostTestRegistry()
screamer 0:66f3b5499f7f 41
screamer 0:66f3b5499f7f 42 # Static plugin registration
screamer 0:66f3b5499f7f 43 # Some plugins are commented out if they are not stable or not commonly used
screamer 0:66f3b5499f7f 44 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mbed.load_plugin())
screamer 0:66f3b5499f7f 45 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_shell.load_plugin())
screamer 0:66f3b5499f7f 46
screamer 0:66f3b5499f7f 47 try:
screamer 0:66f3b5499f7f 48 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_smart.load_plugin())
screamer 0:66f3b5499f7f 49 except:
screamer 0:66f3b5499f7f 50 pass
screamer 0:66f3b5499f7f 51
screamer 0:66f3b5499f7f 52 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mbed.load_plugin())
screamer 0:66f3b5499f7f 53 #HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_firefox.load_plugin())
screamer 0:66f3b5499f7f 54
screamer 0:66f3b5499f7f 55 # Extra platforms support
screamer 0:66f3b5499f7f 56 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_mps2.load_plugin())
screamer 0:66f3b5499f7f 57 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_mps2.load_plugin())
screamer 0:66f3b5499f7f 58 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_copy_silabs.load_plugin())
screamer 0:66f3b5499f7f 59 HOST_TEST_PLUGIN_REGISTRY.register_plugin(module_reset_silabs.load_plugin())
screamer 0:66f3b5499f7f 60
screamer 0:66f3b5499f7f 61 # TODO: extend plugin loading to files with name module_*.py loaded ad-hoc
screamer 0:66f3b5499f7f 62
screamer 0:66f3b5499f7f 63 ###############################################################################
screamer 0:66f3b5499f7f 64 # Functional interface for host test plugin registry
screamer 0:66f3b5499f7f 65 ###############################################################################
screamer 0:66f3b5499f7f 66 def call_plugin(type, capability, *args, **kwargs):
screamer 0:66f3b5499f7f 67 """ Interface to call plugin registry functional way
screamer 0:66f3b5499f7f 68 """
screamer 0:66f3b5499f7f 69 return HOST_TEST_PLUGIN_REGISTRY.call_plugin(type, capability, *args, **kwargs)
screamer 0:66f3b5499f7f 70
screamer 0:66f3b5499f7f 71 def get_plugin_caps(type):
screamer 0:66f3b5499f7f 72 """ Returns list of all capabilities for plugin family with the same type.
screamer 0:66f3b5499f7f 73 If there are no capabilities empty list is returned
screamer 0:66f3b5499f7f 74 """
screamer 0:66f3b5499f7f 75 return HOST_TEST_PLUGIN_REGISTRY.get_plugin_caps(type)
screamer 0:66f3b5499f7f 76
screamer 0:66f3b5499f7f 77 def print_plugin_info():
screamer 0:66f3b5499f7f 78 """ Prints plugins' information in user friendly way
screamer 0:66f3b5499f7f 79 """
screamer 0:66f3b5499f7f 80 print HOST_TEST_PLUGIN_REGISTRY