vdr  2.2.0
hdffcmd_remote.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 HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol)
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;
45  BitBuffer_SetBits(&cmdBuf, 8, Protocol);
46  osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
47  return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
48 }
49 
50 int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address)
51 {
52  uint8_t cmdData[12];
53  BitBuffer_t cmdBuf;
54  osd_raw_cmd_t osd_cmd;
55 
56  BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData));
57  memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t));
58  osd_cmd.cmd_data = cmdData;
62  BitBuffer_SetBits(&cmdBuf, 1, Enable);
63  BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved
64  BitBuffer_SetBits(&cmdBuf, 32, Address);
65  osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf);
66  return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd);
67 }
void BitBuffer_SetBits(BitBuffer_t *BitBuffer, int NumBits, uint32_t Data)
Definition: bitbuffer.c:37
const void * cmd_data
Definition: hdffcmd_base.h:31
int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol)
uint32_t HdffCmdSetLength(BitBuffer_t *MsgBuf)
Definition: hdffcmd_base.c:36
void BitBuffer_Init(BitBuffer_t *BitBuffer, uint8_t *Data, uint32_t MaxLength)
Definition: bitbuffer.c:28
void HdffCmdBuildHeader(BitBuffer_t *MsgBuf, HdffMessageType_t MsgType, HdffMessageGroup_t MsgGroup, HdffMessageId_t MsgId)
Definition: hdffcmd_base.c:26
#define OSD_RAW_CMD
Definition: hdffcmd_base.h:43
int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address)
HdffRemoteProtocol_t