int get_ed_from_ready_q(bool f_isperiodic, ed_t **get_ed) { if(f_isperiodic) { otg_list_head *transreadyq_list_entity=NULL; if(periodic_trans_ready_q.trans_ready_entry_num==0) { return USB_ERR_NO_ENTITY; } transreadyq_list_entity = periodic_trans_ready_q.trans_ready_q_list_head.next; //if(transreadyq_list_entity!= &periodic_trans_ready_q.trans_ready_q_list_head) if(!otg_list_empty(&periodic_trans_ready_q.trans_ready_q_list_head)) { *get_ed = otg_list_get_node(transreadyq_list_entity,ed_t,trans_ready_q_list_entry); otg_list_pop(transreadyq_list_entity); periodic_trans_ready_q.trans_ready_entry_num--; return USB_ERR_SUCCESS; } else { return USB_ERR_NO_ENTITY; } } else { otg_list_head *transreadyq_list_entity=NULL; if(nonperiodic_trans_ready_q.trans_ready_entry_num==0) { return USB_ERR_NO_ENTITY; } transreadyq_list_entity = nonperiodic_trans_ready_q.trans_ready_q_list_head.next; //if(transreadyq_list_entity!= &nonperiodic_trans_ready_q.trans_ready_q_list_head) if(!otg_list_empty(&nonperiodic_trans_ready_q.trans_ready_q_list_head)) { *get_ed = otg_list_get_node(transreadyq_list_entity,ed_t, trans_ready_q_list_entry); otg_list_pop(transreadyq_list_entity); nonperiodic_trans_ready_q.trans_ready_entry_num--; return USB_ERR_SUCCESS; } else { return USB_ERR_NO_ENTITY; } } }
static int get_ed_from_ready_q(struct ed **get_ed, bool is_periodic) { otg_list_head *qlist = NULL; /* periodic transfer : control and bulk */ if (is_periodic) { if (periodic_trans_ready_q.entity_num == 0) return USB_ERR_NO_ENTITY; qlist = periodic_trans_ready_q.entity_list.next; if (!otg_list_empty(&periodic_trans_ready_q.entity_list)) { *get_ed = otg_list_get_node(qlist, struct ed, readyq_list); if (qlist->prev == LIST_POISON2 || qlist->next == LIST_POISON1) { printk(KERN_ERR "shost scheduler: get_ed_from_ready_q error\n"); periodic_trans_ready_q.entity_num = 0; } else { otg_list_pop(qlist); periodic_trans_ready_q.entity_num--; get_ed[0]->ed_status.is_in_transfer_ready_q = false; } return USB_ERR_SUCCESS; } else return USB_ERR_NO_ENTITY;
int remove_ed_from_ready_q(ed_t *remove_ed) { // SPINLOCK_t SLForRemoveED_t = SPIN_LOCK_INIT; // u32 uiSLFlag=0; otg_list_pop(&remove_ed->trans_ready_q_list_entry); if(remove_ed->ed_desc.endpoint_type == BULK_TRANSFER|| remove_ed->ed_desc.endpoint_type == CONTROL_TRANSFER) { // spin_lock_irq_save_otg(&SLForRemoveED_t, uiSLFlag); // otg_list_pop(&remove_ed->trans_ready_q_list_entry); nonperiodic_trans_ready_q.trans_ready_entry_num--; // spin_unlock_irq_save_otg(&SLForRemoveED_t, uiSLFlag); } else { // spin_lock_irq_save_otg(&SLForRemoveED_t, uiSLFlag); // otg_list_pop(&remove_ed->trans_ready_q_list_entry); periodic_trans_ready_q.trans_ready_entry_num--; // spin_unlock_irq_save_otg(&SLForRemoveED_t, uiSLFlag); } return USB_ERR_SUCCESS; }
static int remove_ed_from_ready_q(struct ed *remove_ed) { otg_dbg(OTG_DBG_SCHEDULE_ED, "ed_id %d, td_id %d\n", remove_ed->ed_id, remove_ed->num_td); otg_list_pop(&remove_ed->readyq_list); if (remove_ed->ed_desc.endpoint_type == BULK_TRANSFER || remove_ed->ed_desc.endpoint_type == CONTROL_TRANSFER) { nonperiodic_trans_ready_q.entity_num--; } else periodic_trans_ready_q.entity_num--; return USB_ERR_SUCCESS; }