vdr
1.7.27
|
00001 /********************************************************************** 00002 * 00003 * HDFF firmware command interface library 00004 * 00005 * Copyright (C) 2011 Andreas Regel 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the 00019 * Free Software Foundation, Inc., 00020 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 * 00022 *********************************************************************/ 00023 00024 #include <stdint.h> 00025 #include <string.h> 00026 #include <sys/ioctl.h> 00027 00028 #include "hdffcmd.h" 00029 #include "hdffcmd_base.h" 00030 #include "hdffcmd_defs.h" 00031 00032 00033 int HdffCmdRemoteSetProtocol(int OsdDevice, HdffRemoteProtocol_t Protocol) 00034 { 00035 uint8_t cmdData[8]; 00036 BitBuffer_t cmdBuf; 00037 osd_raw_cmd_t osd_cmd; 00038 00039 BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData)); 00040 memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t)); 00041 osd_cmd.cmd_data = cmdData; 00042 HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, 00043 HDFF_MSG_GROUP_REMOTE_CONTROL, 00044 HDFF_MSG_REMOTE_SET_PROTOCOL); 00045 BitBuffer_SetBits(&cmdBuf, 8, Protocol); 00046 osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf); 00047 return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd); 00048 } 00049 00050 int HdffCmdRemoteSetAddressFilter(int OsdDevice, int Enable, uint32_t Address) 00051 { 00052 uint8_t cmdData[12]; 00053 BitBuffer_t cmdBuf; 00054 osd_raw_cmd_t osd_cmd; 00055 00056 BitBuffer_Init(&cmdBuf, cmdData, sizeof(cmdData)); 00057 memset(&osd_cmd, 0, sizeof(osd_raw_cmd_t)); 00058 osd_cmd.cmd_data = cmdData; 00059 HdffCmdBuildHeader(&cmdBuf, HDFF_MSG_TYPE_COMMAND, 00060 HDFF_MSG_GROUP_REMOTE_CONTROL, 00061 HDFF_MSG_REMOTE_SET_ADDRESS_FILTER); 00062 BitBuffer_SetBits(&cmdBuf, 1, Enable); 00063 BitBuffer_SetBits(&cmdBuf, 7, 0); // reserved 00064 BitBuffer_SetBits(&cmdBuf, 32, Address); 00065 osd_cmd.cmd_len = HdffCmdSetLength(&cmdBuf); 00066 return ioctl(OsdDevice, OSD_RAW_CMD, &osd_cmd); 00067 }