Ignore:
Timestamp:
2011-02-10T22:14:38Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1e64b250
Parents:
8bf1eeb
Message:

Get buffer replaced with asynchronous data read

The GET_BUFFER request from the USB HC interface (of DDF) was replaced
by using asynchronous version of IPC_M_DATA_READ.

Still needs to be done:

  • check error handling of protocol problems
  • remove the get_buffer callback from remote part of the interface completely
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    r8bf1eeb r0a6fa9f  
    9898typedef struct {
    9999        ipc_callid_t caller;
     100        ipc_callid_t data_caller;
    100101        void *buffer;
    101102        void *setup_packet;
     
    127128
    128129        trans->caller = caller;
     130        trans->data_caller = 0;
    129131        trans->buffer = NULL;
    130132        trans->setup_packet = NULL;
     
    295297
    296298        trans->size = actual_size;
    297         async_answer_1(trans->caller, USB_OUTCOME_OK, (sysarg_t)trans);
     299
     300        if (trans->data_caller) {
     301                async_data_read_finalize(trans->data_caller,
     302                    trans->buffer, actual_size);
     303        }
     304
     305        async_answer_0(trans->caller, USB_OUTCOME_OK);
    298306}
    299307
     
    376384        };
    377385
     386        ipc_callid_t data_callid;
     387        if (!async_data_read_receive(&data_callid, &len)) {
     388                async_answer_0(callid, EPARTY);
     389                return;
     390        }
     391
    378392        async_transaction_t *trans = async_transaction_create(callid);
    379393        if (trans == NULL) {
     
    381395                return;
    382396        }
     397        trans->data_caller = data_callid;
    383398        trans->buffer = malloc(len);
    384399        trans->size = len;
     
    630645        }
    631646
     647        ipc_callid_t data_callid;
     648        if (!async_data_read_receive(&data_callid, &data_len)) {
     649                async_answer_0(callid, EPARTY);
     650                free(setup_packet);
     651                return;
     652        }
     653
    632654        async_transaction_t *trans = async_transaction_create(callid);
    633655        if (trans == NULL) {
     
    636658                return;
    637659        }
     660        trans->data_caller = data_callid;
    638661        trans->setup_packet = setup_packet;
    639662        trans->size = data_len;
Note: See TracChangeset for help on using the changeset viewer.