You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

module_reset_mps2.py 2.4KB

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