cleaned up. X86emu does not work with debug trace on currently.
This commit is contained in:
@@ -8,9 +8,18 @@
|
||||
#include "net_timer.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "bas_printf.h"
|
||||
#include "MCF5475.h"
|
||||
#include "interrupts.h"
|
||||
|
||||
#define DBG_TMR
|
||||
#ifdef DBG_TMR
|
||||
#define dbg(format, arg...) do { xprintf("DEBUG: " format, ##arg); } while (0)
|
||||
#else
|
||||
#define dbg(format, arg...) do { ; } while (0)
|
||||
#endif /* DBG_TMR */
|
||||
|
||||
|
||||
#if defined(MACHINE_FIREBEE)
|
||||
#include "firebee.h"
|
||||
#elif defined(MACHINE_M5484LITE)
|
||||
@@ -37,6 +46,8 @@ int timer_default_isr(void *not_used, NET_TIMER *t)
|
||||
*/
|
||||
MCF_GPT_GMS(t->ch) = 0;
|
||||
|
||||
dbg("%s: timer isr called for timer channel %d\r\n", __FUNCTION__);
|
||||
|
||||
/*
|
||||
* Clear the reference - the desired seconds have expired
|
||||
*/
|
||||
@@ -119,7 +130,12 @@ bool timer_init(uint8_t ch, uint8_t lvl, uint8_t pri)
|
||||
* initialization code.
|
||||
*/
|
||||
if (!((ch <= 3) && (lvl <= 7) && (lvl >= 1) && (pri <= 7)))
|
||||
{
|
||||
dbg("%s: illegal parameters (ch=%d, lvl=%d, pri=%d)\r\n", __FUNCTION__,
|
||||
ch, lvl, pri);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset the timer
|
||||
@@ -143,8 +159,10 @@ bool timer_init(uint8_t ch, uint8_t lvl, uint8_t pri)
|
||||
(void *) &net_timer[ch])
|
||||
)
|
||||
{
|
||||
dbg("%s: could not register timer interrupt handler\r\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
dbg("%s: timer handler registered\r\n", __FUNCTION__);
|
||||
|
||||
/*
|
||||
* Calculate the require CNT value to get a 1 second timeout
|
||||
@@ -162,7 +180,7 @@ bool timer_init(uint8_t ch, uint8_t lvl, uint8_t pri)
|
||||
* CNT = SYSTEM_CLOCK * (1000000/0xFFFF)
|
||||
*/
|
||||
net_timer[ch].pre = 0xFFFF;
|
||||
net_timer[ch].cnt = (uint16_t) (SYSCLK * (1000000 / 0xFFFF));
|
||||
net_timer[ch].cnt = (uint16_t) ((SYSCLK / 1000) * (1000000 / 0xFFFF));
|
||||
|
||||
/*
|
||||
* Save off the appropriate mode select register value
|
||||
|
||||
Reference in New Issue
Block a user