summaryrefslogtreecommitdiff
path: root/c/rvcontroller-libraries/rvcontroller-ecalls.h
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2026-05-23 20:14:34 -0500
committercheapie <no-email-for-you@example.com>2026-05-23 20:14:34 -0500
commit85b5fde272be6ab543aa866baebabddc24566bdb (patch)
treeb4f2e3bb634effe51c2bdc5585ca4ea8b98d6dfa /c/rvcontroller-libraries/rvcontroller-ecalls.h
downloadrvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.gz
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.bz2
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.tar.xz
rvcontroller-85b5fde272be6ab543aa866baebabddc24566bdb.zip
Add initial content
Diffstat (limited to 'c/rvcontroller-libraries/rvcontroller-ecalls.h')
-rw-r--r--c/rvcontroller-libraries/rvcontroller-ecalls.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/c/rvcontroller-libraries/rvcontroller-ecalls.h b/c/rvcontroller-libraries/rvcontroller-ecalls.h
new file mode 100644
index 0000000..7107d21
--- /dev/null
+++ b/c/rvcontroller-libraries/rvcontroller-ecalls.h
@@ -0,0 +1,108 @@
+/* RVController ecall C Library - C Header Portion
+ * A product of Advanced Mesecons Devices, a Cheapie Systems company
+ * This is free and unencumbered software released into the public domain.
+ * See http://unlicense.org/ for more information */
+
+#ifndef _STDINT_H
+#include <stdint.h>
+#endif
+
+/* printint(number)
+ *
+ * Prints a 32-bit signed integer to standard output.
+ * number: The number to print */
+void printint(int32_t number);
+
+/* printstr(*str)
+ *
+ * Prints a null-terminated ASCII string to standard output.
+ * *str: Pointer to the start of the string data */
+void printstr(char *str);
+
+/* printchar(c)
+ *
+ * Prints a single ASCII character to standard output.
+ * c: The character to print */
+void printchar(char c);
+
+/* digiline_send(*channel,*msg)
+ *
+ * Sends an arbitrary digilines message on an arbitrary channel.
+ * *channel: Pointer to the start of the null-terminated channel string
+ * *msg: Pointer to the start of the null-terminated message string */
+void digiline_send(char *channel, char *msg);
+
+/* digiline_bufferlevel()
+ *
+ * Reads the current number of digilines messages that have been received
+ * but not yet read.
+ * Returns: Number of messages */
+uint8_t digiline_bufferlevel(void);
+
+/* digiline_receive(*channelbuf,channelbuflen,*msgbuf,msgbuflen)
+ *
+ * Reads the first (oldest) digilines message from the receive queue and removes
+ * the message from the queue.
+ * Null termination will be added to all received strings.
+ * *channelbuf: Pointer to the location of a buffer into which the channel will be placed
+ * channelbuflen: The size of the buffer pointed to by channelbuf
+ * *msgbuf: Pointer to the location of a buffer into which the message will be placed
+ * msgbuflen: The size of the buffer pointed to by channelbuf */
+void digiline_receive(char *channelbuf, int channelbuflen, char *msgbuf, int msgbuflen);
+
+/* rdcycle()
+ *
+ * Reads the number of clock cycles that have passed since the processor was started.
+ * Returns: Number of clock cycles */
+uint32_t rdcycle(void);
+
+/* rdtime()
+ *
+ * Reads the number of seconds that have elapsed since the processor was started.
+ * Returns: Number of seconds */
+uint32_t rdtime(void);
+
+/* digiline_clearbuffer()
+ *
+ * Discards all received digilines messages currently waiting in the queue. */
+void digiline_clearbuffer(void);
+
+/* lightweight_mode(enabled)
+ *
+ * Turns lightweight mode (see RVController documentation) or or off.
+ * enabled: 1 to enable, 0 to disable, other values are reserved */
+void lightweight_mode(char enabled);
+
+/* readint()
+ *
+ * Reads a 32-bit signed integer from the console.
+ * This will block until the user enters a valid number.
+ * returns: The number typed by the user */
+int32_t readint(void);
+
+/* readstr()
+ *
+ * Reads a null-terminated string from the console.
+ * This will block until the user enters something.
+ * buffer: Pointer to a buffer that the string will be stored in
+ * bufsize: The size of the buffer */
+void readstr(char *buffer, uint32_t bufsize);
+
+/* randomint(lowlimit,highlimit)
+ *
+ * Generates a random integer between lowlimit and highlimit.
+ * lowlimit: The lowest number that can be generated (inclusive)
+ * highlimit: The highest number that can be generated (inclusive)
+ * returns: Random number */
+int32_t randomint(int32_t lowlimit,int32_t highlimit);
+
+/* console_clearbuffer()
+ *
+ * Discards all characters currently waiting in the console input buffer. */
+void console_clearbuffer(void);
+
+/* console_readchar()
+ *
+ * Reads one character from the console input buffer.
+ * returns: Character, or 0 if no characters are available to read */
+char console_readchar(void);