mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 23:42:43 +02:00
all: clean up pwrmngr header file
Origin commit data
------------------
Branch: master
Commit: 5ccc49af32
Author: max_10 <max_10@gmx.de>
Date: 2018-03-22 (Thu, 22 Mar 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -6,7 +6,6 @@ AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/libeplayer3/include
|
||||
|
||||
AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing
|
||||
|
||||
AM_LDFLAGS = \
|
||||
-lOpenThreads \
|
||||
@AVFORMAT_LIBS@ \
|
||||
@@ -23,7 +22,6 @@ libspark_la_SOURCES = \
|
||||
audio_mixer.cpp \
|
||||
init.cpp \
|
||||
playback_libeplayer3.cpp \
|
||||
pwrmngr.cpp \
|
||||
record.cpp
|
||||
|
||||
AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
|
||||
|
@@ -1,102 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "pwrmngr.h"
|
||||
#include "lt_debug.h"
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args)
|
||||
void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
/* those function dummies return true or "harmless" values */
|
||||
bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
unsigned long cCpuFreqManager::GetCpuFreq(void) {
|
||||
int freq = 0;
|
||||
if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) {
|
||||
char buffer[120];
|
||||
while(fgets(buffer, sizeof(buffer), pll0)) {
|
||||
if (1 == sscanf(buffer, "SH4 = %d MHZ", &freq))
|
||||
break;
|
||||
}
|
||||
fclose(pll0);
|
||||
return 1000 * 1000 * (unsigned long) freq;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; }
|
||||
#endif
|
||||
unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; }
|
||||
//
|
||||
cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
|
||||
bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
|
||||
bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; }
|
||||
void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
//
|
||||
bool cPowerManager::SetStandby(bool Active, bool Passive)
|
||||
{
|
||||
lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cCpuFreqManager::SetCpuFreq(unsigned long f)
|
||||
{
|
||||
#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE
|
||||
if (f) {
|
||||
FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w");
|
||||
if (pll0) {
|
||||
f /= 1000000;
|
||||
fprintf(pll0, "%lu\n", (f/10 << 8) | 3);
|
||||
fclose (pll0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* actually SetCpuFreq is used to determine if the system is in standby
|
||||
this is an "elegant" hack, because:
|
||||
* during a recording, cpu freq is kept "high", even if the box is sent to standby
|
||||
* the "SetStandby" call is made even if a recording is running
|
||||
On the TD, setting standby disables the frontend, so we must not do it
|
||||
if a recording is running.
|
||||
For now, the values in neutrino are hardcoded:
|
||||
* f == 0 => max => not standby
|
||||
* f == 50000000 => min => standby
|
||||
*/
|
||||
lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false");
|
||||
#if 0
|
||||
int fd = open("/dev/stb/tdsystem", O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("open tdsystem");
|
||||
return false;
|
||||
}
|
||||
if (f)
|
||||
{
|
||||
ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */
|
||||
ioctl(fd, IOC_AVS_STANDBY_ENTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */
|
||||
ioctl(fd, IOC_AVS_STANDBY_LEAVE);
|
||||
/* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */
|
||||
// ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */
|
||||
}
|
||||
|
||||
close(fd);
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); }
|
||||
cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); }
|
||||
|
@@ -1,53 +0,0 @@
|
||||
#ifndef __PWRMNGR_H__
|
||||
#define __PWRMNGR_H__
|
||||
|
||||
// -- cCpuFreqManager ----------------------------------------------------------
|
||||
|
||||
class cCpuFreqManager {
|
||||
private:
|
||||
unsigned long startCpuFreq;
|
||||
unsigned long delta;
|
||||
public:
|
||||
void Up(void);
|
||||
void Down(void);
|
||||
void Reset(void);
|
||||
//
|
||||
bool SetCpuFreq(unsigned long CpuFreq);
|
||||
bool SetDelta(unsigned long Delta);
|
||||
unsigned long GetCpuFreq(void);
|
||||
unsigned long GetDelta(void);
|
||||
//
|
||||
cCpuFreqManager(void);
|
||||
|
||||
};
|
||||
|
||||
// -- cPowerManageger ----------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PWR_INIT = 1,
|
||||
PWR_FULL_ACTIVE, /* all devices/clocks up */
|
||||
PWR_ACTIVE_STANDBY,
|
||||
PWR_PASSIVE_STANDBY,
|
||||
PWR_INVALID
|
||||
} PWR_STATE;
|
||||
|
||||
class cPowerManager {
|
||||
private:
|
||||
bool init;
|
||||
bool opened;
|
||||
PWR_STATE powerState;
|
||||
//
|
||||
static void ApplicationCallback(void *, void *, signed long, void *, void *) {}
|
||||
bool SetState(PWR_STATE PowerState);
|
||||
public:
|
||||
bool Open(void);
|
||||
void Close(void);
|
||||
//
|
||||
bool SetStandby(bool Active, bool Passive);
|
||||
//
|
||||
cPowerManager(void);
|
||||
virtual ~cPowerManager();
|
||||
};
|
||||
|
||||
#endif // __PWRMNGR_H__
|
Reference in New Issue
Block a user