source: svn/trunk/newcon3bcm2_21bu/dta/src/app/image_recv.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 6.4 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2008, 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: $
11 * $brcm_Revision: $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: $
19 *
20 *
21 ***************************************************************************/
22#if !defined(__IMAGE_RECV_H__)
23#define __IMAGE_RECV_H__
24
25#include "bsettop_types.h"
26
27/***************************************************************************
28Summary:
29 Error codes returned by image functions
30Description:
31 Error codes that are returned by image... functions. Caller must test
32these error codes and update status accordingly.
33***************************************************************************/
34#define berr_no_dsmcc_pid 41
35#define berr_no_code_image_file 42
36#define berr_download_failure 43
37#define berr_no_memory 44
38#define berr_verification_falure 45
39#define berr_loading 46
40#define berr_same_version 47
41
42/***************************************************************************
43Summary:
44 Structure describing received software image in memory.
45Description:
46 Structure is placed at the head of received image.
47 size - size of the image.
48 header - space for boot header structure;
49 data - content of the software image. The actual array has at least as many
50 bytes as the size of the image. The remaining bytes follow the first element
51 of the array - data[1], data[2]...
52***************************************************************************/
53struct image_t {
54    size_t size;
55    unsigned int header[4];
56    char data[1];
57};
58
59/***************************************************************************
60Summary:
61 Structure describing current download status.
62Description:
63 Structure is used to obtain status for display in diagnostic screen
64 block_count - total block count according to DII
65 block_received - number of blocks that was already received.
66 module_version - module version from DII
67 module_info_length - lenght of module name from DII
68 module_info_bytes - pointer to constant string containing module name.
69***************************************************************************/
70struct image_status_t {
71    uint32_t blocks_count;
72    uint32_t blocks_received;
73    uint32_t module_version;
74    uint32_t module_info_length;
75    uint8_t * module_info_bytes;
76};
77
78/***************************************************************************
79Summary:
80  Initialize image download.
81Description:
82  Initialize image download and prepare for receiving image. This function
83should be called before calling any other function. There is no corresponding
84close function.
85Input:
86  None
87Output:
88  None
89Returns:
90  b_ok in case call was successful, error code otherwise.
91SeeAlso:
92None
93***************************************************************************/
94bresult image_init(void);
95
96/***************************************************************************
97Summary:
98  Receive image from the dsmcc carousel
99Description:
100  Receive image from the dsmcc carousel. The function first receives dii,
101parses it, then receives first module described in dii. The result is stored
102in memory block described by image_t structure and allocated inside of the
103function. After caller is done with the image it must call free(image) in
104order to avoid memory leak. Since image is large memory leak will be
105significant. Function does not do any tuning so tuning should be done before
106calling this function.
107Input:
108  band - input band on which to receive data.
109  pid - pid which contains dsm-cc data.
110  image - pointer to pointer to the image structure.
111  name_lengh - lenght of name from CVT
112  name - pointer to the name from CVT
113Output:
114  image - if function is successful this pointer will be initialize with
115pointer to the image_t structure containing received image. If function
116fails content of this pointer is not defined. After application is done with
117data the this pointer should be freed by calling free.
118Returns:
119  b_ok if function is successful error code otherwise.
120SeeAlso:
121  image_init
122***************************************************************************/
123bresult image_receive(bband_t band, uint16_t pid, struct image_t ** image, uint8_t name_length, uint8_t * name);
124
125/***************************************************************************
126Summary:
127  Write image to flash
128Description:
129  Function chooses which location to use for storing image based on image
130version and running image version. Then function authenticates image and
131if authentication successful, writes image to flash.
132Input:
133  image - pointer to the image structure.
134Output:
135  None
136Returns:
137  b_ok if function is successful error code otherwise.
138SeeAlso:
139  image_init, image_receive
140***************************************************************************/
141bresult image_write(struct image_t * image);
142
143/***************************************************************************
144Summary:
145  Retrieve current download status.
146Description:
147  Retrieve current download status from download module.
148Input:
149  status - poitner to the stcuture that will be filled with status
150           information.
151Output:
152  None
153Returns:
154  None
155SeeAlso:
156  image_init, image_receive
157***************************************************************************/
158void image_get_status(struct image_status_t * status);
159
160
161/***************************************************************************
162Summary:
163 Retrieve flash write status.
164Description:
165 New HD DTA OSI requires to draw the percentage of CDL.
166Output:
167 berased : specify whether flash erase is done or not
168 wpct : percentage of flash program
169Return:
170 None
171***************************************************************************/
172void image_get_wstate(bool *berased, int *wpct);
173
174/***************************************************************************
175Summary:
176 Return application header for specified bank
177Input:
178 bank - 0 for Bank A, 1 for Bank B
179Output:
180 bact - specifiy specified bank image is active or not
181Returns:
182 pointer to the application header for the specified bank.
183 If there's no image on that bank, return NULL
184***************************************************************************/
185void *image_get_header(int bank, bool *bact);
186#endif
Note: See TracBrowser for help on using the repository browser.