~smoser/ubuntu/natty/lirc/lp-698208

« back to all changes in this revision

Viewing changes to drivers/lirc_parallel/lirc_parallel.c

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2008-05-10 16:07:40 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080510160740-5wyxu9n2iqh33kpt
Tags: 0.8.3-0ubuntu1
* New upstream version.
* Drop 05_fix_cmdir as it's now included in CVS.
* Update 12_pvr150_transmit_support for configure
  script changes.
* Update 13-warning-cleanup to change from whitespace
  changes from CVS.
* Update 16_lirc-gpio for changes from CVS.
* Update 23_pad2keys for changes from CVS.
* Update 24_freecom_dvbt for changes from CVS.
* Drop 25_upstream_2_6_24 as it's now included from CVS.
* Drop 29_macmini_repeat as it's now included from CVS.
* Update 30_medion_md1_remote for changes from CVS.
* Update 33_asus_mycinema_remote for changes from CVS.
* Update 23_pad2keys patch to properly work (LP: #153184)
* Update 21_atiusb.dpatch because it's half upstream now (LP: #213549)
* Add 23_remove_md8800 as the MD8800 remote is causing problems. (LP: #213549)
* debian/modules-source/lirc-modules-source.conf:
  - Default the mode to be w/ soft carrier. (LP: #182530)
* Update 31_hauppauge_hvr_1100 to use the right devinput driver instead. (LP: #206495)
* Add 34_nebula_digitv.dpatch for supporting the Nebula Digitv remote (LP: #164867)
* Add 35_general_devinput.dpatch for generic devinput devices. (LP: #235811)
* Add 36_remove_extra_tekram.dpatch for removing extra option in lirc.hwdb.
  This option was causing lots of failures (LP: #211566)
* debian/{modules-source/Makefile,rules}:
  - Allow the kernel version to be passed as an argument.
    prevents broken upgrades when the kernel ABI revs (LP: #218955)
* debian/lirc-modules-source.prerm:
  - Check for both remove and upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $Id: lirc_parallel.c,v 5.38 2007/09/27 19:47:22 lirc Exp $      */
 
1
/*      $Id: lirc_parallel.c,v 5.40 2008/01/13 11:13:50 lirc Exp $      */
2
2
 
3
3
/****************************************************************************
4
4
 ** lirc_parallel.c *********************************************************
99
99
 ***********************************************************************/
100
100
 
101
101
static int debug;
 
102
static int check_pselecd;
 
103
 
102
104
unsigned int irq = LIRC_IRQ;
103
105
unsigned int io = LIRC_PORT;
104
106
#ifdef LIRC_TIMER
129
131
 *************************   Interne Funktionen  ***********************
130
132
 ***********************************************************************/
131
133
 
132
 
static unsigned int __inline__ in(int offset)
 
134
static inline unsigned int in(int offset)
133
135
{
134
136
        switch (offset) {
135
137
        case LIRC_LP_BASE:
142
144
        return 0; /* make compiler happy */
143
145
}
144
146
 
145
 
static void __inline__ out(int offset, int value)
 
147
static inline void out(int offset, int value)
146
148
{
147
149
        switch (offset) {
148
150
        case LIRC_LP_BASE:
158
160
        }
159
161
}
160
162
 
161
 
static unsigned int __inline__ lirc_get_timer(void)
 
163
static inline unsigned int lirc_get_timer(void)
162
164
{
163
165
        return (in(LIRC_PORT_TIMER)&LIRC_PORT_TIMER_BIT);
164
166
}
165
167
 
166
 
static unsigned int __inline__  lirc_get_signal(void)
 
168
static inline  unsigned int lirc_get_signal(void)
167
169
{
168
170
        return (in(LIRC_PORT_SIGNAL)&LIRC_PORT_SIGNAL_BIT);
169
171
}
170
172
 
171
 
static void __inline__ lirc_on(void)
 
173
static inline void lirc_on(void)
172
174
{
173
175
        out(LIRC_PORT_DATA, tx_mask);
174
176
}
175
177
 
176
 
static void __inline__ lirc_off(void)
 
178
static inline void lirc_off(void)
177
179
{
178
180
        out(LIRC_PORT_DATA, 0);
179
181
}
255
257
        unsigned int nwptr;
256
258
 
257
259
        nwptr = (wptr + 1) & (RBUF_SIZE - 1);
258
 
        if (nwptr == rptr) { /* no new signals will be accepted */
 
260
        if (nwptr == rptr) {
 
261
                /* no new signals will be accepted */
259
262
                lost_irqs++;
260
263
                printk(KERN_NOTICE "%s: buffer overrun\n", LIRC_DRIVER_NAME);
261
264
                return;
289
292
          disable_irq(irq);
290
293
          out(LIRC_PORT_IRQ, in(LIRC_PORT_IRQ) & (~LP_PINTEN));
291
294
        */
292
 
        if (in(1) & LP_PSELECD)
 
295
        if (check_pselecd && (in(1) & LP_PSELECD))
293
296
                return;
294
297
 
295
298
#ifdef LIRC_TIMER
297
300
                do_gettimeofday(&tv);
298
301
 
299
302
                signal = tv.tv_sec - lasttv.tv_sec;
300
 
                if (signal > 15) {
301
 
                        data = PULSE_MASK;  /* really long time */
302
 
                } else
 
303
                if (signal > 15)
 
304
                        /* really long time */
 
305
                        data = PULSE_MASK;
 
306
                else
303
307
                        data = (lirc_t) (signal*1000000 +
304
308
                                         tv.tv_usec - lasttv.tv_usec +
305
309
                                         LIRC_SFH506_DELAY);
306
310
 
307
311
                rbuf_write(data); /* space */
308
312
        } else {
309
 
                if (timer == 0) { /* wake up; we'll lose this signal
310
 
                                   * but it will be garbage if the device
311
 
                                   * is turned on anyway */
 
313
                if (timer == 0) {
 
314
                        /* wake up; we'll lose this signal
 
315
                         * but it will be garbage if the device
 
316
                         * is turned on anyway */
312
317
                        timer = init_lirc_timer();
313
318
                        /* enable_irq(irq); */
314
319
                        return;
326
331
                level = newlevel;
327
332
 
328
333
                /* giving up */
329
 
                if (signal > timeout || (in(1) & LP_PSELECD)) {
 
334
                if (signal > timeout
 
335
                    || (check_pselecd && (in(1) & LP_PSELECD))) {
330
336
                        signal = 0;
331
337
                        printk(KERN_NOTICE "%s: timeout\n", LIRC_DRIVER_NAME);
332
338
                        break;
436
442
                return -EFAULT;
437
443
 
438
444
#ifdef LIRC_TIMER
439
 
        if (timer == 0) { /* try again if device is ready */
 
445
        if (timer == 0) {
 
446
                /* try again if device is ready */
440
447
                timer = init_lirc_timer();
441
448
                if (timer == 0)
442
449
                        return(-EIO);
466
473
                        if (level == 0 && newlevel != 0)
467
474
                                counttimer++;
468
475
                        level = newlevel;
469
 
                        if (in(1) & LP_PSELECD) {
 
476
                        if (check_pselecd && (in(1) & LP_PSELECD)) {
470
477
                                lirc_off();
471
478
                                local_irq_restore(flags);
472
479
                                return -EIO;
483
490
                        if (level == 0 && newlevel != 0)
484
491
                                counttimer++;
485
492
                        level = newlevel;
486
 
                        if (in(1) & LP_PSELECD) {
 
493
                        if (check_pselecd && (in(1) & LP_PSELECD)) {
487
494
                                local_irq_restore(flags);
488
495
                                return -EIO;
489
496
                        }
767
774
module_param(debug, bool, 0644);
768
775
MODULE_PARM_DESC(debug, "Enable debugging messages");
769
776
 
 
777
module_param(check_pselecd, bool, 0644);
 
778
MODULE_PARM_DESC(debug, "Check for printer (default: 0)");
 
779
 
770
780
EXPORT_NO_SYMBOLS;
771
781
 
772
782
#endif /* MODULE */