1
0

mbox.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * File : mbox.h
  3. * Copyright (c) 2006-2021, 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_GET_CLOCK_RATE 0x30002
  31. #define MBOX_SET_CLOCK_RATE 0x38002
  32. #define MBOX_TAG_LAST 0
  33. #define MMIO_BASE 0x3F000000
  34. #define VIDEOCORE_MBOX (MMIO_BASE+0x0000B880)
  35. #define MBOX_READ ((volatile unsigned int*)(VIDEOCORE_MBOX+0x0))
  36. #define MBOX_POLL ((volatile unsigned int*)(VIDEOCORE_MBOX+0x10))
  37. #define MBOX_SENDER ((volatile unsigned int*)(VIDEOCORE_MBOX+0x14))
  38. #define MBOX_STATUS ((volatile unsigned int*)(VIDEOCORE_MBOX+0x18))
  39. #define MBOX_CONFIG ((volatile unsigned int*)(VIDEOCORE_MBOX+0x1C))
  40. #define MBOX_WRITE ((volatile unsigned int*)(VIDEOCORE_MBOX+0x20))
  41. #define MBOX_RESPONSE 0x80000000
  42. #define MBOX_FULL 0x80000000
  43. #define MBOX_EMPTY 0x40000000
  44. #define DEVICE_ID_SD_CARD 0
  45. #define DEVICE_ID_USB_HCD 3
  46. #define POWER_STATE_OFF (0 << 0)
  47. #define POWER_STATE_ON (1 << 0)
  48. #define POWER_STATE_WAIT (1 << 1)
  49. #define POWER_STATE_NO_DEVICE (1 << 1) // in response
  50. #define MMU_ENABLE 1
  51. #define MMU_DISABLE 0
  52. #define MBOX_ADDR 0xc00000
  53. int mbox_call(unsigned char ch, int mmu_enable);
  54. #endif