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
|
||||
|
||||
extern void isr_init(void);
|
||||
extern int isr_register_handler(int type, int vector, int (*handler)(void *, void *), void *hdev, void *harg);
|
||||
extern void isr_remove_handler(int type ,int (*handler)(void *, void *));
|
||||
extern int isr_register_handler(int vector, int (*handler)(void *, void *), void *hdev, void *harg);
|
||||
extern void isr_remove_handler(int (*handler)(void *, void *));
|
||||
extern bool isr_execute_handler(int vector);
|
||||
#endif /* _INTERRUPTS_H_ */
|
||||
|
||||
@@ -152,8 +152,7 @@ bool timer_init(uint8_t ch, uint8_t lvl, uint8_t pri)
|
||||
/*
|
||||
* Register the timer interrupt handler
|
||||
*/
|
||||
if (!isr_register_handler(ISR_DBUG_ISR,
|
||||
TIMER_VECTOR(ch),
|
||||
if (!isr_register_handler(TIMER_VECTOR(ch),
|
||||
(int (*)(void *,void *)) timer_default_isr,
|
||||
NULL,
|
||||
(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 */
|
||||
|
||||
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);
|
||||
return;
|
||||
@@ -276,7 +276,7 @@ void network_init(void)
|
||||
handler = dma_interrupt_handler;
|
||||
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);
|
||||
return;
|
||||
|
||||
@@ -88,31 +88,29 @@ int register_interrupt_handler(uint8_t source, uint8_t level, uint8_t priority,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef UIF_MAX_ISR_ENTRY
|
||||
#define UIF_MAX_ISR_ENTRY (20)
|
||||
#ifndef MAX_ISR_ENTRY
|
||||
#define MAX_ISR_ENTRY (20)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int vector;
|
||||
int type;
|
||||
int (*handler)(void *, void *);
|
||||
void *hdev;
|
||||
void *harg;
|
||||
} ISRENTRY;
|
||||
|
||||
ISRENTRY isrtab[UIF_MAX_ISR_ENTRY];
|
||||
ISRENTRY isrtab[MAX_ISR_ENTRY];
|
||||
|
||||
|
||||
void isr_init(void)
|
||||
{
|
||||
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].type = 0;
|
||||
isrtab[index].handler = 0;
|
||||
isrtab[index].hdev = 0;
|
||||
isrtab[index].harg = 0;
|
||||
@@ -120,8 +118,7 @@ void isr_init(void)
|
||||
}
|
||||
|
||||
|
||||
int isr_register_handler(int type, int vector,
|
||||
int (*handler)(void *, void *), void *hdev, void *harg)
|
||||
int isr_register_handler(int vector, int (*handler)(void *, void *), void *hdev, void *harg)
|
||||
{
|
||||
/*
|
||||
* This function places an interrupt handler in the ISR table,
|
||||
@@ -133,28 +130,24 @@ int isr_register_handler(int type, int vector,
|
||||
*/
|
||||
int index;
|
||||
|
||||
if ((vector == 0) ||
|
||||
((type != ISR_DBUG_ISR) && (type != ISR_USER_ISR)) ||
|
||||
(handler == NULL))
|
||||
if ((vector == 0) || (handler == NULL))
|
||||
{
|
||||
dbg("%s: illegal type, vector or handler!\r\n", __FUNCTION__);
|
||||
dbg("%s: illegal vector or handler!\r\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
||||
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||
{
|
||||
if ((isrtab[index].vector == vector) &&
|
||||
(isrtab[index].type == type))
|
||||
if (isrtab[index].vector == vector)
|
||||
{
|
||||
/* only one entry of each type per vector */
|
||||
dbg("%s: already set handler with this type and vector (%d, %d)\r\n", __FUNCTION__, type, vector);
|
||||
/* one cross each, only! */
|
||||
dbg("%s: already set handler with this vector (%d, %d)\r\n", __FUNCTION__, vector);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isrtab[index].vector == 0)
|
||||
{
|
||||
isrtab[index].vector = vector;
|
||||
isrtab[index].type = type;
|
||||
isrtab[index].handler = handler;
|
||||
isrtab[index].hdev = hdev;
|
||||
isrtab[index].harg = harg;
|
||||
@@ -167,21 +160,19 @@ int isr_register_handler(int type, int vector,
|
||||
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
|
||||
* entries that matches 'type' and 'handler'.
|
||||
* entries that matches 'handler'.
|
||||
*/
|
||||
int index;
|
||||
|
||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
||||
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||
{
|
||||
if ((isrtab[index].handler == handler) &&
|
||||
(isrtab[index].type == type))
|
||||
if (isrtab[index].handler == handler)
|
||||
{
|
||||
isrtab[index].vector = 0;
|
||||
isrtab[index].type = 0;
|
||||
isrtab[index].handler = 0;
|
||||
isrtab[index].hdev = 0;
|
||||
isrtab[index].harg = 0;
|
||||
@@ -189,7 +180,7 @@ void isr_remove_handler(int type, int (*handler)(void *, void *))
|
||||
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.
|
||||
*/
|
||||
for (index = 0; index < UIF_MAX_ISR_ENTRY; index++)
|
||||
for (index = 0; index < MAX_ISR_ENTRY; index++)
|
||||
{
|
||||
if ((isrtab[index].vector == vector) &&
|
||||
(isrtab[index].type == ISR_DBUG_ISR))
|
||||
if (isrtab[index].vector == vector)
|
||||
{
|
||||
retval = true;
|
||||
|
||||
|
||||
@@ -407,6 +407,9 @@ bool access_exception(uint32_t pc, uint32_t format_status)
|
||||
extern uint8_t _FASTRAM_END[];
|
||||
uint32_t FASTRAM_END = (uint32_t) &_FASTRAM_END[0];
|
||||
|
||||
/*
|
||||
* extract fault status from format_status exception stack field
|
||||
*/
|
||||
fault_status = (((format_status & 0xc000000) >> 24) |
|
||||
((format_status & 0x30000) >> 16));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user