mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-09-17 19:07:07 +02:00
dm36x: Add interrupt-enable function for application code.
This commit is contained in:
@@ -60,7 +60,8 @@ extern int archUsleepCheckExpired (int32_t start_time, int32_t delay_usecs);
|
|||||||
* ISR handler registration (optional, not available on all ports)
|
* ISR handler registration (optional, not available on all ports)
|
||||||
*/
|
*/
|
||||||
typedef void (*ISR_FUNC)(void);
|
typedef void (*ISR_FUNC)(void);
|
||||||
extern int archISRInstall (int int_vector, ISR_FUNC isr_func);
|
extern int archIntInstallISR (int int_vector, ISR_FUNC isr_func);
|
||||||
|
extern int archIntEnable (int int_vector, int enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ low_level_init (void)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \b archISRInstall
|
* \b archIntInstallISR
|
||||||
*
|
*
|
||||||
* Register an interrupt handler to be called if a particular
|
* Register an interrupt handler to be called if a particular
|
||||||
* interrupt vector occurs.
|
* interrupt vector occurs.
|
||||||
@@ -166,7 +166,7 @@ low_level_init (void)
|
|||||||
* @retval ATOM_OK Success
|
* @retval ATOM_OK Success
|
||||||
* @retval ATOM_ERROR Error
|
* @retval ATOM_ERROR Error
|
||||||
*/
|
*/
|
||||||
int archISRInstall (int int_vector, ISR_FUNC isr_func)
|
int archInstallISR (int int_vector, ISR_FUNC isr_func)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@@ -179,7 +179,52 @@ int archISRInstall (int int_vector, ISR_FUNC isr_func)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Valid vector, install it in the ISR table */
|
/* Valid vector, install it in the ISR table */
|
||||||
isr_handlers[int_vector] = isr_func;
|
isr_handlers[int_vector] = isr_func;
|
||||||
|
status = ATOM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \b archIntEnable
|
||||||
|
*
|
||||||
|
* Enable/unmask an interrupt in the interrupt controller.
|
||||||
|
* @param[in] int_vector Interrupt vector to enable/disable
|
||||||
|
* @param[in] enable TRUE=enable, FALSE=disable
|
||||||
|
*
|
||||||
|
* @retval ATOM_OK Success
|
||||||
|
* @retval ATOM_ERROR Error
|
||||||
|
*/
|
||||||
|
int archIntEnable (int int_vector, int enable)
|
||||||
|
{
|
||||||
|
CRITICAL_STORE;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
/* Check vector is valid */
|
||||||
|
if ((int_vector < 0) || (int_vector > DM36X_INTC_MAX_VEC))
|
||||||
|
{
|
||||||
|
/* Invalid vector number */
|
||||||
|
status = ATOM_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Valid vector, mask or unmask it using RMW */
|
||||||
|
CRITICAL_START();
|
||||||
|
if (enable)
|
||||||
|
{
|
||||||
|
/* Enable/unmask the interrupt */
|
||||||
|
INTC_REG(((int_vector >= 32) ? DM36X_INTC_EINT1 : DM36X_INTC_EINT0))
|
||||||
|
|= (1 << ((int_vector >= 32) ? (int_vector - 32) : int_vector));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Disable/mask the interrupt */
|
||||||
|
INTC_REG(((int_vector >= 32) ? DM36X_INTC_EINT1 : DM36X_INTC_EINT0))
|
||||||
|
|= (1 << ((int_vector >= 32) ? (int_vector - 32) : int_vector));
|
||||||
|
}
|
||||||
|
CRITICAL_END();
|
||||||
status = ATOM_OK;
|
status = ATOM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user