From f414286a2fb2411b1fd6fcabea5208ce4bd5e2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kyle=20J=C2=A0Cardoza?= Date: Mon, 8 Jul 2024 23:38:14 -0400 Subject: [PATCH] Documentation of kernel API --- doc/syscalls.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/syscalls.md b/doc/syscalls.md index 035d6a5..e8d2820 100644 --- a/doc/syscalls.md +++ b/doc/syscalls.md @@ -150,12 +150,14 @@ Return Values: This call fills in the specified buffer with the current date, in the following format: +``` struct { uint16_t year // Current year uint8_t month; // 1 = January..12 = December uint8_t day; // 1..31 uint8_t weekday; // 0 = Sunday..6=Saturday } +``` ## 0x0A: Set Date @@ -169,12 +171,14 @@ Return Values: Argument Structure: +``` struct { uint16_t year // Current year uint8_t month; // 1 = January..12 = December uint8_t day; // 1..31 uint8_t weekday; // 0 = Sunday..6=Saturday }; +``` This call sets the system date from the data in the argument structure. @@ -190,11 +194,13 @@ Return Values: Argument Structure: +``` struct { uint8_t hour; // 0..23 uint8_t minute; // 0..59 uint8_t second; // 0..59 }; +``` This call fills in the specified argument structure with the current time. @@ -279,14 +285,15 @@ Return Values: - C: Status code - X: Number of bytes actually read -Argument block structure: +Argument Structure: +``` struct { void *dest; // Pointer to the buffer to use. uint16_t file; // File handle. size_t length; // Maximum number of bytes to read. }; - +``` This call attempts to read up to `length` bytes from the file handle `file`, into the buffer pointed to by `dest`. On success, the C accumulator will contain STATUS_OK, @@ -305,14 +312,15 @@ Return Values: - C: Status code - X: Number of bytes actually written -Argument block structure: +Argument Structure: +``` struct { void *src; // Pointer to the buffer to use. uint16_t file; // File handle. size_t length; // Maximum number of bytes to write. }; - +``` This call attempts to write up to `length` bytes to the file handle `file`, from the buffer pointed to by `src`. On success, the C accumulator will contain STATUS_OK, @@ -371,10 +379,12 @@ Return Values: Argument Structure: +``` struct { char *src; // Fully-qualified source pathname. char *dest; // Fully-qualified destination pathname. }; +``` This call attempts to move or rename the specified `source` file to `dest`. On success, C will contain STATUS_OK. On error, C will contain a negative value indicating the