@@ -53,13 +53,13 @@ static inline uint32_t task_get_irq(struct task *task)
5353 uint32_t irq ;
5454
5555 switch (task -> priority ) {
56- case TASK_PRI_MED + 1 ... TASK_PRI_LOW :
56+ case TASK_PRI_MED + 6 ... TASK_PRI_LOW :
5757 irq = PLATFORM_IRQ_TASK_LOW ;
5858 break ;
59- case TASK_PRI_HIGH ... TASK_PRI_MED - 1 :
59+ case TASK_PRI_HIGH ... TASK_PRI_MED - 6 :
6060 irq = PLATFORM_IRQ_TASK_HIGH ;
6161 break ;
62- case TASK_PRI_MED :
62+ case TASK_PRI_MED - 5 ... TASK_PRI_MED + 5 :
6363 default :
6464 irq = PLATFORM_IRQ_TASK_MED ;
6565 break ;
@@ -72,26 +72,38 @@ static inline void task_set_data(struct task *task)
7272{
7373 struct list_item * dst = NULL ;
7474 struct irq_task * irq_task ;
75+ struct list_item * clist ;
76+ struct task * ctask ;
7577 uint32_t flags ;
7678
7779 switch (task -> priority ) {
78- case TASK_PRI_MED + 1 ... TASK_PRI_LOW :
80+ case TASK_PRI_MED + 6 ... TASK_PRI_LOW :
7981 irq_task = irq_low_task ;
8082 dst = & irq_task -> list ;
8183 break ;
82- case TASK_PRI_HIGH ... TASK_PRI_MED - 1 :
84+ case TASK_PRI_HIGH ... TASK_PRI_MED - 6 :
8385 irq_task = irq_high_task ;
8486 dst = & irq_task -> list ;
8587 break ;
86- case TASK_PRI_MED :
88+ case TASK_PRI_MED - 5 ... TASK_PRI_MED + 5 :
8789 default :
8890 irq_task = irq_med_task ;
8991 dst = & irq_task -> list ;
9092 break ;
9193 }
9294
95+ /* find position in the list to append the item */
96+ list_for_item (clist , & irq_task -> list ) {
97+ trace_event (TRACE_CLASS_PIPE , "ins" );
98+ ctask = container_of (clist , struct task , irq_list );
99+ if (task -> priority >= ctask -> priority )
100+ dst = clist ;
101+ else
102+ break ;
103+ }
104+
93105 spin_lock_irq (& irq_task -> lock , flags );
94- list_item_append (& task -> irq_list , dst );
106+ list_item_insert (& task -> irq_list , dst );
95107 spin_unlock_irq (& irq_task -> lock , flags );
96108}
97109
0 commit comments