/* 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 #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);