FreeBSD Bugzilla – Attachment 70422 Details for
Bug 102765
New port: multimedia/pvrxxx. A patched version of pvr250 to support 150/500 cards.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
pvrxxx.shar
pvrxxx.shar (text/plain), 44.63 KB, created by
usleepless
on 2006-09-01 22:30:18 UTC
(
hide
)
Description:
pvrxxx.shar
Filename:
MIME Type:
Creator:
usleepless
Created:
2006-09-01 22:30:18 UTC
Size:
44.63 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># pvrxxx ># pvrxxx/files ># pvrxxx/files/patch-pvr250-1.2 ># pvrxxx/files/patch-dev ># pvrxxx/files/patch-cxm_iic ># pvrxxx/files/patch-cxm ># pvrxxx/Makefile ># pvrxxx/pkg-plist ># pvrxxx/pkg-message ># pvrxxx/pkg-descr ># >echo c - pvrxxx >mkdir -p pvrxxx > /dev/null 2>&1 >echo c - pvrxxx/files >mkdir -p pvrxxx/files > /dev/null 2>&1 >echo x - pvrxxx/files/patch-pvr250-1.2 >sed 's/^X//' >pvrxxx/files/patch-pvr250-1.2 << 'END-of-pvrxxx/files/patch-pvr250-1.2' >XOnly in pvr250-1.2: setchannel >Xdiff -ur ../work.orig/pvr250-1.2/setchannel.c pvr250-1.2/setchannel.c >X--- ../work.orig/pvr250-1.2/setchannel.c Mon May 2 02:03:12 2005 >X+++ pvr250-1.2/setchannel.c Thu Aug 17 11:51:31 2006 >X@@ -58,6 +58,7 @@ >X printf("Usage: setchannel [-a {on|off}] [-c | -r | -s | -t] [-g geom] [-m chnl_set] [chnl | freq]\n" >X " -a Enable / disable AFC.\n" >X " -c Select composite input.\n" >X+ " -d Select unit ( 0..x ). \n" >X " -r Select radio input.\n" >X " -s Select svideo input.\n" >X " -t Select tuner.\n" >X@@ -93,6 +94,7 @@ >X int i; >X int status; >X int tfd; >X+ int unit; >X unsigned int channel; >X unsigned int fraction; >X unsigned int freq; >X@@ -107,11 +109,12 @@ >X channel_set = -1; >X device = 0; >X freq = 0; >X+ unit = 0; >X status = 0; >X x_size = 0; >X y_size = 0; >X >X- while ((c = getopt (argc, argv, "a:crstg:m:")) != -1) >X+ while ((c = getopt (argc, argv, "a:crstg:m:d:")) != -1) >X switch (c) { >X case 'a': >X if (strcasecmp (optarg, "on") == 0) >X@@ -124,6 +127,10 @@ >X } >X break; >X >X+ case 'd': >X+ unit = atoi (optarg); >X+ break; >X+ >X case 'c': >X device = METEOR_INPUT_DEV2; >X audio = -1; >X@@ -208,11 +215,15 @@ >X exit (1); >X } >X >X- tfd = open( "/dev/cxm0", O_RDONLY ); >X+{ char buf[255]; >X+ sprintf(buf,"/dev/cxm%d",unit); >X+ >X+ tfd = open( buf, O_RDONLY ); >X if ( tfd < 0 ) { >X- perror( "open() of /dev/tuner0 failed." ); >X+ perror( "open() of /dev/cxm0 failed." ); >X exit(1); >X } >X+} >X >X if (afc != -1) >X if ( ioctl( tfd, TVTUNER_SETAFC, &afc ) < 0 ) { >XOnly in pvr250-1.2: setchannel.c.bak >END-of-pvrxxx/files/patch-pvr250-1.2 >echo x - pvrxxx/files/patch-dev >sed 's/^X//' >pvrxxx/files/patch-dev << 'END-of-pvrxxx/files/patch-dev' >Xdiff -ur ../work.orig/dev/cxm/cxm.c dev/cxm/cxm.c >X--- ../work.orig/dev/cxm/cxm.c Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm.c Wed Aug 23 21:31:44 2006 >X@@ -87,6 +87,9 @@ >X >X #include <dev/iicbus/iiconf.h> >X >X+#include "v4l2_ioctl_hook.h" >X+ >X+#include "wm8775.h" >X >X /* >X * Various supported device vendors/types and their names. >X@@ -353,6 +356,8 @@ >X &dvd_full_d1_pal_profile >X }; >X >X+int jan_fps; >X+ >X >X static unsigned int >X cxm_queue_firmware_command( struct cxm_softc *sc, >X@@ -366,7 +371,7 @@ >X intrmask_t s; >X >X if (nparameters > CXM_MBX_MAX_PARAMETERS) { >X- printf("%s: too many parameters for mailbox\n", sc->name); >X+ log(LOG_DEBUG,"%s: too many parameters for mailbox\n", sc->name); >X return -1; >X } >X >X@@ -387,7 +392,8 @@ >X return -1; >X } >X >X- s = spltty(); >X+ if(!sc->inint) >X+ s = spltty(); >X for (i = 0; i < CXM_MBX_FW_CMD_MAILBOXES; i++) { >X flags = CSR_READ_4(sc, >X mailbox >X@@ -421,7 +427,8 @@ >X } >X >X if (i >= CXM_MBX_FW_CMD_MAILBOXES) { >X- splx(s); >X+ if(!sc->inint) >X+ splx(s); >X return -1; >X } >X >X@@ -436,7 +443,8 @@ >X >X (void)CSR_READ_4(sc, mailbox + offsetof(struct cxm_mailbox, flags)); >X >X- splx(s); >X+ if(!sc->inint) >X+ splx(s); >X >X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, command), cmd); >X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, timeout), >X@@ -448,12 +456,13 @@ >X + offsetof(struct cxm_mailbox, parameters) >X + i * sizeof(u_int32_t), >X *(parameters + i)); >X- >X+#ifdef _nuniet_ >X for ( ; i < CXM_MBX_MAX_PARAMETERS; i++) >X CSR_WRITE_4(sc, >X mailbox >X + offsetof(struct cxm_mailbox, parameters) >X + i * sizeof(u_int32_t), 0); >X+#endif >X >X CSR_WRITE_4(sc, mailbox + offsetof(struct cxm_mailbox, flags), >X CXM_MBX_FLAG_IN_USE | CXM_MBX_FLAG_DRV_DONE); >X@@ -495,7 +504,7 @@ >X mailbox = cxm_queue_firmware_command(sc, mbx_name, cmd, >X parameters, nparameters); >X if (mailbox == -1) { >X- printf("%s: no free mailboxes\n", sc->name); >X+ log(LOG_DEBUG,"%s: no free mailboxes\n", sc->name); >X return -1; >X } >X >X@@ -514,7 +523,7 @@ >X } >X >X if (i >= 100) { >X- printf("%s: timeout\n", sc->name); >X+ log(LOG_DEBUG,"%s: timeout\n", sc->name); >X return -1; >X } >X >X@@ -556,7 +565,7 @@ >X } >X >X if (i >= 100) { >X- printf("%s: no free mailboxes\n", sc->name); >X+ log(LOG_DEBUG,"%s: no free mailboxes\n", sc->name); >X return -1; >X } >X >X@@ -575,7 +584,7 @@ >X } >X >X if (i >= 100) { >X- printf("%s: timeout\n", sc->name); >X+ log(LOG_DEBUG,"%s: timeout\n", sc->name); >X return -1; >X } >X >X@@ -620,6 +629,7 @@ >X static void >X cxm_set_irq_mask( struct cxm_softc *sc, u_int32_t mask ) >X { >X+/* userland! */ >X intrmask_t s; >X >X s = spltty(); >X@@ -661,10 +671,12 @@ >X { >X >X if (sc->cxm_iic) { >X+#ifdef _nuniet_ >X if (cxm_saa7115_mute(sc) < 0) >X return -1; >X if (cxm_msp_mute(sc) < 0) >X return -1; >X+#endif >X } >X >X /* Halt the firmware */ >X@@ -811,7 +823,7 @@ >X ¶meter, 1) < 0) >X return -1; >X >X- printf("%s: encoder firmware version %#x\n", >X+ log(LOG_DEBUG,"%s: encoder firmware version %#x\n", >X sc->name, (unsigned int)parameter); >X >X /* Get decoder firmware version */ >X@@ -822,14 +834,13 @@ >X ¶meter, 1) < 0) >X return -1; >X >X- printf("%s: decoder firmware version %#x\n", >X+ log(LOG_DEBUG,"%s: decoder firmware version %#x\n", >X sc->name, (unsigned int)parameter); >X } >X >X return 0; >X } >X >X- >X static int >X cxm_configure_encoder( struct cxm_softc *sc ) >X { >X@@ -838,7 +849,7 @@ >X u_int32_t parameters[12]; >X const struct cxm_codec_profile *cpp; >X >X- if (sc->source == cxm_fm_source) >X+ if (1 || sc->source == cxm_fm_source) >X switch (cxm_tuner_selected_channel_set(sc)) { >X case CHNLSET_NABCST: >X case CHNLSET_CABLEIRC: >X@@ -854,8 +865,12 @@ >X else >X fps = cxm_saa7115_detected_fps(sc); >X >X+ >X if (fps < 0) >X- return -1; >X+ { >X+ log(LOG_DEBUG,"Could not detect FPS\n"); >X+ return -1; >X+ } >X >X if (sc->profile->fps != fps) { >X >X@@ -879,11 +894,12 @@ >X } >X >X cpp = sc->profile; >X- >X+/* >X if (cxm_saa7115_configure(sc, >X cpp->width, cpp->source_height, fps, >X cpp->audio_sample_rate) < 0) >X return -1; >X+*/ >X >X /* assign dma block len */ >X parameters[0] = 1; /* Transfer block size = 1 */ >X@@ -1090,17 +1106,26 @@ >X u_int32_t type; >X >X if (sc->encoding) >X+ { >X+ log(LOG_DEBUG,"already encoding\n"); >X return 0; >X+ } >X >X if (cxm_configure_encoder(sc) < 0) >X+ { >X+ log(LOG_DEBUG,"could not config dec\n"); >X return -1; >X+ } >X >X /* Mute the video input if necessary. */ >X parameters[0] = sc->source == cxm_fm_source ? 1 : 0; >X if (cxm_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_MUTE_VIDEO_INPUT, >X parameters, 1) != 0) >X+ { >X+ log(LOG_DEBUG,"could not mute vid inp\n"); >X return -1; >X+ } >X >X /* Clear pending encoder interrupts (which are currently masked) */ >X cxm_set_irq_status(sc, CXM_IRQ_ENC); >X@@ -1113,22 +1138,39 @@ >X if (cxm_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_ENC_EVENT_NOTIFICATION, >X parameters, 4) != 0) >X+ { >X+ log(LOG_DEBUG,"could not act evt not\n"); >X return -1; >X+ } >X >X+#ifdef _nuniet_ >X if (cxm_saa7115_mute(sc) < 0) >X return -1; >X if (cxm_msp_mute(sc) < 0) >X return -1; >X+#endif >X >X if (cxm_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_INITIALIZE_VIDEO_INPUT, >X NULL, 0) < 0) >X+ { >X+ log(LOG_DEBUG,"could not init vid inp\n"); >X return -1; >X+ } >X >X+#ifdef _nuniet_ >X if (cxm_saa7115_unmute(sc) < 0) >X return -1; >X if (cxm_msp_unmute(sc) < 0) >X return -1; >X+#endif >X+ >X+ cx25840_command(sc->iicbus, VIDIOC_STREAMOFF, NULL); >X+ >X+cxm_firmware_command(sc,cxm_enc_mailbox, 0xcd, NULL, 0); >X+ >X+ cx25840_command(sc->iicbus, VIDIOC_STREAMON, NULL); >X+ >X >X /* Wait for 100ms */ >X (void)tsleep(&sc->encoding, PWAIT, "cxmce", hz / 10); >X@@ -1145,7 +1187,10 @@ >X parameters[1] = subtype; >X if (cxm_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_BEGIN_CAPTURE, parameters, 2) != 0) >X+ { >X+ log(LOG_DEBUG,"could not begin capt\n"); >X return -1; >X+ } >X >X sc->enc_pool.offset = 0; >X sc->enc_pool.read = 0; >X@@ -1154,6 +1199,7 @@ >X sc->encoding_eos = 0; >X >X sc->encoding = 1; >X+ sc->inint = 0; >X >X /* Enable interrupts */ >X cxm_set_irq_mask(sc, sc->irq_mask & ~CXM_IRQ_ENC); >X@@ -1165,10 +1211,12 @@ >X static int >X cxm_stop_encoder( struct cxm_softc *sc ) >X { >X+/* userland! */ >X u_int32_t parameters[4]; >X u_int32_t subtype; >X u_int32_t type; >X intrmask_t s; >X+ >X >X if (! sc->encoding ) >X return 0; >X@@ -1191,11 +1239,13 @@ >X /* Wait for up to 1 second */ >X s = spltty(); >X if (! sc->encoding_eos ) >X+ { >X (void)tsleep(&sc->encoding_eos, PWAIT, "cxmeos", hz); >X+ } >X splx(s); >X >X if (sc->mpeg && ! sc->encoding_eos ) >X- printf("%s: missing encoder EOS\n", sc->name); >X+ log(LOG_DEBUG,"%s: missing encoder EOS\n", sc->name); >X >X /* Disable event notification */ >X parameters[0] = 0; /* Event = 0 (refresh encoder input) */ >X@@ -1257,9 +1307,9 @@ >X unsigned int macroblocks_per_line; >X unsigned int scratch; >X unsigned int words_per_line; >X- u_int32_t *ptr; >X+ u_int32_t *ptr, *ptr_end; >X u_int32_t *src; >X- size_t nbytes; >X+ /* size_t nbytes; */ >X >X switch (sc->enc_pool.bufs[current].byte_order) { >X case cxm_device_mpeg_byte_order: >X@@ -1267,17 +1317,23 @@ >X /* >X * Convert each 32 bit word to the proper byte ordering. >X */ >X- >X+#ifdef _nunieT_ >X for (nbytes = 0, >X ptr = (u_int32_t *)sc->enc_pool.bufs[current].vaddr; >X nbytes != sc->enc_pool.bufs[current].size; >X nbytes += sizeof(*ptr), ptr++) >X *ptr = bswap32(*ptr); >X- >X+#else >X+ ptr = (u_int32_t *)sc->enc_pool.bufs[current].vaddr ; >X+ ptr_end = ptr + ( sc->enc_pool.bufs[current].size / sizeof(u_int32_t) ); >X+ >X+ for(;ptr < ptr_end;ptr++) >X+ *ptr = bswap32(*ptr); >X+#endif >X break; >X >X case cxm_device_yuv12_byte_order: >X- >X+log(LOG_DEBUG,"yuv!\n"); >X /* >X * Convert each macro block to planar using >X * a scratch buffer (the buffer prior to the >X@@ -1349,12 +1405,12 @@ >X if (cxm_queue_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_SCHED_DMA_TO_HOST, >X parameters, 3) == -1) { >X- printf("%s: failed to discard encoder dma request\n", >X+ log(LOG_DEBUG,"%s: failed to discard encoder dma request\n", >X sc->name); >X return; >X } >X >X- sc->encoding_dma = -1; >X+ sc->encoding_dma = 0; /* was -1 ?? */ >X } >X >X >X@@ -1363,10 +1419,11 @@ >X { >X int buffers_pending; >X u_int32_t status; >X- intrmask_t s; >X+ /* unsigned int buffers_available; */ >X+ /* intrmask_t s; */ >X >X if (! sc->encoding_dma) { >X- printf("%s: encoder dma not already in progress\n", >X+ log(LOG_DEBUG,"%s: encoder dma not already in progress\n", >X sc->name); >X return; >X } >X@@ -1382,23 +1439,31 @@ >X if ((status >X & (CXM_DMA_ERROR_LIST | CXM_DMA_ERROR_WRITE | CXM_DMA_SUCCESS)) >X != CXM_DMA_SUCCESS) { >X- printf("%s: encoder dma status %#x\n", >X+ log(LOG_DEBUG,"%s: encoder dma status %#x\n", >X sc->name, (unsigned int)status); >X return; >X } >X >X /* Update the books (spl is used since mutex is not available) */ >X- s = spltty(); >X+/* s = spltty(); */ >X sc->enc_pool.write = (sc->enc_pool.write + buffers_pending) >X % CXM_SG_BUFFERS; >X- splx(s); >X+ /* splx(s); */ >X >X /* signal anyone requesting notification */ >X if (sc->enc_proc) >X psignal (sc->enc_proc, sc->enc_signal); >X >X- /* wakeup anyone waiting for data */ >X- wakeup(&sc->enc_pool.read); >X+ /* wakeup anyone waiting for data >X+buffers_available = sc->enc_pool.write - sc->enc_pool.read; >X+ if (buffers_available < 0) >X+ buffers_available += CXM_SG_BUFFERS; >X+ >X+ if(buffers_available >= sc->buffers_requested) >X+ { >X+ sc->buffers_requested = 0; */ >X+ wakeup(&sc->enc_pool.read); >X+ /* } */ >X >X /* wakeup anyone polling for data */ >X selwakeup(&sc->enc_sel); >X@@ -1424,10 +1489,10 @@ >X size_t offset; >X size_t size; >X } requests[2]; >X- intrmask_t s; >X+ /* intrmask_t s; */ >X >X if (sc->encoding_dma) { >X- printf("%s: encoder dma already in progress\n", >X+ log(LOG_DEBUG,"%s: encoder dma already in progress\n", >X sc->name); >X cxm_encoder_dma_discard(sc); >X return; >X@@ -1436,12 +1501,11 @@ >X mailbox = sc->enc_mbx >X + CXM_MBX_FW_DMA_MAILBOX * sizeof(struct cxm_mailbox); >X >X- for (i = 0; i < CXM_MBX_MAX_PARAMETERS; i++) >X- parameters[i] >X+ parameters[0] >X = CSR_READ_4(sc, >X mailbox >X + offsetof(struct cxm_mailbox, parameters) >X- + i * sizeof(u_int32_t)); >X+ + 0 * sizeof(u_int32_t)); >X >X byte_order = cxm_device_mpeg_byte_order; >X max_sg_segment = CXM_SG_SEGMENT; >X@@ -1450,11 +1514,25 @@ >X >X switch (type) { >X case 0: /* MPEG */ >X+ for (i = 1; i < 3/* CXM_MBX_MAX_PARAMETERS */; i++) >X+ parameters[i] >X+ = CSR_READ_4(sc, >X+ mailbox >X+ + offsetof(struct cxm_mailbox, parameters) >X+ + i * sizeof(u_int32_t)); >X+ >X requests[nrequests].offset = parameters[1]; >X requests[nrequests++].size = parameters[2]; >X break; >X >X case 1: /* YUV */ >X+ for (i = 1; i < 5/* CXM_MBX_MAX_PARAMETERS */; i++) >X+ parameters[i] >X+ = CSR_READ_4(sc, >X+ mailbox >X+ + offsetof(struct cxm_mailbox, parameters) >X+ + i * sizeof(u_int32_t)); >X+ >X byte_order = cxm_device_yuv12_byte_order; >X >X /* >X@@ -1482,7 +1560,7 @@ >X case 2: /* PCM (audio) */ >X case 3: /* VBI */ >X default: >X- printf("%s: encoder dma type %#x unsupported\n", >X+ log(LOG_DEBUG,"%s: encoder dma type %#x unsupported\n", >X sc->name, (unsigned int)type); >X cxm_encoder_dma_discard(sc); >X return; >X@@ -1492,11 +1570,11 @@ >X * Determine the number of buffers free at this * instant * >X * taking into consideration that the ring buffer wraps. >X */ >X- s = spltty(); >X+ /* s = spltty(); */ >X buffers_free = sc->enc_pool.read - sc->enc_pool.write; >X if (buffers_free <= 0) >X buffers_free += CXM_SG_BUFFERS; >X- splx(s); >X+ /* splx(s); */ >X >X /* >X * Build the scatter / gather list taking in >X@@ -1508,10 +1586,11 @@ >X >X buffers_pending = 0; >X current = sc->enc_pool.write; >X+ /* splx(s); */ >X >X for (i = 0; i < nrequests; i++) { >X if (! requests[i].size ) { >X- printf("%s: encoder dma size is zero\n", sc->name); >X+ log(LOG_DEBUG,"%s: encoder dma size is zero\n", sc->name); >X cxm_encoder_dma_discard(sc); >X return; >X } >X@@ -1536,7 +1615,7 @@ >X current = (current + 1) % CXM_SG_BUFFERS; >X >X if (buffers_pending >= buffers_free) { >X- printf( >X+ log(LOG_DEBUG, >X "%s: encoder dma not enough buffer space free\n", >X sc->name); >X cxm_encoder_dma_discard(sc); >X@@ -1555,7 +1634,7 @@ >X if (cxm_queue_firmware_command(sc, cxm_enc_mailbox, >X CXM_FW_CMD_SCHED_DMA_TO_HOST, >X parameters, 3) == -1) { >X- printf("%s: failed to schedule encoder dma request\n", >X+ log(LOG_DEBUG,"%s: failed to schedule encoder dma request\n", >X sc->name); >X return; >X } >X@@ -1575,7 +1654,7 @@ >X static int >X cxm_encoder_wait_for_lock( struct cxm_softc *sc ) >X { >X- int muted; >X+ /* int muted; */ >X int locked; >X int result; >X >X@@ -1590,6 +1669,7 @@ >X return result; >X } >X >X+#ifdef _nuniet_ >X /* >X * Wait for the video decoder to lock. >X */ >X@@ -1616,6 +1696,7 @@ >X if (muted == 0 && cxm_msp_unmute(sc) < 0) >X return -1; >X } >X+#endif >X >X return locked; >X } >X@@ -1678,6 +1759,8 @@ >X unit = device_get_unit(dev); >X >X sc->type = cxm_iTVC15_type; >X+ sc->inint =0; >X+ >X switch(pci_get_device(dev)) { >X case CXM_DEVICEID_CONEXANT_iTVC16: >X sc->type = cxm_iTVC16_type; >X@@ -1737,6 +1820,7 @@ >X goto fail; >X } >X >X+ >X /* >X * Initialize the tuner. >X */ >X@@ -1746,6 +1830,7 @@ >X goto fail; >X } >X >X+#ifdef _nuniet_ >X /* >X * Initialize the SAA7115. >X */ >X@@ -1772,6 +1857,33 @@ >X error = ENXIO; >X goto fail; >X } >X+#endif >X+ >X+ cx25840_initialize(sc->iicbus,1); >X+ tda9887_initialize(sc->iicbus); >X+ wm8775_init(sc->iicbus); >X+ >X+ { int jan = 0; >X+ >X+ /* set the standard */ >X+ if(cxm_eeprom_get_std(sc)) >X+ { >X+ device_printf(dev,"Eeprom NTSC\n"); >X+ jan = V4L2_STD_NTSC_M; >X+ } >X+ else >X+ { >X+ device_printf(dev,"Eeprom PAL\n"); >X+ jan = V4L2_STD_PAL; >X+ } >X+ >X+ tda9887_command(sc->iicbus, VIDIOC_S_STD , &jan); >X+ cx25840_command(sc->iicbus, VIDIOC_S_STD , &jan); >X+ } >X+ >X+ DELAY(100000); >X+ >X+ cx25840_command(sc->iicbus, VIDIOC_LOG_STATUS,NULL); >X >X sc->dec_mbx = -1; >X sc->enc_mbx = -1; >X@@ -1922,6 +2034,9 @@ >X goto fail; >X } >X >X+if(cxm_eeprom_get_std(sc)) >X+ sc->profile = &dvd_full_d1_pal_profile; >X+else >X sc->profile = &dvd_full_d1_ntsc_profile; >X >X sc->source = cxm_tuner_source; >X@@ -2074,12 +2189,17 @@ >X /* Get the device data */ >X sc = (struct cxm_softc *)arg; >X >X+ sc->inint = 1; >X+ >X status = CSR_READ_4(sc, CXM_REG_IRQ_STATUS); >X >X status &= ~sc->irq_mask; >X >X if (! status ) >X+ { >X+ sc->inint = 0; >X return; >X+ } >X >X /* Process DMA done before handling a new DMA request or EOS */ >X if (status & CXM_IRQ_ENC_DMA_DONE) >X@@ -2093,6 +2213,8 @@ >X wakeup(&sc->encoding_eos); >X } >X >X+ sc->inint = 0; >X+ >X cxm_set_irq_status(sc, status); >X } >X >X@@ -2190,6 +2312,7 @@ >X int unit; >X struct cxm_softc *sc; >X >X+ >X unit = UNIT( minor(dev) ); >X >X /* Get the device data */ >X@@ -2199,15 +2322,17 @@ >X return ENXIO; >X } >X >X- if (sc->is_opened) >X- return EBUSY; >X+ /* if (sc->is_opened) >X+ return EBUSY; */ >X >X- sc->is_opened = 1; >X+ sc->is_opened++; >X sc->mpeg = 1; >X >X /* Record that the device is now busy */ >X- device_busy(devclass_get_device(cxm_devclass, unit)); >X+ if(sc->is_opened==1) >X+ device_busy(devclass_get_device(cxm_devclass, unit)); >X >X+log(LOG_DEBUG,"device %s opened\n", sc->name); >X return 0; >X } >X >X@@ -2254,12 +2379,16 @@ >X int >X cxm_read( dev_t dev, struct uio *uio, int flag ) >X { >X+/* userland! */ >X int buffers_available; >X int buffers_read; >X int error; >X int unit; >X unsigned int current; >X- unsigned int i; >X+/* unsigned int i; */ >X+ unsigned int encread; >X+/* unsigned int br; */ >X+ /*unsigned int uior; */ >X size_t nbytes; >X size_t offset; >X struct cxm_softc *sc; >X@@ -2277,38 +2406,50 @@ >X /* Only trigger the encoder if the ring buffer is empty */ >X if (! sc->encoding && sc->enc_pool.read == sc->enc_pool.write) { >X if (cxm_start_encoder(sc) < 0) >X+ { >X+ log(LOG_DEBUG,"could not start encoder\n"); >X return ENXIO; >X+ } >X if (flag & IO_NDELAY) >X return EWOULDBLOCK; >X } >X- >X+#ifdef _nuniet_ >X buffers_available = 0; >X >X- s = spltty(); >X- while (sc->enc_pool.read == sc->enc_pool.write) { >X+ s = spltty(); >X+ >X+ buffers_available = sc->enc_pool.write - sc->enc_pool.read; >X+ if (buffers_available < 0) >X+ buffers_available += CXM_SG_BUFFERS; >X+ >X+ uior = uio->uio_resid; >X+ br = sc->buffers_requested = uio->uio_resid / CXM_SG_SEGMENT; >X+ >X+ while (buffers_available < sc->buffers_requested) { /* )sc->enc_pool.read = sc->enc_pool.write) { */ >X error = tsleep(&sc->enc_pool.read, PZERO | PCATCH, "cmxrd", 0); >X+ >X+ buffers_available = sc->enc_pool.write - sc->enc_pool.read; >X+ if (buffers_available < 0) >X+ buffers_available += CXM_SG_BUFFERS; >X+ >X if (error) { >X splx(s); >X return error; >X } >X } >X >X- /* >X- * Determine the number of buffers available at this * instant * >X- * taking in consideration that the ring buffer wraps. >X- */ >X- buffers_available = sc->enc_pool.write - sc->enc_pool.read; >X- if (buffers_available < 0) >X- buffers_available += CXM_SG_BUFFERS; >X+ offset = sc->enc_pool.offset; >X+ encread = sc->enc_pool.read; >X splx(s); >X >X- offset = sc->enc_pool.offset; >X- >X- for (buffers_read = 0, i = sc->enc_pool.read; >X+ for (buffers_read = 0, i = encread; >X buffers_read != buffers_available && uio->uio_resid; >X buffers_read++, i = (i + 1) % CXM_SG_BUFFERS) { >X >X- current = cxm_encoder_fixup_byte_order (sc, i, offset); >X+ if(!offset) >X+ current = cxm_encoder_fixup_byte_order (sc, i, offset); >X+ else >X+ current = i; >X >X nbytes = sc->enc_pool.bufs[current].size - offset; >X >X@@ -2328,20 +2469,85 @@ >X break; >X >X offset = 0; >X+ s = spltty(); >X+ sc->enc_pool.read = ( sc->enc_pool.read + 1 ) % CXM_SG_BUFFERS; >X+ splx(s); >X } >X- >X- sc->enc_pool.offset = offset; >X+if(offset) >X+ log(LOG_DEBUG,"offset = %d, bufs_req = %d, uio_req = %d\n",offset,br,uior); >X >X /* Update the books (spl is used since mutex is not available) */ >X- s = spltty(); >X- sc->enc_pool.read = (sc->enc_pool.read + buffers_read) >X- % CXM_SG_BUFFERS; >X- splx(s); >X+ /* s = spltty(); */ >X+ sc->enc_pool.offset = offset; >X+ >X+ /* sc->enc_pool.read = (sc->enc_pool.read + buffers_read) >X+ % CXM_SG_BUFFERS; */ >X+ /* splx(s); */ >X+#else >X+ buffers_read = 0; >X+ do { >X+ s = spltty(); >X+ encread = sc->enc_pool.read = (sc->enc_pool.read + buffers_read) % CXM_SG_BUFFERS; >X+ buffers_read = 0; >X+ buffers_available = sc->enc_pool.write - sc->enc_pool.read; >X+ offset = sc->enc_pool.offset; >X+ splx(s); >X+ if (buffers_available < 0) >X+ buffers_available += CXM_SG_BUFFERS; >X+ >X+ if(!uio->uio_resid) >X+ { >X+ break; >X+ } >X+ >X+ if(buffers_available == 0) >X+ { >X+ error = tsleep(&sc->enc_pool.read, PZERO | PCATCH, "cmxrd", 0); >X+ >X+ if(error) >X+ return error; >X+ else >X+ continue; >X+ } >X+ else >X+ { >X+ current = cxm_encoder_fixup_byte_order (sc, encread, offset); >X+ >X+ nbytes = sc->enc_pool.bufs[current].size - offset; >X+ >X+ /* Don't transfer more than requested */ >X+ if (nbytes > uio->uio_resid) >X+ nbytes = uio->uio_resid; >X+ >X+ error = uiomove(sc->enc_pool.bufs[current].vaddr + offset, >X+ nbytes, uio); >X+ >X+ if (error) >X+ return error; >X+ >X+ offset += nbytes; >X+ >X+ /* Handle a partial read of a buffer */ >X+ if (! uio->uio_resid && offset != sc->enc_pool.bufs[current].size) >X+ { >X+ sc->enc_pool.offset = offset; >X+ /* no need to update the books! */ >X+ break; >X+ } >X+ >X+ sc->enc_pool.offset = offset = 0; >X+ buffers_read = 1; >X+ } >X+ } while(1); >X+#endif >X+ >X >X return 0; >X } >X >X >X+#include "v4l2_ioctl_hook.c" >X+ >X /* >X * >X */ >X@@ -2736,11 +2942,22 @@ >X >X switch (*(unsigned long *)arg & 0xf000) { >X case METEOR_INPUT_DEV1: >X+printf("tuner input\n"); >X source = cxm_tuner_source; >X break; >X >X case METEOR_INPUT_DEV2: >X+{ >X+int arg; >X source = cxm_line_in_source_composite; >X+arg=AUDIO_EXTERN_1; >X+cx25840_command(sc->iicbus, AUDC_SET_INPUT,&arg); >X+wm8775_command(sc->iicbus, AUDC_SET_INPUT,&arg); >X+ >X+ >X+arg=CX25840_COMPOSITE0; >X+cx25840_command(sc->iicbus, VIDIOC_S_INPUT, &arg); >X+} >X break; >X >X case METEOR_INPUT_DEV_SVIDEO: >X@@ -2766,11 +2983,12 @@ >X >X if (cxm_pause_encoder(sc) < 0) >X return ENXIO; >X- >X+/* >X if (cxm_saa7115_select_source(sc, source) < 0) >X return ENXIO; >X if (cxm_msp_select_source(sc, source) < 0) >X return ENXIO; >X+*/ >X >X sc->source = source; >X >X@@ -2866,9 +3084,10 @@ >X break; >X >X case TVTUNER_SETCHNL: >X+/* >X if (sc->source == cxm_tuner_source) >X if (cxm_pause_encoder(sc) < 0) >X- return ENXIO; >X+ return ENXIO; */ >X >X if (cxm_tuner_select_channel(sc, *(unsigned int *)arg) < 0) >X return ENXIO; >X@@ -2881,6 +3100,7 @@ >X * Explicitly wait for the tuner lock so we >X * can indicate if there's a station present. >X */ >X+/* >X if (cxm_tuner_wait_for_lock(sc) < 0) >X return EINVAL; >X >X@@ -2888,11 +3108,11 @@ >X if (result < 0) >X return ENXIO; >X else if (result == 0) >X- return EINVAL; >X- >X+ return EINVAL; */ >X+/* >X if (sc->source == cxm_tuner_source) >X if (cxm_unpause_encoder(sc) < 0) >X- return ENXIO; >X+ return ENXIO; */ >X break; >X >X case TVTUNER_GETFREQ: >X@@ -2930,6 +3150,8 @@ >X if (sc->source == cxm_tuner_source) >X if (cxm_unpause_encoder(sc) < 0) >X return ENXIO; >X+ >X+ cx25840_command(sc->iicbus, VIDIOC_LOG_STATUS,NULL); >X break; >X >X case TVTUNER_GETSTATUS: >X@@ -2946,7 +3168,7 @@ >X break; >X >X default: >X- return ENOTTY; >X+ return v4l2_ioctl_hook(sc,cmd,arg); >X } >X >X return 0; >Xdiff -ur ../work.orig/dev/cxm/cxm.h dev/cxm/cxm.h >X--- ../work.orig/dev/cxm/cxm.h Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm.h Wed Aug 23 20:45:59 2006 >X@@ -33,6 +33,15 @@ >X * Header file for the Conexant MPEG-2 Codec driver. >X */ >X >X+#ifndef _cxm_h >X+#define _cxm_h >X+ >X+#if __FreeBSD_version >= 500014 >X+# include <sys/selinfo.h> >X+#else >X+# include <sys/select.h> >X+#endif >X+ >X #if __FreeBSD_version >= 503001 >X # define dev_t struct cdev * >X #endif >X@@ -64,7 +73,7 @@ >X enum cxm_byte_order byte_order; >X }; >X >X-#define CXM_SG_BUFFERS 50 >X+#define CXM_SG_BUFFERS 16 >X >X struct cxm_buffer_pool { >X bus_dma_tag_t dmat; >X@@ -183,7 +192,8 @@ >X * that the size of each piece must be a multiple of >X * 256 and less than 64k. >X */ >X-#define CXM_SG_SEGMENT (0xff00 & ~(PAGE_SIZE - 1)) >X+#define CXM_SG_SEGMENT 32768 >X+/* (0xff00 & ~(PAGE_SIZE - 1)) */ >X >X struct cxm_sg_entry { >X u_int32_t src; >X@@ -243,6 +253,8 @@ >X >X unsigned int dec_mbx; >X unsigned int enc_mbx; >X+ unsigned int inint; >X+ unsigned int buffers_requested; >X >X device_t cxm_iic; >X device_t iicbus; >X@@ -266,6 +278,7 @@ >X int encoding; >X int encoding_dma; >X int encoding_eos; >X+ int tuner_signal; >X }; >X >X /* >X@@ -434,7 +447,7 @@ >X #define CXM_FW_CAPTURE_STREAM_PCM_AUDIO 0x00000002 >X #define CXM_FW_CAPTURE_STREAM_VBI 0x00000004 >X >X-#define CXM_FW_STREAM_TYPE_DVD 0x0000000a >X+#define CXM_FW_STREAM_TYPE_DVD 0x0000000e >X #define CXM_FW_STREAM_TYPE_MPEG1 0x00000002 >X #define CXM_FW_STREAM_TYPE_MPEG2_PROGRAM 0x00000000 >X #define CXM_FW_STREAM_TYPE_SVCD 0x0000000c >X@@ -463,6 +476,7 @@ >X */ >X int cxm_eeprom_init( struct cxm_softc *sc ); >X int cxm_eeprom_tuner_type( struct cxm_softc *sc ); >X+int cxm_eeprom_get_std( struct cxm_softc *sc ); >X >X /* >X * Infrared remote >X@@ -521,8 +535,9 @@ >X #define CXM_TUNER_LG_TAPE_H001F 18 >X #define CXM_TUNER_MICROTUNE_4049_FM5 19 >X #define CXM_TUNER_TCL_2002N_6A 20 >X+#define CXM_TUNER_SAMSUNG 21 >X >X-#define CXM_TUNER_TYPES 21 >X+#define CXM_TUNER_TYPES 22 >X >X #define CXM_TUNER_AFC_MASK 0x07 >X >X@@ -656,3 +671,5 @@ >X int cxm_saa7115_set_hue( struct cxm_softc *sc, unsigned char hue ); >X int cxm_saa7115_is_locked( struct cxm_softc *sc ); >X int cxm_saa7115_wait_for_lock( struct cxm_softc *sc ); >X+ >X+#endif /* cmx_h */ >Xdiff -ur ../work.orig/dev/cxm/cxm_eeprom.c dev/cxm/cxm_eeprom.c >X--- ../work.orig/dev/cxm/cxm_eeprom.c Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm_eeprom.c Sun Aug 27 15:31:24 2006 >X@@ -112,6 +112,16 @@ >X return 0; >X } >X >X+static unsigned int sup_std[4]; >X+ >X+int cxm_eeprom_get_std( struct cxm_softc *sc ) >X+{ >X+ int dev_num; >X+ >X+ dev_num = device_get_unit(sc->iicbus); >X+ >X+ return sup_std[dev_num] == 8; /* returns true if ntsc */ >X+} >X >X int >X cxm_eeprom_tuner_type( struct cxm_softc *sc ) >X@@ -122,6 +132,11 @@ >X unsigned int subsystem_vendor_id; >X unsigned int tuner_code; >X int tuner_type; >X+int dev_num; >X+int beenhere; >X+beenhere = 0; >X+ >X+dev_num = device_get_unit(sc->iicbus); >X >X if (cxm_eeprom_read(sc->iicbus, CXM_I2C_EEPROM, >X eeprom, sizeof(eeprom), 0) != sizeof(eeprom)) >X@@ -154,7 +169,7 @@ >X } >X else if ((eeprom[i] & 0xf0) == 0x70) { >X if (eeprom[i] & 0x08) >X- break; >X+ break; >X len = eeprom[i] & 0x07; >X i++; >X } >X@@ -174,11 +189,20 @@ >X >X switch (eeprom[i]) { >X case 0x00: >X- tuner_code = eeprom[i + 6]; >X+ tuner_code = eeprom[i + 6]; >X+ sup_std[dev_num] = eeprom[i + 5]; >X break; >X >X case 0x0a: >X- tuner_code = eeprom[i + 2]; >X+if(beenhere==0) >X+{ >X+ tuner_code = eeprom[i + 2]; /* + 2 */ >X+ sup_std[dev_num] = eeprom[i + 1]; >X+beenhere = 1; >X+} >X+else >X+printf("second(radio) tuner %d\n",(int)eeprom[i+2]); >X+ >X break; >X >X default: >X@@ -186,6 +210,8 @@ >X } >X } >X >X+printf("tuner code %d\n",tuner_code); >X+ >X switch (tuner_code) { >X case 0x03: /* Philips FI1216 */ >X case 0x08: /* Philips FI1216 MK2 */ >X@@ -196,6 +222,8 @@ >X tuner_type = CXM_TUNER_PHILIPS_FQ1216ME; >X break; >X >X+case 0x69: >X+case 0x5b: >X case 0x37: /* Philips FQ1216ME MK3 */ >X tuner_type = CXM_TUNER_PHILIPS_FQ1216ME_MK3; >X break; >X@@ -271,6 +299,9 @@ >X case 0x13: /* Philips FR1246 MK2 */ >X case 0x18: /* Philips FM1246 */ >X tuner_type = CXM_TUNER_PHILIPS_FM1246; >X+ break; >X+ case 0x57: >X+ tuner_type = CXM_TUNER_SAMSUNG; >X break; >X >X default: >Xdiff -ur ../work.orig/dev/cxm/cxm_extract_fw.c dev/cxm/cxm_extract_fw.c >X--- ../work.orig/dev/cxm/cxm_extract_fw.c Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm_extract_fw.c Wed Aug 23 18:03:59 2006 >X@@ -65,11 +65,18 @@ >X char outfile[MAXPATHLEN]; >X size_t i; >X >X+#ifdef _nuniet_ >X if (nbytes < (256 * 1024)) { >X fprintf (stderr, "%s: save_firmware -- firmware image isn't long enough\n", >X MyName); >X return -1; >X } >X+#endif >X+ >X+ if(nbytes> ( 256*1024)) >X+ { >X+ nbytes=256*1024; >X+ } >X >X if (snprintf (outfile, sizeof (outfile), "%s.c", name) >= sizeof (outfile)) { >X fprintf (stderr, "%s: save_firmware -- firmware name is too long\n", >X@@ -86,10 +93,10 @@ >X >X fprintf (ofp, "#include <sys/types.h>\n" >X "\n" >X- "const u_int8_t %s[] __attribute__ ((aligned(4))) = {", >X+ "u_int8_t %s[] __attribute__ ((aligned(4))) = {", >X name); >X >X- for (i = 0; i < (256 * 1024); i++) { >X+ for (i = 0; i < nbytes; i++) { >X if (i) >X fputc (',', ofp); >X if ((i % 8) == 0) >X@@ -167,6 +174,9 @@ >X >X close (fd); >X >X+ >X+if(statbuf.st_size > 100000) >X+{ >X decoder_fw_saved = 0; >X encoder_fw_saved = 0; >X >X@@ -199,17 +209,23 @@ >X exit (1); >X } >X } >X+} >X+else >X+{ >X+/* must be cx25840-file */ >X+save_firmware ("cx25840_fw", start, statbuf.st_size); >X+} >X >X munmap ((caddr_t)start, (size_t)statbuf.st_size); >X- >X+/* >X if (! decoder_fw_saved) >X fprintf (stderr, "%s: decoder image not present\n", MyName); >X >X if (! encoder_fw_saved) >X fprintf (stderr, "%s: encoder image not present\n", MyName); >X- >X if (! decoder_fw_saved || ! encoder_fw_saved) >X exit (1); >X+*/ >X >X exit (0); >X } >Xdiff -ur ../work.orig/dev/cxm/cxm_i2c.c dev/cxm/cxm_i2c.c >X--- ../work.orig/dev/cxm/cxm_i2c.c Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm_i2c.c Wed Aug 23 21:13:52 2006 >X@@ -375,6 +375,7 @@ >X */ >X >X (void)CSR_READ_4(sc, CXM_REG_I2C_SETSCL); >X+ >X } >X >X >X@@ -396,6 +397,7 @@ >X */ >X >X (void)CSR_READ_4(sc, CXM_REG_I2C_SETSDA); >X+ >X } >X >X >X@@ -408,6 +410,6 @@ >X cxm_iic_setsda(dev, data); >X >X /* Wait for 10 usec */ >X- DELAY(10); >X+ DELAY(5); >X } >X #endif >Xdiff -ur ../work.orig/dev/cxm/cxm_tuner.c dev/cxm/cxm_tuner.c >X--- ../work.orig/dev/cxm/cxm_tuner.c Fri Sep 1 23:10:08 2006 >X+++ dev/cxm/cxm_tuner.c Wed Aug 23 22:56:51 2006 >X@@ -1,5 +1,4 @@ >X-/* >X- * Copyright (c) 2003, 2004, 2005 >X+ /* Copyright (c) 2003, 2004, 2005 >X * John Wehle <john@feith.com>. All rights reserved. >X * >X * Redistribution and use in source and binary forms, with or without >X@@ -314,6 +313,7 @@ >X 0, 0, >X { 0 }, >X &l_air_channels }, >X+ >X { "Philips FQ1216ME MK3", >X { CXM_TUNER_TV_SYSTEM_BG | CXM_TUNER_TV_SYSTEM_DK >X | CXM_TUNER_TV_SYSTEM_I >X@@ -507,6 +507,15 @@ >X { 55250, { 0x8e, 0x01 } } }, >X 0, 0, >X { 0 }, >X+ &us_cable_channels }, >X+ { "Samsung TCPN 2121P30A", >X+ { CXM_TUNER_TV_SYSTEM_MN, cxm_none_system_code_style }, >X+ 55250, 801250, >X+ { { 364500, { 0xce, 0x08 } }, >X+ { 130000, { 0xce, 0x02 } }, >X+ { 55250, { 0xce, 0x01 } } }, >X+ 0, 0, >X+ { 0 }, >X &us_cable_channels } >X }; >X >X@@ -517,7 +526,7 @@ >X { >X int received; >X >X- if (iicbus_start(iicbus, i2c_addr + 1, CXM_I2C_TIMEOUT) != 0) >X+ if (iicbus_start(iicbus, i2c_addr + 1 , CXM_I2C_TIMEOUT) != 0) >X return -1; >X >X if (iicbus_read(iicbus, buf, len, &received, IIC_LAST_READ, 0) != 0) >X@@ -562,10 +571,14 @@ >X int tuner_type; >X >X if (cxm_eeprom_init(sc) < 0) >X+{ >X+printf("could not init tuner\n"); >X return -1; >X+} >X >X tuner_type = cxm_eeprom_tuner_type(sc); >X >X+printf("tuner_type = %d\n",tuner_type); >X if (tuner_type < 0 || tuner_type >= NUM_ELEMENTS(cxm_tuners)) >X return -1; >X >X@@ -575,10 +588,16 @@ >X >X if (cxm_tuner_read(sc->iicbus, CXM_I2C_TUNER, &status, sizeof(status)) >X != sizeof(status)) >X+{ >X+printf("could not read tuner\n"); >X return -1; >X+} >X >X- if (cxm_tuner_select_channel(sc, 4) < 0) >X+ if (cxm_tuner_select_channel(sc, 3) < 0) >X+{ >X+printf("could not select channel\n"); >X return -1; >X+} >X >X printf("%s: %s tuner\n", sc->name, sc->tuner->name); >X >X@@ -737,18 +756,17 @@ >X for (band_code = sc->tuner->band_codes; >X band_code->freq > freq; band_code++) >X ; >X- >X if (freq >= sc->tuner_freq) { >X- msg[0] = (unsigned char)(N >> 8); >X- msg[1] = (unsigned char)N; >X+ msg[0] = (unsigned char)(N >> 8) & 0x7f; >X+ msg[1] = (unsigned char)N & 0xff; >X msg[2] = band_code->codes[0]; >X msg[3] = band_code->codes[1] | pb; >X } >X else { >X msg[0] = band_code->codes[0]; >X msg[1] = band_code->codes[1] | pb; >X- msg[2] = (unsigned char)(N >> 8); >X- msg[3] = (unsigned char)N; >X+ msg[2] = (unsigned char)(N >> 8) & 0x7f; >X+ msg[3] = (unsigned char)N & 0xff; >X } >X msg[4] = aux; >X break; >X@@ -758,25 +776,35 @@ >X } >X >X if (N > 32767) >X+{ >X+printf("N bigger than int\n"); >X return -1; >X+} >X >X if (cxm_tuner_write(sc->iicbus, CXM_I2C_TUNER, msg, tuner_msg_len) >X- != tuner_msg_len) >X+ != (tuner_msg_len)) >X+{ >X+printf("write to tuner failed\n"); >X return -1; >X+} >X >X /* >X * Program the IF processing after the tuner since some tuners >X * use the control byte to set the address of the IF. >X */ >X >X- if (system_code) { >X+ if (0 && system_code) { >X+printf("sending system code\n"); >X msg[0] = 0x00; >X msg[1] = system_code->codes[0]; >X msg[2] = system_code->codes[1]; >X msg[3] = system_code->codes[2]; >X >X if (cxm_tuner_write(sc->iicbus, CXM_I2C_TUNER_IF, msg, 4) != 4) >X+{ >X+printf("system code sent failed\n"); >X return -1; >X+} >X } >X >X sc->tuner_freq = freq; >X@@ -797,14 +825,20 @@ >X if (! channels >X || channel < channels->min_channel >X || channel > channels->max_channel) >X+{ >X+printf("channel out of range\n"); >X return -1; >X+} >X >X for (assignments = channels->assignments; >X assignments->channel > channel; assignments++) >X ; >X >X if (! assignments->freq) >X+{ >X+printf("no freq\n"); >X return -1; >X+} >X >X freq = assignments->freq >X + (channel - assignments->channel) * assignments->step; >X@@ -824,6 +858,7 @@ >X unsigned long prev_freq; >X unsigned long step_size; >X >X+printf("in afc\n"); >X if (cxm_tuner_wait_for_lock(sc) != 1) >X return -1; >X >X@@ -835,13 +870,20 @@ >X step_size = 63; >X >X for (i = 0; i < (max_offset / step_size); i++) { >X+printf("afc stepping\n"); >X status = cxm_tuner_status(sc); >X >X if (status == -1) >X+{ >X+printf("afc sattus =1\n"); >X break; >X+} >X >X if (! (status & CXM_TUNER_PHASE_LOCKED) ) >X+{ >X+printf("afc pl\n"); >X break; >X+} >X >X switch (status & CXM_TUNER_AFC_MASK) { >X case CXM_TUNER_AFC_FREQ_CENTERED: >X@@ -862,7 +904,11 @@ >X } >X >X if (freq == prev_freq) >X+{ >X+printf("afc terug bij af\n"); >X return 0; >X+} >X+ >X prev_freq = sc->tuner_freq; >X >X if (cxm_tuner_select_frequency(sc, cxm_tuner_tv_freq_type, >X@@ -963,7 +1009,10 @@ >X >X if (cxm_tuner_read(sc->iicbus, CXM_I2C_TUNER, &status, sizeof(status)) >X != sizeof(status)) >X+{ >X+printf("no status read\n"); >X return -1; >X+} >X >X if (sc->tuner->systems.code_style == cxm_if_system_code_style >X || sc->tuner->systems.code_style >END-of-pvrxxx/files/patch-dev >echo x - pvrxxx/files/patch-cxm_iic >sed 's/^X//' >pvrxxx/files/patch-cxm_iic << 'END-of-pvrxxx/files/patch-cxm_iic' >XOnly in modules/cxm/cxm_iic: @ >Xdiff -ur ../work.orig/modules/cxm/cxm_iic/Makefile modules/cxm/cxm_iic/Makefile >X--- ../work.orig/modules/cxm/cxm_iic/Makefile Fri Sep 1 23:10:08 2006 >X+++ modules/cxm/cxm_iic/Makefile Tue Apr 25 20:35:23 2006 >X@@ -2,5 +2,6 @@ >X KMOD = cxm_iic >X SRCS = cxm_i2c.c cxm.h \ >X opt_cxm.h bus_if.h device_if.h iicbb_if.h pci_if.h >X+CFLAGS += -I../../.. >X >X .include <bsd.kmod.mk> >XOnly in modules/cxm/cxm_iic: export_syms >XOnly in modules/cxm/cxm_iic: machine >XOnly in modules/cxm/cxm_iic: opt_cxm.h >END-of-pvrxxx/files/patch-cxm_iic >echo x - pvrxxx/files/patch-cxm >sed 's/^X//' >pvrxxx/files/patch-cxm << 'END-of-pvrxxx/files/patch-cxm' >XOnly in modules/cxm/cxm: @ >Xdiff -ur ../work.orig/modules/cxm/cxm/Makefile modules/cxm/cxm/Makefile >X--- ../work.orig/modules/cxm/cxm/Makefile Fri Sep 1 23:10:08 2006 >X+++ modules/cxm/cxm/Makefile Wed Aug 23 15:21:41 2006 >X@@ -1,7 +1,10 @@ >X .PATH: ${.CURDIR}/../../../dev/cxm >X KMOD = cxm >X SRCS = cxm.c cxm.h cxm_dec_fw.c cxm_enc_fw.c cxm_audio.c cxm_eeprom.c \ >X- cxm_ir.c cxm_tuner.c cxm_video.c opt_cxm.h \ >X- bus_if.h device_if.h iicbb_if.h pci_if.h vnode_if.h >X+ cxm_ir.c cxm_tuner.c cxm_video.c \ >X+ tda9887.c fbsd-compat.c cx25840-core.c cx25840-audio.c cx25840-firmware.c cx25840_fw.c cx25840-vbi.c wm8775.c\ >X+ opt_cxm.h bus_if.h device_if.h iicbb_if.h pci_if.h vnode_if.h \ >X+ v4l2_ioctl_hook.h tda9887.h wm8775.h fbsd-compat.h >X+CFLAGS+= -I../../.. >X >X .include <bsd.kmod.mk> >XOnly in modules/cxm/cxm: asm >XOnly in modules/cxm/cxm: audiochip.h >XOnly in modules/cxm/cxm: cx25840-audio.c >XOnly in modules/cxm/cxm: cx25840-core.c >XOnly in modules/cxm/cxm: cx25840-firmware.c >XOnly in modules/cxm/cxm: cx25840-vbi.c >XOnly in modules/cxm/cxm: cx25840.h >XOnly in modules/cxm/cxm: export_syms >XOnly in modules/cxm/cxm: fbsd-compat.c >XOnly in modules/cxm/cxm: fbsd-compat.h >XOnly in modules/cxm/cxm: ivtv-compat.h >XOnly in modules/cxm/cxm: linux >XOnly in modules/cxm/cxm: machine >XOnly in modules/cxm/cxm: opt_cxm.h >XOnly in modules/cxm/cxm: tda9887.c >XOnly in modules/cxm/cxm: tda9887.h >XOnly in modules/cxm/cxm: tuner.h >XOnly in modules/cxm/cxm: v4l2-common.h >XOnly in modules/cxm/cxm: v4l2_ioctl_hook.c >XOnly in modules/cxm/cxm: v4l2_ioctl_hook.h >XOnly in modules/cxm/cxm: video_decoder.h >XOnly in modules/cxm/cxm: videodev.h >XOnly in modules/cxm/cxm: videodev2.h >XOnly in modules/cxm/cxm: wm8775.c >XOnly in modules/cxm/cxm: wm8775.h >END-of-pvrxxx/files/patch-cxm >echo x - pvrxxx/Makefile >sed 's/^X//' >pvrxxx/Makefile << 'END-of-pvrxxx/Makefile' >X# >X# Adapted ports collection makefile for: pvrxxx >X# Date created: 22 August 2006 >X# Whom: usleepless <usleepless@gmail.com> >X# based on: >X# >X# New ports collection makefile for: pvr250 >X# Date created: 10 October 2004 >X# Whom: Edwin Groothuis <edwin@mavetju.org> >X# >X# $FreeBSD: ports/multimedia/pvrxxx/Makefile,v 1.13 2006/01/21 21:41:42 edwin Exp $ >X# >X >XPORTNAME= pvrxxx >XPORTVERSION= 20060822 >XCATEGORIES= multimedia >XMASTER_SITES= http://www.mavetju.org/download/adopted/ >XDISTFILES= ${CXMSHAR} ${PVRTOOLS}.tar.gz hcwPVRP2.sys HcwMakoA.ROM pvrxxx_gpl.tgz >XIGNOREFILES= hcwPVRP2.sys # Varies from month to month >X >XMAINTAINER= usleep@gmail.com >XCOMMENT= Hauppauge PVR-150/500 TV cards driver for the cxm device, based on the pv250-port. >X >XPVRTOOLS= pvr250-1.2 >XCXMSHAR= cxm-20051030.shar >X >XWRKSRC= ${WRKDIR} >XUSE_REINPLACE= yes >XNOFETCHFILES= hcwPVRP2.sys HcwMakoA.ROM >X >XRESTRICTED_FILES= hcwPVRP2.sys HcwMakoA.ROM >XRESTRICTED= "This port uses a binary driver which is owned by Hauppauge" >XNO_PACKAGE= ${RESTRICTED} >XNO_CDROM= ${RESTRICTED} >X >XMAN4= cxm.4 >XMAN1= pvr250-setchannel.1 >X >X.include <bsd.port.pre.mk> >X >X.if ${OSVERSION} < 500000 >XMODULESDIR= /modules >X.else >XMODULESDIR= /boot/modules >X.endif >XPLIST_SUB= MODULESDIR=${MODULESDIR} >X >X.if !exists(${DISTDIR}/hcwPVRP2.sys) >XIGNORE= You need the file hcwPVRP2.sys from the CD coming with the PVR-150/500 card. Please place this file in ${DISTDIR} and run make again. Check http://ivtvdriver.org/index.php/Firmware for the recommended version. >X.endif >X >X.if !exists(${DISTDIR}/HcwMakoA.ROM) >XIGNORE= You need the file HcwMakoA.ROM from the CD coming with the PVR-150/500 card. Please place this file in ${DISTDIR} and run m >Xake again. Check http://ivtvdriver.org/index.php/Firmware for the recommended version. >X.endif >X >X.if !exists(/usr/src/sys/dev/iicbus/iicbb.c) >XIGNORE= You need the kernel sources installed to build this module. >X.endif >X >Xpatch-iicbb: >X.if ${OSVERSION} < 500000 >X @if [ -z "`${GREP} cxm_iic /usr/src/sys/dev/iicbus/iicbb.c`" ]; then \ >X ${PATCH} -d/sys <${WRKDIR}/dev/cxm/Patch.iicbb-fbsd4; \ >X ${ECHO_CMD} "Patched /usr/src/sys/dev/iicbus/iicbb.c"; \ >X else \ >X ${ECHO_CMD} "/usr/src/sys/dev/iicbus/iicbb.c was already patched"; \ >X fi >X.else >X @if [ -z "`${GREP} cxm_iic /usr/src/sys/dev/iicbus/iicbb.c`" ]; then \ >X ${PATCH} -d/sys <${WRKDIR}/dev/cxm/Patch.iicbb-fbsd5; \ >X ${ECHO_CMD} "Patched /usr/src/sys/dev/iicbus/iicbb.c"; \ >X else \ >X ${ECHO_CMD} "/usr/src/sys/dev/iicbus/iicbb.c was already patched"; \ >X fi >X.endif >X >Xdo-extract: >X ${MKDIR} ${WRKDIR} >X cd ${WRKDIR}; \ >X ${SH} ${DISTDIR}/${CXMSHAR}; \ >X ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/${PVRTOOLS}.tar.gz ${EXTRACT_AFTER_ARGS}; \ >X cd modules/cxm/cxm; \ >X ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/pvrxxx_gpl.tgz ${EXTRACT_AFTER_ARGS}; >X >Xpost-patch: >X.if ${OSVERSION} < 500000 >X ${REINPLACE_CMD} -e 's/cxm0/bktr0/' \ >X ${WRKDIR}/${PVRTOOLS}/setchannel.c >X ${REINPLACE_CMD} -e 's/tuner0/bktr0/' \ >X ${WRKDIR}/${PVRTOOLS}/setchannel.c >X.else >X ${REINPLACE_CMD} -e 's/tuner0/cxm0/' \ >X ${WRKDIR}/${PVRTOOLS}/setchannel.c >X.endif >X >Xdo-configure: >X cd ${WRKDIR}/dev/cxm; \ >X ${CC} -Wall -o cxm_extract_fw cxm_extract_fw.c; \ >X ./cxm_extract_fw ${DISTDIR}/hcwPVRP2.sys; \ >X cd ../../modules/cxm/cxm; \ >X ../../../dev/cxm/cxm_extract_fw ${DISTDIR}/HcwMakoA.ROM; >X >X >Xdo-build: >X cd ${WRKDIR}/modules/cxm; ${MAKE} >X cd ${WRKDIR}/${PVRTOOLS}; ${MAKE} >X >Xdo-install: >X ${INSTALL_DATA} ${WRKDIR}/modules/cxm/cxm/cxm.ko ${MODULESDIR} >X ${INSTALL_DATA} ${WRKDIR}/modules/cxm/cxm_iic/cxm_iic.ko ${MODULESDIR} >X ${INSTALL_MAN} ${WRKDIR}/${PVRTOOLS}/cxm.4 ${PREFIX}/man/man4/cxm.4 >X ${INSTALL_MAN} ${WRKDIR}/${PVRTOOLS}/pvr250-setchannel.1 ${PREFIX}/man/man1/pvr250-setchannel.1 >X ${INSTALL_PROGRAM} ${WRKDIR}/${PVRTOOLS}/setchannel ${PREFIX}/bin/pvr250-setchannel >X.if ${OSVERSION} < 500000 >X cd /dev; \ >X ./MAKEDEV bktr0 >X.endif >X >Xpost-install: >X @${CAT} ${PKGMESSAGE} >X >X.include <bsd.port.post.mk> >END-of-pvrxxx/Makefile >echo x - pvrxxx/pkg-plist >sed 's/^X//' >pvrxxx/pkg-plist << 'END-of-pvrxxx/pkg-plist' >X@unexec rm %%MODULESDIR%%/cxm.ko >X@unexec rm %%MODULESDIR%%/cxm_iic.ko >Xbin/pvr250-setchannel >END-of-pvrxxx/pkg-plist >echo x - pvrxxx/pkg-message >sed 's/^X//' >pvrxxx/pkg-message << 'END-of-pvrxxx/pkg-message' >XPVR-250/350 - Nearly done! >X >XIf you haven't patched /usr/src/sys/dev/iicbus/iicbb.c yet, and >Xrebuild a new kernel, and rebooted, these are the following steps: >X >X - Run "make patch-iicbb". This will enable cxm to use the i2c bus. >X - Add this to your kernel configuration file: >X DEVICE iicbus >X DEVICE iicbb >X - Rebuild your kernel. >X - Reboot. >X >XNext step is to load the drivers: >X - Run "kldload cxm_iic" >X - Run "kldload cxm" >X >XCheck your console (or /var/log/messages if you're running X) and >Xyou should see something like: >X >X cxm0: <Conexant iTVC15 MPEG Coder> mem ... irq ... at device ... on pci ... >X cxm_iic0: <Conexant iTVC15 / iTVC16 I2C cnotroller> on cxm0 >X iicbb0: <I2C bit-banging driver> on cxm_iic0 >X cxm0: Philips FI1236M K2 Tuner >X cxm0: SAA7115 rev 1 video decoder >X cxm0: MSP3435G-B6 audio decoder >X cxm0: IR Remote >X >XTo test the card, either do "cat /dev/bktr0 > filename.mpg" (FreeBSD >X4.x) or "cat /dev/cxm0 > filename.mpg" (FreeBSD 5.x). >END-of-pvrxxx/pkg-message >echo x - pvrxxx/pkg-descr >sed 's/^X//' >pvrxxx/pkg-descr << 'END-of-pvrxxx/pkg-descr' >XThis port contains: >X >X- Drivers for the Conexant MPEG-2 Codec driver which can be found >X on the Hauppauge PVR-250/350 TV cards. >X These drivers are (c) John Wehle <john@feith.com> >X >X On FreeBSD 4.x, the device used is /dev/bktr0. >X On FreeBSD 5.x, the device used is /dev/cxm0 >X >X This driver has been successfully tested on: >X - FreeBSD 4.10 >X - FreeBSD 5.3 >X >X- One program to modify some ioctls on the card: set the channel >X and set the window size. >X >XNote: >X >X- Note: the maintainer of this port has no inside knowledge of the >X workings of this software. Please don't contact me about cards >X which don't work. Please contact me about problems with the port, >X with possible enhancements, with success stories. >X >XAuthor: John Wehle <john@feith.com> >END-of-pvrxxx/pkg-descr >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 102765
: 70422