lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since 89a0485a was 89a0485a, checked in by Jan Vesely <jano.vesely@…>, 14 years ago |
Move function implementations to .c files
Unify error reporting in uhci_in()
|
-
Property mode
set to
100644
|
File size:
694 bytes
|
Rev | Line | |
---|
[89a0485a] | 1 | #include <errno.h>
|
---|
| 2 |
|
---|
| 3 | #include "callback.h"
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | int callback_init(callback_t *instance, device_t *dev,
|
---|
| 7 | void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
|
---|
| 8 | usbhc_iface_transfer_out_callback_t func_out, void *arg)
|
---|
| 9 | {
|
---|
| 10 | assert(instance);
|
---|
| 11 | assert(func_in == NULL || func_out == NULL);
|
---|
| 12 | instance->new_buffer = trans_malloc(size);
|
---|
| 13 | if (!instance->new_buffer) {
|
---|
| 14 | uhci_print_error("Failed to allocate device acessible buffer.\n");
|
---|
| 15 | return ENOMEM;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | if (func_out)
|
---|
| 19 | memcpy(instance->new_buffer, buffer, size);
|
---|
| 20 |
|
---|
| 21 | instance->callback_out = func_out;
|
---|
| 22 | instance->callback_in = func_in;
|
---|
| 23 | instance->old_buffer = buffer;
|
---|
| 24 | instance->buffer_size = size;
|
---|
| 25 | instance->dev = dev;
|
---|
| 26 | return EOK;
|
---|
| 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.