os.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * See file CREDITS for list of people who contributed to this
  4. * project.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation; either version 2 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  19. * MA 02111-1307 USA
  20. */
  21. /*
  22. * Operating System Interface
  23. *
  24. * This provides access to useful OS routines from the sandbox architecture
  25. */
  26. /**
  27. * Access to the OS read() system call
  28. *
  29. * \param fd File descriptor as returned by os_open()
  30. * \param buf Buffer to place data
  31. * \param count Number of bytes to read
  32. * \return number of bytes read, or -1 on error
  33. */
  34. ssize_t os_read(int fd, void *buf, size_t count);
  35. /**
  36. * Access to the OS write() system call
  37. *
  38. * \param fd File descriptor as returned by os_open()
  39. * \param buf Buffer containing data to write
  40. * \param count Number of bytes to write
  41. * \return number of bytes written, or -1 on error
  42. */
  43. ssize_t os_write(int fd, const void *buf, size_t count);
  44. /**
  45. * Access to the OS open() system call
  46. *
  47. * \param pathname Pathname of file to open
  48. * \param flags Flags, like O_RDONLY, O_RDWR
  49. * \return file descriptor, or -1 on error
  50. */
  51. int os_open(const char *pathname, int flags);
  52. /**
  53. * Access to the OS close() system call
  54. *
  55. * \param fd File descriptor to close
  56. * \return 0 on success, -1 on error
  57. */
  58. int os_close(int fd);
  59. /**
  60. * Access to the OS exit() system call
  61. *
  62. * This exits with the supplied return code, which should be 0 to indicate
  63. * success.
  64. *
  65. * @param exit_code exit code for U-Boot
  66. */
  67. void os_exit(int exit_code);
  68. /**
  69. * Put tty into raw mode to mimic serial console better
  70. */
  71. void os_tty_raw(int fd);