⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tx_el.c

📁 threadx嵌入式实时操作系统源代码
💻 C
📖 第 1 页 / 共 4 页
字号:

    /* Store the lower time stamp.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =
                                (ULONG) _tx_el_fake_time_stamp++;

    /* Store the current thread.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =
                                (ULONG) thread_ptr;

    /* Now move the current event log pointer.  */
    entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;

    /* Check for a wrap-around condition.  */
    if (entry_ptr >= _tx_el_event_area_end)
    {

        /* Yes, we have wrapped around to the end of the event area.  
           Start back at the top!  */
        entry_ptr =  _tx_el_event_area_start;
    }

    /* Write the entry pointer back into the header.  */
    *_tx_el_current_event =  entry_ptr;

    TX_EL_END_FILTER
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _tx_el_thread_preempted                          68332/Green Hills  */ 
/*                                                           3.0a         */ 
/*  AUTHOR                                                                */ 
/*                                                                        */ 
/*    William E. Lamie, Express Logic, Inc.                               */ 
/*                                                                        */ 
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function inserts a thread preempted event into the event       */
/*    log, which indicates that an interrupt occurred that made a higher  */
/*    priority thread ready for execution.  In this case, the previously  */
/*    executing thread has an event entered to indicate it is no longer   */
/*    running.                                                            */
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    thread_ptr                            Pointer to thread being       */
/*                                            scheduled                   */
/*                                                                        */
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    _tx_thread_context_restore            ThreadX context restore       */ 
/*                                                                        */ 
/*  RELEASE HISTORY                                                       */ 
/*                                                                        */ 
/*    DATE              NAME                      DESCRIPTION             */ 
/*                                                                        */ 
/*  12-02-1999     William E. Lamie         Initial Version 3.0a          */ 
/*                                                                        */ 
/**************************************************************************/ 
VOID  _tx_el_thread_preempted(TX_THREAD *thread_ptr)
{

UINT    upper_tb;
UCHAR   *entry_ptr;


    TX_EL_NO_STATUS_EVENTS 

    /* Increment total event counter.  */
    _tx_el_total_events++;

    /* Setup working entry pointer first.  */
    entry_ptr =  *_tx_el_current_event;

    /* Store the event type and sub-type.  */
    *((unsigned short *) entry_ptr) =  TX_EL_THREAD_STATUS_CHANGE;
    *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) TX_READY;

    /* Store the upper time stamp.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) =
                                (ULONG) 0;

    /* Store the lower time stamp.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =
                                (ULONG) _tx_el_fake_time_stamp++;

    /* Store the current thread.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =
                                (ULONG) _tx_thread_current_ptr;

    /* Now move the current event log pointer.  */
    entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;

    /* Check for a wrap-around condition.  */
    if (entry_ptr >= _tx_el_event_area_end)
    {

        /* Yes, we have wrapped around to the end of the event area.  
           Start back at the top!  */
        entry_ptr =  _tx_el_event_area_start;
    }

    /* Write the entry pointer back into the header.  */
    *_tx_el_current_event =  entry_ptr;

    TX_EL_END_FILTER
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _tx_el_interrupt                                 68332/Green Hills  */ 
/*                                                           3.0a         */ 
/*  AUTHOR                                                                */ 
/*                                                                        */ 
/*    William E. Lamie, Express Logic, Inc.                               */ 
/*                                                                        */ 
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function inserts an interrupt event into the log, which        */
/*    indicates the start of interrupt processing for the specific        */
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    interrupt_number                      Interrupt number supplied by  */
/*                                            ISR                         */
/*                                                                        */
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    ISR processing                                                      */ 
/*                                                                        */ 
/*  RELEASE HISTORY                                                       */ 
/*                                                                        */ 
/*    DATE              NAME                      DESCRIPTION             */ 
/*                                                                        */ 
/*  12-02-1999     William E. Lamie         Initial Version 3.0a          */ 
/*                                                                        */ 
/**************************************************************************/ 
VOID  _tx_el_interrupt(UINT interrupt_number)
{

UINT    upper_tb;
UCHAR   *entry_ptr;


    TX_EL_NO_INTERRUPT_EVENTS 

    /* Increment total event counter.  */
    _tx_el_total_events++;

    /* Setup working entry pointer first.  */
    entry_ptr =  *_tx_el_current_event;

    /* Store the event type and sub-type.  */
    *((unsigned short *) entry_ptr) =  TX_EL_INTERRUPT;
    *((unsigned short *) (entry_ptr + TX_EL_EVENT_SUBTYPE_OFFSET)) = (unsigned short) TX_EL_INTERRUPT_SUB_TYPE;

    /* Store the upper time stamp.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_UPPER_OFFSET)) =
                                (ULONG) 0;

    /* Store the lower time stamp.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_TIME_LOWER_OFFSET)) =
                                (ULONG) _tx_el_fake_time_stamp++;

    /* Store the current thread.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_THREAD_OFFSET)) =
                                (ULONG) _tx_thread_current_ptr;

    /* Store the first info word.  */
    *((ULONG *) (entry_ptr + TX_EL_EVENT_INFO_1_OFFSET)) =
                                (ULONG) interrupt_number;

    /* Now move the current event log pointer.  */
    entry_ptr =  entry_ptr + TX_EL_EVENT_SIZE;

    /* Check for a wrap-around condition.  */
    if (entry_ptr >= _tx_el_event_area_end)
    {

        /* Yes, we have wrapped around to the end of the event area.  
           Start back at the top!  */
        entry_ptr =  _tx_el_event_area_start;
    }

    /* Write the entry pointer back into the header.  */
    *_tx_el_current_event =  entry_ptr;

    TX_EL_END_FILTER
}


/**************************************************************************/ 
/*                                                                        */ 
/*  FUNCTION                                               RELEASE        */ 
/*                                                                        */ 
/*    _tx_el_interrupt_end                             68332/Green Hills  */ 
/*                                                           3.0a         */ 
/*  AUTHOR                                                                */ 
/*                                                                        */ 
/*    William E. Lamie, Express Logic, Inc.                               */ 
/*                                                                        */ 
/*  DESCRIPTION                                                           */ 
/*                                                                        */ 
/*    This function inserts an interrupt end event into the log, which    */
/*    indicates the end of interrupt processing for the specific          */
/*                                                                        */ 
/*  INPUT                                                                 */ 
/*                                                                        */ 
/*    interrupt_number                      Interrupt number supplied by  */
/*                                            ISR                         */
/*                                                                        */
/*  OUTPUT                                                                */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLS                                                                 */ 
/*                                                                        */ 
/*    None                                                                */ 
/*                                                                        */ 
/*  CALLED BY                                                             */ 
/*                                                                        */ 
/*    ISR processing                                                      */ 
/*                                                                        */ 
/*  RELEASE HISTORY                                                       */ 
/*                                                                        */ 
/*    DATE              NAME                      DESCRIPTION             */ 
/*                                                                        */ 
/*  12-02-1999     William E. Lamie         Initial Version 3.0a          */ 
/*                                                                        */ 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -