Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
cx23885-417.c File Reference
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/firmware.h>
#include <linux/slab.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/cx2341x.h>
#include "cx23885.h"
#include "cx23885-ioctl.h"

Go to the source code of this file.

Macros

#define CX23885_FIRM_IMAGE_SIZE   376836
 
#define CX23885_FIRM_IMAGE_NAME   "v4l-cx23885-enc.fw"
 
#define dprintk(level, fmt, arg...)
 
#define IVTV_CMD_HW_BLOCKS_RST   0xFFFFFFFF
 
#define IVTV_API_STD_TIMEOUT   500
 
#define IVTV_REG_ENC_SDRAM_REFRESH   (0x07F8)
 
#define IVTV_REG_ENC_SDRAM_PRECHARGE   (0x07FC)
 
#define IVTV_REG_SPU   (0x9050)
 
#define IVTV_REG_HW_BLOCKS   (0x9054)
 
#define IVTV_REG_VPU   (0x9058)
 
#define IVTV_REG_APU   (0xA064)
 
#define MC417_MIWR   0x8000
 
#define MC417_MIRD   0x4000
 
#define MC417_MICS   0x2000
 
#define MC417_MIRDY   0x1000
 
#define MC417_MIADDR   0x0F00
 
#define MC417_MIDATA   0x00FF
 
#define MCI_MEMORY_DATA_BYTE0   0x000
 
#define MCI_MEMORY_DATA_BYTE1   0x100
 
#define MCI_MEMORY_DATA_BYTE2   0x200
 
#define MCI_MEMORY_DATA_BYTE3   0x300
 
#define MCI_MEMORY_ADDRESS_BYTE2   0x400
 
#define MCI_MEMORY_ADDRESS_BYTE1   0x500
 
#define MCI_MEMORY_ADDRESS_BYTE0   0x600
 
#define MCI_REGISTER_DATA_BYTE0   0x800
 
#define MCI_REGISTER_DATA_BYTE1   0x900
 
#define MCI_REGISTER_DATA_BYTE2   0xA00
 
#define MCI_REGISTER_DATA_BYTE3   0xB00
 
#define MCI_REGISTER_ADDRESS_BYTE0   0xC00
 
#define MCI_REGISTER_ADDRESS_BYTE1   0xD00
 
#define MCI_REGISTER_MODE   0xE00
 
#define MCI_MODE_REGISTER_READ   0
 
#define MCI_MODE_REGISTER_WRITE   1
 
#define MCI_MODE_MEMORY_READ   0
 
#define MCI_MODE_MEMORY_WRITE   0x40
 
#define MC417_SPD_CTL(x)   (((x) << 4) & 0x00000030)
 
#define MC417_GPIO_SEL(x)   (((x) << 1) & 0x00000006)
 
#define MC417_UART_GPIO_EN   0x00000001
 
#define MC417_SPD_CTL_SLOW   0x1
 
#define MC417_SPD_CTL_MEDIUM   0x0
 
#define MC417_SPD_CTL_FAST   0x3 /* b'1x, but we use b'11 */
 
#define MC417_GPIO_SEL_GPIO3   0x3
 
#define MC417_GPIO_SEL_GPIO2   0x2
 
#define MC417_GPIO_SEL_GPIO1   0x1
 
#define MC417_GPIO_SEL_GPIO0   0x0
 

Enumerations

enum  cx23885_capture_type { CX23885_MPEG_CAPTURE, CX23885_RAW_CAPTURE, CX23885_RAW_PASSTHRU_CAPTURE }
 
enum  cx23885_capture_bits {
  CX23885_RAW_BITS_NONE = 0x00, CX23885_RAW_BITS_YUV_CAPTURE = 0x01, CX23885_RAW_BITS_PCM_CAPTURE = 0x02, CX23885_RAW_BITS_VBI_CAPTURE = 0x04,
  CX23885_RAW_BITS_PASSTHRU_CAPTURE = 0x08, CX23885_RAW_BITS_TO_HOST_CAPTURE = 0x10
}
 
enum  cx23885_capture_end { CX23885_END_AT_GOP, CX23885_END_NOW }
 
enum  cx23885_framerate { CX23885_FRAMERATE_NTSC_30, CX23885_FRAMERATE_PAL_25 }
 
enum  cx23885_stream_port { CX23885_OUTPUT_PORT_MEMORY, CX23885_OUTPUT_PORT_STREAMING, CX23885_OUTPUT_PORT_SERIAL }
 
enum  cx23885_data_xfer_status { CX23885_MORE_BUFFERS_FOLLOW, CX23885_LAST_BUFFER }
 
enum  cx23885_picture_mask { CX23885_PICTURE_MASK_NONE, CX23885_PICTURE_MASK_I_FRAMES, CX23885_PICTURE_MASK_I_P_FRAMES = 0x3, CX23885_PICTURE_MASK_ALL_FRAMES = 0x7 }
 
enum  cx23885_vbi_mode_bits { CX23885_VBI_BITS_SLICED, CX23885_VBI_BITS_RAW }
 
enum  cx23885_vbi_insertion_bits {
  CX23885_VBI_BITS_INSERT_IN_XTENSION_USR_DATA, CX23885_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1, CX23885_VBI_BITS_SEPARATE_STREAM = 0x2 << 1, CX23885_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1,
  CX23885_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1
}
 
enum  cx23885_dma_unit { CX23885_DMA_BYTES, CX23885_DMA_FRAMES }
 
enum  cx23885_dma_transfer_status_bits { CX23885_DMA_TRANSFER_BITS_DONE = 0x01, CX23885_DMA_TRANSFER_BITS_ERROR = 0x04, CX23885_DMA_TRANSFER_BITS_LL_ERROR = 0x10 }
 
enum  cx23885_pause { CX23885_PAUSE_ENCODING, CX23885_RESUME_ENCODING }
 
enum  cx23885_copyright { CX23885_COPYRIGHT_OFF, CX23885_COPYRIGHT_ON }
 
enum  cx23885_notification_type { CX23885_NOTIFICATION_REFRESH }
 
enum  cx23885_notification_status { CX23885_NOTIFICATION_OFF, CX23885_NOTIFICATION_ON }
 
enum  cx23885_notification_mailbox { CX23885_NOTIFICATION_NO_MAILBOX = -1 }
 
enum  cx23885_field1_lines { CX23885_FIELD1_SAA7114 = 0x00EF, CX23885_FIELD1_SAA7115 = 0x00F0, CX23885_FIELD1_MICRONAS = 0x0105 }
 
enum  cx23885_field2_lines { CX23885_FIELD2_SAA7114 = 0x00EF, CX23885_FIELD2_SAA7115 = 0x00F0, CX23885_FIELD2_MICRONAS = 0x0106 }
 
enum  cx23885_custom_data_type { CX23885_CUSTOM_EXTENSION_USR_DATA, CX23885_CUSTOM_PRIVATE_PACKET }
 
enum  cx23885_mute { CX23885_UNMUTE, CX23885_MUTE }
 
enum  cx23885_mute_video_mask { CX23885_MUTE_VIDEO_V_MASK = 0x0000FF00, CX23885_MUTE_VIDEO_U_MASK = 0x00FF0000, CX23885_MUTE_VIDEO_Y_MASK = 0xFF000000 }
 
enum  cx23885_mute_video_shift { CX23885_MUTE_VIDEO_V_SHIFT = 8, CX23885_MUTE_VIDEO_U_SHIFT = 16, CX23885_MUTE_VIDEO_Y_SHIFT = 24 }
 

Functions

 module_param (mpegbufs, int, 0644)
 
 MODULE_PARM_DESC (mpegbufs,"number of mpeg buffers, range 2-32")
 
 module_param (mpeglines, int, 0644)
 
 MODULE_PARM_DESC (mpeglines,"number of lines in an MPEG buffer, range 2-32")
 
 module_param (mpeglinesize, int, 0644)
 
 MODULE_PARM_DESC (mpeglinesize,"number of bytes in each line of an MPEG buffer, range 512-1024")
 
 module_param (v4l_debug, int, 0644)
 
 MODULE_PARM_DESC (v4l_debug,"enable V4L debug messages")
 
void cx23885_mc417_init (struct cx23885_dev *dev)
 
int mc417_register_write (struct cx23885_dev *dev, u16 address, u32 value)
 
int mc417_register_read (struct cx23885_dev *dev, u16 address, u32 *value)
 
int mc417_memory_write (struct cx23885_dev *dev, u32 address, u32 value)
 
int mc417_memory_read (struct cx23885_dev *dev, u32 address, u32 *value)
 
void mc417_gpio_set (struct cx23885_dev *dev, u32 mask)
 
void mc417_gpio_clear (struct cx23885_dev *dev, u32 mask)
 
void mc417_gpio_enable (struct cx23885_dev *dev, u32 mask, int asoutput)
 
void cx23885_417_check_encoder (struct cx23885_dev *dev)
 
void cx23885_417_unregister (struct cx23885_dev *dev)
 
int cx23885_417_register (struct cx23885_dev *dev)
 
 MODULE_FIRMWARE (CX23885_FIRM_IMAGE_NAME)
 

Macro Definition Documentation

#define CX23885_FIRM_IMAGE_NAME   "v4l-cx23885-enc.fw"

Definition at line 43 of file cx23885-417.c.

#define CX23885_FIRM_IMAGE_SIZE   376836

Definition at line 42 of file cx23885-417.c.

#define dprintk (   level,
  fmt,
  arg... 
)
Value:
do { if (v4l_debug >= level) \
printk(KERN_DEBUG "%s: " fmt, \
(dev) ? dev->name : "cx23885[?]", ## arg); \
} while (0)

Definition at line 60 of file cx23885-417.c.

#define IVTV_API_STD_TIMEOUT   500

Definition at line 211 of file cx23885-417.c.

#define IVTV_CMD_HW_BLOCKS_RST   0xFFFFFFFF

Definition at line 208 of file cx23885-417.c.

#define IVTV_REG_APU   (0xA064)

Definition at line 220 of file cx23885-417.c.

#define IVTV_REG_ENC_SDRAM_PRECHARGE   (0x07FC)

Definition at line 216 of file cx23885-417.c.

#define IVTV_REG_ENC_SDRAM_REFRESH   (0x07F8)

Definition at line 215 of file cx23885-417.c.

#define IVTV_REG_HW_BLOCKS   (0x9054)

Definition at line 218 of file cx23885-417.c.

#define IVTV_REG_SPU   (0x9050)

Definition at line 217 of file cx23885-417.c.

#define IVTV_REG_VPU   (0x9058)

Definition at line 219 of file cx23885-417.c.

#define MC417_GPIO_SEL (   x)    (((x) << 1) & 0x00000006)

Definition at line 272 of file cx23885-417.c.

#define MC417_GPIO_SEL_GPIO0   0x0

Definition at line 284 of file cx23885-417.c.

#define MC417_GPIO_SEL_GPIO1   0x1

Definition at line 283 of file cx23885-417.c.

#define MC417_GPIO_SEL_GPIO2   0x2

Definition at line 282 of file cx23885-417.c.

#define MC417_GPIO_SEL_GPIO3   0x3

Definition at line 281 of file cx23885-417.c.

#define MC417_MIADDR   0x0F00

Definition at line 240 of file cx23885-417.c.

#define MC417_MICS   0x2000

Definition at line 238 of file cx23885-417.c.

#define MC417_MIDATA   0x00FF

Definition at line 241 of file cx23885-417.c.

#define MC417_MIRD   0x4000

Definition at line 237 of file cx23885-417.c.

#define MC417_MIRDY   0x1000

Definition at line 239 of file cx23885-417.c.

#define MC417_MIWR   0x8000

Definition at line 236 of file cx23885-417.c.

#define MC417_SPD_CTL (   x)    (((x) << 4) & 0x00000030)

Definition at line 271 of file cx23885-417.c.

#define MC417_SPD_CTL_FAST   0x3 /* b'1x, but we use b'11 */

Definition at line 278 of file cx23885-417.c.

#define MC417_SPD_CTL_MEDIUM   0x0

Definition at line 277 of file cx23885-417.c.

#define MC417_SPD_CTL_SLOW   0x1

Definition at line 276 of file cx23885-417.c.

#define MC417_UART_GPIO_EN   0x00000001

Definition at line 273 of file cx23885-417.c.

#define MCI_MEMORY_ADDRESS_BYTE0   0x600

Definition at line 250 of file cx23885-417.c.

#define MCI_MEMORY_ADDRESS_BYTE1   0x500

Definition at line 249 of file cx23885-417.c.

#define MCI_MEMORY_ADDRESS_BYTE2   0x400

Definition at line 248 of file cx23885-417.c.

#define MCI_MEMORY_DATA_BYTE0   0x000

Definition at line 244 of file cx23885-417.c.

#define MCI_MEMORY_DATA_BYTE1   0x100

Definition at line 245 of file cx23885-417.c.

#define MCI_MEMORY_DATA_BYTE2   0x200

Definition at line 246 of file cx23885-417.c.

#define MCI_MEMORY_DATA_BYTE3   0x300

Definition at line 247 of file cx23885-417.c.

#define MCI_MODE_MEMORY_READ   0

Definition at line 262 of file cx23885-417.c.

#define MCI_MODE_MEMORY_WRITE   0x40

Definition at line 263 of file cx23885-417.c.

#define MCI_MODE_REGISTER_READ   0

Definition at line 260 of file cx23885-417.c.

#define MCI_MODE_REGISTER_WRITE   1

Definition at line 261 of file cx23885-417.c.

#define MCI_REGISTER_ADDRESS_BYTE0   0xC00

Definition at line 255 of file cx23885-417.c.

#define MCI_REGISTER_ADDRESS_BYTE1   0xD00

Definition at line 256 of file cx23885-417.c.

#define MCI_REGISTER_DATA_BYTE0   0x800

Definition at line 251 of file cx23885-417.c.

#define MCI_REGISTER_DATA_BYTE1   0x900

Definition at line 252 of file cx23885-417.c.

#define MCI_REGISTER_DATA_BYTE2   0xA00

Definition at line 253 of file cx23885-417.c.

#define MCI_REGISTER_DATA_BYTE3   0xB00

Definition at line 254 of file cx23885-417.c.

#define MCI_REGISTER_MODE   0xE00

Definition at line 257 of file cx23885-417.c.

Enumeration Type Documentation

Enumerator:
CX23885_RAW_BITS_NONE 
CX23885_RAW_BITS_YUV_CAPTURE 
CX23885_RAW_BITS_PCM_CAPTURE 
CX23885_RAW_BITS_VBI_CAPTURE 
CX23885_RAW_BITS_PASSTHRU_CAPTURE 
CX23885_RAW_BITS_TO_HOST_CAPTURE 

Definition at line 109 of file cx23885-417.c.

Enumerator:
CX23885_END_AT_GOP 
CX23885_END_NOW 

Definition at line 117 of file cx23885-417.c.

Enumerator:
CX23885_MPEG_CAPTURE 
CX23885_RAW_CAPTURE 
CX23885_RAW_PASSTHRU_CAPTURE 

Definition at line 104 of file cx23885-417.c.

Enumerator:
CX23885_COPYRIGHT_OFF 
CX23885_COPYRIGHT_ON 

Definition at line 164 of file cx23885-417.c.

Enumerator:
CX23885_CUSTOM_EXTENSION_USR_DATA 
CX23885_CUSTOM_PRIVATE_PACKET 

Definition at line 188 of file cx23885-417.c.

Enumerator:
CX23885_MORE_BUFFERS_FOLLOW 
CX23885_LAST_BUFFER 

Definition at line 130 of file cx23885-417.c.

Enumerator:
CX23885_DMA_TRANSFER_BITS_DONE 
CX23885_DMA_TRANSFER_BITS_ERROR 
CX23885_DMA_TRANSFER_BITS_LL_ERROR 

Definition at line 155 of file cx23885-417.c.

Enumerator:
CX23885_DMA_BYTES 
CX23885_DMA_FRAMES 

Definition at line 151 of file cx23885-417.c.

Enumerator:
CX23885_FIELD1_SAA7114 
CX23885_FIELD1_SAA7115 
CX23885_FIELD1_MICRONAS 

Definition at line 178 of file cx23885-417.c.

Enumerator:
CX23885_FIELD2_SAA7114 
CX23885_FIELD2_SAA7115 
CX23885_FIELD2_MICRONAS 

Definition at line 183 of file cx23885-417.c.

Enumerator:
CX23885_FRAMERATE_NTSC_30 
CX23885_FRAMERATE_PAL_25 

Definition at line 121 of file cx23885-417.c.

Enumerator:
CX23885_UNMUTE 
CX23885_MUTE 

Definition at line 192 of file cx23885-417.c.

Enumerator:
CX23885_MUTE_VIDEO_V_MASK 
CX23885_MUTE_VIDEO_U_MASK 
CX23885_MUTE_VIDEO_Y_MASK 

Definition at line 196 of file cx23885-417.c.

Enumerator:
CX23885_MUTE_VIDEO_V_SHIFT 
CX23885_MUTE_VIDEO_U_SHIFT 
CX23885_MUTE_VIDEO_Y_SHIFT 

Definition at line 201 of file cx23885-417.c.

Enumerator:
CX23885_NOTIFICATION_NO_MAILBOX 

Definition at line 175 of file cx23885-417.c.

Enumerator:
CX23885_NOTIFICATION_OFF 
CX23885_NOTIFICATION_ON 

Definition at line 171 of file cx23885-417.c.

Enumerator:
CX23885_NOTIFICATION_REFRESH 

Definition at line 168 of file cx23885-417.c.

Enumerator:
CX23885_PAUSE_ENCODING 
CX23885_RESUME_ENCODING 

Definition at line 160 of file cx23885-417.c.

Enumerator:
CX23885_PICTURE_MASK_NONE 
CX23885_PICTURE_MASK_I_FRAMES 
CX23885_PICTURE_MASK_I_P_FRAMES 
CX23885_PICTURE_MASK_ALL_FRAMES 

Definition at line 134 of file cx23885-417.c.

Enumerator:
CX23885_OUTPUT_PORT_MEMORY 
CX23885_OUTPUT_PORT_STREAMING 
CX23885_OUTPUT_PORT_SERIAL 

Definition at line 125 of file cx23885-417.c.

Enumerator:
CX23885_VBI_BITS_INSERT_IN_XTENSION_USR_DATA 
CX23885_VBI_BITS_INSERT_IN_PRIVATE_PACKETS 
CX23885_VBI_BITS_SEPARATE_STREAM 
CX23885_VBI_BITS_SEPARATE_STREAM_USR_DATA 
CX23885_VBI_BITS_SEPARATE_STREAM_PRV_DATA 

Definition at line 144 of file cx23885-417.c.

Enumerator:
CX23885_VBI_BITS_SLICED 
CX23885_VBI_BITS_RAW 

Definition at line 140 of file cx23885-417.c.

Function Documentation

void cx23885_417_check_encoder ( struct cx23885_dev dev)

Definition at line 1013 of file cx23885-417.c.

int cx23885_417_register ( struct cx23885_dev dev)

Definition at line 1743 of file cx23885-417.c.

void cx23885_417_unregister ( struct cx23885_dev dev)

Definition at line 1708 of file cx23885-417.c.

void cx23885_mc417_init ( struct cx23885_dev dev)

Definition at line 286 of file cx23885-417.c.

void mc417_gpio_clear ( struct cx23885_dev dev,
u32  mask 
)

Definition at line 644 of file cx23885-417.c.

void mc417_gpio_enable ( struct cx23885_dev dev,
u32  mask,
int  asoutput 
)

Definition at line 654 of file cx23885-417.c.

void mc417_gpio_set ( struct cx23885_dev dev,
u32  mask 
)

Definition at line 634 of file cx23885-417.c.

int mc417_memory_read ( struct cx23885_dev dev,
u32  address,
u32 value 
)

Definition at line 544 of file cx23885-417.c.

int mc417_memory_write ( struct cx23885_dev dev,
u32  address,
u32  value 
)

Definition at line 480 of file cx23885-417.c.

int mc417_register_read ( struct cx23885_dev dev,
u16  address,
u32 value 
)

Definition at line 386 of file cx23885-417.c.

int mc417_register_write ( struct cx23885_dev dev,
u16  address,
u32  value 
)

Definition at line 322 of file cx23885-417.c.

MODULE_FIRMWARE ( CX23885_FIRM_IMAGE_NAME  )
module_param ( mpegbufs  ,
int  ,
0644   
)
module_param ( mpeglines  ,
int  ,
0644   
)
module_param ( mpeglinesize  ,
int  ,
0644   
)
module_param ( v4l_debug  ,
int  ,
0644   
)
MODULE_PARM_DESC ( mpegbufs  ,
"number of mpeg  buffers,
range 2-32"   
)
MODULE_PARM_DESC ( mpeglines  ,
"number of lines in an MPEG  buffer,
range 2-32"   
)
MODULE_PARM_DESC ( mpeglinesize  ,
"number of bytes in each line of an MPEG  buffer,
range 512-1024"   
)
MODULE_PARM_DESC ( v4l_debug  ,
"enable V4L debug messages"   
)