- includes: some manual code nicenings

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-11-07 00:57:01 +01:00
committed by Thilo Graf
parent 52192c7ba5
commit adb876646f
9 changed files with 141 additions and 179 deletions

View File

@@ -5,9 +5,10 @@
#include "cs_types.h"
#include <vector>
#include <set>
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
enum CA_INIT_MASK
{
@@ -25,29 +26,29 @@ enum CA_SLOT_TYPE
enum CA_MESSAGE_FLAGS
{
CA_MESSAGE_EMPTY = (1 << 0),
CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), // Free after use!
CA_MESSAGE_HAS_PARAM1_INT = (1 << 2),
CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3),
CA_MESSAGE_HAS_PARAM2_INT = (1 << 4),
CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5),
CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6),
CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), // Free after use!
CA_MESSAGE_HAS_PARAM3_INT = (1 << 8),
CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9),
CA_MESSAGE_HAS_PARAM4_INT = (1 << 10),
CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11),
CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12),
CA_MESSAGE_HAS_PARAM5_INT = (1 << 13),
CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14),
CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15),
CA_MESSAGE_HAS_PARAM6_INT = (1 << 16),
CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17),
CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18),
CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19),
CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20),
CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21),
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22)
CA_MESSAGE_EMPTY = (1 << 0),
CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), // Free after use!
CA_MESSAGE_HAS_PARAM1_INT = (1 << 2),
CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3),
CA_MESSAGE_HAS_PARAM2_INT = (1 << 4),
CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5),
CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6),
CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), // Free after use!
CA_MESSAGE_HAS_PARAM3_INT = (1 << 8),
CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9),
CA_MESSAGE_HAS_PARAM4_INT = (1 << 10),
CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11),
CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12),
CA_MESSAGE_HAS_PARAM5_INT = (1 << 13),
CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14),
CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15),
CA_MESSAGE_HAS_PARAM6_INT = (1 << 16),
CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17),
CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18),
CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19),
CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20),
CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21),
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22)
};
enum CA_MESSAGE_MSGID
@@ -103,18 +104,12 @@ class cCA
uint32_t GetNumberSmartCardSlots(void);
static cCA *GetInstance(void);
bool SendPMT(int Unit, unsigned char *Data, int Len, CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL);
// bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/) { return true; };
// bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/) { return true; };
bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/, enum CA_SLOT_TYPE
/*SlotType*/, unsigned char /*scrambled = 0*/, ca_map_t /*camap = std::set<int>()*/, int /*mode = 0*/, bool /*enabled = false*/)
{
return true;
};
/*SlotType*/, unsigned char /*scrambled = 0*/, ca_map_t /*camap = std::set<int>()*/, int /*mode = 0*/, bool /*enabled = false*/) { return true; };
bool SendMessage(const CA_MESSAGE *Msg);
void SetInitMask(enum CA_INIT_MASK InitMask);
int GetCAIDS(CaIdVector & /*Caids*/)
{
return 0;
};
int GetCAIDS(CaIdVector & /*Caids*/) { return 0; };
bool Start(void);
void Stop(void);
void Ready(bool Set);
@@ -125,21 +120,12 @@ class cCA
void MenuAnswer(enum CA_SLOT_TYPE, uint32_t Slot, uint32_t choice);
void InputAnswer(enum CA_SLOT_TYPE, uint32_t Slot, uint8_t *Data, int Len);
void MenuClose(enum CA_SLOT_TYPE, uint32_t Slot);
void SetTSClock(u32 /*Speed*/, int /*slot*/)
{
return;
};
bool checkChannelID(u64 /*chanID*/)
{
return false;
};
void setCheckLiveSlot(int /*check*/)
{
return;
};
void SetTSClock(u32 /*Speed*/, int /*slot*/) { return; };
bool checkChannelID(u64 /*chanID*/) { return false; };
void setCheckLiveSlot(int /*check*/) { return; };
/// start pollthread after zapit is ready
virtual void setZapitReady(){zapitReady = true;};
virtual bool getZapitReady(){return zapitReady;};
virtual void setZapitReady() { zapitReady = true; };
virtual bool getZapitReady() { return zapitReady; };
/// Virtual destructor
virtual ~cCA();
};

View File

@@ -15,20 +15,20 @@
#include "cs_api.h"
/* constants taken from dvb-apps */
#define T_SB 0x80 // sb primitive h<--m
#define T_RCV 0x81 // receive primitive h-->m
#define T_CREATE_T_C 0x82 // create transport connection primitive h-->m
#define T_C_T_C_REPLY 0x83 // ctc reply primitive h<--m
#define T_DELETE_T_C 0x84 // delete tc primitive h<->m
#define T_D_T_C_REPLY 0x85 // dtc reply primitive h<->m
#define T_REQUEST_T_C 0x86 // request transport connection primitive h<--m
#define T_NEW_T_C 0x87 // new tc / reply to t_request primitive h-->m
#define T_T_C_ERROR 0x77 // error creating tc primitive h-->m
#define T_DATA_LAST 0xA0 // convey data from higher constructed h<->m
#define T_DATA_MORE 0xA1 // convey data from higher constructed h<->m
#define T_SB 0x80 // sb primitive h<--m
#define T_RCV 0x81 // receive primitive h-->m
#define T_CREATE_T_C 0x82 // create transport connection primitive h-->m
#define T_C_T_C_REPLY 0x83 // ctc reply primitive h<--m
#define T_DELETE_T_C 0x84 // delete tc primitive h<->m
#define T_D_T_C_REPLY 0x85 // dtc reply primitive h<->m
#define T_REQUEST_T_C 0x86 // request transport connection primitive h<--m
#define T_NEW_T_C 0x87 // new tc / reply to t_request primitive h-->m
#define T_T_C_ERROR 0x77 // error creating tc primitive h-->m
#define T_DATA_LAST 0xA0 // convey data from higher constructed h<->m
#define T_DATA_MORE 0xA1 // convey data from higher constructed h<->m
/* max multi decrypt per ci-cam */
#define CI_MAX_MULTI 5
#define CI_MAX_MULTI 5
enum CA_INIT_MASK
{
@@ -46,29 +46,29 @@ enum CA_SLOT_TYPE
enum CA_MESSAGE_FLAGS
{
CA_MESSAGE_EMPTY = (1 << 0),
CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), /// Free after use!
CA_MESSAGE_HAS_PARAM1_INT = (1 << 2),
CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3),
CA_MESSAGE_HAS_PARAM2_INT = (1 << 4),
CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5),
CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6),
CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), /// Free after use!
CA_MESSAGE_HAS_PARAM3_INT = (1 << 8),
CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9),
CA_MESSAGE_HAS_PARAM4_INT = (1 << 10),
CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11),
CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12),
CA_MESSAGE_HAS_PARAM5_INT = (1 << 13),
CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14),
CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15),
CA_MESSAGE_HAS_PARAM6_INT = (1 << 16),
CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17),
CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18),
CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19),
CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20),
CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21),
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22)
CA_MESSAGE_EMPTY = (1 << 0),
CA_MESSAGE_HAS_PARAM1_DATA = (1 << 1), /// Free after use!
CA_MESSAGE_HAS_PARAM1_INT = (1 << 2),
CA_MESSAGE_HAS_PARAM1_PTR = (1 << 3),
CA_MESSAGE_HAS_PARAM2_INT = (1 << 4),
CA_MESSAGE_HAS_PARAM2_PTR = (1 << 5),
CA_MESSAGE_HAS_PARAM2_DATA = (1 << 6),
CA_MESSAGE_HAS_PARAM3_DATA = (1 << 7), /// Free after use!
CA_MESSAGE_HAS_PARAM3_INT = (1 << 8),
CA_MESSAGE_HAS_PARAM3_PTR = (1 << 9),
CA_MESSAGE_HAS_PARAM4_INT = (1 << 10),
CA_MESSAGE_HAS_PARAM4_PTR = (1 << 11),
CA_MESSAGE_HAS_PARAM4_DATA = (1 << 12),
CA_MESSAGE_HAS_PARAM5_INT = (1 << 13),
CA_MESSAGE_HAS_PARAM5_PTR = (1 << 14),
CA_MESSAGE_HAS_PARAM5_DATA = (1 << 15),
CA_MESSAGE_HAS_PARAM6_INT = (1 << 16),
CA_MESSAGE_HAS_PARAM6_PTR = (1 << 17),
CA_MESSAGE_HAS_PARAM6_DATA = (1 << 18),
CA_MESSAGE_HAS_PARAM1_LONG = (1 << 19),
CA_MESSAGE_HAS_PARAM2_LONG = (1 << 20),
CA_MESSAGE_HAS_PARAM3_LONG = (1 << 21),
CA_MESSAGE_HAS_PARAM4_LONG = (1 << 22)
};
enum CA_MESSAGE_MSGID
@@ -113,19 +113,19 @@ typedef struct CA_MESSAGE
typedef std::set<int> ca_map_t;
typedef ca_map_t::iterator ca_map_iterator_t;
typedef std::vector<u16> bSIDVector;
typedef std::vector<u16> bSIDVector;
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
typedef std::vector<u16> CaIdVector;
typedef std::vector<u16>::iterator CaIdVectorIterator;
typedef std::vector<u16>::const_iterator CaIdVectorConstIterator;
#define CA_MESSAGE_SIZE sizeof(CA_MESSAGE)
#define CA_MESSAGE_ENTRIES 256
#define CA_MESSAGE_ENTRIES_CI 128
#define CA_MESSAGE_ENTRIES_SC 64
#define CA_MESSAGE_SIZE sizeof(CA_MESSAGE)
#define CA_MESSAGE_ENTRIES 256
#define CA_MESSAGE_ENTRIES_CI 128
#define CA_MESSAGE_ENTRIES_SC 64
#ifndef CS_CA_PDATA
#define CS_CA_PDATA void
#define CS_CA_PDATA void
#endif
typedef enum
@@ -376,7 +376,7 @@ class cCA
int GetCAIDS(CaIdVector &Caids);
/// Send a CA-PMT object and Raw unparsed PMT to the CA layer
bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL,
unsigned char scrambled = 0, ca_map_t camap = std::set<int>(), int mode = 0, bool enabled = false);
unsigned char scrambled = 0, ca_map_t camap = std::set<int>(), int mode = 0, bool enabled = false);
/// sh4 unused
bool SendDateTime(void);
/// the main loop
@@ -388,8 +388,8 @@ class cCA
/// as the name says
bool CheckCerts(void);
/// start pollthread after zapit is ready
virtual void setZapitReady(){zapitReady = true;};
virtual bool getZapitReady(){return zapitReady;};
virtual void setZapitReady() { zapitReady = true; };
virtual bool getZapitReady() { return zapitReady; };
/// Virtual destructor
virtual ~cCA();
};

