⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysgen1.pl

📁 一些brew 代码
💻 PL
📖 第 1 页 / 共 5 页
字号:
#!/usr/bin/perl
#
#  Copyright Statement:
#  --------------------
#  This software is protected by Copyright and the information contained
#  herein is confidential. The software may not be copied and the information
#  contained herein may not be used or disclosed except with the written
#  permission of MediaTek Inc. (C) 2006
#
#  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
#  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
#  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
#  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
#  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
#  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
#  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
#  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
#  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
#  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
#  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
#
#  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
#  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
#  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
#  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
#  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
#
#  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
#  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
#  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
#  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
#  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
#
#*****************************************************************************
#*
#* Filename:
#* ---------
#*   sysGen1.pl
#*
#* Project:
#* --------
#*
#*
#* Description:
#* ------------
#*   This script embedded several .c .h source code templates and will 
#*       1. generate custom_util.c if not exists
#*       2. generate custom_util.h if not exists
#*       3. generate custom_sap.h if not exists
#*       4. generate custom1_create.c if not exists
#*       5. generate custom_config.h if not exists
#*       6. generate custom_config.c if not exists
#*       7. generate fs_config.c if not exists
#*       8. generate custom_jump_tbl.h if not exists
#*       9. generate custom_jump_tbl.c if not exists
#*      10. generate custom_fota.h if not exists
#*      11. generate custom_fota.c if not exists
#*      12. generate custom_nor_large_disk.c if not exists
#*
#* Author:
#* -------
#*   JI Huang  (mtk01077)
#*
#*============================================================================
#*             HISTORY
#* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
#*------------------------------------------------------------------------------
#* $Revision$
#* $Modtime$
#* $Log$
#*
#*
#*------------------------------------------------------------------------------
#* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
#*============================================================================
#****************************************************************************/

#****************************************************************************
# Included Modules
#****************************************************************************
use strict;

#****************************************************************************
# Constants
#****************************************************************************
my $SYSGEN_VERNO     = " V0.22";
                       # v0.22 , 2007/08/20 , fs_config.c revise for MT6223P platform setting
                       # v0.21 , 2007/08/20 , custom_config.c system RAM default value alignment on GSM projects
                       # v0.20 , 2007/08/10 , custom_config.c system RAM and MMI stack adjustment if OBIGO_Q05A
                       # v0.19 , 2007/05/14 , custom_config.c control buffer slots adjustment
                       # v0.18 , 2007/05/14 , custom_config.c fs_config.c resource enlarge for DM , DRMT tasks
                       # v0.17 , 2007/04/23 , dependency_check enable
                       # v0.16 , 2007/04/23 , custom_config.c OBIGO_Q05A compile option 
                       # v0.15 , 2007/04/17 , GLOBAL_DEBUG_MEM_SIZE 150K -> 160K on globalmem_gsm
                       # v0.14 , 2007/03/12 , custom_config.c new function custom_config_task_stack_location()
                       # v0.13 , 2007/02/26 , fs_config.c revise for MSDC device configure update
                       # v0.12 , 2007/01/21 , make event schedule pool size customizable
                       # v0.11 , 2007/01/02 , custom_nor_large_disk.c template imported
                       #                    , add error checking on file close
                       # v0.10 ,            , minor revise on custom_fota.h template
                       # v0.09 , 2006/12/25 , fs_config.c support SIM_PLUS, custom_fota.c custom_fota.h template
                       # v0.08 , 2006/12/18 , new mechanism for custom task present on usb / factory boot mode

#****************************************************************************
# File Names
#****************************************************************************
my $CUSTOM_UTIL_C    = $ARGV[0] . '\\' . "custom_util.c";
my $CUSTOM_UTIL_H    = $ARGV[0] . '\\' . "custom_util.h";
my $CUSTOM_SAP_H     = $ARGV[0] . '\\' . "custom_sap.h";
my $CUSTOM1_CREATE_C = $ARGV[0] . '\\' . "custom1_create.c";
my $CUSTOM_CONFIG_H  = $ARGV[0] . '\\' . "custom_config.h";
my $CUSTOM_CONFIG_C  = $ARGV[0] . '\\' . "custom_config.c";
my $FS_CONFIG_C      = $ARGV[0] . '\\' . "fs_config.c";
my $CUSTOM_JUMPTBL_H = $ARGV[0] . '\\' . "custom_jump_tbl.h";
my $CUSTOM_JUMPTBL_C = $ARGV[0] . '\\' . "custom_jump_tbl.c";
my $CUSTOM_FOTA_H    = $ARGV[0] . '\\' . "custom_fota.h";
my $CUSTOM_FOTA_C    = $ARGV[0] . '\\' . "custom_fota.c";
my $CUSTOM_NORFDM5_C = $ARGV[0] . '\\' . "custom_nor_large_disk.c";

#****************************************************************************
# Script filename
#****************************************************************************
my $sysgen_pl        = $0;

