Subversion Repositories DevTools

Rev

Rev 7299 | Blame | Last modification | View Log | RSS feed

# -*- mode: perl; indent-width: 4; -*-
##############################################################################
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
#
# File:         PLATFORM/eos
#
# Contents:     Generic EOS platform definition, for all
#               platforms both kernel and targets.
#
# Revision History:
#   19/08/99  APY   Created
#   02/11/99  APY   NGDDU/NGBCP
#   06/12/99  APY   Networking
#   04/01/00  APY   - Defined EOS_CPU2
#                   - Library 'eosdvff' not available under HK386PC
#                   - KDB
#   01/03/00  APY   Audio driver standard for P386
#   09/03/00  APY   --Local within CPU/FAMILY directory specification
#   06/04/00  APY   HKGAK, HKAVM (with CMOS flavouring)
#   02/09/01  APY   HK396PC, DVUT
#   27/02/02  APY   Build system +v2 support,
#                       Populate ScmTarget and ScmTargetMach
#   12/04/02  APY   eoshal library
#   07/05/02  APY   Additional HKPCA libraries
#   27/05/02        NET_PROD option
#   11/07/02        EETP386, -DMELBOURNE
#   19/07/02        EOSBSD
#   04/10/02        GMPCA
#   19/04/04        --NoWarn
##############################################################################
#

EosInit();

$EOS_LNK    = 0x1000;
$EOS_KDB    = 0x2000;
$EOS_BIN    = 0x0100;
$EOS_ROM    = 0x0200;
$EOS_EXT    = 0x0400;

$NET_ROUTER = 0x0010;                           
$NET_UDP    = 0x0020;
$NET_TCP    = 0x0040;
$NET_PROD   = 0x0080;                           #Force production
$NET_UDPX   = $NET_UDP | $NET_ROUTER;
$NET_TCPX   = $NET_TCP | $NET_ROUTER;
$_NETKERNEL = $NET_UDP | $NET_TCP;              #Required for TCP and/or UDP

##############################################################################
#.  AMX platform runtime configuration
#
##############################################################################
sub EosInit
{
    AddFlags( '*', '-DEMBEDDED', '-D__EOSSYSTEM__' );

#.. Kernels
#
    #... Intel 86386 (and greater) protected mode
    #
    AddFlags( 'EOSP386',        '-DPERTH', '-DEOS_I86' );
    AddFlags( 'EETP386',        '-DMELBOURNE', '-DEOS_I86' );
    AddFlags( 'CMOS386',        '-DMELBOURNE', '-DEOS_I86' );
    $EOS_CPU        = "P386"
        if ( $ScmPlatform eq "EOSP386" ||
             $ScmPlatform eq "EETP386" ||
             $ScmPlatform eq "CMOS386" );

    #... 68x00
    #
    AddFlags( 'EOSM68K',        '-DPERTH' );
    AddFlags( 'CMOS68K',        '-DMELBOURNE' );
    $EOS_CPU        = "M68K"
        if ( $ScmPlatform eq "EOSM68K" || $ScmPlatform eq "CMOS68K" );

#.. Targets
#
    $EOS_KERNEL     = "";
    $EOS_CPU2       = "";

    #... HK386PC        (HK/Protected Mode 386)
    #
    AddFlags( 'HK386PC',        '-DPERTH', '-DEOS_I86' );
    if ( $ScmPlatform eq "HK386PC" ) {
        $EOS_KERNEL =  "EOSP386";
        $EOS_PROD   =  "HK386PC";
        $EOS_FAM    =  "HK386PC";
        $EOS_CPU    =  "P386";
    }

    #... HKMPR          (HK/Multi-Processor Unit)
    #
    AddFlags( 'HKMPR',          '-DPERTH', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "HKMPR" ) {
        $EOS_KERNEL =  "EOSM68K";
        $EOS_PROD   =  "HKMPR";
        $EOS_FAM    =  "HKPERTH1";
        $EOS_CPU    =  "M341";
    }

    #... HKDDU          (HK/Driver Display Unit)
    #
    AddFlags( 'HKDDU',          '-DPERTH', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "HKDDU" ) {
        $EOS_KERNEL =  "EOSM68K";
        $EOS_PROD   =  "HKDDU";
        $EOS_FAM    =  "HKPERTH1";
        $EOS_CPU    =  "M341";
    }

    #... NGDDU          (HK/New Generation Driver Display Unit)
    #
    AddFlags( 'NGDDU',          '-DPERTH', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "NGDDU" ) {
        $EOS_KERNEL =  "EOSM68K";
        $EOS_PROD   =  "NGDDU";
        $EOS_FAM    =  "HKPERTH1";
        $EOS_CPU    =  "M341";
        $EOS_CPU2   =  "M340";          # Supports M341/M340 env ...
    }

    #... HKBCP          (HK/Bus Card Processor)
    #
    AddFlags( 'HKBCP',          '-DPERTH', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "HKBCP" ) {
        $EOS_KERNEL =  "EOSM68K";
        $EOS_PROD   =  "HKBCP";
        $EOS_FAM    =  "HKPERTH1";
        $EOS_CPU    =  "M341";
    }

    #... NGBCP          (HK/New Generation Bus Card Processor)
    #
    AddFlags( 'NGBCP',          '-DPERTH', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "NGBCP" ) {
        $EOS_KERNEL =  "EOSM68K";
        $EOS_PROD   =  "NGBCP";
        $EOS_FAM    =  "HKPERTH1";
        $EOS_CPU    =  "M341";
        $EOS_CPU2   =  "M340";          # Supports M341/M340 env ...
    }

    #... HKGAK          (HK/Gate Adaption Kit)
    #
    AddFlags( 'HKGAK',          '-DMELBOURNE', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "HKGAK" ) {
        $EOS_KERNEL =  "CMOS68K";
        $EOS_PROD   =  "HKGAK";
        $EOS_FAM    =  "HKGMP1";
        $EOS_CPU    =  "M341";
    }

    #... HKAVM          (HK/Add Value Machine - Watcom)
    #
    AddFlags( 'HKAVM',          '-DMELBOURNE', '-DEOS_I86' );
    if ( $ScmPlatform eq "HKAVM" ) {
        $EOS_KERNEL =  "EOSP386";
        $EOS_PROD   =  "HKAVM";
        $EOS_FAM    =  "HK386PC";
        $EOS_CPU    =  "P386";
    }

    #... HKAVM2          (HK/Add Value Machine - Paradigm)
    #
    AddFlags( 'HKAVM2',         '-DMELBOURNE', '-DEOS_I86' );
    if ( $ScmPlatform eq "HKAVM2") {
        $EOS_KERNEL =  "EETP386";
        $EOS_PROD   =  "HKAVM2";
        $EOS_FAM    =  "HK386PC";
        $EOS_CPU    =  "P386";
    }

    #... HKPCA           (HK/Portable Card Reader)
    #
    AddFlags( 'HKPCA',          '-DMELBOURNE', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "HKPCA") {
        $EOS_KERNEL =  "CMOS68K";
        $EOS_PROD   =  "HKPCA";
        $EOS_FAM    =  "HKPCA";
        $EOS_CPU    =  "M332";
    }

    #... GMPCA           (GMPTE/Portable Card Reader)
    #
    AddFlags( 'GMPCA',          '-DMELBOURNE', '-DM68K', '-DEOS_M68K' );
    if ( $ScmPlatform eq "GMPCA") 
    {
        $EOS_KERNEL =  "CMOS68K";
        $EOS_PROD   =  "GMPCA";
        $EOS_FAM    =  "GMPCA";
        $EOS_CPU    =  "M332";
    }

    #... EOS products
    #
    $ScmTargetMach = $EOS_CPU;                  # Target machine

    if ( $EOS_KERNEL eq "" )
    {
        PlatformDefine( "#################################################");
        PlatformDefine( "# Building EOS kernel" );
        PlatformDefine( "#" );
        AddFlags( '*',  "-D$EOS_CPU" );
        AddFlags( '*',  "-DEOS_CPU=$EOS_CPU" );
        AddFlags( '*',  "-DEOS_$EOS_CPU" );
        AddDir( '*',    "$EOS_CPU", '--Local', '--NoWarn' );
    }
    else
    {
        PlatformDefine( "#################################################");
        PlatformDefine( "# Building an EOS based application" );
        PlatformDefine( "#" );
        PlatformDefine( "EOS_KERNEL     = $EOS_KERNEL" );
        PlatformDefine( "EOS_CPU        = $EOS_CPU" );
        PlatformDefine( "EOS_CPU2       = $EOS_CPU2" )
            if ( "$EOS_CPU2" ne "" );
        PlatformDefine( "EOS_PROD       = $EOS_PROD" );
        PlatformDefine( "EOS_FAM        = $EOS_FAM" );
        PlatformDefine( "" );

    #.. Order of directory search
    #       CPU, CPU2, PROD, then FAMILY ...
    #
        AddFlags( '*',  "-DEOS_CPU=$EOS_CPU" );
        AddFlags( '*',  "-DEOS_$EOS_CPU" );
        AddDir( '*',    "$EOS_CPU", '--Local', '--NoWarn' );

        if ( "$EOS_CPU2" ne "" ) {
            AddFlags( '*',  "-DEOS_CPU2=$EOS_CPU2" );
            AddFlags( '*',  "-DEOS_$EOS_CPU2" );
            AddDir( '*',    "$EOS_CPU2", '--Local', '--NoWarn' );
        }

        AddFlags( '*',  "-DEOS_PROD=$EOS_PROD" );
        AddFlags( '*',  "-DEOS_$EOS_PROD" );
        AddDir( '*',    "$EOS_PROD", '--Local', '--NoWarn' );

        AddFlags( '*',  "-DEOS_FAM=$EOS_FAM" );
        if ( "$EOS_PROD" ne "$EOS_FAM" ) {
            AddFlags( '*',  "-DEOS_$EOS_FAM" );
            AddDir( '*',    "$EOS_FAM", '--Local', '--NoWarn' );
        }
    }

#.. AMX requires
#
    PlatformRequire( "amx" );
}


