|
Muteki
EABI code execution on Besta® RTOS devices.
|
Besta error code constants and functions. More...
#include "common.h"Go to the source code of this file.
Typedefs | |
| typedef unsigned int | bxc_errno_t |
Functions | |
| static unsigned short | BXC_ERRNO_NS (bxc_errno_t kerrno) |
| Get the namespace portion of raw kernel errno value. | |
| static unsigned short | BXC_ERRNO_ERR (bxc_errno_t kerrno) |
| Get the error code portion of raw kernel errno value. | |
| static bxc_errno_t | BXC_ERRNO (unsigned short ns, unsigned short err) |
| Helper function that builds an errno from namespace and error code. | |
| size_t | FormatMessage (unsigned int flags, int _sbz0, int _sbz1, int _sbz2, void *outbuf, size_t outlen) |
| Fetch an error message. | |
| void | OSSetLastError (bxc_errno_t err) |
| Set the global errno. | |
| bxc_errno_t | OSGetLastError (void) |
| Get errno value from the global errno variable. | |
| void | _SetLastError (bxc_errno_t err) |
| Set errno. | |
| bxc_errno_t | _GetLastError (void) |
| Get errno. | |
Besta error code constants and functions.
| typedef unsigned int bxc_errno_t |
Kernel error code type
| enum bxc_errno_exec_e |
Error code for BXC_ERRNO_NS_EXEC.
| Enumerator | |
|---|---|
| BXC_ERR_EXEC_UNSUPPORTED | Unsupported executable type. This may be returned when attempting to execute a TLCS-900 executable or x86 EXE file on Arm systems.
|
| BXC_ERR_EXEC_INVALID | Invalid executable file. This may be returned when attempting to execute a data-only ROM.
|
| BXC_ERR_EXEC_OPEN_FAILED | Failed to open executable file. |
| BXC_ERR_EXEC_LOADER_FAILURE | Failed to parse executable file. |
| BXC_ERR_EXEC_MALLOC_FAILED | Failed to allocate memory when loading executable file. |
| BXC_ERR_EXEC_DECOMPRESSION_FAILED | Decompression failed. |
| BXC_ERR_EXEC_MP3_PLAYER_IS_RUNNING | Refuse to load an executable file because MP3 player is running in the background. Probably an left-over from the TLCS-900 days when MP3 can be played in the background. |
| BXC_ERR_EXEC_GENERIC_ERROR | Generic error. This is usually shown when the loader functions encountered an internal error. |
| BXC_ERR_EXEC_MAP_FULL | Executable mapping table is full. This is returned when too many executable is loaded. May be overwritten by a more generic code like BXC_ERR_EXEC_LOADER_FAILURE. |
| BXC_ERR_EXEC_BESTAPE_HEADER_PARSER_FAILURE | Failed to load executable file due to an error originated from the header parser. |
| BXC_ERR_EXEC_BESTAPE_LD_FAILURE | Failed to load executable file due to an error originated from the shared object loader. |
| BXC_ERR_EXEC_BESTAPE_RELOC_FAILURE | Failed to load executable file due to an error originated from the relocator. |
| BXC_ERR_EXEC_INVALID_PATH | Invalid pathname. |
| BXC_ERR_EXEC_MODULE_NOT_LOADED | Module is not loaded. |
| BXC_ERR_EXEC_NOT_LOADED | Executable is not loaded. |
| enum bxc_errno_kernel_e |
Error code for BXC_ERRNO_NS_KERNEL.
| Enumerator | |
|---|---|
| BXC_ERR_PERIPHERAL_COMM_FAILED | Peripheral communication failed. |
| BXC_ERR_GENERAL_HW_ERROR | General hardware error. |
| BXC_ERR_FTL_DATA_CORRUPTED | FTL: Data corruption detected. |
| BXC_ERR_FTL_ECC_FAILED | FTL: Data corruption detected and error correction attempt failed. |
| BXC_ERR_FTL_ECC_TRIGGERED | FTL: Data corruption detected and error correction attempt succeeded. |
| BXC_ERR_FTL_INVALID_LBA | FTL: Invalid Logical Block Address. |
| BXC_ERR_MEDIUM_WP_ENABLED | Medium is write protected. |
| BXC_ERR_MEDIUM_CHANGED | Medium changed |
| BXC_ERR_MEDIUM_INCOMPATIBLE | Medium is of an incompatible type. |
| BXC_ERR_MEDIUM_ERROR | Medium I/O error. |
| BXC_ERR_MEDIUM_UNLOADED | Medium is not loaded. |
| BXC_ERR_SYS_STORAGE_DEVICE_NOT_FOUND | Storage device not found. |
| BXC_ERR_SYS_ERASE_FAILED | Erase of storage device failed. |
| BXC_ERR_SYS_OUT_OF_MEMORY | Out of memory. |
| BXC_ERR_SYS_LOW_BATTERY | Low battery. |
| BXC_ERR_SYS_LOCK_SWITCH_ENABLED | Lock switch is on. System is locked. |
| BXC_ERR_MKFS_PROMPT | Block device format prompt. |
| BXC_ERR_MKFS_UNSUPPORTED | Block device needs formatting. |
| BXC_ERR_MKFS_NO_SPACE_LEFT | mkfs: No space left for device. |
| BXC_ERR_MKFS_MODE_ERROR | mkfs: Mode error. |
| BXC_ERR_MKFS_IO_ERROR | mkfs: I/O error. |
| BXC_ERR_FS_INVALID_DRIVE_LETTER | Invalid drive letter |
| BXC_ERR_FS_INVALID_FILENAME | Filename contains invalid characters. |
| BXC_ERR_FS_OPERATION_ERROR | General filesystem I/O error. |
| BXC_ERR_FS_ENTRY_EXISTS | File or directory exists. |
| BXC_ERR_FS_DIR_RECORD_GROWTH | Directory/mount record cannot grow. |
| BXC_ERR_FS_NO_SUCH_ENTRY | No such file or directory. This is raised when a file/directory cannot be found, or attempting to access an unmounted drive.
|
| BXC_ERR_FS_FILE_UNAVAILABLE | File/directory is not available. |
| BXC_ERR_FS_SUBFILE_OOB_SEEK | Seeking a subfile out-of-bound. Only seems to be used by the loader's subfile API. |
| BXC_ERR_FS_CONFLICTING_ATTR | Conflicting file/directory attributes |
| BXC_ERR_FS_TOO_MANY_OPEN_FILES | Too many open files. |
| BXC_ERR_FS_FILE_LOCKED | File/directory is locked for exclusive access. |
| BXC_ERR_FS_FILE_ATTR_ERROR | Attribute error. |
| BXC_ERR_FS_NO_SPACE_LEFT | No space left for device. |
| BXC_ERR_FS_PATH_TRAVERSAL | Path traversal failure. This is raised when attempting to access a file but the path traversal fails at a directory, or wrong type of node is found during path traversal (i.e. expecting a directory but a file is found, and vice-versa).
|
| BXC_ERR_FS_READ_ONLY_FILE | File is read-only. File descriptor does not support read function. |
| BXC_ERR_FS_WRITE_ONLY_FILE | File is write-only. File descriptor does not support write function. |
| BXC_ERR_FS_PATH_TOO_LONG | Path too long. |
| BXC_ERR_FS_GENERIC_ERROR | Generic error. This is usually shown when the file and filesystem functions encountered an internal error, or that the supplied file descriptor is invalid. |
| BXC_ERR_FS_EOF_REACHED | EOF reached when accessing (R/W) a file.
|
| BXC_ERR_FS_FAT16_DIR_ALLOC | FAT16 directory entry allocation failure. Seems to be raised when the FAT16 driver cannot find an empty slot to put a new directory entry in. |
| BXC_ERR_DB_CORRUPTED | Database is corrupted. |
| BXC_ERR_DB_OPEN_FAILED | Failed to open database. |
| BXC_ERR_DB_INDEX_FULL_DELETE | Database index is full. Suggesting entry cleanup. |
| BXC_ERR_DB_FULL | Database is full. |
| BXC_ERR_DB_INDEX_FULL_SYNC | Database index is full. Suggesting sync with PC. |
| BXC_ERR_DB_TOO_MANY_OPEN_FILES | Database: too many open files. |
| enum bxc_errno_ns_flag_e |
Kernel errno namespace.
| Enumerator | |
|---|---|
| BXC_ERRNO_NS_USER | User (errors set by OSSetLastError()). |
| BXC_ERRNO_NS_KERNEL | Kernel. |
| BXC_ERRNO_NS_EXEC | Executable loader. |
| BXC_ERRNO_NS_APPLET | Applet specific (errors set by _SetLastError()). |
| enum bxc_errno_user_e |
Error code for BXC_ERRNO_NS_USER.
| enum bxc_message_flags_e |
Flags for FormatMessage().
| Enumerator | |
|---|---|
| BXC_FORMAT_MESSAGE_ALLOCATE_BUFFER | Allocate buffer for the message. |
| BXC_FORMAT_MESSAGE_FROM_SYSTEM | Use system error message string table to generate the message. |
|
extern |
Get errno.
If kernel errno is set, the errno is returned with BXC_ERRNO_NS_KERNEL bit set. Otherwise it will return the result from OSSetLastError() with BXC_ERRNO_NS_USER bit set.
Requires -lkrnllib when dynamically linking with the shims.
|
extern |
Set errno.
Unlike OSSetLastError(), this also clears the kernel errno before calling OSSetLastError().
If the errno namespace is unset, it will also automatically set BXC_ERRNO_NS_APPLET before passing it to OSSetLastError().
Requires -lkrnllib when dynamically linking with the shims.
| err | New errno value. |
|
inlinestatic |
Helper function that builds an errno from namespace and error code.
| ns | Namespace. |
| err | Error code. |
|
inlinestatic |
Get the error code portion of raw kernel errno value.
| kerrno | Kernel errno value. |
|
inlinestatic |
Get the namespace portion of raw kernel errno value.
| kerrno | Kernel errno value. |
|
extern |
Fetch an error message.
Fetch error descriptions (encoded in UTF16) for last set error in a similar manner to FormatMessage API in Windows.
| flags | Flags. Only BXC_FORMAT_MESSAGE_FROM_SYSTEM and BXC_FORMAT_MESSAGE_ALLOCATE_BUFFER are supported. In addition, BXC_FORMAT_MESSAGE_FROM_SYSTEM must be set. |
| _sbz0 | Reserved. Should be set to 0. |
| _sbz1 | Reserved. Should be set to 0. |
| _sbz2 | Reserved. Should be set to 0. |
| outbuf | The output buffer. If using BXC_FORMAT_MESSAGE_ALLOCATE_BUFFER, the pointer to the allocated buffer will be placed at this location. Otherwise the message will be written directly to this location. It's caller's responsibility to free any buffer allocated by BXC_FORMAT_MESSAGE_ALLOCATE_BUFFER. |
| outlen | When not using BXC_FORMAT_MESSAGE_ALLOCATE_BUFFER, this is the length of the message buffer. Otherwise this is the minimum size of the buffer allocated for the message by the function. |
|
extern |
Get errno value from the global errno variable.
|
extern |
Set the global errno.
| err | New errno value. |