static void process_data_sock(int h, struct pollfd *pfds, int count) { asrt(count <= ts[h].poll_count); int i; for( i= 1; i < ts[h].poll_count; i++) { if(pfds[i].revents) { int ps_i = ts[h].psi[i]; asrt(pfds[i].fd == ts[h].ps[ps_i].pfd.fd); uint32_t user_id = ts[h].ps[ps_i].user_id; int type = ts[h].ps[ps_i].type; int flags = 0; print_events(pfds[i].revents); if(IS_READ(pfds[i].revents)) { flags |= SOCK_THREAD_FD_RD; } if(IS_WRITE(pfds[i].revents)) { flags |= SOCK_THREAD_FD_WR; } if(IS_EXCEPTION(pfds[i].revents)) { flags |= SOCK_THREAD_FD_EXCEPTION; //remove the whole slot not flags remove_poll(h, &ts[h].ps[ps_i], ts[h].ps[ps_i].flags); } else if(flags) remove_poll(h, &ts[h].ps[ps_i], flags); //remove the monitor flags that already processed if(flags) ts[h].callback(pfds[i].fd, type, flags, user_id); } } }
uint32_t edmac_get_dir(uint32_t channel) { if(!IS_USED(edmac_chanlist[channel])) { return EDMAC_DIR_UNUSED; } if(IS_WRITE(edmac_chanlist[channel])) { return EDMAC_DIR_WRITE; } if(IS_READ(edmac_chanlist[channel])) { return EDMAC_DIR_READ; } return EDMAC_DIR_UNUSED; }