View File

@@ -19,8 +19,8 @@ inline void cs_api_exit()
hal_api_exit();
};
#define cs_malloc_uncached malloc
#define cs_free_uncached free
#define cs_malloc_uncached malloc
#define cs_free_uncached free
// Callback function helpers
#if HAVE_DUCKBOX_HARDWARE \
@@ -33,25 +33,13 @@ inline void cs_api_exit()
)
void cs_register_messenger(cs_messenger messenger);
#else
static inline void cs_register_messenger(cs_messenger)
{
return;
};
static inline void cs_register_messenger(cs_messenger) { return; };
#endif
static inline void cs_deregister_messenger(void)
{
return;
};
static inline void cs_deregister_messenger(void) { return; };
/* compat... HD1 seems to be version 6. everything newer ist > 6... */
static inline unsigned int cs_get_revision(void)
{
return 1;
};
static inline unsigned int cs_get_chip_type(void)
{
return 0;
};
static inline unsigned int cs_get_revision(void) { return 1; };
static inline unsigned int cs_get_chip_type(void) { return 0; };
extern int cnxt_debug;
#endif // __CS_API_H__

View File

@@ -251,41 +251,41 @@ typedef enum
typedef enum
{
FP_FLAG_NONE = 0x00,
FP_FLAG_SCROLL_ON = 0x01, /* switch scrolling on */
FP_FLAG_SCROLL_LTR = 0x02, /* scroll from left to rightinstead of default right to left direction (i.e. for arabic text) */
FP_FLAG_SCROLL_SIO = 0x04, /* start/stop scrolling with empty screen (scroll in/out) */
FP_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */
FP_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */
FP_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */
FP_FLAG_UPDATE_SCROLL_POS = 0x40, /* update the current position for scrolling */
FP_FLAG_NONE = 0x00,
FP_FLAG_SCROLL_ON = 0x01, /* switch scrolling on */
FP_FLAG_SCROLL_LTR = 0x02, /* scroll from left to rightinstead of default right to left direction (i.e. for arabic text) */
FP_FLAG_SCROLL_SIO = 0x04, /* start/stop scrolling with empty screen (scroll in/out) */
FP_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */
FP_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */
FP_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */
FP_FLAG_UPDATE_SCROLL_POS = 0x40, /* update the current position for scrolling */
} fp_flag;
typedef struct
{
unsigned char brightness;
unsigned char flags;
unsigned char current_hour;
unsigned char current_minute;
unsigned char timer_minutes_hi;
unsigned char timer_minutes_lo;
unsigned char brightness;
unsigned char flags;
unsigned char current_hour;
unsigned char current_minute;
unsigned char timer_minutes_hi;
unsigned char timer_minutes_lo;
} fp_standby_data_t;
typedef enum
{
FP_LED_1_ON = 0x81,
FP_LED_2_ON = 0x82,
FP_LED_3_ON = 0x83,
FP_LED_1_OFF = 0x01,
FP_LED_2_OFF = 0x02,
FP_LED_3_OFF = 0x03
FP_LED_1_ON = 0x81,
FP_LED_2_ON = 0x82,
FP_LED_3_ON = 0x83,
FP_LED_1_OFF = 0x01,
FP_LED_2_OFF = 0x02,
FP_LED_3_OFF = 0x03
} fp_led_ctrl_t;
typedef struct
{
unsigned char source;
unsigned char time_minutes_hi;
unsigned char time_minutes_lo;
unsigned char source;
unsigned char time_minutes_hi;
unsigned char time_minutes_lo;
} fp_wakeup_data_t;
typedef enum
@@ -299,20 +299,20 @@ typedef enum
typedef struct
{
unsigned short addr;
unsigned short cmd;
unsigned short addr;
unsigned short cmd;
} fp_standby_cmd_data_t;
typedef enum
{
FP_DISPLAY_TEXT_NONE = 0,
FP_DISPLAY_TEXT_NONE = 0,
FP_DISPLAY_TEXT_LIMITED,
FP_DISPLAY_TEXT_ALL
} fp_display_text_type_t;
typedef enum
{
FP_DISPLAY_TYPE_NONE = 0,
FP_DISPLAY_TYPE_NONE = 0,
FP_DISPLAY_TYPE_VFD,
FP_DISPLAY_TYPE_OLED,
FP_DISPLAY_TYPE_LED_SEGMENT
@@ -320,11 +320,11 @@ typedef enum
typedef struct
{
fp_display_type_t display_type;
unsigned short xres, yres;
unsigned int segment_count;
fp_display_text_type_t text_support;
bool number_support;
fp_display_type_t display_type;
unsigned short xres, yres;
unsigned int segment_count;
fp_display_text_type_t text_support;
bool number_support;
} fp_display_caps_t;
#endif // __CS_FRONTPANEL_H__

View File

@@ -11,13 +11,13 @@ typedef enum
AVSYNC_AUDIO_IS_MASTER
} AVSYNC_TYPE;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;
#endif // __CS_TYPES_H__

