fwmem.c (127468) | fwmem.c (129585) |
---|---|
1/* 2 * Copyright (c) 2002-2003 3 * Hidetoshi Shimokawa. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 */ 35 36#ifdef __FreeBSD__ 37#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2002-2003 3 * Hidetoshi Shimokawa. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 */ 35 36#ifdef __FreeBSD__ 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/dev/firewire/fwmem.c 127468 2004-03-26 23:17:10Z simokawa $"); | 38__FBSDID("$FreeBSD: head/sys/dev/firewire/fwmem.c 129585 2004-05-22 16:14:17Z dfr $"); |
39#endif 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/types.h> 44 45#include <sys/kernel.h> 46#include <sys/malloc.h> --- 75 unchanged lines hidden (view full) --- 122 123 return xfer; 124} 125 126struct fw_xfer * 127fwmem_read_quad( 128 struct fw_device *fwdev, 129 caddr_t sc, | 39#endif 40 41#include <sys/param.h> 42#include <sys/systm.h> 43#include <sys/types.h> 44 45#include <sys/kernel.h> 46#include <sys/malloc.h> --- 75 unchanged lines hidden (view full) --- 122 123 return xfer; 124} 125 126struct fw_xfer * 127fwmem_read_quad( 128 struct fw_device *fwdev, 129 caddr_t sc, |
130 u_int8_t spd, 131 u_int16_t dst_hi, 132 u_int32_t dst_lo, | 130 uint8_t spd, 131 uint16_t dst_hi, 132 uint32_t dst_lo, |
133 void *data, 134 void (*hand)(struct fw_xfer *)) 135{ 136 struct fw_xfer *xfer; 137 struct fw_pkt *fp; 138 139 xfer = fwmem_xfer_req(fwdev, (void *)sc, spd, 0, 4, hand); 140 if (xfer == NULL) { 141 return NULL; 142 } 143 144 fp = &xfer->send.hdr; 145 fp->mode.rreqq.tcode = FWTCODE_RREQQ; 146 fp->mode.rreqq.dest_hi = dst_hi; 147 fp->mode.rreqq.dest_lo = dst_lo; 148 149 xfer->send.payload = NULL; | 133 void *data, 134 void (*hand)(struct fw_xfer *)) 135{ 136 struct fw_xfer *xfer; 137 struct fw_pkt *fp; 138 139 xfer = fwmem_xfer_req(fwdev, (void *)sc, spd, 0, 4, hand); 140 if (xfer == NULL) { 141 return NULL; 142 } 143 144 fp = &xfer->send.hdr; 145 fp->mode.rreqq.tcode = FWTCODE_RREQQ; 146 fp->mode.rreqq.dest_hi = dst_hi; 147 fp->mode.rreqq.dest_lo = dst_lo; 148 149 xfer->send.payload = NULL; |
150 xfer->recv.payload = (u_int32_t *)data; | 150 xfer->recv.payload = (uint32_t *)data; |
151 152 if (fwmem_debug) 153 printf("fwmem_read_quad: %d %04x:%08x\n", fwdev->dst, 154 dst_hi, dst_lo); 155 156 if (fw_asyreq(xfer->fc, -1, xfer) == 0) 157 return xfer; 158 159 fw_xfer_free(xfer); 160 return NULL; 161} 162 163struct fw_xfer * 164fwmem_write_quad( 165 struct fw_device *fwdev, 166 caddr_t sc, | 151 152 if (fwmem_debug) 153 printf("fwmem_read_quad: %d %04x:%08x\n", fwdev->dst, 154 dst_hi, dst_lo); 155 156 if (fw_asyreq(xfer->fc, -1, xfer) == 0) 157 return xfer; 158 159 fw_xfer_free(xfer); 160 return NULL; 161} 162 163struct fw_xfer * 164fwmem_write_quad( 165 struct fw_device *fwdev, 166 caddr_t sc, |
167 u_int8_t spd, 168 u_int16_t dst_hi, 169 u_int32_t dst_lo, | 167 uint8_t spd, 168 uint16_t dst_hi, 169 uint32_t dst_lo, |
170 void *data, 171 void (*hand)(struct fw_xfer *)) 172{ 173 struct fw_xfer *xfer; 174 struct fw_pkt *fp; 175 176 xfer = fwmem_xfer_req(fwdev, sc, spd, 0, 0, hand); 177 if (xfer == NULL) 178 return NULL; 179 180 fp = &xfer->send.hdr; 181 fp->mode.wreqq.tcode = FWTCODE_WREQQ; 182 fp->mode.wreqq.dest_hi = dst_hi; 183 fp->mode.wreqq.dest_lo = dst_lo; | 170 void *data, 171 void (*hand)(struct fw_xfer *)) 172{ 173 struct fw_xfer *xfer; 174 struct fw_pkt *fp; 175 176 xfer = fwmem_xfer_req(fwdev, sc, spd, 0, 0, hand); 177 if (xfer == NULL) 178 return NULL; 179 180 fp = &xfer->send.hdr; 181 fp->mode.wreqq.tcode = FWTCODE_WREQQ; 182 fp->mode.wreqq.dest_hi = dst_hi; 183 fp->mode.wreqq.dest_lo = dst_lo; |
184 fp->mode.wreqq.data = *(u_int32_t *)data; | 184 fp->mode.wreqq.data = *(uint32_t *)data; |
185 186 xfer->send.payload = xfer->recv.payload = NULL; 187 188 if (fwmem_debug) 189 printf("fwmem_write_quad: %d %04x:%08x %08x\n", fwdev->dst, | 185 186 xfer->send.payload = xfer->recv.payload = NULL; 187 188 if (fwmem_debug) 189 printf("fwmem_write_quad: %d %04x:%08x %08x\n", fwdev->dst, |
190 dst_hi, dst_lo, *(u_int32_t *)data); | 190 dst_hi, dst_lo, *(uint32_t *)data); |
191 192 if (fw_asyreq(xfer->fc, -1, xfer) == 0) 193 return xfer; 194 195 fw_xfer_free(xfer); 196 return NULL; 197} 198 199struct fw_xfer * 200fwmem_read_block( 201 struct fw_device *fwdev, 202 caddr_t sc, | 191 192 if (fw_asyreq(xfer->fc, -1, xfer) == 0) 193 return xfer; 194 195 fw_xfer_free(xfer); 196 return NULL; 197} 198 199struct fw_xfer * 200fwmem_read_block( 201 struct fw_device *fwdev, 202 caddr_t sc, |
203 u_int8_t spd, 204 u_int16_t dst_hi, 205 u_int32_t dst_lo, | 203 uint8_t spd, 204 uint16_t dst_hi, 205 uint32_t dst_lo, |
206 int len, 207 void *data, 208 void (*hand)(struct fw_xfer *)) 209{ 210 struct fw_xfer *xfer; 211 struct fw_pkt *fp; 212 213 xfer = fwmem_xfer_req(fwdev, sc, spd, 0, roundup2(len, 4), hand); --- 19 unchanged lines hidden (view full) --- 233 fw_xfer_free(xfer); 234 return NULL; 235} 236 237struct fw_xfer * 238fwmem_write_block( 239 struct fw_device *fwdev, 240 caddr_t sc, | 206 int len, 207 void *data, 208 void (*hand)(struct fw_xfer *)) 209{ 210 struct fw_xfer *xfer; 211 struct fw_pkt *fp; 212 213 xfer = fwmem_xfer_req(fwdev, sc, spd, 0, roundup2(len, 4), hand); --- 19 unchanged lines hidden (view full) --- 233 fw_xfer_free(xfer); 234 return NULL; 235} 236 237struct fw_xfer * 238fwmem_write_block( 239 struct fw_device *fwdev, 240 caddr_t sc, |
241 u_int8_t spd, 242 u_int16_t dst_hi, 243 u_int32_t dst_lo, | 241 uint8_t spd, 242 uint16_t dst_hi, 243 uint32_t dst_lo, |
244 int len, 245 void *data, 246 void (*hand)(struct fw_xfer *)) 247{ 248 struct fw_xfer *xfer; 249 struct fw_pkt *fp; 250 251 xfer = fwmem_xfer_req(fwdev, sc, spd, len, 0, hand); --- 189 unchanged lines hidden --- | 244 int len, 245 void *data, 246 void (*hand)(struct fw_xfer *)) 247{ 248 struct fw_xfer *xfer; 249 struct fw_pkt *fp; 250 251 xfer = fwmem_xfer_req(fwdev, sc, spd, len, 0, hand); --- 189 unchanged lines hidden --- |