diff options
Diffstat (limited to 'sw/z80/libc')
-rw-r--r-- | sw/z80/libc/include/stdint.h | 13 | ||||
-rw-r--r-- | sw/z80/libc/include/stdio.h | 11 | ||||
-rw-r--r-- | sw/z80/libc/include/stdlib.h | 7 | ||||
-rw-r--r-- | sw/z80/libc/include/string.h | 12 | ||||
-rw-r--r-- | sw/z80/libc/include/sysio.h | 55 | ||||
-rw-r--r-- | sw/z80/libc/include/types.h | 60 | ||||
-rw-r--r-- | sw/z80/libc/stdio.c | 12 | ||||
-rw-r--r-- | sw/z80/libc/string.c | 37 |
8 files changed, 0 insertions, 207 deletions
diff --git a/sw/z80/libc/include/stdint.h b/sw/z80/libc/include/stdint.h deleted file mode 100644 index 5e8caf3..0000000 --- a/sw/z80/libc/include/stdint.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __STDINT_H__ -#define __STDINT_H__ - -typedef unsigned int uint; - -typedef char int8_t; -typedef unsigned char uint8_t; -typedef int int16_t; -typedef unsigned int uint16_t; -typedef long int int32_t; -typedef unsigned long int uint32_t; - -#endif // __STDINT_H__
\ No newline at end of file diff --git a/sw/z80/libc/include/stdio.h b/sw/z80/libc/include/stdio.h deleted file mode 100644 index b31cdfd..0000000 --- a/sw/z80/libc/include/stdio.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __STDIO_H__ -#define __STDIO_H__ - -#include "types.h" - -extern uint8_t *stdout, stderr; - -void putc(char ch, uint8_t *buffer); -int printf(const char *fmt, ...); - -#endif diff --git a/sw/z80/libc/include/stdlib.h b/sw/z80/libc/include/stdlib.h deleted file mode 100644 index c69f573..0000000 --- a/sw/z80/libc/include/stdlib.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __STDLIB_H__ -#define __STDLIB_H__ - -#include "stdint.h" - - -#endif // __STDLIB_H__
\ No newline at end of file diff --git a/sw/z80/libc/include/string.h b/sw/z80/libc/include/string.h deleted file mode 100644 index 9c002e3..0000000 --- a/sw/z80/libc/include/string.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __STRING_H__ -#define __STRING_H__ - -#include "types.h" - -void * memset(void *dest, const int8_t src, size_t n); - -void *memcpy(void *dest, const void *src, size_t n); - -int8_t memcmp(const void *s1, const void *s2, size_t n); - -#endif diff --git a/sw/z80/libc/include/sysio.h b/sw/z80/libc/include/sysio.h deleted file mode 100644 index 5d1f5ae..0000000 --- a/sw/z80/libc/include/sysio.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __SYSIO_H__ -#define __SYSIO_H__ - -#include "types.h" - -/* -* Memory management -*/ - -void * malloc(uint16_t size); -uint16_t malloc_size(void * address); -void free(void * address); - -/* -* File management -*/ - -#define F_WRITE "w" -#define F_READ "r" -#define F_BIN_WRITE "wb" -#define F_BIN_READ "rb" - -#define F_READ_CODE 0x0 -#define F_WRITE_CODE 0x1 -#define F_BIN_READ_CODE 0x2 -#define F_BIN_WRITE_CODE 0x3 - -#define F_PERM_READ 0x0 -#define F_PERM_WRITE 0x1 -#define F_PERM_RW 0x2 - -struct file { - - const char * path; - unsigned int mode:4; - unsigned int permission:4; -}; - -#define FILE struct file - -FILE * fopen(const char * path, const char * mode); -uint8_t fclose(FILE * file); - -// TODO: other functions - -/* -* Processes management -*/ - -#define PID uint16_t - -void exit(); // exit this program -void interrupt(PID) - -#endif
\ No newline at end of file diff --git a/sw/z80/libc/include/types.h b/sw/z80/libc/include/types.h deleted file mode 100644 index a083bfe..0000000 --- a/sw/z80/libc/include/types.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __TYPES_H__ -#define __TYPES_H__ - -/* only types from primitive types are defined in this file */ - -typedef volatile unsigned char register_t; - -typedef unsigned int uint; - -typedef char int8_t; -typedef unsigned char uint8_t; -typedef int int16_t; -typedef unsigned int uint16_t; -typedef long int int32_t; -typedef unsigned long int uint32_t; - -typedef uint16_t size_t; -typedef int16_t ssize_t; - -typedef uint8_t pid_t; -typedef uint16_t ino_t; - -typedef uint8_t dev_t; -typedef uint32_t devsize_t; -typedef uint8_t fd_t; -typedef uint16_t blk_t; -typedef uint8_t user_t; -typedef struct { - uint8_t member[3]; -} uint24_t; - -typedef uint32_t fsize_t; - -typedef struct -{ - dev_t dev; // device id, global in the fs - ino_t inode; // inode id relative to the volume - -} inode_t; - -typedef struct time_s -{ - struct - { - uint minutes :6; - uint hour :5; - - } time; - - struct - { - uint day :5; - uint month :4; - uint year :12; - - } date; - -} time_t; - -#endif diff --git a/sw/z80/libc/stdio.c b/sw/z80/libc/stdio.c deleted file mode 100644 index c2548d6..0000000 --- a/sw/z80/libc/stdio.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "stdio.h" - -void putc(char ch, uint8_t *buffer) -{ - *buffer = ch; - *(++buffer) = '\0'; -} - - -int printf(const char *fmt, ...) -{ -} diff --git a/sw/z80/libc/string.c b/sw/z80/libc/string.c deleted file mode 100644 index 57b3a7f..0000000 --- a/sw/z80/libc/string.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "string.h" - -void *memset(void *dest, const int8_t src, size_t n) { - - char *dp = (char *) dest; - - while (n--) - *(dp++) = src; - - return dest; -} - -void *memcpy(void *dest, void *src, size_t n) -{ - char *dp = dest; - char *sp = src; - - while (n--) { - *dp++ = *sp++; - } - - return dest; -} - -int8_t memcmp(void *s1, void *s2, size_t n) -{ - char *u1 = (char *) s1; - char *u2 = (char *) s2; - - for ( ; n--; u1++, u2++) { - - if (*u1 != *u2) - return u1 - u2; - } - - return 0; -}
\ No newline at end of file |