45 #ifndef _TN_ARCH_PIC24_H 46 #define _TN_ARCH_PIC24_H 54 #include "../../core/tn_common_macros.h" 55 #include "../../core/tn_cfg_dispatch.h" 72 #ifndef DOXYGEN_SHOULD_SKIP_THIS 74 #define _TN_PIC24_INTSAVE_DATA_INVALID 0xffff 77 # define _TN_PIC24_INTSAVE_CHECK() \ 79 if (TN_INTSAVE_VAR == _TN_PIC24_INTSAVE_DATA_INVALID){ \ 80 _TN_FATAL_ERROR(""); \ 84 # define _TN_PIC24_INTSAVE_CHECK() 93 #define _TN_FFS(x) _tn_p24_ffs_asm(x) 94 int _tn_p24_ffs_asm(
int x);
103 #define _TN_FATAL_ERRORF(error_msg, ...) \ 104 {__asm__ volatile(".pword 0xDA4000"); __asm__ volatile ("nop");} 130 #if defined (__C30__) 131 # define TN_ARCH_STK_ATTR_BEFORE 132 # define TN_ARCH_STK_ATTR_AFTER 134 # error "Unknown compiler" 141 #define TN_MIN_STACK_SIZE (25 \ 142 + _TN_EDS_STACK_ADD \ 143 + _TN_STACK_OVERFLOW_SIZE_ADD \ 152 # define _TN_EDS_STACK_ADD 1 154 # define _TN_EDS_STACK_ADD 0 161 #define TN_INT_WIDTH 16 183 #define TN_PRIORITIES_MAX_CNT TN_INT_WIDTH 189 #define TN_WAIT_INFINITE (TN_TickCnt)0xFFFFFFFF 194 #define TN_FILL_STACK_VAL 0xFEED 202 #define TN_INTSAVE_VAR tn_save_status_reg 216 #define TN_INTSAVE_DATA \ 217 TN_UWord TN_INTSAVE_VAR = _TN_PIC24_INTSAVE_DATA_INVALID; 226 #define TN_INTSAVE_DATA_INT TN_INTSAVE_DATA 254 # define TN_INT_DIS_SAVE() TN_INTSAVE_VAR = tn_arch_sr_save_int_dis() 255 # define TN_INT_RESTORE() _TN_PIC24_INTSAVE_CHECK(); \ 256 tn_arch_sr_restore(TN_INTSAVE_VAR) 265 #define TN_INT_IDIS_SAVE() TN_INT_DIS_SAVE() 274 #define TN_INT_IRESTORE() TN_INT_RESTORE() 279 #define TN_IS_INT_DISABLED() (_tn_arch_is_int_disabled()) 284 #define _TN_CONTEXT_SWITCH_IPEND_IF_NEEDED() \ 285 _tn_context_switch_pend_if_needed() 292 #define _TN_SIZE_BYTES_TO_UWORDS(size_in_bytes) ((size_in_bytes) >> 1) 295 # define _TN_INLINE inline __attribute__ ((always_inline)) 297 # define _TN_INLINE inline 300 #define _TN_STATIC_INLINE static _TN_INLINE 302 #define _TN_VOLATILE_WORKAROUND 320 # define _TN_SOFT_ISR_PRIORITY_CHECK() \ 322 " mov #0xE0, W0 \n" \ 323 " and _SR, WREG \n" \ 324 " lsr W0, #5, W0 \n" \ 325 " cp W0, #" _TN_STRINGIFY_MACRO(TN_P24_SYS_IPL) " \n" \ 329 " .pword 0xDA4000 \n" \ 335 # define _TN_SOFT_ISR_PRIORITY_CHECK() 339 #define _TN_SOFT_ISR_PROLOGUE \ 349 _TN_SOFT_ISR_PRIORITY_CHECK() \ 360 " mov __tn_p24_int_splim, w0; \n" \ 366 " mov SPLIM, w1; \n" \ 367 " mov w0, SPLIM; \n" \ 369 " mov __tn_p24_int_stack_low_addr, w15; \n" \ 388 #define _TN_SOFT_ISR_CALL \ 394 #define _TN_SOFT_ISR_EPILOGUE \ 402 " mov w1, SPLIM; \n" \ 418 " mov.b w0, [w15-1]; \n" \ 426 #define _tn_soft_isr_internal(_func, _psv, _shadow) \ 427 void __attribute__(( \ 430 _TN_SOFT_ISR_PROLOGUE \ 432 _TN_SOFT_ISR_EPILOGUE \ 443 #define _TN_ARCH_STACK_PT_TYPE _TN_ARCH_STACK_PT_TYPE__EMPTY 444 #define _TN_ARCH_STACK_DIR _TN_ARCH_STACK_DIR__ASC 446 #endif //-- DOXYGEN_SHOULD_SKIP_THIS 484 #define tn_p24_soft_isr(_func, _psv) _tn_soft_isr_internal(_func, _psv, ) 493 #endif // _TN_ARCH_PIC24_H unsigned int TN_UIntPtr
Unsigned integer type that is able to store pointers.
Atomic bit-field access macros for PIC24/dsPIC.
unsigned int TN_UWord
Unsigned integer type whose size is equal to the size of CPU register.