Feat: lab 3 w/o adv 2
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define NO_ERROR 0x00000000
|
||||
#define ERR_NO_MEM 0x00000001
|
||||
#define ERR_UNREACHABLE 0x00000002
|
||||
#define ERR_CONVERSION 0x00000003
|
||||
@@ -7,4 +8,5 @@
|
||||
#define ERR_INVALID_OP 0x00000005
|
||||
#define ERR_INVALID_MEM 0x00000006
|
||||
#define ERR_NOT_EXIST 0x00000007
|
||||
#define ERR_IO_FAILED 0x00000008
|
||||
#define ERR_ADMINKILL 0x00114514
|
||||
|
||||
@@ -34,6 +34,13 @@ static inline char *_logger_pointer(char *dest, void *x)
|
||||
return _logger_hex(dest, (uint64_t)x);
|
||||
}
|
||||
|
||||
static inline
|
||||
void _uart_puts_sync(const char *s)
|
||||
{
|
||||
while (*s != '\0')
|
||||
uart_putb_sync((const uint8_t *)s++, 1);
|
||||
}
|
||||
|
||||
#define _I_HATE_C_LANG(msg) \
|
||||
logger_cur = _Generic((msg), \
|
||||
char * : _do_nothing, \
|
||||
@@ -54,9 +61,9 @@ logger_cur = _Generic((msg), \
|
||||
}
|
||||
|
||||
#define FLUSH(prefix) { \
|
||||
uart_puts(prefix); \
|
||||
uart_puts(logger_buf); \
|
||||
uart_puts(ENDL); \
|
||||
_uart_puts_sync(prefix); \
|
||||
_uart_puts_sync(logger_buf); \
|
||||
_uart_puts_sync(ENDL); \
|
||||
logger_cur = logger_buf; \
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define true 0x1
|
||||
#define false 0x0
|
||||
|
||||
#define ENDL "\r\n"
|
||||
|
||||
#define NAME_MAX 255
|
||||
#define PATH_MAX 4096
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
int strcmp(const char *lhs, const char *rhs);
|
||||
char *strcpy(char *destination, const char *source);
|
||||
size_t strlen(const char *str);
|
||||
char *strtok_r(char *str, const char *delimiters, char **saveptr);
|
||||
|
||||
void *memcpy(void *dest, const void *src, size_t count);
|
||||
void *memzero(void *start, void *end);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void uart_init();
|
||||
void uart_send(unsigned int c);
|
||||
uint8_t uart_getb();
|
||||
char uart_getc();
|
||||
void uart_puts(const char *s);
|
||||
void uart_hex(uint64_t d);
|
||||
|
||||
extern int is_uart_init;
|
||||
Reference in New Issue
Block a user