/* * Function: enqueue_packet * Purpose: move a newly read packet onto the appropriate queue * of read packets * * Params: * In/Out: ds State structure with new packet * * Returns: Nothing */ static void enqueue_packet(DevSWState *ds) { struct data_packet *dp = &ds->ds_activeread.dc_packet; Packet *packet = ds->ds_nextreadpacket; /* * transfer the length */ packet->pk_length = dp->len; /* * take this packet out of the incoming slot */ ds->ds_nextreadpacket = NULL; /* * try to put it on the correct input queue */ if (illegalDevChanID(dp->type)) { /* this shouldn't happen */ WARN("Illegal type for Rx packet"); DevSW_FreePacket(packet); } else Adp_addToQueue(&ds->ds_readqueue[dp->type], packet); }
static AdpErrs ChannelWrite( const ChannelID chan, Packet *packet, AsyncMode mode) { struct Channel *ch; unsigned char *cptr; #ifdef DEBUG printf("Adp_ChannelWrite(%d, %x)\n", chan, packet); #endif /* DEBUG */ if (deviceToUse == NULL) return adp_device_not_open; if (invalidChannelID(chan)) return adp_bad_channel_id; /* * fill in the channels header at the start of this buffer */ ch = (channels + chan); if (ch != NULL) { ; /* (ok) */ } else { ; /* FIXME: do something here */ } cptr = packet->pk_buffer; *cptr++ = chan; *cptr = 0; packet->pk_length += CHAN_HEADER_SIZE; /* * OK, add this packet to the write queue, and try to flush it out */ Adp_addToQueue(&writeQueueSend, packet); Adp_AsynchronousProcessing(mode); return adp_ok; }