source: svn/newcon3bcm2_21bu/BSEAV/lib/bprofile/bsymtable.h @ 46

Last change on this file since 46 was 46, checked in by megakiss, 11 years ago

459Mhz로 OTC 주파수 변경

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006, 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: bsymtable.h $
11 * $brcm_Revision: 2 $
12 * $brcm_Date: 11/20/06 4:54p $
13 *
14 * Module Description:
15 *
16 * Embeddeble symbol table
17 *             
18 *
19 * Revision History:
20 *
21 * $brcm_Log: /BSEAV/lib/bprofile/bsymtable.h $
22 *
23 * 2   11/20/06 4:54p vsilyaev
24 * PR 25997: Decoupled profiling and symbol table
25 *
26 * 1   11/16/06 5:25p vsilyaev
27 * PR 25997: Embeddable profiler
28 *
29 *******************************************************************************/
30#ifndef _BSYMTABLE_H__
31#define _BSYMTABLE_H__
32
33#ifdef __cplusplus
34extern "C"
35{
36#endif
37
38typedef struct bsymbol_entry {
39        uint32_t addr;
40        const char *name;
41} bsymbol_entry;
42
43typedef struct bsymbol_table {
44        const bsymbol_entry *table;
45        size_t nentries;
46        unsigned offset;
47} bsymbol_table;
48
49/* this function returns pointer to the bsymbol_table with corrected addresses */
50const bsymbol_table *bsymbol_fixup(void);
51/* this function lookups table map and return nearest symbol and offset to this symbol */
52const char *bsymbol_lookup(const bsymbol_table *map, uint32_t addr, unsigned *offset);
53
54#ifdef __cplusplus
55}
56#endif
57
58
59/*
60 * this macro builds a function that does a binary seatch in a sorted array ([0] smallest value)
61 * it returns either index of located entry or if result is negative
62 * -(off+1), where off is offset to largest address in array that is smaller
63 *  then address
64 */
65#define B_BIN_SEARCH(name, type, key)  \
66int name(const type *a, size_t nentries, uint32_t v) { \
67        int right = nentries-1; int left = 0; int mid; \
68        while(left <= right) { \
69                mid = (left+right) / 2; \
70                if (v > a[mid].key) { left = mid+1; } \
71                else if (v < a[mid].key) { right = mid-1; } \
72                else { return mid; } \
73        } return -(left+1);  \
74}
75
76
77
78#endif /* _BSYMTABLE_H__ */
79
Note: See TracBrowser for help on using the repository browser.