platform_init.c 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2012, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #include "sdk.h"
  31. #include "board_io_expanders.h"
  32. #include "platform_init.h"
  33. #include "core/cortex_a9.h"
  34. #include "core/mmu.h"
  35. ////////////////////////////////////////////////////////////////////////////////
  36. // Code
  37. ////////////////////////////////////////////////////////////////////////////////
  38. void platform_init(void)
  39. {
  40. enable_neon_fpu();
  41. disable_strict_align_check();
  42. mmu_init();
  43. // Map some SDRAM for DMA
  44. #if defined(BOARD_EVB)
  45. mmu_map_l1_range(0x30000000, 0x30000000, 0x70000000, kNoncacheable, kShareable, kRWAccess);
  46. #elif defined(BOARD_SMART_DEVICE)
  47. mmu_map_l1_range(0x20000000, 0x20000000, 0x30000000, kNoncacheable, kShareable, kRWAccess);
  48. #endif
  49. // Enable interrupts. Until this point, the startup code has left interrupts disabled.
  50. gic_init();
  51. arm_set_interrupt_state(true);
  52. // Initialize clock sources, dividers, ...
  53. ccm_init();
  54. // Configure the EPIT timer used for system delay function.
  55. system_time_init();
  56. // Initialize the debug/console UART
  57. uart_init(g_debug_uart_port, 115200, PARITY_NONE, STOPBITS_ONE, EIGHTBITS, FLOWCTRL_OFF);
  58. // flush UART RX FIFO
  59. uint8_t c;
  60. do {
  61. c = uart_getchar(g_debug_uart_port);
  62. } while (c != NONE_CHAR);
  63. // Some init for the board
  64. board_ioexpander_init();
  65. }
  66. ////////////////////////////////////////////////////////////////////////////////
  67. // EOF
  68. ////////////////////////////////////////////////////////////////////////////////