glue.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * (C) Copyright 2007 Semihalf
  3. *
  4. * Written by: Rafal Jaworowski <raj@semihalf.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. *
  24. */
  25. /*
  26. * This is the header file for conveniency wrapper routines (API glue)
  27. */
  28. #ifndef _API_GLUE_H_
  29. #define _API_GLUE_H_
  30. #define API_SEARCH_LEN (3 * 1024 * 1024) /* 3MB search range */
  31. #define UB_MAX_MR 5 /* max mem regions number */
  32. #define UB_MAX_DEV 6 /* max devices number */
  33. extern void *syscall_ptr;
  34. extern uint32_t search_hint;
  35. int syscall(int, int *, ...);
  36. int api_search_sig(struct api_signature **sig);
  37. /*
  38. * The ub_ library calls are part of the application, not U-Boot code! They
  39. * are front-end wrappers that are used by the consumer application: they
  40. * prepare arguments for particular syscall and jump to the low level
  41. * syscall()
  42. */
  43. /* console */
  44. int ub_getc(void);
  45. int ub_tstc(void);
  46. void ub_putc(char c);
  47. void ub_puts(const char *s);
  48. /* system */
  49. void ub_reset(void);
  50. struct sys_info * ub_get_sys_info(void);
  51. /* time */
  52. void ub_udelay(unsigned long);
  53. unsigned long ub_get_timer(unsigned long);
  54. /* env vars */
  55. char * ub_env_get(const char *name);
  56. void ub_env_set(const char *name, char *value);
  57. const char * ub_env_enum(const char *last);
  58. /* devices */
  59. int ub_dev_enum(void);
  60. int ub_dev_open(int handle);
  61. int ub_dev_close(int handle);
  62. int ub_dev_read(int handle, void *buf, lbasize_t len,
  63. lbastart_t start, lbasize_t *rlen);
  64. int ub_dev_send(int handle, void *buf, int len);
  65. int ub_dev_recv(int handle, void *buf, int len, int *rlen);
  66. struct device_info * ub_dev_get(int);
  67. #endif /* _API_GLUE_H_ */