source: svn/newcon3bcm2_21bu/nexus/build/tools/kernelproxy/class_list.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: 7.0 KB
Line 
1#############################################################################
2#    (c)2008-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: class_list.pl $
39# $brcm_Revision: 13 $
40# $brcm_Date: 12/7/11 10:41a $
41#
42# Module Description:
43#
44# Revision History:
45#
46# $brcm_Log: /nexus/build/tools/kernelproxy/class_list.pl $
47#
48# 13   12/7/11 10:41a erickson
49# SW7420-2141: merge as much duplicated kernelmode proxy/usermode ipc
50#  perl code as possible
51#
52# 12   11/15/11 11:07a erickson
53# SW7231-391: fix stub macro
54#
55# 11   11/1/11 2:51p erickson
56# SW7231-391: fix naming, warnings
57#
58# 10   11/1/11 11:21a erickson
59# SW7231-391: add macro to test if nexus class exists
60#
61# 9   9/2/11 12:39p erickson
62# SW7420-1148: refactor class_list.pl to generate per-module "get current
63#  client" functions
64#
65# 8   9/2/11 10:03a erickson
66# SW7420-1148: allow nexus_register/unregister to objdb from nexus
67#  module. enables more complex resource management.
68#
69# 7   7/25/11 2:46p erickson
70# SW7420-1992: allow class with secondary_destructor and release, no
71#  destructor
72#
73# 6   7/12/11 1:26p erickson
74# SW7420-1979: add support for new shutdown attribute
75#
76# 5   5/17/11 12:26p erickson
77# SW7420-1679: NEXUS_Memory_Free must check pointer with objdb before
78#  freeing
79#
80# 4   3/1/11 9:34a erickson
81# SW7420-1123: use bapi_common::skip_thunk
82#
83# 3   1/19/11 3:42p erickson
84# SW7420-1123: refactor kernelproxy to correspond to usermode changes
85#
86# 2   1/19/11 2:03p erickson
87# SW7420-1123: socket-based usermode IPC
88#
89# 1   12/7/10 5:47p erickson
90# SW7420-1148: refactor kernel mode proxy for process isolation
91#
92#############################################################################
93use strict;
94use lib "../common";
95use bapi_parse_c;
96use bapi_common;
97use bapi_classes;
98
99my $class_file = shift @ARGV;
100my $class_verification_file = shift @ARGV;
101my $file;
102my @funcs;
103my %structs;
104my @modules;
105
106# @ARGV is a list of all nexus public api header files and module names
107# -headers FILE FILE FILE -modules MODULE MODULE MODULE
108my $parsing_headers;
109foreach $file (@ARGV) {
110    if ($file eq "-headers") {
111        $parsing_headers = 1;
112        next;
113    }
114    elsif ($file eq "-modules") {
115        undef $parsing_headers;
116        next;
117    }
118   
119    if ($parsing_headers) {
120        next if (bapi_classes::skip_thunk($file));
121        #print "kernelproxy/class_list.pl parsing $file\n";
122   
123        push @funcs, bapi_parse_c::get_func_prototypes $file;
124   
125        my $file_structs = bapi_parse_c::parse_struct $file;
126        my $name;
127        my $members;
128        while (($name, $members) = each %$file_structs) {
129            $structs{$name} = $members;
130        }
131    }
132    else {
133        push @modules, $file;
134    }
135}
136
137# Build the perl datastructure
138my @funcrefs = bapi_parse_c::parse_funcs @funcs;
139my $funcs = \@funcrefs;
140
141# create a file which contains the handles for every "class" (an interface with a constructor/destructor)
142my $destructors = bapi_classes::get_destructors $funcs;
143my $classes = bapi_classes::get_classes $funcs, $destructors;
144
145# create nexus/platforms/$(NEXUS_PLATFORM)/bin/syncthunk/class_list.inc
146open(OUTFILE, ">$class_file") or die "Unable to open output file $class_file";
147for (@$classes) {
148    my $class = $_;
149    #print "class $class->{CLASS_TYPE}\n";
150    print OUTFILE "$class->{CLASS_TYPE}\n";
151}
152close OUTFILE;
153
154# create nexus/platforms/$(NEXUS_PLATFORM)/bin/syncthunk/nexus_class_verification.h
155open(OUTFILE, ">$class_verification_file") or die "Unable to open output file $class_verification_file";
156for (@$classes) {
157    my $class = $_;
158    my $handletype = $class->{CLASS_TYPE};
159    print OUTFILE "#if NEXUS_SERVER_SUPPORT\n";
160    print OUTFILE "#define ${handletype}_CLASS 1\n";
161    print OUTFILE "extern int nexus_driver_verify_$handletype(void *client_id, void *object);\n";
162    print OUTFILE "extern int  nexus_register_${handletype}(void *client, void *object, bool acquire);\n";
163    print OUTFILE "extern void nexus_unregister_${handletype}(void *client, void *object, bool release);\n";
164    print OUTFILE "#else\n";
165    print OUTFILE "#define nexus_driver_verify_$handletype(client_id, object) (0)\n";
166    print OUTFILE "#define nexus_register_${handletype}(client, object, acquire) (0)\n";
167    print OUTFILE "#define nexus_unregister_${handletype}(client, object, release)\n";
168    print OUTFILE "#endif\n";
169   
170    if (exists $class->{SHUTDOWN}) {
171        for (@{$class->{SHUTDOWN}}) {
172            my $shutdown_target = $_->{'shutdown_target'};
173            print OUTFILE "extern void nexus_driver_shutdown_$shutdown_target(void *);\n";
174        }
175    }
176}
177
178for (@modules) {
179    my $module = lc $_;
180    print OUTFILE "#if NEXUS_SERVER_SUPPORT\n";
181    print OUTFILE "extern void *nexus_${module}_client(void);\n";
182    print OUTFILE "#else\n";
183    print OUTFILE "#define nexus_${module}_client() (NULL)\n";
184    print OUTFILE "#endif\n";
185}
186
187close OUTFILE;
Note: See TracBrowser for help on using the repository browser.