vdr
2.0.4
Main Page
Namespaces
Classes
Files
File List
File Members
PLUGINS
src
dvbhddevice
libhdffcmd
hdffcmd_hdmi.c
Go to the documentation of this file.
1
/**********************************************************************
2
*
3
* HDFF firmware command interface library
4
*
5
* Copyright (C) 2011 Andreas Regel
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the
19
* Free Software Foundation, Inc.,
20
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
*
22
*********************************************************************/
23
24
#include <stdint.h>
25
#include <string.h>
26
#include <sys/ioctl.h>
27
28
#include "
hdffcmd.h
"
29
#include "
hdffcmd_base.h
"
30
#include "
hdffcmd_defs.h
"
31
32
33
int
HdffCmdHdmiSetVideoMode
(
int
OsdDevice,
HdffVideoMode_t
VideoMode)
34
{
35
uint8_t cmdData[8];
36
BitBuffer_t
cmdBuf;
37
osd_raw_cmd_t
osd_cmd;
38
39
BitBuffer_Init
(&cmdBuf, cmdData,
sizeof
(cmdData));
40
memset(&osd_cmd, 0,
sizeof
(
osd_raw_cmd_t
));
41
osd_cmd.
cmd_data
= cmdData;
42
HdffCmdBuildHeader
(&cmdBuf,
HDFF_MSG_TYPE_COMMAND
,
HDFF_MSG_GROUP_HDMI
,
43
HDFF_MSG_HDMI_SET_VIDEO_MODE
);
44
BitBuffer_SetBits
(&cmdBuf, 8, VideoMode);
45
osd_cmd.
cmd_len
=
HdffCmdSetLength
(&cmdBuf);
46
return
ioctl(OsdDevice,
OSD_RAW_CMD
, &osd_cmd);
47
}
48
49
int
HdffCmdHdmiConfigure
(
int
OsdDevice,
const
HdffHdmiConfig_t
* Config)
50
{
51
uint8_t cmdData[24];
52
BitBuffer_t
cmdBuf;
53
osd_raw_cmd_t
osd_cmd;
54
size_t
nameLen;
55
int
i;
56
57
BitBuffer_Init
(&cmdBuf, cmdData,
sizeof
(cmdData));
58
memset(&osd_cmd, 0,
sizeof
(
osd_raw_cmd_t
));
59
osd_cmd.
cmd_data
= cmdData;
60
HdffCmdBuildHeader
(&cmdBuf,
HDFF_MSG_TYPE_COMMAND
,
HDFF_MSG_GROUP_HDMI
,
61
HDFF_MSG_HDMI_CONFIGURE
);
62
BitBuffer_SetBits
(&cmdBuf, 1, Config->
TransmitAudio
? 1 : 0);
63
BitBuffer_SetBits
(&cmdBuf, 1, Config->
ForceDviMode
? 1 : 0);
64
BitBuffer_SetBits
(&cmdBuf, 1, Config->
CecEnabled
? 1 : 0);
65
BitBuffer_SetBits
(&cmdBuf, 3, Config->
VideoModeAdaption
);
66
BitBuffer_SetBits
(&cmdBuf, 6, 0);
// reserved
67
nameLen = strlen(Config->
CecDeviceName
);
68
if
(nameLen > 13)
69
nameLen = 13;
70
BitBuffer_SetBits
(&cmdBuf, 4, nameLen);
71
for
(i = 0; i < nameLen; i++)
72
BitBuffer_SetBits
(&cmdBuf, 8, Config->
CecDeviceName
[i]);
73
74
osd_cmd.
cmd_len
=
HdffCmdSetLength
(&cmdBuf);
75
return
ioctl(OsdDevice,
OSD_RAW_CMD
, &osd_cmd);
76
}
77
78
int
HdffCmdHdmiSendCecCommand
(
int
OsdDevice,
HdffCecCommand_t
Command)
79
{
80
uint8_t cmdData[8];
81
BitBuffer_t
cmdBuf;
82
osd_raw_cmd_t
osd_cmd;
83
84
BitBuffer_Init
(&cmdBuf, cmdData,
sizeof
(cmdData));
85
memset(&osd_cmd, 0,
sizeof
(
osd_raw_cmd_t
));
86
osd_cmd.
cmd_data
= cmdData;
87
HdffCmdBuildHeader
(&cmdBuf,
HDFF_MSG_TYPE_COMMAND
,
HDFF_MSG_GROUP_HDMI
,
88
HDFF_MSG_HDMI_SEND_CEC_COMMAND
);
89
BitBuffer_SetBits
(&cmdBuf, 8, Command);
90
osd_cmd.
cmd_len
=
HdffCmdSetLength
(&cmdBuf);
91
return
ioctl(OsdDevice,
OSD_RAW_CMD
, &osd_cmd);
92
}
93
94
int
HdffCmdHdmiSendRawCecCommand
(
int
OsdDevice, uint8_t Destination,
95
uint8_t Opcode,
const
uint8_t * Operand,
96
uint8_t OperandLength)
97
{
98
uint8_t cmdData[24];
99
BitBuffer_t
cmdBuf;
100
osd_raw_cmd_t
osd_cmd;
101
int
i;
102
103
if
(OperandLength > 14)
104
OperandLength = 14;
105
106
BitBuffer_Init
(&cmdBuf, cmdData,
sizeof
(cmdData));
107
memset(&osd_cmd, 0,
sizeof
(
osd_raw_cmd_t
));
108
osd_cmd.
cmd_data
= cmdData;
109
HdffCmdBuildHeader
(&cmdBuf,
HDFF_MSG_TYPE_COMMAND
,
HDFF_MSG_GROUP_HDMI
,
110
HDFF_MSG_HDMI_SEND_RAW_CEC_COMMAND
);
111
BitBuffer_SetBits
(&cmdBuf, 4, 0);
// reserved
112
BitBuffer_SetBits
(&cmdBuf, 4, Destination);
113
BitBuffer_SetBits
(&cmdBuf, 8, Opcode);
114
BitBuffer_SetBits
(&cmdBuf, 8, OperandLength);
115
for
(i = 0; i < OperandLength; i++)
116
BitBuffer_SetBits
(&cmdBuf, 8, Operand[i]);
117
118
osd_cmd.
cmd_len
=
HdffCmdSetLength
(&cmdBuf);
119
return
ioctl(OsdDevice,
OSD_RAW_CMD
, &osd_cmd);
120
}
121
Generated by
1.8.3.1