File tree 1 file changed +28
-5
lines changed 1 file changed +28
-5
lines changed Original file line number Diff line number Diff line change 49
49
#define MAIL_TAGS 0x8 // Mailbox Channel 8: Tags (ARM to VC)
50
50
51
51
#define TAG_GET_BOARD_REVISION 0x00010002 // Hardware: Get Board Revision (Response: Board Revision)
52
+ #define TAG_SET_POWER_STATE 0x00028001 // Power: Set Power State (Response: Device ID, State)
53
+
54
+ #define POWER_STATE_OFF (0 << 0)
55
+ #define POWER_STATE_ON (1 << 0)
56
+
57
+ //
58
+ // Power: Unique Device ID's
59
+ //
60
+ #define PWR_USB_HCD_ID 0x3 // USB HCD
52
61
53
62
//
54
63
// System Timers
@@ -204,13 +213,27 @@ int GetBoardRevision (void)
204
213
205
214
int SetPowerStateOn (unsigned nDeviceId )
206
215
{
207
- mbox_write (0 , 0x80 );
208
- if (mbox_read (0 ) != 0x80 )
209
- {
210
- return 0 ;
216
+ unsigned int mb_addr = 0x40007000 ; // 0x7000 in L2 cache coherent mode
217
+ volatile unsigned int * mailbuffer = (unsigned int * ) mb_addr ;
218
+
219
+ mailbuffer [0 ] = 8 * 4 ; // size of this message
220
+ mailbuffer [1 ] = 0 ; // this is a request
221
+
222
+ mailbuffer [2 ] = TAG_SET_POWER_STATE ;
223
+ mailbuffer [3 ] = 8 ; // value buffer size
224
+ mailbuffer [4 ] = 8 ; // request/response
225
+ mailbuffer [5 ] = PWR_USB_HCD_ID ; // device id
226
+ mailbuffer [6 ] = POWER_STATE_ON ; // power state
227
+
228
+ mailbuffer [7 ] = 0 ;
229
+ mbox_write (MAIL_TAGS , mb_addr );
230
+
231
+ mbox_read (MAIL_TAGS );
232
+ if (mailbuffer [1 ] == MAIL_FULL ) {
233
+ return 1 ;
211
234
}
212
235
213
- return 1 ;
236
+ return 0 ;
214
237
}
215
238
216
239
int GetMACAddress (unsigned char Buffer [6 ])
You can’t perform that action at this time.
0 commit comments