board.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * (C) Copyright 2004 Atmark Techno, Inc.
  3. *
  4. * Yasushi SHOJI <yashi@atmark-techno.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. #include <common.h>
  25. #include <command.h>
  26. #include <malloc.h>
  27. #include <version.h>
  28. const char version_string[] =
  29. U_BOOT_VERSION" (" __DATE__ " - " __TIME__ ")";
  30. /*
  31. * Begin and End of memory area for malloc(), and current "brk"
  32. */
  33. static ulong mem_malloc_start;
  34. static ulong mem_malloc_end;
  35. static ulong mem_malloc_brk;
  36. void *sbrk (ptrdiff_t increment)
  37. {
  38. ulong old = mem_malloc_brk;
  39. ulong new = old + increment;
  40. if ((new < mem_malloc_start) || (new > mem_malloc_end)) {
  41. return (NULL);
  42. }
  43. mem_malloc_brk = new;
  44. return ((void *) old);
  45. }
  46. /*
  47. * All attempts to come up with a "common" initialization sequence
  48. * that works for all boards and architectures failed: some of the
  49. * requirements are just _too_ different. To get rid of the resulting
  50. * mess of board dependend #ifdef'ed code we now make the whole
  51. * initialization sequence configurable to the user.
  52. *
  53. * The requirements for any new initalization function is simple: it
  54. * receives a pointer to the "global data" structure as it's only
  55. * argument, and returns an integer return code, where 0 means
  56. * "continue" and != 0 means "fatal error, hang the system".
  57. */
  58. typedef int (init_fnc_t) (void);
  59. init_fnc_t *init_sequence[] = {
  60. serial_init, /* serial communications setup */
  61. NULL,
  62. };
  63. void hang (void)
  64. {
  65. puts ("### ERROR ### Please RESET the board ###\n");
  66. for (;;);
  67. }