removed type field from isr_register_handler() and friends
This commit is contained in:
@@ -101,7 +101,7 @@ extern int register_interrupt_handler(uint8_t source, uint8_t level, uint8_t pri
|
|||||||
#define ISR_USER_ISR 0x02
|
#define ISR_USER_ISR 0x02
|
||||||
|
|
||||||
extern void isr_init(void);
|
extern void isr_init(void);
|
||||||
extern int isr_register_handler(int type, int vector, int (*handler)(void *, void *), void *hdev, void *harg);
|
extern int isr_register_handler(int vector, int (*handler)(void *, void *), void *hdev, void *harg);
|
||||||
extern void isr_remove_handler(int type ,int (*handler)(void *, void *));
|
extern void isr_remove_handler(int (*handler)(void *, void *));
|
||||||
extern bool isr_execute_handler(int vector);
|
extern bool isr_execute_handler(int vector);
|
||||||
#endif /* _INTERRUPTS_H_ */
|
#endif /* _INTERRUPTS_H_ */
|
||||||
|
|||||||
@@ -152,8 +152,7 @@ bool timer_init(uint8_t ch, uint8_t lvl, uint8_t pri)
|
|||||||
/*
|
/*
|
||||||
* Register the timer interrupt handler
|
* Register the timer interrupt handler
|
||||||
*/
|
*/
|
||||||
if (!isr_register_handler(ISR_DBUG_ISR,
|
if (!isr_register_handler(TIMER_VECTOR(ch),
|
||||||
TIMER_VECTOR(ch),
|
|
||||||
(int (*)(void *,void *)) timer_default_isr,
|
(int (*)(void *,void *)) timer_default_isr,
|
||||||
NULL,
|
NULL,
|
||||||
(void *) &net_timer[ch])
|
(void *) &net_timer[ch])
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ void network_init(void)
|
|||||||
|
|
||||||
isr_init(); /* need to call that explicitely, otherwise isr table might be full */
|
isr_init(); /* need to call that explicitely, otherwise isr table might be full */
|
||||||
|
|
||||||
if (!isr_register_handler(ISR_DBUG_ISR, vector, handler, NULL, (void *) &nif1))
|
if (!isr_register_handler(vector, handler, NULL, (void *) &nif1))
|
||||||
{
|
{
|
||||||
dbg("%s: unable to register handler for vector %d\r\n", __FUNCTION__, vector);
|
dbg("%s: unable to register handler for vector %d\r\n", __FUNCTION__, vector);
|
||||||
return;
|
return;
|
||||||
@@ -276,7 +276,7 @@ void network_init(void)
|
|||||||
handler = dma_interrupt_handler;
|
handler = dma_interrupt_handler;
|
||||||
vector = 112;
|
vector = 112;
|
||||||
|
|
||||||
if (!isr_register_handler(ISR_DBUG_ISR, vector, handler, NULL,NULL))
|
if (!isr_register_handler(vector, handler, NULL,NULL))
|
||||||
{
|
{
|
||||||
dbg("%s: Error: Unable to register handler for vector %s\r\n", __FUNCTION__, vector);
|
dbg("%s: Error: Unable to register handler for vector %s\r\n", __FUNCTION__, vector);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -88,31 +88,29 @@ int register_interrupt_handler(uint8_t source, uint8_t level, uint8_t priority,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef UIF_MAX_ISR_ENTRY
|
#ifndef MAX_ISR_ENTRY
|
||||||
#define UIF_MAX_ISR_ENTRY (20)
|
#define MAX_ISR_ENTRY (20)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int vector;
|
int vector;
|
||||||
int type;
|
|
||||||
int (*handler)(void *, void *);
|
int (*handler)(void *, void *);
|
||||||
void *hdev;
|
void *hdev;
|
||||||
void *harg;
|
void *harg;
|
||||||
} ISRENTRY;
|
} ISRENTRY;
|
||||||
|
|
||||||
ISRENTRY isrtab[UIF_MAX_ISR_ENTRY];
|
ISRENTRY isrtab[MAX_ISR_ENTRY];
|
||||||
|
|
||||||
|
|
||||||
void isr_init(void)
|
void isr_init(void)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||||
{
|
{
|
||||||
isrtab[index].vector = 0;
|
isrtab[index].vector = 0;
|
||||||
isrtab[index].type = 0;
|
|
||||||
isrtab[index].handler = 0;
|
isrtab[index].handler = 0;
|
||||||
isrtab[index].hdev = 0;
|
isrtab[index].hdev = 0;
|
||||||
isrtab[index].harg = 0;
|
isrtab[index].harg = 0;
|
||||||
@@ -120,8 +118,7 @@ void isr_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int isr_register_handler(int type, int vector,
|
int isr_register_handler(int vector, int (*handler)(void *, void *), void *hdev, void *harg)
|
||||||
int (*handler)(void *, void *), void *hdev, void *harg)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This function places an interrupt handler in the ISR table,
|
* This function places an interrupt handler in the ISR table,
|
||||||
@@ -133,28 +130,24 @@ int isr_register_handler(int type, int vector,
|
|||||||
*/
|
*/
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if ((vector == 0) ||
|
if ((vector == 0) || (handler == NULL))
|
||||||
((type != ISR_DBUG_ISR) && (type != ISR_USER_ISR)) ||
|
|
||||||
(handler == NULL))
|
|
||||||
{
|
{
|
||||||
dbg("%s: illegal type, vector or handler!\r\n", __FUNCTION__);
|
dbg("%s: illegal vector or handler!\r\n", __FUNCTION__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||||
{
|
{
|
||||||
if ((isrtab[index].vector == vector) &&
|
if (isrtab[index].vector == vector)
|
||||||
(isrtab[index].type == type))
|
|
||||||
{
|
{
|
||||||
/* only one entry of each type per vector */
|
/* one cross each, only! */
|
||||||
dbg("%s: already set handler with this type and vector (%d, %d)\r\n", __FUNCTION__, type, vector);
|
dbg("%s: already set handler with this vector (%d, %d)\r\n", __FUNCTION__, vector);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isrtab[index].vector == 0)
|
if (isrtab[index].vector == 0)
|
||||||
{
|
{
|
||||||
isrtab[index].vector = vector;
|
isrtab[index].vector = vector;
|
||||||
isrtab[index].type = type;
|
|
||||||
isrtab[index].handler = handler;
|
isrtab[index].handler = handler;
|
||||||
isrtab[index].hdev = hdev;
|
isrtab[index].hdev = hdev;
|
||||||
isrtab[index].harg = harg;
|
isrtab[index].harg = harg;
|
||||||
@@ -167,21 +160,19 @@ int isr_register_handler(int type, int vector,
|
|||||||
return false; /* no available slots */
|
return false; /* no available slots */
|
||||||
}
|
}
|
||||||
|
|
||||||
void isr_remove_handler(int type, int (*handler)(void *, void *))
|
void isr_remove_handler(int (*handler)(void *, void *))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This routine removes from the ISR table all
|
* This routine removes from the ISR table all
|
||||||
* entries that matches 'type' and 'handler'.
|
* entries that matches 'handler'.
|
||||||
*/
|
*/
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||||
{
|
{
|
||||||
if ((isrtab[index].handler == handler) &&
|
if (isrtab[index].handler == handler)
|
||||||
(isrtab[index].type == type))
|
|
||||||
{
|
{
|
||||||
isrtab[index].vector = 0;
|
isrtab[index].vector = 0;
|
||||||
isrtab[index].type = 0;
|
|
||||||
isrtab[index].handler = 0;
|
isrtab[index].handler = 0;
|
||||||
isrtab[index].hdev = 0;
|
isrtab[index].hdev = 0;
|
||||||
isrtab[index].harg = 0;
|
isrtab[index].harg = 0;
|
||||||
@@ -189,7 +180,7 @@ void isr_remove_handler(int type, int (*handler)(void *, void *))
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg("%s: no such handler registered (type=%d, handler=%p\r\n", __FUNCTION__, type, handler);
|
dbg("%s: no such handler registered (handler=%p\r\n", __FUNCTION__, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -205,10 +196,9 @@ bool isr_execute_handler(int vector)
|
|||||||
/*
|
/*
|
||||||
* First locate a BaS Interrupt Service Routine handler.
|
* First locate a BaS Interrupt Service Routine handler.
|
||||||
*/
|
*/
|
||||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||||
{
|
{
|
||||||
if ((isrtab[index].vector == vector) &&
|
if (isrtab[index].vector == vector)
|
||||||
(isrtab[index].type == ISR_DBUG_ISR))
|
|
||||||
{
|
{
|
||||||
retval = true;
|
retval = true;
|
||||||
|
|
||||||
|
|||||||
@@ -407,6 +407,9 @@ bool access_exception(uint32_t pc, uint32_t format_status)
|
|||||||
extern uint8_t _FASTRAM_END[];
|
extern uint8_t _FASTRAM_END[];
|
||||||
uint32_t FASTRAM_END = (uint32_t) &_FASTRAM_END[0];
|
uint32_t FASTRAM_END = (uint32_t) &_FASTRAM_END[0];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* extract fault status from format_status exception stack field
|
||||||
|
*/
|
||||||
fault_status = (((format_status & 0xc000000) >> 24) |
|
fault_status = (((format_status & 0xc000000) >> 24) |
|
||||||
((format_status & 0x30000) >> 16));
|
((format_status & 0x30000) >> 16));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user