286
285
HIF_SCATTER_DMA_BOUNCE, /* Uses SG DMA but HIF layer uses an internal bounce buffer */
287
286
} HIF_SCATTER_METHOD;
289
typedef struct _HIF_SCATTER_REQ {
290
DL_LIST ListLink; /* link management */
291
A_UINT32 Address; /* address for the read/write operation */
292
A_UINT32 Request; /* request flags */
293
A_UINT32 TotalLength; /* total length of entire transfer */
294
A_UINT32 CallerFlags; /* caller specific flags can be stored here */
288
struct hif_scatter_req {
289
struct dl_list ListLink; /* link management */
290
u32 Address; /* address for the read/write operation */
291
u32 Request; /* request flags */
292
u32 TotalLength; /* total length of entire transfer */
293
u32 CallerFlags; /* caller specific flags can be stored here */
295
294
HIF_SCATTER_COMP_CB CompletionRoutine; /* completion routine set by caller */
296
A_STATUS CompletionStatus; /* status of completion */
295
int CompletionStatus; /* status of completion */
297
296
void *Context; /* caller context for this request */
298
297
int ValidScatterEntries; /* number of valid entries set by caller */
299
298
HIF_SCATTER_METHOD ScatterMethod; /* scatter method handled by HIF */
300
299
void *HIFPrivate[4]; /* HIF private area */
301
A_UINT8 *pScatterBounceBuffer; /* bounce buffer for upper layers to copy to/from */
302
HIF_SCATTER_ITEM ScatterList[1]; /* start of scatter list */
305
typedef HIF_SCATTER_REQ * ( *HIF_ALLOCATE_SCATTER_REQUEST)(HIF_DEVICE *device);
306
typedef void ( *HIF_FREE_SCATTER_REQUEST)(HIF_DEVICE *device, HIF_SCATTER_REQ *request);
307
typedef A_STATUS ( *HIF_READWRITE_SCATTER)(HIF_DEVICE *device, HIF_SCATTER_REQ *request);
309
typedef struct _HIF_DEVICE_SCATTER_SUPPORT_INFO {
300
u8 *pScatterBounceBuffer; /* bounce buffer for upper layers to copy to/from */
301
struct hif_scatter_item ScatterList[1]; /* start of scatter list */
304
typedef struct hif_scatter_req * ( *HIF_ALLOCATE_SCATTER_REQUEST)(struct hif_device *device);
305
typedef void ( *HIF_FREE_SCATTER_REQUEST)(struct hif_device *device, struct hif_scatter_req *request);
306
typedef int ( *HIF_READWRITE_SCATTER)(struct hif_device *device, struct hif_scatter_req *request);
308
struct hif_device_scatter_support_info {
310
309
/* information returned from HIF layer */
311
310
HIF_ALLOCATE_SCATTER_REQUEST pAllocateReqFunc;
312
311
HIF_FREE_SCATTER_REQUEST pFreeReqFunc;
313
312
HIF_READWRITE_SCATTER pReadWriteScatterFunc;
314
313
int MaxScatterEntries;
315
314
int MaxTransferSizePerScatterReq;
316
} HIF_DEVICE_SCATTER_SUPPORT_INFO;
317
struct hif_device_os_device_info {
320
} HIF_DEVICE_OS_DEVICE_INFO;
322
321
#define HIF_MAX_DEVICES 1
324
323
struct htc_callbacks {
325
324
void *context; /* context to pass to the dsrhandler
326
325
note : rwCompletionHandler is provided the context passed to HIFReadWrite */
327
A_STATUS (* rwCompletionHandler)(void *rwContext, A_STATUS status);
328
A_STATUS (* dsrHandler)(void *context);
326
int (* rwCompletionHandler)(void *rwContext, int status);
327
int (* dsrHandler)(void *context);
331
330
typedef struct osdrv_callbacks {
332
331
void *context; /* context to pass for all callbacks except deviceRemovedHandler
333
332
the deviceRemovedHandler is only called if the device is claimed */
334
A_STATUS (* deviceInsertedHandler)(void *context, void *hif_handle);
335
A_STATUS (* deviceRemovedHandler)(void *claimedContext, void *hif_handle);
336
A_STATUS (* deviceSuspendHandler)(void *context);
337
A_STATUS (* deviceResumeHandler)(void *context);
338
A_STATUS (* deviceWakeupHandler)(void *context);
339
A_STATUS (* devicePowerChangeHandler)(void *context, HIF_DEVICE_POWER_CHANGE_TYPE config);
333
int (* deviceInsertedHandler)(void *context, void *hif_handle);
334
int (* deviceRemovedHandler)(void *claimedContext, void *hif_handle);
335
int (* deviceSuspendHandler)(void *context);
336
int (* deviceResumeHandler)(void *context);
337
int (* deviceWakeupHandler)(void *context);
338
int (* devicePowerChangeHandler)(void *context, HIF_DEVICE_POWER_CHANGE_TYPE config);
340
339
} OSDRV_CALLBACKS;
342
341
#define HIF_OTHER_EVENTS (1 << 0) /* other interrupts (non-Recv) are pending, host
343
342
needs to read the register table to figure out what */
344
343
#define HIF_RECV_MSG_AVAIL (1 << 1) /* pending recv packet */
346
typedef struct _HIF_PENDING_EVENTS_INFO {
349
A_UINT32 AvailableRecvBytes;
345
struct hif_pending_events_info {
348
u32 AvailableRecvBytes;
352
A_UINT32 INT_CAUSE_REG;
354
} HIF_PENDING_EVENTS_INFO;
356
355
/* function to get pending events , some HIF modules use special mechanisms
357
356
* to detect packet available and other interrupts */
358
typedef A_STATUS ( *HIF_PENDING_EVENTS_FUNC)(HIF_DEVICE *device,
359
HIF_PENDING_EVENTS_INFO *pEvents,
357
typedef int ( *HIF_PENDING_EVENTS_FUNC)(struct hif_device *device,
358
struct hif_pending_events_info *pEvents,
360
359
void *AsyncContext);
362
#define HIF_MASK_RECV TRUE
363
#define HIF_UNMASK_RECV FALSE
361
#define HIF_MASK_RECV true
362
#define HIF_UNMASK_RECV false
364
363
/* function to mask recv events */
365
typedef A_STATUS ( *HIF_MASK_UNMASK_RECV_EVENT)(HIF_DEVICE *device,
364
typedef int ( *HIF_MASK_UNMASK_RECV_EVENT)(struct hif_device *device,
367
366
void *AsyncContext);
372
371
* and to set OS driver callbacks (i.e. insertion/removal) to the HIF layer
375
A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks);
374
int HIFInit(OSDRV_CALLBACKS *callbacks);
377
376
/* This API claims the HIF device and provides a context for handling removal.
378
377
* The device removal callback is only called when the OSDRV layer claims
379
378
* a device. The claimed context must be non-NULL */
380
void HIFClaimDevice(HIF_DEVICE *device, void *claimedContext);
379
void HIFClaimDevice(struct hif_device *device, void *claimedContext);
381
380
/* release the claimed device */
382
void HIFReleaseDevice(HIF_DEVICE *device);
381
void HIFReleaseDevice(struct hif_device *device);
384
383
/* This API allows the HTC layer to attach to the HIF device */
385
A_STATUS HIFAttachHTC(HIF_DEVICE *device, HTC_CALLBACKS *callbacks);
384
int HIFAttachHTC(struct hif_device *device, HTC_CALLBACKS *callbacks);
386
385
/* This API detaches the HTC layer from the HIF device */
387
void HIFDetachHTC(HIF_DEVICE *device);
386
void HIFDetachHTC(struct hif_device *device);
390
389
* This API is used to provide the read/write interface over the specific bus