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

📄 sysgen1.pl

📁 一些brew 代码
💻 PL
📖 第 1 页 / 共 5 页
字号:
}

#****************************************************************************
#11 >>>  Generate custom_fota.c
#****************************************************************************
&dependency_check($CUSTOM_FOTA_C, $sysgen_pl);

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

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

    print "$CUSTOM_FOTA_C is generated\n";
}

#****************************************************************************
#12 >>>  Generate custom_nor_large_disk.c
#****************************************************************************
&dependency_check($CUSTOM_NORFDM5_C, $sysgen_pl);

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

    print CUSTOM_NORFDM5_C &copyright_file_header();
    print CUSTOM_NORFDM5_C &description_file_header(      "custom_nor_large_disk.c",
	  "defines prototypes and data structure which will be used in NOR FDM 5.0",
              "Yoda Chen (mtk01178)     " . "system auto generator". $SYSGEN_VERNO);
    print CUSTOM_NORFDM5_C &custom_nor_large_disk_c_file_body();
    close CUSTOM_NORFDM5_C or die "fail to generate $CUSTOM_NORFDM5_C";

    print "$CUSTOM_NORFDM5_C is generated\n";
}

#****************************************************************************
# oo >>>  Finished
#****************************************************************************
exit;

#****************************************************************************
# subroutine:  dependency check
# return:      None
#****************************************************************************
sub dependency_check
{
    my ($target, @depends) = (@_);
    
    return unless (-e $target);

    my @stat_target = stat $target;

    foreach my $dep (@depends)
    {
        next unless (-e $dep);
        my @stat_dep = stat $dep;

        next if ($stat_dep[9] < $stat_target[9]);

        ## Now check if the $target file check-in or auto-gen
        open SRC_FILE_R , "<$target" or die "cannot open $target\n";
        my $saved_sep = $/;
        undef $/;
        my $reading = <SRC_FILE_R>; 
        close SRC_FILE_R;
        $/ = $saved_sep;

        if ($reading !~ /\[MAUI_\d{8}\]/)
        {
            print "$target is older than $dep, force delete and update\n";
            unlink $target;
        }

        ## return in either way
        return;
    }
}

#****************************************************************************
# subroutine:  determine the amount for file system configure in fs_config.c
# return:      the value for recommend drive number <NOTE!!!: scalar context>
#****************************************************************************
sub dispatch_drivenum
{
    my $value = 4; #  4 = 1(*SYS*) + 1 (NOR) +  1 (NAND) + 1 (CARD)
    # check (NOR) not present
    if (exists $MAKEFILE_OPTIONS{'nand_flash_booting'} and $MAKEFILE_OPTIONS{'nand_flash_booting'} eq 'TRUE')
    {  $value -= 1;
    }
    elsif (exists $MAKEFILE_OPTIONS{'system_drive_on_nand'} and $MAKEFILE_OPTIONS{'system_drive_on_nand'} eq 'TRUE')
    {  $value -= 1;
    }
    # check (NAND) not present
    unless (exists $MAKEFILE_OPTIONS{'nand_support'} and $MAKEFILE_OPTIONS{'nand_support'} eq 'TRUE')
    {  $value -= 1;
    }
    #check (CARD) not present
    unless (exists $MAKEFILE_OPTIONS{'msdc_card_support_type'} and $MAKEFILE_OPTIONS{'msdc_card_support_type'} ne 'NONE')
    {  $value -= 1;
    }
    #finial
    return $value;
}

#****************************************************************************
# subroutine:  determine the amount for file system configure in fs_config.c
# return:      the value for recommend buffer number <NOTE!!!: scalar context>
#****************************************************************************
sub dispatch_buffnum
{
    if    (exists $MAKEFILE_OPTIONS{'l1_gprs'} and $MAKEFILE_OPTIONS{'l1_gprs'} eq 'TRUE')
    # GPRS  capability
    {   return 16;
    }
    elsif (exists $MAKEFILE_OPTIONS{'low_cost_support'} and $MAKEFILE_OPTIONS{'low_cost_support'} eq 'FALSE')
    # GSM   capability  ; default
    {   return  8;
    }
    else
    # GSM   capability  + Low cost (single bank no matter)
    {   return  4;
    }
    die "search buffer number fail";
}

#****************************************************************************
# subroutine:  determine the amount for file system configure in fs_config.c
# return:      the value for recommend file handle number <NOTE!!!: scalar context>
#****************************************************************************
sub dispatch_fhnum
{
    if    (exists $MAKEFILE_OPTIONS{'l1_gprs'} and $MAKEFILE_OPTIONS{'l1_gprs'} eq 'TRUE')
    # GPRS  capability
    {   return 24;
    }
    elsif (exists $MAKEFILE_OPTIONS{'low_cost_support'} and $MAKEFILE_OPTIONS{'low_cost_support'} eq 'FALSE')
    # GSM   capability  ; default
    {   return 16;
    }
    elsif (exists $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} and
                  $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} eq 'FALSE')
    # GSM   capability  ; low cost
    {   return  8;
    }
    elsif (exists $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} and
                  $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} eq 'TRUE')
    # GSM   capability  ; low cost + single bank
    {   return  4;
    }
    die "search file handle number fail";
}

#****************************************************************************
# subroutine:  determine the amount for file system configure in fs_config.c
# return:      the value for recommend max thread number <NOTE!!!: scalar context>
#****************************************************************************
sub dispatch_threadnum
{
    if    (exists $MAKEFILE_OPTIONS{'l1_egprs'} and $MAKEFILE_OPTIONS{'l1_egprs'} eq 'TRUE')
    # EDGE  capability
    {   return 26;
    }
    elsif (exists $MAKEFILE_OPTIONS{'l1_gprs'} and $MAKEFILE_OPTIONS{'l1_gprs'} eq 'TRUE')
    # GPRS  capability
    {   return 22;
    }
    elsif (exists $MAKEFILE_OPTIONS{'low_cost_support'} and $MAKEFILE_OPTIONS{'low_cost_support'} eq 'FALSE')
    # GSM   capability  ; default
    {   return 14;
    }
    else
    # GSM   capability  ; low cost (single bank no matter)
    {   return  7;
    }
    die "search file handle number fail";
}

#****************************************************************************
# subroutine:  determine the template of global sys memory and
#              global debug memory for custom_config.c
# return:      the partial body strings in <NOTE!!!: list context>
#****************************************************************************
sub dispatch_globalmem_and_ctrlbuffpool
{
    my $gm_str_ref;
    my $cb_str_ref;
    if    (exists $MAKEFILE_OPTIONS{'l1_wcdma'} and $MAKEFILE_OPTIONS{'l1_wcdma'} eq 'TRUE')
    # WCDMA capability
    {   $gm_str_ref = &globalmem_wcdma;
        $cb_str_ref = &ctrlbuffpool_as_default;
    }
    elsif (exists $MAKEFILE_OPTIONS{'l1_egprs'} and $MAKEFILE_OPTIONS{'l1_egprs'} eq 'TRUE')
    # EDGE  capability
    {   $gm_str_ref = &globalmem_edge;
        $cb_str_ref = &ctrlbuffpool_as_default;
        $cb_str_ref.= &ctrlbuffpool_adjust_on_edge_class;
    }
    elsif (exists $MAKEFILE_OPTIONS{'l1_gprs'} and $MAKEFILE_OPTIONS{'l1_gprs'} eq 'TRUE')
    # GPRS  capability
    {   $gm_str_ref = &globalmem_gprs;
        $cb_str_ref = &ctrlbuffpool_as_default;
        $cb_str_ref.= &ctrlbuffpool_adjust_on_gprs_class;
    }
    elsif (exists $MAKEFILE_OPTIONS{'low_cost_support'} and $MAKEFILE_OPTIONS{'low_cost_support'} eq 'FALSE')
    # GSM   capability  ; default
    {   $gm_str_ref = &globalmem_gsm;
        $cb_str_ref = &ctrlbuffpool_as_default;
    }
    elsif (exists $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} and
                  $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} eq 'FALSE')
    # GSM   capability  ; low cost
    {   $gm_str_ref = &globalmem_gsm_lowcost;
        $cb_str_ref = &ctrlbuffpool_gsm_lowcost;
    }
    elsif (exists $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} and
                  $MAKEFILE_OPTIONS{'single_bank_nor_flash_support'} eq 'TRUE')
    # GSM   capability  ; low cost + single bank
    {   $gm_str_ref = &globalmem_gsm_lowcost_singlebank;
        $cb_str_ref = &ctrlbuffpool_gsm_lowcost_singlebank;
    }
    else  
    # Un supported state
    {       die "global memory and ctrl buff pool template search fail";
    }
    return ($gm_str_ref, $cb_str_ref);
}

#****************************************************************************
# subroutine:  generate global memory definiation for WCDMA type
# return:      the body strings
# EXAMPLE PROJECT : MONZA29E2_EVB
#****************************************************************************
sub globalmem_wcdma
{
    my $template = <<"__TEMPLATE";
/* SysGen Template Type : WCDMA Generic */
#if defined(__WCDMA_RAT__)

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          (8000*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    (6000*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          (5700*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    (2000*1024)
    #endif

#else  /* __WCDMA_RAT__ */

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          ( 290*1024)
       #define GLOBAL_DEBUG_MEM_SIZE    ( 100*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          ( 290*1024)
       #define GLOBAL_DEBUG_MEM_SIZE    ( 100*1024)
    #endif

#endif /* __WCDMA_RAT__ */

__TEMPLATE

    return $template;
}

#****************************************************************************
# subroutine:  generate global memory definiation for EDGE type
# return:      the body strings
# EXAMPLE PROJECT : SUPERMAN29_BB
#****************************************************************************
sub globalmem_edge
{
    my $template = <<"__TEMPLATE";
/* SysGen Template Type : EDGE Generic */
#if defined(__EGPRS_MODE__) && ( defined(__VOIP__) || defined(__WIFI_SUPPORT__) ) && defined(OBIGO_Q05A)

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          ( 450*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 300*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          ( 450*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 128*1024)
    #endif

#elif defined(__EGPRS_MODE__) && ( defined(__VOIP__) || defined(__WIFI_SUPPORT__) )

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          ( 420*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 300*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          ( 420*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 128*1024)
    #endif

#elif defined(OBIGO_Q05A)

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          ( 390*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 100*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          ( 360*1024) 
       #define GLOBAL_DEBUG_MEM_SIZE    ( 110*1024)
    #endif

#else  /* __EGPRS_MODE__ && ( __VOIP__ || __WIFI_SUPPORT__ ) && OBIGO_Q05A */

    #if defined(MTK_KAL_MNT) || defined(KAL_ON_OSCAR)
       #define GLOBAL_MEM_SIZE          ( 360*1024)
       #define GLOBAL_DEBUG_MEM_SIZE    ( 100*1024)
    #else /* MTK_KAL_MNT || KAL_ON_OSCAR */
       #define GLOBAL_MEM_SIZE          ( 340*1024)
       #define GLOBAL_DEBUG_MEM_SIZE    ( 100*1024)
    #endif

#endif /* __EGPRS_MODE__ && ( __VOIP__ || __WIFI_SUPPORT__ ) && OBIGO_Q05A */

__TEMPLATE

    return $template;
}

#****************************************************************************
# subroutine:  generate global memory definiation for GPRS type
# return:      the body strings
# EXAMPLE PROJECT : SAPPHIRE28_BB
#****************************************************************************
sub globalmem_gprs
{
    my $template = <<"__TEMPLATE";
/* SysGen Template Type : GPRS Generic */
#if (defined(__WIFI_SUPPORT__) || defined(__VOIP__)) && defined(OBIGO_Q05A)

        #define GLOBAL_MEM_SIZE         ( 370*1024)
        #define GLOBAL_DEBUG_MEM_SIZE   ( 110*1024)

#elif defined(__WIFI_SUPPORT__) || defined(__VOIP__)

        #define GLOBAL_MEM_SIZE         ( 340*1024)
        #define GLOBAL_DEBUG_MEM_SIZE   ( 110*1024)

#elif defined(OBIGO_Q05A)

        #define GLOBAL_MEM_SIZE         ( 320*1024)
        #define GLOBAL_DEBUG_MEM_SIZE   ( 100*1024)

#else /* (__WIFI_SUPPORT__ || __VOIP__) && OBIGO_Q05A */

        #define GLOBAL_MEM_SIZE         ( 290*1024)
        #define GLOBAL_DEBUG_MEM_SIZE   ( 100*1024)

#endif /* (__WIFI_SUPPORT__ || __VOIP__) && OBIGO_Q05A */

__TEMPLATE

    return $template;
}

#****************************************************************************
# subroutine:  generate global memory definiation for GSM type
# return:      the body strings
# EXAMPLE PROJECT : MT6205_CEVB
#****************************************************************************
sub globalmem_gsm
{
    my $template = <<"__TEMPLATE";
/* SysGen Template Type : GSM Generic */
        #define GLOBAL_MEM_SIZE         ( 160*1024)
        #define GLOBAL_DEBUG_MEM_SIZE   (  50*1024)
__TEMPLATE

⌨️ 快捷键说明

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