#****************************************************************************
# Project Make File
#****************************************************************************
my %MAKEFILE_OPTIONS;
my $keyname;

my $themf = $ARGV[1];
die "$themf did NOT exist!\n" if (!-e $themf);

open (FILE_HANDLE, "<$themf") or die "cannot open $themf\n";
while (<FILE_HANDLE>) {
  if (/^(\S+)\s*=\s*(\S+)/) {
    $keyname = lc($1);
    defined($${keyname}) && warn "$1 redefined in $themf!\n";
    $MAKEFILE_OPTIONS{$keyname} = uc($2);
  }
}
close (FILE_HANDLE);

#****************************************************************************
# 1 >>>  Generate custom_util.c
#****************************************************************************
&dependency_check($CUSTOM_UTIL_C, $sysgen_pl);

if (-e $CUSTOM_UTIL_C)
{
    print "$CUSTOM_UTIL_C already exists\n";
}
else
{
    open (CUSTOM_UTIL_C, ">$CUSTOM_UTIL_C") or die "cannot open $CUSTOM_UTIL_C\n";

    print CUSTOM_UTIL_C &copyright_file_header();
    print CUSTOM_UTIL_C &description_file_header(       "custom_util.c",
                          "This file provides the custom utililty APIs",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_UTIL_C &custom_util_c_file_body();
    close CUSTOM_UTIL_C or die "fail to generate $CUSTOM_UTIL_C";

    print "$CUSTOM_UTIL_C is generated\n";
}

#****************************************************************************
# 2 >>>  Generate custom_util.h
#****************************************************************************
&dependency_check($CUSTOM_UTIL_H, $sysgen_pl);

if (-e $CUSTOM_UTIL_H)
{
    print "$CUSTOM_UTIL_H already exists\n";
}
else
{
    open (CUSTOM_UTIL_H, ">$CUSTOM_UTIL_H") or die "cannot open $CUSTOM_UTIL_H\n";

    print CUSTOM_UTIL_H &copyright_file_header();
    print CUSTOM_UTIL_H &description_file_header(       "custom_util.h",
                  "This file provides the custom utililty declarations",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_UTIL_H &custom_util_h_file_body();
    close CUSTOM_UTIL_H or die "fail to generate $CUSTOM_UTIL_H";

    print "$CUSTOM_UTIL_H is generated\n";
}

#****************************************************************************
# 3 >>>  Generate custom_sap.h
#****************************************************************************
&dependency_check($CUSTOM_SAP_H, $sysgen_pl);

if (-e $CUSTOM_SAP_H)
{
    print "$CUSTOM_SAP_H already exists\n";
}
else
{
    open (CUSTOM_SAP_H, ">$CUSTOM_SAP_H") or die "cannot open $CUSTOM_SAP_H\n";

    print CUSTOM_SAP_H &copyright_file_header();
    print CUSTOM_SAP_H &description_file_header(         "custom_sap.h",
                       "This file provide for customization message id",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_SAP_H &custom_sap_h_file_body();
    close CUSTOM_SAP_H or die "fail to generate $CUSTOM_SAP_H";

    print "$CUSTOM_SAP_H is generated\n";
}

#****************************************************************************
# 4 >>>  Generate custom1_create.c
#****************************************************************************
&dependency_check($CUSTOM1_CREATE_C, $sysgen_pl);

if (-e $CUSTOM1_CREATE_C)
{
    print "$CUSTOM1_CREATE_C already exists\n";
}
else
{
    open (CUSTOM1_CREATE_C, ">$CUSTOM1_CREATE_C") or die "cannot open $CUSTOM1_CREATE_C\n";

    print CUSTOM1_CREATE_C &copyright_file_header();
    print CUSTOM1_CREATE_C &description_file_header( "custom1_create.c",
          "This file implements custom1 component task create function",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM1_CREATE_C &custom1_create_c_file_body();
    close CUSTOM1_CREATE_C or die "fail to generate $CUSTOM1_CREATE_C";

    print "$CUSTOM1_CREATE_C is generated\n";
}

#****************************************************************************
# 5 >>>  Generate custom_config.h
#****************************************************************************
&dependency_check($CUSTOM_CONFIG_H, $sysgen_pl, $themf);

if (-e $CUSTOM_CONFIG_H)
{
    print "$CUSTOM_CONFIG_H already exists\n";
}
else
{
    open (CUSTOM_CONFIG_H, ">$CUSTOM_CONFIG_H") or die "cannot open $CUSTOM_CONFIG_H\n";

    print CUSTOM_CONFIG_H &copyright_file_header();
    print CUSTOM_CONFIG_H &description_file_header( "custom_config.h",
          "This file provides the custom task index and module index configuration",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_CONFIG_H &custom_config_h_file_body();
    close CUSTOM_CONFIG_H or die "fail to generate $CUSTOM_CONFIG_H";

    print "$CUSTOM_CONFIG_H is generated\n";
}

#****************************************************************************
# 6 >>>  Generate custom_config.c
#****************************************************************************
&dependency_check($CUSTOM_CONFIG_C, $sysgen_pl, $themf);

if (-e $CUSTOM_CONFIG_C)
{
    print "$CUSTOM_CONFIG_C already exists\n";
}
else
{
    open (CUSTOM_CONFIG_C, ">$CUSTOM_CONFIG_C") or die "cannot open $CUSTOM_CONFIG_C\n";

    print CUSTOM_CONFIG_C &copyright_file_header();
    print CUSTOM_CONFIG_C &description_file_header(   "custom_config.c",
              "This file contain definition of custom component module".
                                "configuration variables, and routines",
                                 "system auto generator". $SYSGEN_VERNO);
    # template generator here, 
    # See Also  dispatch_globalmem_and_ctrlbuffpool();  for algorithm
    #
    print CUSTOM_CONFIG_C &custom_config_c_file_body();
    close CUSTOM_CONFIG_C or die "fail to generate $CUSTOM_CONFIG_C";

    print "$CUSTOM_CONFIG_C is generated\n";
}

#****************************************************************************
# 7 >>>  Generate fs_config.c
#****************************************************************************
&dependency_check($FS_CONFIG_C, $sysgen_pl, $themf);

if (-e $FS_CONFIG_C)
{
    print "$FS_CONFIG_C already exists\n";
}
else
{
    open (FS_CONFIG_C, ">$FS_CONFIG_C") or die "cannot open $FS_CONFIG_C\n";

    print FS_CONFIG_C &copyright_file_header();
    print FS_CONFIG_C &description_file_header(           "fs_config.c",
                "This file defines all resource setting in file system",
                                 "system auto generator". $SYSGEN_VERNO);
    # template generator here, 
    # See Also  dispatch_drivenum(), dispatch_buffnum(),
    #           dispatch_fhnum(), dispatch_threadnum()   for algorithms
    #
    print FS_CONFIG_C &fs_config_c_file_body();
    close FS_CONFIG_C or die "fail to generate $FS_CONFIG_C";

    print "$FS_CONFIG_C is generated\n";
}

#****************************************************************************
# 8 >>>  Generate custom_jump_tbl.h
#****************************************************************************
&dependency_check($CUSTOM_JUMPTBL_H, $sysgen_pl);

if (-e $CUSTOM_JUMPTBL_H)
{
    print "$CUSTOM_JUMPTBL_H already exists\n";
}
else
{
    open (CUSTOM_JUMPTBL_H, ">$CUSTOM_JUMPTBL_H") or die "cannot open $CUSTOM_JUMPTBL_H\n";

    print CUSTOM_JUMPTBL_H &copyright_file_header();
    print CUSTOM_JUMPTBL_H &description_file_header( "custom_jump_tbl.h",
          "header file for indirect jump table for multiple binary load",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_JUMPTBL_H &custom_jump_tbl_h_file_body();
    close CUSTOM_JUMPTBL_H or die "fail to generate $CUSTOM_JUMPTBL_H";

    print "$CUSTOM_JUMPTBL_H is generated\n";
}

#****************************************************************************
# 9 >>>  Generate custom_jump_tbl.c
#****************************************************************************
&dependency_check($CUSTOM_JUMPTBL_C, $sysgen_pl);

if (-e $CUSTOM_JUMPTBL_C)
{
    print "$CUSTOM_JUMPTBL_C already exists\n";
}
else
{
    open (CUSTOM_JUMPTBL_C, ">$CUSTOM_JUMPTBL_C") or die "cannot open $CUSTOM_JUMPTBL_C\n";

    print CUSTOM_JUMPTBL_C &copyright_file_header();
    print CUSTOM_JUMPTBL_C &description_file_header(   "custom_jump_tbl.c",
            "source file for indirect jump table for multiple binary load",
                                 "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_JUMPTBL_C &custom_jump_tbl_c_file_body();
    close CUSTOM_JUMPTBL_C or die "fail to generate $CUSTOM_JUMPTBL_C";

    print "$CUSTOM_JUMPTBL_C is generated\n";
}

#****************************************************************************
#10 >>>  Generate custom_fota.h
#****************************************************************************
&dependency_check($CUSTOM_FOTA_H, $sysgen_pl);

if (-e $CUSTOM_FOTA_H)
{
    print "$CUSTOM_FOTA_H already exists\n";
}
else
{
    open (CUSTOM_FOTA_H, ">$CUSTOM_FOTA_H") or die "cannot open $CUSTOM_FOTA_H\n";

    print CUSTOM_FOTA_H &copyright_file_header();
    print CUSTOM_FOTA_H &description_file_header(                 "custom_fota.h",
          "This Module defines the FOTA (Firmware Over the Air) related setting.",
             "Yoda Chen (mtk01178)     " . "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_FOTA_H &custom_fota_h_file_body();
    close CUSTOM_FOTA_H or die "fail to generate $CUSTOM_FOTA_H";

    print "$CUSTOM_FOTA_H is generated\n";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -