global: Migrate CONFIG_STACKBASE to CFG
[platform/kernel/u-boot.git] / include / console.h
index 58a4ec3..ceb733b 100644 (file)
@@ -25,6 +25,18 @@ void clear_ctrlc(void);      /* clear the Control-C condition */
 int disable_ctrlc(int);        /* 1 to disable, 0 to enable Control-C detect */
 int confirm_yesno(void);        /*  1 if input is "y", "Y", "yes" or "YES" */
 
+/**
+ * console_search_dev() - search for stdio device with given flags and name
+ * @flags: device flags as per input/output/system
+ * @name: device name
+ *
+ * Iterates over registered STDIO devices and match them with given @flags
+ * and @name.
+ *
+ * Return: pointer to the &struct stdio_dev if found, or NULL otherwise
+ */
+struct stdio_dev *console_search_dev(int flags, const char *name);
+
 #ifdef CONFIG_CONSOLE_RECORD
 /**
  * console_record_init() - set up the console recording buffers
@@ -32,7 +44,7 @@ int confirm_yesno(void);        /*  1 if input is "y", "Y", "yes" or "YES" */
  * This should be called as soon as malloc() is available so that the maximum
  * amount of console output can be recorded.
  *
- * @return 0 if OK, -ENOMEM if out of memory
+ * Return: 0 if OK, -ENOMEM if out of memory
  */
 int console_record_init(void);
 
@@ -48,7 +60,7 @@ void console_record_reset(void);
  *
  * This should be called to enable the console buffer.
  *
- * @return 0 (always)
+ * Return: 0 (always)
  */
 int console_record_reset_enable(void);
 
@@ -60,16 +72,28 @@ int console_record_reset_enable(void);
  *
  * @str: Place to put string
  * @maxlen: Maximum length of @str including nul terminator
- * @return length of string returned
+ * Return: length of string returned, or -ENOSPC if the console buffer was
+ *     overflowed by the output
  */
 int console_record_readline(char *str, int maxlen);
 
 /**
  * console_record_avail() - Get the number of available bytes in console output
  *
- * @return available bytes (0 if empty)
+ * Return: available bytes (0 if empty)
  */
 int console_record_avail(void);
+
+/**
+ * console_in_puts() - Write a string to the console input buffer
+ *
+ * This writes the given string to the console_in buffer which will then be
+ * returned if a function calls e.g. `getc()`
+ *
+ * @str: the string to write
+ * Return:  the number of bytes added
+ */
+int console_in_puts(const char *str);
 #else
 static inline int console_record_init(void)
 {
@@ -101,6 +125,12 @@ static inline int console_record_avail(void)
        return 0;
 }
 
+static inline int console_in_puts(const char *str)
+{
+       /* There is never anything written */
+       return 0;
+}
+
 #endif /* !CONFIG_CONSOLE_RECORD */
 
 /**
@@ -111,7 +141,7 @@ static inline int console_record_avail(void)
  * This function prints a banner on devices which (we assume) did not receive
  * it before relocation.
  *
- * @return 0 (meaning no errors)
+ * Return: 0 (meaning no errors)
  */
 int console_announce_r(void);