📄 system_messages.c
字号:
/*
** Copyright (C) 2006 Tamir Michael
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "system_messages.h"
static error_code_to_string_map s_error_map[] =
{
{ERR_SYSTEM_CALL_AT_INTERRUPT_CONTEXT, "The kernel is not reentrant. System calls from interrupt context are prohibited."},
{ERR_MUTEX_NOT_FOUND, "Invalid mutex id."},
{ERR_TIMER_NOT_FOUND, "Invalid timer id."},
{ERR_FAILED_TO_CREATE_TASK, "Task creation failed."},
{ERR_FAILED_TO_CREATE_IDLE_TASK, "Idle task creation failed."},
{ERR_FAILED_TO_CREATE_PERFORMANCE_TASK, "Performance task creation failed."},
{ERR_QUEUE_FULL, "Queue full."},
{ERR_QUEUE_EMPTY, "Queue empty."},
{ERR_INVALID_PARAMETER, "Invalid parameter."},
{ERR_TASK_NOT_FOUND, "Invalid task id."},
{ERR_TASK_HAS_LOCKS, "Task has locks. Operation aborted."},
{ERR_MUTEX_LOCKED, "Mutex locked. Operation aborted."},
{ERR_SEMAPHORE_LOCKED, "Semaphore locked. Operation aborted."},
{ERR_MAX_TASKS_ALLOCATED, "The maximum number of tasks has been allocated. Failed to create task."},
{ERR_MAX_MUTEXES_ALLOCATED, "The maximum number of mutexes has been allocated. Failed to create mutex."},
{ERR_MAX_SEMAPHORES_ALLOCATED, "The maximum number of semaphores has been allocated. Failed to create semaphore."},
{ERR_INVALID_STACK_PARAMETER, "A null stack pointer has been provided. Failed to create task."},
{ERR_MINIMUM_STACK_SIZE_VIOLATION, "Failed to create task. The minimum size of a task stack is"},
{ERR_MAXIMUM_STACK_SIZE_VIOLATION, "Failed to create task. The maximum size of a task stack is"},
{ERR_BAD_INITIAL_TASK_STATE, "The initial state of a task must be either 'eTaskRunning' or 'eTaskSuspended'."},
{ERR_ITEM_NOT_FOUND, "Search item not found."},
{ERR_FEATURE_NOT_IMPLEMENTED, "Feature not implemented."},
{ERR_STACK_ALREADY_IN_USE, "Tasks cannot share the same stack buffer. Task creation failed."},
{ERR_SEMAPHORE_NOT_FOUND, "Invalid semaphore id."},
{ERR_MSG_WAIT_TIMEOUT_ELAPSED, "Prespecified timeout has elapsed."},
{ERR_TASK_IS_BLOCKED, "Task is blocked on a synchronization primitive."},
{ERR_INVALID_TASK_PRIORITY, "Invalid task priority."},
{ERR_IDLE_TASK_CANNOT_START, "The idle task failed to start."},
{ERR_STKOF_TRAP, "Stack overflow."},
{ERR_STKUF_TRAP, "Stack underflow."},
{ERR_NMI_TRAP, "NMI trap."},
{ERR_CANNOT_RESCHEDULE_INTERRUPTS_DISABLED, "Kernel execution flow compromized because a task reschedule was attempted while interrupts were disabled."},
{ERR_TASK_CANNOT_DELETE_ITSELF, "A task cannot delete itself."},
{ERR_DEADLOCK_RISK, "An operation has been executed that might cause a deadlock."},
{ERR_INVALID_INTERRUPT_VECTOR, "The interrupt vector does not exist and thus cannot be waited for."},
{ERR_INVALID_SCHEDULING_POLICY, "Invalid scheduling policy specified"},
{ERR_INTERRUPT_VECTOR_IN_USE, "Wait failed. The following task is waiting for this interrupt:"},
{ERR_TASK_CANNOT_BE_WOKEN, "The task is not eTaskWaiting, eTaskWaitingForMessage, eTaskWaitingForInterrupt."},
{ERR_TRACE_BUFFER_INVALID_SIZE, "The size of the trace buffer must be a power of 2"},
{ERR_TRACE_BUFFER_INVALID_CODE, "This action code cannot be added to the trace buffer:"},
{ERR_CANNOT_TAKE_TASK_SNAPSHOT, "Snapshot failed. task stack size must be DEFUALT_STACK_SIZE * sizeof(int16u) bytes or less."},
{ERR_SNAPSHOT_TASK_IS_BLOCKED_ON_SYNCH, "Snapshot cannot be restored. EOS cannot revoke a task's mutex/semaphore lock."},
{ERR_INVALID_TASK_STATE, "Internal error: task has an invalid state."},
{ERR_STACK_SPACE_LOW, "The system stack space is lower than the specified threshold."},
{ERR_STACK_SPACE_OUT, "The system stack was overrun."},
{LAST_ENTRY, "No such error found."}
} ;
const char *resolve_system_message(error_code err_code)
{
int16s l_index = 0 ;
while ( s_error_map[l_index].err_code != LAST_ENTRY)
{
if (s_error_map[l_index].err_code == err_code)
{
return s_error_map[l_index].error_message ;
}
l_index++ ;
}
return 0 ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -