lowlev.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*****************************************************************************/
  2. /* LOWLEV.H v8.2.2 */
  3. /* */
  4. /* Copyright (c) 2017-2017 Texas Instruments Incorporated */
  5. /* http://www.ti.com/ */
  6. /* */
  7. /* Redistribution and use in source and binary forms, with or without */
  8. /* modification, are permitted provided that the following conditions */
  9. /* are met: */
  10. /* */
  11. /* Redistributions of source code must retain the above copyright */
  12. /* notice, this list of conditions and the following disclaimer. */
  13. /* */
  14. /* Redistributions in binary form must reproduce the above copyright */
  15. /* notice, this list of conditions and the following disclaimer in */
  16. /* the documentation and/or other materials provided with the */
  17. /* distribution. */
  18. /* */
  19. /* Neither the name of Texas Instruments Incorporated nor the names */
  20. /* of its contributors may be used to endorse or promote products */
  21. /* derived from this software without specific prior written */
  22. /* permission. */
  23. /* */
  24. /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
  25. /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
  26. /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */
  27. /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
  28. /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
  29. /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
  30. /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */
  31. /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */
  32. /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  33. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */
  34. /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  35. /* */
  36. /*****************************************************************************/
  37. #ifndef _LOWLEV
  38. #define _LOWLEV
  39. #include <_mutex.h>
  40. #include <_data_synch.h>
  41. #include "file.h"
  42. typedef struct {
  43. char name[9];
  44. unsigned short flags;
  45. int (*OPEN) (const char *path, unsigned flags, int llv_fd);
  46. int (*CLOSE) (int dev_fd);
  47. int (*READ) (int dev_fd, char *buf, unsigned count);
  48. int (*WRITE) (int dev_fd, const char *buf, unsigned count);
  49. off_t (*LSEEK) (int dev_fd, off_t offset, int origin);
  50. int (*UNLINK) (const char *path);
  51. int (*RENAME) (const char *old_name, const char *new_name);
  52. } _DEVICE;
  53. struct stream_info { _DEVICE *dev; int dfd; };
  54. extern _DEVICE _device[_NDEVICE];
  55. extern struct stream_info _stream[_NSTREAM];
  56. extern _CODE_ACCESS _DEVICE *finddevice(const char *devname);
  57. extern _DEVICE *getdevice (const char **path);
  58. #define stdevice (&_device[0]) /* Default device (host) */
  59. #endif