sim.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. #ifndef H_KERNEL_SIM_
  20. #define H_KERNEL_SIM_
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #include <stdio.h>
  25. #include <setjmp.h>
  26. #include "os/mynewt.h"
  27. #include "mcu/mcu_sim.h"
  28. struct os_task;
  29. struct stack_frame;
  30. struct stack_frame {
  31. int sf_mainsp; /* stack on which main() is executing */
  32. sigjmp_buf sf_jb;
  33. struct os_task *sf_task;
  34. };
  35. void sim_task_start(struct stack_frame *sf, int rc);
  36. os_stack_t *sim_task_stack_init(struct os_task *t, os_stack_t *stack_top,
  37. int size);
  38. os_error_t sim_os_start(void);
  39. void sim_os_stop(void);
  40. os_error_t sim_os_init(void);
  41. void sim_ctx_sw(struct os_task *next_t);
  42. os_sr_t sim_save_sr(void);
  43. void sim_restore_sr(os_sr_t osr);
  44. int sim_in_critical(void);
  45. void sim_tick_idle(os_time_t ticks);
  46. int sig_block_irq_on();
  47. void sig_unblock_irq_off();
  48. uint8_t inner_main_clean_up(int exit_code);
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif