#ifndef __RPP_SDR_H
#define __RPP_SDR_H
+/**
+ * SDRAM start address on RPP board.
+ *
+ * @note See RPP_SDR_ADDR_END for memory size.
+ */
+#define RPP_SDR_ADDR_START 0x80000000U
+
+/**
+ * SDRAM end address on RPP board.
+ *
+ * @note 0x83FFFFFF − 0x80000000 + 1 = 67108864 addresses.\n
+ * One address per byte.\n
+ * 67108864 bytes = 65536 Kbytes = 64 Mbytes.
+ */
+#define RPP_SDR_ADDR_END 0x83FFFFFFU
+
+
/**
* SDR module initialization.
+ *
* Call this method before using this module.
*
- * @return SUCCESS if initialization successful.
- * FAILURE is module already initialized.
+ * @return SUCCESS if initialization successful.\n
+ * FAILURE if module already initialized.
*/
int8_t rpp_sdr_init();
-#endif /* __RPP_SDR_H */
+/**
+ * Configure SD-RAM logging.
+ *
+ * This function will enable or disable logging on application. Note that when
+ * logging is enabled a command processor task which uses the SCI for user I/O
+ * is spawned. This command processor might conflict with user application if it
+ * also uses the SCI for user I/O.
+ *
+ * @param[in] enable Enable/Disable logging on application.
+ *
+ * @return SUCCESS if logging was successfully enabled or disabled.\n
+ * FAILURE if trying to disable disabled (or enable enabled)
+ * logging, SDR module have not being initialized or not
+ * enough memory to allocate tasks.
+ */
+int8_t rpp_sdr_setup(boolean_t enable);
+
+
+/**
+ * Query for the amount of space free on the SD-RAM.
+ *
+ * This funtion will calculate the amount of free space left (not used by logs)
+ * on the SD-RAM.
+ *
+ * @return Number of bytes free in the SD-RAM.\n
+ * For 64MB SD-RAM value is between [0-67108864]
+ */
+uint32_t rpp_sdr_available();
+
+/**
+ * Store a formatted user string on the log, if logging is enabled.
+ *
+ * Implementation uses vsnprintf() from stdio.h using a fixed MAX_BUFFER_LEN
+ * bytes buffer.
+ *
+ * @param[in] format C string that contains a format string that follows the
+ * same specifications as format in printf (see stdio.h's
+ * printf for details).
+ * @param[in] ... (additional arguments) Depending on the format string,
+ * the function may expect a sequence of additional
+ * arguments, each containing a value to be used to replace
+ * a format specifier in the format string (or a pointer to
+ * a storage location).
+ * There should be at least as many of these arguments as
+ * the number of values specified in the format specifiers.
+ * Additional arguments are ignored by the function.
+ *
+ * @return The number of characters that would have been written if the buffer
+ * had been sufficiently large, not counting the terminating null
+ * character.
+ * If logging is disabled, an encoding error occurs or the log file is
+ * full a negative number is returned.
+ * Please note that only when this returned value is non-negative and
+ * less than the buffer size, the string has been completely written.
+ */
+int32_t rpp_sdr_printf(const char *format, ...);
+
+
+/**
+ * Clear log.
+ *
+ * This function will clear all the data from the log. This will also stop the
+ * show task if it's currently flushing the log.
+ *
+ * @return SUCCESS if log was cleared.\n
+ * FAILURE if logging is disabled or log was already empty.
+ */
+int8_t rpp_sdr_clear();
+
+
+/**
+ * Start/Stop the task that sends the log to the SCI.
+ *
+ * This function will start the task that reads the log and prints it to the
+ * SCI in a similar way the 'dmesg' command work on Linux.
+ *
+ * @param[in] start TRUE to request the log to be sent to the SCI.
+ * FALSE to stop the log file from being send to the SCI.
+ *
+ * @return SUCCESS if log was cleared.\n
+ * FAILURE if logging is disabled or trying to stop an stopped task
+ * (or start an already started task).
+ */
+int8_t rpp_sdr_show(boolean_t start);
+
+
+#endif /* __RPP_SDR_H */