реклама на сайте
подробности

 
 
> Интервальный таймер в линуксе на 80х86 и АРМе, Почему-то работает с разными периодами
Гвоздик
сообщение Mar 20 2008, 07:56
Сообщение #1


Частый гость
**

Группа: Свой
Сообщений: 153
Регистрация: 2-12-04
Из: Чебоксары
Пользователь №: 1 289



Здравствуйте. Запускаю эту подпрограмму:
Код
/* Configure and start timer for CAN bus I/O transactions */
/* Input: CanBusDescriptor for write and read to/from it  */
/* Output: 0 - start is ok                                */
/*         -1 - not ok (invalid)                          */
int StartCanBusTimer(void)
{
  /* linux interval timer configuration */
  struct itimerval TimerId;
  struct sigaction sigact;

  /* clear all flags and handler before using signal action */
  memset(&sigact, 0, sizeof(sigact));
  /* define signal handler for timer interruption */
  sigact.sa_handler = &CanBusTimerHandler;

  if(sigaction(SIGALRM, &sigact, (struct sigaction *)NULL) != 0)
  {
    DEBUG_PRINT("Can not run signal action!\n");
    return -1;
  }

  /* configure timer */
  /* first time run timer handler after minimal time (1 us) */
  TimerId.it_value.tv_sec = 0;
  TimerId.it_value.tv_usec = 1;
  /* and every timing interval run timer handler again */
  TimerId.it_interval.tv_sec = 0;
  TimerId.it_interval.tv_usec = 1000;
  /* start the timer */
  setitimer(ITIMER_REAL, &TimerId, NULL);

  return 0;
}


При ее компиляции в линуксе на своем ПК таймерный интервал равен 1 мс (все в порядке), однако при ее перекомпиляции под АРМ (AT91SAM9260-EK) таймерный интервал становится 10 мс!
АРМовский компилятор - GCC брал с www.linux4sam.org:
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/paul/arm/src/gcc-4.2/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-shared --enable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --prefix=/opt/codesourcery --enable-languages=c,c++ --enable-symvers=gnu --enable-__cxa_atexit --with-versuffix=CodeSourcery Sourcery G++ Lite 2007q1-10 --with-pkgversion=CodeSourcery Sourcery G++ Lite 2007q1-10 --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/paul/arm/install/arm-none-linux-gnueabi/libc --enable-poison-system-directories --with-build-time-tools=/scratch/paul/arm/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/paul/arm/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.2.0 20070413 (prerelease) (CodeSourcery Sourcery G++ Lite 2007q1-10)

В чем может быть дело?
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 12:32
Рейтинг@Mail.ru


Страница сгенерированна за 0.01325 секунд с 7
ELECTRONIX ©2004-2016