Changeset 2bf8f8c in mainline for uspace/drv/ohci/batch.c
- Timestamp:
- 2011-03-21T13:18:03Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d328172
- Parents:
- be7950e8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/batch.c
rbe7950e8 r2bf8f8c 39 39 40 40 #include "batch.h" 41 #include "utils/malloc32.h" 41 42 42 43 #define DEFAULT_ERROR_COUNT 3 … … 48 49 usb_speed_t speed, 49 50 char *buffer, 50 size_t size,51 size_t buffer_size, 51 52 char *setup_buffer, 52 53 size_t setup_size, … … 57 58 ) 58 59 { 59 return NULL; 60 #define CHECK_NULL_DISPOSE_RETURN(ptr, message...) \ 61 if (ptr == NULL) { \ 62 usb_log_error(message); \ 63 if (instance) { \ 64 batch_dispose(instance); \ 65 } \ 66 return NULL; \ 67 } else (void)0 68 69 batch_t *instance = malloc(sizeof(batch_t)); 70 CHECK_NULL_DISPOSE_RETURN(instance, 71 "Failed to allocate batch instance.\n"); 72 batch_init(instance, target, transfer_type, speed, max_packet_size, 73 buffer, NULL, buffer_size, NULL, setup_size, func_in, 74 func_out, arg, fun, NULL); 75 76 if (buffer_size > 0) { 77 instance->transport_buffer = malloc32(buffer_size); 78 CHECK_NULL_DISPOSE_RETURN(instance->transport_buffer, 79 "Failed to allocate device accessible buffer.\n"); 80 } 81 82 if (setup_size > 0) { 83 instance->setup_buffer = malloc32(setup_size); 84 CHECK_NULL_DISPOSE_RETURN(instance->setup_buffer, 85 "Failed to allocate device accessible setup buffer.\n"); 86 memcpy(instance->setup_buffer, setup_buffer, setup_size); 87 } 88 89 90 return instance; 60 91 } 61 92 /*----------------------------------------------------------------------------*/ 62 93 void batch_dispose(batch_t *instance) 63 94 { 95 assert(instance); 64 96 } 65 97 /*----------------------------------------------------------------------------*/ 66 98 void batch_control_write(batch_t *instance) 67 99 { 100 assert(instance); 68 101 } 69 102 /*----------------------------------------------------------------------------*/ 70 103 void batch_control_read(batch_t *instance) 71 104 { 105 assert(instance); 72 106 } 73 107 /*----------------------------------------------------------------------------*/ 74 108 void batch_interrupt_in(batch_t *instance) 75 109 { 110 assert(instance); 76 111 } 77 112 /*----------------------------------------------------------------------------*/ 78 113 void batch_interrupt_out(batch_t *instance) 79 114 { 115 assert(instance); 80 116 } 81 117 /*----------------------------------------------------------------------------*/ 82 118 void batch_bulk_in(batch_t *instance) 83 119 { 120 assert(instance); 84 121 } 85 122 /*----------------------------------------------------------------------------*/ 86 123 void batch_bulk_out(batch_t *instance) 87 124 { 125 assert(instance); 88 126 } 89 127 /**
Note:
See TracChangeset
for help on using the changeset viewer.