提交 7963eb43 编写于 作者: J Jarod Wilson 提交者: Greg Kroah-Hartman

staging: add Broadcom Crystal HD driver

This patch supersedes the earlier ones sent by Manu Abraham to add
the Broadcom Crystal HD driver to the staging tree, per discussion
with him about it. I've been working with Broadcom's Naren Sankar
on this driver for a number of months, and had already talked Naren
about submitting this on Broadcom's behalf, didn't expect anyone
else to jump on submitting it as quickly as Manu did. ;)

This version is a one-shot deal, incorporating the original driver,
Manu's coding style clean-ups, udev device creation support from
Edgar 'gimli' Hucek, and a number of other small tweaks from myself
and Scott Davilla, the other individual who has been working closely
on this code with Naren and I.

I've tested this iteration of the code lightly on a mini pci-e board
in a ThinkPad T61p running x86_64 Fedora 12, with the expected results,
and will test further on other systems with other variants of the card
(I have three varieties of this device currently in hand). Scott has
also tested on assorted primarily i686 varieties of Ubuntu, and Naren
has tested with both Fedora and Ubuntu, iirc.

Note: only the 70012 is currently supported by this driver, 70015
support will follow later. Also note that Blu-Ray support isn't
enabled (at the firmware level), due to misc fun related to the
BD encryption scheme, DRM, etc. :\

I *do* have a git tree containing the driver, lib, gst plugin and
firmware that I'm working from at the moment[*], as there are inter-
dependencies between the driver and lib, and the driver can be used
with kernels going a ways back (I've only tested back to 2.6.18 as
it exists in Red Hat Enterprise Linux 5). I'm exporting from there,
into a linux-next tree, then generating patches from there. The goal
is to feed everything upstream as quickly as possible, but there are
users who want this code for earlier kernels too...

The firmware will be submitted for inclusion in dwmw2's linux-firmware
tree once there is a suitable redistribution-no-modification type of
license on it (I believe Naren is working with Broadcom legal to get
that in place).

Changelog from initial Broadcom release to here:

commit d20475d444610c5683d09e63f707f5bb22359062
Author: Jarod Wilson <jarod@redhat.com>
Date:   Mon Jan 4 13:55:16 2010 -0500

    include: lib doesn't build w/o the removed stdint include
    
    So add it back...
Signed-off-by: NJarod Wilson <jarod@redhat.com>

commit c181070a330530b792d2b80e3ec6ab12a5a57394
Author: Scott Davilla <davilla@4pi.com>
Date:   Mon Jan 4 13:38:37 2010 -0500

    include: don't define VOID if its already defined
Signed-off-by: NScott Davilla <davilla@4pi.com>
Signed-off-by: NJarod Wilson <jarod@redhat.com>

commit 33d8a2b691e81212e398f53770578d79650bf0bc
Author: Jarod Wilson <jarod@redhat.com>
Date:   Mon Jan 4 13:12:10 2010 -0500

    driver: create crystalhd device using udev
    
    Based on:
    http://sourceforge.net/apps/trac/archvdr/browser/trunk/archvdr/crystalhd/use_udev.patch
    
    Signed-off-by: Edgar ( gimli ) Hucek <ebsi4711 at gmail dot com>
    
    Formatting tweaks, error-handling path fixups and any bugs added by Jarod.
Signed-off-by: NJarod Wilson <jarod@redhat.com>

commit c44c64dea5537814796fcbe2d9db0209383c78b9
Author: Manu Abraham <abraham.manu@gmail.com>
Date:   Mon Jan 4 10:32:47 2010 -0500

    crystalhd: coding style cleanups
Signed-off-by: NManu Abraham <abraham.manu@gmail.com>
Signed-off-by: NJarod Wilson <jarod@redhat.com>

commit cffa6da7467ff697a656d1dfff54bb0513a053dc
Author: Jarod Wilson <jarod@redhat.com>
Date:   Mon Jan 4 10:17:27 2010 -0500

    crystalhd: run dos2unix over everything, this is linux source...
Signed-off-by: NJarod Wilson <jarod@redhat.com>

commit 7fa38a282db7af5a5746055f7c6cef8a9b8ee138
Author: Jarod Wilson <jarod@redhat.com>
Date:   Mon Jan 4 10:02:33 2010 -0500

    crystalhd: initial import of released Broadcom code
    
    Straight import of:
    http://www.broadcom.com/docs/support/crystalhd/crystalhd_linux_20091229.zip
    
    Unfortunately, we're unable to publicly publish all the history that got
    us from the initial internal code to what was released here, but such is
    life, we can just be happy we've got this open-sourced now. :)
