Change task_irq_object from global to local variable.
The variable task_irq_object is global because the test_task_irq project needed to access it. That data should only be accessed through the API. To make the variable local, break that dependency to the test project and restrict the access to the variable. Change-Id: I1ccb21625d456714a038e0374d124b42aa72e577 Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
This commit is contained in:
parent
19f4eccb4a
commit
8f08126af8
4 changed files with 18 additions and 11 deletions
|
@ -44,8 +44,6 @@ struct task_irq_info {
|
|||
uint32_t vector; /* interrupt vector assigned to task IRQ object */
|
||||
};
|
||||
|
||||
extern struct task_irq_info task_irq_object[];
|
||||
|
||||
extern uint32_t task_irq_alloc(kirq_t irq_obj,
|
||||
uint32_t irq,
|
||||
uint32_t priority);
|
||||
|
|
|
@ -72,7 +72,7 @@ struct irq_obj_reg_arg {
|
|||
|
||||
/* task IRQ object array */
|
||||
|
||||
struct task_irq_info task_irq_object[MAX_TASK_IRQS] = {
|
||||
static struct task_irq_info task_irq_object[MAX_TASK_IRQS] = {
|
||||
[0 ...(MAX_TASK_IRQS - 1)].taskId = INVALID_TASK
|
||||
};
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
static ksem_t resultSems[] = { SEM_TASKDONE, SEM_TASKFAIL, ENDLIST };
|
||||
static ksem_t rdySem = SEM_RDY;
|
||||
|
||||
#define NUM_OBJECTS 4
|
||||
extern uint32_t irq_vectors[NUM_OBJECTS];
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* taskAMain - entry point for taskA
|
||||
|
@ -112,9 +115,9 @@ void registerWait(void)
|
|||
}
|
||||
|
||||
TC_PRINT("Generating interrupts for all allocated IRQ objects...\n");
|
||||
for (irq_obj = 0; irq_obj < NUM_TASK_IRQS; irq_obj++) {
|
||||
if (task_irq_object[irq_obj].irq != INVALID_VECTOR) {
|
||||
raiseInt((uint8_t)task_irq_object[irq_obj].vector);
|
||||
for (irq_obj = 0; irq_obj < NUM_OBJECTS; irq_obj++) {
|
||||
if (irq_vectors[irq_obj] != INVALID_VECTOR) {
|
||||
raiseInt((uint8_t)irq_vectors[irq_obj]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +136,6 @@ void registerWait(void)
|
|||
|
||||
void MonitorTaskEntry(void)
|
||||
{
|
||||
extern struct task_irq_info task_irq_object[NUM_TASK_IRQS];
|
||||
ksem_t result;
|
||||
int tasksDone;
|
||||
|
||||
|
|
|
@ -65,6 +65,9 @@ exercises the task_irq_free() API.
|
|||
#error "Unknown target"
|
||||
#endif
|
||||
|
||||
#define NUM_OBJECTS 4
|
||||
uint32_t irq_vectors[NUM_OBJECTS] = {[0 ... (NUM_OBJECTS - 1)] = INVALID_VECTOR};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* taskA - first of 2 tasks to allocate IRQ objects and check for events
|
||||
|
@ -78,13 +81,15 @@ exercises the task_irq_free() API.
|
|||
|
||||
int taskA(ksem_t semRdy)
|
||||
{
|
||||
if (task_irq_alloc(DEV1_ID, DEV1_IRQ, 1) == INVALID_VECTOR) {
|
||||
irq_vectors[DEV1_ID] = task_irq_alloc(DEV1_ID, DEV1_IRQ, 1);
|
||||
if (irq_vectors[DEV1_ID] == INVALID_VECTOR) {
|
||||
TC_ERROR("Not able to allocate IRQ object\n");
|
||||
return TC_FAIL;
|
||||
}
|
||||
TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV1_ID, DEV1_IRQ);
|
||||
|
||||
if (task_irq_alloc(DEV2_ID, DEV2_IRQ, 2) == INVALID_VECTOR) {
|
||||
irq_vectors[DEV2_ID] = task_irq_alloc(DEV2_ID, DEV2_IRQ, 2);
|
||||
if (irq_vectors[DEV2_ID] == INVALID_VECTOR) {
|
||||
TC_ERROR("Not able to allocate IRQ object\n");
|
||||
return TC_FAIL;
|
||||
}
|
||||
|
@ -148,13 +153,15 @@ int taskA(ksem_t semRdy)
|
|||
|
||||
int taskB(ksem_t semRdy)
|
||||
{
|
||||
if (task_irq_alloc(DEV3_ID, DEV3_IRQ, 1) == INVALID_VECTOR) {
|
||||
irq_vectors[DEV3_ID] = task_irq_alloc(DEV3_ID, DEV3_IRQ, 1);
|
||||
if (irq_vectors[DEV3_ID] == INVALID_VECTOR) {
|
||||
TC_ERROR("Not able to allocate IRQ object\n");
|
||||
return TC_FAIL;
|
||||
}
|
||||
TC_PRINT("IRQ object %d using IRQ%d allocated\n", DEV3_ID, DEV3_IRQ);
|
||||
|
||||
if (task_irq_alloc(DEV4_ID, DEV4_IRQ, 1) == INVALID_VECTOR) {
|
||||
irq_vectors[DEV4_ID] = task_irq_alloc(DEV4_ID, DEV4_IRQ, 1);
|
||||
if (irq_vectors[DEV4_ID] == INVALID_VECTOR) {
|
||||
TC_ERROR("Not able to allocate IRQ object\n");
|
||||
return TC_FAIL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue