dffs_descriptor.h (2048B)
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 __DFFS_DESCRIPTOR_H_INCLUDED__ 9 /* { */ 10 #define __DFFS_DESCRIPTOR_H_INCLUDED__ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /************* 17 * INCLUDES * 18 */ 19 /* { */ 20 21 /* } */ 22 23 /************* 24 * DEFINES * 25 */ 26 /* { */ 27 /* max characters in a file name */ 28 #define DFFS_FILENAME_SIZE 25 29 30 /* max characters in a date string */ 31 #define DFFS_DATE_STR_SIZE 9 32 33 /* max characters in a file description comment string */ 34 #define DFFS_COMMENT_STR_SIZE 66 35 36 /* a pattern used for dffs recognition*/ 37 #define DFFS_SIGNATURE_PATTERN 0xAFC33CFA 38 39 /* maximal allowed number of files used in DFFS*/ 40 #define DFFS_MAX_FILES 20 41 /* } */ 42 43 /************* 44 * MACROS * 45 */ 46 /* { */ 47 48 /* } */ 49 50 /************* 51 * TYPE DEFS * 52 */ 53 /* { */ 54 enum 55 { 56 DFFS_VER_01 = 0, 57 DFFS_NOF_VERSIONS 58 } dffs_versions_enum; 59 60 /* DFFS File Descriptor structure */ 61 typedef struct 62 { 63 char name[DFFS_FILENAME_SIZE]; 64 char date[DFFS_DATE_STR_SIZE]; 65 unsigned char version; 66 char comment[DFFS_COMMENT_STR_SIZE]; 67 unsigned long attr1; 68 unsigned long attr2; 69 unsigned long attr3; 70 unsigned long member_sectors; 71 unsigned long total_size; 72 } __ATTRIBUTE_PACKED__ DFFS_FD_TYPE; 73 74 /* DFFS descriptor header structure */ 75 typedef struct 76 { 77 unsigned long dffs_signature; 78 unsigned char version; 79 } __ATTRIBUTE_PACKED__ DFFS_HDR_TYPE; 80 81 /* DFFS descriptor structure */ 82 typedef struct 83 { 84 DFFS_HDR_TYPE header; 85 unsigned long busy_sectors; /* occupied sectors bitmap */ 86 unsigned long sectors_available; 87 DFFS_FD_TYPE fd[DFFS_MAX_FILES]; 88 unsigned short crc16; 89 } __ATTRIBUTE_PACKED__ DFFS_DESCRIPTOR_TYPE; 90 91 /* } */ 92 93 /************* 94 * GLOBALS * 95 */ 96 /* { */ 97 98 /* } */ 99 100 /************* 101 * FUNCTIONS * 102 */ 103 /* { */ 104 105 /* } */ 106 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 113 /* } __DFFS_DESCRIPTOR_H_INCLUDED__*/ 114 #endif