README 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c) 2009 Openmoko Inc.
  3. *
  4. * Authors Daniel Mack <daniel@caiaq.de>
  5. * Holger Hans Peter Freyther <zecke@openmoko.com>
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. 1) CONCEPT
  21. Mahatma is our mini-kernel. Is is in fact not even worth the name 'kernel',
  22. as it is not more than a thin abstraction layer and some calls to wiki-lib,
  23. the library which has all the core functionality.
  24. In short, the flow thru the system from Mahatma's point of view is as
  25. follows:
  26. * The kernel sets up the hardware and trap tables
  27. * wikilib_init() and guilib_init() are called to let the libraries do their
  28. neccessary initialisations
  29. * As of calling wikilib_run(), the kernel gives control to wikilib's
  30. application logic. This function does never return
  31. * Wikilib calls wl_input_wait() after some time to wait for new event so
  32. arrive, this is where the kernel gets back control
  33. * As all possible input event will cause an interrupt to occur, Mahatma
  34. makes the CPU enter HALT state and lets the interrupt controller do the
  35. rest
  36. * The interrupt service routine for each IRQ handels the hardware
  37. * After that, each subsystem which is able to create input events is polled
  38. once. If there was an incoming event, control is given back to wikilib to
  39. handle it. Otherwise, Mahatma goes to sleep again so the game starts over.
  40. 2) MEMORY MAP
  41. Because we want to switch off the external SDRAM during HALT mode, code
  42. doing that and calling __asm__("halt") must be located outside the RAM
  43. area mapped to external components. Mahatma's linker script stores routines
  44. which are involved in interrupt handling and system suspend/resume to the
  45. DST RAM section. In particular, all symbols and functions from traps.c and
  46. suspend.c are handled like that.