source: svn/newcon3bcm2_21bu/nexus/build/tools/ipcthunk/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.3 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: 6 $
40# $brcm_Date: 12/7/11 10:41a $
41#
42# File Description:
43#
44# Revision History:
45#
46# $brcm_Log: /nexus/build/tools/ipcthunk/bapi_build.pl $
47#
48# 6   12/7/11 10:41a erickson
49# SW7420-2141: merge as much duplicated kernelmode proxy/usermode ipc
50#  perl code as possible
51#
52# 5   8/8/11 5:10p erickson
53# SW7420-1689: add untrusted client api enforcement
54#
55# 4   3/1/11 9:34a erickson
56# SW7420-1123: use bapi_common::skip_thunk
57#
58# 3   1/19/11 2:03p erickson
59# SW7420-1123: socket-based usermode IPC
60#
61# 2   11/3/10 5:32p erickson
62# SW7420-1223: exclude nexus_base_mmap.h from thunks
63#
64# 1   9/29/10 9:34a erickson
65# SW7420-1123: add linux usermode IPC
66#
67#############################################################################
68use strict;
69
70use lib "../common";
71use bapi_parse_c;
72use bapi_ipc_apidef;
73use bapi_ipc_client;
74use bapi_ipc_server;
75use bapi_untrusted_api;
76use Getopt::Long;
77
78my $file;
79my @funcs;
80my %structs;
81my $source_file;
82my $file_headers;
83my @file_list;
84
85if ($#ARGV == -1) {
86    print "Usage: perl bapi_build.pl [--source listfile] module destdir class_handles file1.h file2.h ...\n";
87    exit;
88}
89
90#check presence of a sources file and process if present
91GetOptions ('source=s' => \$source_file);
92if($source_file) {
93    open(HEADERS, $source_file) || die("Could not open source file: $source_file");
94    $file_headers=<HEADERS>;
95    close(HEADERS);
96
97    chomp($file_headers);
98    @file_list = split(/\s+/,$file_headers);
99    my $count;
100    $count = @file_list;
101    print "Sources file $source_file contains $count headers\n";
102}
103
104# Process all files on the command line
105my $module = lc shift @ARGV;
106my $destdir = shift @ARGV;
107
108# read class_handles.inc file into a list
109my $class_list_file = shift @ARGV;
110open FILE, $class_list_file;
111my @class_handles = <FILE>;
112close FILE;
113chomp @class_handles;
114
115for $file (@file_list,@ARGV) {
116    next if (bapi_classes::skip_thunk($file));
117    #print "ipcthunk/bapi_build.pl parsing $file\n";
118
119    push @funcs, bapi_parse_c::get_func_prototypes $file;
120
121    my $file_structs = bapi_parse_c::parse_struct $file;
122    my $name;
123    my $members;
124    while (($name, $members) = each %$file_structs) {
125        $structs{$name} = $members;
126    }
127}
128
129# Build the perl datastructure
130my @funcrefs = bapi_parse_c::parse_funcs @funcs;
131
132# Print out the perl datastructure
133#bapi_parse_c::print_api @funcrefs;
134#bapi_parse_c::print_struct \%structs;
135
136my $version = bapi_parse_c::version_api @funcrefs;
137$version = ($version * 0x10000) + bapi_parse_c::version_struct \%structs;
138
139my $untrusted_api = bapi_untrusted_api::parse "../common/nexus_untrusted_api.txt";
140
141# Build thunk layer
142bapi_ipc_apidef::generate "${destdir}/" . (bapi_common::ipc_header $module) , $module, $version, @funcrefs;
143bapi_ipc_client::generate "${destdir}/nexus_${module}_ipc_client.c", $module, $version, \%structs, @funcrefs;
144bapi_ipc_server::generate "${destdir}/nexus_${module}_ipc_server.c", $module, $version, \%structs, \@funcrefs, \@class_handles, $untrusted_api;
Note: See TracBrowser for help on using the repository browser.