mbox.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * File : mbox.h
  3. * Copyright (c) 2006-2018, RT-Thread Development Team
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2019-08-29 zdzn first version
  10. */
  11. #ifndef __MBOX_H__
  12. #define __MBOX_H__
  13. /* a properly aligned buffer */
  14. extern volatile unsigned int* mbox;
  15. #define MBOX_REQUEST 0
  16. /* channels */
  17. #define MBOX_CH_POWER 0
  18. #define MBOX_CH_FB 1
  19. #define MBOX_CH_VUART 2
  20. #define MBOX_CH_VCHIQ 3
  21. #define MBOX_CH_LEDS 4
  22. #define MBOX_CH_BTNS 5
  23. #define MBOX_CH_TOUCH 6
  24. #define MBOX_CH_COUNT 7
  25. #define MBOX_CH_PROP 8
  26. /* tags */
  27. #define MBOX_TAG_SETPOWER 0x28001
  28. #define MBOX_TAG_SETCLKRATE 0x38002
  29. #define MBOX_GET_MAC_ADDRESS 0x10003
  30. #define MBOX_TAG_LAST 0
  31. #define MMIO_BASE 0x3F000000
  32. #define VIDEOCORE_MBOX (MMIO_BASE+0x0000B880)
  33. #define MBOX_READ ((volatile unsigned int*)(VIDEOCORE_MBOX+0x0))
  34. #define MBOX_POLL ((volatile unsigned int*)(VIDEOCORE_MBOX+0x10))
  35. #define MBOX_SENDER ((volatile unsigned int*)(VIDEOCORE_MBOX+0x14))
  36. #define MBOX_STATUS ((volatile unsigned int*)(VIDEOCORE_MBOX+0x18))
  37. #define MBOX_CONFIG ((volatile unsigned int*)(VIDEOCORE_MBOX+0x1C))
  38. #define MBOX_WRITE ((volatile unsigned int*)(VIDEOCORE_MBOX+0x20))
  39. #define MBOX_RESPONSE 0x80000000
  40. #define MBOX_FULL 0x80000000
  41. #define MBOX_EMPTY 0x40000000
  42. #define DEVICE_ID_SD_CARD 0
  43. #define DEVICE_ID_USB_HCD 3
  44. #define POWER_STATE_OFF (0 << 0)
  45. #define POWER_STATE_ON (1 << 0)
  46. #define POWER_STATE_WAIT (1 << 1)
  47. #define POWER_STATE_NO_DEVICE (1 << 1) // in response
  48. #define MMU_ENABLE 1
  49. #define MMU_DISABLE 0
  50. #define MBOX_ADDR 0xc00000
  51. int mbox_call(unsigned char ch, int mmu_enable);
  52. #endif