diff --git a/libc/inc/array.h b/libc/inc/array.h index 5ab8fb4..c235398 100644 --- a/libc/inc/array.h +++ b/libc/inc/array.h @@ -6,13 +6,18 @@ #pragma once #ifdef __KERNEL__ +/// Function for allocating memory for the array. #define ARRAY_ALLOC kmalloc +/// Function for freeing the memory for the array. #define ARRAY_FREE kfree #else +/// Function for allocating memory for the array. #define ARRAY_ALLOC malloc +/// Function for freeing the memory for the array. #define ARRAY_FREE free #endif +/// @brief Declares a new dynamic-size array structure. #define DECLARE_ARRAY(type, name) \ typedef struct arr_##name##_t { \ const unsigned size; \ diff --git a/libc/inc/bits/termios-struct.h b/libc/inc/bits/termios-struct.h index 5c698f4..aad92c6 100644 --- a/libc/inc/bits/termios-struct.h +++ b/libc/inc/bits/termios-struct.h @@ -42,4 +42,5 @@ typedef struct termios { #define ECHOKE 0x00000001 ///< If ICANON is set, KILL is echoed by erasing each character on the line. #define IEXTEN 0x00000400 ///< Enables implementation-defined input processing. +/// @brief Mask for extracting control values. #define CTRL(x) (x & 037) \ No newline at end of file diff --git a/libc/inc/ring_buffer.h b/libc/inc/ring_buffer.h index d53b66c..dac2827 100644 --- a/libc/inc/ring_buffer.h +++ b/libc/inc/ring_buffer.h @@ -5,6 +5,7 @@ #pragma once +/// @brief Declares a fixed-size ring-buffer. #define DECLARE_FIXED_SIZE_RING_BUFFER(type, name, length, init) \ typedef struct fs_rb_##name##_t { \ unsigned size, read, write; \ @@ -69,13 +70,18 @@ } #ifdef __KERNEL__ +/// Function for allocating memory for the ring buffer. #define RING_BUFFER_ALLOC kmalloc +/// Function for freeing the memory for the ring buffer. #define RING_BUFFER_FREE kfree #else +/// Function for allocating memory for the ring buffer. #define RING_BUFFER_ALLOC malloc +/// Function for freeing the memory for the ring buffer. #define RING_BUFFER_FREE free #endif +/// @brief Declares a dynamic-size ring-buffer. #define DECLARE_RING_BUFFER(type, name, init) \ typedef struct rb_##name##_t { \ const unsigned size; \ diff --git a/libc/src/unistd/exec.c b/libc/src/unistd/exec.c index 06a50c2..ac08c32 100644 --- a/libc/src/unistd/exec.c +++ b/libc/src/unistd/exec.c @@ -62,6 +62,11 @@ static inline int __find_in_path(const char *file, char *buf, size_t buf_len) /// @brief Replaces the current process image with a new process /// image (argument vector), allows the caller to specify /// the environment of the executed program via `envp`. +/// @param path The absolute path to the binary file to execute. +/// @param argv A vector of one or more pointers to null-terminated strings that represent +/// the argument list available to the executed program. +/// @param envp A vector of one or more pointers to null-terminated strings that represent +/// the environment list available to the executed program. /// @return Returns -1 only if an error has occurred, and sets errno. _syscall3(int, execve, const char *, path, char *const *, argv, char *const *, envp) diff --git a/mentos/inc/drivers/keyboard/keymap.h b/mentos/inc/drivers/keyboard/keymap.h index 683841e..881465e 100644 --- a/mentos/inc/drivers/keyboard/keymap.h +++ b/mentos/inc/drivers/keyboard/keymap.h @@ -40,8 +40,10 @@ keymap_type_t get_keymap_type(); /// @param type The type to set. void set_keymap_type(keymap_type_t type); -/// @brief Returns the current keymap. -/// @return Pointer to the current keymap. + +/// @brief Returns the current keymap for the given scancode. +/// @param scancode the scancode we want. +/// @return Pointer to the keymap. const keymap_t *get_keymap(int scancode); /// @brief Initializes the supported keymaps. diff --git a/mentos/inc/drivers/ps2.h b/mentos/inc/drivers/ps2.h index fdf1c51..20652c6 100644 --- a/mentos/inc/drivers/ps2.h +++ b/mentos/inc/drivers/ps2.h @@ -9,6 +9,10 @@ /// @return 0 on success, 1 on failure. int ps2_initialize(); +/// @brief Writes data to the PS/2 port. +/// @param data the data to write. void ps2_write(unsigned char data); +/// @brief Reads data from the PS/2 port. +/// @return the data coming from the PS/2 port. unsigned char ps2_read(); \ No newline at end of file diff --git a/mentos/src/drivers/ps2.c b/mentos/src/drivers/ps2.c index 6e649ab..224c5ce 100644 --- a/mentos/src/drivers/ps2.c +++ b/mentos/src/drivers/ps2.c @@ -17,9 +17,9 @@ #include "io/debug.h" #include "stdbool.h" -#define PS2_DATA 0x60 -#define PS2_STATUS 0x64 -#define PS2_COMMAND 0x64 +#define PS2_DATA 0x60 ///< Data signal line. +#define PS2_STATUS 0x64 ///< Status signal line. +#define PS2_COMMAND 0x64 ///< Command signal line. #define PS2_CTRL_TEST_CONTROLLER 0xAA ///< Test PS/2 Controller. 0x55 passed, 0xFC failed. #define PS2_CTRL_P1_ENABLE 0xAE ///< Enable first PS/2 port. No response. @@ -29,12 +29,12 @@ #define PS2_CTRL_P2_DISABLE 0xA7 ///< Disable second PS/2 port. No response. #define PS2_CTRL_P2_TEST 0xA9 ///< Test second PS/2 port (only if 2 PS/2 ports supported). -#define PS2_TEST_SUCCESS 0xAA -#define PS2_ECHO_RES 0xEE -#define PS2_ACK 0xFA -#define PS2_TEST_FAIL1 0xFC -#define PS2_TEST_FAIL2 0xFD -#define PS2_RESEND 0xFE +#define PS2_TEST_SUCCESS 0xAA ///< Self test passed (sent after "0xFF (reset)" command or keyboard power up). +#define PS2_ECHO_RES 0xEE ///< Response to "0xEE (echo)" command. +#define PS2_ACK 0xFA ///< Command acknowledged (ACK). +#define PS2_TEST_FAIL1 0xFC ///< Self test failed (sent after "0xFF (reset)" command or keyboard power up). +#define PS2_TEST_FAIL2 0xFD ///< Self test failed (sent after "0xFF (reset)" command or keyboard power up). +#define PS2_RESEND 0xFE ///< Resend (keyboard wants controller to repeat last command it sent). // PS/2 Controller Configuration Byte // Bit | Meaning diff --git a/mentos/src/fs/ext2.c b/mentos/src/fs/ext2.c index e3b09e0..9a6c702 100644 --- a/mentos/src/fs/ext2.c +++ b/mentos/src/fs/ext2.c @@ -10,7 +10,7 @@ /// Change the header. #define __DEBUG_HEADER__ "[EXT2 ]" /// Set the log level. -#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE +#define __DEBUG_LEVEL__ LOGLEVEL_DEBUG #include "process/scheduler.h" #include "process/process.h" diff --git a/mentos/src/io/proc_video.c b/mentos/src/io/proc_video.c index d319399..481ff33 100644 --- a/mentos/src/io/proc_video.c +++ b/mentos/src/io/proc_video.c @@ -24,6 +24,8 @@ #include "ctype.h" #include "process/scheduler.h" +/// @brief Prints the ring-buffer. +/// @param rb the ring-buffer to print. void print_rb(fs_rb_scancode_t *rb) { if (!fs_rb_scancode_empty(rb)) {