os_arch.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 _OS_ARCH_ARM_H
  20. #define _OS_ARCH_ARM_H
  21. #include <stdint.h>
  22. #include "syscfg/syscfg.h"
  23. #include "mcu/cmsis_nvic.h"
  24. #include "mcu/cortex_m4.h"
  25. #include <irq_ctrl.h>
  26. #include "mcu/mcu_sim.h"
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* CPU status register */
  31. typedef uint32_t os_sr_t;
  32. /* Stack element */
  33. typedef uint32_t os_stack_t;
  34. struct stack_frame;
  35. void os_arch_frame_init(struct stack_frame *sf);
  36. /* Stack sizes for common OS tasks */
  37. #define OS_SANITY_STACK_SIZE (2000)
  38. #if MYNEWT_VAL(OS_SYSVIEW)
  39. #define OS_IDLE_STACK_SIZE (80)
  40. #else
  41. #define OS_IDLE_STACK_SIZE (4000)
  42. #endif
  43. static inline int
  44. os_arch_in_isr(void)
  45. {
  46. return hw_irq_ctrl_get_irq_status();
  47. }
  48. /* Include common arch definitions and APIs */
  49. #include "os/arch/common.h"
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* _OS_ARCH_ARM_H */