void _klog_isr_start_internal ( _mqx_uint vector_number ) { /* Body */ KERNEL_DATA_STRUCT_PTR kernel_data; _GET_KERNEL_DATA(kernel_data); if (kernel_data->KERNEL_COMPONENTS[KERNEL_LWLOG]) { if (kernel_data->LOG_CONTROL & KLOG_INTERRUPTS_ENABLED) { if (!(kernel_data->LOG_CONTROL & KLOG_SYSTEM_CLOCK_INT_ENABLED)) { /* Check to see if the vector number is to be ignored */ if (vector_number == kernel_data->SYSTEM_CLOCK_INT_NUMBER) { return; } /* Endif */ } /* Endif */ _lwlog_write_internal(LOG_KERNEL_LOG_NUMBER, (_mqx_max_type)KLOG_INTERRUPT, (_mqx_max_type)vector_number, (_mqx_max_type)_int_get_isr(vector_number), (_mqx_max_type)_int_get_isr_data(vector_number), (_mqx_max_type)0, (_mqx_max_type)0, (_mqx_max_type)0); } /* Endif */ } /* Endif */ } /* Endbody */
void _klog_yield_internal ( void ) { /* Body */ KERNEL_DATA_STRUCT_PTR kernel_data; TD_STRUCT_PTR td_ptr; _GET_KERNEL_DATA(kernel_data); if ( kernel_data->LOG_CONTROL & KLOG_TASK_QUALIFIED ) { if (! (kernel_data->ACTIVE_PTR->FLAGS & TASK_LOGGING_ENABLED) ) { return; } /* Endif */ } /* Endif */ if (kernel_data->LOG_CONTROL & KLOG_FUNCTIONS_ENABLED) { if ((KLOG_sched_yield & KLOG_FUNCTION_MASK) & kernel_data->LOG_CONTROL) { if (kernel_data->KERNEL_COMPONENTS[KERNEL_LWLOG]) { td_ptr = kernel_data->ACTIVE_PTR; _lwlog_write_internal(LOG_KERNEL_LOG_NUMBER, (_mqx_max_type)KLOG_FUNCTION_ENTRY, (_mqx_max_type)KLOG_sched_yield, (_mqx_max_type)td_ptr, (_mqx_max_type)td_ptr->TASK_ID, (_mqx_max_type)td_ptr->STATE, (_mqx_max_type)td_ptr->STACK_PTR, (_mqx_max_type)0); } /* Endif */ } /* Endif */ } /* Endif */ } /* Endbody */
void _klog_context_switch_internal ( void ) { /* Body */ KERNEL_DATA_STRUCT_PTR kernel_data; TD_STRUCT_PTR td_ptr; _GET_KERNEL_DATA(kernel_data); /* Start CR 914 */ #if 0 if ( kernel_data->LOG_CONTROL & KLOG_TASK_QUALIFIED ) { if (! (kernel_data->ACTIVE_PTR->FLAGS & TASK_LOGGING_ENABLED) ) { return; } /* Endif */ } /* Endif */ #endif /* End CR 914 */ if (kernel_data->LOG_CONTROL & KLOG_CONTEXT_ENABLED) { if (kernel_data->ACTIVE_PTR != kernel_data->LOG_OLD_TD) { if (kernel_data->KERNEL_COMPONENTS[KERNEL_LWLOG]) { kernel_data->LOG_OLD_TD = kernel_data->ACTIVE_PTR; /* Start CR 914 */ if ( kernel_data->LOG_CONTROL & KLOG_TASK_QUALIFIED ) { if (! (kernel_data->ACTIVE_PTR->FLAGS & TASK_LOGGING_ENABLED) ) { return; } /* Endif */ } /* Endif */ /* End CR 914 */ td_ptr = kernel_data->ACTIVE_PTR; _lwlog_write_internal(LOG_KERNEL_LOG_NUMBER, (_mqx_max_type)KLOG_CONTEXT_SWITCH, (_mqx_max_type)td_ptr, (_mqx_max_type)td_ptr->TASK_ID, (_mqx_max_type)td_ptr->STATE, (_mqx_max_type)td_ptr->STACK_PTR, (_mqx_max_type)0, (_mqx_max_type)0); } /* Endif */ } /* Endif */ } /* Endif */ } /* Endbody */
/*! * \brief Writes to the lightweight log. * * This function writes the log entry only if it returns MQX_OK. * * \param[in] log_number Log number of a previously created lightweight log. * \param[in] p1 Data to be written to the log entry. If log_number is 0 * and p1 is >= 10 (0 through 9 are reserved for MQX), data specified by p2 through * p7 is written to kernel log. * \param[in] p2 Data to be written into the log entry. * \param[in] p3 Data to be written into the log entry. * \param[in] p4 Data to be written into the log entry. * \param[in] p5 Data to be written into the log entry. * \param[in] p6 Data to be written into the log entry. * \param[in] p7 Data to be written into the log entry. * * \return MQX_OK * \return LOG_FULL (Log is full and LOG_OVERWRITE is not set.) * \return LOG_DISABLED (Log is disabled.) * \return LOG_INVALID (Log_number is out of range.) * \return LOG_DOES_NOT_EXIST (Log_number was not created.) * \return MQX_INVALID_COMPONENT_HANDLE (Log component data is not valid.) * \return MQX_COMPONENT_DOES_NOT_EXIST (Log component is not created.) * * \see _lwlog_create * \see _lwlog_create_at * \see _lwlog_read * \see _lwlog_disable * \see _lwlog_enable */ _mqx_uint _lwlog_write ( _mqx_uint log_number, _mqx_max_type p1, _mqx_max_type p2, _mqx_max_type p3, _mqx_max_type p4, _mqx_max_type p5, _mqx_max_type p6, _mqx_max_type p7 ) { /* Body */ KERNEL_DATA_STRUCT_PTR kernel_data; _mqx_uint result; _GET_KERNEL_DATA(kernel_data); #if MQX_CHECK_ERRORS if (log_number >= LOG_MAXIMUM_NUMBER) { return (LOG_INVALID); } /* Endif */ if (kernel_data->KERNEL_COMPONENTS[KERNEL_LWLOG] == NULL) { return (MQX_COMPONENT_DOES_NOT_EXIST); } /* Endif */ #endif _INT_DISABLE(); result = _lwlog_write_internal(log_number, p1, p2, p3, p4, p5, p6, p7); _INT_ENABLE(); return (result); } /* Endbody */