source: svn/newcon3bcm2_21bu/nexus/build/tools/syncthunk/bapi_build.pl

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 5.9 KB
Line 
1#!/usr/bin/perl
2#     (c)2003-2011 Broadcom Corporation
3#
4#  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5#  and may only be used, duplicated, modified or distributed pursuant to the terms and
6#  conditions of a separate, written license agreement executed between you and Broadcom
7#  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8#  no license (express or implied), right to use, or waiver of any kind with respect to the
9#  Software, and Broadcom expressly reserves all rights in and to the Software and all
10#  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11#  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12#  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13#
14#  Except as expressly set forth in the Authorized License,
15#
16#  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17#  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18#  and to use this information only in connection with your use of Broadcom integrated circuit products.
19#
20#  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21#  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22#  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23#  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24#  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25#  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26#  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27#  USE OR PERFORMANCE OF THE SOFTWARE.
28#
29#  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30#  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31#  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32#  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33#  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34#  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35#  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36#  ANY LIMITED REMEDY.
37#
38# $brcm_Workfile: bapi_build.pl $
39# $brcm_Revision: 8 $
40# $brcm_Date: 12/7/11 10:41a $
41#
42# File Description:
43#
44# Revision History:
45#
46# $brcm_Log: /nexus/build/tools/syncthunk/bapi_build.pl $
47#
48# 8   12/7/11 10:41a erickson
49# SW7420-2141: merge as much duplicated kernelmode proxy/usermode ipc
50#  perl code as possible
51#
52# 7   3/17/11 4:57p erickson
53# SW7420-1661: test for duplicate functions to avoid obscure nexus link
54#  failures
55#
56# 6   3/1/11 9:34a erickson
57# SW7420-1123: use bapi_common::skip_thunk
58#
59# 5   1/19/11 2:02p erickson
60# SW7420-1123: socket-based usermode IPC
61#
62# 4   11/3/10 5:32p erickson
63# SW7420-1223: exclude nexus_base_mmap.h from thunks
64#
65# 3   7/14/10 11:56a erickson
66# SW7405-4621: exclude nexus_base_os.h from thunk
67#
68# 2   3/23/10 3:40p erickson
69# SWDEPRECATED-2423: add --source option for build systems with cmdline
70#  limitations
71#
72# 1   1/18/08 2:15p jgarrett
73# PR 38808: Merging to main branch
74#
75# Nexus_Devel/4   10/12/07 11:47a erickson
76# PR36066: remove "lc" when getting destdir
77#
78# Nexus_Devel/3   10/2/07 11:54a jgarrett
79# PR 34416: Removing print
80#
81# Nexus_Devel/2   9/28/07 10:02a erickson
82# PR35395: remove autogen from thunk file name
83#
84# Nexus_Devel/1   9/27/07 1:33p erickson
85# PR35395: initial impl
86#
87#############################################################################
88use strict;
89
90use lib "../common";
91use bapi_parse_c;
92use bapi_thunks;
93use bapi_classes;
94use Getopt::Long;
95
96my $file;
97my @funcs;
98my $source_file;
99my $file_headers;
100my @file_list;
101
102if ($#ARGV == -1) {
103    print "Usage: perl bapi_build.pl [--source listfile] module destdir file1.h file2.h ...\n";
104    exit;
105}
106
107#check presence of a sources file and process if present
108GetOptions ('source=s' => \$source_file);
109if($source_file) {
110    open(HEADERS, $source_file) || die("Could not open source file: $source_file");
111    $file_headers=<HEADERS>;
112    close(HEADERS);
113
114    chomp($file_headers);
115    @file_list = split(/\s+/,$file_headers);
116    my $count;
117    $count = @file_list;
118    print "Sources file $source_file contains $count headers\n";
119}
120
121# Process all files on the command line
122my $module = lc shift @ARGV;
123my $destdir = shift @ARGV;
124
125for $file (@file_list,@ARGV) {
126    next if (bapi_classes::skip_thunk($file));
127    #print "syncthunk/bapi_build.pl parsing $file\n";
128
129    push @funcs, bapi_parse_c::get_func_prototypes $file;
130}
131
132# Build the perl datastructure
133my @funcrefs = bapi_parse_c::parse_funcs @funcs;
134
135# test for duplicate functions. these will fail later in the link, but we can catch the failure now.
136# this can be from copying a header file (for example, cp nexus_types.h nexus_types.backup.h). the *.h will suck that in.
137# it can also happen if you using #if. the perl thunk does not recognize that.
138my $f1;
139for $f1 (@funcrefs) {
140    my $f2;
141    my $count = 0;
142    for $f2 (@funcrefs) {
143        if ($f2->{FUNCNAME} eq $f1->{FUNCNAME}) {
144            if (++$count == 2) {
145                print "ERROR: Duplicate function $f1->{FUNCNAME} found within $module module.\n";
146                print "ERROR:   You may have unnecessary copies of header files in your public API directory.\n";
147                print "ERROR:   You may be using #if around duplicate prototypes. Nexus does not run a preprocessor in its thunk.\n";
148                exit 1;
149            }
150        }
151    }
152}
153
154# Print out the perl datastructure
155#bapi_parse_c::print_api @funcrefs;
156
157#print "Building synchronization thunk for module ${module}\n";
158
159# Build thunk layer
160bapi_thunks::build_thunks ${module}, "${destdir}/nexus_${module}_thunks.c", \@funcrefs;
161bapi_thunks::build_remapping "${destdir}/nexus_${module}_thunks.h", \@funcrefs;
162
Note: See TracBrowser for help on using the repository browser.