BAL and Maple Release 2.2

Signed-off-by: Shad Ansari <developer@Carbon.local>
diff --git a/bcm68620_release/release/make/bcm68620/Makefile.host.config b/bcm68620_release/release/make/bcm68620/Makefile.host.config
new file mode 100644
index 0000000..6f42b11
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/Makefile.host.config
@@ -0,0 +1,23 @@
+# Maple host configuration
+#
+# Set environment, extra flags, etc.
+# In particular, set CROSS_COMPILE
+# For linux environment make sure to set also OS_KERNEL=linux, KERNELDIR, KERNEL_OUTDIR and KERNEL_ARCH
+ifneq ("$(BOARD)", "")
+    include $(MAKE_DEVICE_DIR)/board.$(BOARD).config
+endif
+
+include $(MAKE_DEVICE_DIR)/$(TOOLCHAIN).opts
+
+export KERNELDIR
+export KERNEL_OUTDIR
+export KERNEL_ARCH
+export OS_KERNEL
+
+ifeq ("$(USE_ONU_SIM)", "y")
+    CFLAGS += -DCONFIG_ONU_SIM
+    export CONFIG_ONU_SIM := y
+endif
+
+LINT_FLAGS = -e686 $(MAKE_DEVICE_DIR)/gcc.lnt $(MAKE_DEVICE_DIR)/config.lnt
+
diff --git a/bcm68620_release/release/make/bcm68620/Makefile.host.rules b/bcm68620_release/release/make/bcm68620/Makefile.host.rules
new file mode 100644
index 0000000..54c4c44
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/Makefile.host.rules
@@ -0,0 +1,7 @@
+# Maple host rules
+#
+# Platform/board-specific rules
+# In particular, set BOARD_ENV_RULE if there is anything board-specific to be done
+ifneq ("$(BOARD)", "")
+    -include $(MAKE_DEVICE_DIR)/board.$(BOARD).rules
+endif
diff --git a/bcm68620_release/release/make/bcm68620/armcc.lnt b/bcm68620_release/release/make/bcm68620/armcc.lnt
new file mode 100644
index 0000000..99aa766
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/armcc.lnt
@@ -0,0 +1,5 @@
+-i/projects/xpon_co_lint/sources/supp/lnt
+co-ARMCC-5.lnt
+-i/tools/arm/DS-5_5.18.0/Linux-64/include
+-d"__int64=long long"
+
diff --git a/bcm68620_release/release/make/bcm68620/board.remote_wrx.config b/bcm68620_release/release/make/bcm68620/board.remote_wrx.config
new file mode 100644
index 0000000..57cfb32
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/board.remote_wrx.config
@@ -0,0 +1,25 @@
+# Remote WRX board
+#
+export CONFIG_TRANSPORT_RAW = n
+
+ifeq ("$(SUBSYSTEM)", "embedded")
+    $(error Can't build embedded subsystem for this board)
+else
+    ARCH_FLAGS      += -EB -mabi=64
+    TOOLCHAIN_PATH  ?= /opt/toolchains/maple/toolchains_bin/mipscross/linux/bin
+    CROSS_COMPILE   = $(TOOLCHAIN_PATH)/mips64-nlm-linux-
+
+    # a kludge here. If CONFIG_TRANSPORT_RAW is not set, that means that we are building for 
+    # wrx, but not the same wrx where Maple is. For example, building for WRX that controls 
+    # switch directly and maple remotely. In this case, we don't want any board-specific stuff
+    # to be compiled in (e.g., FPGA, I2C, etc.).
+    override BOARD =
+    
+    # OS for user space 
+    OS              = posix
+    
+    SIMULATION_BUILD = y
+   
+endif
+
+
diff --git a/bcm68620_release/release/make/bcm68620/board.wrx.config b/bcm68620_release/release/make/bcm68620/board.wrx.config
new file mode 100644
index 0000000..99bdf12
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/board.wrx.config
@@ -0,0 +1,112 @@
+# WRX board
+#
+
+# Use raw transport
+export CONFIG_TRANSPORT_RAW = y
+
+ENABLE_PMC   ?= y
+
+ifeq ("$(ENABLE_PMC)", "y")
+    EXTRA_CFLAGS   += -DBCM_PMC_EXIST
+endif
+
+ifeq ("$(SUBSYSTEM)", "embedded")
+    TOOLCHAIN = armcc
+    OS=threadx
+	    
+    # We use gcc for dependency generation in order to speed up the build process
+    GCCVER ?= 4.8.1
+    
+    # Use raw transport
+    # Should be moved go common host/embedded section when the host environment is ready
+    COMPILE_ALL_IN_ONE_GO ?= n
+    export COMPILE_ALL_IN_ONE_GO
+
+    # Definition for enable Periodic  ARM DS-5 license model, up to 4X improvement for compilation time 
+    # the output from the /tools/bin/get_lic_servers arm5-periodic is optimized for each site, the 
+    # "38224@lic-tlva-001:38224@lic-blr-001:38224@lic-irva-350:38224@lic-irva-000" string is valide for HZ site
+    export ARMLMD_LICENSE_FILE :=$(shell if [ -f /tools/bin/get_lic_servers ] ; then /tools/bin/get_lic_servers arm5-periodic ; \
+else echo "38224@lic-tlva-001.broadcom.net:38224@lic-blr-001.broadcom.net:38224@lic-irva-350.broadcom.net:38224@lic-irva-000.broadcom.net"; fi)
+    export ARMCC5_CCOPT        :=--sitelicense --licretry
+    export ARMCC5_ASMOPT       :=--sitelicense --licretry
+    export ARMCC5_LINKOPT      :=--sitelicense --licretry
+    export ARMCC5_FROMELFOPT   :=--sitelicense --licretry
+    export ARMCC5_AROPT        :=--sitelicense --licretry
+   
+    USE_UNCACHE_BW_MAP ?= n
+    export USE_UNCACHE_BW_MAP 
+    USE_UNCACHE_SR_NSR_COUNTERS ?= n
+    export USE_UNCACHE_SR_NSR_COUNTERS
+
+    ifeq ("$(SIMULATION)", "y")
+        EXTRA_DEFINES += -DSIMULATION
+    endif
+	
+	USE_SYM_TAB ?= y
+	export USE_SYM_TAB
+	
+	ifeq ("$(USE_SYM_TAB)", "y")
+		
+		export SYMTAB_GEN_TOOLS = $(TOP_DIR)/scripts/bcmSymTlbGen.sh 
+		
+		ifeq ("$(SYMTAB_NO_DATA)", "y")
+		    export SYMTAB_ND=-nd
+	    endif
+	
+	    ifeq ("$(SYMTAB_NO_LDATA)", "y")
+		   export SYMTAB_NLD=-nld
+	    endif
+	
+	    ifeq ("$(SYMTAB_NO_LFANC)", "y")
+		    export SYMTAB_NLF=-nlf
+	    endif
+		
+		EXTRA_DEFINES += -DUSE_SYM_TAB	
+		
+		export DUMMY_SYMTAB = $(TOP_DIR)/embedded/sys/bsp/symtab.c
+	endif
+    
+    ifeq ("$(ENABLE_TRACE)", "y")
+        EXTRA_DEFINES += -DTX_ENABLE_EVENT_TRACE
+        ifeq ("$(DEBUG_TRACE_INIT)", "y")
+            EXTRA_DEFINES += -DDEBUG_TRACE_INIT
+        endif
+    endif
+    	
+    INT_CHECK    ?= y
+    ifeq ("$(INT_CHECK)", "y")
+        EXTRA_DEFINES += -DINTERRUPT_VALIDATION
+    endif
+else
+    BOARD_DIR       ?= $(TOP_DIR)/../boards/cur/$(BOARD)
+    KERNEL_BRCM_VER = 3.0.2-m1.01
+    TOOLCHAIN_PATH  ?= /opt/toolchains/maple/toolchains_bin/mipscross/linux/bin
+    CROSS_COMPILE   = $(TOOLCHAIN_PATH)/mips64-nlm-linux-
+    
+    KERNELDIR       = $(BOARD_DIR)/linux/$(KERNEL_BRCM_VER)/linux
+    KERNEL_OUTDIR  ?= $(KERNELDIR)
+    export KERNELDIR
+    export KERNEL_OUTDIR
+
+
+    # use Linux kernel
+    export OS_KERNEL= linux
+    # OS for user space 
+    OS              = posix
+    
+    # Architecture definition   
+    KERNEL_ARCH     = mips
+    ARCH_FLAGS      += -EB -mabi=64
+    
+    export KERNEL_ARCH
+    export ARCH_FLAGS
+    
+    export KERNEL_TAR_NAME  = wrx_linux-sdk.tar.bz2
+    export LIBS_TAR_NAME    = libraries.tar.bz2
+    
+    # Rule tu build wrx kernel. The rule itself is defined in board.wrx.rules
+    export BOARD_ENV_RULE   = wrx_linux_kernel 
+    
+endif
+
+
diff --git a/bcm68620_release/release/make/bcm68620/board.wrx.rules b/bcm68620_release/release/make/bcm68620/board.wrx.rules
new file mode 100644
index 0000000..3546f5d
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/board.wrx.rules
@@ -0,0 +1,26 @@
+# WRX-specific rules
+
+ifeq ("$(SUBSYSTEM)", "host")
+    # Build linux kernel if not done yet
+
+wrx_linux_kernel:
+	if [ ! -d $(BOARD_DIR) ]; then\
+		$(BOLD_PRINT) "ERROR: $(BOARD_DIR) directory doesn't not exist" ; \
+		exit -1; \
+	fi;\
+    if [ -f  $(KERNEL_OUTDIR)/vmlinux ] ; then \
+        $(BOLD_PRINT) "found compiled $(BOARD) kernel in $(KERNEL_OUTDIR)" ;\
+        exit 0;\
+    fi;\
+	if [ ! -f $(BOARD_DIR)/linux/$(KERNEL_BRCM_VER)/$(KERNEL_TAR_NAME) ]; then\
+		$(BOLD_PRINT) "ERROR: Kernel tar file doesn't exist. Please get the latest version of $(BOARD_DIR)/linux/$(KERNEL_BRCM_VER)/$(KERNEL_TAR_NAME) ";\
+		exit -1;\
+	fi;\
+	if [ ! -f $(BOARD_DIR)/linux/$(KERNEL_BRCM_VER)/$(LIBS_TAR_NAME) ]; then \
+		$(BOLD_PRINT) "ERROR: Kernel Libraries tar file not exists. Please get latest version of $(BOARD_DIR)/linux/$(KERNEL_BRCM_VER)/$(LIBS_TAR_NAME) ";\
+		exit -1;\
+	fi;\
+	$(BOLD_PRINT) "Building wrx kernel";\
+	cd $(BOARD_DIR);  $(MAKE)
+
+endif
diff --git a/bcm68620_release/release/make/bcm68620/gcc.lnt b/bcm68620_release/release/make/bcm68620/gcc.lnt
new file mode 100644
index 0000000..3a3c198
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/gcc.lnt
@@ -0,0 +1,5 @@
+-i/projects/xpon_co_lint/sources/supp/lnt
+co-gcc.lnt
+-emacro(633, BUG_ON)
+-parent(va_list, __gnuc_va_list)
+-parent(va_list, __builtin_va_list)
diff --git a/bcm68620_release/release/make/bcm68620/gcc.opts b/bcm68620_release/release/make/bcm68620/gcc.opts
new file mode 100644
index 0000000..718b403
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/gcc.opts
@@ -0,0 +1,53 @@
+# Maple SDK requires C99
+EXTRA_CFLAGS    += -Wall -Werror
+ARFLAGS = r
+
+BLD_CC = $(CCACHE) $(CROSS_COMPILE)gcc
+BLD_AS = $(CCACHE) $(CROSS_COMPILE)gcc
+BLD_AR = $(CROSS_COMPILE)ar
+BLD_DEP = $(BLD_CC)
+
+CFLAGS    += -std=c99
+ifeq ("$(ENABLE_EXTRA_WARNINGS)", "y")
+    CFLAGS    += -Wextra -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts
+    CFLAGS    += -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls
+    CFLAGS    += -Wstrict-prototypes -Wparentheses -Wswitch -Wswitch-default -Wunused -Wuninitialized -Wunused-but-set-variable
+    CFLAGS    += -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare
+    CFLAGS    += -Wshadow -Wno-inline
+endif
+
+BUILD_DEPS_IN_CC    ?= y
+export BUILD_DEPS_IN_CC
+
+ifeq ("$(BUILD_DEPS_IN_CC)", "y")
+    CFLAGS += -MMD -MP
+endif
+
+ifeq ("$(CROSS_COMPILE)", "")
+    ARCH_FLAGS += -m32 -march=i386
+    SIMULATION_BUILD ?= y
+    export SIMULATION_BUILD
+    GCCVER ?= 4.8.1
+    export GCCVER
+    # Temporary, until bad cast in bcm_dev_log_task.c is fixed (SWMAPLE-2123)
+    CFLAGS += -Wno-strict-aliasing
+endif
+
+ifeq ("$(EXPORT_DYNAMIC_SYMBOLS)", "y")
+    ARCH_FLAGS += -Wl,-export-dynamic 
+endif
+
+ifneq ("$(SIMULATION_BUILD)", "y")
+    EXTRA_CFLAGS    += -Wframe-larger-than=16384
+endif
+
+LIBS_MARKER =-l
+LIBS_PATH_MARKER =-L
+LIBS_START_MARKER = -Wl,--start-group
+LIBS_END_MARKER = -Wl,--end-group
+
+# Debug and release optimization options. Can be overwritten in Makefile.config.$(PLATFORM)
+DEBUG_O_CFLAGS      ?= -g -ggdb -O0
+DEBUG_O_LFLAGS      ?= -g
+RELEASE_O_CFLAGS    ?= -g -O2
+RELEASE_O_LFLAGS    ?= -g
diff --git a/bcm68620_release/release/make/bcm68620/modules.host b/bcm68620_release/release/make/bcm68620/modules.host
new file mode 100644
index 0000000..a7a0f59
--- /dev/null
+++ b/bcm68620_release/release/make/bcm68620/modules.host
@@ -0,0 +1,67 @@
+host_customized/dev_ctrl_linux
+host_customized/coop_dba_linux
+host_customized/embedded_cli
+host_customized/embedded_cli/main
+host_customized/os_abstraction
+host_customized/os_abstraction/linux
+host_customized/os_abstraction/os_cli
+host_customized/transport/nl_socket
+host_customized/transport/unix_socket
+host_customized/transport/plugin
+host_customized/transport/plugin/mux
+host_customized/transport/plugin/raw_nl
+host_customized/transport/plugin/raw_ud
+host_customized/transport/plugin/udp
+host_customized/user_config
+host_customized/user_config/board_selector
+host_customized/ll_pcie
+host_customized/pcie
+host_customized/i2c
+host_customized/board/wrx
+host_customized/model_linux
+host_customized/utils_linux
+host_customized/api_linux
+host_customized/host_api_linux
+host_driver/api
+host_driver/utils
+host_driver/debug
+host_driver/dev_ctrl
+host_driver/coop_dba
+host_driver/dev_ctrl_daemon
+host_driver/dev_ctrl_daemon/user
+host_driver/host_api
+host_driver/keep_alive
+host_driver/keep_alive/daemon
+host_driver/model
+host_driver/pcie
+host_driver/transport/inband
+host_driver/transport
+host_driver/transport/mux
+host_driver/transport/mux/daemon
+host_driver/transport/pcie_sw_queue
+host_driver/fld
+host_driver/common_gpon
+host_reference/api_cli
+host_reference/device_selector
+host_reference/cli
+host_reference/dev_log
+host_reference/dev_log_linux
+host_reference/dev_log_linux/kernel
+host_reference/api_dev_log
+host_reference/linenoise
+host_reference/user_appl
+host_reference/user_appl/eon
+host_reference/user_appl/omon
+host_reference/user_appl/epon_hde
+host_reference/user_appl/protection_switching
+host_reference/user_appl/epon_oam
+host_reference/user_appl/epon_oam_cli
+host_reference/user_appl/image_transfer
+host_reference/user_appl/sw_upgrade
+host_reference/user_appl/playback
+host_reference/user_appl/dpoe_sec
+host_reference/user_appl/ngpon2_onu_tuning
+host_reference/api_proxy
+host_reference/remote_cli
+host_reference/common_epon_oam
+host_reference/time_measurement