Signed-off-by: NJarod Wilson <jarod@redhat.com>
Signed-off-by: NNaren Sankar <nsankar@broadcom.com>
Signed-off-by: NScott Davilla <davilla@4pi.com>
Signed-off-by: NManu Abraham <abraham.manu@gmail.com>
Signed-off-by: NJarod Wilson <jarod@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 ca1f29c0
...@@ -139,5 +139,7 @@ source "drivers/staging/sm7xx/Kconfig" ...@@ -139,5 +139,7 @@ source "drivers/staging/sm7xx/Kconfig"
source "drivers/staging/dt3155/Kconfig" source "drivers/staging/dt3155/Kconfig"
source "drivers/staging/crystalhd/Kconfig"
endif # !STAGING_EXCLUDE_BUILD endif # !STAGING_EXCLUDE_BUILD
endif # STAGING endif # STAGING
...@@ -51,3 +51,4 @@ obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan/ ...@@ -51,3 +51,4 @@ obj-$(CONFIG_PCMCIA_WAVELAN) += wavelan/
obj-$(CONFIG_PCMCIA_NETWAVE) += netwave/ obj-$(CONFIG_PCMCIA_NETWAVE) += netwave/
obj-$(CONFIG_FB_SM7XX) += sm7xx/ obj-$(CONFIG_FB_SM7XX) += sm7xx/
obj-$(CONFIG_DT3155) += dt3155/ obj-$(CONFIG_DT3155) += dt3155/
obj-$(CONFIG_CRYSTALHD) += crystalhd/
config CRYSTALHD
tristate "Broadcom Crystal HD video decoder support"
depends on PCI
default n
help
Support for the Broadcom Crystal HD video decoder chipset
obj-$(CONFIG_CRYSTALHD) += crystalhd.o
crystalhd-objs := crystalhd_cmds.o \
crystalhd_hw.o \
crystalhd_lnx.o \
crystalhd_misc.o
- Testing
- Cleanup return codes
- Cleanup typedefs
- Cleanup all WIN* references
- Allocate an Accelerator device class specific Major number,
since we don't have any other open sourced accelerators, it is the only
one in that category for now.
A somewhat similar device is the DXR2/3
Please send patches to:
Greg Kroah-Hartman <greg@kroah.com>
Naren Sankar <nsankar@broadcom.com>
Jarod Wilson <jarod@wilsonet.com>
Scott Davilla <davilla@4pi.com>
Manu Abraham <abraham.manu@gmail.com>
/********************************************************************
* Copyright(c) 2006-2009 Broadcom Corporation.
*
* Name: bc_dts_defs.h
*
* Description: Common definitions for all components. Only types
* is allowed to be included from this file.
*
* AU
*
* HISTORY:
*
********************************************************************
* This header is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 2.1 of the License.
*
* This header is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this header. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************/
#ifndef _BC_DTS_DEFS_H_
#define _BC_DTS_DEFS_H_
#include "bc_dts_types.h"
/* BIT Mask */
#define BC_BIT(_x) (1 << (_x))
typedef enum _BC_STATUS {
BC_STS_SUCCESS = 0,
BC_STS_INV_ARG = 1,
BC_STS_BUSY = 2,
BC_STS_NOT_IMPL = 3,
BC_STS_PGM_QUIT = 4,
BC_STS_NO_ACCESS = 5,
BC_STS_INSUFF_RES = 6,
BC_STS_IO_ERROR = 7,
BC_STS_NO_DATA = 8,
BC_STS_VER_MISMATCH = 9,
BC_STS_TIMEOUT = 10,
BC_STS_FW_CMD_ERR = 11,
BC_STS_DEC_NOT_OPEN = 12,
BC_STS_ERR_USAGE = 13,
BC_STS_IO_USER_ABORT = 14,
BC_STS_IO_XFR_ERROR = 15,
BC_STS_DEC_NOT_STARTED = 16,
BC_STS_FWHEX_NOT_FOUND = 17,
BC_STS_FMT_CHANGE = 18,
BC_STS_HIF_ACCESS = 19,
BC_STS_CMD_CANCELLED = 20,
BC_STS_FW_AUTH_FAILED = 21,
BC_STS_BOOTLOADER_FAILED = 22,
BC_STS_CERT_VERIFY_ERROR = 23,
BC_STS_DEC_EXIST_OPEN = 24,
BC_STS_PENDING = 25,
BC_STS_CLK_NOCHG = 26,
/* Must be the last one.*/
BC_STS_ERROR = -1
} BC_STATUS;
/*------------------------------------------------------*
* Registry Key Definitions *
*------------------------------------------------------*/
#define BC_REG_KEY_MAIN_PATH "Software\\Broadcom\\MediaPC\\70010"
#define BC_REG_KEY_FWPATH "FirmwareFilePath"
#define BC_REG_KEY_SEC_OPT "DbgOptions"
/*
* Options:
*
* b[5] = Enable RSA KEY in EEPROM Support
* b[6] = Enable Old PIB scheme. (0 = Use PIB with video scheme)
*
* b[12] = Enable send message to NotifyIcon
*
*/
typedef enum _BC_SW_OPTIONS {
BC_OPT_DOSER_OUT_ENCRYPT = BC_BIT(3),
BC_OPT_LINK_OUT_ENCRYPT = BC_BIT(29),
} BC_SW_OPTIONS;
typedef struct _BC_REG_CONFIG{
uint32_t DbgOptions;
} BC_REG_CONFIG;
#if defined(__KERNEL__) || defined(__LINUX_USER__)
#else
/* Align data structures */
#define ALIGN(x) __declspec(align(x))
#endif
/* mode
* b[0]..b[7] = _DtsDeviceOpenMode
* b[8] = Load new FW
* b[9] = Load file play back FW
* b[10] = Disk format (0 for HD DVD and 1 for BLU ray)
* b[11]-b[15] = default output resolution
* b[16] = Skip TX CPB Buffer Check
* b[17] = Adaptive Output Encrypt/Scramble Scheme
* b[18]-b[31] = reserved for future use
*/
/* To allow multiple apps to open the device. */
enum _DtsDeviceOpenMode {
DTS_PLAYBACK_MODE = 0,
DTS_DIAG_MODE,
DTS_MONITOR_MODE,
DTS_HWINIT_MODE
};
/* To enable the filter to selectively enable/disable fixes or erratas */
enum _DtsDeviceFixMode {
DTS_LOAD_NEW_FW = BC_BIT(8),
DTS_LOAD_FILE_PLAY_FW = BC_BIT(9),
DTS_DISK_FMT_BD = BC_BIT(10),
/* b[11]-b[15] : Default output resolution */
DTS_SKIP_TX_CHK_CPB = BC_BIT(16),
DTS_ADAPTIVE_OUTPUT_PER = BC_BIT(17),
DTS_INTELLIMAP = BC_BIT(18),
/* b[19]-b[21] : select clock frequency */
DTS_PLAYBACK_DROP_RPT_MODE = BC_BIT(22)
};
#define DTS_DFLT_RESOLUTION(x) (x<<11)
#define DTS_DFLT_CLOCK(x) (x<<19)
/* F/W File Version corresponding to S/W Releases */
enum _FW_FILE_VER {
/* S/W release: 02.04.02 F/W release 2.12.2.0 */
BC_FW_VER_020402 = ((12<<16) | (2<<8) | (0))
};
/*------------------------------------------------------*
* Stream Types for DtsOpenDecoder() *
*------------------------------------------------------*/
enum _DtsOpenDecStreamTypes {
BC_STREAM_TYPE_ES = 0,
BC_STREAM_TYPE_PES = 1,
BC_STREAM_TYPE_TS = 2,
BC_STREAM_TYPE_ES_TSTAMP = 6,
};
/*------------------------------------------------------*
* Video Algorithms for DtsSetVideoParams() *
*------------------------------------------------------*/
enum _DtsSetVideoParamsAlgo {
BC_VID_ALGO_H264 = 0,
BC_VID_ALGO_MPEG2 = 1,
BC_VID_ALGO_VC1 = 4,
BC_VID_ALGO_VC1MP = 7,
};
/*------------------------------------------------------*
* MPEG Extension to the PPB *
*------------------------------------------------------*/
#define BC_MPEG_VALID_PANSCAN (1)
typedef struct _BC_PIB_EXT_MPEG {
uint32_t valid;
/* Always valid, defaults to picture size if no
* sequence display extension in the stream. */
uint32_t display_horizontal_size;
uint32_t display_vertical_size;
/* MPEG_VALID_PANSCAN
* Offsets are a copy values from the MPEG stream. */
uint32_t offset_count;
int32_t horizontal_offset[3];
int32_t vertical_offset[3];
} BC_PIB_EXT_MPEG;
/*------------------------------------------------------*
* H.264 Extension to the PPB *
*------------------------------------------------------*/
/* Bit definitions for 'other.h264.valid' field */
#define H264_VALID_PANSCAN (1)
#define H264_VALID_SPS_CROP (2)
#define H264_VALID_VUI (4)
typedef struct _BC_PIB_EXT_H264 {
/* 'valid' specifies which fields (or sets of
* fields) below are valid. If the corresponding
* bit in 'valid' is NOT set then that field(s)
* is (are) not initialized. */
uint32_t valid;
/* H264_VALID_PANSCAN */
uint32_t pan_scan_count;
int32_t pan_scan_left[3];
int32_t pan_scan_right[3];
int32_t pan_scan_top[3];
int32_t pan_scan_bottom[3];
/* H264_VALID_SPS_CROP */
int32_t sps_crop_left;
int32_t sps_crop_right;
int32_t sps_crop_top;
int32_t sps_crop_bottom;
/* H264_VALID_VUI */
uint32_t chroma_top;
uint32_t chroma_bottom;
} BC_PIB_EXT_H264;
/*------------------------------------------------------*
* VC1 Extension to the PPB *
*------------------------------------------------------*/
#define VC1_VALID_PANSCAN (1)
typedef struct _BC_PIB_EXT_VC1 {
uint32_t valid;
/* Always valid, defaults to picture size if no
* sequence display extension in the stream. */
uint32_t display_horizontal_size;
uint32_t display_vertical_size;
/* VC1 pan scan windows */
uint32_t num_panscan_windows;
int32_t ps_horiz_offset[4];
int32_t ps_vert_offset[4];
int32_t ps_width[4];
int32_t ps_height[4];
} BC_PIB_EXT_VC1;
/*------------------------------------------------------*
* Picture Information Block *
*------------------------------------------------------*/
#if defined(_WIN32) || defined(_WIN64) || defined(__LINUX_USER__)
/* Values for 'pulldown' field. '0' means no pulldown information
* was present for this picture. */
enum {
vdecNoPulldownInfo = 0,
vdecTop = 1,
vdecBottom = 2,
vdecTopBottom = 3,
vdecBottomTop = 4,
vdecTopBottomTop = 5,
vdecBottomTopBottom = 6,
vdecFrame_X2 = 7,
vdecFrame_X3 = 8,
vdecFrame_X1 = 9,
vdecFrame_X4 = 10,
};
/* Values for the 'frame_rate' field. */
enum {
vdecFrameRateUnknown = 0,
vdecFrameRate23_97,
vdecFrameRate24,
vdecFrameRate25,
vdecFrameRate29_97,
vdecFrameRate30,
vdecFrameRate50,
vdecFrameRate59_94,
vdecFrameRate60,
};
/* Values for the 'aspect_ratio' field. */
enum {
vdecAspectRatioUnknown = 0,
vdecAspectRatioSquare,
vdecAspectRatio12_11,
vdecAspectRatio10_11,
vdecAspectRatio16_11,
vdecAspectRatio40_33,
vdecAspectRatio24_11,
vdecAspectRatio20_11,
vdecAspectRatio32_11,
vdecAspectRatio80_33,
vdecAspectRatio18_11,
vdecAspectRatio15_11,
vdecAspectRatio64_33,
vdecAspectRatio160_99,
vdecAspectRatio4_3,
vdecAspectRatio16_9,
vdecAspectRatio221_1,
vdecAspectRatioOther = 255,
};
/* Values for the 'colour_primaries' field. */
enum {
vdecColourPrimariesUnknown = 0,
vdecColourPrimariesBT709,
vdecColourPrimariesUnspecified,
vdecColourPrimariesReserved,
vdecColourPrimariesBT470_2M = 4,
vdecColourPrimariesBT470_2BG,
vdecColourPrimariesSMPTE170M,
vdecColourPrimariesSMPTE240M,
vdecColourPrimariesGenericFilm,
};
enum {
vdecRESOLUTION_CUSTOM = 0x00000000, /* custom */
vdecRESOLUTION_480i = 0x00000001, /* 480i */
vdecRESOLUTION_1080i = 0x00000002, /* 1080i (1920x1080, 60i) */
vdecRESOLUTION_NTSC = 0x00000003, /* NTSC (720x483, 60i) */
vdecRESOLUTION_480p = 0x00000004, /* 480p (720x480, 60p) */
vdecRESOLUTION_720p = 0x00000005, /* 720p (1280x720, 60p) */
vdecRESOLUTION_PAL1 = 0x00000006, /* PAL_1 (720x576, 50i) */
vdecRESOLUTION_1080i25 = 0x00000007, /* 1080i25 (1920x1080, 50i) */
vdecRESOLUTION_720p50 = 0x00000008, /* 720p50 (1280x720, 50p) */
vdecRESOLUTION_576p = 0x00000009, /* 576p (720x576, 50p) */
vdecRESOLUTION_1080i29_97 = 0x0000000A, /* 1080i (1920x1080, 59.94i) */
vdecRESOLUTION_720p59_94 = 0x0000000B, /* 720p (1280x720, 59.94p) */
vdecRESOLUTION_SD_DVD = 0x0000000C, /* SD DVD (720x483, 60i) */
vdecRESOLUTION_480p656 = 0x0000000D, /* 480p (720x480, 60p), output bus width 8 bit, clock 74.25MHz */
vdecRESOLUTION_1080p23_976 = 0x0000000E, /* 1080p23_976 (1920x1080, 23.976p) */
vdecRESOLUTION_720p23_976 = 0x0000000F, /* 720p23_976 (1280x720p, 23.976p) */
vdecRESOLUTION_240p29_97 = 0x00000010, /* 240p (1440x240, 29.97p ) */
vdecRESOLUTION_240p30 = 0x00000011, /* 240p (1440x240, 30p) */
vdecRESOLUTION_288p25 = 0x00000012, /* 288p (1440x288p, 25p) */
vdecRESOLUTION_1080p29_97 = 0x00000013, /* 1080p29_97 (1920x1080, 29.97p) */
vdecRESOLUTION_1080p30 = 0x00000014, /* 1080p30 (1920x1080, 30p) */
vdecRESOLUTION_1080p24 = 0x00000015, /* 1080p24 (1920x1080, 24p) */
vdecRESOLUTION_1080p25 = 0x00000016, /* 1080p25 (1920x1080, 25p) */
vdecRESOLUTION_720p24 = 0x00000017, /* 720p24 (1280x720, 25p) */
vdecRESOLUTION_720p29_97 = 0x00000018, /* 720p29.97 (1280x720, 29.97p) */
vdecRESOLUTION_480p23_976 = 0x00000019, /* 480p23.976 (720*480, 23.976) */
vdecRESOLUTION_480p29_97 = 0x0000001A, /* 480p29.976 (720*480, 29.97p) */
vdecRESOLUTION_576p25 = 0x0000001B, /* 576p25 (720*576, 25p) */
/* For Zero Frame Rate */
vdecRESOLUTION_480p0 = 0x0000001C, /* 480p (720x480, 0p) */
vdecRESOLUTION_480i0 = 0x0000001D, /* 480i (720x480, 0i) */
vdecRESOLUTION_576p0 = 0x0000001E, /* 576p (720x576, 0p) */
vdecRESOLUTION_720p0 = 0x0000001F, /* 720p (1280x720, 0p) */
vdecRESOLUTION_1080p0 = 0x00000020, /* 1080p (1920x1080, 0p) */
vdecRESOLUTION_1080i0 = 0x00000021, /* 1080i (1920x1080, 0i) */
};
/* Bit definitions for 'flags' field */
#define VDEC_FLAG_EOS (0x0004)
#define VDEC_FLAG_FRAME (0x0000)
#define VDEC_FLAG_FIELDPAIR (0x0008)
#define VDEC_FLAG_TOPFIELD (0x0010)
#define VDEC_FLAG_BOTTOMFIELD (0x0018)
#define VDEC_FLAG_PROGRESSIVE_SRC (0x0000)
#define VDEC_FLAG_INTERLACED_SRC (0x0020)
#define VDEC_FLAG_UNKNOWN_SRC (0x0040)
#define VDEC_FLAG_BOTTOM_FIRST (0x0080)
#define VDEC_FLAG_LAST_PICTURE (0x0100)
#define VDEC_FLAG_PICTURE_META_DATA_PRESENT (0x40000)
#endif /* _WIN32 || _WIN64 */
enum _BC_OUTPUT_FORMAT {
MODE420 = 0x0,
MODE422_YUY2 = 0x1,
MODE422_UYVY = 0x2,
};
typedef struct _BC_PIC_INFO_BLOCK {
/* Common fields. */
uint64_t timeStamp; /* Timestamp */
uint32_t picture_number; /* Ordinal display number */
uint32_t width; /* pixels */
uint32_t height; /* pixels */
uint32_t chroma_format; /* 0x420, 0x422 or 0x444 */
uint32_t pulldown;
uint32_t flags;
uint32_t frame_rate;
uint32_t aspect_ratio;
uint32_t colour_primaries;
uint32_t picture_meta_payload;
uint32_t sess_num;
uint32_t ycom;
uint32_t custom_aspect_ratio_width_height;
uint32_t n_drop; /* number of non-reference frames remaining to be dropped */
/* Protocol-specific extensions. */
union {
BC_PIB_EXT_H264 h264;
BC_PIB_EXT_MPEG mpeg;
BC_PIB_EXT_VC1 vc1;
} other;
} BC_PIC_INFO_BLOCK, *PBC_PIC_INFO_BLOCK;
/*------------------------------------------------------*
* ProcOut Info *
*------------------------------------------------------*/
/* Optional flags for ProcOut Interface.*/
enum _POUT_OPTIONAL_IN_FLAGS_{
/* Flags from App to Device */
BC_POUT_FLAGS_YV12 = 0x01, /* Copy Data in YV12 format */
BC_POUT_FLAGS_STRIDE = 0x02, /* Stride size is valid. */
BC_POUT_FLAGS_SIZE = 0x04, /* Take size information from Application */
BC_POUT_FLAGS_INTERLACED = 0x08, /* copy only half the bytes */
BC_POUT_FLAGS_INTERLEAVED = 0x10, /* interleaved frame */
/* Flags from Device to APP */
BC_POUT_FLAGS_FMT_CHANGE = 0x10000, /* Data is not VALID when this flag is set */
BC_POUT_FLAGS_PIB_VALID = 0x20000, /* PIB Information valid */
BC_POUT_FLAGS_ENCRYPTED = 0x40000, /* Data is encrypted. */
BC_POUT_FLAGS_FLD_BOT = 0x80000, /* Bottom Field data */
};
#if defined(__KERNEL__) || defined(__LINUX_USER__)
typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, void *pOut);
#else
typedef BC_STATUS(*dts_pout_callback)(void *shnd, uint32_t width, uint32_t height, uint32_t stride, struct _BC_DTS_PROC_OUT *pOut);
#endif
/* Line 21 Closed Caption */
/* User Data */
#define MAX_UD_SIZE 1792 /* 1920 - 128 */
typedef struct _BC_DTS_PROC_OUT {
uint8_t *Ybuff; /* Caller Supplied buffer for Y data */
uint32_t YbuffSz; /* Caller Supplied Y buffer size */
uint32_t YBuffDoneSz; /* Transferred Y datasize */
uint8_t *UVbuff; /* Caller Supplied buffer for UV data */
uint32_t UVbuffSz; /* Caller Supplied UV buffer size */
uint32_t UVBuffDoneSz; /* Transferred UV data size */
uint32_t StrideSz; /* Caller supplied Stride Size */
uint32_t PoutFlags; /* Call IN Flags */
uint32_t discCnt; /* Picture discontinuity count */
BC_PIC_INFO_BLOCK PicInfo; /* Picture Information Block Data */
/* Line 21 Closed Caption */
/* User Data */
uint32_t UserDataSz;
uint8_t UserData[MAX_UD_SIZE];
void *hnd;
dts_pout_callback AppCallBack;
uint8_t DropFrames;
uint8_t b422Mode; /* Picture output Mode */
uint8_t bPibEnc; /* PIB encrypted */
uint8_t bRevertScramble;
} BC_DTS_PROC_OUT;
typedef struct _BC_DTS_STATUS {
uint8_t ReadyListCount; /* Number of frames in ready list (reported by driver) */
uint8_t FreeListCount; /* Number of frame buffers free. (reported by driver) */
uint8_t PowerStateChange; /* Number of active state power transitions (reported by driver) */
uint8_t reserved_[1];
uint32_t FramesDropped; /* Number of frames dropped. (reported by DIL) */
uint32_t FramesCaptured; /* Number of frames captured. (reported by DIL) */
uint32_t FramesRepeated; /* Number of frames repeated. (reported by DIL) */
uint32_t InputCount; /* Times compressed video has been sent to the HW.
* i.e. Successful DtsProcInput() calls (reported by DIL) */
uint64_t InputTotalSize; /* Amount of compressed video that has been sent to the HW.
* (reported by DIL) */
uint32_t InputBusyCount; /* Times compressed video has attempted to be sent to the HW
* but the input FIFO was full. (reported by DIL) */
uint32_t PIBMissCount; /* Amount of times a PIB is invalid. (reported by DIL) */
uint32_t cpbEmptySize; /* supported only for H.264, specifically changed for
* Adobe. Report size of CPB buffer available.
* Reported by DIL */
uint64_t NextTimeStamp; /* TimeStamp of the next picture that will be returned
* by a call to ProcOutput. Added for Adobe. Reported
* back from the driver */
uint8_t reserved__[16];
} BC_DTS_STATUS;
#define BC_SWAP32(_v) \
((((_v) & 0xFF000000)>>24)| \
(((_v) & 0x00FF0000)>>8)| \
(((_v) & 0x0000FF00)<<8)| \
(((_v) & 0x000000FF)<<24))
#define WM_AGENT_TRAYICON_DECODER_OPEN 10001
#define WM_AGENT_TRAYICON_DECODER_CLOSE 10002
#define WM_AGENT_TRAYICON_DECODER_START 10003
#define WM_AGENT_TRAYICON_DECODER_STOP 10004
#define WM_AGENT_TRAYICON_DECODER_RUN 10005
#define WM_AGENT_TRAYICON_DECODER_PAUSE 10006
#endif /* _BC_DTS_DEFS_H_ */
/********************************************************************
* Copyright(c) 2006-2009 Broadcom Corporation.
*
* Name: bc_dts_glob_lnx.h
*
* Description: Wrapper to Windows dts_glob.h for Link-Linux usage.
* The idea is to define additional Linux related defs
* in this file to avoid changes to existing Windows
* glob file.
*
* AU
*
* HISTORY:
*
********************************************************************
* This header is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 2.1 of the License.
*
* This header is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this header. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************/
#ifndef _BC_DTS_GLOB_LNX_H_
#define _BC_DTS_GLOB_LNX_H_
#ifdef __LINUX_USER__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <sys/time.h>
#include <time.h>
#include <arpa/inet.h>
#include <asm/param.h>
#include <linux/ioctl.h>
#include <sys/select.h>
#define DRVIFLIB_INT_API
#endif
#include "bc_dts_defs.h"
#include "bcm_70012_regs.h" /* Link Register defs */
#define CRYSTALHD_API_NAME "crystalhd"
#define CRYSTALHD_API_DEV_NAME "/dev/crystalhd"
/*
* These are SW stack tunable parameters shared
* between the driver and the application.
*/
enum _BC_DTS_GLOBALS {
BC_MAX_FW_CMD_BUFF_SZ = 0x40, /* FW passthrough cmd/rsp buffer size */
PCI_CFG_SIZE = 256, /* PCI config size buffer */
BC_IOCTL_DATA_POOL_SIZE = 8, /* BC_IOCTL_DATA Pool size */
BC_LINK_MAX_OPENS = 3, /* Maximum simultaneous opens*/
BC_LINK_MAX_SGLS = 1024, /* Maximum SG elements 4M/4K */
BC_TX_LIST_CNT = 2, /* Max Tx DMA Rings */
BC_RX_LIST_CNT = 8, /* Max Rx DMA Rings*/
BC_PROC_OUTPUT_TIMEOUT = 3000, /* Milliseconds */
BC_INFIFO_THRESHOLD = 0x10000,
};
typedef struct _BC_CMD_REG_ACC {
uint32_t Offset;
uint32_t Value;
} BC_CMD_REG_ACC;
typedef struct _BC_CMD_DEV_MEM {
uint32_t StartOff;
uint32_t NumDwords;
uint32_t Rsrd;
} BC_CMD_DEV_MEM;
/* FW Passthrough command structure */
enum _bc_fw_cmd_flags {
BC_FW_CMD_FLAGS_NONE = 0,
BC_FW_CMD_PIB_QS = 0x01,
};
typedef struct _BC_FW_CMD {
uint32_t cmd[BC_MAX_FW_CMD_BUFF_SZ];
uint32_t rsp[BC_MAX_FW_CMD_BUFF_SZ];
uint32_t flags;
uint32_t add_data;
} BC_FW_CMD, *PBC_FW_CMD;
typedef struct _BC_HW_TYPE {
uint16_t PciDevId;
uint16_t PciVenId;
uint8_t HwRev;
uint8_t Align[3];
} BC_HW_TYPE;
typedef struct _BC_PCI_CFG {
uint32_t Size;
uint32_t Offset;
uint8_t pci_cfg_space[PCI_CFG_SIZE];
} BC_PCI_CFG;
typedef struct _BC_VERSION_INFO_ {
uint8_t DriverMajor;
uint8_t DriverMinor;
uint16_t DriverRevision;
} BC_VERSION_INFO;
typedef struct _BC_START_RX_CAP_ {
uint32_t Rsrd;
uint32_t StartDeliveryThsh;
uint32_t PauseThsh;
uint32_t ResumeThsh;
} BC_START_RX_CAP;
typedef struct _BC_FLUSH_RX_CAP_ {
uint32_t Rsrd;
uint32_t bDiscardOnly;
} BC_FLUSH_RX_CAP;
typedef struct _BC_DTS_STATS {
uint8_t drvRLL;
uint8_t drvFLL;
uint8_t eosDetected;
uint8_t pwr_state_change;
/* Stats from App */
uint32_t opFrameDropped;
uint32_t opFrameCaptured;
uint32_t ipSampleCnt;
uint64_t ipTotalSize;
uint32_t reptdFrames;
uint32_t pauseCount;
uint32_t pibMisses;
uint32_t discCounter;
/* Stats from Driver */
uint32_t TxFifoBsyCnt;
uint32_t intCount;
uint32_t DrvIgnIntrCnt;
uint32_t DrvTotalFrmDropped;
uint32_t DrvTotalHWErrs;
uint32_t DrvTotalPIBFlushCnt;
uint32_t DrvTotalFrmCaptured;
uint32_t DrvPIBMisses;
uint32_t DrvPauseTime;
uint32_t DrvRepeatedFrms;
uint32_t res1[13];
} BC_DTS_STATS;
typedef struct _BC_PROC_INPUT_ {
uint8_t *pDmaBuff;
uint32_t BuffSz;
uint8_t Mapped;
uint8_t Encrypted;
uint8_t Rsrd[2];
uint32_t DramOffset; /* For debug use only */
} BC_PROC_INPUT, *PBC_PROC_INPUT;
typedef struct _BC_DEC_YUV_BUFFS {
uint32_t b422Mode;
uint8_t *YuvBuff;
uint32_t YuvBuffSz;
uint32_t UVbuffOffset;
uint32_t YBuffDoneSz;
uint32_t UVBuffDoneSz;
uint32_t RefCnt;
} BC_DEC_YUV_BUFFS;
enum _DECOUT_COMPLETION_FLAGS{
COMP_FLAG_NO_INFO = 0x00,
COMP_FLAG_FMT_CHANGE = 0x01,
COMP_FLAG_PIB_VALID = 0x02,
COMP_FLAG_DATA_VALID = 0x04,
COMP_FLAG_DATA_ENC = 0x08,
COMP_FLAG_DATA_BOT = 0x10,
};
typedef struct _BC_DEC_OUT_BUFF{
BC_DEC_YUV_BUFFS OutPutBuffs;
BC_PIC_INFO_BLOCK PibInfo;
uint32_t Flags;
uint32_t BadFrCnt;
} BC_DEC_OUT_BUFF;
typedef struct _BC_NOTIFY_MODE {
uint32_t Mode;
uint32_t Rsvr[3];
} BC_NOTIFY_MODE;
typedef struct _BC_CLOCK {
uint32_t clk;
uint32_t Rsvr[3];
} BC_CLOCK;
typedef struct _BC_IOCTL_DATA {
BC_STATUS RetSts;
uint32_t IoctlDataSz;
uint32_t Timeout;
union {
BC_CMD_REG_ACC regAcc;
BC_CMD_DEV_MEM devMem;
BC_FW_CMD fwCmd;
BC_HW_TYPE hwType;
BC_PCI_CFG pciCfg;
BC_VERSION_INFO VerInfo;
BC_PROC_INPUT ProcInput;
BC_DEC_YUV_BUFFS RxBuffs;
BC_DEC_OUT_BUFF DecOutData;
BC_START_RX_CAP RxCap;
BC_FLUSH_RX_CAP FlushRxCap;
BC_DTS_STATS drvStat;
BC_NOTIFY_MODE NotifyMode;
BC_CLOCK clockValue;
} u;
struct _BC_IOCTL_DATA *next;
} BC_IOCTL_DATA;
typedef enum _BC_DRV_CMD{
DRV_CMD_VERSION = 0, /* Get SW version */
DRV_CMD_GET_HWTYPE, /* Get HW version and type Dozer/Tank */
DRV_CMD_REG_RD, /* Read Device Register */
DRV_CMD_REG_WR, /* Write Device Register */
DRV_CMD_FPGA_RD, /* Read FPGA Register */
DRV_CMD_FPGA_WR, /* Wrtie FPGA Reister */
DRV_CMD_MEM_RD, /* Read Device Memory */
DRV_CMD_MEM_WR, /* Write Device Memory */
DRV_CMD_RD_PCI_CFG, /* Read PCI Config Space */
DRV_CMD_WR_PCI_CFG, /* Write the PCI Configuration Space*/
DRV_CMD_FW_DOWNLOAD, /* Download Firmware */
DRV_ISSUE_FW_CMD, /* Issue FW Cmd (pass through mode) */
DRV_CMD_PROC_INPUT, /* Process Input Sample */
DRV_CMD_ADD_RXBUFFS, /* Add Rx side buffers to driver pool */
DRV_CMD_FETCH_RXBUFF, /* Get Rx DMAed buffer */
DRV_CMD_START_RX_CAP, /* Start Rx Buffer Capture */
DRV_CMD_FLUSH_RX_CAP, /* Stop the capture for now...we will enhance this later*/
DRV_CMD_GET_DRV_STAT, /* Get Driver Internal Statistics */
DRV_CMD_RST_DRV_STAT, /* Reset Driver Internal Statistics */
DRV_CMD_NOTIFY_MODE, /* Notify the Mode to driver in which the application is Operating*/
DRV_CMD_CHANGE_CLOCK, /* Change the core clock to either save power or improve performance */
/* MUST be the last one.. */
DRV_CMD_END, /* End of the List.. */
} BC_DRV_CMD;
#define BC_IOC_BASE 'b'
#define BC_IOC_VOID _IOC_NONE
#define BC_IOC_IOWR(nr, type) _IOWR(BC_IOC_BASE, nr, type)
#define BC_IOCTL_MB BC_IOCTL_DATA
#define BCM_IOC_GET_VERSION BC_IOC_IOWR(DRV_CMD_VERSION, BC_IOCTL_MB)
#define BCM_IOC_GET_HWTYPE BC_IOC_IOWR(DRV_CMD_GET_HWTYPE, BC_IOCTL_MB)
#define BCM_IOC_REG_RD BC_IOC_IOWR(DRV_CMD_REG_RD, BC_IOCTL_MB)
#define BCM_IOC_REG_WR BC_IOC_IOWR(DRV_CMD_REG_WR, BC_IOCTL_MB)
#define BCM_IOC_MEM_RD BC_IOC_IOWR(DRV_CMD_MEM_RD, BC_IOCTL_MB)
#define BCM_IOC_MEM_WR BC_IOC_IOWR(DRV_CMD_MEM_WR, BC_IOCTL_MB)
#define BCM_IOC_FPGA_RD BC_IOC_IOWR(DRV_CMD_FPGA_RD, BC_IOCTL_MB)
#define BCM_IOC_FPGA_WR BC_IOC_IOWR(DRV_CMD_FPGA_WR, BC_IOCTL_MB)
#define BCM_IOC_RD_PCI_CFG BC_IOC_IOWR(DRV_CMD_RD_PCI_CFG, BC_IOCTL_MB)
#define BCM_IOC_WR_PCI_CFG BC_IOC_IOWR(DRV_CMD_WR_PCI_CFG, BC_IOCTL_MB)
#define BCM_IOC_PROC_INPUT BC_IOC_IOWR(DRV_CMD_PROC_INPUT, BC_IOCTL_MB)
#define BCM_IOC_ADD_RXBUFFS BC_IOC_IOWR(DRV_CMD_ADD_RXBUFFS, BC_IOCTL_MB)
#define BCM_IOC_FETCH_RXBUFF BC_IOC_IOWR(DRV_CMD_FETCH_RXBUFF, BC_IOCTL_MB)
#define BCM_IOC_FW_CMD BC_IOC_IOWR(DRV_ISSUE_FW_CMD, BC_IOCTL_MB)
#define BCM_IOC_START_RX_CAP BC_IOC_IOWR(DRV_CMD_START_RX_CAP, BC_IOCTL_MB)
#define BCM_IOC_FLUSH_RX_CAP BC_IOC_IOWR(DRV_CMD_FLUSH_RX_CAP, BC_IOCTL_MB)
#define BCM_IOC_GET_DRV_STAT BC_IOC_IOWR(DRV_CMD_GET_DRV_STAT, BC_IOCTL_MB)
#define BCM_IOC_RST_DRV_STAT BC_IOC_IOWR(DRV_CMD_RST_DRV_STAT, BC_IOCTL_MB)
#define BCM_IOC_NOTIFY_MODE BC_IOC_IOWR(DRV_CMD_NOTIFY_MODE, BC_IOCTL_MB)
#define BCM_IOC_FW_DOWNLOAD BC_IOC_IOWR(DRV_CMD_FW_DOWNLOAD, BC_IOCTL_MB)
#define BCM_IOC_CHG_CLK BC_IOC_IOWR(DRV_CMD_CHANGE_CLOCK, BC_IOCTL_MB)
#define BCM_IOC_END BC_IOC_VOID
/* Wrapper for main IOCTL data */
typedef struct _crystalhd_ioctl_data {
BC_IOCTL_DATA udata; /* IOCTL from App..*/
uint32_t u_id; /* Driver specific user ID */
uint32_t cmd; /* Cmd ID for driver's use. */
void *add_cdata; /* Additional command specific data..*/
uint32_t add_cdata_sz; /* Additional command specific data size */
struct _crystalhd_ioctl_data *next; /* List/Fifo management */
} crystalhd_ioctl_data;
enum _crystalhd_kmod_ver{
crystalhd_kmod_major = 0,
crystalhd_kmod_minor = 9,
crystalhd_kmod_rev = 27,
};
#endif
/********************************************************************
* Copyright(c) 2006-2009 Broadcom Corporation.
*
* Name: bc_dts_types.h
*
* Description: Data types
*
* AU
*
* HISTORY:
*
********************************************************************
* This header is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 2.1 of the License.
*
* This header is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this header. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************/
#ifndef _BC_DTS_TYPES_H_
#define _BC_DTS_TYPES_H_
#if defined(_WIN64) || defined(_WIN32)
typedef uint32_t U32;
typedef int32_t S32;
typedef uint16_t U16;
typedef int16_t S16;
typedef unsigned char U8;
typedef char S8;
#endif
#ifndef PVOID
typedef void *PVOID;
#endif
#ifndef BOOL
typedef int BOOL;
#endif
#ifdef WIN32
typedef unsigned __int64 U64;
#elif defined(_WIN64)
typedef uint64_t U64;
#endif
#ifdef _WIN64
#if !(defined(POINTER_32))
#define POINTER_32 __ptr32
#endif
#else /* _WIN32 */
#define POINTER_32
#endif
#if defined(__KERNEL__) || defined(__LINUX_USER__)
#ifdef __LINUX_USER__ /* Don't include these for KERNEL */
typedef uint32_t ULONG;
typedef int32_t LONG;
typedef void *HANDLE;
typedef void VOID;
typedef void *LPVOID;
typedef uint32_t DWORD;
typedef uint32_t UINT32;
typedef uint32_t *LPDWORD;
typedef unsigned char *PUCHAR;
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define TEXT
#else
/* For Kernel usage.. */
typedef bool bc_bool_t;
#endif
#else
#ifndef uint64_t
typedef struct _uint64_t {
uint32_t low_dw;
uint32_t hi_dw;
} uint64_t;
#endif
#ifndef int32_t
typedef signed long int32_t;
#endif
#ifndef uint32_t
typedef unsigned long uint32_t;
#endif
#ifndef uint16_t
typedef unsigned short uint16_t;
#endif
#ifndef uint8_t
typedef unsigned char uint8_t;
#endif
#endif
#endif
此差异已折叠。
此差异已折叠。
/***************************************************************************
* Copyright (c) 2005-2009, Broadcom Corporation.
*
* Name: crystalhd_cmds . h
*
* Description:
* BCM70010 Linux driver user command interfaces.
*
* HISTORY:
*
**********************************************************************
* This file is part of the crystalhd device driver.
*
* This driver is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This driver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this driver. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#ifndef _CRYSTALHD_CMDS_H_
#define _CRYSTALHD_CMDS_H_
/*
* NOTE:: This is the main interface file between the Linux layer
* and the harware layer. This file will use the definitions
* from _dts_glob and dts_defs etc.. which are defined for
* windows.
*/
#include "crystalhd_misc.h"
#include "crystalhd_hw.h"
enum _crystalhd_state{
BC_LINK_INVALID = 0x00,
BC_LINK_INIT = 0x01,
BC_LINK_CAP_EN = 0x02,
BC_LINK_FMT_CHG = 0x04,
BC_LINK_SUSPEND = 0x10,
BC_LINK_PAUSED = 0x20,
BC_LINK_READY = (BC_LINK_INIT | BC_LINK_CAP_EN | BC_LINK_FMT_CHG),
};
struct crystalhd_user {
uint32_t uid;
uint32_t in_use;
uint32_t mode;
};
#define DTS_MODE_INV (-1)
struct crystalhd_cmd {
uint32_t state;
struct crystalhd_adp *adp;
struct crystalhd_user user[BC_LINK_MAX_OPENS];
spinlock_t ctx_lock;
uint32_t tx_list_id;
uint32_t cin_wait_exit;
uint32_t pwr_state_change;
struct crystalhd_hw hw_ctx;
};
typedef BC_STATUS (*crystalhd_cmd_proc)(struct crystalhd_cmd *, crystalhd_ioctl_data *);
typedef struct _crystalhd_cmd_tbl {
uint32_t cmd_id;
const crystalhd_cmd_proc cmd_proc;
uint32_t block_mon;
} crystalhd_cmd_tbl_t;
BC_STATUS crystalhd_suspend(struct crystalhd_cmd *ctx, crystalhd_ioctl_data *idata);
BC_STATUS crystalhd_resume(struct crystalhd_cmd *ctx);
crystalhd_cmd_proc crystalhd_get_cmd_proc(struct crystalhd_cmd *ctx, uint32_t cmd,
struct crystalhd_user *uc);
BC_STATUS crystalhd_user_open(struct crystalhd_cmd *ctx, struct crystalhd_user **user_ctx);
BC_STATUS crystalhd_user_close(struct crystalhd_cmd *ctx, struct crystalhd_user *uc);
BC_STATUS crystalhd_setup_cmd_context(struct crystalhd_cmd *ctx, struct crystalhd_adp *adp);
BC_STATUS crystalhd_delete_cmd_context(struct crystalhd_cmd *ctx);
bool crystalhd_cmd_interrupt(struct crystalhd_cmd *ctx);
#endif
/***************************************************************************
* Copyright (c) 2005-2009, Broadcom Corporation.
*
* Name: crystalhd_fw_if . h
*
* Description:
* BCM70012 Firmware interface definitions.
*
* HISTORY:
*
**********************************************************************
* This file is part of the crystalhd device driver.
*
* This driver is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This driver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this driver. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#ifndef _CRYSTALHD_FW_IF_H_
#define _CRYSTALHD_FW_IF_H_
/* TBD: Pull in only required defs into this file.. */
/* User Data Header */
typedef struct user_data {
struct user_data *next;
uint32_t type;
uint32_t size;
} UD_HDR;
/*------------------------------------------------------*
* MPEG Extension to the PPB *
*------------------------------------------------------*/
typedef struct {
uint32_t to_be_defined;
uint32_t valid;
/* Always valid, defaults to picture size if no
sequence display extension in the stream. */
uint32_t display_horizontal_size;
uint32_t display_vertical_size;
/* MPEG_VALID_PANSCAN
Offsets are a copy values from the MPEG stream. */
uint32_t offset_count;
int32_t horizontal_offset[3];
int32_t vertical_offset[3];
/* MPEG_VALID_USERDATA
User data is in the form of a linked list. */
int32_t userDataSize;
UD_HDR *userData;
} PPB_MPEG;
/*------------------------------------------------------*
* VC1 Extension to the PPB *
*------------------------------------------------------*/
typedef struct {
uint32_t to_be_defined;
uint32_t valid;
/* Always valid, defaults to picture size if no
sequence display extension in the stream. */
uint32_t display_horizontal_size;
uint32_t display_vertical_size;
/* VC1 pan scan windows */
uint32_t num_panscan_windows;
int32_t ps_horiz_offset[4];
int32_t ps_vert_offset[4];
int32_t ps_width[4];
int32_t ps_height[4];
/* VC1_VALID_USERDATA
User data is in the form of a linked list. */
int32_t userDataSize;
UD_HDR *userData;
} PPB_VC1;
/*------------------------------------------------------*
* H.264 Extension to the PPB *
*------------------------------------------------------*/
/**
* @brief Film grain SEI message.
*
* Content of the film grain SEI message.
*/
/* maximum number of model-values as for Thomson spec(standard says 5) */
#define MAX_FGT_MODEL_VALUE (3)
/* maximum number of intervals(as many as 256 intervals?) */
#define MAX_FGT_VALUE_INTERVAL (256)
typedef struct FGT_SEI {
struct FGT_SEI *next;
unsigned char model_values[3][MAX_FGT_VALUE_INTERVAL][MAX_FGT_MODEL_VALUE];
unsigned char upper_bound[3][MAX_FGT_VALUE_INTERVAL];
unsigned char lower_bound[3][MAX_FGT_VALUE_INTERVAL];
unsigned char cancel_flag; /* Cancel flag: 1 no film grain. */
unsigned char model_id; /* Model id. */
/* +unused SE based on Thomson spec */
unsigned char color_desc_flag; /* Separate color descrition flag. */
unsigned char bit_depth_luma; /* Bit depth luma minus 8. */
unsigned char bit_depth_chroma; /* Bit depth chroma minus 8. */
unsigned char full_range_flag; /* Full range flag. */
unsigned char color_primaries; /* Color primaries. */
unsigned char transfer_charact; /* Transfer characteristics. */
unsigned char matrix_coeff; /*< Matrix coefficients. */
/* -unused SE based on Thomson spec */
unsigned char blending_mode_id; /* Blending mode. */
unsigned char log2_scale_factor; /* Log2 scale factor (2-7). */
unsigned char comp_flag[3]; /* Components [0,2] parameters present flag. */
unsigned char num_intervals_minus1[3]; /* Number of intensity level intervals. */
unsigned char num_model_values[3]; /* Number of model values. */
uint16_t repetition_period; /* Repetition period (0-16384) */
} FGT_SEI;
typedef struct {
/* 'valid' specifies which fields (or sets of
* fields) below are valid. If the corresponding
* bit in 'valid' is NOT set then that field(s)
* is (are) not initialized. */
uint32_t valid;
int32_t poc_top; /* POC for Top Field/Frame */
int32_t poc_bottom; /* POC for Bottom Field */
uint32_t idr_pic_id;
/* H264_VALID_PANSCAN */
uint32_t pan_scan_count;
int32_t pan_scan_left[3];
int32_t pan_scan_right[3];
int32_t pan_scan_top[3];
int32_t pan_scan_bottom[3];
/* H264_VALID_CT_TYPE */
uint32_t ct_type_count;
uint32_t ct_type[3];
/* H264_VALID_SPS_CROP */
int32_t sps_crop_left;
int32_t sps_crop_right;
int32_t sps_crop_top;
int32_t sps_crop_bottom;
/* H264_VALID_VUI */
uint32_t chroma_top;
uint32_t chroma_bottom;
/* H264_VALID_USER */
uint32_t user_data_size;
UD_HDR *user_data;
/* H264 VALID FGT */
FGT_SEI *pfgt;
} PPB_H264;
typedef struct {
/* Common fields. */
uint32_t picture_number; /* Ordinal display number */
uint32_t video_buffer; /* Video (picbuf) number */
uint32_t video_address; /* Address of picbuf Y */
uint32_t video_address_uv; /* Address of picbuf UV */
uint32_t video_stripe; /* Picbuf stripe */
uint32_t video_width; /* Picbuf width */
uint32_t video_height; /* Picbuf height */
uint32_t channel_id; /* Decoder channel ID */
uint32_t status; /* reserved */
uint32_t width; /* pixels */
uint32_t height; /* pixels */
uint32_t chroma_format; /* see above */
uint32_t pulldown; /* see above */
uint32_t flags; /* see above */
uint32_t pts; /* 32 LSBs of PTS */
uint32_t protocol; /* protocolXXX (above) */
uint32_t frame_rate; /* see above */
uint32_t matrix_coeff; /* see above */
uint32_t aspect_ratio; /* see above */
uint32_t colour_primaries; /* see above */
uint32_t transfer_char; /* see above */
uint32_t pcr_offset; /* 45kHz if PCR type; else 27MHz */
uint32_t n_drop; /* Number of pictures to be dropped */
uint32_t custom_aspect_ratio_width_height;
/* upper 16-bits is Y and lower 16-bits is X */
uint32_t picture_tag; /* Indexing tag from BUD packets */
uint32_t picture_done_payload;
uint32_t picture_meta_payload;
uint32_t reserved[1];
/* Protocol-specific extensions. */
union {
PPB_H264 h264;
PPB_MPEG mpeg;
PPB_VC1 vc1;
} other;
} PPB;
typedef struct {
uint32_t bFormatChange;
uint32_t resolution;
uint32_t channelId;
uint32_t ppbPtr;
int32_t ptsStcOffset;
uint32_t zeroPanscanValid;
uint32_t dramOutBufAddr;
uint32_t yComponent;
PPB ppb;
} C011_PIB;
typedef struct {
uint32_t command;
uint32_t sequence;
uint32_t status;
uint32_t picBuf;
uint32_t picRelBuf;
uint32_t picInfoDeliveryQ;
uint32_t picInfoReleaseQ;
uint32_t channelStatus;
uint32_t userDataDeliveryQ;
uint32_t userDataReleaseQ;
uint32_t transportStreamCaptureAddr;
uint32_t asyncEventQ;
} DecRspChannelStartVideo;
#define eCMD_C011_CMD_BASE (0x73763000)
/* host commands */
typedef enum {
eCMD_TS_GET_NEXT_PIC = 0x7376F100, /* debug get next picture */
eCMD_TS_GET_LAST_PIC = 0x7376F102, /* debug get last pic status */
eCMD_TS_READ_WRITE_MEM = 0x7376F104, /* debug read write memory */
/* New API commands */
/* General commands */
eCMD_C011_INIT = eCMD_C011_CMD_BASE + 0x01,
eCMD_C011_RESET = eCMD_C011_CMD_BASE + 0x02,
eCMD_C011_SELF_TEST = eCMD_C011_CMD_BASE + 0x03,
eCMD_C011_GET_VERSION = eCMD_C011_CMD_BASE + 0x04,
eCMD_C011_GPIO = eCMD_C011_CMD_BASE + 0x05,
eCMD_C011_DEBUG_SETUP = eCMD_C011_CMD_BASE + 0x06,
/* Decoding commands */
eCMD_C011_DEC_CHAN_OPEN = eCMD_C011_CMD_BASE + 0x100,
eCMD_C011_DEC_CHAN_CLOSE = eCMD_C011_CMD_BASE + 0x101,
eCMD_C011_DEC_CHAN_ACTIVATE = eCMD_C011_CMD_BASE + 0x102,
eCMD_C011_DEC_CHAN_STATUS = eCMD_C011_CMD_BASE + 0x103,
eCMD_C011_DEC_CHAN_FLUSH = eCMD_C011_CMD_BASE + 0x104,
eCMD_C011_DEC_CHAN_TRICK_PLAY = eCMD_C011_CMD_BASE + 0x105,
eCMD_C011_DEC_CHAN_TS_PIDS = eCMD_C011_CMD_BASE + 0x106,
eCMD_C011_DEC_CHAN_PS_STREAM_ID = eCMD_C011_CMD_BASE + 0x107,
eCMD_C011_DEC_CHAN_INPUT_PARAMS = eCMD_C011_CMD_BASE + 0x108,
eCMD_C011_DEC_CHAN_VIDEO_OUTPUT = eCMD_C011_CMD_BASE + 0x109,
eCMD_C011_DEC_CHAN_OUTPUT_FORMAT = eCMD_C011_CMD_BASE + 0x10A,
eCMD_C011_DEC_CHAN_SCALING_FILTERS = eCMD_C011_CMD_BASE + 0x10B,
eCMD_C011_DEC_CHAN_OSD_MODE = eCMD_C011_CMD_BASE + 0x10D,
eCMD_C011_DEC_CHAN_DROP = eCMD_C011_CMD_BASE + 0x10E,
eCMD_C011_DEC_CHAN_RELEASE = eCMD_C011_CMD_BASE + 0x10F,
eCMD_C011_DEC_CHAN_STREAM_SETTINGS = eCMD_C011_CMD_BASE + 0x110,
eCMD_C011_DEC_CHAN_PAUSE_OUTPUT = eCMD_C011_CMD_BASE + 0x111,
eCMD_C011_DEC_CHAN_CHANGE = eCMD_C011_CMD_BASE + 0x112,
eCMD_C011_DEC_CHAN_SET_STC = eCMD_C011_CMD_BASE + 0x113,
eCMD_C011_DEC_CHAN_SET_PTS = eCMD_C011_CMD_BASE + 0x114,
eCMD_C011_DEC_CHAN_CC_MODE = eCMD_C011_CMD_BASE + 0x115,
eCMD_C011_DEC_CREATE_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x116,
eCMD_C011_DEC_COPY_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x117,
eCMD_C011_DEC_DELETE_AUDIO_CONTEXT = eCMD_C011_CMD_BASE + 0x118,
eCMD_C011_DEC_CHAN_SET_DECYPTION = eCMD_C011_CMD_BASE + 0x119,
eCMD_C011_DEC_CHAN_START_VIDEO = eCMD_C011_CMD_BASE + 0x11A,
eCMD_C011_DEC_CHAN_STOP_VIDEO = eCMD_C011_CMD_BASE + 0x11B,
eCMD_C011_DEC_CHAN_PIC_CAPTURE = eCMD_C011_CMD_BASE + 0x11C,
eCMD_C011_DEC_CHAN_PAUSE = eCMD_C011_CMD_BASE + 0x11D,
eCMD_C011_DEC_CHAN_PAUSE_STATE = eCMD_C011_CMD_BASE + 0x11E,
eCMD_C011_DEC_CHAN_SET_SLOWM_RATE = eCMD_C011_CMD_BASE + 0x11F,
eCMD_C011_DEC_CHAN_GET_SLOWM_RATE = eCMD_C011_CMD_BASE + 0x120,
eCMD_C011_DEC_CHAN_SET_FF_RATE = eCMD_C011_CMD_BASE + 0x121,
eCMD_C011_DEC_CHAN_GET_FF_RATE = eCMD_C011_CMD_BASE + 0x122,
eCMD_C011_DEC_CHAN_FRAME_ADVANCE = eCMD_C011_CMD_BASE + 0x123,
eCMD_C011_DEC_CHAN_SET_SKIP_PIC_MODE = eCMD_C011_CMD_BASE + 0x124,
eCMD_C011_DEC_CHAN_GET_SKIP_PIC_MODE = eCMD_C011_CMD_BASE + 0x125,
eCMD_C011_DEC_CHAN_FILL_PIC_BUF = eCMD_C011_CMD_BASE + 0x126,
eCMD_C011_DEC_CHAN_SET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x127,
eCMD_C011_DEC_CHAN_GET_CONTINUITY_CHECK = eCMD_C011_CMD_BASE + 0x128,
eCMD_C011_DEC_CHAN_SET_BRCM_TRICK_MODE = eCMD_C011_CMD_BASE + 0x129,
eCMD_C011_DEC_CHAN_GET_BRCM_TRICK_MODE = eCMD_C011_CMD_BASE + 0x12A,
eCMD_C011_DEC_CHAN_REVERSE_FIELD_STATUS = eCMD_C011_CMD_BASE + 0x12B,
eCMD_C011_DEC_CHAN_I_PICTURE_FOUND = eCMD_C011_CMD_BASE + 0x12C,
eCMD_C011_DEC_CHAN_SET_PARAMETER = eCMD_C011_CMD_BASE + 0x12D,
eCMD_C011_DEC_CHAN_SET_USER_DATA_MODE = eCMD_C011_CMD_BASE + 0x12E,
eCMD_C011_DEC_CHAN_SET_PAUSE_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x12F,
eCMD_C011_DEC_CHAN_SET_SLOW_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x130,
eCMD_C011_DEC_CHAN_SET_FF_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x131,
eCMD_C011_DEC_CHAN_SET_DISPLAY_TIMING_MODE = eCMD_C011_CMD_BASE + 0x132,
eCMD_C011_DEC_CHAN_SET_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x133,
eCMD_C011_DEC_CHAN_GET_DISPLAY_MODE = eCMD_C011_CMD_BASE + 0x134,
eCMD_C011_DEC_CHAN_SET_REVERSE_FIELD = eCMD_C011_CMD_BASE + 0x135,
eCMD_C011_DEC_CHAN_STREAM_OPEN = eCMD_C011_CMD_BASE + 0x136,
eCMD_C011_DEC_CHAN_SET_PCR_PID = eCMD_C011_CMD_BASE + 0x137,
eCMD_C011_DEC_CHAN_SET_VID_PID = eCMD_C011_CMD_BASE + 0x138,
eCMD_C011_DEC_CHAN_SET_PAN_SCAN_MODE = eCMD_C011_CMD_BASE + 0x139,
eCMD_C011_DEC_CHAN_START_DISPLAY_AT_PTS = eCMD_C011_CMD_BASE + 0x140,
eCMD_C011_DEC_CHAN_STOP_DISPLAY_AT_PTS = eCMD_C011_CMD_BASE + 0x141,
eCMD_C011_DEC_CHAN_SET_DISPLAY_ORDER = eCMD_C011_CMD_BASE + 0x142,
eCMD_C011_DEC_CHAN_GET_DISPLAY_ORDER = eCMD_C011_CMD_BASE + 0x143,
eCMD_C011_DEC_CHAN_SET_HOST_TRICK_MODE = eCMD_C011_CMD_BASE + 0x144,
eCMD_C011_DEC_CHAN_SET_OPERATION_MODE = eCMD_C011_CMD_BASE + 0x145,
eCMD_C011_DEC_CHAN_DISPLAY_PAUSE_UNTO_PTS = eCMD_C011_CMD_BASE + 0x146,
eCMD_C011_DEC_CHAN_SET_PTS_STC_DIFF_THRESHOLD = eCMD_C011_CMD_BASE + 0x147,
eCMD_C011_DEC_CHAN_SEND_COMPRESSED_BUF = eCMD_C011_CMD_BASE + 0x148,
eCMD_C011_DEC_CHAN_SET_CLIPPING = eCMD_C011_CMD_BASE + 0x149,
eCMD_C011_DEC_CHAN_SET_PARAMETERS_FOR_HARD_RESET_INTERRUPT_TO_HOST
= eCMD_C011_CMD_BASE + 0x150,
/* Decoder RevD commands */
eCMD_C011_DEC_CHAN_SET_CSC = eCMD_C011_CMD_BASE + 0x180, /* color space conversion */
eCMD_C011_DEC_CHAN_SET_RANGE_REMAP = eCMD_C011_CMD_BASE + 0x181,
eCMD_C011_DEC_CHAN_SET_FGT = eCMD_C011_CMD_BASE + 0x182,
/* Note: 0x183 not implemented yet in Rev D main */
eCMD_C011_DEC_CHAN_SET_LASTPICTURE_PADDING = eCMD_C011_CMD_BASE + 0x183,
/* Decoder 7412 commands (7412-only) */
eCMD_C011_DEC_CHAN_SET_CONTENT_KEY = eCMD_C011_CMD_BASE + 0x190,
eCMD_C011_DEC_CHAN_SET_SESSION_KEY = eCMD_C011_CMD_BASE + 0x191,
eCMD_C011_DEC_CHAN_FMT_CHANGE_ACK = eCMD_C011_CMD_BASE + 0x192,
eCMD_C011_DEC_CHAN_CUSTOM_VIDOUT = eCMD_C011_CMD_BASE + 0x1FF,
/* Encoding commands */
eCMD_C011_ENC_CHAN_OPEN = eCMD_C011_CMD_BASE + 0x200,
eCMD_C011_ENC_CHAN_CLOSE = eCMD_C011_CMD_BASE + 0x201,
eCMD_C011_ENC_CHAN_ACTIVATE = eCMD_C011_CMD_BASE + 0x202,
eCMD_C011_ENC_CHAN_CONTROL = eCMD_C011_CMD_BASE + 0x203,
eCMD_C011_ENC_CHAN_STATISTICS = eCMD_C011_CMD_BASE + 0x204,
eNOTIFY_C011_ENC_CHAN_EVENT = eCMD_C011_CMD_BASE + 0x210,
} eC011_TS_CMD;
#endif
此差异已折叠。
此差异已折叠。
此差异已折叠。
/***************************************************************************
* Copyright (c) 2005-2009, Broadcom Corporation.
*
* Name: crystalhd_lnx . c
*
* Description:
* BCM70012 Linux driver
*
* HISTORY:
*
**********************************************************************
* This file is part of the crystalhd device driver.
*
* This driver is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2 of the License.
*
* This driver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this driver. If not, see <http://www.gnu.org/licenses/>.
**********************************************************************/
#ifndef _CRYSTALHD_LNX_H_
#define _CRYSTALHD_LNX_H_
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pagemap.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include "crystalhd_cmds.h"
#define CRYSTAL_HD_NAME "Broadcom Crystal HD Decoder (BCM70012) Driver"
/* OS specific PCI information structure and adapter information. */
struct crystalhd_adp {
/* Hardware borad/PCI specifics */
char name[32];
struct pci_dev *pdev;
unsigned long pci_mem_start;
uint32_t pci_mem_len;
void *addr;
unsigned long pci_i2o_start;
uint32_t pci_i2o_len;
void *i2o_addr;
unsigned int drv_data;
unsigned int dmabits; /* 32 | 64 */
unsigned int registered;
unsigned int present;
unsigned int msi;
spinlock_t lock;
/* API Related */
unsigned int chd_dec_major;
unsigned int cfg_users;
crystalhd_ioctl_data *idata_free_head; /* ioctl data pool */
crystalhd_elem_t *elem_pool_head; /* Queue element pool */
struct crystalhd_cmd cmds;
crystalhd_dio_req *ua_map_free_head;
struct pci_pool *fill_byte_pool;
};
struct crystalhd_adp *chd_get_adp(void);
void chd_set_log_level(struct crystalhd_adp *adp, char *arg);
#endif
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册