Skip to content

Commit

Permalink
support for turning on the qpu
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjhall committed Mar 14, 2014
1 parent afff2ca commit 224f379
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
49 changes: 49 additions & 0 deletions vc_support.c
Expand Up @@ -25,6 +25,55 @@
#endif

/****** VC MAILBOX FUNCTIONALITY ******/
unsigned int QpuEnable(bool e)
{
struct vc_msg
{
unsigned int m_msgSize;
unsigned int m_response;

struct vc_tag
{
unsigned int m_tagId;
unsigned int m_sendBufferSize;
unsigned int m_sendDataSize;

struct args
{
unsigned int m_enable;
} m_args;
} m_tag;
unsigned int m_endTag;
} msg;
int s;

msg.m_msgSize = sizeof(msg);
msg.m_response = 0;
msg.m_endTag = 0;

//the enable/disable tag
msg.m_tag.m_tagId = 0x30012;
msg.m_tag.m_sendBufferSize = 4;
msg.m_tag.m_sendDataSize = 4;

//which option we want
msg.m_tag.m_args.m_enable = e;

//run the command
s = bcm_mailbox_property(&msg, sizeof(msg));

if (s == 0 && msg.m_response == 0x80000000)
{
printk(KERN_DEBUG "qpu %s\n", e ? "ENABLED" : "DISABLED");
return 0;
}
else
{
printk(KERN_ERR "failed to toggle qpu state\n");
return 1;
}
}

unsigned int AllocateVcMemory(unsigned int *pHandle, unsigned int size, unsigned int alignment, unsigned int flags)
{
struct vc_msg
Expand Down
2 changes: 2 additions & 0 deletions vc_support.h
Expand Up @@ -58,6 +58,8 @@ enum {
MEM_FLAG_HINT_PERMALOCK = 1 << 6, /* Likely to be locked for long periods of time. */
};

unsigned int QpuEnable(bool e);

unsigned int AllocateVcMemory(unsigned int *pHandle, unsigned int size, unsigned int alignment, unsigned int flags);
unsigned int ReleaseVcMemory(unsigned int handle);
unsigned int LockVcMemory(unsigned int *pBusAddress, unsigned int handle);
Expand Down

0 comments on commit 224f379

Please sign in to comment.