[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / linux / RBP.cpp
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://www.xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #include "RBP.h"
22 #if defined(TARGET_RASPBERRY_PI)
23
24 #include "utils/log.h"
25
26 CRBP::CRBP()
27 {
28   m_initialized     = false;
29   m_omx_initialized = false;
30   m_DllBcmHost      = new DllBcmHost();
31   m_OMX             = new COMXCore();
32 }
33
34 CRBP::~CRBP()
35 {
36   Deinitialize();
37   delete m_OMX;
38   delete m_DllBcmHost;
39 }
40
41 bool CRBP::Initialize()
42 {
43   m_initialized = m_DllBcmHost->Load();
44   if(!m_initialized)
45     return false;
46
47   m_DllBcmHost->bcm_host_init();
48
49   m_omx_initialized = m_OMX->Initialize();
50   if(!m_omx_initialized)
51     return false;
52
53   return true;
54 }
55
56 void CRBP::LogFirmwareVerison()
57 {
58   char  response[80];
59   m_DllBcmHost->vc_gencmd(response, sizeof response, "version");
60   CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s\n", response);
61 }
62
63 void CRBP::Deinitialize()
64 {
65   if(m_omx_initialized)
66     m_OMX->Deinitialize();
67
68   m_DllBcmHost->bcm_host_deinit();
69
70   if(m_initialized)
71     m_DllBcmHost->Unload();
72
73   m_initialized     = false;
74   m_omx_initialized = false;
75 }
76 #endif