9 #ifndef __ewf_platform_bare_metal__h__included__ 
   10 #define __ewf_platform_bare_metal__h__included__ 
   14 #ifndef EWF_PLATFORM_BARE_METAL 
   15 #error EWF_PLATFORM_BARE_METAL must be defined before including this file 
   24 #ifndef EWF_PLATFORM_TICKS_PER_SECOND 
   26 #define EWF_PLATFORM_TICKS_PER_SECOND          (1000) 
   29 #ifndef EWF_PLATFORM_BUSY_WAIT 
   37 #define EWF_PLATFORM_BUSY_WAIT(count)       \ 
   39     static volatile uint32_t i, j, x;       \ 
   40     for (i = 0, x = 0; i < count; i++)      \ 
   41         for (j = 0; j < 1024; j++)          \ 
   46 #if defined(__CORTEX_M)  
   48 #define EWF_PLATFORM_INTERRUPT_DISABLE() __disable_irq() 
   49 #define EWF_PLATFORM_INTERRUPT_ENABLE() __enable_irq() 
   51 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE uint32_t 
   53 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE_GET() __get_PRIMASK() 
   54 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE_SET(state) __set_PRIMASK(state) 
   56 #elif defined(__IAR_SYSTEMS_ICC__)  
   58 #define EWF_PLATFORM_INTERRUPT_DISABLE() __disable_interrupt() 
   59 #define EWF_PLATFORM_INTERRUPT_ENABLE() __enable_interrupt() 
   61 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE __istate_t 
   63 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE_GET() __get_interrupt_state() 
   64 #define EWF_PLATFORM_INTERRUPT_STATE_TYPE_SET(state) __set_interrupt_state(state) 
   69 #error "Bare metal platform not implemented! (yet)" 
   77     volatile uint32_t queue_size;
 
   78     volatile uint32_t tail_index;
 
   79     volatile uint32_t used_count;
 
   89 #define EWF_PLATFORM_QUEUE_STATIC_DECLARE(queue_ptr, queue_name_symb, item_type, item_count)                                    \ 
   91 static uint8_t ewf_platform_queue__buffer__##queue_name_symb[sizeof(item_type) * item_count];                                   \ 
   92 static ewf_platform_queue ewf_platform_queue__##queue_name_symb = {0};                                                          \ 
   93 ewf_platform_queue__##queue_name_symb.data = ewf_platform_queue__buffer__##queue_name_symb;                                     \ 
   94 ewf_platform_queue__##queue_name_symb.item_size = sizeof(item_type);                                                            \ 
   95 ewf_platform_queue__##queue_name_symb.queue_size = item_count;                                                                  \ 
   96 ewf_platform_queue__##queue_name_symb.tail_index = 0;                                                                           \ 
   97 ewf_platform_queue__##queue_name_symb.used_count = 0;                                                                           \ 
   98 queue_ptr = &(ewf_platform_queue__##queue_name_symb);                                                                           \