📄 system_messages.h
字号:
/*
** 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.
*/
#ifndef _ERROR_CODES
#define _ERROR_CODES
#include "general_definitions.h"
// error codes are always negative numbers
typedef enum
{
ERR_SYSTEM_CALL_AT_INTERRUPT_CONTEXT = -100,
ERR_MUTEX_NOT_FOUND,
ERR_TIMER_NOT_FOUND,
ERR_FAILED_TO_CREATE_TASK,
ERR_FAILED_TO_CREATE_IDLE_TASK,
ERR_FAILED_TO_CREATE_PERFORMANCE_TASK,
ERR_QUEUE_FULL,
ERR_QUEUE_EMPTY,
ERR_INVALID_PARAMETER,
ERR_TASK_NOT_FOUND,
ERR_TASK_HAS_LOCKS,
ERR_MUTEX_LOCKED,
ERR_SEMAPHORE_LOCKED,
ERR_MAX_TASKS_ALLOCATED,
ERR_MAX_MUTEXES_ALLOCATED,
ERR_MAX_SEMAPHORES_ALLOCATED,
ERR_INVALID_STACK_PARAMETER,
ERR_MINIMUM_STACK_SIZE_VIOLATION,
ERR_MAXIMUM_STACK_SIZE_VIOLATION,
ERR_BAD_INITIAL_TASK_STATE,
ERR_ITEM_NOT_FOUND,
ERR_FEATURE_NOT_IMPLEMENTED,
ERR_STACK_ALREADY_IN_USE,
ERR_SEMAPHORE_NOT_FOUND,
ERR_MSG_WAIT_TIMEOUT_ELAPSED,
ERR_TASK_IS_BLOCKED,
ERR_INVALID_TASK_PRIORITY,
ERR_IDLE_TASK_CANNOT_START,
ERR_STKOF_TRAP,
ERR_STKUF_TRAP,
ERR_NMI_TRAP,
ERR_CANNOT_RESCHEDULE_INTERRUPTS_DISABLED,
ERR_TASK_CANNOT_DELETE_ITSELF,
ERR_DEADLOCK_RISK,
ERR_INVALID_INTERRUPT_VECTOR,
ERR_INTERRUPT_VECTOR_IN_USE,
ERR_INVALID_SCHEDULING_POLICY,
ERR_TASK_CANNOT_BE_WOKEN,
ERR_TRACE_BUFFER_INVALID_SIZE,
ERR_TRACE_BUFFER_INVALID_CODE,
ERR_CANNOT_TAKE_TASK_SNAPSHOT,
ERR_SNAPSHOT_TASK_IS_BLOCKED_ON_SYNCH,
ERR_INVALID_TASK_STATE,
ERR_STACK_SPACE_LOW,
ERR_STACK_SPACE_OUT,
NO_ERROR,
LAST_ENTRY
} error_code ;
// WAR STORY
// preferably, if not too expensive to complete, all structures should have a size that is a power of 2 so that looping
// through an array of structures, for example, will not incur an expensive 'MUL' instruction to calculate the offset
// of elements - but a 'SHL' instruction instead.
typedef struct
{
error_code err_code ;
const char* error_message ;
int16s power2patch ; // a patch for 2^3 = 8 bytes. see war story.
} error_code_to_string_map ;
// module interface starts here
const char *resolve_system_message(error_code) ;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -