1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef PLATFORM_DUMPER_H 10 #define PLATFORM_DUMPER_H 11 12 #include "hdf_dlist.h" 13 #include "osal_sem.h" 14 #include "osal_spinlock.h" 15 #include "osal_thread.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif /* __cplusplus */ 20 21 enum PlatformDumperDataType { 22 PLATFORM_DUMPER_UINT8 = 0, 23 PLATFORM_DUMPER_UINT16, 24 PLATFORM_DUMPER_UINT32, 25 PLATFORM_DUMPER_UINT64, 26 PLATFORM_DUMPER_INT8, 27 PLATFORM_DUMPER_INT16, 28 PLATFORM_DUMPER_INT32, 29 PLATFORM_DUMPER_INT64, 30 PLATFORM_DUMPER_FLOAT, 31 PLATFORM_DUMPER_DOUBLE, 32 PLATFORM_DUMPER_CHAR, 33 PLATFORM_DUMPER_STRING, 34 PLATFORM_DUMPER_REGISTERL, 35 PLATFORM_DUMPER_REGISTERW, 36 PLATFORM_DUMPER_REGISTERB, 37 PLATFORM_DUMPER_GENERAL, 38 PLATFORM_DUMPER_MAX, 39 }; 40 41 struct PlatformDumperMethod { 42 void (*dumperCfgInfo)(void); 43 void (*dumperStatusInfo)(void); 44 void (*dumperRegisterInfo)(void); 45 void (*dumperStatisInfo)(void); 46 }; 47 48 struct PlatformDumperData { 49 const char *name; // name len < 32 50 enum PlatformDumperDataType type; 51 void *paddr; 52 }; 53 54 struct PlatformDumper; 55 56 struct PlatformDumper *PlatformDumperCreate(const char *name); 57 void PlatformDumperDestroy(struct PlatformDumper *dumper); 58 int32_t PlatformDumperDump(struct PlatformDumper *dumper); 59 int32_t PlatformDumperAddData(struct PlatformDumper *dumper, const struct PlatformDumperData *data); 60 int32_t PlatformDumperAddDatas(struct PlatformDumper *dumper, struct PlatformDumperData datas[], int size); 61 int32_t PlatformDumperSetMethod(struct PlatformDumper *dumper, struct PlatformDumperMethod *ops); 62 int32_t PlatformDumperDelData(struct PlatformDumper *dumper, const char *name, enum PlatformDumperDataType type); 63 int32_t PlatformDumperClearDatas(struct PlatformDumper *dumper); 64 65 #ifdef __cplusplus 66 } 67 #endif /* __cplusplus */ 68 69 #endif /* PLATFORM_DUMPER_H */ 70