diff --git a/lib/libcoolstream/control.h b/lib/libcoolstream/control.h new file mode 100644 index 000000000..cc41c6c72 --- /dev/null +++ b/lib/libcoolstream/control.h @@ -0,0 +1,67 @@ +/******************************************************************** +* Description: Control driver for PWM and Scart +* Author: CoolStream Dev. Team +* Created at: Fri Jun 26 08:11:43 CEST 2009 +* +* Copyright (c) 2009 CoolStream International Ltd. All rights reserved. +* +********************************************************************/ + +#ifndef __CONTROL_H +#define __CONTROL_H + +#ifndef __KERNEL__ +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +#include + +#else +#include +#include +#endif + +#include "tsrouter.h" + +typedef struct _scart_status { + bool widescreen; + bool function; + bool fastblank; +} scart_status_t; + +typedef struct _pwm_status { + u16 pwm_pulse_first; + u16 pwm_pulse_second; + u32 pwm_clock; +} pwm_status_t; + +typedef struct cs_control_data { + scart_status_t scart_status; + pwm_status_t pwm_status; + bool hdd_power; + u32 readers; + u32 sys_serial_high, sys_serial_low; + u32 sys_revision; +} cs_control_data_t; + +/* ioctls */ +#define CS_CONTROL_MAGIC 0xDE +#define IOC_CONTROL_WIDESCREEN _IOW(CS_CONTROL_MAGIC, 20, unsigned int) +#define IOC_CONTROL_TVAV _IOW(CS_CONTROL_MAGIC, 21, unsigned int) +#define IOC_CONTROL_RGB _IOW(CS_CONTROL_MAGIC, 22, unsigned int) +#define IOC_CONTROL_SCART_STATUS _IOR(CS_CONTROL_MAGIC, 23, scart_status_t *) +#define IOC_CONTROL_PWM_SPEED _IOW(CS_CONTROL_MAGIC, 24, unsigned int) +#define IOC_CONTROL_HDDPOWER _IOW(CS_CONTROL_MAGIC, 25, unsigned int) + +/* ioctl for getting board serial and revision */ +#define IOC_CONTROL_BOARD_SERIAL_LOW _IOR(CS_CONTROL_MAGIC, 26, unsigned int *) +#define IOC_CONTROL_BOARD_SERIAL_HIGH _IOR(CS_CONTROL_MAGIC, 27, unsigned int *) +#define IOC_CONTROL_BOARD_REV _IOR(CS_CONTROL_MAGIC, 28, unsigned int *) + +/* ioctl for setting TS routing */ +#define IOC_CONTROL_TSROUTE_GET_HSDP_CONFIG _IOR(CS_CONTROL_MAGIC, 29, tsrouter_hsdp_config_t *) +#define IOC_CONTROL_TSROUTE_SET_HSDP_CONFIG _IOW(CS_CONTROL_MAGIC, 30, tsrouter_tsp_config_t *) +#define IOC_CONTROL_TSROUTE_GET_TSP_CONFIG _IOR(CS_CONTROL_MAGIC, 31, tsrouter_hsdp_config_t *) +#define IOC_CONTROL_TSROUTE_SET_TSP_CONFIG _IOW(CS_CONTROL_MAGIC, 32, tsrouter_tsp_config_t *) + +#endif /* __CONTROL_H */ diff --git a/lib/libcoolstream/cs_vfd.h b/lib/libcoolstream/cs_vfd.h new file mode 100755 index 000000000..13b4b933d --- /dev/null +++ b/lib/libcoolstream/cs_vfd.h @@ -0,0 +1,102 @@ +/* + * Driver for the Samsung HCR-13SS22 VF-Display connected to the Conexant + * CX2450x (Nevis) SoC via Coolstream VFD-Controller - public definititons. + * + * Copyright (C) 2008 Coolstream International Limited + */ + +#ifndef __CS_VFD__ +#define __CS_VFD__ + +typedef enum +{ + VFD_ICON_BAR8 = 0x00000004, + VFD_ICON_BAR7 = 0x00000008, + VFD_ICON_BAR6 = 0x00000010, + VFD_ICON_BAR5 = 0x00000020, + VFD_ICON_BAR4 = 0x00000040, + VFD_ICON_BAR3 = 0x00000080, + VFD_ICON_BAR2 = 0x00000100, + VFD_ICON_BAR1 = 0x00000200, + VFD_ICON_FRAME = 0x00000400, + VFD_ICON_HDD = 0x00000800, + VFD_ICON_MUTE = 0x00001000, + VFD_ICON_DOLBY = 0x00002000, + VFD_ICON_POWER = 0x00004000, + VFD_ICON_TIMESHIFT = 0x00008000, + VFD_ICON_SIGNAL = 0x00010000, + VFD_ICON_TV = 0x00020000, + VFD_ICON_RADIO = 0x00040000, + VFD_ICON_HD = 0x01000001, + VFD_ICON_1080P = 0x02000001, + VFD_ICON_1080I = 0x03000001, + VFD_ICON_720P = 0x04000001, + VFD_ICON_480P = 0x05000001, + VFD_ICON_480I = 0x06000001, + VFD_ICON_USB = 0x07000001, + VFD_ICON_MP3 = 0x08000001, + VFD_ICON_PLAY = 0x09000001, + VFD_ICON_COL1 = 0x09000002, + VFD_ICON_PAUSE = 0x0A000001, + VFD_ICON_CAM1 = 0x0B000001, + VFD_ICON_COL2 = 0x0B000002, + VFD_ICON_CAM2 = 0x0C000001 +} vfd_icon; + +typedef enum +{ + VFD_FLAG_NONE = 0x00, + VFD_FLAG_SCROLL_ON = 0x01, /* switch scrolling on */ + VFD_FLAG_SCROLL_LTR = 0x02, /* scroll from left to rightinstead of default right to left direction (i.e. for arabic text) */ + VFD_FLAG_SCROLL_SIO = 0x04, /* start/stop scrolling with empty screen (scroll in/out) */ + VFD_FLAG_SCROLL_DELAY = 0x08, /* delayed scroll start */ + VFD_FLAG_ALIGN_LEFT = 0x10, /* align the text in display from the left (default) */ + VFD_FLAG_ALIGN_RIGHT = 0x20, /* align the text in display from the right (arabic) */ + VFD_FLAG_UPDATE_SCROLL_POS = 0x40, /* update the current position for scrolling */ +} vfd_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; +} standby_data_t; + +typedef enum { + VFD_LED_1_ON = 0x81, + VFD_LED_2_ON = 0x82, + VFD_LED_3_ON = 0x83, + VFD_LED_1_OFF = 0x01, + VFD_LED_2_OFF = 0x02, + VFD_LED_3_OFF = 0x03, +} vfd_led_ctrl_t; + +typedef struct { + unsigned char source; + unsigned char time_minutes_hi; + unsigned char time_minutes_lo; +} wakeup_data_t; + +typedef enum +{ + WAKEUP_SOURCE_TIMER = 0x01, + WAKEUP_SOURCE_BUTTON = 0x02, + WAKEUP_SOURCE_REMOTE = 0x04, + WAKEUP_SOURCE_PWLOST = 0x7F, + WAKEUP_SOURCE_POWER = 0xFF +} wakeup_source; + +#define IOC_VFD_SET_BRIGHT _IOW(0xDE, 1, unsigned char) /* set the display brighness in 16 steps between 0 to 15 */ +#define IOC_VFD_CLEAR_ALL _IOW(0xDE, 2, unsigned int) /* clear the entire display (both text and icons) */ +#define IOC_VFD_SET_TEXT _IOW(0xDE, 3, char*) /* set a text to be displayed on the display. If arg == NULL, the text is cleared */ +#define IOC_VFD_SET_ICON _IOW(0xDE, 4, vfd_icon) /* switch the given icon on */ +#define IOC_VFD_CLEAR_ICON _IOW(0xDE, 5, vfd_icon) /* switch the given icon off */ +#define IOC_VFD_SET_OUTPUT _IOW(0xDE, 6, unsigned char) /* switch the given output on (supported by the controller, but not used in the hardware) */ +#define IOC_VFD_CLEAR_OUTPUT _IOW(0xDE, 7, unsigned char) /* switch the given output off (supported by the controller, but not used in the hardware) */ +#define IOC_VFD_STANDBY _IOW(0xDE, 8, standby_data_t *)/* switch the vfd/psu in standby (NEO and above only) */ +#define IOC_VFD_LED_CTRL _IOW(0xDE, 9, unsigned char) /* control the Frontpanles LED's (NEO and above only) */ +#define IOC_VFD_GET_WAKEUP _IOW(0xDE, 10,wakeup_data_t *) /* get wakeup data (NEO and above only) */ + +#endif /* __CS_VFD__ */ diff --git a/lib/libcoolstream/nevis_ir.h b/lib/libcoolstream/nevis_ir.h new file mode 100644 index 000000000..0774a150c --- /dev/null +++ b/lib/libcoolstream/nevis_ir.h @@ -0,0 +1,84 @@ +/* + * public definitions for the CX2450x Infrared receiver driver + * + * Copyright (C) 2008-2011 Coolstream International Limited + * + */ + +#ifndef __NEVIS_IR_H__ +#define __NEVIS_IR_H__ + +typedef enum +{ + IR_PROTOCOL_UNKNOWN = 0x00000, + IR_PROTOCOL_RMAP = 0x00001, /* Ruwido rMAP */ + IR_PROTOCOL_RMAP_E = 0x00002, /* Ruwido rMAP with extension for MNC Ltd sp. z o.o. */ + IR_PROTOCOL_NRC17 = 0x00004, /* Nokia NRC17 */ + IR_PROTOCOL_JVC = 0x00008, /* JVC */ + IR_PROTOCOL_RCA = 0x00010, /* RCA */ + IR_PROTOCOL_PSD = 0x00020, /* Precision Squared (not yet supported) */ + IR_PROTOCOL_RC5 = 0x00040, /* Philips RC5 */ + IR_PROTOCOL_RCMM = 0x00080, /* Philips RCMM */ + IR_PROTOCOL_RECS80 = 0x00100, /* Philips RECS80 */ + IR_PROTOCOL_NEC = 0x00200, /* NEC */ + IR_PROTOCOL_NECE = 0x00400, /* NEC with 16 bit address capability */ + IR_PROTOCOL_SCA = 0x00800, /* Scientific Atlanta */ + IR_PROTOCOL_MATSUSHITA = 0x01000, /* Matsushita (Technics/Panasonics) */ + IR_PROTOCOL_SONY = 0x02000, /* Sony SIRC 12 bit */ + IR_PROTOCOL_SONY15 = 0x04000, /* Sony SIRC 15 bit */ + IR_PROTOCOL_SONY20 = 0x08000, /* Sony SIRC 20 bit */ + IR_PROTOCOL_SONY24 = 0x10000, /* Sony SIRC 24 bit */ + IR_PROTOCOL_ALL = 0x1FFFF +} ir_protocol_t; + +typedef enum +{ + FP_MODE_KEYS_DISABLED = 0, + FP_MODE_KEYS_ENABLED = 1 +} fp_mode_t; + +#define EVENT_KEY_UP 0 +#define EVENT_KEY_DOWN 1 +#define NEVIS_IR_DEVICE_NAME "IR_NEVIS" + +/*******************************************************************************/ +/* DEBUG options */ +/*******************************************************************************/ + +#define DBG_NONE 0x00000000 /* no debug at all */ + +#define DBG_IR_SYSTEM 0x00000001 /* IR: low level informations */ +#define DBG_IR_DECODE 0x00000002 /* IR: informations from the IR protocol decoder */ +#define DBG_OUTPUT_QUEUE 0x00000004 /* IR: show data from the outgoing queue (from driver to the client(s) ) */ +#define DBG_IR_FOPS 0x00000008 /* IR: informations about filoe operations (ioctl's) */ + +#define DBG_VFD_SYSTEM 0x00010000 /* VFD: low level informations */ +#define DBG_VFD_FOPS 0x00080000 /* VFD: informations about filoe operations (ioctl's) */ + +/*******************************************************************************/ +/* ioctl's */ +/*******************************************************************************/ + +/* set the IR-protocols to listen for. */ +#define IOC_IR_SET_PRI_PROTOCOL _IOW(0xDD, 1, ir_protocol_t) /* set the primary IR-protocol */ +#define IOC_IR_SET_SEC_PROTOCOL _IOW(0xDD, 2, ir_protocol_t) /* set the secondary IR-protocol */ + +/* some IR-protocols can handle different device addresses. */ +#define IOC_IR_SET_PRI_ADDRESS _IOW(0xDD, 3, unsigned int) /* set the primary IR-address */ +#define IOC_IR_SET_SEC_ADDRESS _IOW(0xDD, 4, unsigned int) /* set the secondary IR-address */ + +/* defines the delay time between two pulses in milliseconds */ +#define IOC_IR_SET_F_DELAY _IOW(0xDD, 5, unsigned int) /* set the delay time before the first repetition */ +#define IOC_IR_SET_X_DELAY _IOW(0xDD, 6, unsigned int) /* set the delay time between all other repetitions */ + +/* load key mappings to translate from raw IR to Linux Input */ +#define IOC_IR_SET_PRI_KEYMAP _IOW(0xDD, 7, unsigned short *) /* set the primary keymap [num entries],[entry 1],[entry 2],...,[entry n] (max 0xFFFF entries) */ +#define IOC_IR_SET_SEC_KEYMAP _IOW(0xDD, 8, unsigned short *) /* set the secondary keymap [num entries],[entry 1],[entry 2],...,[entry n] (max 0xFFFF entries) */ + +/* frontpanel button options */ +#define IOC_IR_SET_FP_MODE _IOW(0xDD, 9, fp_mode_t) /* enable/disable frontpanel buttons */ + +/* informative stuff */ +#define IOC_IR_GET_PROTOCOLS _IOR(0xDD, 10, ir_protocol_t) /* reports a bitmask of all supported ir_protocols */ + +#endif /* __NEVIS_IR_H__ */ diff --git a/lib/libcoolstream/tsrouter.h b/lib/libcoolstream/tsrouter.h new file mode 100644 index 000000000..672d6721d --- /dev/null +++ b/lib/libcoolstream/tsrouter.h @@ -0,0 +1,32 @@ +#ifndef __TSROUTER_H +#define __TSROUTER_H + +typedef struct _tsrouter_hsdp_config { + u8 port; + u32 port_ctrl; + u32 pkt_ctrl; + u32 clk_ctrl; + u32 mux; + u32 int_en; + /* more ? */ +} tsrouter_hsdp_config_t; + +typedef struct _tsrouter_tsp_config { + u8 port; + u32 port_ctrl; + u32 mux; +} tsrouter_tsp_config_t; + +extern int cs_tsrouter_init(void); +extern void cs_tsrouter_exit(void); + +extern void cs_tsx_hsdp_init_port(u32 port, u32 ctrl); +extern void cs_tsx_tsp_init_port(u32 port, u32 hsdp_port); + +extern void cs_tsx_hsdp_get_port_config(tsrouter_hsdp_config_t *conf); +extern void cs_tsx_tsp_get_port_config(tsrouter_tsp_config_t *conf); + +extern void cs_tsx_hsdp_set_port_config(const tsrouter_hsdp_config_t *conf); +extern void cs_tsx_tsp_set_port_config(const tsrouter_tsp_config_t *conf); + +#endif /* __TSROUTER_H */