utils_dffs_cpu_mez.h (12243B)
1 /* 2 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 3 * 4 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 5 */ 6 7 8 #ifndef __UTILS_DFFS_CPU_MEZ_H_INCLUDED__ 9 /* { */ 10 #define __UTILS_DFFS_CPU_MEZ_H_INCLUDED__ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 #ifdef _MSC_VER 17 /* 18 * On MS-Windows platform this attribute is not defined. 19 */ 20 #define __ATTRIBUTE_PACKED__ 21 #pragma pack(push) 22 #pragma pack(1) 23 24 #elif __GNUC__ 25 /* 26 * GNUC packing attribute 27 */ 28 #define __ATTRIBUTE_PACKED__ __attribute__ ((packed)) 29 #else 30 #error "Add your system support for packed attribute." 31 #endif 32 33 /************* 34 * INCLUDES * 35 */ 36 /* { */ 37 #include <appl/diag/dpp/dffs_low.h> 38 #include <appl/diag/dpp/dffs_descriptor.h> 39 #include <appl/diag/dpp/dffs_driver.h> 40 /* } */ 41 42 /************* 43 * DEFINES * 44 */ 45 /* { */ 46 47 /* } */ 48 49 /************* 50 * MACROS * 51 */ 52 /* { */ 53 54 /* } */ 55 56 /************* 57 * TYPE DEFS * 58 */ 59 /* { */ 60 61 /* } */ 62 63 /************* 64 * GLOBALS * 65 */ 66 /* { */ 67 68 /* } */ 69 70 /************* 71 * FUNCTIONS * 72 */ 73 /* { */ 74 75 /***************************************************** 76 *NAME 77 * utils_dffs_cpu_init 78 *TYPE: 79 * PROC 80 *DATE: 81 * 02/07/2006 82 *FUNCTION: 83 * Brings the DFFS descriptor from flash to the supplied in-memory buffer. 84 * Checks validity of the DFFS. If necessary - creates an empty DFFS. 85 *INPUT: 86 * SOC_SAND_DIRECT: 87 * unsigned char silent - if TRUE, printing is suppressed 88 * SOC_SAND_INDIRECT: 89 * None. 90 *OUTPUT: 91 * SOC_SAND_DIRECT: 92 * error indication 93 * SOC_SAND_INDIRECT: 94 * dffs_descriptor. 95 *REMARKS: 96 * None. 97 *SEE ALSO: 98 */ 99 unsigned int 100 utils_dffs_cpu_init( 101 unsigned char silent 102 ); 103 104 /***************************************************** 105 *NAME 106 * utils_dffs_cpu_file_exists 107 *TYPE: 108 * PROC 109 *DATE: 110 * 06/07/2006 111 *FUNCTION: 112 * Checks if the requested file exists. 113 *INPUT: 114 * SOC_SAND_DIRECT: 115 * char* file_name - the name of the requested file 116 * unsigned int* does_file_exist - TRUE if the file exists 117 * on dffs 118 * unsigned char silent - if TRUE, printing is suppressed 119 * SOC_SAND_INDIRECT: 120 * None. 121 *OUTPUT: 122 * SOC_SAND_DIRECT: 123 * error indication 124 * SOC_SAND_INDIRECT: 125 * TRUE/FALSE. 126 *REMARKS: 127 * None. 128 *SEE ALSO: 129 */ 130 unsigned int 131 utils_dffs_cpu_file_exists( 132 char* file_name, 133 unsigned int* does_file_exist, 134 unsigned char silent 135 ); 136 /***************************************************** 137 *NAME 138 * utils_dffs_cpu_get_file_size 139 *TYPE: 140 * PROC 141 *DATE: 142 * 02/07/2006 143 *FUNCTION: 144 * Reads the requested file from flash to the in-memory buffer. 145 *INPUT: 146 * SOC_SAND_DIRECT: 147 * char* file_name - the name of the requested file 148 * unsigned long* file_size - the size of the requested file 149 * unsigned char silent - if TRUE, printing is suppressed 150 * SOC_SAND_INDIRECT: 151 * None. 152 *OUTPUT: 153 * SOC_SAND_DIRECT: 154 * error indication 155 * SOC_SAND_INDIRECT: 156 * file_size. 157 *REMARKS: 158 * None. 159 *SEE ALSO: 160 */ 161 unsigned int 162 utils_dffs_cpu_get_file_size( 163 char* file_name, 164 unsigned long* file_size, 165 unsigned char silent 166 ); 167 168 /***************************************************** 169 *NAME 170 * utils_dffs_cpu_file_from_flash 171 *TYPE: 172 * PROC 173 *DATE: 174 * 02/07/2006 175 *FUNCTION: 176 * Reads the requested file from flash to the in-memory buffer. 177 *INPUT: 178 * SOC_SAND_DIRECT: 179 * char* file_name - the name of the requested file 180 * char* file_size - the size of the requested file 181 * char* file_buff - a memory allocated for the file 182 * unsigned char silent - if TRUE, printing is suppressed 183 * SOC_SAND_INDIRECT: 184 * None. 185 *OUTPUT: 186 * SOC_SAND_DIRECT: 187 * error indication 188 * SOC_SAND_INDIRECT: 189 * file_buff. 190 *REMARKS: 191 * None. 192 *SEE ALSO: 193 */ 194 unsigned int 195 utils_dffs_cpu_file_from_flash( 196 char* file_name, 197 unsigned long file_size, 198 char* file_buff, 199 unsigned char silent 200 ); 201 202 203 /***************************************************** 204 *NAME 205 * utils_dffs_cpu_file_to_flash 206 *TYPE: 207 * PROC 208 *DATE: 209 * 02/07/2006 210 *FUNCTION: 211 * Writes the requested file to flash from the in-memory buffer. 212 *INPUT: 213 * SOC_SAND_DIRECT: 214 * char* file_name - the name of the requested file 215 * char* file_size - the size of the requested file 216 * char* file_buff - the buffer containing the file 217 * unsigned char silent - if TRUE, printing is suppressed 218 * SOC_SAND_INDIRECT: 219 * None. 220 *OUTPUT: 221 * SOC_SAND_DIRECT: 222 * error indication 223 * SOC_SAND_INDIRECT: 224 * None. 225 *REMARKS: 226 * None. 227 *SEE ALSO: 228 */ 229 unsigned int 230 utils_dffs_cpu_file_to_flash( 231 char* file_name, 232 unsigned long file_size, 233 char* file_buff, 234 unsigned char silent 235 ); 236 237 238 /***************************************************** 239 *NAME 240 * utils_dffs_cpu_delete_file 241 *TYPE: 242 * PROC 243 *DATE: 244 * 02/07/2006 245 *FUNCTION: 246 * Deletes the requested file. 247 *INPUT: 248 * SOC_SAND_DIRECT: 249 * char* file_name - the name of the requested file 250 * unsigned char silent - if TRUE, printing is suppressed 251 * SOC_SAND_INDIRECT: 252 * None. 253 *OUTPUT: 254 * SOC_SAND_DIRECT: 255 * error indication 256 * SOC_SAND_INDIRECT: 257 * None. 258 *REMARKS: 259 * None. 260 *SEE ALSO: 261 */ 262 unsigned int 263 utils_dffs_cpu_delete_file( 264 char* file_name, 265 unsigned char silent 266 ); 267 268 269 /***************************************************** 270 *NAME 271 * utils_dffs_cpu_dir 272 *TYPE: 273 * PROC 274 *DATE: 275 * 02/07/2006 276 *FUNCTION: 277 * Prints to screen the file information on DFFS files. 278 *INPUT: 279 * SOC_SAND_DIRECT: 280 * DFFS_FORMAT_TYPE format - long or short format 281 * unsigned char silent - if TRUE, printing is suppressed 282 * SOC_SAND_INDIRECT: 283 * None. 284 *OUTPUT: 285 * SOC_SAND_DIRECT: 286 * error indication 287 * SOC_SAND_INDIRECT: 288 * None. 289 *REMARKS: 290 * None. 291 *SEE ALSO: 292 */ 293 unsigned int 294 utils_dffs_cpu_dir( 295 DFFS_FORMAT_TYPE format, 296 unsigned char silent 297 ); 298 299 /***************************************************** 300 *NAME 301 * utils_dffs_cpu_diagnostics 302 *TYPE: 303 * PROC 304 *DATE: 305 * 02/07/2006 306 *FUNCTION: 307 * Prints to screen the file information on DFFS files. 308 *INPUT: 309 * SOC_SAND_DIRECT: 310 * unsigned char silent - if TRUE, printing is suppressed 311 * SOC_SAND_INDIRECT: 312 * None. 313 *OUTPUT: 314 * SOC_SAND_DIRECT: 315 * error indication 316 * SOC_SAND_INDIRECT: 317 * None. 318 *REMARKS: 319 * None. 320 *SEE ALSO: 321 */ 322 unsigned int 323 utils_dffs_cpu_diagnostics( 324 unsigned char silent 325 ); 326 327 /***************************************************** 328 *NAME 329 * utils_dffs_cpu_print_file 330 *TYPE: 331 * PROC 332 *DATE: 333 * 02/07/2006 334 *FUNCTION: 335 * Prints the contents of the requested file to screen. 336 *INPUT: 337 * SOC_SAND_DIRECT: 338 * char* file_name - the name of the requested file 339 * unsigned long size_int_bytes - the number of bytes to print 340 * unsigned char silent - if TRUE, printing is suppressed 341 * SOC_SAND_INDIRECT: 342 * None. 343 *OUTPUT: 344 * SOC_SAND_DIRECT: 345 * error indication 346 * SOC_SAND_INDIRECT: 347 * None. 348 *REMARKS: 349 * None. 350 *SEE ALSO: 351 */ 352 unsigned int 353 utils_dffs_cpu_print_file( 354 char* file_name, 355 unsigned long size_int_bytes, 356 unsigned char silent 357 ); 358 359 360 /***************************************************** 361 *NAME 362 * utils_dffs_cpu_set_version 363 *TYPE: 364 * PROC 365 *DATE: 366 * 02/07/2006 367 *FUNCTION: 368 * Sets the version field of the requested file. 369 *INPUT: 370 * SOC_SAND_DIRECT: 371 * char* file_name - the name of the requested file 372 * unsigned char version - the value to be set 373 * unsigned char silent - if TRUE, printing is suppressed 374 * SOC_SAND_INDIRECT: 375 * None. 376 *OUTPUT: 377 * SOC_SAND_DIRECT: 378 * error indication 379 * SOC_SAND_INDIRECT: 380 * None. 381 *REMARKS: 382 * None. 383 *SEE ALSO: 384 */ 385 unsigned int 386 utils_dffs_cpu_set_version( 387 char* file_name, 388 unsigned char version, 389 unsigned char silent 390 ); 391 392 393 /***************************************************** 394 *NAME 395 * utils_dffs_cpu_set_attr 396 *TYPE: 397 * PROC 398 *DATE: 399 * 02/07/2006 400 *FUNCTION: 401 * Sets the general attribute field of the requested file.' 402 * attr_index distinguishes between attr1, attr2 and attr3. 403 *INPUT: 404 * SOC_SAND_DIRECT: 405 * char* file_name - the name of the requested file 406 * unsigned long attribute - the value to be set 407 * unsigned char attr_idx - the index of the general attribute 408 * to be updated. 409 * unsigned char silent - if TRUE, printing is suppressed 410 * SOC_SAND_INDIRECT: 411 * None. 412 *OUTPUT: 413 * SOC_SAND_DIRECT: 414 * error indication 415 * SOC_SAND_INDIRECT: 416 * None. 417 *REMARKS: 418 * None. 419 *SEE ALSO: 420 */ 421 unsigned int 422 utils_dffs_cpu_set_attr( 423 char* file_name, 424 unsigned long attribute, 425 unsigned char attr_idx, 426 unsigned char silent 427 ); 428 429 430 /***************************************************** 431 *NAME 432 * utils_dffs_cpu_set_date 433 *TYPE: 434 * PROC 435 *DATE: 436 * 02/07/2006 437 *FUNCTION: 438 * Sets the date field of the requested file. 439 * The date is a string 8 charecters long, i.e. 03/06/06 440 *INPUT: 441 * SOC_SAND_DIRECT: 442 * char* file_name - the name of the requested file 443 * char date[DFFS_DATE_STR_SIZE] - the value to be set 444 * unsigned char silent - if TRUE, printing is suppressed 445 * SOC_SAND_INDIRECT: 446 * None. 447 *OUTPUT: 448 * SOC_SAND_DIRECT: 449 * error indication 450 * SOC_SAND_INDIRECT: 451 * None. 452 *REMARKS: 453 * None. 454 *SEE ALSO: 455 */ 456 unsigned int 457 utils_dffs_cpu_set_date( 458 char* file_name, 459 char date[DFFS_DATE_STR_SIZE], 460 unsigned char silent 461 ); 462 463 464 /***************************************************** 465 *NAME 466 * utils_dffs_cpu_set_comment 467 *TYPE: 468 * PROC 469 *DATE: 470 * 02/07/2006 471 *FUNCTION: 472 * Sets the comment field of the requested file. 473 * A comment is a general text of 474 * max DFFS_COMMENT_STR_SIZE (20 on creation) charecters. 475 *INPUT: 476 * SOC_SAND_DIRECT: 477 * char* file_name - the name of the requested file 478 * char comment[DFFS_COMMENT_STR_SIZE] - the value to be set 479 * unsigned char silent - if TRUE, printing is suppressed 480 * SOC_SAND_INDIRECT: 481 * None. 482 *OUTPUT: 483 * SOC_SAND_DIRECT: 484 * error indication 485 * SOC_SAND_INDIRECT: 486 * None. 487 *REMARKS: 488 * None. 489 *SEE ALSO: 490 */ 491 unsigned int 492 utils_dffs_cpu_set_comment( 493 char* file_name, 494 char comment[DFFS_COMMENT_STR_SIZE], 495 unsigned char silent 496 ); 497 498 499 /***************************************************** 500 *NAME 501 * utils_dffs_cpu_print_comment 502 *TYPE: 503 * PROC 504 *DATE: 505 * 02/07/2006 506 *FUNCTION: 507 * Prints the comment field of the requested file to screen. 508 *INPUT: 509 * SOC_SAND_DIRECT: 510 * char* file_name - the name of the requested file 511 * unsigned char silent - if TRUE, printing is suppressed 512 * SOC_SAND_INDIRECT: 513 * None. 514 *OUTPUT: 515 * SOC_SAND_DIRECT: 516 * error indication 517 * SOC_SAND_INDIRECT: 518 * None. 519 *REMARKS: 520 * None. 521 *SEE ALSO: 522 */ 523 unsigned int 524 utils_dffs_cpu_print_comment( 525 char* file_name, 526 unsigned char silent 527 ); 528 529 /***************************************************** 530 *NAME 531 * utils_dffs_cpu_dld_and_write 532 *TYPE: 533 * PROC 534 *DATE: 535 * 05/07/2006 536 *FUNCTION: 537 * Downloads a file from a local host and writes it to flash. 538 *INPUT: 539 * SOC_SAND_DIRECT: 540 * char* file_name - the name of the file 541 * unsigned char silent - if TRUE, printing is suppressed 542 * SOC_SAND_INDIRECT: 543 * None. 544 *OUTPUT: 545 * SOC_SAND_DIRECT: 546 * error indication 547 * SOC_SAND_INDIRECT: 548 * None. 549 *REMARKS: 550 * None. 551 *SEE ALSO: 552 */ 553 unsigned int 554 utils_dffs_cpu_dld_and_write( 555 char* file_name, 556 unsigned char silent 557 ); 558 559 /* } */ 560 561 562 #ifdef _MSC_VER 563 #pragma pack(pop) 564 #endif 565 566 #ifdef __cplusplus 567 } 568 #endif 569 570 571 /* } __UTILS_DFFS_CPU_MEZ_H_INCLUDED__*/ 572 #endif