View File

@@ -92,19 +92,13 @@ class cDemux
void SetSyncMode(AVSYNC_TYPE mode);
void *getBuffer();
void *getChannel();
DMX_CHANNEL_TYPE getChannelType(void)
{
return dmx_type;
};
DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; };
bool addPid(unsigned short pid);
void getSTC(int64_t *STC);
int getUnit(void);
static bool SetSource(int unit, int source);
static int GetSource(int unit);
int getFD(void)
{
return fd;
}; /* needed by cPlayback class */
int getFD(void) { return fd; }; /* needed by cPlayback class */
cDemux(int num = 0);
~cDemux();
private:

View File

@@ -28,15 +28,9 @@ class GLFramebuffer : public OpenThreads::Thread
public:
GLFramebuffer(int x, int y);
~GLFramebuffer();
std::vector<unsigned char> *getOSDBuffer()
{
return &osd_buf; /* pointer to OSD bounce buffer */
}
std::vector<unsigned char> *getOSDBuffer() { return &osd_buf; } /* pointer to OSD bounce buffer */
void blit();
fb_var_screeninfo getScreenInfo()
{
return si;
}
fb_var_screeninfo getScreenInfo() { return si; }
private:
fb_var_screeninfo si;
@@ -44,7 +38,7 @@ class GLFramebuffer : public OpenThreads::Thread
void run(); /* for OpenThreads::Thread */
void setup();
void blit_osd();
void *pdata; /* not yet used */
void *pdata; /* not yet used */
};
#endif // __GLFB_H__

