|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
#include "serial.h"#include <spinlock.h>#include <type.h>#include <init/init.h>#include <libk/io.h>#include <str.h>#include <hal/cpu/irq_lock.h>Go to the source code of this file.
Data Structures | |
| struct | serial_entry_t |
| struct | serial_ring_buffer_t |
Macros | |
| #define | INT_ENABLE_OFFSET 1 |
| #define | SERIAL_BUFFER2_SIZE (4096 * 3) |
| #define | SERIAL_BUFFER2_MASK (SERIAL_BUFFER2_SIZE - 1) |
| #define | SLOT_WRITING 0xFE |
| #define | SLOT_DROPPED 0xFF |
| #define | SLOT_EMPTY 0x00 |
| #define | SPIN_LIMIT 10000u |
Functions | |
| void | serial_setup (void) |
| int | serial_is_transmit_empty (void) |
| void | serial_putc (char c) |
| void | serial_send_string (char *str) |
| void | serial_send_number (int64_t num, int base) |
| void | serial_clear (void) |
| static bool | reserve_slot (uint32_t *out_idx) |
| static void | put_into_buffer (const char *str, uint8_t len) |
| static void | serial2_send_number (int64_t num, int base) |
| static void | serial2_send_unsigned_number (uint64_t num, int base, int limit) |
| void | parse_multicore (__builtin_va_list args, const char *fmt) |
| void | serial2_flush (void) |
| static void | serial_send_padded (uint64_t val, int base, int width, char pad) |
| static void | parse_before_multicore (__builtin_va_list args, const char *fmt) |
| __attribute__ ((used, visibility("default"), section(".export"))) | |
| This function handles memory allocation for a new dentry using the slab allocator. | |
Variables | |
| static serial_ring_buffer_t | __buffer = {0} |
| static volatile unsigned char | __flush_lock = 0 |
| static spinlock_t | __serial2_producer_lock = {0} |
| boolean_t | multicore_start |
| #define INT_ENABLE_OFFSET 1 |
Definition at line 8 of file serial.c.
Referenced by serial_setup().
| #define SERIAL_BUFFER2_MASK (SERIAL_BUFFER2_SIZE - 1) |
Definition at line 10 of file serial.c.
Referenced by reserve_slot(), and serial2_flush().
| #define SERIAL_BUFFER2_SIZE (4096 * 3) |
Definition at line 9 of file serial.c.
Referenced by reserve_slot().
| __attribute__ | ( | (used, visibility("default"), section(".export")) | ) |
This function handles memory allocation for a new dentry using the slab allocator.
It also links the dentry to its corresponding VNode (if provided).
| name | The name of the file or directory. |
| vnode | Pointer to the associated VNode (inode data). Pass NULL if the VNode is not yet available. |
Definition at line 542 of file serial.c.
References __serial2_producer_lock, flags, irq_restore(), irq_save(), KERNEL_API, multicore_start, parse_before_multicore(), parse_multicore(), spin_acquire(), and spin_release().
|
static |
Definition at line 433 of file serial.c.
References serial_putc(), serial_send_padded(), serial_send_string(), and width.
Referenced by __attribute__().
| void parse_multicore | ( | __builtin_va_list | args, |
| const char * | fmt ) |
Definition at line 271 of file serial.c.
References ptr, put_into_buffer(), serial2_send_number(), serial2_send_unsigned_number(), and strlen().
Referenced by __attribute__().
|
static |
Definition at line 156 of file serial.c.
References __buffer, serial_entry_t::data, idx, len, serial_entry_t::len, reserve_slot(), SLOT_DROPPED, SLOT_EMPTY, SLOT_WRITING, SPIN_LIMIT, and str().
Referenced by parse_multicore(), serial2_send_number(), and serial2_send_unsigned_number().
|
static |
Definition at line 122 of file serial.c.
References __buffer, head, SERIAL_BUFFER2_MASK, SERIAL_BUFFER2_SIZE, and tail.
Referenced by put_into_buffer().
| void serial2_flush | ( | void | ) |
Definition at line 359 of file serial.c.
References __buffer, __flush_lock, serial_entry_t::data, head, len, serial_entry_t::len, SERIAL_BUFFER2_MASK, serial_putc(), SLOT_DROPPED, SLOT_EMPTY, SLOT_WRITING, SPIN_LIMIT, and tail.
Referenced by __attribute__().
|
static |
Definition at line 201 of file serial.c.
References base, and put_into_buffer().
Referenced by parse_multicore().
|
static |
Definition at line 235 of file serial.c.
References base, count, and put_into_buffer().
Referenced by parse_multicore().
| void serial_clear | ( | void | ) |
Definition at line 105 of file serial.c.
References serial_printf().
| int serial_is_transmit_empty | ( | void | ) |
Definition at line 56 of file serial.c.
References inb(), and SERIAL_COM1.
Referenced by serial_putc().
|
extern |
Definition at line 60 of file serial.c.
References outb(), SERIAL_COM1, and serial_is_transmit_empty().
Referenced by parse_before_multicore(), serial2_flush(), serial_send_number(), serial_send_padded(), and serial_send_string().
| void serial_send_number | ( | int64_t | num, |
| int | base ) |
Definition at line 72 of file serial.c.
References base, and serial_putc().
|
static |
Definition at line 411 of file serial.c.
References base, serial_putc(), and width.
Referenced by parse_before_multicore().
| void serial_send_string | ( | char * | str | ) |
Definition at line 67 of file serial.c.
References serial_putc(), and str().
Referenced by parse_before_multicore().
| void serial_setup | ( | void | ) |
Definition at line 46 of file serial.c.
References INT_ENABLE_OFFSET, outb(), and SERIAL_COM1.
Referenced by __attribute__(), and __attribute__().
|
static |
Definition at line 33 of file serial.c.
Referenced by put_into_buffer(), reserve_slot(), and serial2_flush().
|
static |
Definition at line 39 of file serial.c.
Referenced by serial2_flush().
|
static |
Definition at line 40 of file serial.c.
Referenced by __attribute__().
|
extern |
Definition at line 105 of file core.c.
Referenced by __attribute__(), and INIT().