Part Number: TPS65910
Tool/software: Linux
I am using the TI Linux SDK 4.1.8-ti-r18 on an Beaglebone Black-based custom design. Want to use a DM Timer to restore unit out of low-power Standby mode but having trouble compiling the following test module.
#include <ctype.h> // tolower, toupper
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> // strcasecmp, strcasestr
#include <sysexits.h>
#include <syslog.h> // for satfi_logger entry levels
#include <time.h> // time, localtime, clock_gettime
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/time.h> // gettimeofday
#include <sys/types.h>
#include <plat/dmtimer.h> // DM Timers
#define MODIFY_DATE "3/20/2017"
#define TIMER_IRQ_NUM 7
char logString[MAX_LOG_LEN];
// Definition of the data type for this global region
typedef struct
{
int irq_num;
struct omap_dm_timer *stndby_tmr;
} dm_timer_t;
typedef struct
{
dm_timer_t standby_timer; // DM Timer for wakeup after standby
} SysCfg_t;
SysCfg_t SysCfg; // System configuration information
irqreturn_t standby_interrupt_handler (int irq, void *dev_id)
{
int status = 0;
/* Read the current Status */
status = omap_dm_timer_read_status(SysCfg.standby_timer.stndby_tmr);
/* Clear the timer interrupt */
if (status == OMAP_TIMER_INT_MATCH)
{
omap_dm_timer_write_status(SysCfg.standby_timer.stndby_tmr,
OMAP_TIMER_INT_MATCH);
}
/* Stop the timer, disable interrupt & timer then free up both */
omap_dm_timer_stop(SysCfg.standby_timer.stndby_tmr);
omap_dm_timer_set_int_enable(SysCfg.standby_timer.stndby_tmr, 0);
omap_dm_timer_free(SysCfg.standby_timer.stndby_tmr);
free_irq(SysCfg.standby_timer.irq_num, &SysCfg.standby_timer);
/* Indicate the Interrupt was handled */
return (IRQ_HANDLED);
}
int init_wakeup_timer(int timerNum)
{
int retVal;
SysCfg.standby_timer.stndby_tmr = omap_dm_timer_request_specific(timerNum);
/* Get irq number and register an interrupt handler for this irq */
SysCfg.standby_timer.irq_num = omap_dm_timer_get_irq(SysCfg.standby_timer.stndby_tmr);
retVal = request_irq(SysCfg.standby_timer.irq_num, standby_interrupt_handler,
IRQF_DISABLED, "pm_standby", &SysCfg.standby_timer);
if (retVal < 0)
{
printf("init_wakeup_timer: Could not initialize Timer %d (%s)",
timerNum, strerror(errno));
return (retVal);
}
/* Clear any pending events by writing to the Status Register */
omap_dm_timer_write_status(SysCfg.standby_timer.stndby_tmr, OMAP_TIMER_INT_OVERFLOW);
/* Enable overflow interrupt */
omap_dm_timer_set_int_enable(SysCfg.standby_timer.stndby_tmr, OMAP_TIMER_INT_OVERFLOW);
/* Load the counter register and start the timer */
omap_dm_timer_set_load_start(SysCfg.standby_timer.stndby_tmr, 0, 0xF8D8A6FC);
return (retVal);
}
int main(int argc, char *argv[])
{
init_wakeup_timer(TIMER_IRQ_NUM);
/* Main Processing */
return (EX_OK);
}
Compilation error is giving:
../src/testDMtimer.c:18:39: fatal error: plat/dmtimer.h: No such file or directory
#include <plat/dmtimer.h> // DM Timers
compilation terminated.
make: *** [src/testDMtimer.o] Error 1
I know the dmtimer.h file is in the KERNEL directory but it was not carried over to the libc directory where the compiler looks for it. What am I missing?