| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2005, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bimg.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 2/24/05 6:46p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: throttled playback |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/img/bimg.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/1 2/24/05 6:46p vsilyaev |
|---|
| 21 | * PR 14226: Interface to access firmware type of data images |
|---|
| 22 | * |
|---|
| 23 | * |
|---|
| 24 | ***************************************************************/ |
|---|
| 25 | #ifndef BIMG_H__ |
|---|
| 26 | #define BIMG_H__ |
|---|
| 27 | |
|---|
| 28 | /*================== Module Overview ===================================== |
|---|
| 29 | This modules defines interface to access firware image files. |
|---|
| 30 | |
|---|
| 31 | User of the interface (low level software, aka Porting Interface module) is responsible: |
|---|
| 32 | o to pair 'open' with 'close' call |
|---|
| 33 | o do not nest calls to 'open' |
|---|
| 34 | o test return codes from 'open' and 'next' calls, each error considered to be fatal |
|---|
| 35 | o do not use interface in the _isr context |
|---|
| 36 | |
|---|
| 37 | Provider of the image loader interface is resposible: |
|---|
| 38 | o open,next and close calls shall take bounded time to execute |
|---|
| 39 | o 'next' method should either read requested number of bytes from the media or return an error |
|---|
| 40 | |
|---|
| 41 | ========================================================================*/ |
|---|
| 42 | |
|---|
| 43 | /*************************************************************************** |
|---|
| 44 | Summary: |
|---|
| 45 | This method is used to open image interface and allow further access to the image |
|---|
| 46 | |
|---|
| 47 | Input: |
|---|
| 48 | context - conext of the image interface |
|---|
| 49 | image_id - system specific ID for the specific image |
|---|
| 50 | |
|---|
| 51 | Output: |
|---|
| 52 | image - context for the opened image |
|---|
| 53 | |
|---|
| 54 | Returns: |
|---|
| 55 | BERR_SUCCESS - if function succeded |
|---|
| 56 | error code - if function has failed |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | ***************************************************************************/ |
|---|
| 60 | typedef BERR_Code (*BIMG_Method_Open)( |
|---|
| 61 | void *context, /* context of the image interface */ |
|---|
| 62 | void **image, /* [out] pointer to the image context */ |
|---|
| 63 | unsigned image_id /* ID of the image */ |
|---|
| 64 | ); |
|---|
| 65 | |
|---|
| 66 | /*************************************************************************** |
|---|
| 67 | Summary: |
|---|
| 68 | This method is used to access to the image data |
|---|
| 69 | |
|---|
| 70 | Input: |
|---|
| 71 | image - conext of previously opened image |
|---|
| 72 | chunk - number of microcode block |
|---|
| 73 | length - size of the microcode block |
|---|
| 74 | |
|---|
| 75 | Output: |
|---|
| 76 | data - pointer to the images data |
|---|
| 77 | |
|---|
| 78 | Returns: |
|---|
| 79 | BERR_SUCCESS - if function succeded and data points to the memory with exact 'length' bytes of data |
|---|
| 80 | error code - if function has failed |
|---|
| 81 | |
|---|
| 82 | ***************************************************************************/ |
|---|
| 83 | typedef BERR_Code (*BIMG_Method_Next)( |
|---|
| 84 | void *image, /* image context information, one returned by the 'open' call */ |
|---|
| 85 | unsigned chunk, /* number of chunk, starts from 0, shall increment with each call */ |
|---|
| 86 | const void **data, /* [out] returns pointer to next piece of data, contents of this pointer is valid until succeding call to the 'next' function */ |
|---|
| 87 | uint16_t length /* number of bytes to read from the image, length shall be less than 64K */ |
|---|
| 88 | ); |
|---|
| 89 | |
|---|
| 90 | /*************************************************************************** |
|---|
| 91 | Summary: |
|---|
| 92 | This method is used to close image context |
|---|
| 93 | |
|---|
| 94 | Input: |
|---|
| 95 | image - conext of previously opened image |
|---|
| 96 | |
|---|
| 97 | Returns: |
|---|
| 98 | <none> |
|---|
| 99 | |
|---|
| 100 | ***************************************************************************/ |
|---|
| 101 | typedef void (*BIMG_Method_Close)( |
|---|
| 102 | void *image /* image context */ |
|---|
| 103 | ); |
|---|
| 104 | |
|---|
| 105 | /*************************************************************************** |
|---|
| 106 | Summary: |
|---|
| 107 | This interface is used to access firmware images |
|---|
| 108 | |
|---|
| 109 | ***************************************************************************/ |
|---|
| 110 | typedef struct BIMG_Interface { |
|---|
| 111 | BIMG_Method_Open open; /* open method */ |
|---|
| 112 | BIMG_Method_Next next; /* 'next' method */ |
|---|
| 113 | BIMG_Method_Close close; /* close method */ |
|---|
| 114 | } BIMG_Interface; |
|---|
| 115 | |
|---|
| 116 | #endif /* BIMG_H__ */ |
|---|
| 117 | |
|---|
| 118 | |
|---|