##############################################################################
#   EosLink( $name, $eos, \@objs, \@libraries )
#       Build the rules required to link an EOS application
#
#  Returns:
#       Appends additional objects and libraries required to build
#       an EOS based application.
#....

sub EosLink
{
    my( $name, $eos, $pObjs, $pLibs ) = @_;
    my( $nettype );

#.. Startup code
#
    if ($eos & $EOS_ROM) {                      # BOOTROM
      if ($ScmToolset eq "wc386") {
        @$pLibs = ( "eosbc"."\$(SCM_TYPE)", @$pLibs );
      }
      elsif ( $ScmPlatform eq "HKPCA")
      {
        @$pLibs = ( "eosbc"."\$(SCM_TYPE)", @$pLibs );
      } else {
        if ($eos & $EOS_BIN) {
          @$pLibs = ( "eosbcP", @$pLibs );              # Download image
        } else {
          @$pLibs = ( "eosbcD", @$pLibs );              # Powerscope
        }
      }
    } else {                                    # Application
      if ($ScmToolset eq "wc386") {
        @$pLibs = ( "eosas"."\$(SCM_TYPE)", @$pLibs );
      }
      elsif ( $ScmPlatform eq "HKPCA")
      {
        @$pLibs = ( "eosas"."\$(SCM_TYPE)", @$pLibs );
      } else {
        if ($eos & $EOS_BIN) {
          @$pLibs = ( "eosasP", @$pLibs );              # Download image
        } else {
          @$pLibs = ( "eosasD", @$pLibs );              # Powerscope
        }
      }
    }

#.. KDB
#
    if ($eos & $EOS_KDB) {
        push( @$pLibs, "eoskdb" . "\$(SCM_TYPE)" );     # KDB
    } else {
        push( @$pLibs, "eoskdbx" . "\$(SCM_TYPE)" );    # KDB dummy ...
    }

#.. Application interface
#
    if ($ScmPlatform ne "HKAVM") {
        push( @$pLibs, "eoswin"  . "\$(SCM_TYPE)" );    # Window Manager
    }
    push( @$pLibs, "eosfm"   . "\$(SCM_TYPE)" );        # Font Manager
    push( @$pLibs, "eosfnt"  . "\$(SCM_TYPE)" );        # Fonts
    push( @$pLibs, "eosrm"   . "\$(SCM_TYPE)" );        # Resource Manager
    push( @$pLibs, "eoslog"  . "\$(SCM_TYPE)" );        # Syslog

#.. EOS Kernel
#
    if (($eos & $EOS_EXT) || ($eos & $EOS_KDB)) {
        push( @$pLibs, "eosesh"  . "\$(SCM_TYPE)" );    # Command shell
        push( @$pLibs, "eosstdx" . "\$(SCM_TYPE)" );    # Standard library
    } else {
        push( @$pLibs, "eosstd"  . "\$(SCM_TYPE)" );    # Standard library
    }
    push( @$pLibs,  "eosfs"   . "\$(SCM_TYPE)" );       # File system
    push( @$pLibs,  "eosdm"   . "\$(SCM_TYPE)" );       # Device Manager
    push( @$pLibs,  "eosmsg"  . "\$(SCM_TYPE)" );       # Messaging
    push( @$pLibs,  "eosmem"  . "\$(SCM_TYPE)" );       # Memory
    push( @$pLibs,  "eosts"   . "\$(SCM_TYPE)" );       # Task

#.. Target dependent
#
    push( @$pLibs,  "eostm"   . "\$(SCM_TYPE)" );       # Time
    push( @$pLibs,  "eoswd"   . "\$(SCM_TYPE)" );       # Watchdog
    push( @$pLibs,  "eoshal"  . "\$(SCM_TYPE)" );       # H/W abstraction

#.. Network
#
    $nettype = "\$(SCM_TYPE)";                          # default
    $nettype = "P"                                      # production
        if ($eos & $NET_PROD);

    if ($eos & $_NETKERNEL) {
        push( @$pLibs, "eosrpc" . $nettype );           # RPC
        push( @$pLibs, "eosnet" . $nettype );           # Network kernel
        if ($eos & $NET_UDP) {
            if ($eos & $NET_ROUTER) {                   # UDP only
                push( @$pLibs, "eosudpx" . $nettype );
            } else {
                push( @$pLibs, "eosudp" . $nettype );
            }
        } elsif ($eos & $NET_TCP) {                     # TCP/UDP
            if ($eos & $NET_ROUTER) {
                push( @$pLibs, "eostcpx" . $nettype );
            } else {
                push( @$pLibs, "eostcp" . $nettype );
            }
        }
    }

#.. Drivers (generic)
#
    if ( $ScmPlatform eq "HKDDU" || $ScmPlatform eq "HKBCP" ||
            $ScmPlatform eq "HKMPR" || 
         $ScmPlatform eq "HKPCA" || $ScmPlatform eq "GMPCA" )
    {
        push( @$pLibs, "eosdvff" . "\$(SCM_TYPE)" );    # Flash file system
    }


    if ( $ScmPlatform eq "HK386PC" || $ScmPlatform eq "HKAVM" )
    {
        push( @$pLibs, "eosdvdf" . "\$(SCM_TYPE)" );    # DOS/FS
    }

    if ( $ScmPlatform eq "HKAVM2" )
    {
        push( @$pLibs, "eosbsd"  . "\$(SCM_TYPE)" );    # BSD subsystem
        push( @$pLibs, "eosdafs" . "\$(SCM_TYPE)" );    # AMX/FS
    }

    push( @$pLibs, "eosdvtm" . "\$(SCM_TYPE)" );        # Timer
    push( @$pLibs, "eosdvrc" . "\$(SCM_TYPE)" );        # Runtime clock
    push( @$pLibs, "eosdvwd" . "\$(SCM_TYPE)" );        # Watchdog

#.. EOS standard drivers,
#       XXX - The follow should be defined within the platform definitions
#
    if ( $ScmPlatform eq "HK386PC" )
    {
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
    }
    elsif ( $ScmPlatform eq "HKAVM" || $ScmPlatform eq "HKAVM2" )
    {
        push( @$pLibs, "eosdvsc" . "\$(SCM_TYPE)" );    # Sony CSC
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
        push( @$pLibs, "eosbsdv" . "\$(SCM_TYPE)" );    # BSD driver (audio & LPT)
        push( @$pLibs, "eosdvkb" . "\$(SCM_TYPE)" );      # keyboard
        push( @$pLibs, "svgalib" . "\$(SCM_TYPE)" );    # SVGA Library
        push( @$pLibs, "eosdvgd" . "\$(SCM_TYPE)" );    # VGA
    }
    elsif ( $ScmPlatform eq "HKMPR" )
    {
        push( @$pLibs, "eosdvfl" . "\$(SCM_TYPE)" );    # Flash
        push( @$pLibs, "eosdvsc" . "\$(SCM_TYPE)" );    # Sony CSC
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvdd" . "\$(SCM_TYPE)" );    # Display
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
        push( @$pLibs, "eosdvfr" . "\$(SCM_TYPE)" );    # FRAM
        push( @$pLibs, "eosdio"  . "\$(SCM_TYPE)" );    # DIO
    }
    elsif ( $ScmPlatform eq "HKDDU" || $ScmPlatform eq "NGDDU" )
    {
        push( @$pLibs, "eosdvfl" . "\$(SCM_TYPE)" );    # Flash
        push( @$pLibs, "eosdvkb" . "\$(SCM_TYPE)" );    # Keyboard
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvdd" . "\$(SCM_TYPE)" );    # Display
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
        push( @$pLibs, "eosdvfr" . "\$(SCM_TYPE)" );    # FRAM
        push( @$pLibs, "eosdio"  . "\$(SCM_TYPE)" );    # DIO
    }
    elsif ( $ScmPlatform eq "HKBCP" || $ScmPlatform eq "NGBCP" )
    {
        push( @$pLibs, "eosdvfl" . "\$(SCM_TYPE)" );    # Flash
        push( @$pLibs, "eosdvsc" . "\$(SCM_TYPE)" );    # Sony CSC
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvdd" . "\$(SCM_TYPE)" );    # Display
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
        push( @$pLibs, "eosdvfr" . "\$(SCM_TYPE)" );    # FRAM
        push( @$pLibs, "eosdio"  . "\$(SCM_TYPE)" );    # DIO
    }
    elsif ( $ScmPlatform eq "HKPCA" )
    {     
        push( @$pLibs, "eosdvfl" . "\$(SCM_TYPE)" );    # Flash
        push( @$pLibs, "eosdvsc" . "\$(SCM_TYPE)" );    # Sony CSC
        push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvdd" . "\$(SCM_TYPE)" );    # Display
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
        push( @$pLibs, "eosdvfr" . "\$(SCM_TYPE)" );    # FRAM
    }
    elsif ( $ScmPlatform eq "GMPCA" )
    {
#       push( @$pLibs, "eosdvfl" . "\$(SCM_TYPE)" );    # Flash
#       push( @$pLibs, "eosdvut" . "\$(SCM_TYPE)" );    # Uart
        push( @$pLibs, "eosdvdd" . "\$(SCM_TYPE)" );    # Display
        push( @$pLibs, "eosdvad" . "\$(SCM_TYPE)" );    # Audio
#       push( @$pLibs, "eosdvfr" . "\$(SCM_TYPE)" );    # FRAM
    }

    if ($eos & $_NETKERNEL) {
        push( @$pLibs, "eosdvnt" . $nettype  );         # Network
    }
}