View File

@@ -17,7 +17,7 @@ typedef enum
HW_DISPLAY_NONE,
HW_DISPLAY_LED_ONLY,
HW_DISPLAY_LED_NUM, /* simple 7 segment LED display */
HW_DISPLAY_LINE_TEXT, /* 1 line text display */
HW_DISPLAY_LINE_TEXT, /* 1 line text display */
HW_DISPLAY_GFX
} display_type_t;
@@ -35,11 +35,11 @@ typedef struct hw_caps
int can_cpufreq;
int can_shutdown;
int can_cec;
int can_ar_14_9; /* video drivers have 14:9 aspect ratio mode */
int can_ps_14_9; /* video drivers have 14:9 panscan mode */
int can_ar_14_9; /* video drivers have 14:9 aspect ratio mode */
int can_ps_14_9; /* video drivers have 14:9 panscan mode */
int force_tuner_2G; /* force DVB-S2 even though driver may not advertise it */
display_type_t display_type;
int display_xres; /* x resolution or chars per line */
int display_xres; /* x resolution or chars per line */
int display_yres;
int display_can_umlauts;
int display_can_deepstandby;

View File

@@ -1,9 +1,9 @@
#ifndef __MMI_H__
#define __MMI_H__
#define MAX_MMI_ITEMS 40
#define MAX_MMI_TEXT_LEN 255
#define MAX_MMI_CHOICE_TEXT_LEN 255
#define MAX_MMI_ITEMS 40
#define MAX_MMI_TEXT_LEN 255
#define MAX_MMI_CHOICE_TEXT_LEN 255
typedef enum
{
@@ -49,7 +49,7 @@ typedef struct
} MMI_ENQUIRY_INFO;
/* compat */
#define enguiryText enquiryText
#define enguiryText enquiryText
#define MMI_ENGUIRY_INFO MMI_ENQUIRY_INFO
#endif // __MMI_H__