source: multiio/pcmmio/multiio_pcmmio.c @ d35032f

Last change on this file since d35032f was 03aa739, checked in by Joel Sherrill <joel.sherrill@…>, on 10/05/11 at 18:07:48

2011-10-05 Joel Sherrill <joel.sherrill@…>

  • mio_io_rtems.c, multiio_pcmmio.c: Rework interrupt handler to reduce overhead per pin change.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include "multiio.h"
13#include "mio_io.h"
14#include <stdint.h>
15#include <rtems.h>
16
17int rtems_multiio_initialize(void)
18{
19  /*
20   *  Initialize the PCMMIO module to use IRQ6.  Ours is jumpered for 0x300
21   *  base address.  We use discrete input interrupts so enable all of the
22   *  as edge triggered on 1.
23   */
24  pcmmio_initialize(0x300, 6);
25  enable_dio_interrupt();
26  { int i;
27    for (i=1 ; i<=48 ; i++ )
28      dio_enab_bit_int(i, 1);
29  }
30
31  return 0;
32}
33
34const char *rtems_multiio_get_name(void)
35{
36  return "Winsystems";
37}
38
39/*
40 *  ADC
41 */
42int rtems_adc_get_maximum(void)
43{
44  return 16;
45}
46
47float rtems_adc_get_channel_voltage(int adc)
48{
49  return adc_get_channel_voltage(adc);
50}
51
52/*
53 *  DAC
54 */
55int rtems_dac_get_maximum(void)
56{
57  return 8;
58}
59
60float rtems_dac_get_minimum_voltage(void)
61{
62  return -10.0;
63}
64
65float rtems_dac_get_maximum_voltage(void)
66{
67  return 10.0;
68}
69
70int rtems_set_dac_voltage(int dac, float voltage)
71{
72  set_dac_voltage(dac, voltage);
73  return 0;
74}
75
76/*
77 *  Discrete Outputs
78 */
79int rtems_dout_get_maximum(void)
80{
81  return 48;
82}
83
84int rtems_set_dout(int dout, int value)
85{
86  dio_write_bit(dout+1, value);
87  return 0;
88}
89
90/*
91 *  Discrete Inputs
92 */
93int rtems_din_get_maximum(void)
94{
95  return 48;
96}
97
98int rtems_din_get(int din)
99{
100  return dio_read_bit(din+1);
101}
102
103int rtems_din_flush_buffered_interrupts(void)
104{
105  flush_buffered_ints();
106  return 0;
107}
108
109int rtems_din_wait_interrupt_with_timestamp(
110  int                milliseconds,
111  struct timespec   *timestamp
112)
113{
114  (void) wait_dio_int_with_timestamp(milliseconds, timestamp);
115  return 0;
116}
117
Note: See TracBrowser for help on using the repository browser.