Changeset 45abed9 in multiio


Ignore:
Timestamp:
Jul 22, 2009, 8:58:43 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
master
Children:
6955473
Parents:
d7d35da
Message:

2009-07-22 Joel Sherrill <joel.sherrill@…>

  • Makefile, README, main_pcmmio_dac.c, mio_io.h, mio_io_rtems.c, pcmmio_commands.h, pcmmio_shell.c, rtems_config.c: Add pcmmio_irq command and do some cleanup as noticed on other files.
  • main_pcmmio_irq.c: New file.
Location:
pcmmio/original
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • pcmmio/original/ChangeLog

    rd7d35da r45abed9  
     12009-07-22      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile, README, main_pcmmio_dac.c, mio_io.h, mio_io_rtems.c,
     4        pcmmio_commands.h, pcmmio_shell.c, rtems_config.c: Add pcmmio_irq
     5        command and do some cleanup as noticed on other files.
     6        * main_pcmmio_irq.c: New file.
     7
    182009-07-22      Joel Sherrill <joel.sherrill@oarcorp.com>
    29
  • pcmmio/original/Makefile

    rd7d35da r45abed9  
    2222SHARED_CSRCS += main_pcmmio_din.c main_pcmmio_dout.c
    2323SHARED_CSRCS += main_pcmmio_adc.c main_pcmmio_dac.c
     24SHARED_CSRCS += main_pcmmio_irq.c
    2425SHARED_CSRCS += mio_io_rtems.c
    25 #SHARED_CSRCS += string2double.c string2float.c string2int.c \
    26 #  string2long.c string2longlong.c string2unsignedchar.c \
    27 #  string2unsignedint.c string2unsignedlong.c string2unsignedlonglong.c
    2826
    2927SHARED_COBJS = $(SHARED_CSRCS:%.c=${ARCH}/%.o)
  • pcmmio/original/README

    rd7d35da r45abed9  
    5555    Second form writes a pattern.
    5656
     57pcmmio_irq - Wait for PCMMIO IRQs
     58  pcmmio_irq [-i iterations] [-p period] [-v] [-d|-D DAC|-a ADC]
     59
     60  Where: maximum iterations defaults to 1
     61         the period is in milliseconds and defaults to 1000
     62         -d enables discrete input irq monitoring
     63         -D DAC enables irq monitoring on the DAC channel "DAC"
     64         -a ADC enables irq monitoring on the ADC channel "ADC"
     65
     66  You select one of the three IRQ sources to monitor.
    5767
    5868Aliases
  • pcmmio/original/main_pcmmio_dac.c

    rd7d35da r45abed9  
    9797    printf( "Write %6.4f to to dac %d\n", low_voltage, dac );
    9898    set_dac_voltage(dac, low_voltage);
     99    return 0;
    99100  }
    100101
  • pcmmio/original/mio_io.h

    rd7d35da r45abed9  
    1414#if defined(__linux__)
    1515#include <linux/ioctl.h>
    16 #else
    17 #define MAJOR_NUM 1
    18 #define _IOWR(_x, _y, _t) (_t) ((_x << 16) | (_y << 16))
    19 #endif
    2016
    2117
     
    6157#define DEVICE_FILE_NAME "pcmmio"
    6258
    63 
    64 #endif
    65 
    66 /* These are the error codes doe mio_error_code */
     59#endif
     60
     61#endif
     62
     63/* These are the error codes for mio_error_code */
    6764
    6865#define MIO_SUCCESS 0
     
    200197    unsigned short _irq
    201198  );
    202 #endif
    203 
     199
     200  int wait_adc_int_with_timeout(int adc_num, int milliseconds);
     201  int wait_dac_int_with_timeout(int dac_num, int milliseconds);
     202  int wait_dio_int_with_timeout(int milliseconds);
     203#endif
     204
  • pcmmio/original/mio_io_rtems.c

    rd7d35da r45abed9  
    4444rtems_id wq_dio;
    4545
    46 void interruptible_sleep_on(
    47   rtems_id *id
     46int interruptible_sleep_on(
     47  rtems_id *id,
     48  int       milliseconds
    4849);
    4950void wake_up_interruptible(
     
    339340}
    340341
     342int wait_adc_int_with_timeout(int adc_num, int milliseconds)
     343{
     344  int sc;
     345
     346  if (check_handle())   /* Check for chip available */
     347    return -1;
     348
     349  if (adc_num) {
     350    sc = interruptible_sleep_on(&wq_a2d_1, milliseconds);
     351  } else {
     352    sc = interruptible_sleep_on(&wq_a2d_2, milliseconds);
     353  }
     354
     355  return sc;
     356}
     357
    341358int wait_adc_int(int adc_num)
    342359{
    343   if (check_handle())   /* Check for chip available */
    344     return -1;
    345 
    346   if (adc_num) {
    347     interruptible_sleep_on(&wq_a2d_1);
     360  return wait_adc_int_with_timeout(adc_num, 0);
     361}
     362
     363int wait_dac_int_with_timeout(int dac_num, int milliseconds)
     364{
     365  int sc;
     366
     367  if (check_handle())   /* Check for chip available */
     368    return -1;
     369
     370  if (dac_num) {
     371    sc = interruptible_sleep_on(&wq_dac_1, milliseconds);
    348372  } else {
    349     interruptible_sleep_on(&wq_a2d_2);
    350   }
    351 
    352   return 0;
    353 }
    354 
     373    sc = interruptible_sleep_on(&wq_dac_2, milliseconds);
     374  }
     375
     376  return sc;
     377}
    355378
    356379int wait_dac_int(int dac_num)
    357380{
    358   if (check_handle())   /* Check for chip available */
    359     return -1;
    360 
    361   if (dac_num) {
    362     interruptible_sleep_on(&wq_dac_1);
    363   } else {
    364     interruptible_sleep_on(&wq_dac_2);
    365   }
    366 
    367   return 0;
    368 }
    369 
    370 
    371 int wait_dio_int(void)
     381  return wait_dac_int_with_timeout(dac_num, 0);
     382}
     383
     384int wait_dio_int_with_timeout(int milliseconds)
    372385{
    373386  int i;
     387  int sc;
    374388
    375389  if (check_handle())   /* Check for chip available */
     
    379393    return i;
    380394
    381   interruptible_sleep_on(&wq_dio);
     395  sc = interruptible_sleep_on(&wq_dio, milliseconds);
     396  if ( sc != 0 )
     397    return sc;
    382398
    383399  i = get_buffered_int(NULL);
     
    386402}
    387403
     404int wait_dio_int(void)
     405{
     406  return wait_dio_int_with_timeout(0);
     407}
    388408
    389409static int handle = 0; /* XXX move to lower */
     
    434454}
    435455
    436 void interruptible_sleep_on(
    437   rtems_id *id
     456int interruptible_sleep_on(
     457  rtems_id *id,
     458  int       milliseconds
    438459)
    439460{
    440461  rtems_status_code rc;
    441462
    442   rc = rtems_barrier_wait(*id, 0);
     463  rc = rtems_barrier_wait(*id, RTEMS_MILLISECONDS_TO_TICKS(milliseconds));
     464  if ( rc == RTEMS_SUCCESSFUL )
     465    return 0;
     466  return -1;
    443467}
    444468
     
    513537    pcmmio_irq.name = irq;
    514538    #if defined(BSP_SHARED_HANDLER_SUPPORT)
    515       BSP_install_rtems_shared_irq_handler( &pcmmio_irq );
     539      printk( "PCMMIO Installing IRQ handler as shared\n" );
     540      status = BSP_install_rtems_shared_irq_handler( &pcmmio_irq );
    516541    #else
    517542      printk( "PCMMIO Installing IRQ handler as non-shared\n" );
    518       BSP_install_rtems_irq_handler( &pcmmio_irq );
     543      status = BSP_install_rtems_irq_handler( &pcmmio_irq );
    519544    #endif
    520545    if ( !status ) {
    521546      printk("Error installing PCMMIO interrupt handler!\n" );
    522       rtems_fatal_error_occurred( status );
    523547    }
    524548  }
  • pcmmio/original/pcmmio_commands.h

    rd7d35da r45abed9  
    2222extern rtems_shell_cmd_t Shell_PCMMIO_ADC_Command;
    2323extern rtems_shell_cmd_t Shell_PCMMIO_DAC_Command;
     24extern rtems_shell_cmd_t Shell_PCMMIO_IRQ_Command;
    2425
    2526#define CONFIGURE_PCMMIO_COMMANDS \
     
    2728  &Shell_PCMMIO_DOUT_Command, \
    2829  &Shell_PCMMIO_ADC_Command, \
    29   &Shell_PCMMIO_DAC_Command
     30  &Shell_PCMMIO_DAC_Command, \
     31  &Shell_PCMMIO_IRQ_Command
    3032
    3133extern rtems_shell_alias_t Shell_PCMMIO_DIN_Alias;
  • pcmmio/original/pcmmio_shell.c

    rd7d35da r45abed9  
    1616)
    1717{
     18  pcmmio_initialize(0x300, 6);
     19
    1820  printf(
    1921    "\n"
     
    4446#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
    4547
     48#define CONFIGURE_MICROSECONDS_PER_TICK     1000
     49
    4650#define CONFIGURE_MAXIMUM_TASKS                  20
    4751#define CONFIGURE_MAXIMUM_SEMAPHORES             20
     52#define CONFIGURE_MAXIMUM_BARRIERS                4
    4853#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
    49 #define CONFIGURE_STACK_CHECKER_ENABLED
    5054
    5155#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
    5256#define CONFIGURE_EXTRA_TASK_STACKS         (6 * RTEMS_MINIMUM_STACK_SIZE)
    5357
     58#define CONFIGURE_STACK_CHECKER_ENABLED
    5459#define CONFIGURE_MALLOC_STATISTICS
    5560
  • pcmmio/original/rtems_config.c

    rd7d35da r45abed9  
    3434#define CONFIGURE_MAXIMUM_POSIX_THREADS      3
    3535#define CONFIGURE_MAXIMUM_BARRIERS           4
    36 #define CONFIGURE_MICROSECONDS_PER_TICK      1
     36#define CONFIGURE_MICROSECONDS_PER_TICK      1000
    3737
    3838
Note: See TracChangeset for help on using the changeset viewer.