- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Im new to Nios. In my system there are 2 timers:timer_0 and timer_1. Defined as follow in system.h: /* * timer_0 configuration * */ #defineTIMER_0_NAME "/dev/timer_0" #define
TIMER_0_TYPE "altera_avalon_timer" #define
TIMER_0_BASE 0x00042400 #define
TIMER_0_SPAN 32 #define
TIMER_0_IRQ 0 #define
TIMER_0_ALWAYS_RUN 0 #define
TIMER_0_FIXED_PERIOD 0 #define
TIMER_0_SNAPSHOT 1 #define
TIMER_0_PERIOD 1 #define
TIMER_0_PERIOD_UNITS "ms" #define
TIMER_0_RESET_OUTPUT 0 #define
TIMER_0_TIMEOUT_PULSE_OUTPUT 0 #define
TIMER_0_LOAD_VALUE 24999 #define
TIMER_0_COUNTER_SIZE 32 #define
TIMER_0_MULT 0.0010 #define
TIMER_0_TICKS_PER_SEC 1000 #define
TIMER_0_FREQ 25000000 #define
ALT_MODULE_CLASS_timer_0 altera_avalon_timer /* * timer_1 configuration * */ #define
TIMER_1_NAME "/dev/timer_1" #define
TIMER_1_TYPE "altera_avalon_timer" #define
TIMER_1_BASE 0x00042420 #define
TIMER_1_SPAN 32 #define
TIMER_1_IRQ 1 #define
TIMER_1_ALWAYS_RUN 0 #define
TIMER_1_FIXED_PERIOD 0 #define
TIMER_1_SNAPSHOT 1 #define
TIMER_1_PERIOD 100 #define
TIMER_1_PERIOD_UNITS "us" #define
TIMER_1_RESET_OUTPUT 0 #define
TIMER_1_TIMEOUT_PULSE_OUTPUT 0 #define
TIMER_1_LOAD_VALUE 2499 #define
TIMER_1_COUNTER_SIZE 32 #define
TIMER_1_MULT "1.0E-6" #define
TIMER_1_TICKS_PER_SEC 10000 #define
TIMER_1_FREQ 25000000 #define ALT_MODULE_CLASS_timer_1 altera_avalon_timer What i want to know is:
- When i use the function : alt_alarm_start i see that the system automatically use timer_0 to set the alarm,why timer_0?
- What should i do if i want the alarm every 100 micro seconds and still use the function : alt_alarm_start?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you may config your timer in sopc builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
and if want to use it in your nios, you may registry it first and then install it
hope this will help- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
timer_0 must be defined as the system timer by default. You can change it to timer_1 by updating it in the bsp settings in NIOS SBT tool.
The prototype for alarm start is: int alt_alarm_start ( alt_alarm* alarm, alt_u32 nticks, alt_u32 (*callback) (void* context), void* context ) Think nticks is what you are looking for. You can use it to trigger a callback function after 100us systicks. One the callback is triggered, you can restart the same alarm within the callback itself.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page