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 12 #ifndef __MBOX_H__ 13 #define __MBOX_H__ 14 15 /* a properly aligned buffer */ 16 extern volatile unsigned int* mbox; 17 18 #define MBOX_REQUEST 0 19 20 /* channels */ 21 #define MBOX_CH_POWER 0 22 #define MBOX_CH_FB 1 23 #define MBOX_CH_VUART 2 24 #define MBOX_CH_VCHIQ 3 25 #define MBOX_CH_LEDS 4 26 #define MBOX_CH_BTNS 5 27 #define MBOX_CH_TOUCH 6 28 #define MBOX_CH_COUNT 7 29 #define MBOX_CH_PROP 8 30 31 /* tags */ 32 #define MBOX_TAG_SETPOWER 0x28001 33 #define MBOX_TAG_SETCLKRATE 0x38002 34 #define MBOX_GET_MAC_ADDRESS 0x10003 35 #define MBOX_GET_CLOCK_RATE 0x30002 36 #define MBOX_SET_CLOCK_RATE 0x38002 37 #define MBOX_TAG_LAST 0 38 39 #define MMIO_BASE 0x3F000000 40 #define VIDEOCORE_MBOX (MMIO_BASE+0x0000B880) 41 #define MBOX_READ ((volatile unsigned int*)(VIDEOCORE_MBOX+0x0)) 42 #define MBOX_POLL ((volatile unsigned int*)(VIDEOCORE_MBOX+0x10)) 43 #define MBOX_SENDER ((volatile unsigned int*)(VIDEOCORE_MBOX+0x14)) 44 #define MBOX_STATUS ((volatile unsigned int*)(VIDEOCORE_MBOX+0x18)) 45 #define MBOX_CONFIG ((volatile unsigned int*)(VIDEOCORE_MBOX+0x1C)) 46 #define MBOX_WRITE ((volatile unsigned int*)(VIDEOCORE_MBOX+0x20)) 47 #define MBOX_RESPONSE 0x80000000 48 #define MBOX_FULL 0x80000000 49 #define MBOX_EMPTY 0x40000000 50 51 #define DEVICE_ID_SD_CARD 0 52 #define DEVICE_ID_USB_HCD 3 53 #define POWER_STATE_OFF (0 << 0) 54 #define POWER_STATE_ON (1 << 0) 55 #define POWER_STATE_WAIT (1 << 1) 56 #define POWER_STATE_NO_DEVICE (1 << 1) // in response 57 #define MMU_ENABLE 1 58 #define MMU_DISABLE 0 59 60 #define MBOX_ADDR 0xc00000 61 62 int mbox_call(unsigned char ch, int mmu_enable); 63 #endif 64