diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5e24190c --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +# Everything in the REPO directory is ignored by default. + +# Build products +BUILD/ +dependmodules.x +*.deb +*.cpio.gz +*.sqsh +*.pyc + +# Package cache and lock files +.lock +.PKGs.cache +.PKGs.cache.lock + +# Local module manifest. +.manifest.mk + + + diff --git a/REPO/.gitignore b/REPO/.gitignore new file mode 100644 index 00000000..1477bd1f --- /dev/null +++ b/REPO/.gitignore @@ -0,0 +1 @@ +extracts diff --git a/REPO/Makefile b/REPO/Makefile new file mode 100644 index 00000000..9637ab11 --- /dev/null +++ b/REPO/Makefile @@ -0,0 +1,11 @@ + +help: + @echo "Targets:" + @echo " clean : Clean all extracts and debian packages." + +clean: + @find packages -name "*.deb" -delete + @find packages -name Packages -delete + @find packages -name Packages.gz -delete + @rm -rf extracts + diff --git a/REPO/packages/.gitignore b/REPO/packages/.gitignore new file mode 100644 index 00000000..a1f17ae9 --- /dev/null +++ b/REPO/packages/.gitignore @@ -0,0 +1,3 @@ +*.deb +Packages +Packages.gz diff --git a/REPO/packages/all/Makefile b/REPO/packages/all/Makefile new file mode 100644 index 00000000..6283cc30 --- /dev/null +++ b/REPO/packages/all/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/repo.mk diff --git a/REPO/packages/amd64/Makefile b/REPO/packages/amd64/Makefile new file mode 100644 index 00000000..6283cc30 --- /dev/null +++ b/REPO/packages/amd64/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/repo.mk diff --git a/REPO/packages/powerpc/Makefile b/REPO/packages/powerpc/Makefile new file mode 100644 index 00000000..6283cc30 --- /dev/null +++ b/REPO/packages/powerpc/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/repo.mk diff --git a/builds/swi/.gitignore b/builds/swi/.gitignore new file mode 100644 index 00000000..e231f9df --- /dev/null +++ b/builds/swi/.gitignore @@ -0,0 +1,2 @@ +*.swi +*.swi.md5sum diff --git a/builds/swi/amd64/Makefile b/builds/swi/amd64/Makefile new file mode 100644 index 00000000..0c007902 --- /dev/null +++ b/builds/swi/amd64/Makefile @@ -0,0 +1,3 @@ +ROOTFS_PACKAGE := onl-rootfs +include $(ONL)/make/config.amd64.mk +include $(ONL)/make/swi.mk diff --git a/builds/swi/powerpc/Makefile b/builds/swi/powerpc/Makefile new file mode 100644 index 00000000..dbd07c9b --- /dev/null +++ b/builds/swi/powerpc/Makefile @@ -0,0 +1,3 @@ +ROOTFS_PACKAGE := onl-rootfs +include $(ONL)/make/config.powerpc.mk +include $(ONL)/make/swi.mk diff --git a/make/.gitignore b/make/.gitignore new file mode 100644 index 00000000..8efe6e45 --- /dev/null +++ b/make/.gitignore @@ -0,0 +1,2 @@ +version-onl.* + diff --git a/make/Makefile b/make/Makefile new file mode 100644 index 00000000..d7a2afeb --- /dev/null +++ b/make/Makefile @@ -0,0 +1,8 @@ +############################################################ +# +# Convenience makefile for generating +# the local version variables. +# +versions.env: + $(ONL_V_at) $(MAKE) -f versions.mk ONL_VERSION_ENV_FILE=versions.env + diff --git a/make/config.amd64.mk b/make/config.amd64.mk new file mode 100644 index 00000000..5648d13f --- /dev/null +++ b/make/config.amd64.mk @@ -0,0 +1,10 @@ +############################################################ +# +# Open Network Linux +# +############################################################ +include $(ONL)/make/config.mk +export TOOLCHAIN := x86_64-linux-gnu +export ARCH := amd64 + + diff --git a/make/config.mk b/make/config.mk new file mode 100644 index 00000000..508734e3 --- /dev/null +++ b/make/config.mk @@ -0,0 +1,36 @@ +############################################################ +# +# Open Network Linux Configuration Makefile +# +############################################################ +ifndef ONL + $(error $$ONL is not defined) +endif + +ifndef ONLPM_PY + ONLPM := $(ONL)/tools/onlpm.py +endif + +ifndef BUILDER + # Builder is here + export BUILDER := $(ONL)/sm/infra/builder/unix +endif + +# +# The default build directory for all infra:builder compilations is the following. +# +export BUILD_DIR_BASE=BUILD + + +# Generate manifest if necessary +export MODULEMANIFEST := $(shell $(ONL)/tools/scripts/manifest.sh $(ONL) $(BUILDER)) + +# +# Default make options. +# +ONL_MAKE_FLAGS += --no-print-directory -s +ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS) +ONL_V_at := @ + + + diff --git a/make/config.powerpc.mk b/make/config.powerpc.mk new file mode 100644 index 00000000..29f0a0ec --- /dev/null +++ b/make/config.powerpc.mk @@ -0,0 +1,10 @@ +############################################################ +# +# Open Network Linux +# +############################################################ +include $(ONL)/make/config.mk +export TOOLCHAIN := powerpc-linux-gnu +export ARCH := powerpc + + diff --git a/make/kbuild.mk b/make/kbuild.mk new file mode 100644 index 00000000..4c36eaf7 --- /dev/null +++ b/make/kbuild.mk @@ -0,0 +1,166 @@ +############################################################ +# +# +# Copyright 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Prepare and build a kernel. +# +############################################################ + +ifndef ARCH +$(error $$ARCH must be set) +endif + +# +# The kernel patchlevel. +# +ifndef K_PATCH_LEVEL +$(error $$K_PATCH_LEVEL must be set) +endif + +# +# The kernel sublevel +# +ifndef K_SUB_LEVEL +$(error $$K_SUB_LEVEL must be set) +endif + +# +# The directory containing the patches to be applied +# to the kernel sources. +# +ifndef K_PATCH_DIR +$(error $$K_PATCH_DIR must be set) +endif + +# +# This is the directory that will receive the build targets. +# The kernel build tree is placed in this directory, +# as well as any custom copy targets. +# +ifndef K_TARGET_DIR +$(error $$K_TARGET_DIR not set) +endif + +# +# This is the absolute path to the kernel configuration +# that should be used for this build. +# +ifndef K_CONFIG +$(error $$K_CONFIG not set) +endif + +# +# This is the build target. bzImage, uImage, etc. +# +ifndef K_BUILD_TARGET +$(error $$K_BUILD_TARGET not set) +endif + +############################################################ +############################################################ +ONL_KERNELS := $(ONL)/packages/base/any/kernels + +K_VERSION := 3.$(K_PATCH_LEVEL).$(K_SUB_LEVEL)$(K_SUFFIX) +K_NAME := linux-$(K_VERSION) +ifndef K_ARCHIVE_EXT +K_ARCHIVE_EXT := tar.xz +endif +K_ARCHIVE_NAME := $(K_NAME).$(K_ARCHIVE_EXT) +K_ARCHIVE_PATH := $(ONL_KERNELS)/archives/$(K_ARCHIVE_NAME) +ifndef K_ARCHIVE_URL +K_ARCHIVE_URL := https://www.kernel.org/pub/linux/kernel/v3.x/$(K_ARCHIVE_NAME) +endif +K_SOURCE_DIR := $(K_TARGET_DIR)/$(K_NAME) +K_MBUILD_DIR := $(K_SOURCE_DIR)-mbuild +K_DTBS_DIR := $(K_SOURCE_DIR)-dtbs + +# +# The kernel source archive. Download if not present. +# +$(K_ARCHIVE_PATH): + cd $(ONL_KERNELS)/archives && wget $(K_ARCHIVE_URL) + + +.PHONY : ksource kpatched + +# +# The extracted kernel sources +# +$(K_SOURCE_DIR)/Makefile: $(K_ARCHIVE_PATH) + cd $(K_TARGET_DIR) && tar kxf $(K_ARCHIVE_PATH) + touch -c $(K_SOURCE_DIR)/Makefile + $(K_MAKE) mrproper + +ksource: $(K_SOURCE_DIR)/Makefile + +# +# The patched kernel sources +# +$(K_SOURCE_DIR)/.PATCHED: $(K_SOURCE_DIR)/Makefile + $(ONL)/tools/scripts/apply-patches.sh $(K_SOURCE_DIR) $(K_PATCH_DIR) + touch $(K_SOURCE_DIR)/.PATCHED + +kpatched: $(K_SOURCE_DIR)/.PATCHED + +# +# Setup the kernel and output directory for the build. +# +setup: $(K_SOURCE_DIR)/.PATCHED + cp $(K_CONFIG) $(K_SOURCE_DIR)/.config + +# +# Kernel build command. +# +K_MAKE := $(MAKE) -C $(K_SOURCE_DIR) + +# +# Build the kernel. +# +build: setup + +$(K_MAKE) $(K_BUILD_TARGET) +ifdef K_COPY_SRC +ifdef K_COPY_DST + cp $(K_SOURCE_DIR)/$(K_COPY_SRC) $(K_TARGET_DIR)/$(K_COPY_DST) +endif +endif + + +MODSYNCLIST := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib + +mbuild: build + rm -rf $(K_MBUILD_DIR) + mkdir -p $(K_MBUILD_DIR) + $(foreach f,$(MODSYNCLIST),$(ONL)/tools/scripts/tree-copy.sh $(K_SOURCE_DIR) $(f) $(K_MBUILD_DIR);) + +dtbs: mbuild +ifdef DTS_LIST + rm -rf $(K_DTBS_DIR) + mkdir -p $(K_DTBS_DIR) + $(foreach name,$(DTS_LIST),$(K_SOURCE_DIR)/scripts/dtc/dtc -I dts -O dtb -o $(K_DTBS_DIR)/$(name).dtb $(K_SOURCE_DIR)/arch/$(ARCH)/boot/dts/$(name).dts; ) +endif + +# +# This target can be used to manage the configuration file. +# +configure: setup + $(K_MAKE) menuconfig + cp $(K_SOURCE_DIR)/.config $(K_CONFIG) + +.DEFAULT_GOAL := dtbs diff --git a/make/pkg.mk b/make/pkg.mk new file mode 100644 index 00000000..03bd6108 --- /dev/null +++ b/make/pkg.mk @@ -0,0 +1,53 @@ +############################################################ +# +# pkg.mk +# +# Default rules for building packages. +# +# Build all package groups in the current subtree. +# +############################################################ +include $(ONL)/make/config.mk + +# +# Invoke onlpm to build all packages in the current +# directory tree. +# +pkgall: + $(ONL_V_at) MAKE=$(MAKE) onlpm.py --build all + + +clean: + $(ONL_V_at) MAKE=$(MAKE) onlpm.py --clean all + +rebuild: + $(ONL_V_at) MAKE=$(MAKE) onlpm.py --rebuild-pkg-cache + +# +# Check all package declarations. +# +check: + $(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --no-pkg-cache + +subdir: + $(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --build all --no-pkg-cache + + +# +# Package construction only (no build step) +# +pkg: + $(ONL_V_at) MAKE=$(MAKE) NOBUILD=1 onlpm.py --build all + + + +# +# Generate a rule for all available packages +# +ALL_PACKAGES := $(shell onlpm.py --list-all) +define package_build_template +package-$(1): + $(ONL_V_at) onlpm.py --build $(2) + +endef +$(foreach p,$(ALL_PACKAGES),$(eval $(call package_build_template,$(subst :,_,$(p)),$(p)))) diff --git a/make/repo.mk b/make/repo.mk new file mode 100644 index 00000000..ac113fc1 --- /dev/null +++ b/make/repo.mk @@ -0,0 +1,6 @@ +PACKAGES := $(wildcard *.deb) + +Packages: $(PACKAGES) + @echo "Updating Package Manifest..." + $(ONL_V_at) dpkg-scanpackages . > Packages + diff --git a/make/require-packages.mk b/make/require-packages.mk new file mode 100644 index 00000000..aa32a8da --- /dev/null +++ b/make/require-packages.mk @@ -0,0 +1,6 @@ +include $(ONL)/make/config.mk + +required_packages: +ifdef REQUIRED_PACKAGES + $(ONLPM) --require $(REQUIRED_PACKAGES) +endif diff --git a/make/rfs.mk b/make/rfs.mk new file mode 100644 index 00000000..1c8e0d52 --- /dev/null +++ b/make/rfs.mk @@ -0,0 +1,42 @@ +############################################################ +# +# Common rules for invoking the onlrfs script. +# +# See $(ONL)/tools/onlrfs.py +# +############################################################ + +ifndef ARCH +$(error $$ARCH must be specified) +endif + +ifndef RFS_CONFIG +$(error $$RFS_CONFIG must be set to the RFS yaml configuration file) +endif + +ifndef RFS_DIR +$(error $$RFS_DIR must be set) +endif + +RFS_COMMAND := $(ONL)/tools/onlrfs.py --arch $(ARCH) --config $(RFS_CONFIG) --dir $(RFS_DIR) + +ifdef RFS_CPIO +RFS_COMMAND += --cpio $(RFS_CPIO) +endif + +ifdef RFS_SQUASH +RFS_COMMAND += --squash $(RFS_SQUASH) +endif + +RFS: + $(ONL_V_at) rm -rf manifest.json + $(ONL_V_at) $(RFS_COMMAND) + $(ONL_V_at) [ -f $(RFS_DIR)/etc/onl/rootfs/manifest.json ] && cp $(RFS_DIR)/etc/onl/rootfs/manifest.json . + +clean: + $(ONL_V_at) sudo rm -rf $(RFS_DIR) + $(ONL_v_at) rm -rf $(RFS_CPIO) $(RFS_SQUASH) + + +show-packages: + $(ONL_V_at) $(RFS_COMMAND) --show-packages diff --git a/make/subdirs.mk b/make/subdirs.mk new file mode 100644 index 00000000..acb3fa62 --- /dev/null +++ b/make/subdirs.mk @@ -0,0 +1,19 @@ +############################################################ +# +# +############################################################ +include $(ONL)/make/config.mk + +ifndef DIRECTORIES +DIRECTORIES := $(notdir $(wildcard $(CURDIR)/*)) +endif + +FILTER := make Makefile Makefile~ $(FILTER) +DIRECTORIES := $(filter-out $(FILTER),$(DIRECTORIES)) + +all $(MAKECMDGOALS): + +$(ONL_V_at) $(foreach d,$(DIRECTORIES),$(ONL_MAKE) -C $(d) $(MAKECMDGOALS) || exit 1;) + + + + diff --git a/make/swi.mk b/make/swi.mk new file mode 100644 index 00000000..b5b16a43 --- /dev/null +++ b/make/swi.mk @@ -0,0 +1,26 @@ +ifndef ARCH +$(error $$ARCH is not set) +endif + +ifndef ROOTFS_PACKAGE +$(error $$ROOTFS_PACKAGE not set.) +endif + +ifdef REBUILD_RFS +FORCE_OPTION = --force +endif + +LINK_OPTIONS := $(FORCE_OPTION) --link-file $(ROOTFS_PACKAGE):$(ARCH) rootfs-$(ARCH).sqsh . --link-file $(ROOTFS_PACKAGE):$(ARCH) manifest.json . + +ifndef FILENAMER +FILENAMER := $(ONL)/tools/filenamer.py +endif + +swi: FORCE + $(ONL_V_at) $(ONLPM) $(LINK_OPTIONS) + $(ONL_V_at) zip -n rootfs-$(ARCH).sqsh - rootfs-$(ARCH).sqsh manifest.json > $@ + $(ONL_V_at) mv $@ `$(FILENAMER) --type swi --manifest manifest.json $@` + $(ONL_V_at) for f in `ls *.swi`; do md5sum $$f > $$f.md5sum; done + $(ONL_V_at) rm -rf rootfs-$(ARCH).sqsh manifest.json + $(ONL_V_at) ls *.swi +FORCE: diff --git a/packages/base/all/Makefile b/packages/base/all/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/all/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/all/initrds/loader-initrd-files/Makefile b/packages/base/all/initrds/loader-initrd-files/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/all/initrds/loader-initrd-files/PKG.yml b/packages/base/all/initrds/loader-initrd-files/PKG.yml new file mode 100644 index 00000000..97f1bdc7 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/PKG.yml @@ -0,0 +1,36 @@ +common: + arch: all + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-loader-initrd-files + version: 1.0.0 + summary: Open Network Linux System Loader Source Files + + files: + - src/bin : /bin + - src/etc : /etc + - src/lib : /lib + - $ONL/make/version-onl.sh : /etc/onl/loader/versions.sh + - $ONL/make/version-onl.json : /etc/onl/loader/versions.json + - $ONL/make/version-onl.mk : /etc/onl/loader/versions.mk + + changelog: Change changes changes., + + + - name: onl-loader-initscripts + version: 1.0.0 + summary: Open Network Linux System Loader Common Initscripts + + files: + src/bin/initblockdev : /sbin/ + src/bin/initmounts : /sbin/ + src/bin/initnetdev : /sbin/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/autoboot b/packages/base/all/initrds/loader-initrd-files/src/bin/autoboot new file mode 100644 index 00000000..574131c4 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/autoboot @@ -0,0 +1,121 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# autoboot +# +# Automatic boot sequence. +# +############################################################ +. /lib/msgs + +if [ -f /etc/onl/abort ]; then + sleep 3 + exit 1 +fi + + +# +# The maximum number of times we will retry autobooting before +# rebooting the system. +# +AUTOBOOT_MAX=50 +AUTOBOOT_COUNTER=/var/run/autoboot.count + +tryagain() { + # The timeout call to the boot script does not always kill stalled wgets properly. + # If there are any lingering wgets because of a timeout in downloading + # lets make sure they die a proper death. + killall -9 wget > /dev/null 2>&1 + + # Get the current retry count. + autoboot_count=0 + if [ -f "$AUTOBOOT_COUNTER" ]; then + . "$AUTOBOOT_COUNTER" + fi + let "autoboot_count=autoboot_count+1" + echo "autoboot_count=$autoboot_count" > "$AUTOBOOT_COUNTER" + if [ "$autoboot_count" -gt "$AUTOBOOT_MAX" ]; then + # Reboot + msg_info "The Maximum number of autoboot attempts has been reached. Restarting..." + sleep 3 + reboot + fi + exec $0 "$@" +} + +if [ "$1" != "now" ]; then + if [ -f /bin/banner ]; then + /bin/banner + if [ -f /etc/onl/abort ]; then + sleep 3 + exit 1 + fi + fi + echo + echo + echo "Press Control-C now to enter the interactive loader shell." + sleep 3 + echo + msg_info "Starting Autoboot" +fi + +# +# Apply any network settings indicated in the boot-config. +# +msg_info "Configuring Interfaces" + +if ! ifup; then + msg_error "The network settings indicated in the boot-config could not be applied." + echo $(cat /etc/onl/NET) + echo + tryagain +fi + + +# +# Bootmode selection. +# +if [ ! -f /etc/onl/BOOTMODE ]; then + msg_error "There is no BOOTMODE setting. Autobooting cannot continue." + exit 1 +fi + +BOOTMODE=$(cat /etc/onl/BOOTMODE) +if [ ! "$BOOTMODE" ]; then + msg_error "The BOOTMODE setting is empty. Autobooting cannot continue." + exit 1 +fi + +BOOTMODE=$(echo $BOOTMODE | tr '[:upper:]' '[:lower:]') +msg_info "BOOTMODE is $BOOTMODE." + +if [ -f "/bootmodes/$BOOTMODE" ]; then + "/bootmodes/$BOOTMODE" + rv=$? + # + # If successful the BOOTMODE handler should not even return. + # If we get here its because of some sort of error. + # + if [ $rv -eq 0 ]; then + msg_error "The $BOOTMODE boot handler returned successfully. This is likely a bug. Autobooting cannot continue." + exit 1 + elif [ $rv -eq 200 ]; then + msg_error "The $BOOTMODE boot handler indicates an unrecoverable error. Autobooting cannot continue." + exit 1 + else + # Potentially recoverable error. Continue trying. + tryagain + fi +else + msg_error "BOOTMODE $BOOTMODE is not implemented. Autobooting cannot continue." + exit 1 +fi + diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/banner b/packages/base/all/initrds/loader-initrd-files/src/bin/banner new file mode 100755 index 00000000..54165d40 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/banner @@ -0,0 +1,42 @@ +#!/bin/sh +. /lib/msgs +. /lib/customize.sh + +field() +{ + if [ -n "$1" ]; then + echo "* $2" + fi + +} +ONL_PLATFORM=$(cat /etc/onl/platform) +MA1_ADDR=$(ifconfig ma1 | awk '/HWaddr/ { print tolower($5)}') + +echo "************************************************************" +echo "*" +echo "* $LOADER_SYSTEM_NAME $LOADER_LOADER_NAME" +echo "* " +field "$VERSION_ID" " Version: $VERSION_ID" +field "$VERSION_ID" " Id: $BUILD_ID" +echo "*" +field "$ONL_PLATFORM" " Platform: $ONL_PLATFORM" +field "MA1_ADDR" " ma1: $MA1_ADDR" +echo "*" +echo "************************************************************" +if [ -f /mnt/flash/boot-config ]; then + msg_info "boot-config" + cat /mnt/flash/boot-config +else + + if [ -f /bin/boot-config.py ]; then + if /bin/boot-config.py configure; then + echo "The system will now reboot to apply your configuration." + reboot + else + echo "The boot-config script failed." >> /etc/onl/abort + fi + else + msg_info "No boot-config" + fi +fi + diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/boot b/packages/base/all/initrds/loader-initrd-files/src/bin/boot new file mode 100755 index 00000000..1791ed36 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/boot @@ -0,0 +1,149 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# boot +# +# Handle booting SWI image locators. +# +############################################################ +set -e +unset testonly help cache + +while [ "$1" ]; do + case "$1" in + -h|--help) help=1 ;; + -t|--testonly) testonly=1 ;; + --cache) shift; cache="$1" ;; + *) break ;; + esac + shift +done +SWI=$1 + +mkdir -p /etc/onl + +if [ ! "${SWI}" ] || [ "${help}" ]; then + cat </tmp/swi0 + mv /tmp/swi0 /tmp/swi + swipath=/tmp/swi + ;; + tftp:*) + echo "Downloading ${SWI}" + eval $(echo "${SWI}" | sed -n 's#tftp://\([^/:]*\|\[[^]/]*\]\)\(:\([0-9]\+\)\)\?/\(.*\)#host="\1" port="\3" file="\4"#p') + tftp -g -r "${file}" -l /tmp/swi0 "${host}" ${port} + mv /tmp/swi0 /tmp/swi + swipath=/tmp/swi + ;; + nfs:*) + eval $(echo "${SWI}" | sed -n 's#nfs://\([^/:]*\|\[[^]/]*\]\)\(:\([0-9]\+\)\)\?\(.*\)/\(.*\)#host="\1" port="\3" dir="\4" file="\5"#p') + [ "${dir}" ] || dir=/ + [ "${port}" ] || port=0 + echo "Mounting nfs://${host}:${port}${dir}" + umount -l /tmp/nfs 2>/dev/null || : + mkdir -p /tmp/nfs + mount -t nfs -o "nolock,port=${port}" "${host}:${dir}" /tmp/nfs + if [ "${file}" ]; then + swipath="/tmp/nfs/${file}" + [ ! -d ${swipath} ] || { echo "${SWI} must be a SWI file (use ${SWI}/ for a SWI directory)"; exit 1; } + else + swipath=/tmp/nfs + [ -d "${swipath}/${rootfs}" ] || { echo "${SWI}${rootfs} must be an unpacked rootfs"; exit 1; } + mount -t nfs -o "nolock,port=${port}" "${host}:${dir}/${rootfs}" "${swipath}/${rootfs}" + fi + ;; + *) + # Parse dev:file or dev:/file or /mnt/dev/file + parselocal='s#\(\([^:/]*\):/\?\|/mnt/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p' + eval $(echo "${SWI}" | sed -n "${parselocal}") + if [ "${dev}" ] ; then + # Wait for /mnt/dev to show up + waitforblockdev "/mnt/${dev}" + else + # Assume file is relative, parse absolutified file + eval $(realpath "${file}" | sed -n "${parselocal}") + SWI="${dev}:${file}" + fi + swipath="/mnt/${dev}/${file}" + [ -f "${swipath}" ] || { echo "${SWI} not found or not a file"; exit 1; } + ;; +esac + +echo "SWI=${SWI}" >/etc/onl/boot-config +echo "CONSOLESPEED=$(stty speed)" >>/etc/onl/boot-config +PASSWORD=$(cat /etc/onl/PASSWORD) +[ ! "${PASSWORD}" ] || echo "PASSWORD=${PASSWORD}" >>/etc/onl/boot-config +if [ "${swipath#/tmp/nfs}" != "${swipath}" ]; then + ifget + cat /etc/onl/NET >>/etc/onl/boot-config +fi + +# +# Cache the SWI if necessary. +# +if [ -n "$cache" ]; then + python /bin/swicache.py "${swipath}" "${cache}" +fi + +. /lib/boot1 + +echo "Boot failed" +exit 1 diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/discoverbootconf b/packages/base/all/initrds/loader-initrd-files/src/bin/discoverbootconf new file mode 100644 index 00000000..c6d63bf1 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/discoverbootconf @@ -0,0 +1,119 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# discoverbootconf +# +# Discover the current boot configuration. +# +############################################################ + +. /lib/loader-functions || exit 1 + +intf=$1 + +if [ ! ${intf} ]; then + echo "Usage: $0 INTERFACE" + exit 1 +fi + +if ! ifconfig ${intf} >/dev/null 2>&1; then + echo "Interface ${intf} not found; can't discover boot configuration" + exit 1 +fi + +ifconfig ${intf} up +ip route add to 224.0.0.0/4 dev ${intf} + +zcip ${intf} + +rm -f /tmp/udhcpc.boot_file /tmp/udhcpc.pid +udhcpc -i ${intf} -b -t 1 -A 3 + +trap "exit 1" SIGINT +trap "kill \$(cat /tmp/udhcpc.pid); ifconfig ${intf} down" EXIT + +macaddr=$(ifconfig ${intf} | awk '/HWaddr/ { print tolower($5) }') +platform=$(cat /etc/onl/platform) + +# see if we are in (or if we want to be in) ZTN mode +# retrieve the cached state of the previous swi +swi_url_orig=$(sed -n -e 's/^SWI=\(.*\)/\1/p' /etc/onl/boot-config) +case "$swi_url_orig" in + "") + ZTN=1 + swi_url_orig="flash2:.ztn-onl.swi" + ;; + flash2:.ztn-onl.swi) + ZTN=1 + ;; + /mnt/flash2/.ztn-onl.swi) + ZTN=1 + swi_url_orig="flash2:.ztn-onl.swi" + ;; +esac + +if [ "$ZTN" ]; then + + waitforblockdev /mnt/flash2 + + if [ -f /mnt/flash2/.ztn-onl.swi ]; then + swi_md5_orig=$(md5sum /mnt/flash2/.ztn-onl.swi 2>/dev/null | awk '{print $1}') + fi + + if [ -f /mnt/flash2/.ztn-startup-config ]; then + cfg_md5_orig=$(md5sum /mnt/flash2/.ztn-startup-config 2>/dev/null | awk '{print $1}') + fi + +fi + +while true; do + echo "Looking for boot configuration; press Control-C to stop" + + dsc_dhcp_boot $intf $macaddr && exit + + if [ "$ZTN" ]; then + # borrow liberally from ONIE (rootconf/default/bin/discover) + + # ha ha, the wget IPv6 link local syntax is screwy + # (and also does not match upstream GNU wget) + ping6 -I ${intf} -c 3 ff02::1 > /dev/null 2>&1 + neighs6=$(ip -6 neigh show | awk '{printf("%s%%'$intf'\n", $1)}') + + ping -I ${intf} -w 2 -c 3 -q 255.255.255.255 > /dev/null 2>&1 + neighs=$(ip -4 neigh show | awk '{print $1}') + fi + + for a in $neighs6 $neighs; do + dsc_swi_manifest $macaddr $a && exit + done + + bootservers=$(cat /tmp/udhcpc.boot_file 2>/dev/null) + for a in ${bootservers} ff02::fb 224.0.0.251; do + dsc_dnssd $macaddr $a && exit + done + +done + +# Local variables: +# indent-tabs-mode: nil +# sh-basic-offset: 4 +# End: diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/help b/packages/base/all/initrds/loader-initrd-files/src/bin/help new file mode 100755 index 00000000..e4a276fb --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/help @@ -0,0 +1,50 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# help +# +# Loader Help +# +############################################################ + +cat < +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# ifget +# +# Scrape network interface settings into /etc/onl/NET +# +############################################################ +: >/etc/onl/NET + +NETDEV=$(ip -o link show up | sed -n -e '/LOOPBACK/d' -e 's/^[0-9]\+: \([^:]\+\): .*/\1/p' | head -n 1) +[ "${NETDEV}" ] || exit 0 + +echo "NETDEV=${NETDEV}" >>/etc/onl/NET + +if [ -f /tmp/udhcpc.pid ]; then + echo "NETAUTO=dhcp" >>/etc/onl/NET +else + set -- $(ip -o addr show dev ${NETDEV} | sed -n 's/^[0-9]\+: [^ ]\+ \+\([^ ]\+ [^ ]\+\) scope global.*/\1/p' | tail -n 1) + echo "NETIP=$2" >>/etc/onl/NET + if [ "$1" ]; then + echo "NETGW=$(ip -o -f $1 route show | sed -n 's/^default via \([^ ]\+\).*/\1/p')" >>/etc/onl/NET + fi + if [ -f /etc/resolv.conf ]; then + echo "NETDOMAIN=$(sed -n 's/search \+\([a-zA-Z0-9\.-]\+\).*/\1/p' /etc/resolv.conf)" >>/etc/onl/NET + echo "NETDNS=$(sed -n 's/nameserver \+\([0-9\.]\+\).*/\1/p' /etc/resolv.conf)" >>/etc/onl/NET + fi +fi + +echo "NETHW=$(ip -o link show dev ${NETDEV} | sed -n 's/^.*link\/ether \([0-9a-fA-F:]\+\).*/\1/p')" >>/etc/onl/NET diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup new file mode 100644 index 00000000..b9edbe67 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup @@ -0,0 +1,89 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# ifup +# +# Configure a network interface from settings in /etc/onl/NET +# NETDEV: device name +# NETAUTO: autoconfiguration method ("dhcp" or empty) +# NETIP: IP address (/prefix optional for v4) +# NETMASK: netmask (if NETIP has no prefix) +# NETGW: default gateway IP address (optional) +# NETDOMAIN: DNS default domain (optional) +# NETDNS: DNS server IP address (optional) +# NETHW: hardware (MAC) address (optional) +# +############################################################ + +unset NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW +. /etc/onl/NET + +[ "${NETDEV}" ] || exit + +if [ "${NETHW}" ]; then + ip link set dev ${NETDEV} addr ${NETHW} +fi + +case "${NETAUTO}" in + dhcp|auto) + echo 1 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf + udhcpc -i ${NETDEV} + ;; + up) + ifconfig "${NETDEV}" up + ;; + *) + if [ "${NETIP}" ] && [ "${NETMASK}" ] && [ "${NETIP#*/}" = "${NETIP}" ]; then + NETIP=${NETIP}/$(ipcalc -p -s ${NETIP} ${NETMASK} | sed -n 's/PREFIX=//p') + fi + ip link set ${NETDEV} down + echo 0 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf + ip addr flush dev ${NETDEV} + if [ "${NETIP}" ]; then + ip addr add ${NETIP} dev ${NETDEV} + fi + ip link set ${NETDEV} up + if [ "${NETGW}" ]; then + ip route add default via ${NETGW} + fi + >/etc/resolv.conf + if [ "${NETDOMAIN}" ]; then + echo "search ${NETDOMAIN}" >>/etc/resolv.conf + fi + if [ "${NETDNS}" ]; then + echo "nameserver ${NETDNS}" >>/etc/resolv.conf + fi + ;; +esac + +# +# If no network settings were applied, bring the interface up for link-local usage. +# +grep -q down "/sys/class/net/${NETDEV}/operstate" || ifconfig "${NETDEV}" up + +for i in $(seq 30); do + (ip -o -6 addr list dev ${NETDEV} | grep tentative >/dev/null) || break + if [ $i = 5 ]; then + echo "Waiting for IPv6 duplicate address detection to complete..." + fi + sleep 1 +done diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/initblockdev b/packages/base/all/initrds/loader-initrd-files/src/bin/initblockdev new file mode 100755 index 00000000..a98d2f24 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/initblockdev @@ -0,0 +1,82 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# initblockdev +# +# Initialize all block mounts for the platform. +# +############################################################ +set -e +exec 9<$0 +flock -x 9 +case $2 in + add) + eval $(echo $1 | sed "s#^\(mmcblk[0-9]*\|ubi[0-9]*_[0-9]*\|mtdblock[0-9]*\|[a-z]*\)\(p[0-9]*\|[0-9]*\).*#dev='\1' part='\2'#") + devid= + if [ -e /sys/class/ubi/${dev}/device ]; then + eval $(realpath /sys/class/ubi/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#") + fi + if [ -e /sys/class/block/${dev}/device ]; then + eval $(realpath /sys/class/block/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#") + fi + while read i n; do + expr match "$i" "#" >/dev/null && continue || : + [ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && mount=/mnt/$n && break || : + expr match "@${dev}" "$i" >/dev/null && mount=/mnt/$n && break || : + done /dev/null)" = "070701" ]; then + mount=${mount}-recover + else + mkdir -p ${mount} + [ $(stat -c %D ${mount}) = $(stat -c %D /mnt) ] + if [ "$(dd if=/dev/${dev}${part} bs=1 skip=82 count=5 2>/dev/null)" = "FAT32" ] \ + || [ "$(dd if=/dev/${dev}${part} bs=1 skip=54 count=5 2>/dev/null)" = "FAT16" ]; then + if [ ! -e /etc/onl/kdump ]; then + # Try to repair FAT filesystem automatically to prevent further + # damage (but skip it in kdump to save time and memory) + if dosfsck -a /dev/${dev}${part} >/dev/null 2>&1; then + : + else + dosfsck -n /dev/${dev}${part} >/dev/null 2>&1 + fi + dosfsck -a /dev/${dev}${part} >/dev/null 2>&1 || : + fi + mount -o flush,dirsync,noatime,umask=0007 /dev/${dev}${part} ${mount} 2>/dev/null + else + mount -o noatime /dev/${dev}${part} ${mount} 2>/dev/null + fi + fi + echo -e "devid='${devid}'\ndev='${dev}'\npart='${part}'" >${mount}.conf + ;; + remove) + mtab=$(mktemp /tmp/tmp.XXXXXX) + cp /proc/mounts ${mtab} + while read dev mount x; do + if [ /dev/$1 = "${dev}" ]; then + rm -f ${mount}.conf + umount -l ${mount} 2>/dev/null || : + fi + done <${mtab} + rm -f ${mtab} + ;; +esac diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/initmounts b/packages/base/all/initrds/loader-initrd-files/src/bin/initmounts new file mode 100755 index 00000000..6f4f0ff0 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/initmounts @@ -0,0 +1,275 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# initmounts +# +# Mount all mount points listed in /etc/onl/mounts +# +# Each line in /etc/onl/mounts is in the following syntax: +# +# /dev/sda sda mount-point +# - wait for /dev/sda to appear, +# then mount /dev/sda as /mnt/mount-point +# +# /dev/sda * mount-point +# - wait for block device /dev/sda to appear, +# then mount /dev/sda as /mnt/mount-point +# (infer /dev/sda from the left-hand path specification) +# +# block/sda sda mount-point +# block/sda * mount-point +# SYSDEV=block/sda sda mount-point +# SYSDEV=block/sda * mount-point +# - wait for /sys/block/sda to appear, +# then mount /mnt/sda as /mnt/mnt-point +# +# LABEL=MYDEV * mount-point +# LABEL="MYDEV" * mount-point +# - wait for a partition with the given label to appear +# (via polling 'blkid') +# then mount as /mnt/mnt-point +# +# UUID=some-uuid * mount-point +# UUID="some-uuid" * mount-point +# - wait for a partition with the given UUID to appear +# (via polling 'blkid') +# then mount as /mnt/mnt-point +# +# - multiple lines mapping to the same mount point can +# be listed in /etc/onl/mounts, the first one that +# is valid wins +# +# - initmounts exits with code zero (success) +# if each mount point is mounted once +# +# - initmounts exits with non-zero (failure) +# if un-mounted mount points are still remaining after 10s +# +############################################################ +exec 9<$0 +flock -x 9 + +CR=" +" +PATH=$PATH:/sbin:/usr/sbin + +recover="fsck" + +try_mount_block() +{ + local dev devpart mount + dev=$1; shift + devpart=$1; shift + mount=$1; shift + + if test -b "$dev"; then + + if test "$devpart" = "*"; then + devpart=`echo "$dev" | sed -e 's/^.*[/]//' ` + fi + + test -d /mnt/$mount || mkdir -p /mnt/$mount + if test "$recover" = "fsck"; then + if dosfsck -a /dev/$devpart; then + : + else + dosfsck -n /dev/$devpart || return + fi + else + dosfsck -n /dev/$devpart || return + fi + mount -o noatime /dev/$devpart /mnt/$mount || return + echo "mounted /dev/$devpart --> /mnt/$mount" + + fi +} + +try_mount_sysdev() +{ + local syspath devpart mount + syspath=$1; shift + devpart=$1; shift + mount=$1; shift + + if test -e /sys/$syspath; then + + if test "$devpart" = "*"; then + devpart=`echo "$syspath" | sed -e 's/^.*[/]//' ` + fi + + test -d /mnt/$mount || mkdir -p /mnt/$mount + if test "$recover" = "fsck"; then + if dosfsck -a /dev/$devpart; then + : + else + dosfsck -n /dev/$devpart || return + fi + else + dosfsck -n /dev/$devpart || return + fi + mount -o noatime /dev/$devpart /mnt/$mount || return + echo "mounted /dev/$devpart --> /mnt/$mount" + + fi +} + +try_mount_label() +{ + local label devpart mount + label=$1; shift + devpart=$1; shift + mount=$1; shift + + local ifs dummy line dev + ifs=$IFS; IFS=$CR + for line in `blkid`; do + IFS=$ifs + case " $line " in + *" LABEL=${label} "*) + dev=`echo "$line" | sed -e 's/:.*//'` + break + ;; + *" LABEL=\"${label}\" "*) + dev=`echo "$line" | sed -e 's/:.*//'` + break + ;; + esac + done + IFS=$ifs + + if test "$dev"; then + try_mount_block "$dev" "$devpart" "$mount" + fi +} + +try_mount_uuid() +{ + local uuid devpart mount + uuid=$1; shift + devpart=$1; shift + mount=$1; shift + + local ifs dummy line dev + ifs=$IFS; IFS=$CR + for line in `blkid`; do + IFS=$ifs + case " $line " in + *" UUID=${uuid} "*) + dev=`echo "$line" | sed -e 's/:.*//'` + break + ;; + *" UUID=\"${label}\" "*) + dev=`echo "$uuid" | sed -e 's/:.*//'` + break + ;; + esac + done + IFS=$ifs + + if test "$dev"; then + try_mount_block "$dev" "$devpart" "$mount" + fi +} + +try_mount() +{ + local devspec devpart mount + devspec=$1; shift + devpart=$1; shift + mount=$1; shift + + if grep " /mnt/$mount " /proc/mounts 1>/dev/null; then + return + fi + + local sysdev label uuid + + case "$devspec" in + /dev/*) + try_mount_block "$devspec" "$devpart" "$mount" + ;; + block/*) + try_mount_sysdev "$devspec" "$devpart" "$mount" + ;; + SYSDEV=\"*\") + sysdev=`echo "$devspec" | sed -e 's/SYSDEV=\"\(.*\)\"/\1/'` + try_mount_sysdev "$sysdev" "$devpart" "$mount" + ;; + SYSDEV=*) + sysdev=`echo "$devspec" | sed -e 's/SYSDEV=\(.*\)/\1/'` + try_mount_sysdev "$sysdev" "$devpart" "$mount" + ;; + LABEL=\"*\") + label=`echo "$devspec" | sed -e 's/LABEL=\"\(.*\)\"/\1/'` + try_mount_label "$label" "$devpart" "$mount" + ;; + LABEL=*) + label=`echo "$devspec" | sed -e 's/LABEL=\(.*\)/\1/'` + try_mount_label "$label" "$devpart" "$mount" + ;; + UUID=\"*\") + uuid=`echo "$devspec" | sed -e 's/UUID=\"\(.*\)\"/\1/'` + try_mount_uuid "$uuid" "$devpart" "$mount" + ;; + UUID=*) + uuid=`echo "$devspec" | sed -e 's/UUID=\(.*\)/\1/'` + try_mount_uuid "$uuid" "$devpart" "$mount" + ;; + *) + echo "*** invalid block specifier: $devspec" 1>&2 + ;; + esac +} + +visit_onl_mounts() +{ + local fn rest + fn=$1; shift + rest="$@" + + local ifs dummy line remain + remain=0 + ifs=$IFS; IFS=$CR + for line in $(cat /etc/onl/mounts); do + IFS=$ifs + + set -f + set dummy $line; shift + devspec=$1; shift + devpart=$1; shift + mount=$1; shift + + grep " /mnt/$mount " /proc/mounts 1>/dev/null && continue + remain=1 + eval $fn "$devspec" "$devpart" "$mount" $rest + + set +f + done + IFS=$ifs + + return $remain +} + +if test -f /etc/onl/mounts; then + timeout=10 + while test $timeout -gt 0; do + if visit_onl_mounts try_mount; then + echo "Found all mounts." + exit 0 + fi + sleep 1 + timeout=$(( $timeout - 1 )) + done + if test "$timeout" -eq 0; then + echo "Timed out waiting for block devices" + exit 1 + fi +fi diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/initnetdev b/packages/base/all/initrds/loader-initrd-files/src/bin/initnetdev new file mode 100755 index 00000000..95744fcc --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/initnetdev @@ -0,0 +1,52 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# initnetdev +# +# Initialize management interfaces specified in /etc/onl/net +# +# This maps the platform's management interface to well-known +# interface names (such as ma1) +# +############################################################ +set -e +exec 9<$0 +flock -x 9 +case $2 in + add) + dev=$1 + devid= + if [ -e /sys/class/net/${dev}/device ]; then + eval $(realpath /sys/class/net/${dev}/device | sed 's#/sys/devices/\(.*\)#devid=\1#') + fi + while read i n; do + expr match "$i" "#" >/dev/null && continue || : + [ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && name=$n && break || : + expr match "@${dev}" "$i" >/dev/null && name=$n && break || : + done &1 > /dev/null; then + ip link set dev ${dev} name ${name} + fi + ;; +esac diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/login b/packages/base/all/initrds/loader-initrd-files/src/bin/login new file mode 100644 index 00000000..9925dbc8 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/login @@ -0,0 +1,49 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# login +# +############################################################ + + +trap '' SIGINT + + +if ( + set -e + PASSWORD=$(cat /etc/onl/PASSWORD) + [ -z "${PASSWORD}" ] || checkpass -p "Password:" "${PASSWORD}" +) +then + + # Authenticated succeeded + + trap - SIGINT + exec sh --login + +else + + # Authentication failed + + echo "Authentication failed." + exit 1 +fi diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/netconf b/packages/base/all/initrds/loader-initrd-files/src/bin/netconf new file mode 100755 index 00000000..a7acd351 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/netconf @@ -0,0 +1,61 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# netconf +# +# +# User configuration of the management interface. +# +############################################################ + +[ "$1" = "-h" ] && { echo "Manually configures a management Ethernet interface"; exit; } + +echo "Management network interface configuration tool" +echo "(Press Control-C to cancel)" +echo "" + +unset NETDEV NETIP NETMASK NETGW NETDOMAIN NETDNS +read -p "Which interface (blank for ma1)? " NETDEV +[ "${NETDEV}" ] || NETDEV=ma1 +while [ ! "${NETIP}" ]; do + read -p "IP address (/prefix optional for v4)? " NETIP +done +if [ "${NETIP#*/}" = "${NETIP}" ]; then + while [ ! "${NETMASK}" ]; do + read -p "Netmask? " NETMASK + done +fi +read -p "Default gateway IP address (blank for none)? " NETGW +read -p "DNS IP address (blank for none)? " NETDNS +read -p "DNS default domain (blank for none)? " NETDOMAIN + +echo "" +echo "Configuring interface ${NETDEV}" + +echo "NETDEV=${NETDEV}" >/etc/onl/NET +echo "NETIP=${NETIP}" >>/etc/onl/NET +echo "NETMASK=${NETMASK}" >>/etc/onl/NET +echo "NETGW=${NETGW}" >>/etc/onl/NET +echo "NETDOMAIN=${NETDOMAIN}" >>/etc/onl/NET +echo "NETDNS=${NETDNS}" >>/etc/onl/NET + +ifup diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/recover b/packages/base/all/initrds/loader-initrd-files/src/bin/recover new file mode 100644 index 00000000..e69de29b diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/swicache.py b/packages/base/all/initrds/loader-initrd-files/src/bin/swicache.py new file mode 100644 index 00000000..24fba30f --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/swicache.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +import argparse +import os +import sys +import hashlib +import shutil +import logging + +logging.basicConfig() +logger = logging.getLogger("swicache") +logger.setLevel(logging.INFO) + +def filehash(fname, blocksize=1024*1024): + h = hashlib.sha1() + with open(fname,'rb') as f: + block = 0 + while block != b'': + block = f.read(blocksize) + h.update(block) + return h.hexdigest() + +def write_hash(fname, digest): + open(fname, "w").write(digest) + +def read_hash(fname): + return open(fname).read() + +ap = argparse.ArgumentParser(description="SWI Cacher") +ap.add_argument("src") +ap.add_argument("dst") +ap.add_argument("--force", action='store_true') + +ops = ap.parse_args() + +# Generate hash of the source file +logger.info("Generating hash for %s..." % ops.src) +src_hash = filehash(ops.src) +logger.info("Generated hash for %s: %s" % (ops.src, src_hash)) + +dst_hash_file = "%s.md5sum" % ops.dst + +if not ops.force: + if os.path.exists(ops.dst) and os.path.exists(dst_hash_file): + # Destination exists and the hash file exists. + dst_hash = read_hash(dst_hash_file) + if dst_hash == src_hash: + # Src and destination are the same. + logger.info("Cache file is up to date.") + sys.exit(0) + +# +# Either force==True, a destination file is missing, or the +# current file is out of date. +# +logger.info("Updating %s --> %s, %s" % (ops.src, ops.dst, src_hash)) +if not os.path.isdir(os.path.dirname(ops.dst)): + os.makedirs(os.path.dirname(ops.dst)) +shutil.copyfile(ops.src, ops.dst) +write_hash(dst_hash_file, src_hash); +logger.info("Syncing...") +os.system("sync") +logger.info("Done.") + + + diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/swiinfo b/packages/base/all/initrds/loader-initrd-files/src/bin/swiinfo new file mode 100755 index 00000000..2216bc7c --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/swiinfo @@ -0,0 +1,35 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# swiinfo +# +# Get the version information from the given SWI. +# +############################################################ + +set -e +[ -n "$1" ] && [ "$1" != "-h" ] || { echo "Usage: $0 SWI"; exit 1; } +swi=$1 +rm -f /tmp/version +unzip -l ${swi} +echo +unzip -pq ${swi} version diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/switchroot b/packages/base/all/initrds/loader-initrd-files/src/bin/switchroot new file mode 100644 index 00000000..91d08334 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/switchroot @@ -0,0 +1,60 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# switchroot +# +# This script is a wrapper for busybox switch_root, which works only if: +# - executed as PID 1 (i.e. replacing init) +# - /init is a regular file +# - /newroot is a tmpfs or ramfs +# - /newroot is a different filesystem from / +# +# The only way to execute as PID 1 with busybox init is to invoke it via +# the restart action in the inittab. +# +############################################################ + +# Unmount all filesystems except / and anything under /newroot +mtab=$(mktemp /tmp/tmp.XXXXXX) +cp /proc/mounts ${mtab} +while read dev mount x; do + case "${mount}" in + /|/proc|/sys|/dev|/newroot|/newroot/*) + ;; + *) + rm -f "${mount}".conf + umount -l "${mount}" 2>/dev/null + ;; + esac +done <${mtab} +rm -f ${mtab} + +mount --move /proc /newroot/proc +mount --move /sys /newroot/sys +mount --move /dev /newroot/dev + +# Switch to /newroot if possible, else re-execute /init +if [ -x /newroot/sbin/init ]; then + exec switch_root -c /dev/console /newroot /sbin/init +else + exec /init +fi diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit new file mode 100755 index 00000000..216ad7e0 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit @@ -0,0 +1,156 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# sysinit +# +# Busybox sysinit script. +# +############################################################ + +# Suppress console output until baud rate is set +exec 4>&1 1>/tmp/sysinit.out 2>&1 +restoreconsole() { cat /tmp/sysinit.out 1>&4; exec 1>&4 2>&4; >/tmp/sysinit.out; } +trap "restoreconsole; reboot -f" EXIT + + +# Mount special filesystems +mount -t proc proc /proc +mount -t sysfs sysfs /sys +mount -o remount,size=1M /dev + + +# Grab cmdline settings + +touch /etc/onl/boot-config +tr -s " " "\n" "/etc/onl/$filename" + ;; + esac +done + + +# Populate platform-specific settings +. /lib/platform-detect + +if [ ! -f /etc/onl/abort ]; then + + # Tell kernel to invoke mdev when devices are added or removed + echo /sbin/mdev >/proc/sys/kernel/hotplug + + + # Initialize any block and net devices already present + ( cd /sys/class/block; for d in *; do initblockdev $d add; done ) + if [ -d /sys/class/ubi ]; then + ( cd /sys/class/ubi; for d in *; do initblockdev $d add; done ) + fi + ( cd /sys/class/net; for d in *; do initnetdev $d add; done ) + + # Initialize platform mounts + initmounts + + # Perform recovery if necessary; reboot automatically + if /bin/recover; then + initmounts + else + restoreconsole + echo "Recovery failed." + echo "Press CR now to exit sysinit and access the loader shell." + echo "Otherwise, the system will reboot in 3s." + if read -t 3 prompt; then + trap - EXIT + exit + fi + reboot -f + fi + + + if [ -f /etc/issue ]; then + cat /etc/issue + fi + + waitforblockdev /mnt/flash + sleep 1 # wait for external block devices to be mounted + [ ! -f /mnt/flash/boot-config ] || cat /mnt/flash/boot-config >>/etc/onl/boot-config + + # + # Initialize the /mnt/flash/boot area. + # + mkdir -p /mnt/flash/boot + rm -rf /mnt/flash/boot/* +fi + + +# +# Initialize PKI +# +if [ -f /sbin/init-pki ]; then + /sbin/init-pki +fi + + +# Parse settings +touch /etc/onl/SWI /etc/onl/CONSOLESPEED /etc/onl/PASSWORD /etc/onl/NET /etc/onl/BOOTMODE /etc/onl/BOOTPARAMS +while read -r l; do + n=${l%%=*} + [ "$l" = "${l#*=}" ] && v= || v="${l#*=}" + case $n in + CONSOLESPEED) + echo "$v" >/etc/onl/CONSOLESPEED + ;; + PASSWORD) + echo "$v" >/etc/onl/PASSWORD + ;; + NET*) + echo "$l" >>/etc/onl/NET + ;; + BOOTMODE) + echo "$v" >/etc/onl/BOOTMODE + ;; + *) + if [ -n "$n" ]; then + echo "$n=$v" >> /etc/onl/BOOTPARAMS + fi + ;; + esac +done +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# udhcp +# +############################################################ +. /lib/customize.sh + +kill $(cat /tmp/udhcpc.pid 2>/dev/null) 2>/dev/null +exec busybox udhcpc -V $ONL_UDHCPC_VENDOR -p /tmp/udhcpc.pid -s /lib/udhcpc-script "$@" diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/waitforblockdev b/packages/base/all/initrds/loader-initrd-files/src/bin/waitforblockdev new file mode 100644 index 00000000..cea55477 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/waitforblockdev @@ -0,0 +1,36 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# waitforblockdev +# +# Wait for a block device to appear on $1, time out after +# 10 seconds +# +############################################################ + +local i=10 +while [ $i -gt 0 ]; do + grep -q " "$1" " /proc/mounts && break + sleep 1 + let i-- +done +[ $i -gt 0 ] || { echo "Timed out waiting for $1"; exit 1; } diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/waitforsysdev b/packages/base/all/initrds/loader-initrd-files/src/bin/waitforsysdev new file mode 100755 index 00000000..db37f0f4 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/waitforsysdev @@ -0,0 +1,31 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# waitforsysdev +# +# Wait for a sys device to appear (as $1), time out after +# a specified interval (10s by default) +# +############################################################ + +dev=$1; shift +if test $# -gt 0; then + timeout=$1; shift +else + timeout=10 +fi +local i=$timeout +while test $i -gt 0; do + find /sys/devices | grep $dev 1>/dev/null && break + sleep 1 + i=$(( $i - 1 )) +done +[ $i -gt 0 ] || { echo "Timed out waiting for $dev"; exit 1; } diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/wipe b/packages/base/all/initrds/loader-initrd-files/src/bin/wipe new file mode 100644 index 00000000..f8cd1823 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/wipe @@ -0,0 +1,36 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# wipe +# +############################################################ + +set -e +echo "All data on /mnt/flash will be erased; type \"yes\" and press Enter to proceed," +echo -n "or just press Enter to cancel: " +read arg +[ "${arg}" = "yes" ] || exit 1 +echo "Erasing /mnt/flash" +cd / +rm -rf /mnt/flash/* /mnt/flash/.[^.]* /mnt/flash/..?* +cd /mnt/flash +recover diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/zcip b/packages/base/all/initrds/loader-initrd-files/src/bin/zcip new file mode 100644 index 00000000..70a14c10 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/zcip @@ -0,0 +1,27 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# zcip +# +############################################################ + +exec busybox zcip "$1" /lib/zcip-script diff --git a/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi b/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi new file mode 100755 index 00000000..d1fa5d96 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/bootmodes/swi @@ -0,0 +1,35 @@ +############################################################ +# +# Bootmode: SWI +# +# Boot a SWI URL from the SWI BOOTPARAM value. +# +############################################################ +. /lib/msgs +. /etc/onl/BOOTPARAMS + +if [ ! "${SWI}" ]; then + msg_error "No SWI specified in the boot configuration. SWI booting cannot continue." + # Do not continue the autoboot sequence, nothing can be resolved automatically here. + exit 200 +fi + +if [ "${SWI}" = "flash2::latest" ]; then + # Boot the latest (by mtime) SWI in the flash2 partition. + SWI=`ls /mnt/flash2/*.swi -t | head -n1` + if [ -z "${SWI}" ]; then + msg_error "No SWI available in /mnt/flash2. SWI booting cannot continue." + exit 200 + fi +fi + + +# +# The SWI setting can be a list of URLs +# +for url in $SWI; do + msg_info "Trying ${url}..." + timeout -t 60 boot "${url}" && exit 0 +done + +exit 1 diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/filesystems b/packages/base/all/initrds/loader-initrd-files/src/etc/filesystems new file mode 100644 index 00000000..01350bea --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/filesystems @@ -0,0 +1,6 @@ +jffs2 +ubifs +vfat +ext4 +ext3 +ext2 diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/group b/packages/base/all/initrds/loader-initrd-files/src/etc/group new file mode 100644 index 00000000..ed76cd85 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/group @@ -0,0 +1,2 @@ +root:x:0: +tty:x:5: diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/hosts b/packages/base/all/initrds/loader-initrd-files/src/etc/hosts new file mode 100644 index 00000000..ba712fe0 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 localhost diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/inittab b/packages/base/all/initrds/loader-initrd-files/src/etc/inittab new file mode 100644 index 00000000..e2b1e3fb --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/inittab @@ -0,0 +1,12 @@ +# Run /bin/sysinit without a controlling tty so that job control +# cannot be used to circumvent password security +::sysinit:/bin/sysinit + +# Try booting automatically, start a shell if user interrupts it +::wait:-/bin/autoboot +::wait:-/bin/login +::wait:/bin/umount -a -r +::wait:/sbin/reboot -f + +# Try to switch to rootfs if init receives SIGHUP or SIGQUIT +::restart:/bin/switchroot diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/issue b/packages/base/all/initrds/loader-initrd-files/src/etc/issue new file mode 100644 index 00000000..e69de29b diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/mdev.conf b/packages/base/all/initrds/loader-initrd-files/src/etc/mdev.conf new file mode 100644 index 00000000..a1773b92 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/mdev.conf @@ -0,0 +1,4 @@ +[hs]d[a-z]+[0-9]* 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add} +mmcblk[0-9]+ 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add} +mmcblk[0-9]+p[0-9]+ 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add} +eth[0-9]+ 0:0 0660 */bin/initnetdev ${MDEV} ${ACTION:-add} diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/passwd b/packages/base/all/initrds/loader-initrd-files/src/etc/passwd new file mode 100644 index 00000000..eb85a552 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/passwd @@ -0,0 +1 @@ +root:x:0:0:root:/root:/bin/sh diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/profile b/packages/base/all/initrds/loader-initrd-files/src/etc/profile new file mode 100644 index 00000000..6a2ac05f --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/profile @@ -0,0 +1,21 @@ +#!/bin/sh +. /lib/customize.sh + +PS1=${ONL_PROMPT:-"loader# "} + +if [ -f /etc/onl/abort ]; then + PS1="loader(aborted)# " + echo + echo "************************************************************" + echo "*** Booting cannot continue." + echo "***" + echo "*** $(cat /etc/onl/abort)" + echo "***" + echo "************************************************************" + echo +fi + +echo +echo "Welcome to the $ONL_SYSTEM_NAME $ONL_SYSTEM_LOADER_NAME shell." +echo "Type 'help' for command help." +echo diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms b/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms new file mode 100644 index 00000000..8d76e780 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/rootperms @@ -0,0 +1,33 @@ +# See package/makedevs/README for details +# +# This device table is used to assign proper ownership and permissions +# on various files. It doesn't create any device file, as it is used +# in both static device configurations (where /dev/ is static) and in +# dynamic configurations (where devtmpfs, mdev or udev are used). +# +# +/dev d 755 0 0 - - - - - +/tmp d 1777 0 0 - - - - - +/etc d 755 0 0 - - - - - +/etc/shadow f 600 0 0 - - - - - +/etc/passwd f 644 0 0 - - - - - +/bin/autoboot f 755 0 0 - - - - - +/bin/boot f 755 0 0 - - - - - +/bin/discoverbootconf f 755 0 0 - - - - - +/bin/help f 755 0 0 - - - - - +/bin/ifget f 755 0 0 - - - - - +/bin/ifup f 755 0 0 - - - - - +/bin/initblockdev f 755 0 0 - - - - - +/bin/initnetdev f 755 0 0 - - - - - +/bin/login f 755 0 0 - - - - - +/bin/netconf f 755 0 0 - - - - - +/bin/recover f 755 0 0 - - - - - +/bin/swiinfo f 755 0 0 - - - - - +/bin/switchroot f 755 0 0 - - - - - +/bin/sysinit f 755 0 0 - - - - - +/bin/udhcpc f 755 0 0 - - - - - +/bin/waitforblockdev f 755 0 0 - - - - - +/bin/wipe f 755 0 0 - - - - - +/bin/zcip f 755 0 0 - - - - - +/lib/udhcpc-script f 755 0 0 - - - - - +/lib/zcip-script f 755 0 0 - - - - - diff --git a/packages/base/all/initrds/loader-initrd-files/src/etc/shadow b/packages/base/all/initrds/loader-initrd-files/src/etc/shadow new file mode 100644 index 00000000..d8eb9471 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/etc/shadow @@ -0,0 +1 @@ +root::10933:0:99999:7::: diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/boot1 b/packages/base/all/initrds/loader-initrd-files/src/lib/boot1 new file mode 100644 index 00000000..47348966 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/boot1 @@ -0,0 +1,105 @@ +# -*- sh -*- +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# boot1 +# +# Copies/mounts rootfs from swi and switches root +# +###################################################################### + +mkdir -p /newroot +umount -l /newroot 2>/dev/null || : + +if [ -d "${swipath}" ]; then + # rootfs is a directory + mount --bind "${swipath}/${rootfs}" /newroot +else + # rootfs is a squashfs + echo "Booting: ${swipath}" + mkdir -p /newroot.lower /newroot.upper + umount -l /newroot.lower 2>/dev/null || : + umount -l /newroot.upper 2>/dev/null || : + rm -f /tmp/rootfs + uarch=`uname -m` + + + if [ "$uarch" == "ppc" ]; then + # Try both rootfs-ppc and rootfs-powerpc + for arch in ppc powerpc; do + unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs + [ ! -s /tmp/rootfs ] || break + done + elif [ "$uarch" == "x86_64" ]; then + # Try both rootfs-amd64 and rootfs-x86_64 + for arch in x86_64 amd64; do + unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs + [ ! -s /tmp/rootfs ] || break + done + fi + + if [ ! -s /tmp/rootfs ]; then + echo "${swipath} does not contain a rootfs image for the current architecture ($uarch). Booting cannot continue." + exit 1 + fi + mount -t squashfs -o loop /tmp/rootfs /newroot.lower + mount -t tmpfs -o size=15%,mode=0755 none /newroot.upper + mount -t overlayfs -o lowerdir=/newroot.lower,upperdir=/newroot.upper none /newroot +fi + +mkdir -p /newroot/etc/onl +cp -R /etc/onl/* /newroot/etc/onl + +if [ -f /etc/fw_env.config ]; then + cat /etc/fw_env.config >/newroot/etc/fw_env.config +fi + +unzip -oq "${swipath}" swi-data.tar.gz -d /tmp + +# Install any SWI data packages. +if [ -s /tmp/swi-data.tar.gz ]; then + echo "Installing SWI data into /boot..." + tar -C /newroot/boot -xzf /tmp/swi-data.tar.gz +else + echo "No SWI data to install." +fi + +# If there is a SWI version file put it in /etc/onl/swi_version +unzip -oq "${swipath}" version -d /tmp +if [ -f /tmp/version ]; then + cp /tmp/version /newroot/etc/onl/swi_version + fi + +# +# The file /lib/boot-custom can be provided by customized builds to +# add functionality before the root is switched. +# +if [ -f /lib/boot-custom ]; then + . /lib/boot-custom +fi + +echo "Switching rootfs" # limit 16 chars since serial buffer is not flushed +kill -QUIT 1 # exec /bin/switchroot as PID 1 +sleep 30 + +# Local variables: +# sh-basic-offset: 4 +# End: diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/customize.sh b/packages/base/all/initrds/loader-initrd-files/src/lib/customize.sh new file mode 100644 index 00000000..8bd74bc3 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/customize.sh @@ -0,0 +1,11 @@ +LOADER_LOADER_NAME="Loader" +LOADER_PROMPT="loader# " +LOADER_UDHCPC_VENDOR="onl" +LOADER_SYSTEM_NAME="Open Network Linux" + +if [ -f /etc/onl/loader/versions.sh ]; then + . /etc/onl/loader/versions.sh +fi + + + diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/kdump b/packages/base/all/initrds/loader-initrd-files/src/lib/kdump new file mode 100644 index 00000000..aad33bd5 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/kdump @@ -0,0 +1,39 @@ +#-*-sh-*- +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# kdump +# +# TODO: turn off the phys to prevent network loops? +# TODO: trigger watchdog? +# +############################################################ + +waitforblockdev /mnt/flash || exit +echo "Entered kernel crash handler" +if ! vmcore-dmesg /proc/vmcore >/tmp/kernelcrash; then + echo "vmcore-dmesg failed; cannot dump kernel crash log" + return +fi +mkdir -p /mnt/flash/debug +cp /tmp/kernelcrash /mnt/flash/debug/ && echo "Wrote /mnt/flash/debug/kernelcrash" +echo "Last 50 lines of kernel crash log:" +tail -50 /mnt/flash/debug/kernelcrash diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/loader-functions b/packages/base/all/initrds/loader-initrd-files/src/lib/loader-functions new file mode 100644 index 00000000..45d491a0 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/loader-functions @@ -0,0 +1,212 @@ +# -*- sh -*- +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# loader-functions +# +# Loader support routines. +# +############################################################ + +############################## +# +# dsc_dhcp_boot INTF +# +# Grovel through the dhcp lease (udhcp) for a boot file entry. +# Return '0' for success (discovery can cease) +# Return '2' for undetermined (continue discovery) +# Anything else is an error +# +############################## + +dsc_dhcp_boot() +{ + local intf macaddr bootservers + intf=$1; shift + macaddr=$1; shift + bootservers=$(cat /tmp/udhcpc.boot_file 2>/dev/null) + case "$bootservers" in + SWI=*) + echo "Discovered boot configuration from DHCP" + echo "${bootservers#SWI=}" | sed "s/__macaddr__/${macaddr}/g;s/__platform__/${platform}/g" >/etc/onl/SWI + echo "NETDEV=${intf}" >/etc/onl/NET + echo "NETAUTO=dhcp" >>/etc/onl/NET + return 0 + ;; + esac + + # else, nothing to see here + return 2 +} + +############################## +# +# dsc_swi_manifest +# +# Download a SWI manifest and its components. +# Return '0' for success (discovery can cease) +# Return '2' for undetermined (continue discovery) +# Anything else is an error +# +# Enviromnent: +# $swi_md5_orig +# $cfg_md5_orig +# +############################## + +dsc_swi_manifest() +{ + local macaddr neigh + macaddr=$1; shift + neigh=$1; shift + + local url + local swi_url_mf swi_md5_new swi_md5_dl + local cfg_url_mf cfg_md5_new cfg_md5_dl + + rm -f /tmp/mf0 /tmp/swi0 /tmp/cfg0 + + url="http://${neigh}/ztn/switch/${macaddr}/switch_light_manifest" + echo "Trying $url" + wget -O /tmp/mf0 "$url" 1>/dev/null 2>&1 + test $? -eq 0 || return 2 + + echo "Discovered ONL manifest from neighbor discovery ($neigh)" + swi_url_mf=$(jq -M -r '.swi_url' < /tmp/mf0) + test "$swi_url_mf" || return 2 + + # see if there is a locally-cached SWI + swi_md5_new=$(jq -M -r '.swi_md5' < /tmp/mf0) + if [ "$swi_md5_new" = "$swi_md5_orig" ]; then + echo "Using cached ZTN SWI ($swi_url_orig)" + else + echo "Downloading new ZTN SWI $swi_url_mf" + wget -O /tmp/swi0 "$swi_url_mf" 1>/dev/null 2>&1 + test $? -eq 0 || return 2 + swi_md5_dl=$(md5sum /tmp/swi0 | awk '{print $1}') + if [ "$swi_md5_dl" != "$swi_md5_new" ]; then + echo "MD5 mismatch in downloaded SWI" + return 2 + fi + fi + + # Try to get a startup-config too + cfg_url_mf=$(jq -M -r '.startup_config_url' < /tmp/mf0) + if [ "$cfg_url_mf" ]; then + cfg_md5_new=$(jq -M -r '.startup_config_md5' < /tmp/mf0) + if [ "$cfg_md5_orig" = "$cfg_md5_new" ]; then + echo "Using cached ZTN startup-config" + else + echo "Downloading new startup-config $cfg_url_mf" + wget -O /tmp/cfg0 "$cfg_url_mf" 1>/dev/null 2>&1 + test $? -eq 0 || return 2 + cfg_md5_dl=$(md5sum /tmp/cfg0 | awk '{print $1}') + if [ "$cfg_md5_dl" != "$cfg_md5_new" ]; then + echo "MD5 mismatch in downloaded startup-config" + return 2 + fi + fi + fi + + if [ -f /tmp/swi0 ]; then + echo "Caching ZTN SWI $swi_url_mf --> /mnt/flash2/.ztn-onl.swi" + rm -f /mnt/flash2/.ztn-onl.swi + mv /tmp/swi0 /mnt/flash2/.ztn-onl.swi + fi + echo "$swi_url_orig" > /etc/onl/SWI + echo "$swi_url_mf" > /mnt/flash2/.ztn-onl.swi.url + + # startup-config is optional here + if [ -f /tmp/cfg0 ]; then + echo "Caching ZTN startup-config $cfg_url_mf --> /mnt/flash2/.ztn-startup-config" + rm -f /mnt/flash2/.ztn-startup-config + mv /tmp/cfg0 /mnt/flash2/.ztn-startup-config + fi + if [ "$cfg_url_mf" ]; then + echo "$cfg_url_mf" > /mnt/flash2/.ztn-startup-config.url + else + rm -f /mnt/flash2/.ztn-startup-config /mnt/flash2/.ztn-startup-config.url + fi + + return 0 +} + +############################## +# +# dsc_dsnssd +# +# Try to discover switch config (net and/or SWI) from DNS-SD +# +############################## + +dsc_dnssd() +{ + local macaddr dns + macaddr=$1; shift + dns=$1; shift + + local txt word key val + + echo "Trying $dns" + txt=$(dig +short +time=5 +tries=1 @$dns -p5353 ${macaddr}._slconfig._udp.local TXT) + test $? -eq 0 || return 2 + + echo "Discovered boot configuration from DNS-SD" + cp /dev/null /etc/onl/NET + for word in $txt; do + # words may be quoted + word=$(expr "$word" : '["]\?\(.*[^"]\)["]\?') + case "$word" in + *=*) + key=${word%%=*}; val=${word#$key=} + ;; + *) + key=$word; val= + ;; + esac + case "$key" in + SWI) + echo "$val" >/etc/onl/SWI + ;; + NET*) + echo "$val" >> /etc/onl/NET + ;; + FLASH) + echo "Getting flash::${val}..." + mkdir -p /tmp/flash + cd /tmp/flash && wget "$val" + + mv /tmp/flash/* /mnt/flash + rmdir /tmp/flash + ;; + esac + done + + # valid DNS-SD config for this platform, stop here + return 0 +} + +# Local variables: +# mode: sh +# indent-tabs-mode: nil +# sh-basic-offset: 4 +# End: diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/msgs b/packages/base/all/initrds/loader-initrd-files/src/lib/msgs new file mode 100644 index 00000000..b6a416cc --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/msgs @@ -0,0 +1,25 @@ +# -*- sh -*- +############################################################ +# +# Message logging. +# +############################################################ + +msg_info() +{ + echo "[ $@ ]" +} + +msg_error() +{ + echo + echo "************************************************************" + echo " ERROR " + echo + echo " $@" + echo + echo "************************************************************" + echo + sleep 1 +} + diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/platform-detect b/packages/base/all/initrds/loader-initrd-files/src/lib/platform-detect new file mode 100644 index 00000000..446b3c5c --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/platform-detect @@ -0,0 +1,87 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# platform-detect +# +# This script attempts to detect the current platform. +# +# Under normal circumstances the platform installer +# will have already set the platform in the boot arguments. +# +# This is a fallback for older platforms, corrupt +# boot arguments, or possible detection of misconfiguration. +# +############################################################ +. /lib/msgs + +platform_priority_detect() { + if [ ! -f /etc/onl/platform ]; then + for d in `find /lib/platform-config -name $1`; do + chmod +x ${d} + ${d} + if [ -f /etc/onl/platform ]; then + echo "platform auto-detect: $(cat /etc/onl/platform)" + break + fi + done + fi +} + +############################################################ +# +# Priority0 detection. +# +# Any platforms that want to preempt other platform detection +# routines should be named detect0.sh +# +platform_priority_detect detect0.sh + +############################################################ +# +# Normal priority detection. +platform_priority_detect detect.sh + +############################################################ +# +# Voluntary deprioritization wrt existing platforms. +platform_priority_detect detect1.sh + +if [ ! -f /etc/onl/platform ]; then + echo "unknown" > /etc/onl/platform +fi + +touch /etc/onl/net /etc/onl/block /etc/onl/mounts + +platform="$(cat /etc/onl/platform)" + +if [ -d /lib/platform-config/${platform} ]; then + # Grab and source the platform boot configuration file + x=/lib/platform-config/${platform}/onl/boot/${platform} + if [ -f $x ]; then + . $x + else + echo "The platform boot configuration for the current platform is broken, invalid, or missing." > /etc/onl/abort + fi +else + echo "The current platform (${platform}) is not supported in this version." > /etc/onl/abort +fi + diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/udhcpc-script b/packages/base/all/initrds/loader-initrd-files/src/lib/udhcpc-script new file mode 100755 index 00000000..cd0a62ea --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/udhcpc-script @@ -0,0 +1,41 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# udhcpc-script +# +############################################################ + +[ "${interface}" ] || exit + +case "$1" in + deconfig) + ifconfig ${interface} 0.0.0.0 + ;; + renew|bound) + ifconfig ${interface} ${ip} netmask ${subnet} + [ ! "${router}" ] || ip route add default via ${router} + : >/etc/resolv.conf + [ ! "${domain}" ] || echo "search ${domain}" >>/etc/resolv.conf + [ ! "${dns}" ] || echo "nameserver ${dns}" >>/etc/resolv.conf + [ ! "${boot_file}" ] || echo "${boot_file}" >/tmp/udhcpc.boot_file + ;; +esac diff --git a/packages/base/all/initrds/loader-initrd-files/src/lib/zcip-script b/packages/base/all/initrds/loader-initrd-files/src/lib/zcip-script new file mode 100644 index 00000000..00e2b8e7 --- /dev/null +++ b/packages/base/all/initrds/loader-initrd-files/src/lib/zcip-script @@ -0,0 +1,36 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# zcip-script +# +############################################################ + +[ "${interface}" ] || exit + +case "$1" in + deconfig) + ifconfig ${interface}:0 down + ;; + config) + ifconfig ${interface}:0 ${ip} netmask 255.255.0.0 + ;; +esac diff --git a/packages/base/all/vendor-config-onl/Makefile b/packages/base/all/vendor-config-onl/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/all/vendor-config-onl/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/all/vendor-config-onl/PKG.yml b/packages/base/all/vendor-config-onl/PKG.yml new file mode 100644 index 00000000..3122ba51 --- /dev/null +++ b/packages/base/all/vendor-config-onl/PKG.yml @@ -0,0 +1,15 @@ +packages: + - name: onl-vendor-config-onl + depends: python-yaml + version: 1.0.0 + arch: all + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + summary: ONL Base Configuration Package + + files: + src/python/onl : $PY_INSTALL/onl + src/init.d : /etc/init.d + src/bin : /usr/bin + + changelog: Changes diff --git a/packages/base/all/vendor-config-onl/src/bin/onl-platform-show b/packages/base/all/vendor-config-onl/src/bin/onl-platform-show new file mode 100755 index 00000000..721f861c --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/bin/onl-platform-show @@ -0,0 +1,4 @@ +#!/usr/bin/python +from onl.platform.current import OnlPlatform +print OnlPlatform() + diff --git a/packages/base/all/vendor-config-onl/src/init.d/onl-platform-baseconf b/packages/base/all/vendor-config-onl/src/init.d/onl-platform-baseconf new file mode 100755 index 00000000..718fa281 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/init.d/onl-platform-baseconf @@ -0,0 +1,17 @@ +#!/usr/bin/python + +### BEGIN INIT INFO +# Provides: onl-platform-baseconf +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set up ONL Platform +### END INIT INFO + +from onl.platform.baseconfig import baseconfig + +baseconfig() + + + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/__init__.py b/packages/base/all/vendor-config-onl/src/python/onl/__init__.py new file mode 100644 index 00000000..c71a523a --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/__init__.py @@ -0,0 +1,9 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/__init__.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/__init__.py new file mode 100644 index 00000000..c71a523a --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/__init__.py @@ -0,0 +1,9 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py new file mode 100644 index 00000000..9ee22bd8 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py @@ -0,0 +1,249 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ + +import pprint +import yaml +import json +import os + +class OnlInfoObject(object): + DEFAULT_INDENT=" " + + def __init__(self, d, klass=None): + self._data = d + if klass: + for (m,n) in klass.__dict__.iteritems(): + if m == m.upper(): + setattr(self, m, None) + + for (k,v) in d.iteritems(): + for (m,n) in klass.__dict__.iteritems(): + if n == k: + setattr(self, m, v); + break + + def __getattr__(self, name): + if name in self._data: + return self._data[name] + else: + return None + + def __str__(self, indent=DEFAULT_INDENT): + """String representation of the information container.""" + return OnlInfoObject.string(self._data, indent) + + @staticmethod + def string(d, indent=DEFAULT_INDENT): + return "\n".join( sorted("%s%s: %s" % (indent,k,v) for k,v in d.iteritems() if not k.startswith('_') and d[k] is not None) ) + + +############################################################ +# +# System-specific information keys. +# These represent information about a particular box. +# +############################################################ + +class OnieInfo(object): + PRODUCT_NAME='Product Name' + PART_NUMBER='Part Number' + SERIAL_NUMBER='Serial Number' + MAC_ADDRESS='MAC' + MAC_RANGE='MAC Range' + MANUFACTURER='Manufacturer' + MANUFACTURE_DATE='Manufacture Date' + VENDOR='Vendor' + PLATFORM_NAME='Platform Name' + DEVICE_VERSION='Device Version' + LABEL_REVISION='Label Revision' + COUNTRY_CODE='Country Code' + DIAG_VERSION='Diag Version' + SERVICE_TAG='Service Tag' + ONIE_VERSION='ONIE Version' + oids = { + PRODUCT_NAME : '.1', + PART_NUMBER : '.2', + SERIAL_NUMBER : '.3', + MAC_ADDRESS : '.4', + MAC_RANGE : '.5', + MANUFACTURER : '.6', + MANUFACTURE_DATE : '.7', + VENDOR : '.8', + PLATFORM_NAME : '.9', + DEVICE_VERSION : '.10', + LABEL_REVISION : '.11', + COUNTRY_CODE : '.12', + DIAG_VERSION : '.13', + SERVICE_TAG : '.14', + ONIE_VERSION : '.15', + } + + +############################################################ +# +# ONL Platform Base +# Baseclass for all OnlPlatform objects. +# +############################################################ +class OnlPlatformBase(object): + + CONFIG_DIR='/lib/platform-config' + CURRENT_DIR=os.path.join(CONFIG_DIR, 'current') + + def __init__(self): + self.add_info_json("onie_info", "%s/onie-info.json" % self.basedir_onl(), OnieInfo, + required=False) + self.add_info_json("platform_info", "%s/platform-info.json" % self.basedir_onl(), + required=False) + + def add_info_dict(self, name, d, klass=None): + setattr(self, name, OnlInfoObject(d, klass)) + + def add_info_json(self, name, f, klass=None, required=True): + if os.path.exists(f): + d = json.load(file(f)) + self.add_info_dict(name, d, klass) + elif required: + raise RuntimeError("A required system file (%s) is missing." % f) + + + + def load_configs(self, reload=False): + if reload or hasattr(self, 'configs') is False: + self.configs = {} + for subsys in os.listdir(self.basedir()): + cpath = os.path.join(self.basedir(), subsys, "configs") + if os.path.isdir(cpath): + for config in os.listdir(cpath): + with file(os.path.join(cpath, config)) as f: + if not subsys in self.configs: + self.configs[subsys] = {} + self.configs[subsys][config] = json.load(f) + + def basedir(self): + return os.path.join(self.CONFIG_DIR, self.platform()) + + def basedir_onl(self): + return os.path.join(self.basedir(), 'onl') + + def baseconfig(self): + return True + + def manufacturer(self): + raise Exception("Manufacturer is not set.") + + def model(self): + raise Exception("Model is not set.") + + def platform(self): + raise Exception("Platform is not set.") + + def description(self): + return "%s %s (%s)" % (self.manufacturer(), self.model(), + self.platform()) + + def serialnumber(self): + return self.onie_info.SERIAL_NUMBER + + def hw_description(self): + return "%s (%s)" % (self.onie_info.PRODUCT_NAME, + self.onie_info.PART_NUMBER) + + + # ONL Platform Information Tree + def opit_oid(self): + return "1.3.6.1.4.1.37538.2.1000" + + # ONL Platform Information General Tree + def opitg_oid(self): + return self.opit_oid() + ".1" + + # ONL Platform Information General Sys Tree + def opitg_sys_oid(self): + return self.opitg_oid() + ".1" + + # ONL Platform Information Vendor Tree + def opitv_oid(self): + return self.opit_oid() + ".2" + + def sys_oid_vendor(self): + return ".37538" + + def sys_oid_platform(self): + raise Exception("sys_oid_platform() is not set.") + + def sys_object_id(self): + return ( self.opitv_oid() + + self.sys_oid_vendor() + + self.sys_oid_platform()); + + + def new_device(self, driver, addr, bus, devdir): + if not os.path.exists(os.path.join(bus, devdir)): + try: + with open("%s/new_device" % bus, "w") as f: + f.write("%s 0x%x\n" % (driver, addr)) + except Exception, e: + print "Unexpected error initialize device %s:0x%x:%s: %s" % (driver, addr, bus, e) + else: + print("Device %s:%x:%s already exists." % (driver, addr, bus)) + + def new_devices(self, new_device_list): + for (driver, addr, bus, devdir) in new_device_list: + self.new_device(driver, addr, bus, devdir) + + def new_i2c_device(self, driver, addr, bus_number): + bus = '/sys/bus/i2c/devices/i2c-%d' % bus_number + devdir = "%d-%4.4x" % (bus_number, addr) + return self.new_device(driver, addr, bus, devdir) + + def new_i2c_devices(self, new_device_list): + for (driver, addr, bus_number) in new_device_list: + self.new_i2c_device(driver, addr, bus_number) + + def ifnumber(self): + # The default assumption for any platform + # is ma1 and lo + return 2 + + def __str__(self): + s = """Manufacturer: %s +Model: %s +Platform: %s +Description: %s +System Object Id: %s +System Information: +%s +%s +""" % ( + self.manufacturer(), + self.model(), + self.platform(), + self.description(), + self.sys_object_id(), + str(self.onie_info), + str(self.platform_info), + ) + + + if hasattr(self, 'warning'): + s += """ + +Warning: %s + +""" % (self.warning()) + return s + + + + + + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/baseconfig.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/baseconfig.py new file mode 100644 index 00000000..2aec8f0b --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/baseconfig.py @@ -0,0 +1,66 @@ +############################################################ +# +# Platform Base Configuration +# +############################################################ +import sys +import os +from onl.platform.base import OnlPlatformBase +from onl.platform.current import OnlPlatform +import shutil + +def msg(s, fatal=False): + sys.stderr.write(s) + sys.stderr.flush() + if fatal: + sys.exit(1) + +def baseconfig(): + + platform=OnlPlatform() + + msg("Setting up base ONL platform configuration for %s...\n" % + platform.platform()) + + if os.path.exists(OnlPlatform.CURRENT_DIR): + os.unlink(OnlPlatform.CURRENT_DIR) + + os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR) + + DEB_GNU_HOST_TYPE = None + HOST_TYPES = [ 'powerpc-linux-gnu', + 'i486-linux-gnu', + 'i386-linux-gnu', + 'x86_64-linux-gnu' ] + + for ht in HOST_TYPES: + if os.path.exists('/lib/%s' % ht): + DEB_GNU_HOST_TYPE=ht + break + + if DEB_GNU_HOST_TYPE is None: + msg("Could not determine the current host type.\n", fatal=True) + + DEFAULT_ONLP_LIB = "/lib/%s/libonlp-platform.so" % DEB_GNU_HOST_TYPE + PLATFORM_ONLP_LIB = "%s/lib/libonlp-%s.so" % (platform.basedir_onl(), platform.platform()) + + if os.path.exists(PLATFORM_ONLP_LIB): + if os.path.exists(DEFAULT_ONLP_LIB): + os.unlink(DEFAULT_ONLP_LIB) + os.symlink(PLATFORM_ONLP_LIB, DEFAULT_ONLP_LIB) + + ONLPDUMP = "%s/bin/onlpdump" % (platform.basedir_onl()) + + if not platform.baseconfig(): + msg("*** platform class baseconfig failed.\n", fatal=True) + + if os.path.exists(ONLPDUMP): + os.system("%s -i > %s/oids" % (ONLPDUMP,platform.basedir_onl())) + os.system("%s -o -j > %s/onie-info.json" % (ONLPDUMP, platform.basedir_onl())) + os.system("%s -x -j > %s/platform-info.json" % (ONLPDUMP, platform.basedir_onl())) + + msg("Setting up base platform configuration for %s: done\n" % + platform.platform()) + + + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py new file mode 100644 index 00000000..68606154 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/current.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# This file provides the container for the +# platform-specific class provided by the files in the +# platform-config packages. +# +############################################################ +import importlib + +def import_subsystem_platform_class(subsystem='onl', klass='OnlPlatform'): + # Determine the current platform name. + with open("/etc/onl/platform", 'r') as f: + platform=f.read().strip() + + platform_module = platform.replace('-', '_') + + # Import the platform module + m = importlib.import_module('%s.platform.%s' % (subsystem, platform_module)) + + return getattr(m, '%s_%s' % (klass, platform_module)) + + +OnlPlatform = import_subsystem_platform_class() + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/main.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/main.py new file mode 100644 index 00000000..dde3be48 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/main.py @@ -0,0 +1,24 @@ +#!/usr/bin/python +############################################################ +# +# Common commandline main implementation for platform +# testing. +# +############################################################ +import argparse + +def main(platform): + + ap = argparse.ArgumentParser(description="ONL Platform tool.") + + ap.add_argument("--info", action='store_true') + ap.add_argument("--env", action='store_true') + + ops = ap.parse_args() + + if ops.info: + print platform + + if ops.env: + print platform.get_environment() + diff --git a/packages/base/amd64/faultd/.gitignore b/packages/base/amd64/faultd/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/base/amd64/faultd/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/base/amd64/faultd/Makefile b/packages/base/amd64/faultd/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/faultd/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/amd64/faultd/PKG.yml b/packages/base/amd64/faultd/PKG.yml new file mode 100644 index 00000000..13dbec15 --- /dev/null +++ b/packages/base/amd64/faultd/PKG.yml @@ -0,0 +1,5 @@ +!include $ONL/packages/base/any/faultd/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu + + + + diff --git a/packages/base/amd64/faultd/builds/.gitignore b/packages/base/amd64/faultd/builds/.gitignore new file mode 100644 index 00000000..d3be4daa --- /dev/null +++ b/packages/base/amd64/faultd/builds/.gitignore @@ -0,0 +1,2 @@ +faultd.mk +faultd-module.mk diff --git a/packages/base/amd64/faultd/builds/Makefile b/packages/base/amd64/faultd/builds/Makefile new file mode 100644 index 00000000..aba3104e --- /dev/null +++ b/packages/base/amd64/faultd/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/faultd/builds/Makefile + diff --git a/packages/base/amd64/initrds/loader/Makefile b/packages/base/amd64/initrds/loader/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/initrds/loader/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/amd64/initrds/loader/PKG.yml b/packages/base/amd64/initrds/loader/PKG.yml new file mode 100644 index 00000000..9badcf4a --- /dev/null +++ b/packages/base/amd64/initrds/loader/PKG.yml @@ -0,0 +1 @@ +!include $ONL/packages/base/any/initrds/loader/APKG.yml ARCH=amd64 diff --git a/packages/base/amd64/initrds/loader/builds/.gitignore b/packages/base/amd64/initrds/loader/builds/.gitignore new file mode 100644 index 00000000..1b4a5fd6 --- /dev/null +++ b/packages/base/amd64/initrds/loader/builds/.gitignore @@ -0,0 +1,3 @@ +loader-rootfs +buildroot-makedevs +manifest.json diff --git a/packages/base/amd64/initrds/loader/builds/Makefile b/packages/base/amd64/initrds/loader/builds/Makefile new file mode 100644 index 00000000..34302324 --- /dev/null +++ b/packages/base/amd64/initrds/loader/builds/Makefile @@ -0,0 +1,2 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/initrds/loader/builds/Makefile diff --git a/packages/base/amd64/onlp/Makefile b/packages/base/amd64/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/amd64/onlp/PKG.yml b/packages/base/amd64/onlp/PKG.yml new file mode 100644 index 00000000..89193a43 --- /dev/null +++ b/packages/base/amd64/onlp/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/onlp/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu + diff --git a/packages/base/amd64/onlp/builds/.gitignore b/packages/base/amd64/onlp/builds/.gitignore new file mode 100644 index 00000000..d850afd1 --- /dev/null +++ b/packages/base/amd64/onlp/builds/.gitignore @@ -0,0 +1 @@ +libonlp-module.mk diff --git a/packages/base/amd64/onlp/builds/Makefile b/packages/base/amd64/onlp/builds/Makefile new file mode 100644 index 00000000..1a15e2fe --- /dev/null +++ b/packages/base/amd64/onlp/builds/Makefile @@ -0,0 +1,3 @@ +DIRECTORIES := onlp-platform-defaults onlp-platform onlp +include $(ONL)/make/subdirs.mk + diff --git a/packages/base/amd64/onlp/builds/onlp-platform-defaults/.gitignore b/packages/base/amd64/onlp/builds/onlp-platform-defaults/.gitignore new file mode 100644 index 00000000..4e86ab53 --- /dev/null +++ b/packages/base/amd64/onlp/builds/onlp-platform-defaults/.gitignore @@ -0,0 +1 @@ +libonlp-platform-defaults-module.mk diff --git a/packages/base/amd64/onlp/builds/onlp-platform-defaults/Makefile b/packages/base/amd64/onlp/builds/onlp-platform-defaults/Makefile new file mode 100644 index 00000000..e3ae5051 --- /dev/null +++ b/packages/base/amd64/onlp/builds/onlp-platform-defaults/Makefile @@ -0,0 +1,2 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile diff --git a/packages/base/amd64/onlp/builds/onlp-platform/.gitignore b/packages/base/amd64/onlp/builds/onlp-platform/.gitignore new file mode 100644 index 00000000..8979873a --- /dev/null +++ b/packages/base/amd64/onlp/builds/onlp-platform/.gitignore @@ -0,0 +1 @@ +libonlp-platform-module.mk diff --git a/packages/base/amd64/onlp/builds/onlp-platform/Makefile b/packages/base/amd64/onlp/builds/onlp-platform/Makefile new file mode 100644 index 00000000..88a9ebad --- /dev/null +++ b/packages/base/amd64/onlp/builds/onlp-platform/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/onlp/builds/onlp-platform/Makefile + diff --git a/packages/base/amd64/onlp/builds/onlp/Makefile b/packages/base/amd64/onlp/builds/onlp/Makefile new file mode 100644 index 00000000..0e5518bd --- /dev/null +++ b/packages/base/amd64/onlp/builds/onlp/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/onlp/builds/onlp/Makefile + diff --git a/packages/base/amd64/rootfs/.gitignore b/packages/base/amd64/rootfs/.gitignore new file mode 100644 index 00000000..b2918169 --- /dev/null +++ b/packages/base/amd64/rootfs/.gitignore @@ -0,0 +1 @@ +*.d/ diff --git a/packages/base/amd64/rootfs/Makefile b/packages/base/amd64/rootfs/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/base/amd64/rootfs/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/base/amd64/rootfs/PKG.yml b/packages/base/amd64/rootfs/PKG.yml new file mode 100644 index 00000000..f7a80d0b --- /dev/null +++ b/packages/base/amd64/rootfs/PKG.yml @@ -0,0 +1 @@ +!include $ONL/packages/base/any/rootfs/APKG.yml ARCH=amd64 diff --git a/packages/base/amd64/rootfs/builds/.gitignore b/packages/base/amd64/rootfs/builds/.gitignore new file mode 100644 index 00000000..2ddf5f27 --- /dev/null +++ b/packages/base/amd64/rootfs/builds/.gitignore @@ -0,0 +1 @@ +manifest.json diff --git a/packages/base/amd64/rootfs/builds/Makefile b/packages/base/amd64/rootfs/builds/Makefile new file mode 100644 index 00000000..aa896dda --- /dev/null +++ b/packages/base/amd64/rootfs/builds/Makefile @@ -0,0 +1,16 @@ +include $(ONL)/make/config.amd64.mk + +# +# Default to include all available amd64 platforms. +# You override this with you own list or yaml file. +# +export PLATFORM_LIST=$(shell onlpm --list-platforms --arch amd64 --csv ) + +RFS_CONFIG := $(ONL)/packages/base/any/rootfs/standard/standard.yml +RFS_DIR := rootfs-amd64.d +RFS_CPIO := rootfs-amd64.cpio.gz +RFS_SQUASH := rootfs-amd64.sqsh + +include $(ONL)/make/rfs.mk + + diff --git a/packages/base/any/faultd/APKG.yml b/packages/base/any/faultd/APKG.yml new file mode 100644 index 00000000..fbcd0bef --- /dev/null +++ b/packages/base/any/faultd/APKG.yml @@ -0,0 +1,22 @@ +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-faultd + version: 1.0.0 + summary: Fault Reporting Daemon + provides: [ faultd ] + + files: + builds/$BUILD_DIR/${TOOLCHAIN}/bin/faultd.bin : /usr/bin/faultd + + init: ${ONL}/packages/base/any/faultd/faultd.init + + changelog: Change changes changes., + + + + diff --git a/packages/base/any/faultd/builds/Makefile b/packages/base/any/faultd/builds/Makefile new file mode 100644 index 00000000..1e58f391 --- /dev/null +++ b/packages/base/any/faultd/builds/Makefile @@ -0,0 +1,57 @@ +# -*- Makefile -*- +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +include $(ONL)/make/config.mk + +ifndef TOOLCHAIN +$(error $$TOOLCHAIN must be specified.) +else +export TOOLCHAIN +endif + +MODULE := faultd-module +include $(BUILDER)/standardinit.mk + +LIBRARY := faultd-main +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk + + +DEPENDMODULES := faultd AIM + +include $(BUILDER)/dependmodules.mk + +BINARY := faultd.bin +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +include $(BUILDER)/targets.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_PVS_SYSLOG=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_DAEMONIZE=1 +GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_MAIN=1 +GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_AIM_MAIN=1 +GLOBAL_CFLAGS += -g + +GLOBAL_LINK_LIBS += -lpthread + diff --git a/packages/base/any/faultd/faultd.init b/packages/base/any/faultd/faultd.init new file mode 100644 index 00000000..c7571115 --- /dev/null +++ b/packages/base/any/faultd/faultd.init @@ -0,0 +1,66 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: faultd +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start Faultd Agent +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +. /lib/lsb/init-functions + +DAEMON=/usr/bin/faultd +PIDFILE=/var/run/faultd.pid +FAULTD_OPTS="-dr -pid $PIDFILE" +QUIET= + +test -x $DAEMON || exit 5 + +RUNASUSER=root +UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true + +case $1 in + start) + log_daemon_msg "Starting Fault Agent" "faultd" + if [ -z "$UGID" ]; then + log_failure_msg "user \"$RUNASUSER\" does not exist" + exit 1 + fi + start-stop-daemon --start $QUIET --oknodo --pidfile $PIDFILE --startas $DAEMON -- $FAULTD_OPTS $FAULTD_EXTRA_OPTS + status=$? + log_end_msg $status + ;; + stop) + log_daemon_msg "Stopping Fault Agent" "faultd" + start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE + log_end_msg $? + rm -f $PIDFILE + ;; + restart|force-reload) + $0 stop && sleep 2 && $0 start + ;; + try-restart) + if $0 status >/dev/null; then + $0 restart + else + exit 0 + fi + ;; + reload) + log_daemon_msg "Reloading Fault Agent" "faultd" + start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE --signal 1 + status=$? + log_end_msg $status + ;; + status) + status_of_proc $DAEMON "Fault Agent" + ;; + *) + echo "Usage: $0 {start|stop|restart|try-restart|force-reload|reload|status}" + exit 2 + ;; +esac diff --git a/packages/base/any/faultd/src/.gitignore b/packages/base/any/faultd/src/.gitignore new file mode 100644 index 00000000..f479fcb8 --- /dev/null +++ b/packages/base/any/faultd/src/.gitignore @@ -0,0 +1,2 @@ +/faultd.mk +/doc diff --git a/packages/base/any/faultd/src/Makefile b/packages/base/any/faultd/src/Makefile new file mode 100644 index 00000000..c78c32eb --- /dev/null +++ b/packages/base/any/faultd/src/Makefile @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +include $(ONL)/make/config.mk + +MODULE := faultd +AUTOMODULE := faultd +ifndef BUILDER +$(error "$$BUILDER must be specified.") +endif +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/faultd/src/README b/packages/base/any/faultd/src/README new file mode 100644 index 00000000..598ea203 --- /dev/null +++ b/packages/base/any/faultd/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# faultd README +# +############################################################################### + diff --git a/packages/base/any/faultd/src/faultd.doxy b/packages/base/any/faultd/src/faultd.doxy new file mode 100644 index 00000000..6b77f058 --- /dev/null +++ b/packages/base/any/faultd/src/faultd.doxy @@ -0,0 +1,1792 @@ +# Doxyfile 1.8.1.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "faultd" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Fault Management Daemon." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/faultd/src/module/auto/faultd.yml b/packages/base/any/faultd/src/module/auto/faultd.yml new file mode 100644 index 00000000..a2ea33d9 --- /dev/null +++ b/packages/base/any/faultd/src/module/auto/faultd.yml @@ -0,0 +1,86 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# faultd Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- FAULTD_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- FAULTD_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- FAULTD_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- FAULTD_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: FAULTD_CONFIG_PORTING_STDLIB +- FAULTD_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- FAULTD_CONFIG_PIPE_NAME_DEFAULT: + doc: "Default named pipe." + default: "\"/var/run/faultd.pipe\"" +- FAULTD_CONFIG_BINARY_SIZE: + doc: "Maximum binary name size." + default: 255 +- FAULTD_CONFIG_BACKTRACE_SIZE_MAX: + doc: "Maximum backtrace size." + default: 32 +- FAULTD_CONFIG_SERVICE_PIPES_MAX: + doc: "Maximum number of simulatanous service pipes." + default: 8 +- FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE: + doc: "Maximum backtrace symbols size" + default: 4096 +- FAULTD_CONFIG_INCLUDE_MAIN: + doc: "Include faultd_main() for standard faultd daemon build." + default: 0 +- FAULTD_CONFIG_INCLUDE_AIM_MAIN: + doc: "Include aim_main() as faultd_main()." + default: FAULTD_CONFIG_INCLUDE_MAIN +- FAULTD_CONFIG_MAIN_PIPENAME: + doc: "Default pipename used by faultd_main() if included." + default: "\"/var/run/faultd.fifo\"" + + +definitions: + cdefs: + FAULTD_CONFIG_HEADER: + defs: *cdefs + basename: faultd_config + + portingmacro: + FAULTD: + macros: + - memset + - memcpy + - strncpy + - strlen diff --git a/packages/base/any/faultd/src/module/auto/make.mk b/packages/base/any/faultd/src/module/auto/make.mk new file mode 100644 index 00000000..07f6d0f8 --- /dev/null +++ b/packages/base/any/faultd/src/module/auto/make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# faultd Autogeneration +# +############################################################ +faultd_AUTO_DEFS := module/auto/faultd.yml +faultd_AUTO_DIRS := module/inc/faultd module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/faultd/src/module/inc/faultd/faultd.h b/packages/base/any/faultd/src/module/inc/faultd/faultd.h new file mode 100644 index 00000000..fb7e92db --- /dev/null +++ b/packages/base/any/faultd/src/module/inc/faultd/faultd.h @@ -0,0 +1,205 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + *****************************************************************************/ +#ifndef __FAULTD_H__ +#define __FAULTD_H__ + +#include +#include + +/** + * This structure contains the full fault information. + * + * This structure will be filled out by the fault handler + * + */ +typedef struct faultd_info_s { + /** Service pipe name - Server side only */ + char* pipename; + + /** The full name and path of the process binary */ + char binary[FAULTD_CONFIG_BINARY_SIZE]; + + /** The pid of the process */ + pid_t pid; + /** The kernel thread id of the process */ + pid_t tid; + + /** The signal number that caused the fault. */ + int signal; + /** The signal code for the fault. */ + int signal_code; + /** Offending address, if applicable. */ + void* fault_address; + + /** The last value of errno at the time of the fault */ + int last_errno; + + /** The size of this backtrace */ + int backtrace_size; + /** The backtrace */ + void* backtrace[FAULTD_CONFIG_BACKTRACE_SIZE_MAX]; + + /** + * This will store the output from backtrace_symbols_fd(). + * + * When writing the message to the pipe, set it to non-zero. + * The reader will then read additional bytes until the null + * terminating byte is found. + * + * The pointer will then be replaced on the receiving side. + * + */ + char* backtrace_symbols; + +} faultd_info_t; + + + +/**************************************************************************//** + * + * FaultD Servers + * + * + *****************************************************************************/ +typedef struct faultd_server_s faultd_server_t; + +typedef int faultd_sid_t; + +/** + * @brief Create a faultd server object. + * @param rfso Receives the faultd_server object. + */ +int faultd_server_create(faultd_server_t** rfso); + +/** + * @brief Destroy a server object. + * @param fco The faultd server object. + */ +void faultd_server_destroy(faultd_server_t* fco); + +/** + * @brief Add a named pipe service to the server. + * @param fso The faultd server object. + * @param pipename The name of the pipe. + * @returns The service id. + * @note FAULTD_CONFIG_PIPE_NAME_DEFAULT will be used if pipename is NULL. + */ +faultd_sid_t faultd_server_add(faultd_server_t* fso, char* pipename); + +/** + * @brief Remove a named pipe service. + * @param fso The faultd server object. + * @param pipename The name of the pipe. + * @param sid The service id. + * + * @note You can remove either by pipename or servicename. + */ +int faultd_server_remove(faultd_server_t* fso, char* pipename, + faultd_sid_t sid); + +/** + * @brief Read a fault message from any service pipe. + * @param fso The faultd server object. + * @param info The fault information. + * @note if sid == -1, all services will be polled. + * @note else the given service will be polled. + * @returns The sid from which the message was received. + */ +int faultd_server_read(faultd_server_t* fso, faultd_info_t* info, + faultd_sid_t sid); + + +/** + * @brief Read and report all messages on all service pipes. + * @param fso The fault descriptor. + * @param sid The fault service. + * @param count Process at most 'count' messages. + * @param pvs The output pvs passed to fauld_info_show() + * @param decode Passed to faultd_info_show() + * @note if count is -1, process forever. + */ +int faultd_server_process(faultd_server_t* fso, faultd_sid_t sid, + int count, aim_pvs_t* pvs, int decode); + + +/**************************************************************************//** + * + * faultd Clients + * + * + *****************************************************************************/ +typedef struct faultd_client_s faultd_client_t; + +/** + * @brief Create a faultd client object. + * @param fco Receives the faultd client object. + * @param pipename The named pipe filename. + * @note FAULTD_CONFIG_PIPE_NAME_DEFAULT will be used if pipename is NULL. + */ +int faultd_client_create(faultd_client_t** fco, const char* pipename); + +/** + * @brief Send a fault message to the server. + * @param fco The faultd client object. + * @param info The fault information. + * @note If backtrace_symbols is not NULL, the + * backtrace_symbols_fd() will be called on the backtrace + * and included in the report. + */ +int faultd_client_write(faultd_client_t* fco, faultd_info_t* info); + +/** + * @brief Destroy a client object. + * @param fco The faultd client object. + */ +void faultd_client_destroy(faultd_client_t* fco); + + +/**************************************************************************//** + * + * faultd Hander + * + * + *****************************************************************************/ +int faultd_handler_register(int localfd, + const char* pipename, + const char* binaryname); + + +/**************************************************************************//** + * + * Common + * + * + *****************************************************************************/ + +/** + * @brief Output the fault message information to the given PVS. + * @param info The fault message. + * @param pvs The output pvs. + * @param decode If set, the backtrace will be processing through addr2line + */ +int faultd_info_show(faultd_info_t* info, aim_pvs_t* pvs, int decode); + + +#endif /* __FAULTD_H__ */ diff --git a/packages/base/any/faultd/src/module/inc/faultd/faultd.x b/packages/base/any/faultd/src/module/inc/faultd/faultd.x new file mode 100644 index 00000000..65b75329 --- /dev/null +++ b/packages/base/any/faultd/src/module/inc/faultd/faultd.x @@ -0,0 +1,32 @@ +/* -*- C -*- + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + */ + +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/base/any/faultd/src/module/inc/faultd/faultd_config.h b/packages/base/any/faultd/src/module/inc/faultd/faultd_config.h new file mode 100644 index 00000000..4a376845 --- /dev/null +++ b/packages/base/any/faultd/src/module/inc/faultd/faultd_config.h @@ -0,0 +1,226 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + * @file + * @brief faultd Configuration Header + * + * @addtogroup faultd-config + * @{ + * + *****************************************************************************/ +#ifndef __FAULTD_CONFIG_H__ +#define __FAULTD_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef FAULTD_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * FAULTD_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef FAULTD_CONFIG_INCLUDE_LOGGING +#define FAULTD_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * FAULTD_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef FAULTD_CONFIG_LOG_OPTIONS_DEFAULT +#define FAULTD_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * FAULTD_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef FAULTD_CONFIG_LOG_BITS_DEFAULT +#define FAULTD_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * FAULTD_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef FAULTD_CONFIG_PORTING_STDLIB +#define FAULTD_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS FAULTD_CONFIG_PORTING_STDLIB +#endif + +/** + * FAULTD_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef FAULTD_CONFIG_INCLUDE_UCLI +#define FAULTD_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * FAULTD_CONFIG_PIPE_NAME_DEFAULT + * + * Default named pipe. */ + + +#ifndef FAULTD_CONFIG_PIPE_NAME_DEFAULT +#define FAULTD_CONFIG_PIPE_NAME_DEFAULT "/var/run/faultd.pipe" +#endif + +/** + * FAULTD_CONFIG_BINARY_SIZE + * + * Maximum binary name size. */ + + +#ifndef FAULTD_CONFIG_BINARY_SIZE +#define FAULTD_CONFIG_BINARY_SIZE 255 +#endif + +/** + * FAULTD_CONFIG_BACKTRACE_SIZE_MAX + * + * Maximum backtrace size. */ + + +#ifndef FAULTD_CONFIG_BACKTRACE_SIZE_MAX +#define FAULTD_CONFIG_BACKTRACE_SIZE_MAX 32 +#endif + +/** + * FAULTD_CONFIG_SERVICE_PIPES_MAX + * + * Maximum number of simulatanous service pipes. */ + + +#ifndef FAULTD_CONFIG_SERVICE_PIPES_MAX +#define FAULTD_CONFIG_SERVICE_PIPES_MAX 8 +#endif + +/** + * FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE + * + * Maximum backtrace symbols size */ + + +#ifndef FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE +#define FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE 4096 +#endif + +/** + * FAULTD_CONFIG_INCLUDE_MAIN + * + * Include faultd_main() for standard faultd daemon build. */ + + +#ifndef FAULTD_CONFIG_INCLUDE_MAIN +#define FAULTD_CONFIG_INCLUDE_MAIN 0 +#endif + +/** + * FAULTD_CONFIG_INCLUDE_AIM_MAIN + * + * Include aim_main() as faultd_main(). */ + + +#ifndef FAULTD_CONFIG_INCLUDE_AIM_MAIN +#define FAULTD_CONFIG_INCLUDE_AIM_MAIN FAULTD_CONFIG_INCLUDE_MAIN +#endif + +/** + * FAULTD_CONFIG_MAIN_PIPENAME + * + * Default pipename used by faultd_main() if included. */ + + +#ifndef FAULTD_CONFIG_MAIN_PIPENAME +#define FAULTD_CONFIG_MAIN_PIPENAME "/var/run/faultd.fifo" +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct faultd_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} faultd_config_settings_t; + +/** Configuration settings table. */ +/** faultd_config_settings table. */ +extern faultd_config_settings_t faultd_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* faultd_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int faultd_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "faultd_porting.h" + +#endif /* __FAULTD_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/faultd/src/module/inc/faultd/faultd_dox.h b/packages/base/any/faultd/src/module/inc/faultd/faultd_dox.h new file mode 100644 index 00000000..62d0f2df --- /dev/null +++ b/packages/base/any/faultd/src/module/inc/faultd/faultd_dox.h @@ -0,0 +1,45 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + * faultd Doxygen Header + * + *****************************************************************************/ +#ifndef __FAULTD_DOX_H__ +#define __FAULTD_DOX_H__ + +/** + * @defgroup faultd faultd - faultd Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup faultd-faultd Public Interface + * @defgroup faultd-config Compile Time Configuration + * @defgroup faultd-porting Porting Macros + * + * @} + * + */ + +#endif /* __FAULTD_DOX_H__ */ diff --git a/packages/base/any/faultd/src/module/inc/faultd/faultd_porting.h b/packages/base/any/faultd/src/module/inc/faultd/faultd_porting.h new file mode 100644 index 00000000..c2212095 --- /dev/null +++ b/packages/base/any/faultd/src/module/inc/faultd/faultd_porting.h @@ -0,0 +1,86 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + * @file + * @brief faultd Porting Macros. + * + * @addtogroup faultd_porting + * @{ + * + *****************************************************************************/ +#ifndef __FAULTD_PORTING_H__ +#define __FAULTD_PORTING_H__ + + +/* */ +#if FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef FAULTD_MEMSET + #if defined(GLOBAL_MEMSET) + #define FAULTD_MEMSET GLOBAL_MEMSET + #elif FAULTD_CONFIG_PORTING_STDLIB == 1 + #define FAULTD_MEMSET memset + #else + #error The macro FAULTD_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef FAULTD_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define FAULTD_MEMCPY GLOBAL_MEMCPY + #elif FAULTD_CONFIG_PORTING_STDLIB == 1 + #define FAULTD_MEMCPY memcpy + #else + #error The macro FAULTD_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef FAULTD_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define FAULTD_STRNCPY GLOBAL_STRNCPY + #elif FAULTD_CONFIG_PORTING_STDLIB == 1 + #define FAULTD_STRNCPY strncpy + #else + #error The macro FAULTD_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef FAULTD_STRLEN + #if defined(GLOBAL_STRLEN) + #define FAULTD_STRLEN GLOBAL_STRLEN + #elif FAULTD_CONFIG_PORTING_STDLIB == 1 + #define FAULTD_STRLEN strlen + #else + #error The macro FAULTD_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __FAULTD_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/faultd/src/module/make.mk b/packages/base/any/faultd/src/module/make.mk new file mode 100644 index 00000000..d25ba44c --- /dev/null +++ b/packages/base/any/faultd/src/module/make.mk @@ -0,0 +1,25 @@ +############################################################################### +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +faultd_INCLUDES := -I $(THIS_DIR)inc +faultd_INTERNAL_INCLUDES := -I $(THIS_DIR)src +faultd_DEPENDMODULE_ENTRIES := init:faultd ucli:faultd + diff --git a/packages/base/any/faultd/src/module/src/Makefile b/packages/base/any/faultd/src/module/src/Makefile new file mode 100644 index 00000000..6fc6508e --- /dev/null +++ b/packages/base/any/faultd/src/module/src/Makefile @@ -0,0 +1,31 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Local source generation targets. +# +############################################################ +include ../../../../init.mk + +.DEFAULT_GOAL := ucli + +ucli: + $(SUBMODULE_BIGCODE)/tools/uclihandlers.py faultd_ucli.c + diff --git a/packages/base/any/faultd/src/module/src/faultd.c b/packages/base/any/faultd/src/module/src/faultd.c new file mode 100644 index 00000000..2579780c --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd.c @@ -0,0 +1,538 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include +#include + +#include +#include +#include +#include +#include + +#include +#include "faultd_log.h" + + +typedef struct faultd_service_s { + /** The filename of the named pipe */ + char* pipename; + + /** + * The open pipe descriptor. + * + * This is opened RDONLY for the server. + * This is opened WRONLY for the client. + */ + int pipefd; + + /** + * Server's open write descriptor. + * + * The server-side always opens the named pipe for reading. + * There is not necessarily a writer for the pipe at all times, as + * this depends on whether any clients are currently connected. + * + * The server wants to use select() on the named pipe to wait for + * any client connections, but this only works properly if + * there is a writer connected to the pipe from which we are reading. + * + * The server always opens a write connection to the named pipe at + * startup time to make sure there is always at least one writer connected. + * We never write anything to it. + * + * Note -- empirically, it seems possible to open the pipe descriptor in + * O_RDWR to accomplish this behavior (instead of opening a separate + * descriptor), but this is technically undefined behavior. + */ + int writefd; + +} faultd_service_t; + + + +/** + * faultd Server Object + */ +struct faultd_server_s { + /** All services */ + faultd_service_t services[FAULTD_CONFIG_SERVICE_PIPES_MAX]; + /** The last service from which we read a message */ + int sid_last; +}; /* faultd_server_t */ + + +int +faultd_server_create(faultd_server_t** rfso) +{ + faultd_server_t* fso; + + if(rfso == NULL) { + return -1; + } + + fso = aim_zmalloc(sizeof(*fso)); + + *rfso = fso; + return 0; +} + +void +faultd_server_destroy(faultd_server_t* fso) +{ + int i; + if(fso) { + for(i = 0; i < AIM_ARRAYSIZE(fso->services); i++) { + faultd_server_remove(fso, NULL, i); + } + AIM_FREE(fso); + } +} + +static void +faultd_service_destroy__(faultd_service_t* sp) +{ + if(sp) { + if(sp->pipename) { + AIM_FREE(sp->pipename); + } + if(sp->pipefd) { + close(sp->pipefd); + } + if(sp->writefd) { + close(sp->writefd); + } + AIM_MEMSET(sp, 0, sizeof(*sp)); + } +} + +int +faultd_server_add(faultd_server_t* fso, char* pipename) +{ + int i; + if(fso == NULL) { + return -1; + } + if(pipename == NULL) { + pipename = FAULTD_CONFIG_PIPE_NAME_DEFAULT; + } + + /* Find a free slot */ + for(i = 0; i < AIM_ARRAYSIZE(fso->services); i++) { + if(fso->services[i].pipename == NULL) { + int rv; + faultd_service_t* sp = fso->services+i; + + sp->pipename = aim_strdup(pipename); + + /** + * Create the fifo if it doesn't already exist. + */ + if( mkfifo(sp->pipename, 0644) < 0) { + if(errno != EEXIST) { + goto server_add_failed; + } + } + + /** + * Open the fifo. + */ + rv = open(sp->pipename, O_RDONLY | O_NONBLOCK); + if(rv < 0) { + AIM_LOG_ERROR("open(pipe): %s", strerror(errno)); + goto server_add_failed; + } + sp->pipefd = rv; + + /** + * Open our write connection. + */ + rv = open(sp->pipename, O_WRONLY | O_NONBLOCK); + if(rv < 0) { + AIM_LOG_ERROR("open(writefd): %s", strerror(errno)); + goto server_add_failed; + } + sp->writefd = rv; + + /** + * We opened the pipe originally in non-blocking mode. + * Otherwise, the open() would have blocked waiting for + * a client a client to open() it for writing. + * + * We now want all reads on the pipe to be blocking so + * we can use select() to pend on clients. + * + * Reset the pipe to blocking here: + */ + if( (rv = fcntl(sp->pipefd, F_GETFL, 0)) < 0) { + goto server_add_failed; + } + rv &= ~O_NONBLOCK; + if(fcntl(sp->pipefd, F_SETFL, rv) < 0) { + goto server_add_failed; + } + + /* Good to go. 'i' is the service id. */ + return i; + } + } + /* All services full */ + return -1; + + server_add_failed: + faultd_server_remove(fso, NULL, i); + return -1; +} + +int +faultd_server_remove(faultd_server_t* fso, char* pipename, + faultd_sid_t sid) +{ + if(fso == NULL) { + return -1; + } + else if(sid < 0 || sid >= AIM_ARRAYSIZE(fso->services)) { + return -1; + } + else { + faultd_service_destroy__(fso->services + sid); + return 0; + } +} + +int +faultd_server_process(faultd_server_t* fdo, faultd_sid_t sid, + int count, aim_pvs_t* pvs, int decode) +{ + int c; + faultd_info_t fault_info; + + for(c = 0; c < count || count == -1; c++) { + FAULTD_MEMSET(&fault_info, 0, sizeof(fault_info)); + faultd_server_read(fdo, &fault_info, sid); + faultd_info_show(&fault_info, pvs, decode); + if(fault_info.backtrace_symbols) { + AIM_FREE(fault_info.backtrace_symbols); + } + } + return 0; +} + +struct faultd_client_s { + faultd_service_t s; +}; /* faultd_client_t */ + +int +faultd_client_create(faultd_client_t** rfco, const char* pipename) +{ + int rv; + faultd_client_t* fco; + + if(rfco == NULL) { + return -1; + } + + if(pipename == NULL) { + pipename = FAULTD_CONFIG_PIPE_NAME_DEFAULT; + } + + fco = aim_zmalloc(sizeof(*fco)); + fco->s.pipename = aim_strdup(pipename); + + /** + * Open the fifo. + */ + rv = open(fco->s.pipename, O_WRONLY | O_NONBLOCK); + if(rv < 0) { + goto client_create_failed; + } + fco->s.pipefd = rv; + + *rfco = fco; + return 0; + + client_create_failed: + faultd_client_destroy(fco); + return rv; +} + +void +faultd_client_destroy(faultd_client_t* fco) +{ + if(fco) { + faultd_service_destroy__(&fco->s); + AIM_FREE(fco); + } +} + +static int +read_until__(int fd, char terminator, char* dst, int size) +{ + int rv; + int count = 0; + char c; + + do { + rv = read(fd, &c, 1); + if(rv < 0) { + if(errno == EINTR) { + continue; + } + else { + return rv; + } + } + if(count < size) { + dst[count] = c; + } + if(c == terminator) { + return count; + } + count++; + + /* Fixme - need a timeout */ + } while(1); +} + + + +static int +read_size__(int fd, char* dst, int size) +{ + int rv; + int remaining = size; + char* p = dst; + + do { + rv = read(fd, p, remaining); + if(rv < 0) { + if(errno == EINTR) { + /* Keep trying */ + continue; + } + else { + /* Read failed. Probably not good. */ + /* Do something here */ + AIM_LOG_MSG("read failed errno=%d %s\n", errno, strerror(errno)); + return -1; + } + } + if(rv == 0 && remaining) { + /* What to do here? */ + AIM_LOG_MSG("read() returned zero but we didn't get everything."); + return -1; + } + p += rv; + remaining -= rv; + } while(remaining); + + return size; +} + + +static int +write_size__(int fd, char* src, int size) +{ + int rv; + int remaining = size; + char* p = src; + + do { + rv = write(fd, p, remaining); + if(rv < 0) { + if(errno == EINTR) { + /* Keep trying */ + continue; + } + else { + /* + * Write failed. Probably not good. + * The faultd server may have died, or doesn't + * exist, or something else extra bad in our process. + * Given why we're here, maybe not too surpising. + * + * Theres really nothing else to do. + */ + return -1; + } + } + p += rv; + remaining -= rv; + } while(remaining); + + return size; +} + +int +faultd_wait_services__(faultd_server_t* fso, int sid, fd_set* rfds) +{ + int rv; + int maxfd; + + FD_ZERO(rfds); + + if(sid < 0 && sid >= AIM_ARRAYSIZE(fso->services) && sid != -1) { + /* invalid sid */ + return -1; + } + + if(sid == -1) { + /* All services */ + int i; + for(i = 0, maxfd = 0; i < AIM_ARRAYSIZE(fso->services); i++) { + if(fso->services[i].pipefd) { + FD_SET(fso->services[i].pipefd, rfds); + if(fso->services[i].pipefd > maxfd) { + maxfd = fso->services[i].pipefd; + } + } + } + } + else { + /* Single service */ + if(fso->services[sid].pipefd == 0) { + /* Invalid sid */ + return -1; + } + else { + FD_SET(fso->services[sid].pipefd, rfds); + maxfd = fso->services[sid].pipefd; + } + } + + /* Wait on configured services */ + do { + rv = select(maxfd+1, rfds, NULL, NULL, NULL); + } while(rv == -1 && errno == EINTR); + + return rv; +} + + +int +faultd_server_read(faultd_server_t* fso, faultd_info_t* info, int sid) +{ + int i; + int rv; + fd_set rfds; + int count; + + rv = faultd_wait_services__(fso, sid, &rfds); + + if(rv < 0) { + /* Error on select or sid */ + return rv; + } + + /** + * Read message on a ready descriptor. + * + * If we're polling all services, we start looking for the + * next sid after the last sid we've received a message on. + * This avoids starvation if multiple services are producing + * messages. This is unlikely to be a problem under normal + * circumstances and use cases, but can be avoided easily nonetheless. + */ + for(i = fso->sid_last+1, count = 0; + count < AIM_ARRAYSIZE(fso->services); + i++, count++) { + int s = i % AIM_ARRAYSIZE(fso->services); + if(FD_ISSET(fso->services[s].pipefd, &rfds)) { + rv = read_size__(fso->services[s].pipefd, (char*)info, sizeof(*info)); + + if(rv < 0) { + /* Do something here, like restare the pipe */ + AIM_LOG_ERROR("truncated read on pipe."); + continue; + } + + /** + * Backtrace symbols information available? + */ + if(info->backtrace_symbols) { + /* + * The backtrace symbol information is of variable length. + */ + info->backtrace_symbols = aim_zmalloc(FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE); + /* Backtrace symbols are terminated with a null character. */ + read_until__(fso->services[s].pipefd, 0, info->backtrace_symbols, + FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE); + } + + info->pipename = fso->services[s].pipename; + fso->sid_last = s; + return s; + } + } + /* Error while reading on the only ready descriptor */ + return -1; +} + + +int +faultd_client_write(faultd_client_t* fco, faultd_info_t* info) +{ + int rv = write_size__(fco->s.pipefd, (char*)info, sizeof(*info)); + + if(rv < 0) { + return rv; + } + + if(info->backtrace_symbols) { + char c = 0; + backtrace_symbols_fd(info->backtrace, info->backtrace_size, + fco->s.pipefd); + /* Terminate backtrace symbols with a null character. */ + write_size__(fco->s.pipefd, &c, 1); + } + return 0; +} + +int +faultd_info_show(faultd_info_t* info, aim_pvs_t* pvs, int decode) +{ + int i = 0; + aim_printf(pvs, "service = %s\n", info->pipename); + aim_printf(pvs, "binary = %s\n", info->binary); + aim_printf(pvs, "pid = %d\n", info->pid); + aim_printf(pvs, "tid = %d\n", info->tid); + aim_printf(pvs, "signal = %d (%s)\n", info->signal, strsignal(info->signal)); + aim_printf(pvs, "code = %d\n", info->signal_code); + aim_printf(pvs, "fa = %p\n", info->fault_address); + aim_printf(pvs, "errno = %d\n", info->last_errno); + aim_printf(pvs, "backtrace_size=%d\n", info->backtrace_size); + for(i = 0; i < info->backtrace_size; i++) { + aim_printf(pvs, " %p\n", info->backtrace[i]); + } + aim_printf(pvs, "backtrace_symbols: %p\n", info->backtrace_symbols); + if(info->backtrace_symbols) { + aim_printf(pvs, "%s\n", info->backtrace_symbols); + } + return 0; +} + + + + + + + + + diff --git a/packages/base/any/faultd/src/module/src/faultd_config.c b/packages/base/any/faultd/src/module/src/faultd_config.c new file mode 100644 index 00000000..97d2e176 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_config.c @@ -0,0 +1,131 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include + +/* */ +#define __faultd_config_STRINGIFY_NAME(_x) #_x +#define __faultd_config_STRINGIFY_VALUE(_x) __faultd_config_STRINGIFY_NAME(_x) +faultd_config_settings_t faultd_config_settings[] = +{ +#ifdef FAULTD_CONFIG_INCLUDE_LOGGING + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_INCLUDE_LOGGING), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_INCLUDE_LOGGING) }, +#else +{ FAULTD_CONFIG_INCLUDE_LOGGING(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_LOG_OPTIONS_DEFAULT + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_LOG_OPTIONS_DEFAULT), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ FAULTD_CONFIG_LOG_OPTIONS_DEFAULT(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_LOG_BITS_DEFAULT + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_LOG_BITS_DEFAULT), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ FAULTD_CONFIG_LOG_BITS_DEFAULT(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_PORTING_STDLIB + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_PORTING_STDLIB), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_PORTING_STDLIB) }, +#else +{ FAULTD_CONFIG_PORTING_STDLIB(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ FAULTD_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_INCLUDE_UCLI + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_INCLUDE_UCLI), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_INCLUDE_UCLI) }, +#else +{ FAULTD_CONFIG_INCLUDE_UCLI(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_PIPE_NAME_DEFAULT + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_PIPE_NAME_DEFAULT), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_PIPE_NAME_DEFAULT) }, +#else +{ FAULTD_CONFIG_PIPE_NAME_DEFAULT(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_BINARY_SIZE + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_BINARY_SIZE), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_BINARY_SIZE) }, +#else +{ FAULTD_CONFIG_BINARY_SIZE(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_BACKTRACE_SIZE_MAX + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_BACKTRACE_SIZE_MAX), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_BACKTRACE_SIZE_MAX) }, +#else +{ FAULTD_CONFIG_BACKTRACE_SIZE_MAX(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_SERVICE_PIPES_MAX + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_SERVICE_PIPES_MAX), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_SERVICE_PIPES_MAX) }, +#else +{ FAULTD_CONFIG_SERVICE_PIPES_MAX(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE) }, +#else +{ FAULTD_CONFIG_BACKTRACE_SYMBOLS_SIZE(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_INCLUDE_MAIN + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_INCLUDE_MAIN), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_INCLUDE_MAIN) }, +#else +{ FAULTD_CONFIG_INCLUDE_MAIN(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_INCLUDE_AIM_MAIN + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_INCLUDE_AIM_MAIN), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_INCLUDE_AIM_MAIN) }, +#else +{ FAULTD_CONFIG_INCLUDE_AIM_MAIN(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef FAULTD_CONFIG_MAIN_PIPENAME + { __faultd_config_STRINGIFY_NAME(FAULTD_CONFIG_MAIN_PIPENAME), __faultd_config_STRINGIFY_VALUE(FAULTD_CONFIG_MAIN_PIPENAME) }, +#else +{ FAULTD_CONFIG_MAIN_PIPENAME(__faultd_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __faultd_config_STRINGIFY_VALUE +#undef __faultd_config_STRINGIFY_NAME + +const char* +faultd_config_lookup(const char* setting) +{ + int i; + for(i = 0; faultd_config_settings[i].name; i++) { + if(strcmp(faultd_config_settings[i].name, setting)) { + return faultd_config_settings[i].value; + } + } + return NULL; +} + +int +faultd_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; faultd_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", faultd_config_settings[i].name, faultd_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/faultd/src/module/src/faultd_enums.c b/packages/base/any/faultd/src/module/src/faultd_enums.c new file mode 100644 index 00000000..bfaf116c --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_enums.c @@ -0,0 +1,25 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/base/any/faultd/src/module/src/faultd_handler.c b/packages/base/any/faultd/src/module/src/faultd_handler.c new file mode 100644 index 00000000..7c01ebf1 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_handler.c @@ -0,0 +1,202 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include + +#define __USE_GNU /* Needed to get REG_EIP from ucontext.h */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define _XOPEN_SOURCE 600 +#include + + +static pthread_spinlock_t thread_lock__; +static faultd_client_t* faultd_client__ = NULL; +static faultd_info_t faultd_info__; +static int localfd__ = -1; + +inline int signal_backtrace__(void** buffer, int size, ucontext_t* context, + int distance) +{ +#define IP_STACK_FRAME_NUMBER 3 + + int rv; + rv = backtrace(buffer, size); + + if(context) { + distance += IP_STACK_FRAME_NUMBER; + +#ifdef __i386__ + buffer[distance] = (void*)(context->uc_mcontext.gregs[REG_EIP]); +#endif +#ifdef __PPC__ + buffer[distance] = (void*)(context->uc_mcontext.regs->nip); +#endif + /* Note -- 64bit does not require require modifications */ + } + return rv; +} + #include +static void +faultd_signal_handler__(int signal, siginfo_t* siginfo, void* context) +{ + int rv; + + /* + * Make sure we syncronize properly with other threads that + * may *also* be faulting + */ + rv = pthread_spin_trylock(&thread_lock__); + + if (rv == EBUSY) { + sigset_t mask; + sigemptyset(&mask); + pselect(0, NULL, NULL, NULL, NULL, &mask); + } + + /* + * Generate our fault information. + */ + faultd_info__.pid = getpid(); + faultd_info__.tid = 0; + faultd_info__.signal = signal; + faultd_info__.signal_code = siginfo->si_code; + faultd_info__.fault_address = siginfo->si_addr; + faultd_info__.last_errno = errno; + + faultd_info__.backtrace_size = signal_backtrace__(faultd_info__.backtrace, + AIM_ARRAYSIZE(faultd_info__.backtrace), + context, 0); + faultd_info__.backtrace_symbols = (void*)1; + if(faultd_client__) { + faultd_client_write(faultd_client__, &faultd_info__); + } + if(localfd__ >= 0) { + char* signame = strsignal(faultd_info__.signal); + char* nl = "\n"; + write(localfd__, signame, strlen(signame)+1); + write(localfd__, nl, 2); + backtrace_symbols_fd(faultd_info__.backtrace, + faultd_info__.backtrace_size, + localfd__); + } + + /* + * Unlock spinlock, in case this signal wasn't fatal + */ + pthread_spin_unlock(&thread_lock__); +} + + +int +faultd_handler_register(int localfd, + const char* pipename, + const char* binaryname) +{ + int rv; + struct sigaction saction; + void* dummy_backtrace[1]; + int dummy_backtrace_size; + int fd; + + if ( (rv = pthread_spin_init(&thread_lock__, 0)) ) { + return rv; + } + + /* + * These calls to backtrace are to assure that + * backtrace() and backtrace_symbols_fd() have actually + * been loaded into our process -- its possible they + * come from a dynamic library, and we don't want them + * to get loaded at fault-time. + */ + dummy_backtrace_size = backtrace(dummy_backtrace, 1); + + /** Note - we could just pass an invalid descriptor here, but it + * it flags errors in valgrind. + */ + fd = open("/dev/null", O_WRONLY); + backtrace_symbols_fd(dummy_backtrace, dummy_backtrace_size, fd); + close(fd); + + AIM_MEMSET(&faultd_info__, 0, sizeof(faultd_info__)); + if(!binaryname) { + binaryname = "Not specified."; + } + aim_strlcpy(faultd_info__.binary, binaryname, sizeof(faultd_info__.binary)); + + + if(pipename) { + faultd_client_create(&faultd_client__, pipename); + } + + AIM_MEMSET(&saction, 0, sizeof(saction)); + saction.sa_sigaction = faultd_signal_handler__; + + sigfillset(&saction.sa_mask); + saction.sa_flags = SA_SIGINFO | SA_RESETHAND; + + rv = sigaction (SIGSEGV, &saction, NULL); + rv |= sigaction (SIGILL, &saction, NULL); + rv |= sigaction (SIGFPE, &saction, NULL); + rv |= sigaction (SIGBUS, &saction, NULL); + rv |= sigaction (SIGQUIT, &saction, NULL); + rv |= sigaction (SIGALRM, &saction, NULL); + + /* + * SIGUSR2 can be used to request a backtrace explicitly. + * In this case, we don't want to reset the handler. + */ + saction.sa_flags = SA_SIGINFO; + rv |= sigaction (SIGUSR2, &saction, NULL); + + /* + * The local fault handler will attempt to write a subset of + * the fault information (signal type and backtrace) + * to the localfd descriptor if specified. + */ + localfd__ = localfd; + + return rv; +} + + + + + + diff --git a/packages/base/any/faultd/src/module/src/faultd_int.h b/packages/base/any/faultd/src/module/src/faultd_int.h new file mode 100644 index 00000000..a5d5997d --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_int.h @@ -0,0 +1,30 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + * faultd Internal Header + * + *****************************************************************************/ +#ifndef __FAULTD_INT_H__ +#define __FAULTD_INT_H__ + +#include + + +#endif /* __FAULTD_INT_H__ */ diff --git a/packages/base/any/faultd/src/module/src/faultd_log.c b/packages/base/any/faultd/src/module/src/faultd_log.c new file mode 100644 index 00000000..1ea149e1 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_log.c @@ -0,0 +1,33 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include + +#include "faultd_log.h" +/* + * faultd log struct. + */ +AIM_LOG_STRUCT_DEFINE( + FAULTD_CONFIG_LOG_OPTIONS_DEFAULT | AIM_LOG_OPTION_BIT_TIMESTAMP, + FAULTD_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + FAULTD_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/faultd/src/module/src/faultd_log.h b/packages/base/any/faultd/src/module/src/faultd_log.h new file mode 100644 index 00000000..58ff10e7 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_log.h @@ -0,0 +1,29 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * * + * + *****************************************************************************/ +#ifndef __FAULTD_LOG_H__ +#define __FAULTD_LOG_H__ + +#define AIM_LOG_MODULE_NAME faultd +#include + +#endif /* __FAULTD_LOG_H__ */ diff --git a/packages/base/any/faultd/src/module/src/faultd_main.c b/packages/base/any/faultd/src/module/src/faultd_main.c new file mode 100644 index 00000000..d1b5a581 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_main.c @@ -0,0 +1,221 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + *****************************************************************************/ +#include + +#if FAULTD_CONFIG_INCLUDE_MAIN == 1 + +#include +#include + +#define AIM_LOG_MODULE_NAME faultd +#include +#include +#include + +#include +#include +#include +#include + +AIM_LOG_STRUCT_DEFINE( + AIM_LOG_OPTIONS_DEFAULT, + AIM_LOG_BITS_DEFAULT, + NULL, 0); + + +static int test__(const char* binaryname, const char* pipename); + +/** + * Basic faultd Agent + * + * Hardcoded to : + * - Listen on FAULTD_CONFIG_MAIN_PIPENAME + * - Output messages to syslog and stderr (if a tty) + * - Daemonize and Restart on "-d", "-dr" + */ + +static char help__[] = +"NAME\n\ + faultd - Fault Reporting Agent\n\ +\n\ +SYNOPSIS\n\ +\n\ + faultd [-dr|-d] [-pid file] [-t] [-h | --help]\n\ +\n\ +OPTIONS\n\ + -d Daemonize.\n\ +\n\ + -dr Daemonize with automatic restart.\n\ + -p Server pipe. Default is %s\n\ +\n\ + -pid file Write PID to the given filename.\n\ +\n\ + -t Test mode. Sends a test backtrace the the existing faultd\n\ + server.\n\ +\n\ + -h This help message.\n\ + -help\n\ +\n"; + + +int +faultd_main(int argc, char* argv[]) +{ + char** arg; + + char* pidfile = NULL; + int daemonize = 0; + int restart = 0; + int test = 0; + char* pipename = FAULTD_CONFIG_MAIN_PIPENAME; + + aim_pvs_t* aim_pvs_syslog = NULL; + faultd_server_t* faultd_server = NULL; + int sid = -1; + + + for(arg = argv+1; *arg; arg++) { + if(!strcmp(*arg, "-dr")) { + daemonize=1; + restart=1; + } + else if(!strcmp(*arg, "-d")) { + daemonize=1; + restart=0; + } + else if(!strcmp(*arg, "-pid")) { + arg++; + pidfile = *arg; + if(!pidfile) { + fprintf(stderr, "-pid requires an argument.\n"); + exit(1); + } + } + else if(!strcmp(*arg, "-p")) { + arg++; + pipename = *arg; + if(!pipename) { + fprintf(stderr, "-p requires an argument.\n"); + exit(1); + } + } + else if(!strcmp(*arg, "-t")) { + test = 1; + } + else if(!strcmp(*arg, "-h") || !strcmp(*arg, "--help")) { + printf(help__, FAULTD_CONFIG_MAIN_PIPENAME); + exit(0); + } + } + + if(test) { + return test__(argv[0], pipename); + } + + /** + * Start Server + */ + aim_pvs_syslog = aim_pvs_syslog_open("faultd", LOG_PID, LOG_DAEMON); + aim_printf(aim_pvs_syslog, "faultd starting"); + faultd_server_create(&faultd_server); + sid = faultd_server_add(faultd_server, pipename); + + if(sid < 0) { + perror("server_add:"); + abort(); + } + + if(daemonize) { + aim_daemon_restart_config_t rconfig; + aim_daemon_config_t config; + + memset(&config, 0, sizeof(config)); + aim_daemon_restart_config_init(&rconfig, 1, 1); + AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM); + AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGKILL); + rconfig.maximum_restarts=0; + rconfig.pvs = aim_pvs_syslog_get(); + + config.wd = "/"; + if(restart) { + aim_daemonize(&config, &rconfig); + } + else { + aim_daemonize(&config, NULL); + } + } + + /* + * Write our PID file if requested. + */ + if(pidfile) { + FILE* fp = fopen(pidfile, "w"); + if(fp == NULL) { + int e = errno; + aim_printf(aim_pvs_syslog, "fatal: open(%s): %s\n", + pidfile, strerror(e)); + aim_printf(&aim_pvs_stderr, "fatal: open(%s): %s\n", + pidfile, strerror(e)); + + /* Don't attempt restart */ + raise(SIGTERM); + } + fprintf(fp, "%d\n", getpid()); + fclose(fp); + } + + /** + * Process Fault Messages + */ + for(;;) { + faultd_info_t faultd_info; + memset(&faultd_info, 0, sizeof(faultd_info)); + if(faultd_server_read(faultd_server, &faultd_info, sid) >= 0) { + faultd_info_show(&faultd_info, aim_pvs_syslog, 0); + if(aim_pvs_isatty(&aim_pvs_stderr)) { + faultd_info_show(&faultd_info, &aim_pvs_stderr, 0); + } + } + } +} + +static int +test__(const char* binaryname, const char* pipename) +{ + /** + * Send a backtrace to the current faultd server. + */ + faultd_handler_register(0, pipename, binaryname); + raise(SIGUSR2); + return 0; +} + +#if FAULTD_CONFIG_INCLUDE_AIM_MAIN == 1 +int aim_main(int argc, char* argv[]) +{ + return faultd_main(argc, argv); +} +#endif +#else /* FAULTD_CONFIG_INCLUDE_MAIN */ +int __not_empty__; +#endif diff --git a/packages/base/any/faultd/src/module/src/faultd_module.c b/packages/base/any/faultd/src/module/src/faultd_module.c new file mode 100644 index 00000000..ca4789f6 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_module.c @@ -0,0 +1,41 @@ +/**************************************************************************//** + * + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + * + * + *****************************************************************************/ +#include + +#include "faultd_log.h" + +static int +datatypes_init__(void) +{ +#define FAULTD_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __faultd_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + diff --git a/packages/base/any/faultd/src/module/src/faultd_ucli.c b/packages/base/any/faultd/src/module/src/faultd_ucli.c new file mode 100644 index 00000000..a8a4b7d7 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/faultd_ucli.c @@ -0,0 +1,77 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include + +#if FAULTD_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +faultd_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(faultd) +} + +/* */ +/****************************************************************************** + * + * These handler table(s) were autogenerated from the symbols in this + * source file. + * + *****************************************************************************/ +static ucli_command_handler_f faultd_ucli_ucli_handlers__[] = +{ + faultd_ucli_ucli__config__, + NULL +}; +/******************************************************************************/ +/* */ + +static ucli_module_t +faultd_ucli_module__ = + { + "faultd_ucli", + NULL, + faultd_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +faultd_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&faultd_ucli_module__); + n = ucli_node_create("faultd", NULL, &faultd_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("faultd")); + return n; +} + +#else +void* +faultd_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/base/any/faultd/src/module/src/make.mk b/packages/base/any/faultd/src/module/src/make.mk new file mode 100644 index 00000000..34aaf2b4 --- /dev/null +++ b/packages/base/any/faultd/src/module/src/make.mk @@ -0,0 +1,24 @@ +############################################################################### +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################################### + +LIBRARY := faultd +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/faultd/src/utest/_make.mk b/packages/base/any/faultd/src/utest/_make.mk new file mode 100644 index 00000000..0f4642e9 --- /dev/null +++ b/packages/base/any/faultd/src/utest/_make.mk @@ -0,0 +1,27 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# faultd Unit Test Makefile. +# +############################################################ +UMODULE := faultd +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/faultd/src/utest/main.c b/packages/base/any/faultd/src/utest/main.c new file mode 100644 index 00000000..cc12e4dd --- /dev/null +++ b/packages/base/any/faultd/src/utest/main.c @@ -0,0 +1,166 @@ +/**************************************************************************//** + * + * + * Copyright 2013, 2014 BigSwitch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + *****************************************************************************/ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define LOCALNAME "faultd.pipe" + +int +client_main(int argc, char* argv[]) +{ + /* Report a dummy message */ + faultd_info_t info; + faultd_client_t* clientfd; + int count = 1; + int i; + void* backtrace_symbols = NULL; + char* service = LOCALNAME; + + if(argc >= 1) { + count = atoi(argv[0]); + } + if(argc >= 2) { + intptr_t bts = atoi(argv[1]); + backtrace_symbols = (void*)bts; + } + if(argc >= 3) { + service = argv[2]; + } + for(i = 0; i < count || count == -1; i++) { + if(faultd_client_create(&clientfd, service) < 0) { + perror("client_create: "); + abort(); + } + strcpy(info.binary, "client_main"); + info.pid = getpid(); + info.tid = 100; + info.signal = SIGSEGV; + info.signal_code = i; + info.fault_address = (void*)(0xDEAD); + info.last_errno = -42; + info.backtrace_size = backtrace(info.backtrace, AIM_ARRAYSIZE(info.backtrace)); + info.backtrace_symbols = backtrace_symbols; + printf("writing msg...\n"); + faultd_client_write(clientfd, &info); + faultd_client_destroy(clientfd); + } + return 0; + +} + +int +server_main(int argc, char* argv[]) +{ + int count = -1; + int decode = 0; + faultd_server_t* fso; + + if(argc >= 1) { + count = atoi(argv[0]); + } + if(argc >= 2) { + decode = atoi(argv[1]); + } + + if(faultd_server_create(&fso)) { + abort(); + } + + if(argc >= 3) { + int i; + for(i = 2; i < argc; i++) { + if(faultd_server_add(fso, argv[i]) < 0) { + abort(); + } + } + } + else { + if(faultd_server_add(fso, LOCALNAME) < 0) { + abort(); + } + } + faultd_server_process(fso, -1, count, &aim_pvs_stdout, decode); + faultd_server_destroy(fso); + return 0; +} + +int +utest_main(int argc, char* argv[]) +{ + fprintf(stderr, "No standalone unit test implemented.\n"); + return 0; +} + +int +local_main(int argc, char* argv[]) +{ + int i = 0; + /** Just test local descriptor fault processing */ + if(faultd_handler_register(0, LOCALNAME, "utest") < 0) { + fprintf(stderr, "faultd_handler_register() failed."); + abort(); + } + for(;;) { + sleep(1); + printf("count = %d\n", i++); + if(i % 5 == 0) { + * ((int*)(0)) = 0; + } + } + return 0; +} + +int +aim_main(int argc, char* argv[]) +{ + if(argc == 1) { + /* Run in unit test mode */ + return utest_main(argc, argv); + } + else { + argc--; + argv++; + if(!strcmp(argv[0], "-c")) { + return client_main(--argc, ++argv); + } + if(!strcmp(argv[0], "-s")) { + return server_main(--argc, ++argv); + } + if(!strcmp(argv[0], "-l")) { + return local_main(--argc, ++argv); + } + if(!strcmp(argv[0], "-u")) { + return utest_main(--argc, ++argv); + } + fprintf(stderr, "Unknown option '%s'\n", argv[0]); + return 1; + } +} + diff --git a/packages/base/any/initrds/loader/APKG.yml b/packages/base/any/initrds/loader/APKG.yml new file mode 100644 index 00000000..bb3b8793 --- /dev/null +++ b/packages/base/any/initrds/loader/APKG.yml @@ -0,0 +1,30 @@ +############################################################ +# +# Loader Package Template +# +# Requires: ARCH +# +############################################################ +prerequisites: + packages: [ "onl-buildroot-initrd:$ARCH", "onl-loader-initrd-files:all" ] + +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-loader-initrd + version: 1.0.0 + summary: Open Network Linux Loader Initrd CPIO ($ARCH) + + files: + builds/onl-loader-initrd-$ARCH.cpio.gz : $$PKG_INSTALL/ + builds/manifest.json : $$PKG_INSTALL/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/any/initrds/loader/builds/Makefile b/packages/base/any/initrds/loader/builds/Makefile new file mode 100644 index 00000000..23bc0fbb --- /dev/null +++ b/packages/base/any/initrds/loader/builds/Makefile @@ -0,0 +1,35 @@ +############################################################ +# +# ONL Loader Initrd Build Template. +# +############################################################ +ifndef ARCH +$(error $$ARCH must be set) +endif + +ifndef PLATFORMS +# Include all available platforms in the current architecture. +PLATFORMS := $(shell onlpm --list-platforms --arch $(ARCH)) +endif + +PLATFORM_PACKAGES := $(foreach p,$(PLATFORMS),onl-platform-config-$(p):$(ARCH)) + +ROOT := root +TARGET := onl-loader-initrd-$(ARCH).cpio.gz +.PHONY: $(TARGET) + +$(TARGET): + $(ONLPM) --copy-file onl-buildroot-initrd:$(ARCH) onl-buildroot-initrd-$(ARCH).cpio.gz . + sudo rm -rf $(ROOT) && mkdir $(ROOT) + $(ONLPM) --sudo --force --extract-dir onl-loader-initrd-files:all $(ROOT) + $(ONLPM) --sudo $(foreach p,$(PLATFORM_PACKAGES),--extract-dir $(p) $(ROOT)) + $(ONL)/tools/sjson.py --kj version $(ONL)/make/version-onl.json --kl platforms $(PLATFORMS) --kv arch $(ARCH) --out manifest.json + sudo mkdir -p $(ROOT)/etc/onl/loader && sudo cp manifest.json $(ROOT)/etc/onl/loader + sudo $(ONL)/tools/makedevs -d $(ROOT)/etc/rootperms $(abspath $(ROOT)) + sudo $(ONL)/tools/cpiomod.py --cpio onl-buildroot-initrd-$(ARCH).cpio.gz --add-directory $(ROOT) --out $@ + sudo rm -rf $(ROOT) onl-buildroot-initrd-$(ARCH).cpio.gz + + + + + diff --git a/packages/base/any/onlp/.gitignore b/packages/base/any/onlp/.gitignore new file mode 100644 index 00000000..c9fb117a --- /dev/null +++ b/packages/base/any/onlp/.gitignore @@ -0,0 +1,2 @@ +build/ +*-module.mk diff --git a/packages/base/any/onlp/APKG.yml b/packages/base/any/onlp/APKG.yml new file mode 100644 index 00000000..c5441696 --- /dev/null +++ b/packages/base/any/onlp/APKG.yml @@ -0,0 +1,31 @@ +############################################################ +# +# ONLP Package Build Template +# +# Requires: ARCH, TOOLCHAIN +# +############################################################ +variables: + libdir: /lib/${TOOLCHAIN} + +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onlp + version: 1.0.0 + summary: Open Network Linux Platform Infrastructure + + files: + builds/onlp/$BUILD_DIR/${TOOLCHAIN}/bin/libonlp.so : $libdir/ + builds/onlp-platform/$BUILD_DIR/${TOOLCHAIN}/bin/libonlp-platform.so : $libdir/ + builds/onlp-platform-defaults/$BUILD_DIR/${TOOLCHAIN}/bin/libonlp-platform-defaults.so : $libdir/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/any/onlp/builds/Makefile b/packages/base/any/onlp/builds/Makefile new file mode 100644 index 00000000..6da335a9 --- /dev/null +++ b/packages/base/any/onlp/builds/Makefile @@ -0,0 +1,3 @@ +# These must be built in the given order +DIRECTORIES := onlp-platform-defaults onlp-platform onlp +include $(ONL)/make/subdirs.mk diff --git a/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile b/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile new file mode 100644 index 00000000..bcbfc1b4 --- /dev/null +++ b/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile @@ -0,0 +1,67 @@ +# -*- Makefile -*- +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Build the ONLP Default Platform Library. +# +# This library provides the baseline stub implementations +# for all required ONLP entry points. +# +# All ONLP applications are linked against this library. +# +# +############################################################ +include $(ONL)/make/config.mk + +ifndef TOOLCHAIN +$(error $$TOOLCHAIN must be specified.) +else +export TOOLCHAIN +endif + +MODULE := libonlp-platform-defaults-module +include $(BUILDER)/standardinit.mk + +# +# We use the onlp_platform_defaults entry points as +# the link stubs +# +DEPENDMODULES := AIM onlplib onlp_platform_defaults IOF sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-platform-defaults.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk + +.DEFAULT_GOAL := sharedlibs + +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1 +GLOBAL_CFLAGS += -DONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM=0 +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/onlp/builds/onlp-platform/Makefile b/packages/base/any/onlp/builds/onlp-platform/Makefile new file mode 100644 index 00000000..81f09fcb --- /dev/null +++ b/packages/base/any/onlp/builds/onlp-platform/Makefile @@ -0,0 +1,56 @@ +# -*- Makefile -*- +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.mk + +ifndef TOOLCHAIN +$(error $$TOOLCHAIN must be specified.) +else +export TOOLCHAIN +endif + +MODULE := libonlp-platform-module +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM onlplib onlp_platform_defaults IOF sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-platform.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk + +.DEFAULT_GOAL := sharedlibs + +GLOBAL_CFLAGS += -DONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1 +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/onlp/builds/onlp/Makefile b/packages/base/any/onlp/builds/onlp/Makefile new file mode 100644 index 00000000..52f8f5e6 --- /dev/null +++ b/packages/base/any/onlp/builds/onlp/Makefile @@ -0,0 +1,59 @@ +# -*- Makefile -*- +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.mk + +ifndef TOOLCHAIN +$(error $$TOOLCHAIN must be specified.) +else +export TOOLCHAIN +endif + +MODULE := libonlp-module +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM onlplib onlp cjson cjson_util sff IOF timer_wheel OS + +LIBONLP_PLATFORM_DEFAULTS := ../onlp-platform-defaults/$(BUILD_DIR)/bin/libonlp-platform-defaults.so +LIBONLP_PLATFORM := ../onlp-platform/$(BUILD_DIR)/bin/libonlp-platform.so + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk + +.DEFAULT_GOAL := sharedlibs + +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DONLP_CONFIG_PLATFORM_FILENAME="\"/etc/sl_platform\"" +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread $(LIBONLP_PLATFORM) $(LIBONLP_PLATFORM_DEFAULTS) + +include $(BUILDER)/targets.mk + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/onlp/src/Makefile b/packages/base/any/onlp/src/Makefile new file mode 100644 index 00000000..533b3f8c --- /dev/null +++ b/packages/base/any/onlp/src/Makefile @@ -0,0 +1,37 @@ +################################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +################################################################ +include ../init.mk + +-include Manifest.mk + +include $(BUILDER)/moduledir.mk + +# +# Available targets +# +moduledir_show_targets:: + @echo " autogen Make autogen in all modules." + +autogen: + + + + diff --git a/packages/base/any/onlp/src/onlp/Makefile b/packages/base/any/onlp/src/onlp/Makefile new file mode 100644 index 00000000..c2250874 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/Makefile @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.mk +MODULE := onlp +AUTOMODULE := onlp +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/onlp/README b/packages/base/any/onlp/src/onlp/README new file mode 100644 index 00000000..7917b603 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/README @@ -0,0 +1,6 @@ +############################################################################### +# +# onlp README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/onlp/module/auto/make.mk b/packages/base/any/onlp/src/onlp/module/auto/make.mk new file mode 100644 index 00000000..1e68bdb8 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/auto/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlp Autogeneration +# +############################################################ + +onlp_AUTO_DEFS := module/auto/onlp.yml +onlp_AUTO_DIRS := module/inc/onlp module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/onlp/module/auto/onlp.yml b/packages/base/any/onlp/src/onlp/module/auto/onlp.yml new file mode 100644 index 00000000..6e39ae96 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/auto/onlp.yml @@ -0,0 +1,299 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlp Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- ONLP_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- ONLP_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- ONLP_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- ONLP_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: ONLP_CONFIG_PORTING_STDLIB +- ONLP_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK: + doc: "Include platform error checking at initialization." + default: 1 +- ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT: + doc: "Include global shlock initialization at module init time." + default: 0 +- ONLP_CONFIG_INCLUDE_PLATFORM_STATIC: + doc: "Specify the platform name directly as a compile-time option." + default: 0 +- ONLP_CONFIG_PLATFORM_STATIC: + doc: "The name of the static platform if configured." + default: "\"unknown\"" +- ONLP_CONFIG_PLATFORM_FILENAME: + doc: "The local filename containing the current platform identifier." + default: "\"/etc/onl/platform\"" +- ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES: + doc: "Allow support for local overrides of all platform OID values (testing)." + default: 1 +- ONLP_CONFIG_CONFIGURATION_FILENAME: + doc: "The filename for the (optional) ONLP JSON configuration file." + default: "\"/etc/onlp.conf\"" +- ONLP_CONFIG_CONFIGURATION_ENV: + doc: "Environment variable to check for configuration filenames. Overrides default." + default: "\"ONLP_CONF\"" +- ONLP_CONFIG_INCLUDE_API_LOCK: + doc: "Include exclusive locking for all API calls." + default: 1 +- ONLP_CONFIG_API_LOCK_GLOBAL_SHARED: + doc: "If 0, the API lock is a simple semaphore. If 1, the API lock is a global shared mutex." + default: 0 +- ONLP_CONFIG_API_LOCK_TIMEOUT: + doc: "The maximum amount of time (in usecs) to wait while attempting to acquire the API lock. Failure to acquire is fatal. A value of zero disables this feature. " + default: 60000000 +- ONLP_CONFIG_INFO_STR_MAX: + doc: "The maximum size of static information string buffers." + default: 64 + +# Error codes +onlp_status: &onlp_status +- OK : 0 +- E_UNSUPPORTED : -1 +- E_MISSING : -2 +- E_INVALID : -3 +- E_INTERNAL : -4 +- E_PARAM : -5 + +# OID Types +oid_types: &oid_types +- SYS : 1 +- THERMAL : 2 +- FAN : 3 +- PSU : 4 +- LED : 5 +- MODULE : 6 +- RTC : 7 + +# SFP Control +sfp_control: &sfp_control +- RESET +- RESET_STATE +- RX_LOS +- TX_FAULT +- TX_DISABLE +- LP_MODE +- POWER_OVERRIDE + +# Fan modes +fan_modes: &fan_modes +- 'OFF' +- SLOW +- NORMAL +- FAST +- MAX + +# Fan Capabilities +fan_caps: &fan_caps +- B2F : (1 << 0) +- F2B : (1 << 1) +- SET_RPM : (1 << 2) +- SET_PERCENTAGE : (1 << 3) +- GET_RPM : (1 << 4) +- GET_PERCENTAGE : (1 << 5) + +# Fan Direction +fan_dirs: &fan_dirs +- B2F +- F2B + +# Fan status +fan_status: &fan_status +- PRESENT : (1 << 0) +- FAILED : (1 << 1) +- B2F : (1 << 2) +- F2B : (1 << 3) + +# Thermal status +thermal_status: &thermal_status +- PRESENT : (1 << 0) +- FAILED : (1 << 1) + +# Thermal caps +thermal_caps: &thermal_caps +- GET_TEMPERATURE : (1 << 0) +- GET_WARNING_THRESHOLD : (1 << 1) +- GET_ERROR_THRESHOLD : (1 << 2) +- GET_SHUTDOWN_THRESHOLD : (1 << 3) + +# LED caps +led_caps: &led_caps +- ON_OFF : (1 << 0) +- RED : (1 << 10) +- RED_BLINKING : (1 << 11) +- ORANGE : (1 << 12) +- ORANGE_BLINKING : (1 << 13) +- YELLOW : ( 1 << 14) +- YELLOW_BLINKING : (1 << 15) +- GREEN : (1 << 16) +- GREEN_BLINKING : (1 << 17) +- BLUE : (1 << 18) +- BLUE_BLINKING : (1 << 19) +- PURPLE: (1 << 20) +- PURPLE_BLINKING : (1 << 21) +- AUTO : (1 << 22) + +# LED status +led_status: &led_status +- PRESENT : (1 << 0) +- FAILED : (1 << 1) +- 'ON' : (1 << 2) + +# LED modes +# The enumerations MUST match the CAP bit positions. +led_mode: &led_mode +- 'OFF' +- 'ON' +- 'BLINKING' +- 'RED' : 10 +- 'RED_BLINKING' : 11 +- 'ORANGE' : 12 +- 'ORANGE_BLINKING' : 13 +- 'YELLOW' : 14 +- 'YELLOW_BLINKING' : 15 +- 'GREEN' : 16 +- 'GREEN_BLINKING' : 17 +- 'BLUE' : 18 +- 'BLUE_BLINKING' : 19 +- 'PURPLE' : 20 +- 'PURPLE_BLINKING' : 21 +- 'AUTO' : 22 + +# PSU Status +psu_status: &psu_status +- PRESENT : (1 << 0) +- FAILED : (1 << 1) +- UNPLUGGED : (1 << 2) + +# PSU caps +psu_caps: &psu_caps +- AC : (1 << 0) +- DC12 : (1 << 1) +- DC48 : (1 << 2) +- VIN : (1 << 3) +- VOUT : (1 << 4) +- IIN : (1 << 5) +- IOUT : (1 << 6) +- PIN : (1 << 7) +- POUT : (1 << 8) + +definitions: + cdefs: + ONLP_CONFIG_HEADER: + defs: *cdefs + basename: onlp_config + + enum: &enums + onlp_status: + tag: onlp + members: *onlp_status + onlp_oid_type: + tag: oid + members: *oid_types + onlp_thermal_status: + tag: thermal + members: *thermal_status + onlp_thermal_caps: + tag: thermal + members: *thermal_caps + onlp_sfp_control: + tag: sfp1 + members: + - RESET + - RESET_STATE + - RX_LOS + - TX_FAULT + - TX_DISABLE + - LP_MODE + - POWER_OVERRIDE + onlp_sfp_control_flag: + tag: sfp2 + members: + - RESET : (1 << ONLP_SFP_CONTROL_RESET) + - RESET_STATE : ( 1 << ONLP_SFP_CONTROL_RESET_STATE ) + - RX_LOS : ( 1 << ONLP_SFP_CONTROL_RX_LOS ) + - TX_FAULT : ( 1 << ONLP_SFP_CONTROL_TX_FAULT ) + - TX_DISABLE : ( 1 << ONLP_SFP_CONTROL_TX_DISABLE ) + - LP_MODE : ( 1 << ONLP_SFP_CONTROL_LP_MODE ) + - POWER_OVERRIDE : ( 1 << ONLP_SFP_CONTROL_POWER_OVERRIDE ) + onlp_fan_mode: + tag: fan + members: *fan_modes + onlp_fan_status: + tag: fan + members: *fan_status + onlp_fan_dir: + tag: fan + members: *fan_dirs + onlp_fan_caps: + tag: fan + members: *fan_caps + onlp_led_caps: + tag: led + members: *led_caps + onlp_led_status: + tag: led + members: *led_status + onlp_led_mode: + tag: led + members: *led_mode + onlp_psu_status: + tag: psu + members: *psu_status + onlp_psu_caps: + tag: psu + members: *psu_caps + + portingmacro: + ONLP: + macros: + - memset + - memcpy + - strncpy + - strlen + + xenum: + ONLP_ENUMERATION_ENTRY: + members: *enums + + xmacro: + ONLP_OID_TYPE_ENTRY: + members: *oid_types + + diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/fan.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/fan.h new file mode 100644 index 00000000..0b45723f --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/fan.h @@ -0,0 +1,278 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Management. + * + ***********************************************************/ +#ifndef __ONLP_FAN_H__ +#define __ONLP_FAN_H__ + +#include +#include + +/* */ +/** onlp_fan_status */ +typedef enum onlp_fan_status_e { + ONLP_FAN_STATUS_PRESENT = (1 << 0), + ONLP_FAN_STATUS_FAILED = (1 << 1), + ONLP_FAN_STATUS_B2F = (1 << 2), + ONLP_FAN_STATUS_F2B = (1 << 3), +} onlp_fan_status_t; + +/** onlp_fan_mode */ +typedef enum onlp_fan_mode_e { + ONLP_FAN_MODE_OFF, + ONLP_FAN_MODE_SLOW, + ONLP_FAN_MODE_NORMAL, + ONLP_FAN_MODE_FAST, + ONLP_FAN_MODE_MAX, + ONLP_FAN_MODE_LAST = ONLP_FAN_MODE_MAX, + ONLP_FAN_MODE_COUNT, + ONLP_FAN_MODE_INVALID = -1, +} onlp_fan_mode_t; + +/** onlp_fan_caps */ +typedef enum onlp_fan_caps_e { + ONLP_FAN_CAPS_B2F = (1 << 0), + ONLP_FAN_CAPS_F2B = (1 << 1), + ONLP_FAN_CAPS_SET_RPM = (1 << 2), + ONLP_FAN_CAPS_SET_PERCENTAGE = (1 << 3), + ONLP_FAN_CAPS_GET_RPM = (1 << 4), + ONLP_FAN_CAPS_GET_PERCENTAGE = (1 << 5), +} onlp_fan_caps_t; + +/** onlp_fan_dir */ +typedef enum onlp_fan_dir_e { + ONLP_FAN_DIR_B2F, + ONLP_FAN_DIR_F2B, + ONLP_FAN_DIR_LAST = ONLP_FAN_DIR_F2B, + ONLP_FAN_DIR_COUNT, + ONLP_FAN_DIR_INVALID = -1, +} onlp_fan_dir_t; +/* */ + +/** + * Fan information structure. + */ +typedef struct onlp_fan_info_s { + /** OID Header */ + onlp_oid_hdr_t hdr; + + /* Status */ + uint32_t status; + + /* Capabilities */ + uint32_t caps; + + /* Current fan speed, in RPM, if available */ + int rpm; + + /* Current fan percentage, if available */ + int percentage; + + /* Current fan mode, if available */ + onlp_fan_mode_t mode; + + /* Model (if applicable) */ + char model[ONLP_CONFIG_INFO_STR_MAX]; + + /* Serial Number (if applicable) */ + char serial[ONLP_CONFIG_INFO_STR_MAX]; + +} onlp_fan_info_t; + + +/** + * @brief Initialize the fan subsystem. + */ +int onlp_fan_init(void); + + +/** + * @brief Retrieve fan information. + * @param id The fan OID. + * @param rv [out] Receives the fan information. + */ +int onlp_fan_info_get(onlp_oid_t id, onlp_fan_info_t* rv); + +/** + * @brief Set the fan speed in RPMs. + * @param id The fan OID. + * @param rpm The new RPM. + * @note Only valid if the fan has the SET_RPM capability. + */ +int onlp_fan_rpm_set(onlp_oid_t id, int rpm); + +/** + * @brief Set the fan speed in percentage. + * @param id The fan OID. + * @param p The percentage. + * @note Only valid if the fan has the SET_PERCENTAGE capability. + */ +int onlp_fan_percentage_set(onlp_oid_t id, int p); + +/** + * @brief Set the fan speed by mode. + * @param id The fan OID. + * @param mode The fan mode value. + */ +int onlp_fan_mode_set(onlp_oid_t id, onlp_fan_mode_t mode); + +/** + * @brief Set the fan direction. + * @param id The fan OID. + * @param dir The fan direction (B2F or F2B) + * @notes Only called if both capabilities are set. + */ +int onlp_fan_dir_set(onlp_oid_t id, onlp_fan_dir_t dir); + +/** + * @brief Fan OID debug dump. + * @param id The fan OID. + * @param pvs The output pvs. + * @param flags The output flags. + */ +void onlp_fan_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * @brief Show the given Fan OID. + * @param id The Fan OID + * @param pvs The output pvs + * @param flags The output flags. + */ +void onlp_fan_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * Convenience macros for processing Fan status information. + */ +#define ONLP_FAN_STATUS_PRESENT(_fi) ((_fi).status & ONLP_FAN_STATUS_PRESENT) +#define ONLP_FAN_STATUS_MISSING(_fi) (!ONLP_FAN_INFO_PRESENT(_fi)) +#define ONLP_FAN_STATUS_FAILED(_fi) ( (_fi).status & ONLP_FAN_STATUS_FAILED) +#define ONLP_FAN_STATUS_NORMAL(_fi) ( ONLP_FAN_STATUS_PRESENT(_fi) && !ONLP_FAN_STATUS_FAILED(_fi) ) + + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_fan_status_name(onlp_fan_status_t e); + +/** Enum values. */ +int onlp_fan_status_value(const char* str, onlp_fan_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_fan_status_desc(onlp_fan_status_t e); + +/** Enum validator. */ +int onlp_fan_status_valid(onlp_fan_status_t e); + +/** validator */ +#define ONLP_FAN_STATUS_VALID(_e) \ + (onlp_fan_status_valid((_e))) + +/** onlp_fan_status_map table. */ +extern aim_map_si_t onlp_fan_status_map[]; +/** onlp_fan_status_desc_map table. */ +extern aim_map_si_t onlp_fan_status_desc_map[]; + +/** Strings macro. */ +#define ONLP_FAN_MODE_STRINGS \ +{\ + "OFF", \ + "SLOW", \ + "NORMAL", \ + "FAST", \ + "MAX", \ +} +/** Enum names. */ +const char* onlp_fan_mode_name(onlp_fan_mode_t e); + +/** Enum values. */ +int onlp_fan_mode_value(const char* str, onlp_fan_mode_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_fan_mode_desc(onlp_fan_mode_t e); + +/** validator */ +#define ONLP_FAN_MODE_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= ONLP_FAN_MODE_MAX)) + +/** onlp_fan_mode_map table. */ +extern aim_map_si_t onlp_fan_mode_map[]; +/** onlp_fan_mode_desc_map table. */ +extern aim_map_si_t onlp_fan_mode_desc_map[]; + +/** Enum names. */ +const char* onlp_fan_caps_name(onlp_fan_caps_t e); + +/** Enum values. */ +int onlp_fan_caps_value(const char* str, onlp_fan_caps_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_fan_caps_desc(onlp_fan_caps_t e); + +/** Enum validator. */ +int onlp_fan_caps_valid(onlp_fan_caps_t e); + +/** validator */ +#define ONLP_FAN_CAPS_VALID(_e) \ + (onlp_fan_caps_valid((_e))) + +/** onlp_fan_caps_map table. */ +extern aim_map_si_t onlp_fan_caps_map[]; +/** onlp_fan_caps_desc_map table. */ +extern aim_map_si_t onlp_fan_caps_desc_map[]; + +/** Strings macro. */ +#define ONLP_FAN_DIR_STRINGS \ +{\ + "B2F", \ + "F2B", \ +} +/** Enum names. */ +const char* onlp_fan_dir_name(onlp_fan_dir_t e); + +/** Enum values. */ +int onlp_fan_dir_value(const char* str, onlp_fan_dir_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_fan_dir_desc(onlp_fan_dir_t e); + +/** validator */ +#define ONLP_FAN_DIR_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= ONLP_FAN_DIR_F2B)) + +/** onlp_fan_dir_map table. */ +extern aim_map_si_t onlp_fan_dir_map[]; +/** onlp_fan_dir_desc_map table. */ +extern aim_map_si_t onlp_fan_dir_desc_map[]; +/* */ + + +#endif /* __ONLP_FAN_H__ */ + diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/led.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/led.h new file mode 100644 index 00000000..3366a39d --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/led.h @@ -0,0 +1,218 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * LED Management + * + ***********************************************************/ +#ifndef __ONLP_LED_H__ +#define __ONLP_LED_H__ + +#include +#include + +/* */ +/** onlp_led_status */ +typedef enum onlp_led_status_e { + ONLP_LED_STATUS_PRESENT = (1 << 0), + ONLP_LED_STATUS_FAILED = (1 << 1), + ONLP_LED_STATUS_ON = (1 << 2), +} onlp_led_status_t; + +/** onlp_led_mode */ +typedef enum onlp_led_mode_e { + ONLP_LED_MODE_OFF, + ONLP_LED_MODE_ON, + ONLP_LED_MODE_BLINKING, + ONLP_LED_MODE_RED = 10, + ONLP_LED_MODE_RED_BLINKING = 11, + ONLP_LED_MODE_ORANGE = 12, + ONLP_LED_MODE_ORANGE_BLINKING = 13, + ONLP_LED_MODE_YELLOW = 14, + ONLP_LED_MODE_YELLOW_BLINKING = 15, + ONLP_LED_MODE_GREEN = 16, + ONLP_LED_MODE_GREEN_BLINKING = 17, + ONLP_LED_MODE_BLUE = 18, + ONLP_LED_MODE_BLUE_BLINKING = 19, + ONLP_LED_MODE_PURPLE = 20, + ONLP_LED_MODE_PURPLE_BLINKING = 21, + ONLP_LED_MODE_AUTO = 22, +} onlp_led_mode_t; + +/** onlp_led_caps */ +typedef enum onlp_led_caps_e { + ONLP_LED_CAPS_ON_OFF = (1 << 0), + ONLP_LED_CAPS_RED = (1 << 10), + ONLP_LED_CAPS_RED_BLINKING = (1 << 11), + ONLP_LED_CAPS_ORANGE = (1 << 12), + ONLP_LED_CAPS_ORANGE_BLINKING = (1 << 13), + ONLP_LED_CAPS_YELLOW = ( 1 << 14), + ONLP_LED_CAPS_YELLOW_BLINKING = (1 << 15), + ONLP_LED_CAPS_GREEN = (1 << 16), + ONLP_LED_CAPS_GREEN_BLINKING = (1 << 17), + ONLP_LED_CAPS_BLUE = (1 << 18), + ONLP_LED_CAPS_BLUE_BLINKING = (1 << 19), + ONLP_LED_CAPS_PURPLE = (1 << 20), + ONLP_LED_CAPS_PURPLE_BLINKING = (1 << 21), + ONLP_LED_CAPS_AUTO = (1 << 22), +} onlp_led_caps_t; +/* */ + + +/** + * LED information structure. + */ +typedef struct onlp_led_info_s { + /** Header */ + onlp_oid_hdr_t hdr; + + /** Status */ + uint32_t status; + + /** Capabilities */ + uint32_t caps; + + /** Current mode, if capable. */ + onlp_led_mode_t mode; +} onlp_led_info_t; + +/** + * @brief Initialize the LED subsystem. + */ +int onlp_led_init(void); + +/** + * @brief Get LED information. + * @param id The LED OID + * @param rv [out] Receives the information structure. + */ +int onlp_led_info_get(onlp_oid_t id, onlp_led_info_t* rv); + +/** + * @brief Turn an LED on or off. + * @param id The LED OID + * @param on_or_off Led on (1) or LED off (0) + * @param Relevant if the LED has the ON_OFF capability. + * @note For the purposes of this function the + * interpretation of "on" for multi-mode or multi-color LEDs + * is up to the platform implementation. + */ +int onlp_led_set(onlp_oid_t id, int on_or_off); + +/** + * @brief Set the LED color + * @param id The LED OID + * @param color The color. + * @note Only relevant if the LED supports the color capability. + */ +int onlp_led_mode_set(onlp_oid_t id, onlp_led_mode_t color); + +/** + * @brief LED OID debug dump + * @param id The LED OID + * @param pvs The output pvs + * @param flags The output flags + */ +void onlp_led_dump(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags); + +/** + * @brief Show the given LED OID. + * @param id The LED OID + * @param pvs The output pvs + * @param flags The output flags + */ +void onlp_led_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_led_status_name(onlp_led_status_t e); + +/** Enum values. */ +int onlp_led_status_value(const char* str, onlp_led_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_led_status_desc(onlp_led_status_t e); + +/** Enum validator. */ +int onlp_led_status_valid(onlp_led_status_t e); + +/** validator */ +#define ONLP_LED_STATUS_VALID(_e) \ + (onlp_led_status_valid((_e))) + +/** onlp_led_status_map table. */ +extern aim_map_si_t onlp_led_status_map[]; +/** onlp_led_status_desc_map table. */ +extern aim_map_si_t onlp_led_status_desc_map[]; + +/** Enum names. */ +const char* onlp_led_mode_name(onlp_led_mode_t e); + +/** Enum values. */ +int onlp_led_mode_value(const char* str, onlp_led_mode_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_led_mode_desc(onlp_led_mode_t e); + +/** Enum validator. */ +int onlp_led_mode_valid(onlp_led_mode_t e); + +/** validator */ +#define ONLP_LED_MODE_VALID(_e) \ + (onlp_led_mode_valid((_e))) + +/** onlp_led_mode_map table. */ +extern aim_map_si_t onlp_led_mode_map[]; +/** onlp_led_mode_desc_map table. */ +extern aim_map_si_t onlp_led_mode_desc_map[]; + +/** Enum names. */ +const char* onlp_led_caps_name(onlp_led_caps_t e); + +/** Enum values. */ +int onlp_led_caps_value(const char* str, onlp_led_caps_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_led_caps_desc(onlp_led_caps_t e); + +/** Enum validator. */ +int onlp_led_caps_valid(onlp_led_caps_t e); + +/** validator */ +#define ONLP_LED_CAPS_VALID(_e) \ + (onlp_led_caps_valid((_e))) + +/** onlp_led_caps_map table. */ +extern aim_map_si_t onlp_led_caps_map[]; +/** onlp_led_caps_desc_map table. */ +extern aim_map_si_t onlp_led_caps_desc_map[]; +/* */ + +#endif /* __ONLP_LED_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/oids.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/oids.h new file mode 100644 index 00000000..20ce5746 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/oids.h @@ -0,0 +1,224 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * ONLP Platform Object Identifiers. + * + ***********************************************************/ +#ifndef __ONLP_OID_H__ +#define __ONLP_OID_H__ + +#include + +#include +#include +#include + +/** + * System peripherals are identified by a 32bit OID. + * + * The First byte is the object-class identifier: + * Thermal sensor object + * Fan object + * PSU object + * LED object + * MODULE object + * etc.. + * The remaining bytes are the object id. + */ + +typedef uint32_t onlp_oid_t; + +/* */ +/** onlp_oid_type */ +typedef enum onlp_oid_type_e { + ONLP_OID_TYPE_SYS = 1, + ONLP_OID_TYPE_THERMAL = 2, + ONLP_OID_TYPE_FAN = 3, + ONLP_OID_TYPE_PSU = 4, + ONLP_OID_TYPE_LED = 5, + ONLP_OID_TYPE_MODULE = 6, + ONLP_OID_TYPE_RTC = 7, +} onlp_oid_type_t; +/* */ + + +/** + * Get the or set the type of an OID + */ +#define ONLP_OID_TYPE_GET(_id) ( ( (_id) >> 24) ) +#define ONLP_OID_TYPE_CREATE(_type, _id) ( ( (_type) << 24) | (_id)) +#define ONLP_OID_IS_TYPE(_type,_id) (ONLP_OID_TYPE_GET((_id)) == _type) +#define ONLP_OID_ID_GET(_id) (_id & 0xFFFFFF) +#define ONLP_THERMAL_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_THERMAL, _id) +#define ONLP_FAN_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_FAN, _id) +#define ONLP_PSU_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_PSU, _id) +#define ONLP_LED_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_LED, _id) +#define ONLP_MODULE_ID_CREATE(_id) ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_MODULE, _id) + +#define ONLP_OID_IS_THERMAL(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_THERMAL,_id) +#define ONLP_OID_IS_FAN(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_FAN,_id) +#define ONLP_OID_IS_PSU(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_PSU,_id) +#define ONLP_OID_IS_LED(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_LED,_id) +#define ONLP_OID_IS_MODULE(_id) ONLP_OID_IS_TYPE(ONLP_OID_TYPE_MODULE,_id) + + +/** + * There is only one SYS OID. This value should be used. + */ +#define ONLP_OID_SYS ONLP_OID_TYPE_CREATE(ONLP_OID_TYPE_SYS, 1) + +/** + * All OIDs have user-level description strings: + */ +#define ONLP_OID_DESC_SIZE 128 + +typedef char onlp_oid_desc_t[ONLP_OID_DESC_SIZE]; + +/* fixme */ +#define ONLP_OID_TABLE_SIZE 32 +typedef onlp_oid_t onlp_oid_table_t[ONLP_OID_TABLE_SIZE]; +#define ONLP_OID_TABLE_SIZE_BYTES (sizeof(onlp_oid_t)*ONLP_OID_TABLE_SIZE) +#define ONLP_OID_TABLE_COPY(_dst, _src) memcpy(_dst, _src, ONLP_OID_TABLE_SIZE_BYTES) +#define ONLP_OID_TABLE_CLEAR(_table) memset(_table, 0, ONLP_OID_TABLE_SIZE_BYTES) + + +/** + * This macro can be used to construct your OID hdr tables + */ +#define ONLP_OID_THERMAL_ENTRY(_id, _desc, _parent_type, _parent_id) \ + { ONLP_THERMAL_ID_CREATE(_id), _desc, ONLP_OID_TYPE_CREATE(_parent_type, _parent_id) } + +/** + * All OID objects contain this header as the first member. + */ +typedef struct onlp_oid_hdr_s { + /** The OID */ + onlp_oid_t id; + /** The description of this object. */ + onlp_oid_desc_t description; + /** The parent OID of this object. */ + onlp_oid_t poid; + /** The children of this OID */ + onlp_oid_table_t coids; +} onlp_oid_hdr_t; + + +#define ONLP_OID_DUMP_F_RECURSE 0x1 +#define ONLP_OID_DUMP_F_EVEN_IF_ABSENT 0x2 + +#define ONLP_OID_SHOW_F_RECURSE 0x1 +#define ONLP_OID_SHOW_F_EXTENDED 0x2 +#define ONLP_OID_SHOW_F_YAML 0x4 + +void onlp_oid_dump(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags); +void onlp_oid_table_dump(onlp_oid_table_t table, aim_pvs_t* pvs, + uint32_t flags); + +void onlp_oid_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags); +void onlp_oid_table_show(onlp_oid_table_t table, aim_pvs_t* pvs, + uint32_t flags); + +/** + * @brief Iterate over all OIDS in the given table that match the given expression. + * @param _table The OID table + * @param _oidp OID pointer iterator + * @param _expr OID Expression which must be true + */ +#define ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, _expr) \ + for(_oidp = _table; _oidp < (_table+ONLP_OID_TABLE_SIZE); _oidp++) \ + if( (*_oidp) && (_expr) ) + +/** + * @brief Iterate over all OIDs in the given table. + * @param _table The OID table + * @param _oidp OID pointer iterator + */ +#define ONLP_OID_TABLE_ITER(_table, _oidp) ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, 1) + +/** + * @brief Iterate over all OIDs in the given table of the given type. + * @param _table The OID table + * @param _oidp OID pointer iteration. + * @param _type The OID Type + */ + +#define ONLP_OID_TABLE_ITER_TYPE(_table, _oidp, _type) \ + ONLP_OID_TABLE_ITER_EXPR(_table, _oidp, ONLP_OID_IS_TYPE(ONLP_OID_TYPE_##_type, *_oidp)) + + +/** + * Iterator + */ +typedef int (*onlp_oid_iterate_f)(onlp_oid_t oid, void* cookie); + +/** + * @brief Iterate over all platform OIDs. + * @param oid The root OID. + * @param type The OID type filter (optional) + * @param itf The iterator function. + * @param cookie The cookie. + */ +int onlp_oid_iterate(onlp_oid_t oid, onlp_oid_type_t type, + onlp_oid_iterate_f itf, void* cookie); + +/** + * @brief Get the OID header for a given OID. + * @param oid The oid + * @param hdr [out] Receives the header + */ +int onlp_oid_hdr_get(onlp_oid_t oid, onlp_oid_hdr_t* hdr); + + + + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_oid_type_name(onlp_oid_type_t e); + +/** Enum values. */ +int onlp_oid_type_value(const char* str, onlp_oid_type_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_oid_type_desc(onlp_oid_type_t e); + +/** Enum validator. */ +int onlp_oid_type_valid(onlp_oid_type_t e); + +/** validator */ +#define ONLP_OID_TYPE_VALID(_e) \ + (onlp_oid_type_valid((_e))) + +/** onlp_oid_type_map table. */ +extern aim_map_si_t onlp_oid_type_map[]; +/** onlp_oid_type_desc_map table. */ +extern aim_map_si_t onlp_oid_type_desc_map[]; +/* */ + +#endif /* __ONLP_OID_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.h new file mode 100644 index 00000000..6c0e7d2a --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.h @@ -0,0 +1,104 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_ONLP_H__ +#define __ONLP_ONLP_H__ + +#include + +/* */ +/** onlp_status */ +typedef enum onlp_status_e { + ONLP_STATUS_OK = 0, + ONLP_STATUS_E_UNSUPPORTED = -1, + ONLP_STATUS_E_MISSING = -2, + ONLP_STATUS_E_INVALID = -3, + ONLP_STATUS_E_INTERNAL = -4, + ONLP_STATUS_E_PARAM = -5, +} onlp_status_t; +/* */ + +#define ONLP_IF_ERROR_RETURN(_expr) \ + do { \ + int _rv = (_expr); \ + if(_rv < 0) { \ + return _rv; \ + } \ + } while(0) + + +/** + * @brief Initialize all subsystems. + */ +int onlp_init(void); + + +/** + * @brief Dump the current platform data. + * @param pvs The output pvs + */ + +void onlp_platform_dump(aim_pvs_t* pvs, uint32_t flags); +void onlp_platform_show(aim_pvs_t* pvs, uint32_t flags); + +/** Standardized macros for dealing with sensor milli-values */ +#define ONLP_MILLI_NORMAL_INTEGER(_m) (_m / 1000) +#define ONLP_MILLI_NORMAL_TENTHS(_m) ( (_m % 1000) / 100) +#define ONLP_MILLI_NORMAL_INTEGER_TENTHS(_m) ONLP_MILLI_NORMAL_INTEGER(_m), ONLP_MILLI_NORMAL_TENTHS(_m) + + + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_status_name(onlp_status_t e); + +/** Enum values. */ +int onlp_status_value(const char* str, onlp_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_status_desc(onlp_status_t e); + +/** Enum validator. */ +int onlp_status_valid(onlp_status_t e); + +/** validator */ +#define ONLP_STATUS_VALID(_e) \ + (onlp_status_valid((_e))) + +/** onlp_status_map table. */ +extern aim_map_si_t onlp_status_map[]; +/** onlp_status_desc_map table. */ +extern aim_map_si_t onlp_status_desc_map[]; +/* */ + +#endif /* __ONLP_ONLP_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.x b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.x new file mode 100644 index 00000000..6598122c --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp.x @@ -0,0 +1,63 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + + +/* */ +#ifdef ONLP_OID_TYPE_ENTRY +ONLP_OID_TYPE_ENTRY(SYS, 1) +ONLP_OID_TYPE_ENTRY(THERMAL, 2) +ONLP_OID_TYPE_ENTRY(FAN, 3) +ONLP_OID_TYPE_ENTRY(PSU, 4) +ONLP_OID_TYPE_ENTRY(LED, 5) +ONLP_OID_TYPE_ENTRY(MODULE, 6) +ONLP_OID_TYPE_ENTRY(RTC, 7) +#undef ONLP_OID_TYPE_ENTRY +#endif +/* */ + +/* */ +#ifdef ONLP_ENUMERATION_ENTRY +ONLP_ENUMERATION_ENTRY(onlp_sfp_control_flag, "") +ONLP_ENUMERATION_ENTRY(onlp_psu_status, "") +ONLP_ENUMERATION_ENTRY(onlp_sfp_control, "") +ONLP_ENUMERATION_ENTRY(onlp_led_caps, "") +ONLP_ENUMERATION_ENTRY(onlp_led_status, "") +ONLP_ENUMERATION_ENTRY(onlp_thermal_status, "") +ONLP_ENUMERATION_ENTRY(onlp_oid_type, "") +ONLP_ENUMERATION_ENTRY(onlp_fan_caps, "") +ONLP_ENUMERATION_ENTRY(onlp_fan_status, "") +ONLP_ENUMERATION_ENTRY(onlp_status, "") +ONLP_ENUMERATION_ENTRY(onlp_thermal_caps, "") +ONLP_ENUMERATION_ENTRY(onlp_fan_dir, "") +ONLP_ENUMERATION_ENTRY(onlp_fan_mode, "") +ONLP_ENUMERATION_ENTRY(onlp_psu_caps, "") +ONLP_ENUMERATION_ENTRY(onlp_led_mode, "") +#undef ONLP_ENUMERATION_ENTRY +#endif +/* */ + + diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_config.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_config.h new file mode 100644 index 00000000..baecc3f9 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_config.h @@ -0,0 +1,272 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * @file + * @brief onlp Configuration Header + * + * @addtogroup onlp-config + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_CONFIG_H__ +#define __ONLP_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef ONLP_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * ONLP_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef ONLP_CONFIG_INCLUDE_LOGGING +#define ONLP_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * ONLP_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef ONLP_CONFIG_LOG_OPTIONS_DEFAULT +#define ONLP_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * ONLP_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef ONLP_CONFIG_LOG_BITS_DEFAULT +#define ONLP_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * ONLP_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef ONLP_CONFIG_PORTING_STDLIB +#define ONLP_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLP_CONFIG_PORTING_STDLIB +#endif + +/** + * ONLP_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef ONLP_CONFIG_INCLUDE_UCLI +#define ONLP_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK + * + * Include platform error checking at initialization. */ + + +#ifndef ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK +#define ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK 1 +#endif + +/** + * ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT + * + * Include global shlock initialization at module init time. */ + + +#ifndef ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT +#define ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT 0 +#endif + +/** + * ONLP_CONFIG_INCLUDE_PLATFORM_STATIC + * + * Specify the platform name directly as a compile-time option. */ + + +#ifndef ONLP_CONFIG_INCLUDE_PLATFORM_STATIC +#define ONLP_CONFIG_INCLUDE_PLATFORM_STATIC 0 +#endif + +/** + * ONLP_CONFIG_PLATFORM_STATIC + * + * The name of the static platform if configured. */ + + +#ifndef ONLP_CONFIG_PLATFORM_STATIC +#define ONLP_CONFIG_PLATFORM_STATIC "unknown" +#endif + +/** + * ONLP_CONFIG_PLATFORM_FILENAME + * + * The local filename containing the current platform identifier. */ + + +#ifndef ONLP_CONFIG_PLATFORM_FILENAME +#define ONLP_CONFIG_PLATFORM_FILENAME "/etc/onl/platform" +#endif + +/** + * ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES + * + * Allow support for local overrides of all platform OID values (testing). */ + + +#ifndef ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES +#define ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES 1 +#endif + +/** + * ONLP_CONFIG_CONFIGURATION_FILENAME + * + * The filename for the (optional) ONLP JSON configuration file. */ + + +#ifndef ONLP_CONFIG_CONFIGURATION_FILENAME +#define ONLP_CONFIG_CONFIGURATION_FILENAME "/etc/onlp.conf" +#endif + +/** + * ONLP_CONFIG_CONFIGURATION_ENV + * + * Environment variable to check for configuration filenames. Overrides default. */ + + +#ifndef ONLP_CONFIG_CONFIGURATION_ENV +#define ONLP_CONFIG_CONFIGURATION_ENV "ONLP_CONF" +#endif + +/** + * ONLP_CONFIG_INCLUDE_API_LOCK + * + * Include exclusive locking for all API calls. */ + + +#ifndef ONLP_CONFIG_INCLUDE_API_LOCK +#define ONLP_CONFIG_INCLUDE_API_LOCK 1 +#endif + +/** + * ONLP_CONFIG_API_LOCK_GLOBAL_SHARED + * + * If 0, the API lock is a simple semaphore. If 1, the API lock is a global shared mutex. */ + + +#ifndef ONLP_CONFIG_API_LOCK_GLOBAL_SHARED +#define ONLP_CONFIG_API_LOCK_GLOBAL_SHARED 0 +#endif + +/** + * ONLP_CONFIG_API_LOCK_TIMEOUT + * + * The maximum amount of time (in usecs) to wait while attempting to acquire the API lock. Failure to acquire is fatal. A value of zero disables this feature. */ + + +#ifndef ONLP_CONFIG_API_LOCK_TIMEOUT +#define ONLP_CONFIG_API_LOCK_TIMEOUT 60000000 +#endif + +/** + * ONLP_CONFIG_INFO_STR_MAX + * + * The maximum size of static information string buffers. */ + + +#ifndef ONLP_CONFIG_INFO_STR_MAX +#define ONLP_CONFIG_INFO_STR_MAX 64 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct onlp_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} onlp_config_settings_t; + +/** Configuration settings table. */ +/** onlp_config_settings table. */ +extern onlp_config_settings_t onlp_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* onlp_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int onlp_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "onlp_porting.h" + +#endif /* __ONLP_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_dox.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_dox.h new file mode 100644 index 00000000..9da554c4 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_dox.h @@ -0,0 +1,45 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_DOX_H__ +#define __ONLP_DOX_H__ + +/** + * @defgroup onlp onlp - onlp Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup onlp-onlp Public Interface + * @defgroup onlp-config Compile Time Configuration + * @defgroup onlp-porting Porting Macros + * + * @} + * + */ + +#endif /* __ONLP_DOX_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_porting.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_porting.h new file mode 100644 index 00000000..281a323b --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/onlp_porting.h @@ -0,0 +1,92 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * @file + * @brief onlp Porting Macros. + * + * @addtogroup onlp-porting + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_PORTING_H__ +#define __ONLP_PORTING_H__ + + +/* */ +#if ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ONLP_MEMSET + #if defined(GLOBAL_MEMSET) + #define ONLP_MEMSET GLOBAL_MEMSET + #elif ONLP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_MEMSET memset + #else + #error The macro ONLP_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ONLP_MEMCPY GLOBAL_MEMCPY + #elif ONLP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_MEMCPY memcpy + #else + #error The macro ONLP_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define ONLP_STRNCPY GLOBAL_STRNCPY + #elif ONLP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_STRNCPY strncpy + #else + #error The macro ONLP_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_STRLEN + #if defined(GLOBAL_STRLEN) + #define ONLP_STRLEN GLOBAL_STRLEN + #elif ONLP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_STRLEN strlen + #else + #error The macro ONLP_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ONLP_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/fani.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/fani.h new file mode 100644 index 00000000..76807822 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/fani.h @@ -0,0 +1,83 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation. + * + ***********************************************************/ +#ifndef __ONLP_FANI_H__ +#define __ONLP_FANI_H__ + +#include + +/** + * @brief Initialize the fan platform subsystem. + */ +int onlp_fani_init(void); + +/** + * @brief Get the information structure for the given fan OID. + * @param id The fan OID + * @param rv [out] Receives the fan information. + */ +int onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* rv); + +/** + * @brief Set the fan speed in RPM. + * @param id The fan OID + * @param rpm The new RPM + * @note This is only relevant if the RPM capability is set. + */ +int onlp_fani_rpm_set(onlp_oid_t id, int rpm); + + +/** + * @brief Set the fan speed in percentage. + * @param id The fan OID. + * @param p The new fan speed percentage. + * @note This is only relevant if the PERCENTAGE capability is set. + */ +int onlp_fani_percentage_set(onlp_oid_t id, int p); + +/** + * @brief Set the fan mode. + * @param id The fan OID. + * @param mode The new fan mode. + */ +int onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode); + + +/** + * @brief Set the fan direction (if supported). + * @param id The fan OID + * @param dir The direction. + */ +int onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir); + +/** + * @brief Generic fan ioctl + * @param id The fan OID + * @param vargs The variable argument list for the ioctl call. + * @param Optional + */ +int onlp_fani_ioctl(onlp_oid_t fid, va_list vargs); + +#endif /* __ONLP_FANI_H__ */ + diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/ledi.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/ledi.h new file mode 100644 index 00000000..9bb043fa --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/ledi.h @@ -0,0 +1,66 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * LED Platform Implementation. + * + ***********************************************************/ +#ifndef __ONLP_LEDI_H__ +#define __ONLP_LEDI_H__ + +#include + +/** + * @brief Initialize the LED subsystem. + */ +int onlp_ledi_init(void); + +/** + * @brief Get the information for the given LED + * @param id The LED OID + * @param rv [out] Receives the LED information. + */ +int onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* rv); + +/** + * @brief Turn an LED on or off + * @param id The LED OID + * @param on_or_off (boolean) on if 1 off if 0 + * @param This function is only relevant if the ONOFF capability is set. + * @notes See onlp_led_set() for a description of the default behavior. + */ +int onlp_ledi_set(onlp_oid_t id, int on_or_off); + +/** + * @brief LED ioctl + * @param id The LED OID + * @param vargs The variable argument list for the ioctl call. + */ +int onlp_ledi_ioctl(onlp_oid_t id, va_list vargs); + +/** + * @brief Set the LED mode. + * @param id The LED OID + * @param mode The new mode. + * @notes Only called if the mode is advertised in the LED capabilities. + */ +int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode); + +#endif /* __ONLP_LED_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/psui.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/psui.h new file mode 100644 index 00000000..e9f75da5 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/psui.h @@ -0,0 +1,50 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Power Supply Management Implementation. + * + ***********************************************************/ +#ifndef __ONLP_PSUI_H__ +#define __ONLP_PSUI_H__ + +#include + +/** + * @brief Initialize the PSU subsystem. + */ +int onlp_psui_init(void); + +/** + * @brief Get the information structure for the given PSU + * @param id The PSU OID + * @param rv [out] Receives the PSU information. + */ +int onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* rv); + +/** + * @brief Generic PSU ioctl + * @param id The PSU OID + * @param vargs The variable argument list for the ioctl call. + */ +int onlp_psui_ioctl(onlp_oid_t pid, va_list vargs); + + +#endif /* __ONLP_PSUI_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sfpi.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sfpi.h new file mode 100644 index 00000000..3f451cbb --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sfpi.h @@ -0,0 +1,162 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * SFP Platform Implementation Interface. + * + * This interface must be implemented and available for all + * platforms that support SFP interfaces. + * + ***********************************************************/ +#ifndef __ONLP_SFPI_H__ +#define __ONLP_SFPI_H__ + +#include +#include +#include + +/** + * @brief Initialize the SFPI subsystem. + */ +int onlp_sfpi_init(void); + +/** + * @brief Get the bitmap of SFP-capable port numbers. + * @param bmap [out] Receives the bitmap. + */ +int onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap); + +/** + * @brief Determine if an SFP is present. + * @param port The port number. + * @returns 1 if present + * @returns 0 if absent + * @returns An error condition. + */ +int onlp_sfpi_is_present(int port); + +/** + * @brief Return the presence bitmap for all SFP ports. + * @param dst Receives the presence bitmap. + */ +int onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst); + +/** + * @brief Return the RX_LOS bitmap for all SFP ports. + * @param dst Receives the RX_LOS bitmap. + */ +int onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst); + +/** + * @brief Read the SFP EEPROM. + * @param port The port number. + * @param data Receives the SFP data. + */ +int onlp_sfpi_eeprom_read(int port, uint8_t data[256]); + +/** + * @brief Read the SFP DOM EEPROM. + * @param port The port number. + * @param data Receives the SFP data. + */ +int onlp_sfpi_dom_read(int port, uint8_t data[256]); + +/** + * @brief Perform any actions required after an SFP is inserted. + * @param port The port number. + * @param info The SFF Module information structure. + * @notes Optional + */ +int onlp_sfpi_post_insert(int port, sff_info_t* info); + +/** + * @brief Returns whether or not the given control is suppport on the given port. + * @param port The port number. + * @param control The control. + * @param rv [out] Receives 1 if supported, 0 if not supported. + * @note This provided for convenience and is optional. + * If you implement this function your control_set and control_get APIs + * will not be called on unsupported ports. + */ +int onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* rv); + +/** + * @brief Set an SFP control. + * @param port The port. + * @param control The control. + * @param value The value. + */ +int onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value); + +/** + * @brief Get an SFP control. + * @param port The port. + * @param control The control + * @param [out] value Receives the current value. + */ +int onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value); + +/** + * @brief Remap SFP user SFP port numbers before calling the SFPI interface. + * @param port The user SFP port number. + * @param [out] rport Receives the new port. + * @note This function will be called to remap the user SFP port number + * to the number returned in rport before the SFPI functions are called. + * This is an optional convenience for platforms with dynamic or + * variant physical SFP numbering. + */ +int onlp_sfpi_port_map(int port, int* rport); + +/** + * @brief Deinitialize the SFP driver. + */ +int onlp_sfpi_denit(void); + +/** + * @brief Generic debug status information. + * @param port The port number. + * @param pvs The output pvs. + * @notes The purpose of this vector is to allow reporting of internal debug + * status and information from the platform driver that might be used to debug + * SFP runtime issues. + * For example, internal equalizer settings, tuning status information, status + * of additional signals useful for system debug but not exposed in this interface. + * + * @notes This is function is optional. + */ +void onlp_sfpi_debug(int port, aim_pvs_t* pvs); + +/** + * @brief Generic ioctl + * @param port The port number + * @param The variable argument list of parameters. + * + * @notes This generic ioctl interface can be used + * for platform-specific or driver specific features + * that cannot or have not yet been defined in this + * interface. It is intended as a future feature expansion + * support mechanism. + * + * @notes Optional + */ +int onlp_sfpi_ioctl(int port, va_list vargs); + + +#endif /* __ONLP_SFPI_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sysi.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sysi.h new file mode 100644 index 00000000..692cedee --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/sysi.h @@ -0,0 +1,157 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * ONLP System Platform Interface. + * + ***********************************************************/ +#ifndef __ONLP_SYSI_H__ +#define __ONLP_SYSI_H__ + +#include + + +/** + * @brief Return the name of the the platform implementation. + * @notes This will be called PRIOR to any other calls into the + * platform driver, including the sysi_init() function below. + * + * The platform implementation name should match the current + * ONLP platform name. + * + * IF the platform implementation name equals the current platform name, + * initialization will continue. + * + * If the platform implementation name does not match, the following will be + * attempted: + * + * onlp_sysi_platform_set(current_platform_name); + * If this call is successful, initialization will continue. + * If this call fails, platform initialization will abort(). + * + * The onlp_sysi_platform_set() function is optional. + * The onlp_sysi_platform_get() is not optional. + */ +const char* onlp_sysi_platform_get(void); + +/** + * @brief Attempt to set the platform personality + * in the event that the current platform does not match the + * reported platform. + * @note Optional + */ +int onlp_sysi_platform_set(const char* platform); + + + + +/** + * @brief Initialize the system platform subsystem. + */ +int onlp_sysi_init(void); + + +/** + * @brief Provide the physical base address for the ONIE eeprom. + * @param param [out] physaddr Receives the physical address. + * @notes If your platform provides a memory-mappable base + * address for the ONIE eeprom data you can return it here. + * The ONLP common code will then use this address and decode + * the ONIE TLV specification data. If you cannot return a mappable + * address due to the platform organization see onlp_sysi_onie_data_get() + * instead. + */ + int onlp_sysi_onie_data_phys_addr_get(void** physaddr); + +/** + * @brief Return the raw contents of the ONIE system eeprom. + * @param data [out] Receives the data pointer to the ONIE data. + * @param size [out] Receives the size of the data (if available). + * @notes This function is only necessary if you cannot provide + * the physical base address as per onlp_sysi_onie_data_phys_addr_get(). + */ +int onlp_sysi_onie_data_get(uint8_t** data, int* size); + +/** + * @brief Free the data returned by onlp_sys_onie_data_get() + * @param data The data pointer. + * @notes If onlp_sysi_onie_data_get() is called to retreive the + * contents of the ONIE system eeprom then this function + * will be called to perform any cleanup that may be necessary + * after the data has been used. + */ +void onlp_sysi_onie_data_free(uint8_t* data); + + +/** + * @brief Return the ONIE system information for this platform. + * @param onie The onie information structure. + * @notes If all previous attempts to get the eeprom data fail + * then this routine will be called. Used as a translation option + * for platforms without access to an ONIE-formatted eeprom. + */ +int onlp_sysi_onie_info_get(onlp_onie_info_t* onie); + + +/** + * @brief This function returns the root oid list for the platform. + * @param table [out] Receives the table. + * @param max The maximum number of entries you can fill. + */ +int onlp_sysi_oids_get(onlp_oid_t* table, int max); + + +/** + * @brief This function provides a generic ioctl interface. + * @param code context dependent. + * @param vargs The variable argument list for the ioctl call. + * @notes This is provided as a generic expansion and + * and custom programming mechanism for future and non-standard + * functionality. + * @notes Optional + */ +int onlp_sysi_ioctl(int code, va_list vargs); + + +/** + * @brief Perform necessary platform fan management. + * @note This function should automatically adjust the FAN speeds + * according to the platform conditions. + */ +int onlp_sysi_platform_manage_fans(void); + +/** + * @brief Perform necessary platform LED management. + * @note This function should automatically adjust the LED indicators + * according to the platform conditions. + */ +int onlp_sysi_platform_manage_leds(void); + +/** + * @brief Return custom platform information. + */ +int onlp_sysi_platform_info_get(onlp_platform_info_t* info); + +/** + * @brief Friee a custom platform information structure. + */ +void onlp_sysi_platform_info_free(onlp_platform_info_t* info); + +#endif /* __ONLP_SYSI_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/thermali.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/thermali.h new file mode 100644 index 00000000..fd2a29af --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/platformi/thermali.h @@ -0,0 +1,48 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#ifndef __ONLP_THERMALI_H__ +#define __ONLP_THERMALI_H__ + +#include + +/** + * @brief Initialize the thermal subsystem. + */ +int onlp_thermali_init(void); + + +/** + * @brief Get the information for the given thermal OID. + * @param id The Thermal OID + * @param rv [out] Receives the thermal information. + */ +int onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv); + +/** + * @brief Generic ioctl. + */ +int onlp_thermali_ioctl(int id, va_list vargs); + +#endif /* __ONLP_THERMALI_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/psu.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/psu.h new file mode 100644 index 00000000..0095ccdb --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/psu.h @@ -0,0 +1,190 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Power Supply Management. + * + ***********************************************************/ +#ifndef __ONLP_PSU_H__ +#define __ONLP_PSU_H__ + +#include +#include + +/* */ +/** onlp_psu_caps */ +typedef enum onlp_psu_caps_e { + ONLP_PSU_CAPS_AC = (1 << 0), + ONLP_PSU_CAPS_DC12 = (1 << 1), + ONLP_PSU_CAPS_DC48 = (1 << 2), + ONLP_PSU_CAPS_VIN = (1 << 3), + ONLP_PSU_CAPS_VOUT = (1 << 4), + ONLP_PSU_CAPS_IIN = (1 << 5), + ONLP_PSU_CAPS_IOUT = (1 << 6), + ONLP_PSU_CAPS_PIN = (1 << 7), + ONLP_PSU_CAPS_POUT = (1 << 8), +} onlp_psu_caps_t; + +/** onlp_psu_status */ +typedef enum onlp_psu_status_e { + ONLP_PSU_STATUS_PRESENT = (1 << 0), + ONLP_PSU_STATUS_FAILED = (1 << 1), + ONLP_PSU_STATUS_UNPLUGGED = (1 << 2), +} onlp_psu_status_t; +/* */ + + +/** + * PSU Information Structure + */ +typedef struct onlp_psu_info_t { + /** OID Header */ + onlp_oid_hdr_t hdr; + + /* Model */ + char model[ONLP_CONFIG_INFO_STR_MAX]; + + /* Serial Number */ + char serial[ONLP_CONFIG_INFO_STR_MAX]; + + /* Status */ + uint32_t status; + + /* Capabilities */ + uint32_t caps; + + /* millivolts */ + int mvin; + int mvout; + + /* milliamps */ + int miin; + int miout; + + /* milliwatts */ + int mpin; + int mpout; + +} onlp_psu_info_t; + +/** + * @brief Initialize the PSU subsystem. + */ +int onlp_psu_init(void); + +/** + * @brief Get the PSU information. + * @param id The PSU OID. + * @param rv [out] Receives the information structure. + */ +int onlp_psu_info_get(onlp_oid_t id, onlp_psu_info_t* rv); + +/** + * @brief Issue a PSU ioctl. + * @param id The PSU OID + * @param ... Ioctl arguments. + */ +int onlp_psu_ioctl(onlp_oid_t id, ...); + +/** + * @brief Issue a PSU ioctl. + * @param id The PSU OID + * @param vargs Ioctl arguments. + */ +int onlp_psu_vioctl(onlp_oid_t id, va_list vargs); + +/** + * @brief PSU OID debug dump + * @param id The PSU OID + * @param pvs The output pvs + * @param flags The output flags + */ +void onlp_psu_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + + +/** + * @brief Show the given PSU OID. + * @param id The PSU OID + * @param pvs The output pvs + * @param flags The output flags + */ +void onlp_psu_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * Convenience macros for processing PSU status. + */ +#define ONLP_PSU_STATUS_PRESENT(_pi) ( (_pi).status & ONLP_PSU_STATUS_PRESENT ) +#define ONLP_PSU_STATUS_MISSING(_pi) (!ONLP_PSU_STATUS_PRESENT(_pi)) +#define ONLP_PSU_STATUS_FAILED(_pi) ( (_pi).status & ONLP_PSU_STATUS_FAILED) + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_psu_caps_name(onlp_psu_caps_t e); + +/** Enum values. */ +int onlp_psu_caps_value(const char* str, onlp_psu_caps_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_psu_caps_desc(onlp_psu_caps_t e); + +/** Enum validator. */ +int onlp_psu_caps_valid(onlp_psu_caps_t e); + +/** validator */ +#define ONLP_PSU_CAPS_VALID(_e) \ + (onlp_psu_caps_valid((_e))) + +/** onlp_psu_caps_map table. */ +extern aim_map_si_t onlp_psu_caps_map[]; +/** onlp_psu_caps_desc_map table. */ +extern aim_map_si_t onlp_psu_caps_desc_map[]; + +/** Enum names. */ +const char* onlp_psu_status_name(onlp_psu_status_t e); + +/** Enum values. */ +int onlp_psu_status_value(const char* str, onlp_psu_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_psu_status_desc(onlp_psu_status_t e); + +/** Enum validator. */ +int onlp_psu_status_valid(onlp_psu_status_t e); + +/** validator */ +#define ONLP_PSU_STATUS_VALID(_e) \ + (onlp_psu_status_valid((_e))) + +/** onlp_psu_status_map table. */ +extern aim_map_si_t onlp_psu_status_map[]; +/** onlp_psu_status_desc_map table. */ +extern aim_map_si_t onlp_psu_status_desc_map[]; +/* */ + +#endif /* __ONLP_PSU_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/sfp.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/sfp.h new file mode 100644 index 00000000..c623e089 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/sfp.h @@ -0,0 +1,256 @@ +/************************************************************* + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************* + * + * SFP Management Interface. + * + ************************************************************/ +#ifndef __ONLP_SFP_H__ +#define __ONLP_SFP_H__ + +#include +#include +#include +#include +#include + +/* */ +/** onlp_sfp_control */ +typedef enum onlp_sfp_control_e { + ONLP_SFP_CONTROL_RESET, + ONLP_SFP_CONTROL_RESET_STATE, + ONLP_SFP_CONTROL_RX_LOS, + ONLP_SFP_CONTROL_TX_FAULT, + ONLP_SFP_CONTROL_TX_DISABLE, + ONLP_SFP_CONTROL_LP_MODE, + ONLP_SFP_CONTROL_POWER_OVERRIDE, + ONLP_SFP_CONTROL_LAST = ONLP_SFP_CONTROL_POWER_OVERRIDE, + ONLP_SFP_CONTROL_COUNT, + ONLP_SFP_CONTROL_INVALID = -1, +} onlp_sfp_control_t; +/* */ + +/* */ +/** onlp_sfp_control_flag */ +typedef enum onlp_sfp_control_flag_e { + ONLP_SFP_CONTROL_FLAG_RESET = (1 << ONLP_SFP_CONTROL_RESET), + ONLP_SFP_CONTROL_FLAG_RESET_STATE = ( 1 << ONLP_SFP_CONTROL_RESET_STATE ), + ONLP_SFP_CONTROL_FLAG_RX_LOS = ( 1 << ONLP_SFP_CONTROL_RX_LOS ), + ONLP_SFP_CONTROL_FLAG_TX_FAULT = ( 1 << ONLP_SFP_CONTROL_TX_FAULT ), + ONLP_SFP_CONTROL_FLAG_TX_DISABLE = ( 1 << ONLP_SFP_CONTROL_TX_DISABLE ), + ONLP_SFP_CONTROL_FLAG_LP_MODE = ( 1 << ONLP_SFP_CONTROL_LP_MODE ), + ONLP_SFP_CONTROL_FLAG_POWER_OVERRIDE = ( 1 << ONLP_SFP_CONTROL_POWER_OVERRIDE ), +} onlp_sfp_control_flag_t; +/* */ + +/** + * Initialize the SFP subsystem. + */ +int onlp_sfp_init(void); + +/** + * Valid SFP Port bitmaps are communicated using this type. + */ +typedef aim_bitmap256_t onlp_sfp_bitmap_t; + +/** + * Convenience function for initializing SFP bitmaps. + * @param bmap The address of the bitmap to initialize. + */ +void onlp_sfp_bitmap_t_init(onlp_sfp_bitmap_t* bmap); + +/** + * @brief Get the set of valid {Q}SFP ports. + * @param bmap Returns the valid set of SFP-capable port numbers. + */ +int onlp_sfp_bitmap_get(onlp_sfp_bitmap_t* bmap); + +/** + * @brief Determine if a given port number is a valid SFP port. + * @param port The port number. + */ +int onlp_sfp_port_valid(int port); + +/** + * @brief Determine if an SFP is currently plugged in. + * @param port The SFP port number. + * @returns 1 if an SFP is present. + * @returns 0 if an SFP is not present. + * @returns <0 on error. + */ +int onlp_sfp_is_present(int port); + +/** + * @brief Return the presence bitmap for all ports. + * @param dst The receives the presence bitmap for all ports. + * @note This function can return Unsupported. + * It will not be emulated if the SFPI driver does not support + * batch collection of the SFP presence. + */ +int onlp_sfp_presence_bitmap_get(onlp_sfp_bitmap_t* dst); + +/** + * @brief Read IEEE standard EEPROM data from the given port. + * @param port The SFP Port + * @param rv Receives a buffer containing the EEPROM data. + * @notes The buffer must be freed after use. + * @returns The size of the eeprom data, if successful + * @returns -1 on error. + */ +int onlp_sfp_eeprom_read(int port, uint8_t** rv); + + +/** + * @brief Read the DOM data from the given port. + * @param port The SFP Port + * @param rv Receives a buffer containing the DOM data. + * @notes The buffer must be freed after use. + * @returns The size of the eeprom data, if successful + * @returns -1 on error. + * @note This should only be called if the SFP + * has advertised DOM support. + */ +int onlp_sfp_dom_read(int port, uint8_t** rv); + +/** + * @brief Deinitialize the SFP subsystem. + */ +int onlp_sfp_denit(void); + +/** + * @brief Get the RX_LOS bitmap for all ports. + * @param dst Receives the RX_LOS bitmap for all ports. + * @note This function can return Unsupported. + * It will not be emulated if the SFPI driver does not support + * batch collection of the rx_los status. + */ +int onlp_sfp_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst); + +/** + * @brief Dump the status of all SFPs + * @param pvs The output pvs. + */ +void onlp_sfp_dump(aim_pvs_t* pvs); + +/** + * @brief Issue an ioctl to the SFP interface. + * @param port The port. + * @param ... Ioctl arguments. + */ +int onlp_sfp_ioctl(int port, ...); + +/** + * @brief Issue an ioctl to the SFP interface. + * @param port The port. + * @param vargs Ioctl arguments. + */ +int onlp_sfp_vioctl(int port, va_list vargs); + +/** + * @brief Call the SFP post-insertion handler. + * + */ +int onlp_sfp_post_insert(int port, sff_info_t* info); + +/** + * @brief Set an SFP control. + * @param port The port. + * @param control The control. + * @param value The value. + */ +int onlp_sfp_control_set(int port, onlp_sfp_control_t control, int value); + +/** + * @brief Get an SFP control. + * @param port The port. + * @param control The control + * @param [out] value Receives the current value. + */ +int onlp_sfp_control_get(int port, onlp_sfp_control_t control, int* value); + +/** + * @brief Get the value of all SFP controls. + * @param port The port. + * @param flags Receives the control flag values. See onlp_sfp_control_flags_t + */ +int onlp_sfp_control_flags_get(int port, uint32_t* flags); + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Strings macro. */ +#define ONLP_SFP_CONTROL_STRINGS \ +{\ + "RESET", \ + "RESET_STATE", \ + "RX_LOS", \ + "TX_FAULT", \ + "TX_DISABLE", \ + "LP_MODE", \ + "POWER_OVERRIDE", \ +} +/** Enum names. */ +const char* onlp_sfp_control_name(onlp_sfp_control_t e); + +/** Enum values. */ +int onlp_sfp_control_value(const char* str, onlp_sfp_control_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_sfp_control_desc(onlp_sfp_control_t e); + +/** validator */ +#define ONLP_SFP_CONTROL_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= ONLP_SFP_CONTROL_POWER_OVERRIDE)) + +/** onlp_sfp_control_map table. */ +extern aim_map_si_t onlp_sfp_control_map[]; +/** onlp_sfp_control_desc_map table. */ +extern aim_map_si_t onlp_sfp_control_desc_map[]; +/* */ + +/* */ +/** Enum names. */ +const char* onlp_sfp_control_flag_name(onlp_sfp_control_flag_t e); + +/** Enum values. */ +int onlp_sfp_control_flag_value(const char* str, onlp_sfp_control_flag_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_sfp_control_flag_desc(onlp_sfp_control_flag_t e); + +/** Enum validator. */ +int onlp_sfp_control_flag_valid(onlp_sfp_control_flag_t e); + +/** validator */ +#define ONLP_SFP_CONTROL_FLAG_VALID(_e) \ + (onlp_sfp_control_flag_valid((_e))) + +/** onlp_sfp_control_flag_map table. */ +extern aim_map_si_t onlp_sfp_control_flag_map[]; +/** onlp_sfp_control_flag_desc_map table. */ +extern aim_map_si_t onlp_sfp_control_flag_desc_map[]; +/* */ + +#endif /* __ONLP_SFP_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h new file mode 100644 index 00000000..1d9029ee --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h @@ -0,0 +1,115 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Platform System Information + * + ***********************************************************/ + +#ifndef __ONLP_SYS_H__ +#define __ONLP_SYS_H__ + +#include +#include +#include +#include +#include + + +typedef struct onlp_sys_info_s { + /** OID Header */ + onlp_oid_hdr_t hdr; + + /* ONIE System Information */ + onlp_onie_info_t onie_info; + + /* Platform Information */ + onlp_platform_info_t platform_info; + +} onlp_sys_info_t; + + +/** + * @brief Initialize the System API + */ +int onlp_sys_init(void); + +/** + * @brief Get the system information structure. + * @param rv [out] Receives the system information. + */ +int onlp_sys_info_get(onlp_sys_info_t* rv); + +/** + * @brief Free a system information structure. + */ +void onlp_sys_info_free(onlp_sys_info_t* info); + +/** + * @brief SYS OID debug dump. + * @param id The SYS OID. + * @param pvs The output pvs. + * @param flags The output flags. + * @note This output is designed for debugging. + */ +void onlp_sys_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * @brief Show the status of the given OID. + * @param id the SYS OID. + * @param pvs The output pvs. + * @param flags The output flags + */ +void onlp_sys_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * @brief SYS Ioctl + * @param code The ioctl code. + * @param ... Arguments + */ +int onlp_sys_ioctl(int code, ...); + +/** + * @brief SYS Ioctl + * @param code The ioctl code. + * @param vargs arguments. + */ +int onlp_sys_vioctl(int code, va_list vargs); + +/** + * @brief Start the platform management thread. + */ +int onlp_sys_platform_manage_start(void); + +/** + * @brief Stop the platform management thread. + */ +int onlp_sys_platform_manage_stop(void); + +/** + * @brief Perform any pending platform management activities. + * @note A call to this function will perform any pending + * platform management activities. It is not intended to block + * for an extended period of time. + */ + +void onlp_sys_platform_manage_now(void); + +#endif /* __ONLP_SYS_H_ */ diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/thermal.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/thermal.h new file mode 100644 index 00000000..66dbf3fb --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/thermal.h @@ -0,0 +1,188 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Management. + * + ************************************************************/ +#ifndef __ONLP_THERMAL_H__ +#define __ONLP_THERMAL_H__ + +#include +#include +#include + +/* */ +/** onlp_thermal_status */ +typedef enum onlp_thermal_status_e { + ONLP_THERMAL_STATUS_PRESENT = (1 << 0), + ONLP_THERMAL_STATUS_FAILED = (1 << 1), +} onlp_thermal_status_t; + +/** onlp_thermal_caps */ +typedef enum onlp_thermal_caps_e { + ONLP_THERMAL_CAPS_GET_TEMPERATURE = (1 << 0), + ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD = (1 << 1), + ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD = (1 << 2), + ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD = (1 << 3), +} onlp_thermal_caps_t; +/* */ + +/** + * Shortcut for specifying all capabilties. + */ +#define ONLP_THERMAL_CAPS_ALL 0xF + +/** + * Shortcut for determining the availability of any threshold value. + */ +#define ONLP_THERMAL_CAPS_GET_ANY_THRESHOLD \ + ( ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD | \ + ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD | \ + ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD ) + +/** + * Thermal sensor information structure. + */ +typedef struct onlp_thermal_info_s { + + /** OID Header */ + onlp_oid_hdr_t hdr; + + /** Status */ + uint32_t status; + + /** Capabilities */ + uint32_t caps; + + /* Current temperature in milli-celsius */ + int mcelsius; + + struct { + /* Warning temperature threshold in milli-celsius */ + int warning; + + /* Error temperature threshold in milli-celsius */ + int error; + + /* System shutdown temperature threshold in milli-celsius */ + int shutdown; + } thresholds; + +} onlp_thermal_info_t; + +/** + * @brief Initialize the thermal subsystem. + */ +int onlp_thermal_init(void); + +/** + * @brief Retrieve information about the given thermal id. + * @param id The thermal oid. + * @param rv [out] Receives the thermal information. + */ +int onlp_thermal_info_get(onlp_oid_t id, onlp_thermal_info_t* rv); + + +/** + * @brief Thermal driver ioctl. + * @param code Thermal ioctl code. + * @param ... Arguments + */ +int onlp_thermal_ioctl(int code, ...); + +/** + * @brief Thermal driver ioctl. + * @param code The thermal ioctl code. + * @param vargs The arguments. + */ +int onlp_thermal_vioctl(int code, va_list vargs); + +/** + * @brief Thermal OID debug dump. + * @param id The thermal id. + * @param pvs The output pvs. + * @param flags The dump flags. + */ +void onlp_thermal_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + +/** + * @brief Show the given thermal OID. + * @param id The Thermal OID + * @param pvs The output pvs + * @param flags The output flags + */ +void onlp_thermal_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags); + + + + +/****************************************************************************** + * + * Enumeration Support Definitions. + * + * Please do not add additional code beyond this point. + * + *****************************************************************************/ +/* */ +/** Enum names. */ +const char* onlp_thermal_status_name(onlp_thermal_status_t e); + +/** Enum values. */ +int onlp_thermal_status_value(const char* str, onlp_thermal_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_thermal_status_desc(onlp_thermal_status_t e); + +/** Enum validator. */ +int onlp_thermal_status_valid(onlp_thermal_status_t e); + +/** validator */ +#define ONLP_THERMAL_STATUS_VALID(_e) \ + (onlp_thermal_status_valid((_e))) + +/** onlp_thermal_status_map table. */ +extern aim_map_si_t onlp_thermal_status_map[]; +/** onlp_thermal_status_desc_map table. */ +extern aim_map_si_t onlp_thermal_status_desc_map[]; + +/** Enum names. */ +const char* onlp_thermal_caps_name(onlp_thermal_caps_t e); + +/** Enum values. */ +int onlp_thermal_caps_value(const char* str, onlp_thermal_caps_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_thermal_caps_desc(onlp_thermal_caps_t e); + +/** Enum validator. */ +int onlp_thermal_caps_valid(onlp_thermal_caps_t e); + +/** validator */ +#define ONLP_THERMAL_CAPS_VALID(_e) \ + (onlp_thermal_caps_valid((_e))) + +/** onlp_thermal_caps_map table. */ +extern aim_map_si_t onlp_thermal_caps_map[]; +/** onlp_thermal_caps_desc_map table. */ +extern aim_map_si_t onlp_thermal_caps_desc_map[]; +/* */ + +#endif /* __ONLP_THERMAL_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/make.mk b/packages/base/any/onlp/src/onlp/module/make.mk new file mode 100644 index 00000000..fde52d64 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/make.mk @@ -0,0 +1,30 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +onlp_INCLUDES := -I $(THIS_DIR)inc +onlp_INTERNAL_INCLUDES := -I $(THIS_DIR)src +onlp_DEPENDMODULE_ENTRIES := init:onlp ucli:onlp + diff --git a/packages/base/any/onlp/src/onlp/module/src/Makefile b/packages/base/any/onlp/src/onlp/module/src/Makefile new file mode 100644 index 00000000..3033edf5 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/Makefile @@ -0,0 +1,30 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Local source generation targets. +# +############################################################ +include ../../../../init.mk + +ucli: + $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlp_ucli.c + + diff --git a/packages/base/any/onlp/src/onlp/module/src/fan.c b/packages/base/any/onlp/src/onlp/module/src/fan.c new file mode 100644 index 00000000..b28de2d8 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/fan.c @@ -0,0 +1,293 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Management. + * + ***********************************************************/ +#include +#include +#include +#include "onlp_int.h" +#include "onlp_locks.h" +#include "onlp_log.h" +#include "onlp_json.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define VALIDATENR(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return; \ + } \ + } while(0) + + +static int +onlp_fan_init_locked__(void) +{ + return onlp_fani_init(); +} +ONLP_LOCKED_API0(onlp_fan_init) + + +#if ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES == 1 + +static int +onlp_fani_info_from_json__(cJSON* data, onlp_fan_info_t* fip, int errorcheck) +{ + int rv; + + if(data == NULL) { + return (errorcheck) ? ONLP_STATUS_E_PARAM : 0; + } + + rv = cjson_util_lookup_int(data, (int*) &fip->status, "status"); + if(rv < 0 && errorcheck) return rv; + + rv = cjson_util_lookup_int(data, (int*) &fip->caps, "caps"); + if(rv < 0 && errorcheck) return rv; + + rv = cjson_util_lookup_int(data, (int*) &fip->rpm, "rpm"); + if(rv < 0 && errorcheck) return rv; + + rv = cjson_util_lookup_int(data, (int*) &fip->percentage, "percentage"); + if(rv < 0 && errorcheck) return rv; + + rv = cjson_util_lookup_int(data, (int*) &fip->mode, "mode"); + if(rv < 0 && errorcheck) return rv; + + return 0; +} + +#endif + +static int +onlp_fan_info_get_locked__(onlp_oid_t oid, onlp_fan_info_t* fip) +{ + int rv; + + VALIDATE(oid); + + /* Get the information struct from the platform */ + rv = onlp_fani_info_get(oid, fip); + + if(rv >= 0) { + +#if ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES == 1 + /* + * Optional override from the config file. + * This is usually just for testing. + */ + int id = ONLP_OID_ID_GET(oid); + cJSON* entry = NULL; + + + cjson_util_lookup(onlp_json_get(0), &entry, "overrides.fan.%d", id); + onlp_fani_info_from_json__(entry, fip, 0); +#endif + + if(fip->percentage && fip->rpm == 0) { + /* Approximate RPM based on a 10,000 RPM Maximum */ + fip->rpm = fip->percentage * 100; + } + } + + return rv; +} +ONLP_LOCKED_API2(onlp_fan_info_get, onlp_oid_t, oid, onlp_fan_info_t*, fip); + + +static int +onlp_fan_present__(onlp_oid_t id, onlp_fan_info_t* info) +{ + int rv; + VALIDATE(id); + + /* Info retrieval required. */ + rv = onlp_fani_info_get(id, info); + if(rv < 0) { + return rv; + } + /* The fan must be present. */ + if((info->status & 0x1) == 0) { + return ONLP_STATUS_E_MISSING; + } + return ONLP_STATUS_OK; +} +#define ONLP_FAN_PRESENT_OR_RETURN(_id, _info) \ + do { \ + int _rv = onlp_fan_present__(_id, _info); \ + if(_rv < 0) { \ + return _rv; \ + } \ + } while(0) + + +static int +onlp_fan_rpm_set_locked__(onlp_oid_t id, int rpm) +{ + onlp_fan_info_t info; + ONLP_FAN_PRESENT_OR_RETURN(id, &info); + if(info.caps & ONLP_FAN_CAPS_SET_RPM) { + return onlp_fani_rpm_set(id, rpm); + } + else { + return ONLP_STATUS_E_UNSUPPORTED; + } +} +ONLP_LOCKED_API2(onlp_fan_rpm_set, onlp_oid_t, id, int, rpm); + +static int +onlp_fan_percentage_set_locked__(onlp_oid_t id, int p) +{ + onlp_fan_info_t info; + ONLP_FAN_PRESENT_OR_RETURN(id, &info); + if(info.caps & ONLP_FAN_CAPS_SET_PERCENTAGE) { + return onlp_fani_percentage_set(id, p); + } + else { + return ONLP_STATUS_E_UNSUPPORTED; + } +} +ONLP_LOCKED_API2(onlp_fan_percentage_set, onlp_oid_t, id, int, p); + +static int +onlp_fan_mode_set_locked__(onlp_oid_t id, onlp_fan_mode_t mode) +{ + onlp_fan_info_t info; + ONLP_FAN_PRESENT_OR_RETURN(id, &info); + return onlp_fani_mode_set(id, mode); +} +ONLP_LOCKED_API2(onlp_fan_mode_set, onlp_oid_t, id, onlp_fan_mode_t, mode); + +static int +onlp_fan_dir_set_locked__(onlp_oid_t id, onlp_fan_dir_t dir) +{ + onlp_fan_info_t info; + ONLP_FAN_PRESENT_OR_RETURN(id, &info); + if( (info.caps & ONLP_FAN_CAPS_B2F) && + (info.caps & ONLP_FAN_CAPS_F2B) ) { + return onlp_fani_dir_set(id, dir); + } + else { + return ONLP_STATUS_E_UNSUPPORTED; + } +} +ONLP_LOCKED_API2(onlp_fan_dir_set, onlp_oid_t, id, onlp_fan_dir_t, dir); + + +/************************************************************ + * + * Debug and Show Functions + * + ***********************************************************/ + +void +onlp_fan_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_fan_info_t info; + + VALIDATENR(id); + + onlp_oid_dump_iof_init_default(&iof, pvs); + iof_push(&iof, "fan @ %d", ONLP_OID_ID_GET(id)); + rv = onlp_fan_info_get(id, &info); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &info.hdr); + if(info.status & 1) { + /* Present */ + iof_iprintf(&iof, "Status: %{onlp_fan_status_flags}", info.status); + iof_iprintf(&iof, "Caps: %{onlp_fan_caps_flags}", info.caps); + iof_iprintf(&iof, "RPM: %d", info.rpm); + iof_iprintf(&iof, "Per: %d", info.percentage); + iof_iprintf(&iof, "Model: %s", info.model[0] ? info.model : "NULL"); + iof_iprintf(&iof, "SN: %s", info.serial[0] ? info.serial : "NULL"); + } + else { + iof_iprintf(&iof, "Not present."); + } + } + iof_pop(&iof); +} + +void +onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_fan_info_t fi; + + onlp_oid_show_iof_init_default(&iof, pvs, flags); + + rv = onlp_fan_info_get(oid, &fi); + + iof_push(&iof, "Fan %d", ONLP_OID_ID_GET(oid)); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &fi.hdr); + if(fi.status & 0x1) { + /* Present */ + iof_iprintf(&iof, "State: Present"); + if(fi.status & ONLP_FAN_STATUS_FAILED) { + iof_iprintf(&iof, "Status: FAILED"); + } + else { + iof_iprintf(&iof, "Status: Running."); + if(fi.model[0]) { + iof_iprintf(&iof, "Model: %s", fi.model); + } + if(fi.serial[0]) { + iof_iprintf(&iof, "SN: %s", fi.serial); + } + if(fi.caps & ONLP_FAN_CAPS_GET_RPM) { + iof_iprintf(&iof, "RPM: %d.", fi.rpm); + } + if(fi.caps & ONLP_FAN_CAPS_GET_PERCENTAGE) { + iof_iprintf(&iof, "Speed: %d%%.", fi.percentage); + } + if(fi.status & ONLP_FAN_STATUS_B2F) { + iof_iprintf(&iof, "Airflow: Back-to-Front."); + } + if(fi.status & ONLP_FAN_STATUS_F2B) { + iof_iprintf(&iof, "Airflow: Front-to-Back."); + } + } + } + else { + /* Not present */ + onlp_oid_show_state_missing(&iof); + } + } + iof_pop(&iof); +} + diff --git a/packages/base/any/onlp/src/onlp/module/src/led.c b/packages/base/any/onlp/src/onlp/module/src/led.c new file mode 100644 index 00000000..051cc223 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/led.c @@ -0,0 +1,182 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * LED Management + * + ***********************************************************/ +#include +#include +#include +#include +#include "onlp_int.h" +#include "onlp_locks.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define VALIDATENR(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return; \ + } \ + } while(0) + + +static int +onlp_led_present__(onlp_oid_t id, onlp_led_info_t* info) +{ + int rv; + VALIDATE(id); + + /* Info retrieval required. */ + rv = onlp_ledi_info_get(id, info); + if(rv < 0) { + return rv; + } + /* The led must be present. */ + if((info->status & 0x1) == 0) { + return ONLP_STATUS_E_MISSING; + } + return ONLP_STATUS_OK; +} +#define ONLP_LED_PRESENT_OR_RETURN(_id, _info) \ + do { \ + int _rv = onlp_led_present__(_id, _info); \ + if(_rv < 0) { \ + return _rv; \ + } \ + } while(0) + +static int +onlp_led_init_locked__(void) +{ + return onlp_ledi_init(); +} +ONLP_LOCKED_API0(onlp_led_init); + +static int +onlp_led_info_get_locked__(onlp_oid_t id, onlp_led_info_t* info) +{ + VALIDATE(id); + return onlp_ledi_info_get(id, info); +} +ONLP_LOCKED_API2(onlp_led_info_get, onlp_oid_t, id, onlp_led_info_t*, info); + +static int +onlp_led_set_locked__(onlp_oid_t id, int on_or_off) +{ + onlp_led_info_t info; + ONLP_LED_PRESENT_OR_RETURN(id, &info); + if(info.caps & ONLP_LED_CAPS_ON_OFF) { + return onlp_ledi_set(id, on_or_off); + } + else { + return ONLP_STATUS_E_UNSUPPORTED; + } +} +ONLP_LOCKED_API2(onlp_led_set, onlp_oid_t, id, int, on_or_off); + +static int +onlp_led_mode_set_locked__(onlp_oid_t id, onlp_led_mode_t mode) +{ + onlp_led_info_t info; + ONLP_LED_PRESENT_OR_RETURN(id, &info); + + /* + * The mode enumeration values always match + * the capability bit positions. + */ + if(info.caps & (1 << mode)) { + return onlp_ledi_mode_set(id, mode); + } + else { + return ONLP_STATUS_E_UNSUPPORTED; + } +} +ONLP_LOCKED_API2(onlp_led_mode_set, onlp_oid_t, id, onlp_led_mode_t, mode); + +/************************************************************ + * + * Debug and Show Functions + * + ***********************************************************/ + +void +onlp_led_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_led_info_t info; + + VALIDATENR(id); + onlp_oid_dump_iof_init_default(&iof, pvs); + iof_push(&iof, "led @ %d", ONLP_OID_ID_GET(id)); + rv = onlp_led_info_get(id, &info); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &info.hdr); + if(info.status & 1) { + /* Present */ + iof_iprintf(&iof, "Status: %{onlp_led_status_flags}", info.status); + iof_iprintf(&iof, "Caps: %{onlp_led_caps_flags}", info.caps); + iof_iprintf(&iof, "Mode: %{onlp_led_mode}", info.mode); + } + else { + iof_iprintf(&iof, "Not present."); + } + } + iof_pop(&iof); +} + +void +onlp_led_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_led_info_t info; + + VALIDATENR(id); + onlp_oid_show_iof_init_default(&iof, pvs, flags); + iof_push(&iof, "LED %d", ONLP_OID_ID_GET(id)); + rv = onlp_led_info_get(id, &info); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &info.hdr); + if(info.status & 1) { + /* Present */ + iof_iprintf(&iof, "Mode: %{onlp_led_mode}", info.mode); + } + else { + onlp_oid_show_state_missing(&iof); + } + } + iof_pop(&iof); + +} + diff --git a/packages/base/any/onlp/src/onlp/module/src/make.mk b/packages/base/any/onlp/src/onlp/module/src/make.mk new file mode 100644 index 00000000..9029307d --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/make.mk @@ -0,0 +1,27 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +LIBRARY := onlp +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/onlp/module/src/oids.c b/packages/base/any/onlp/src/onlp/module/src/oids.c new file mode 100644 index 00000000..f2f495f1 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/oids.c @@ -0,0 +1,251 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "onlp_log.h" +#include "onlp_int.h" +#include +#include + +#include +#include +#include +#include +#include + +#define OID_TYPE_SHOWDUMP_DEFINE(_TYPE, _type) \ + static void \ + oid_type_##_TYPE##_dump__(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) \ + { \ + onlp_##_type##_dump(oid, pvs, flags); \ + } \ + static void \ + oid_type_##_TYPE##_show__(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) \ + { \ + onlp_##_type##_show(oid, pvs, flags); \ + } + +#define OID_TYPE_SHOWDUMP_DEFINE_EMPTY(_TYPE, _type) \ + static void \ + oid_type_##_TYPE##_dump__(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) \ + { \ + } \ + static void \ + oid_type_##_TYPE##_show__(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) \ + { \ + } + + +OID_TYPE_SHOWDUMP_DEFINE(SYS, sys); +OID_TYPE_SHOWDUMP_DEFINE(THERMAL, thermal); +OID_TYPE_SHOWDUMP_DEFINE(FAN, fan); +OID_TYPE_SHOWDUMP_DEFINE(PSU, psu); +OID_TYPE_SHOWDUMP_DEFINE(LED, led); +OID_TYPE_SHOWDUMP_DEFINE_EMPTY(MODULE, module); +OID_TYPE_SHOWDUMP_DEFINE_EMPTY(RTC, rtc); + +static void +oid_type_unknown_dump__(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) +{ + iof_t iof; + onlp_oid_dump_iof_init_default(&iof, pvs); + iof_push(&iof, "invalid oid @ 0x%x", oid); + iof_iprintf(&iof, "type = %d", ONLP_OID_TYPE_GET(oid)); + iof_iprintf(&iof, " id = %d", ONLP_OID_ID_GET(oid)); + iof_pop(&iof); +} + +static int +oid_type_SYS_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + int rv; + onlp_sys_info_t si; + rv = onlp_sys_info_get(&si); + memcpy(hdr, &si.hdr, sizeof(si.hdr)); + return rv; +} + +static int +oid_type_THERMAL_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + int rv; + onlp_thermal_info_t ti; + rv = onlp_thermal_info_get(oid, &ti); + memcpy(hdr, &ti.hdr, sizeof(ti.hdr)); + return rv; +} + +static int +oid_type_FAN_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + int rv; + onlp_fan_info_t fi; + rv = onlp_fan_info_get(oid, &fi); + memcpy(hdr, &fi.hdr, sizeof(fi.hdr)); + return rv; +} + +static int +oid_type_LED_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + int rv; + onlp_led_info_t li; + rv = onlp_led_info_get(oid, &li); + memcpy(hdr, &li.hdr, sizeof(li.hdr)); + return rv; +} + +static int +oid_type_PSU_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + int rv; + onlp_psu_info_t pi; + rv = onlp_psu_info_get(oid, &pi); + memcpy(hdr, &pi.hdr, sizeof(pi.hdr)); + return rv; +} + +static int +oid_type_RTC_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + /* Not implemented yet */ + AIM_LOG_MSG("RTC_coids_get: 0x%x", oid); + return ONLP_STATUS_E_INVALID; +} + + +static int +oid_type_MODULE_hdr_get__(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + /* Not implemented yet */ + AIM_LOG_MSG("MODULE_coids_get: 0x%x", oid); + return ONLP_STATUS_E_INVALID; +} + +static void +onlp_oid_showdump__(onlp_oid_t oid, + /* show=1, dump=0 */ + int show, + aim_pvs_t* pvs, + uint32_t flags) +{ + if(oid == 0) { + oid = ONLP_OID_SYS; + } + + switch(ONLP_OID_TYPE_GET(oid)) { + /* {dump || show} */ +#define ONLP_OID_TYPE_ENTRY(_name, _value) \ + case ONLP_OID_TYPE_##_name: \ + if(show) { \ + oid_type_##_name##_show__(oid, pvs, flags); \ + } \ + else { \ + oid_type_##_name##_dump__(oid, pvs, flags); \ + } \ + return; + +#include + + /* Intentional compile time error if an OID decode is missing. */ + } + oid_type_unknown_dump__(oid, pvs, flags); +} + +void +onlp_oid_dump(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) +{ + onlp_oid_showdump__(oid, 0, pvs, flags); +} + +void +onlp_oid_table_dump(onlp_oid_table_t table, aim_pvs_t* pvs, uint32_t flags) +{ + onlp_oid_t* oidp; + ONLP_OID_TABLE_ITER(table, oidp) { + onlp_oid_dump(*oidp, pvs, flags); + } +} + +void +onlp_oid_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags) +{ + onlp_oid_showdump__(oid, 1, pvs, flags); +} + +void +onlp_oid_table_show(onlp_oid_table_t table, aim_pvs_t* pvs, uint32_t flags) +{ + onlp_oid_t* oidp; + ONLP_OID_TABLE_ITER(table, oidp) { + onlp_oid_show(*oidp, pvs, flags); + } +} + +int +onlp_oid_hdr_get(onlp_oid_t oid, onlp_oid_hdr_t* hdr) +{ + switch(ONLP_OID_TYPE_GET(oid)) + { +#define ONLP_OID_TYPE_ENTRY(_name, _value) \ + case ONLP_OID_TYPE_##_name: \ + return oid_type_##_name##_hdr_get__(oid, hdr); +#include + /* Intentional compile time error if an OID handler is missing. */ + } + return ONLP_STATUS_E_INVALID; +} + +int +onlp_oid_iterate(onlp_oid_t oid, onlp_oid_type_t type, + onlp_oid_iterate_f itf, void* cookie) +{ + int rv; + onlp_oid_hdr_t hdr; + onlp_oid_t* oidp; + + if(oid == 0) { + oid = ONLP_OID_SYS; + } + + rv = onlp_oid_hdr_get(oid, &hdr); + if(rv < 0) { + return rv; + } + + ONLP_OID_TABLE_ITER(hdr.coids, oidp) { + if(type == 0 || ONLP_OID_IS_TYPE(*oidp, type)) { + int rv = itf(*oidp, cookie); + if(rv < 0) { + return rv; + } + rv = onlp_oid_iterate(*oidp, type, itf, cookie); + if(rv < 0) { + return rv; + } + } + } + return ONLP_STATUS_OK; +} diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp.c b/packages/base/any/onlp/src/onlp/module/src/onlp.c new file mode 100644 index 00000000..31d9999e --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp.c @@ -0,0 +1,64 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "onlp_int.h" +#include "onlp_json.h" +#include "onlp_locks.h" + +int +onlp_init(void) +{ + extern void __onlp_module_init__(void); + __onlp_module_init__(); + + char* cfile; + + if( (cfile=getenv(ONLP_CONFIG_CONFIGURATION_ENV)) == NULL) { + cfile = ONLP_CONFIG_CONFIGURATION_FILENAME; + } + +#if ONLP_CONFIG_INCLUDE_API_LOCK == 1 + onlp_api_lock_init(); +#endif + + + onlp_json_init(cfile); + onlp_sys_init(); + onlp_sfp_init(); + onlp_led_init(); + onlp_psu_init(); + onlp_fan_init(); + onlp_thermal_init(); + return 0; +} diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_config.c b/packages/base/any/onlp/src/onlp/module/src/onlp_config.c new file mode 100644 index 00000000..68ddf55b --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_config.c @@ -0,0 +1,156 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* */ +#define __onlp_config_STRINGIFY_NAME(_x) #_x +#define __onlp_config_STRINGIFY_VALUE(_x) __onlp_config_STRINGIFY_NAME(_x) +onlp_config_settings_t onlp_config_settings[] = +{ +#ifdef ONLP_CONFIG_INCLUDE_LOGGING + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_LOGGING), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_LOGGING) }, +#else +{ ONLP_CONFIG_INCLUDE_LOGGING(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_LOG_OPTIONS_DEFAULT + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_LOG_OPTIONS_DEFAULT), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ONLP_CONFIG_LOG_OPTIONS_DEFAULT(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_LOG_BITS_DEFAULT + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_LOG_BITS_DEFAULT), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ONLP_CONFIG_LOG_BITS_DEFAULT(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_PORTING_STDLIB + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_PORTING_STDLIB), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_PORTING_STDLIB) }, +#else +{ ONLP_CONFIG_PORTING_STDLIB(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ONLP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_UCLI + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_UCLI), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_UCLI) }, +#else +{ ONLP_CONFIG_INCLUDE_UCLI(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK) }, +#else +{ ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT) }, +#else +{ ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_PLATFORM_STATIC + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_PLATFORM_STATIC), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_PLATFORM_STATIC) }, +#else +{ ONLP_CONFIG_INCLUDE_PLATFORM_STATIC(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_PLATFORM_STATIC + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_PLATFORM_STATIC), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_PLATFORM_STATIC) }, +#else +{ ONLP_CONFIG_PLATFORM_STATIC(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_PLATFORM_FILENAME + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_PLATFORM_FILENAME), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_PLATFORM_FILENAME) }, +#else +{ ONLP_CONFIG_PLATFORM_FILENAME(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES) }, +#else +{ ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_CONFIGURATION_FILENAME + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_CONFIGURATION_FILENAME), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_CONFIGURATION_FILENAME) }, +#else +{ ONLP_CONFIG_CONFIGURATION_FILENAME(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_CONFIGURATION_ENV + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_CONFIGURATION_ENV), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_CONFIGURATION_ENV) }, +#else +{ ONLP_CONFIG_CONFIGURATION_ENV(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INCLUDE_API_LOCK + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INCLUDE_API_LOCK), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INCLUDE_API_LOCK) }, +#else +{ ONLP_CONFIG_INCLUDE_API_LOCK(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_API_LOCK_GLOBAL_SHARED + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_API_LOCK_GLOBAL_SHARED), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_API_LOCK_GLOBAL_SHARED) }, +#else +{ ONLP_CONFIG_API_LOCK_GLOBAL_SHARED(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_API_LOCK_TIMEOUT + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_API_LOCK_TIMEOUT), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_API_LOCK_TIMEOUT) }, +#else +{ ONLP_CONFIG_API_LOCK_TIMEOUT(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_CONFIG_INFO_STR_MAX + { __onlp_config_STRINGIFY_NAME(ONLP_CONFIG_INFO_STR_MAX), __onlp_config_STRINGIFY_VALUE(ONLP_CONFIG_INFO_STR_MAX) }, +#else +{ ONLP_CONFIG_INFO_STR_MAX(__onlp_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __onlp_config_STRINGIFY_VALUE +#undef __onlp_config_STRINGIFY_NAME + +const char* +onlp_config_lookup(const char* setting) +{ + int i; + for(i = 0; onlp_config_settings[i].name; i++) { + if(strcmp(onlp_config_settings[i].name, setting)) { + return onlp_config_settings[i].value; + } + } + return NULL; +} + +int +onlp_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; onlp_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", onlp_config_settings[i].name, onlp_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_enums.c b/packages/base/any/onlp/src/onlp/module/src/onlp_enums.c new file mode 100644 index 00000000..44f98d94 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_enums.c @@ -0,0 +1,1048 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* */ +aim_map_si_t onlp_fan_mode_map[] = +{ + { "OFF", ONLP_FAN_MODE_OFF }, + { "SLOW", ONLP_FAN_MODE_SLOW }, + { "NORMAL", ONLP_FAN_MODE_NORMAL }, + { "FAST", ONLP_FAN_MODE_FAST }, + { "MAX", ONLP_FAN_MODE_MAX }, + { NULL, 0 } +}; + +aim_map_si_t onlp_fan_mode_desc_map[] = +{ + { "None", ONLP_FAN_MODE_OFF }, + { "None", ONLP_FAN_MODE_SLOW }, + { "None", ONLP_FAN_MODE_NORMAL }, + { "None", ONLP_FAN_MODE_FAST }, + { "None", ONLP_FAN_MODE_MAX }, + { NULL, 0 } +}; + +const char* +onlp_fan_mode_name(onlp_fan_mode_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_mode_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_mode'"; + } +} + +int +onlp_fan_mode_value(const char* str, onlp_fan_mode_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_fan_mode_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_fan_mode_desc(onlp_fan_mode_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_mode_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_mode'"; + } +} + + +aim_map_si_t onlp_sfp_control_flag_map[] = +{ + { "RESET", ONLP_SFP_CONTROL_FLAG_RESET }, + { "RESET_STATE", ONLP_SFP_CONTROL_FLAG_RESET_STATE }, + { "RX_LOS", ONLP_SFP_CONTROL_FLAG_RX_LOS }, + { "TX_FAULT", ONLP_SFP_CONTROL_FLAG_TX_FAULT }, + { "TX_DISABLE", ONLP_SFP_CONTROL_FLAG_TX_DISABLE }, + { "LP_MODE", ONLP_SFP_CONTROL_FLAG_LP_MODE }, + { "POWER_OVERRIDE", ONLP_SFP_CONTROL_FLAG_POWER_OVERRIDE }, + { NULL, 0 } +}; + +aim_map_si_t onlp_sfp_control_flag_desc_map[] = +{ + { "None", ONLP_SFP_CONTROL_FLAG_RESET }, + { "None", ONLP_SFP_CONTROL_FLAG_RESET_STATE }, + { "None", ONLP_SFP_CONTROL_FLAG_RX_LOS }, + { "None", ONLP_SFP_CONTROL_FLAG_TX_FAULT }, + { "None", ONLP_SFP_CONTROL_FLAG_TX_DISABLE }, + { "None", ONLP_SFP_CONTROL_FLAG_LP_MODE }, + { "None", ONLP_SFP_CONTROL_FLAG_POWER_OVERRIDE }, + { NULL, 0 } +}; + +const char* +onlp_sfp_control_flag_name(onlp_sfp_control_flag_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_sfp_control_flag_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_sfp_control_flag'"; + } +} + +int +onlp_sfp_control_flag_value(const char* str, onlp_sfp_control_flag_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_sfp_control_flag_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_sfp_control_flag_desc(onlp_sfp_control_flag_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_sfp_control_flag_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_sfp_control_flag'"; + } +} + +int +onlp_sfp_control_flag_valid(onlp_sfp_control_flag_t e) +{ + return aim_map_si_i(NULL, e, onlp_sfp_control_flag_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_psu_status_map[] = +{ + { "PRESENT", ONLP_PSU_STATUS_PRESENT }, + { "FAILED", ONLP_PSU_STATUS_FAILED }, + { "UNPLUGGED", ONLP_PSU_STATUS_UNPLUGGED }, + { NULL, 0 } +}; + +aim_map_si_t onlp_psu_status_desc_map[] = +{ + { "None", ONLP_PSU_STATUS_PRESENT }, + { "None", ONLP_PSU_STATUS_FAILED }, + { "None", ONLP_PSU_STATUS_UNPLUGGED }, + { NULL, 0 } +}; + +const char* +onlp_psu_status_name(onlp_psu_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_psu_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_psu_status'"; + } +} + +int +onlp_psu_status_value(const char* str, onlp_psu_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_psu_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_psu_status_desc(onlp_psu_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_psu_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_psu_status'"; + } +} + +int +onlp_psu_status_valid(onlp_psu_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_psu_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_sfp_control_map[] = +{ + { "RESET", ONLP_SFP_CONTROL_RESET }, + { "RESET_STATE", ONLP_SFP_CONTROL_RESET_STATE }, + { "RX_LOS", ONLP_SFP_CONTROL_RX_LOS }, + { "TX_FAULT", ONLP_SFP_CONTROL_TX_FAULT }, + { "TX_DISABLE", ONLP_SFP_CONTROL_TX_DISABLE }, + { "LP_MODE", ONLP_SFP_CONTROL_LP_MODE }, + { "POWER_OVERRIDE", ONLP_SFP_CONTROL_POWER_OVERRIDE }, + { NULL, 0 } +}; + +aim_map_si_t onlp_sfp_control_desc_map[] = +{ + { "None", ONLP_SFP_CONTROL_RESET }, + { "None", ONLP_SFP_CONTROL_RESET_STATE }, + { "None", ONLP_SFP_CONTROL_RX_LOS }, + { "None", ONLP_SFP_CONTROL_TX_FAULT }, + { "None", ONLP_SFP_CONTROL_TX_DISABLE }, + { "None", ONLP_SFP_CONTROL_LP_MODE }, + { "None", ONLP_SFP_CONTROL_POWER_OVERRIDE }, + { NULL, 0 } +}; + +const char* +onlp_sfp_control_name(onlp_sfp_control_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_sfp_control_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_sfp_control'"; + } +} + +int +onlp_sfp_control_value(const char* str, onlp_sfp_control_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_sfp_control_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_sfp_control_desc(onlp_sfp_control_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_sfp_control_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_sfp_control'"; + } +} + + +aim_map_si_t onlp_led_caps_map[] = +{ + { "ON_OFF", ONLP_LED_CAPS_ON_OFF }, + { "RED", ONLP_LED_CAPS_RED }, + { "RED_BLINKING", ONLP_LED_CAPS_RED_BLINKING }, + { "ORANGE", ONLP_LED_CAPS_ORANGE }, + { "ORANGE_BLINKING", ONLP_LED_CAPS_ORANGE_BLINKING }, + { "YELLOW", ONLP_LED_CAPS_YELLOW }, + { "YELLOW_BLINKING", ONLP_LED_CAPS_YELLOW_BLINKING }, + { "GREEN", ONLP_LED_CAPS_GREEN }, + { "GREEN_BLINKING", ONLP_LED_CAPS_GREEN_BLINKING }, + { "BLUE", ONLP_LED_CAPS_BLUE }, + { "BLUE_BLINKING", ONLP_LED_CAPS_BLUE_BLINKING }, + { "PURPLE", ONLP_LED_CAPS_PURPLE }, + { "PURPLE_BLINKING", ONLP_LED_CAPS_PURPLE_BLINKING }, + { "AUTO", ONLP_LED_CAPS_AUTO }, + { NULL, 0 } +}; + +aim_map_si_t onlp_led_caps_desc_map[] = +{ + { "None", ONLP_LED_CAPS_ON_OFF }, + { "None", ONLP_LED_CAPS_RED }, + { "None", ONLP_LED_CAPS_RED_BLINKING }, + { "None", ONLP_LED_CAPS_ORANGE }, + { "None", ONLP_LED_CAPS_ORANGE_BLINKING }, + { "None", ONLP_LED_CAPS_YELLOW }, + { "None", ONLP_LED_CAPS_YELLOW_BLINKING }, + { "None", ONLP_LED_CAPS_GREEN }, + { "None", ONLP_LED_CAPS_GREEN_BLINKING }, + { "None", ONLP_LED_CAPS_BLUE }, + { "None", ONLP_LED_CAPS_BLUE_BLINKING }, + { "None", ONLP_LED_CAPS_PURPLE }, + { "None", ONLP_LED_CAPS_PURPLE_BLINKING }, + { "None", ONLP_LED_CAPS_AUTO }, + { NULL, 0 } +}; + +const char* +onlp_led_caps_name(onlp_led_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_caps_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_caps'"; + } +} + +int +onlp_led_caps_value(const char* str, onlp_led_caps_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_led_caps_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_led_caps_desc(onlp_led_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_caps_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_caps'"; + } +} + +int +onlp_led_caps_valid(onlp_led_caps_t e) +{ + return aim_map_si_i(NULL, e, onlp_led_caps_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_led_status_map[] = +{ + { "PRESENT", ONLP_LED_STATUS_PRESENT }, + { "FAILED", ONLP_LED_STATUS_FAILED }, + { "ON", ONLP_LED_STATUS_ON }, + { NULL, 0 } +}; + +aim_map_si_t onlp_led_status_desc_map[] = +{ + { "None", ONLP_LED_STATUS_PRESENT }, + { "None", ONLP_LED_STATUS_FAILED }, + { "None", ONLP_LED_STATUS_ON }, + { NULL, 0 } +}; + +const char* +onlp_led_status_name(onlp_led_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_status'"; + } +} + +int +onlp_led_status_value(const char* str, onlp_led_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_led_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_led_status_desc(onlp_led_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_status'"; + } +} + +int +onlp_led_status_valid(onlp_led_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_led_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_thermal_status_map[] = +{ + { "PRESENT", ONLP_THERMAL_STATUS_PRESENT }, + { "FAILED", ONLP_THERMAL_STATUS_FAILED }, + { NULL, 0 } +}; + +aim_map_si_t onlp_thermal_status_desc_map[] = +{ + { "None", ONLP_THERMAL_STATUS_PRESENT }, + { "None", ONLP_THERMAL_STATUS_FAILED }, + { NULL, 0 } +}; + +const char* +onlp_thermal_status_name(onlp_thermal_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_thermal_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_thermal_status'"; + } +} + +int +onlp_thermal_status_value(const char* str, onlp_thermal_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_thermal_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_thermal_status_desc(onlp_thermal_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_thermal_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_thermal_status'"; + } +} + +int +onlp_thermal_status_valid(onlp_thermal_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_thermal_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_oid_type_map[] = +{ + { "SYS", ONLP_OID_TYPE_SYS }, + { "THERMAL", ONLP_OID_TYPE_THERMAL }, + { "FAN", ONLP_OID_TYPE_FAN }, + { "PSU", ONLP_OID_TYPE_PSU }, + { "LED", ONLP_OID_TYPE_LED }, + { "MODULE", ONLP_OID_TYPE_MODULE }, + { "RTC", ONLP_OID_TYPE_RTC }, + { NULL, 0 } +}; + +aim_map_si_t onlp_oid_type_desc_map[] = +{ + { "None", ONLP_OID_TYPE_SYS }, + { "None", ONLP_OID_TYPE_THERMAL }, + { "None", ONLP_OID_TYPE_FAN }, + { "None", ONLP_OID_TYPE_PSU }, + { "None", ONLP_OID_TYPE_LED }, + { "None", ONLP_OID_TYPE_MODULE }, + { "None", ONLP_OID_TYPE_RTC }, + { NULL, 0 } +}; + +const char* +onlp_oid_type_name(onlp_oid_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_oid_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_oid_type'"; + } +} + +int +onlp_oid_type_value(const char* str, onlp_oid_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_oid_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_oid_type_desc(onlp_oid_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_oid_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_oid_type'"; + } +} + +int +onlp_oid_type_valid(onlp_oid_type_t e) +{ + return aim_map_si_i(NULL, e, onlp_oid_type_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_fan_caps_map[] = +{ + { "B2F", ONLP_FAN_CAPS_B2F }, + { "F2B", ONLP_FAN_CAPS_F2B }, + { "SET_RPM", ONLP_FAN_CAPS_SET_RPM }, + { "SET_PERCENTAGE", ONLP_FAN_CAPS_SET_PERCENTAGE }, + { "GET_RPM", ONLP_FAN_CAPS_GET_RPM }, + { "GET_PERCENTAGE", ONLP_FAN_CAPS_GET_PERCENTAGE }, + { NULL, 0 } +}; + +aim_map_si_t onlp_fan_caps_desc_map[] = +{ + { "None", ONLP_FAN_CAPS_B2F }, + { "None", ONLP_FAN_CAPS_F2B }, + { "None", ONLP_FAN_CAPS_SET_RPM }, + { "None", ONLP_FAN_CAPS_SET_PERCENTAGE }, + { "None", ONLP_FAN_CAPS_GET_RPM }, + { "None", ONLP_FAN_CAPS_GET_PERCENTAGE }, + { NULL, 0 } +}; + +const char* +onlp_fan_caps_name(onlp_fan_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_caps_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_caps'"; + } +} + +int +onlp_fan_caps_value(const char* str, onlp_fan_caps_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_fan_caps_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_fan_caps_desc(onlp_fan_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_caps_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_caps'"; + } +} + +int +onlp_fan_caps_valid(onlp_fan_caps_t e) +{ + return aim_map_si_i(NULL, e, onlp_fan_caps_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_led_mode_map[] = +{ + { "OFF", ONLP_LED_MODE_OFF }, + { "ON", ONLP_LED_MODE_ON }, + { "BLINKING", ONLP_LED_MODE_BLINKING }, + { "RED", ONLP_LED_MODE_RED }, + { "RED_BLINKING", ONLP_LED_MODE_RED_BLINKING }, + { "ORANGE", ONLP_LED_MODE_ORANGE }, + { "ORANGE_BLINKING", ONLP_LED_MODE_ORANGE_BLINKING }, + { "YELLOW", ONLP_LED_MODE_YELLOW }, + { "YELLOW_BLINKING", ONLP_LED_MODE_YELLOW_BLINKING }, + { "GREEN", ONLP_LED_MODE_GREEN }, + { "GREEN_BLINKING", ONLP_LED_MODE_GREEN_BLINKING }, + { "BLUE", ONLP_LED_MODE_BLUE }, + { "BLUE_BLINKING", ONLP_LED_MODE_BLUE_BLINKING }, + { "PURPLE", ONLP_LED_MODE_PURPLE }, + { "PURPLE_BLINKING", ONLP_LED_MODE_PURPLE_BLINKING }, + { "AUTO", ONLP_LED_MODE_AUTO }, + { NULL, 0 } +}; + +aim_map_si_t onlp_led_mode_desc_map[] = +{ + { "None", ONLP_LED_MODE_OFF }, + { "None", ONLP_LED_MODE_ON }, + { "None", ONLP_LED_MODE_BLINKING }, + { "None", ONLP_LED_MODE_RED }, + { "None", ONLP_LED_MODE_RED_BLINKING }, + { "None", ONLP_LED_MODE_ORANGE }, + { "None", ONLP_LED_MODE_ORANGE_BLINKING }, + { "None", ONLP_LED_MODE_YELLOW }, + { "None", ONLP_LED_MODE_YELLOW_BLINKING }, + { "None", ONLP_LED_MODE_GREEN }, + { "None", ONLP_LED_MODE_GREEN_BLINKING }, + { "None", ONLP_LED_MODE_BLUE }, + { "None", ONLP_LED_MODE_BLUE_BLINKING }, + { "None", ONLP_LED_MODE_PURPLE }, + { "None", ONLP_LED_MODE_PURPLE_BLINKING }, + { "None", ONLP_LED_MODE_AUTO }, + { NULL, 0 } +}; + +const char* +onlp_led_mode_name(onlp_led_mode_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_mode_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_mode'"; + } +} + +int +onlp_led_mode_value(const char* str, onlp_led_mode_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_led_mode_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_led_mode_desc(onlp_led_mode_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_led_mode_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_led_mode'"; + } +} + +int +onlp_led_mode_valid(onlp_led_mode_t e) +{ + return aim_map_si_i(NULL, e, onlp_led_mode_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_fan_status_map[] = +{ + { "PRESENT", ONLP_FAN_STATUS_PRESENT }, + { "FAILED", ONLP_FAN_STATUS_FAILED }, + { "B2F", ONLP_FAN_STATUS_B2F }, + { "F2B", ONLP_FAN_STATUS_F2B }, + { NULL, 0 } +}; + +aim_map_si_t onlp_fan_status_desc_map[] = +{ + { "None", ONLP_FAN_STATUS_PRESENT }, + { "None", ONLP_FAN_STATUS_FAILED }, + { "None", ONLP_FAN_STATUS_B2F }, + { "None", ONLP_FAN_STATUS_F2B }, + { NULL, 0 } +}; + +const char* +onlp_fan_status_name(onlp_fan_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_status'"; + } +} + +int +onlp_fan_status_value(const char* str, onlp_fan_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_fan_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_fan_status_desc(onlp_fan_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_status'"; + } +} + +int +onlp_fan_status_valid(onlp_fan_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_fan_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_status_map[] = +{ + { "OK", ONLP_STATUS_OK }, + { "E_UNSUPPORTED", ONLP_STATUS_E_UNSUPPORTED }, + { "E_MISSING", ONLP_STATUS_E_MISSING }, + { "E_INVALID", ONLP_STATUS_E_INVALID }, + { "E_INTERNAL", ONLP_STATUS_E_INTERNAL }, + { "E_PARAM", ONLP_STATUS_E_PARAM }, + { NULL, 0 } +}; + +aim_map_si_t onlp_status_desc_map[] = +{ + { "None", ONLP_STATUS_OK }, + { "None", ONLP_STATUS_E_UNSUPPORTED }, + { "None", ONLP_STATUS_E_MISSING }, + { "None", ONLP_STATUS_E_INVALID }, + { "None", ONLP_STATUS_E_INTERNAL }, + { "None", ONLP_STATUS_E_PARAM }, + { NULL, 0 } +}; + +const char* +onlp_status_name(onlp_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_status'"; + } +} + +int +onlp_status_value(const char* str, onlp_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_status_desc(onlp_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_status'"; + } +} + +int +onlp_status_valid(onlp_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_fan_dir_map[] = +{ + { "B2F", ONLP_FAN_DIR_B2F }, + { "F2B", ONLP_FAN_DIR_F2B }, + { NULL, 0 } +}; + +aim_map_si_t onlp_fan_dir_desc_map[] = +{ + { "None", ONLP_FAN_DIR_B2F }, + { "None", ONLP_FAN_DIR_F2B }, + { NULL, 0 } +}; + +const char* +onlp_fan_dir_name(onlp_fan_dir_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_dir_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_dir'"; + } +} + +int +onlp_fan_dir_value(const char* str, onlp_fan_dir_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_fan_dir_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_fan_dir_desc(onlp_fan_dir_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_fan_dir_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_fan_dir'"; + } +} + + +aim_map_si_t onlp_psu_caps_map[] = +{ + { "AC", ONLP_PSU_CAPS_AC }, + { "DC12", ONLP_PSU_CAPS_DC12 }, + { "DC48", ONLP_PSU_CAPS_DC48 }, + { "VIN", ONLP_PSU_CAPS_VIN }, + { "VOUT", ONLP_PSU_CAPS_VOUT }, + { "IIN", ONLP_PSU_CAPS_IIN }, + { "IOUT", ONLP_PSU_CAPS_IOUT }, + { "PIN", ONLP_PSU_CAPS_PIN }, + { "POUT", ONLP_PSU_CAPS_POUT }, + { NULL, 0 } +}; + +aim_map_si_t onlp_psu_caps_desc_map[] = +{ + { "None", ONLP_PSU_CAPS_AC }, + { "None", ONLP_PSU_CAPS_DC12 }, + { "None", ONLP_PSU_CAPS_DC48 }, + { "None", ONLP_PSU_CAPS_VIN }, + { "None", ONLP_PSU_CAPS_VOUT }, + { "None", ONLP_PSU_CAPS_IIN }, + { "None", ONLP_PSU_CAPS_IOUT }, + { "None", ONLP_PSU_CAPS_PIN }, + { "None", ONLP_PSU_CAPS_POUT }, + { NULL, 0 } +}; + +const char* +onlp_psu_caps_name(onlp_psu_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_psu_caps_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_psu_caps'"; + } +} + +int +onlp_psu_caps_value(const char* str, onlp_psu_caps_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_psu_caps_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_psu_caps_desc(onlp_psu_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_psu_caps_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_psu_caps'"; + } +} + +int +onlp_psu_caps_valid(onlp_psu_caps_t e) +{ + return aim_map_si_i(NULL, e, onlp_psu_caps_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_thermal_caps_map[] = +{ + { "GET_TEMPERATURE", ONLP_THERMAL_CAPS_GET_TEMPERATURE }, + { "GET_WARNING_THRESHOLD", ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD }, + { "GET_ERROR_THRESHOLD", ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD }, + { "GET_SHUTDOWN_THRESHOLD", ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD }, + { NULL, 0 } +}; + +aim_map_si_t onlp_thermal_caps_desc_map[] = +{ + { "None", ONLP_THERMAL_CAPS_GET_TEMPERATURE }, + { "None", ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD }, + { "None", ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD }, + { "None", ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD }, + { NULL, 0 } +}; + +const char* +onlp_thermal_caps_name(onlp_thermal_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_thermal_caps_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_thermal_caps'"; + } +} + +int +onlp_thermal_caps_value(const char* str, onlp_thermal_caps_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_thermal_caps_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_thermal_caps_desc(onlp_thermal_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_thermal_caps_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_thermal_caps'"; + } +} + +int +onlp_thermal_caps_valid(onlp_thermal_caps_t e) +{ + return aim_map_si_i(NULL, e, onlp_thermal_caps_map, 0) ? 1 : 0; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_int.h b/packages/base/any/onlp/src/onlp/module/src/onlp_int.h new file mode 100644 index 00000000..2a99de75 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_int.h @@ -0,0 +1,47 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_INT_H__ +#define __ONLP_INT_H__ + +#include +#include +#include +#include +#include +#include "onlp_json.h" + +/** Default IOF initializations for dump() and show() routines */ +void onlp_oid_show_iof_init_default(iof_t* iof, aim_pvs_t* pvs, uint32_t flags); +void onlp_oid_dump_iof_init_default(iof_t* iof, aim_pvs_t* pvs); + +/** Default error message when the status of an OID cannot be retreived */ +void onlp_oid_info_get_error(iof_t* iof, int error); + +/** Standard OID description output */ +void onlp_oid_show_description(iof_t* iof, onlp_oid_hdr_t* hdr); +/** Standard message when an OID is missing. */ +void onlp_oid_show_state_missing(iof_t* iof); + +#endif /* __ONLP_INT_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_json.c b/packages/base/any/onlp/src/onlp/module/src/onlp_json.c new file mode 100644 index 00000000..256c8529 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_json.c @@ -0,0 +1,68 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include "onlp_json.h" +#include "onlp_log.h" +#include + +static cJSON* root__ = NULL; +static char* file__ = NULL; + +void +onlp_json_init(const char* fname) +{ + int rv; + onlp_json_denit(); + + rv = cjson_util_parse_file(fname, &root__); + if(rv < 0 || root__ == NULL) { + root__ = cJSON_Parse("{}"); + } + else { + file__ = aim_strdup(fname); + } + +} + +cJSON* +onlp_json_get(int reload) +{ + if(reload) { + onlp_json_init(file__); + } + return root__; +} + +void +onlp_json_denit(void) +{ + if(root__) { + cJSON_Delete(root__); + root__ = NULL; + } + if(file__) { + aim_free(file__); + file__ = NULL; + } +} diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_json.h b/packages/base/any/onlp/src/onlp/module/src/onlp_json.h new file mode 100644 index 00000000..3ba8e259 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_json.h @@ -0,0 +1,48 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLP_JSON_H__ +#define __ONLP_JSON_H__ + +#include +#include "onlp_int.h" +#include + +/** + * @brief Initialize the JSON configuration data. + * @param fname JSON configuration filename. + */ +void onlp_json_init(const char* fname); + +/** + * @brief Get the JSON configuration root. + * @param reload Option to reload the config file first. + */ +cJSON* onlp_json_get(int reload); + +void onlp_json_denit(void); + + +#endif /* __ONLP_JSON_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_locks.c b/packages/base/any/onlp/src/onlp/module/src/onlp_locks.c new file mode 100644 index 00000000..c87d894d --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_locks.c @@ -0,0 +1,70 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "onlp_locks.h" + +#if ONLP_CONFIG_INCLUDE_API_LOCK == 1 + +#if ONLP_CONFIG_API_LOCK_GLOBAL_SHARED == 0 + +#include + +/** + * The API Lock is a simple semaphore locking within + * the current process only. + */ +static os_sem_t api_sem__; +static const char* owner__ = NULL; + +void +onlp_api_lock_init(void) +{ + api_sem__ = os_sem_create_flags(1, OS_SEM_CREATE_F_TRUE_RELATIVE_TIMEOUTS); +} + +void +onlp_api_lock(const char* api) +{ + if(os_sem_take_timeout(api_sem__, ONLP_CONFIG_API_LOCK_TIMEOUT) != 0) { + AIM_DIE("The ONLP API lock in %s could not be acquired after %d microseconds. It appears to be currently owned by call to %s. This is considered fatal.", + api, ONLP_CONFIG_API_LOCK_TIMEOUT, owner__ ? owner__ : "(none)"); + } + owner__ = api; +} + +void +onlp_api_unlock(void) +{ + os_sem_give(api_sem__); +} + +#else +#error GLOBAL_SHARED API Lock support is not yet implemented. +#endif + +#endif /* ONLP_CONFIG_INCLUDE_API_LOCK */ + + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_locks.h b/packages/base/any/onlp/src/onlp/module/src/onlp_locks.h new file mode 100644 index 00000000..dbb0e5e5 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_locks.h @@ -0,0 +1,175 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_LOCKS_H__ +#define __ONLP_LOCKS_H__ + +#include + +#if ONLP_CONFIG_INCLUDE_API_LOCK == 1 + +/** + * @brief Initialize the ONLP API lock infrastructure. + */ +void onlp_api_lock_init(); + +/** + * @brief Take the ONLP API lock. + */ +void onlp_api_lock(const char* api); + +/** + * @brief Give the ONLP API lock. + */ +void onlp_api_unlock(void); + + +#define ONLP_API_LOCK_INIT() onlp_api_lock_init() +#define ONLP_API_LOCK(_api) onlp_api_lock(_api) +#define ONLP_API_UNLOCK() onlp_api_unlock() + +#else + +#define ONLP_API_LOCK_INIT() +#define ONLP_API_LOCK(_api) +#define ONLP_API_UNLOCK() + +#endif /** ONLP_CONFIG_INCLUDE_API_LOCK */ + + +/**************************************************************************** + * + * These macros are used the instantiate the public (and potentially locked) + * ONLP API entry points. + * + ***************************************************************************/ + +#define ONLP_LOCKED_API_NAME(_name) _name##_locked__ + +#define ONLP_LOCKED_API0(_name) \ + int _name (void) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name)(); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_API1(_name, _t, _v) \ + int _name (_t _v) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name)(_v); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_API2(_name, _t1, _v1, _t2, _v2) \ + int _name (_t1 _v1, _t2 _v2) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name) (_v1, _v2); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_API3(_name, _t1, _v1, _t2, _v2, _t3, _v3) \ + int _name (_t1 _v1, _t2 _v2, _t3 _v3) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_API4(_name, _t1, _v1, _t2, _v2, _t3, _v3, _t4, _v4) \ + int _name (_t1 _v1, _t2 _v2, _t3 _v3, _t4 _v4) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3, _v4); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_API5(_name, _t1, _v1, _t2, _v2, _t3, _v3, _t4, _v4, _t5, _v5) \ + int _name (_t1 _v1, _t2 _v2, _t3 _v3, _t4 _v4, _t5 _v5) \ + { \ + ONLP_API_LOCK(#_name); \ + int _rv = ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3, _v4, _v5); \ + ONLP_API_UNLOCK(); \ + return _rv; \ + } + +#define ONLP_LOCKED_VAPI0(_name) \ + void _name (void) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name)(); \ + ONLP_API_UNLOCK(); \ + } + +#define ONLP_LOCKED_VAPI1(_name, _t, _v) \ + void _name (_t _v) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name)(_v); \ + ONLP_API_UNLOCK(); \ + } + +#define ONLP_LOCKED_VAPI2(_name, _t1, _v1, _t2, _v2) \ + void _name (_t1 _v1, _t2 _v2) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name) (_v1, _v2); \ + ONLP_API_UNLOCK(); \ + } + +#define ONLP_LOCKED_VAPI3(_name, _t1, _v1, _t2, _v2, _t3, _v3) \ + void _name (_t1 _v1, _t2 _v2, _t3 _v3) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3); \ + ONLP_API_UNLOCK(); \ + } + +#define ONLP_LOCKED_VAPI4(_name, _t1, _v1, _t2, _v2, _t3, _v3, _t4, _v4) \ + void _name (_t1 _v1, _t2 _v2, _t3 _v3, _t4 _v4) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3, _v4); \ + ONLP_API_UNLOCK(); \ + } + +#define ONLP_LOCKED_VAPI5(_name, _t1, _v1, _t2, _v2, _t3, _v3, _t4, _v4, _t5, _v5) \ + void _name (_t1 _v1, _t2 _v2, _t3 _v3, _t4 _v4, _t5 _v5) \ + { \ + ONLP_API_LOCK(#_name); \ + ONLP_LOCKED_API_NAME(_name) (_v1, _v2, _v3, _v4, _v5); \ + ONLP_API_UNLOCK(); \ + } + + + + +#endif /* __ONLP_LOCKS_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_log.c b/packages/base/any/onlp/src/onlp/module/src/onlp_log.c new file mode 100644 index 00000000..80c87dcf --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_log.c @@ -0,0 +1,38 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlp_log.h" +/* + * onlp log struct. + */ +AIM_LOG_STRUCT_DEFINE( + ONLP_CONFIG_LOG_OPTIONS_DEFAULT, + ONLP_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_log.h b/packages/base/any/onlp/src/onlp/module/src/onlp_log.h new file mode 100644 index 00000000..63b66c51 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_log.h @@ -0,0 +1,32 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLP_LOG_H__ +#define __ONLP_LOG_H__ + +#define AIM_LOG_MODULE_NAME onlp +#include + +#endif /* __ONLP_LOG_H__ */ diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_main.c b/packages/base/any/onlp/src/onlp/module/src/onlp_main.c new file mode 100644 index 00000000..893d66ea --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_main.c @@ -0,0 +1,311 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include + +/** + * Human-readable SFP inventory. + * This should be moved to common. + */ +static void +show_inventory__(aim_pvs_t* pvs) +{ + int port; + onlp_sfp_bitmap_t bitmap; + + onlp_sfp_bitmap_t_init(&bitmap); + onlp_sfp_bitmap_get(&bitmap); + + if(AIM_BITMAP_COUNT(&bitmap) == 0) { + aim_printf(pvs, "No SFPs on this platform.\n"); + } + else { + aim_printf(pvs, "Port Type Media Status Len Vendor Model S/N \n"); + aim_printf(pvs, "---- -------------- ------ ------ ----- ---------------- ---------------- ----------------\n"); + + AIM_BITMAP_ITER(&bitmap, port) { + int rv; + uint8_t* data; + + rv = onlp_sfp_is_present(port); + + if(rv == 0) { + aim_printf(pvs, "%4d NONE\n", port); + continue; + } + + if(rv < 0) { + aim_printf(pvs, "%4d Error %{onlp_status}\n", port, rv); + continue; + } + + rv = onlp_sfp_eeprom_read(port, &data); + + if(rv < 0) { + aim_printf(pvs, "%4d Error %{onlp_status}\n", port, rv); + continue; + } + + sff_info_t sff; + char status_str[32] = {0}; + + sff_info_init(&sff, data); + + if(!sff.supported) { + /* Present but unidentified. */ + aim_printf(pvs, "%13d UNK\n", port); + continue; + } + + + uint32_t status = 0; + char* cp = status_str; + onlp_sfp_control_flags_get(port, &status); + if(status & ONLP_SFP_CONTROL_FLAG_RX_LOS) { + *cp++ = 'R'; + } + if(status & ONLP_SFP_CONTROL_FLAG_TX_FAULT) { + *cp++ = 'T'; + } + if(status & ONLP_SFP_CONTROL_FLAG_TX_DISABLE) { + *cp++ = 'X'; + } + if(status & ONLP_SFP_CONTROL_FLAG_LP_MODE) { + *cp++ = 'L'; + } + aim_printf(pvs, "%4d %-14s %-6s %-6.6s %-5.5s %-16.16s %-16.16s %16.16s\n", + port, + sff.module_type_name, + sff.media_type_name, + status_str, + sff.length_desc, + sff.vendor, + sff.model, + sff.serial); + } + } +} + + +static int +iterate_oids_callback__(onlp_oid_t oid, void* cookie) +{ + int type = ONLP_OID_TYPE_GET(oid); + int id = ONLP_OID_ID_GET(oid); + + static int thermal = 1; + static int fan = 1; + static int psu = 1; + + switch(type) + { + case ONLP_OID_TYPE_THERMAL: + printf("thermal,Thermal %d,%d\n", id, thermal++); + break; + case ONLP_OID_TYPE_FAN: + printf("fan,Fan %d,%d\n", id, fan++); + break; + case ONLP_OID_TYPE_PSU: + printf("psu,PSU %d,%d\n", id, psu++); + break; + } + return 0; +} + + +static void +iterate_oids__(void) +{ + onlp_oid_iterate(ONLP_OID_SYS, 0, + iterate_oids_callback__, NULL); +} + + + + +int +onlpdump_main(int argc, char* argv[]) +{ + int show = 0; + uint32_t showflags = 0; + int help = 0; + int c; + int rv = -1; + int j = 0; + int o = 0; + int m = 0; + int i = 0; + int p = 0; + int x = 0; + int S = 0; + const char* O = NULL; + const char* t = NULL; + + while( (c = getopt(argc, argv, "srehdojmipxSt:O:")) != -1) { + switch(c) + { + case 's': show=1; break; + case 'r': show=1; showflags |= ONLP_OID_SHOW_F_RECURSE; break; + case 'e': show=1; showflags |= ONLP_OID_SHOW_F_EXTENDED; break; + case 'd': show=0; break; + case 'h': help=1; rv = 0; break; + case 'j': j=1; break; + case 'o': o=1; break; + case 'x': x=1; break; + case 'm': m=1; break; + case 'i': i=1; break; + case 'p': p=1; show=-1; break; + case 't': t = optarg; break; + case 'O': O = optarg; break; + case 'S': S=1; break; + default: help=1; rv = 1; break; + } + } + + if(help) { + printf("Usage: %s [OPTIONS]\n", argv[0]); + printf(" -d Use dump(). This is the default.\n"); + printf(" -s Use show() instead of dump().\n"); + printf(" -r Recursive show(). Implies -s\n"); + printf(" -e Extended show(). Implies -s\n"); + printf(" -o Dump ONIE data only.\n"); + printf(" -x Dump Platform Info only.\n"); + printf(" -j Dump ONIE data in JSON format.\n"); + printf(" -m Run platform manager.\n"); + printf(" -i Iterate OIDs.\n"); + printf(" -p Show SFP presence.\n"); + printf(" -t Decode TlvInfo data.\n"); + printf(" -O Dump OID.\n"); + printf(" -S Decode SFP Inventory\n"); + return rv; + } + + + if(t){ + int rv; + onlp_onie_info_t onie; + rv = onlp_onie_decode_file(&onie, t); + if(rv >= 0) { + onlp_onie_show(&onie, &aim_pvs_stdout); + onlp_onie_info_free(&onie); + return 0; + } + else { + aim_printf(&aim_pvs_stdout, "Decode failed."); + return 1; + } + } + + onlp_init(); + + if(S) { + show_inventory__(&aim_pvs_stdout); + return 0; + } + + if(O) { + int oid; + if(sscanf(O, "0x%x", &oid) == 1) { + onlp_oid_dump(oid, &aim_pvs_stdout, + ONLP_OID_DUMP_F_RECURSE | + ONLP_OID_DUMP_F_EVEN_IF_ABSENT); + } + return 0; + } + + if(i) { + iterate_oids__(); + return 0; + } + + if(o || x) { + onlp_sys_info_t si; + if(onlp_sys_info_get(&si) < 0) { + fprintf(stderr, "onlp_sys_info_get() failed."); + return 1; + } + + if(o) { + if(j) { + onlp_onie_show_json(&si.onie_info, &aim_pvs_stdout); + } + else { + onlp_onie_show(&si.onie_info, &aim_pvs_stdout); + } + } + + if(x) { + if(j) { + onlp_platform_info_show_json(&si.platform_info, &aim_pvs_stdout); + } + else { + onlp_platform_info_show(&si.platform_info, &aim_pvs_stdout); + } + } + + onlp_sys_info_free(&si); + return 0; + } + + if(show >= 0) { + if(show == 0) { + /* Default to full dump */ + onlp_platform_dump(&aim_pvs_stdout, + ONLP_OID_DUMP_F_RECURSE | ONLP_OID_DUMP_F_EVEN_IF_ABSENT); + } + else { + onlp_platform_show(&aim_pvs_stdout, + showflags); + } + } + + + if(m) { + printf("Running the platform manager for 600 seconds...\n"); + onlp_sys_platform_manage_start(); + sleep(600); + printf("Stopping the platform manager.\n"); + onlp_sys_platform_manage_stop(); + } + + if(p) { + onlp_sfp_bitmap_t presence; + onlp_sfp_bitmap_t_init(&presence); + int rv = onlp_sfp_presence_bitmap_get(&presence); + aim_printf(&aim_pvs_stdout, "Presence: "); + if(rv < 0) { + aim_printf(&aim_pvs_stdout, "Error %{onlp_status}\n", rv); + } + else { + aim_printf(&aim_pvs_stdout, "%{aim_bitmap}\n", &presence); + } + } + + return 0; +} diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_module.c b/packages/base/any/onlp/src/onlp/module/src/onlp_module.c new file mode 100644 index 00000000..4d050bd2 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_module.c @@ -0,0 +1,70 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlp_log.h" +#include + +static int +datatypes_init__(void) +{ +#define ONLP_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + + + /* + * Register our flag maps. + */ + AIM_DATATYPE_FMAP_REGISTER(onlp_sfp_control_flags, onlp_sfp_control_flag_map, "SFP Control Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_fan_caps_flags, onlp_fan_caps_map, "FAN Capability Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_fan_status_flags, onlp_fan_status_map, "FAN Status Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_thermal_status_flags, onlp_thermal_status_map, "Thermal Status Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_thermal_caps_flags, onlp_thermal_caps_map, "Thermal Capability Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_led_caps_flags, onlp_led_caps_map, "LED Capability Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_led_status_flags, onlp_led_status_map, "LED Status Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_psu_status_flags, onlp_psu_status_map, "PSU Status Flags", AIM_LOG_INTERNAL); + AIM_DATATYPE_FMAP_REGISTER(onlp_psu_caps_flags, onlp_psu_caps_map, "PSU Capability Flags", AIM_LOG_INTERNAL); + + + return 0; +} + +void __onlp_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); + +#if ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT == 1 + onlp_shlock_global_init(); +#endif + + { + extern int __onlp_platform_version__; + extern int __onlp_platform_version_default__; + __onlp_platform_version_default__ = __onlp_platform_version__; + } +} + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_ucli.c b/packages/base/any/onlp/src/onlp/module/src/onlp_ucli.c new file mode 100644 index 00000000..a9a52401 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_ucli.c @@ -0,0 +1,82 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#if ONLP_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +onlp_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(onlp) +} + +/* */ +/****************************************************************************** + * + * These handler table(s) were autogenerated from the symbols in this + * source file. + * + *****************************************************************************/ +static ucli_command_handler_f onlp_ucli_ucli_handlers__[] = +{ + onlp_ucli_ucli__config__, + NULL +}; +/******************************************************************************/ +/* */ + +static ucli_module_t +onlp_ucli_module__ = + { + "onlp_ucli", + NULL, + onlp_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +onlp_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&onlp_ucli_module__); + n = ucli_node_create("onlp", NULL, &onlp_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("onlp")); + return n; +} + +#else +void* +onlp_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_util.c b/packages/base/any/onlp/src/onlp/module/src/onlp_util.c new file mode 100644 index 00000000..478317dd --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_util.c @@ -0,0 +1,76 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "onlp_int.h" + +/** + * The OID dump() and show() routines + * need a default IOF. + */ +void +onlp_oid_dump_iof_init_default(iof_t* iof, aim_pvs_t* pvs) +{ + if(iof_init(iof, pvs) == 0) { + /* Default settings */ + iof->indent_factor=4; + iof->level=1; + iof->indent_terminator=""; + } +} +void +onlp_oid_show_iof_init_default(iof_t* iof, aim_pvs_t* pvs, uint32_t flags) +{ + if(iof_init(iof, pvs) == 0) { + /* Default settings */ + iof->indent_factor=2; + iof->level=1; + iof->indent_terminator=""; + iof->pop_string = NULL; + if(flags & ONLP_OID_SHOW_F_YAML) { + iof->push_string = ":"; + } + else { + iof->push_string = ""; + } + } +} + +void +onlp_oid_info_get_error(iof_t* iof, int error) +{ + iof_iprintf(iof, "Error retrieving status: %{onlp_status}", error); +} +void +onlp_oid_show_description(iof_t* iof, onlp_oid_hdr_t* hdr) +{ + iof_iprintf(iof, "Description: %s", hdr->description); +} + +void +onlp_oid_show_state_missing(iof_t* iof) +{ + iof_iprintf(iof, "State: Missing"); +} diff --git a/packages/base/any/onlp/src/onlp/module/src/platform_dump.c b/packages/base/any/onlp/src/onlp/module/src/platform_dump.c new file mode 100644 index 00000000..3fd6d533 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/platform_dump.c @@ -0,0 +1,44 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include + +void +onlp_platform_dump(aim_pvs_t* pvs, uint32_t flags) +{ + /* Dump all OIDS, starting with the SYS OID */ + onlp_oid_dump(ONLP_OID_SYS, pvs, flags); + aim_printf(pvs, "\nSFPs:\n"); + /* Dump all SFPs */ + onlp_sfp_dump(pvs); +} + +void +onlp_platform_show(aim_pvs_t* pvs, uint32_t flags) +{ + onlp_oid_show(ONLP_OID_SYS, pvs, flags); +} diff --git a/packages/base/any/onlp/src/onlp/module/src/platform_manager.c b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c new file mode 100644 index 00000000..cea575f0 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c @@ -0,0 +1,433 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * This file implements the Platform Management infrastructure. + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "onlp_log.h" +#include "onlp_int.h" +#include +#include +#include + +/** + * Timer wheel callback entry. + */ +typedef struct management_entry_s { + /** Timer wheel for this entry */ + timer_wheel_entry_t twe; + + /** This is the callback for this timer */ + int (*manage)(void); + + /** This is the callback rate in microseconds */ + uint64_t rate; + + /** The name of this callback (for debugging) */ + const char* name; + + /** The number of times this has been called. */ + int calls; + +} management_entry_t; + +/** + * Platform management control structure. + */ +typedef struct management_ctrl_s { + timer_wheel_t* tw; + + int eventfd; + pthread_t thread; + +} management_ctrl_t; + +/* This is the global control state */ +static management_ctrl_t control__ = { NULL }; + + +/* + * Internal notification handler for PSU + * status changes (all platforms) + */ +static int platform_psus_notify__(void); + + +/* + * Internal notification handler for FAN + * status changes (all platforms) + */ +static int platform_fans_notify__(void); + + + +/* + * First Version : Static callback rates. + * TODO: Allow individual platform callbacks to reregister + * themselves at whatever rate they want. + */ +static management_entry_t management_entries[] = + { + { + { }, + onlp_sysi_platform_manage_fans, + /* Every 10 seconds */ + 10*1000*1000, + "Fans", + }, + { + { }, + onlp_sysi_platform_manage_leds, + /* Every 2 seconds */ + 2*1000*1000, + "LEDs", + + }, + { + { }, + platform_psus_notify__, + /* Every second */ + 1*1000*1000, + "PSUs", + }, + { + { }, + platform_fans_notify__, + /* Every second */ + 1*1000*1000, + "Fans", + } + }; + + +void +onlp_sys_platform_manage_init(void) +{ + if(control__.tw == NULL) { + int i; + uint64_t now = os_time_monotonic(); + + control__.tw = timer_wheel_create(4, 512, now); + + for(i = 0; i < AIM_ARRAYSIZE(management_entries); i++) { + management_entry_t* e = management_entries+i; + timer_wheel_insert(control__.tw, &e->twe, now + e->rate); + } + } +} + + +void +onlp_sys_platform_manage_now(void) +{ + management_entry_t* e; + + onlp_sys_platform_manage_init(); + + while( (e = (management_entry_t*) timer_wheel_next(control__.tw, + os_time_monotonic())) ) { + if(e->manage) { + e->manage(); + } + e->calls++; + timer_wheel_insert(control__.tw, &e->twe, os_time_monotonic() + e->rate); + } +} + +static void* +onlp_sys_platform_manage_thread__(void* vctrl) +{ + volatile management_ctrl_t* ctrl = (volatile management_ctrl_t*)(vctrl); + + os_thread_name_set("onlp.sys.pm"); + + /* + * Wait on the eventfd for the specified timeout period. + */ + for(;;) { + + fd_set fds; + uint64_t now; + struct timeval tv; + timer_wheel_entry_t* twe; + + FD_ZERO(&fds); + FD_SET(ctrl->eventfd, &fds); + + /* + * Ask the timer wheel if there is an expiration in the next 2 seconds. + */ + now = os_time_monotonic(); + twe = timer_wheel_peek(ctrl->tw, now + 20000000); + + if(twe == NULL) { + /* Nothing in the next two seconds. */ + tv.tv_sec = 2; + tv.tv_sec = 0; + } + else { + if(twe->deadline > now) { + /* Sleep until next deadline */ + tv.tv_sec = (twe->deadline - now) / 1000000; + tv.tv_usec = (twe->deadline - now) % 1000000; + } + else { + /* We have surpassed the current deadline */ + tv.tv_sec = 0; + tv.tv_usec = 0; + } + } + + int rv = select(ctrl->eventfd+1, &fds, NULL, NULL, &tv); + if(rv == 1 && FD_ISSET(ctrl->eventfd, &fds)) { + /* We've been asked to terminate. */ + AIM_LOG_MSG("Terminating."); + /* Also signifies that we have exit */ + close(ctrl->eventfd); + ctrl->eventfd = -1; + return NULL; + } + if(rv < 0) { + AIM_LOG_ERROR("select() returned %d (%{errno})", rv, errno); + /* Sleep 1 second, but continue to run */ + sleep(1); + } + + /* + * We don't bother to check the result of select() here. + */ + onlp_sys_platform_manage_now(); + } +} + +int +onlp_sys_platform_manage_start(void) +{ + onlp_sys_platform_manage_init(); + + if(control__.eventfd > 0) { + /* Already running */ + return 0; + } + + if( (control__.eventfd = eventfd(0, EFD_SEMAPHORE)) < 0) { + AIM_LOG_ERROR("eventfd create failed: %{errno}", errno); + return -1; + } + + if( (pthread_create(&control__.thread, NULL, onlp_sys_platform_manage_thread__, + &control__)) != 0) { + AIM_LOG_ERROR("pthread create failed."); + close(control__.eventfd); + control__.eventfd = -1; + return -1; + } + + return 0; +} + +int +onlp_sys_platform_manage_stop(void) +{ + if(control__.eventfd > 0) { + uint64_t zero = 1; + /* Tell the thread to exit */ + write(control__.eventfd, &zero, sizeof(zero)); + /* Wait for the thread to terminate */ + pthread_join(control__.thread, NULL); + } + return 0; +} + + +static int +platform_psus_notify__(void) +{ + static onlp_oid_t psu_oid_table[ONLP_OID_TABLE_SIZE] = {0}; + static onlp_psu_info_t psu_info_table[ONLP_OID_TABLE_SIZE]; + int i = 0; + + if(psu_oid_table[0] == 0) { + /* We haven't retreived the system PSU oids yet. */ + onlp_sys_info_t si; + onlp_oid_t* oidp; + + if(onlp_sys_info_get(&si) < 0) { + AIM_LOG_ERROR("onlp_sys_info_get() failed."); + return -1; + } + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, PSU) { + psu_oid_table[i++] = *oidp; + } + } + + for(i = 0; i < AIM_ARRAYSIZE(psu_oid_table); i++) { + onlp_psu_info_t pi; + int pid = ONLP_OID_ID_GET(psu_oid_table[i]); + + if(psu_oid_table[i] == 0) { + break; + } + + if(onlp_psu_info_get(psu_oid_table[i], &pi) < 0) { + AIM_LOG_ERROR("Failure retreiving status of PSU ID %d", + pid); + continue; + } + + /* + * Log any presences or failure transitions. + */ + if(pi.status != psu_info_table[i].status) { + uint32_t new = pi.status; + uint32_t old = psu_info_table[i].status; + + if( !(old & 0x1) && (new & 0x1) ) { + /* PSU Inserted */ + AIM_SYSLOG_INFO("PSU has been inserted.", + "A PSU has been inserted in the given slot.", + "PSU %d has been inserted.", pid); + } + if( (old & 0x1) && !(new & 0x1) ) { + /* PSU Removed */ + AIM_SYSLOG_WARN("PSU has been removed.", + "A PSU has been removed from the given slot.", + "PSU %d has been removed.", pid); + } + if( (new & 0x1) && (old & ONLP_PSU_STATUS_FAILED) && !(new & ONLP_PSU_STATUS_FAILED) ) { + /* PSU recovery (seems unlikely) */ + AIM_SYSLOG_INFO("PSU has recovered.", + "The given PSU has recovered from a failure.", + "PSU %d has recovered.", pid); + } + + if( !(old & ONLP_PSU_STATUS_FAILED) && (new & ONLP_PSU_STATUS_FAILED) ) { + /* PSU Failure */ + AIM_SYSLOG_CRIT("PSU has failed.", + "The given PSU has failed.", + "PSU %d has failed.", pid); + } + + if(!(new & ONLP_PSU_STATUS_FAILED)) { + if( (old & ONLP_PSU_STATUS_UNPLUGGED) && !(new & ONLP_PSU_STATUS_UNPLUGGED)) { + /* PSU has been plugged in */ + AIM_SYSLOG_INFO("PSU has been plugged in.", + "The given PSU has been plugged in.", + "PSU %d has been plugged in.", pid); + } + + if(!(old & ONLP_PSU_STATUS_UNPLUGGED) && (new & ONLP_PSU_STATUS_UNPLUGGED)) { + /* PSU has been unplugged. */ + AIM_SYSLOG_WARN("PSU has been unplugged.", + "The given PSU has been unplugged.", + "PSU %d has been unplugged.", pid); + } + } + + memcpy(psu_info_table+i, &pi, sizeof(pi)); + } + } + return 0; +} + +static int +platform_fans_notify__(void) +{ + static onlp_oid_t fan_oid_table[ONLP_OID_TABLE_SIZE] = {0}; + static onlp_fan_info_t fan_info_table[ONLP_OID_TABLE_SIZE]; + int i = 0; + + if(fan_oid_table[0] == 0) { + /* We haven't retreived the system FAN oids yet. */ + onlp_sys_info_t si; + onlp_oid_t* oidp; + + if(onlp_sys_info_get(&si) < 0) { + AIM_LOG_ERROR("onlp_sys_info_get() failed."); + return -1; + } + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, FAN) { + fan_oid_table[i++] = *oidp; + } + } + + for(i = 0; i < AIM_ARRAYSIZE(fan_oid_table); i++) { + onlp_fan_info_t fi; + int fid = ONLP_OID_ID_GET(fan_oid_table[i]); + + if(fan_oid_table[i] == 0) { + break; + } + + if(onlp_fan_info_get(fan_oid_table[i], &fi) < 0) { + AIM_LOG_ERROR("Failure retreiving status of FAN ID %d", + fid); + continue; + } + + /* + * Log any presences or failure transitions. + */ + if(fi.status != fan_info_table[i].status) { + uint32_t new = fi.status; + uint32_t old = fan_info_table[i].status; + + if( !(old & 0x1) && (new & 0x1) ) { + /* FAN Inserted */ + AIM_SYSLOG_INFO("Fan has been inserted.", + "The given Fan has been inserted.", + "Fan %d has been inserted.", fid); + } + if( (old & 0x1) && !(new & 0x1) ) { + /* FAN Removed */ + AIM_SYSLOG_WARN("Fan has been removed.", + "The given Fan has been removed.", + "Fan %d has been removed.", fid); + } + if( (old & ONLP_FAN_STATUS_FAILED) && !(new & ONLP_FAN_STATUS_FAILED) ) { + AIM_SYSLOG_INFO("Fan has recovered.", + "The given Fan has recovered from failure.", + "Fan %d has recovered.", fid); + } + + if( !(old & ONLP_FAN_STATUS_FAILED) && (new & ONLP_FAN_STATUS_FAILED) ) { + /* FAN Failure */ + AIM_SYSLOG_CRIT("Fan has failed.", + "The given fan has failed.", + "Fan %d has failed.", fid); + } + + memcpy(fan_info_table+i, &fi, sizeof(fi)); + } + } + return 0; +} + + diff --git a/packages/base/any/onlp/src/onlp/module/src/psu.c b/packages/base/any/onlp/src/onlp/module/src/psu.c new file mode 100644 index 00000000..87325b25 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/psu.c @@ -0,0 +1,222 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Power Supply Management. + * + ***********************************************************/ + +#include +#include +#include +#include +#include "onlp_int.h" +#include "onlp_locks.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define VALIDATENR(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return; \ + } \ + } while(0) + + +static int +onlp_psu_init_locked__(void) +{ + return onlp_psui_init(); +} +ONLP_LOCKED_API0(onlp_psu_init); + +static int +onlp_psu_info_get_locked__(onlp_oid_t id, onlp_psu_info_t* info) +{ + VALIDATE(id); + return onlp_psui_info_get(id, info); +} +ONLP_LOCKED_API2(onlp_psu_info_get, onlp_oid_t, id, onlp_psu_info_t*, info); + +int +onlp_psu_vioctl_locked__(onlp_oid_t id, va_list vargs) +{ + return onlp_psui_ioctl(id, vargs); +} +ONLP_LOCKED_API2(onlp_psu_vioctl, onlp_oid_t, id, va_list, vargs); + +int +onlp_psu_ioctl(onlp_oid_t id, ...) +{ + va_list vargs; + va_start(vargs, id); + int rv = onlp_psu_vioctl(id, vargs); + va_end(vargs); + return rv; +} + +/************************************************************ + * + * Debug and Show Functions + * + ***********************************************************/ + +void +onlp_psu_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_psu_info_t info; + + VALIDATENR(id); + onlp_oid_dump_iof_init_default(&iof, pvs); + + iof_push(&iof, "psu @ %d", ONLP_OID_ID_GET(id)); + rv = onlp_psu_info_get(id, &info); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + iof_iprintf(&iof, "Description: %s", info.hdr.description); + if(info.status & 1) { + /* Present */ + iof_iprintf(&iof, "Model: %s", info.model[0] ? info.model : "NULL"); + iof_iprintf(&iof, "SN: %s", info.serial[0] ? info.serial : "NULL"); + iof_iprintf(&iof, "Status: %{onlp_psu_status_flags}", info.status); + iof_iprintf(&iof, "Caps: %{onlp_psu_caps_flags}", info.caps); + iof_iprintf(&iof, "Vin: %d", info.mvin); + iof_iprintf(&iof, "Vout: %d", info.mvout); + iof_iprintf(&iof, "Iin: %d", info.miin); + iof_iprintf(&iof, "Iout: %d", info.miout); + iof_iprintf(&iof, "Pin: %d", info.mpin); + iof_iprintf(&iof, "Pout: %d", info.mpout); + if(flags & ONLP_OID_DUMP_F_RECURSE) { + onlp_oid_table_dump(info.hdr.coids, &iof.inherit, flags); + } + } + else { + iof_iprintf(&iof, "Not present."); + } + } + iof_pop(&iof); +} + +void +onlp_psu_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_psu_info_t pi; + + onlp_oid_show_iof_init_default(&iof, pvs, flags); + rv = onlp_psu_info_get(id, &pi); + + iof_push(&iof, "PSU %d", ONLP_OID_ID_GET(id)); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &pi.hdr); + if(pi.status & 0x1) { + /* Present */ + iof_iprintf(&iof, "State: Present"); + if(pi.status & ONLP_PSU_STATUS_UNPLUGGED) { + iof_iprintf(&iof, "Status: Unplugged"); + } + else if(pi.status & ONLP_PSU_STATUS_FAILED) { + iof_iprintf(&iof, "Status: Unplugged or Failed."); + } + else { + iof_iprintf(&iof, "Status: Running."); + iof_iprintf(&iof, "Model: %s", pi.model[0] ? pi.model : "Unknown"); + if(pi.serial[0]) iof_iprintf(&iof, "SN: %s", pi.serial); + if(pi.caps & ONLP_PSU_CAPS_AC) { + iof_iprintf(&iof, "Type: AC"); + } + else if(pi.caps & ONLP_PSU_CAPS_DC12) { + iof_iprintf(&iof, "Type: DC 12V"); + } + else if(pi.caps & ONLP_PSU_CAPS_DC48) { + iof_iprintf(&iof, "Type: DC 48V"); + } + else { + iof_iprintf(&iof, "Type: Unknown."); + } + if(pi.caps & ONLP_PSU_CAPS_VIN) { + iof_iprintf(&iof, "Vin: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.mvin)); + } + if(pi.caps & ONLP_PSU_CAPS_VOUT) { + iof_iprintf(&iof, "Vout: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.mvout)); + } + if(pi.caps & ONLP_PSU_CAPS_IIN) { + iof_iprintf(&iof, "Iin: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.miin)); + } + if(pi.caps & ONLP_PSU_CAPS_IOUT) { + iof_iprintf(&iof, "Iout: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.miout)); + } + if(pi.caps & ONLP_PSU_CAPS_PIN) { + iof_iprintf(&iof, "Pin: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.mpin)); + } + if(pi.caps & ONLP_PSU_CAPS_POUT) { + iof_iprintf(&iof, "Pout: %d.%d", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(pi.mpout)); + } + + if(flags & ONLP_OID_SHOW_F_RECURSE) { + /* + * Display sub oids. + * + * The standard version only includes + * Fans and Thermal Sensors. + */ + onlp_oid_t* oidp; + ONLP_OID_TABLE_ITER_TYPE(pi.hdr.coids, oidp, FAN) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + ONLP_OID_TABLE_ITER_TYPE(pi.hdr.coids, oidp, THERMAL) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + + if(flags & ONLP_OID_SHOW_F_EXTENDED) { + /* Include all other types as well. */ + ONLP_OID_TABLE_ITER_TYPE(pi.hdr.coids, oidp, LED) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + } + } + } + } + else { + /* Not present */ + onlp_oid_show_state_missing(&iof); + } + } + iof_pop(&iof); +} diff --git a/packages/base/any/onlp/src/onlp/module/src/sfp.c b/packages/base/any/onlp/src/onlp/module/src/sfp.c new file mode 100644 index 00000000..e89d9f0f --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/sfp.c @@ -0,0 +1,401 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "onlp_log.h" +#include "onlp_locks.h" + +/** + * All port numbers will be validated before calling the SFP driver. + */ +static onlp_sfp_bitmap_t sfpi_bitmap__; + +void +onlp_sfp_bitmap_t_init(onlp_sfp_bitmap_t* bmap) +{ + AIM_BITMAP_INIT(bmap, 255); + AIM_BITMAP_CLR_ALL(bmap); +} + +static int +onlp_sfp_init_locked__(void) +{ + onlp_sfp_bitmap_t_init(&sfpi_bitmap__); + + int rv = onlp_sfpi_init(); + if(rv < 0) { + if(rv == ONLP_STATUS_E_UNSUPPORTED) { + /* + * There are no SFPs on this platform. + * Not necessarily an error condition. + */ + } + else { + AIM_LOG_ERROR("Error initializing the SFPI driver: %{onlp_status}", rv); + } + return rv; + } + else { + /* SFPI initialized. Get the bitmap */ + rv = onlp_sfpi_bitmap_get(&sfpi_bitmap__); + if(rv < 0) { + AIM_LOG_ERROR("onlp_sfpi_bitmap_get(): %{onlp_status}", rv); + return rv; + } + return ONLP_STATUS_OK; + } +} +ONLP_LOCKED_API0(onlp_sfp_init) + + + +static int +onlp_sfp_bitmap_get_locked__(onlp_sfp_bitmap_t* bmap) +{ + AIM_BITMAP_ASSIGN(bmap, &sfpi_bitmap__); + return ONLP_STATUS_OK; +} +ONLP_LOCKED_API1(onlp_sfp_bitmap_get, onlp_sfp_bitmap_t*, bmap); + + +static int +onlp_sfp_denit_locked__(void) +{ + return onlp_sfpi_denit(); +} +ONLP_LOCKED_API0(onlp_sfp_denit); + + +#define ONLP_SFP_PORT_VALIDATE_AND_MAP(_port) \ + do { \ + if(AIM_BITMAP_GET(&sfpi_bitmap__, _port) == 0) { \ + return -1; \ + } \ + int _rport; \ + if(onlp_sfpi_port_map(_port, &_rport) >= 0) { \ + _port = _rport; \ + } \ + } while(0) + +static int +onlp_sfp_is_present_locked__(int port) +{ + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + return onlp_sfpi_is_present(port); +} +ONLP_LOCKED_API1(onlp_sfp_is_present, int, port); + +static int +onlp_sfp_presence_bitmap_get_locked__(onlp_sfp_bitmap_t* dst) +{ + int rv = onlp_sfpi_presence_bitmap_get(dst); + + if(rv == ONLP_STATUS_E_UNSUPPORTED) { + /* Generate from single-port API */ + int p; + AIM_BITMAP_CLR_ALL(dst); + AIM_BITMAP_ITER(&sfpi_bitmap__, p) { + rv = onlp_sfp_is_present_locked__(p); + if(rv < 0) { + return rv; + } + if(rv > 0) { + AIM_BITMAP_SET(dst, p); + } + } + return 0; + } + + return rv; +} +ONLP_LOCKED_API1(onlp_sfp_presence_bitmap_get, onlp_sfp_bitmap_t*, dst); + +int +onlp_sfp_port_valid(int port) +{ + return AIM_BITMAP_GET(&sfpi_bitmap__, port); +} + +static int +onlp_sfp_eeprom_read_locked__(int port, uint8_t** datap) +{ + int rv; + uint8_t* data; + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + + data = aim_zmalloc(256); + if((rv = onlp_sfpi_eeprom_read(port, data)) < 0) { + aim_free(data); + data = NULL; + } + *datap = data; + return rv; +} +ONLP_LOCKED_API2(onlp_sfp_eeprom_read, int, port, uint8_t**, rv); + +static int +onlp_sfp_dom_read_locked__(int port, uint8_t** datap) +{ + int rv; + uint8_t* data; + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + + data = aim_zmalloc(256); + if((rv = onlp_sfpi_dom_read(port, data)) < 0) { + aim_free(data); + data = NULL; + } + *datap = data; + return rv; +} +ONLP_LOCKED_API2(onlp_sfp_dom_read, int, port, uint8_t**, rv); + +void +onlp_sfp_dump(aim_pvs_t* pvs) +{ + int p; + int rv; + + if(AIM_BITMAP_COUNT(&sfpi_bitmap__) == 0) { + aim_printf(pvs, "There are no SFP capable ports.\n"); + return; + } + + onlp_sfp_bitmap_t bmap; + onlp_sfp_bitmap_t_init(&bmap); + rv = onlp_sfp_presence_bitmap_get(&bmap); + aim_printf(pvs, " Presence Bitmap: "); + if(rv == 0) { + aim_printf(pvs, "%{aim_bitmap}\n", &bmap); + } + else { + aim_printf(pvs,"Error: %{onlp_status}\n", rv); + } + aim_printf(pvs, " RX_LOS Bitmap: "); + rv = onlp_sfp_rx_los_bitmap_get(&bmap); + if(rv == 0) { + aim_printf(pvs, "%{aim_bitmap}\n", &bmap); + } + else { + aim_printf(pvs, "Error: %{onlp_status}\n", rv); + } + aim_printf(pvs, "\n"); + + AIM_BITMAP_ITER(&sfpi_bitmap__, p) { + rv = onlp_sfp_is_present(p); + aim_printf(pvs, "Port %.2d: ", p); + if(rv == 0) { + /* Missing, OK */ + aim_printf(pvs, "Missing.\n"); + } + else if(rv == 1) { + /* Present, OK */ + int srv; + uint32_t flags = 0; + srv = onlp_sfp_control_flags_get(p, &flags); + if(srv >= 0) { + aim_printf(pvs, "Present, Status = %{onlp_sfp_control_flags}\n", flags); + } + else { + aim_printf(pvs, "Present, Status Unavailable [ %{onlp_status} ]\n", srv); + } + } + else { + /* Error */ + aim_printf(pvs, "Error: %{onlp_status}\n", rv); + } + if(rv == 1) { + uint8_t* idprom = NULL; + rv = onlp_sfp_eeprom_read(p, &idprom); + if(rv < 0) { + aim_printf(pvs, "Error reading eeprom: %{onlp_status}\n"); + } + else { + aim_printf(pvs, "eeprom:\n%{data}\n", idprom, 256); + aim_free(idprom); + } + } + } + return; +} + +static int +onlp_sfp_post_insert_locked__(int port, sff_info_t* info) +{ + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + return onlp_sfpi_post_insert(port, info); +} +ONLP_LOCKED_API2(onlp_sfp_post_insert, int, port, sff_info_t*, info); + +static int +onlp_sfp_control_set_locked__(int port, onlp_sfp_control_t control, int value) +{ + int supported; + + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + + if(!ONLP_SFP_CONTROL_VALID(control)) { + return ONLP_STATUS_E_PARAM; + } + + /* Does the platform advertise support for this control? */ + if( (onlp_sfpi_control_supported(port, control, &supported) >= 0) && + !supported) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + switch(control) + { + + case ONLP_SFP_CONTROL_RX_LOS: + case ONLP_SFP_CONTROL_TX_FAULT: + /** These are read-only. */ + return ONLP_STATUS_E_PARAM; + + default: + break; + } + return onlp_sfpi_control_set(port, control, value); +} +ONLP_LOCKED_API3(onlp_sfp_control_set, int, port, onlp_sfp_control_t, control, + int, value); + +static int +onlp_sfp_control_get_locked__(int port, onlp_sfp_control_t control, int* value) +{ + ONLP_SFP_PORT_VALIDATE_AND_MAP(port); + + if(!ONLP_SFP_CONTROL_VALID(control)) { + return ONLP_STATUS_E_PARAM; + } + + /* Does the platform advertise support for this control? */ + int supported; + if( (onlp_sfpi_control_supported(port, control, &supported) >= 0) && + !supported) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + switch(control) + { + case ONLP_SFP_CONTROL_RESET: + /* This is a write-only control. */ + return ONLP_STATUS_E_UNSUPPORTED; + + default: + break; + } + + return (value) ? onlp_sfpi_control_get(port, control, value) : ONLP_STATUS_E_PARAM; +} +ONLP_LOCKED_API3(onlp_sfp_control_get, int, port, onlp_sfp_control_t, control, + int*, value); + + + +static int +onlp_sfp_rx_los_bitmap_get_locked__(onlp_sfp_bitmap_t* dst) +{ + int rv = onlp_sfpi_rx_los_bitmap_get(dst); + + if(rv == ONLP_STATUS_E_UNSUPPORTED) { + /* Generate from control API */ + int p; + AIM_BITMAP_CLR_ALL(dst); + AIM_BITMAP_ITER(&sfpi_bitmap__, p) { + int v; + rv = onlp_sfp_control_get_locked__(p, ONLP_SFP_CONTROL_RX_LOS, &v); + if(rv < 0) { + return rv; + } + if(v) { + AIM_BITMAP_SET(dst, p); + } + } + } + + return rv; +} +ONLP_LOCKED_API1(onlp_sfp_rx_los_bitmap_get, onlp_sfp_bitmap_t*, dst); + + +int +onlp_sfp_control_flags_get(int port, uint32_t* flags) +{ + /** + * These are the control bits queried and returned. + */ + onlp_sfp_control_t controls[] = + { + ONLP_SFP_CONTROL_RESET_STATE, + ONLP_SFP_CONTROL_RX_LOS, + ONLP_SFP_CONTROL_TX_DISABLE, + ONLP_SFP_CONTROL_LP_MODE + }; + + if(flags) { + *flags = 0; + } + else { + return ONLP_STATUS_E_PARAM; + } + + int rv, i, v; + + for(i = 0; i < AIM_ARRAYSIZE(controls); i++) { + rv = onlp_sfp_control_get(port, controls[i], &v); + if(rv >= 0) { + if(v) { + *flags |= (1 << controls[i]); + } + } + else { + if(rv != ONLP_STATUS_E_UNSUPPORTED) { + return rv; + } + } + } + return 0; +} + +int +onlp_sfp_ioctl(int port, ...) +{ + int rv; + va_list vargs; + va_start(vargs, port); + rv = onlp_sfp_vioctl(port, vargs); + va_end(vargs); + return rv; +} + +int +onlp_sfp_vioctl_locked__(int port, va_list vargs) +{ + return onlp_sfpi_ioctl(port, vargs); +}; +ONLP_LOCKED_API2(onlp_sfp_vioctl, int, port, va_list, vargs); + + diff --git a/packages/base/any/onlp/src/onlp/module/src/sys.c b/packages/base/any/onlp/src/onlp/module/src/sys.c new file mode 100644 index 00000000..ac72d37a --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/sys.c @@ -0,0 +1,289 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include "onlp_log.h" +#include "onlp_int.h" +#include "onlp_locks.h" + +static char* +platform_detect_fs__(int warn) +{ + /* + * Check the filesystem for the platform identifier. + */ + char* rv = NULL; + if(ONLP_CONFIG_PLATFORM_FILENAME) { + FILE* fp; + if((fp=fopen(ONLP_CONFIG_PLATFORM_FILENAME, "r"))) { + char platform[256]; + if(fgets(platform, sizeof(platform), fp) == platform) { + /* TODO: Base this detection on the global platform registry. */ + if(platform[0]) { + if(platform[ONLP_STRLEN(platform)-1] == '\n') { + platform[ONLP_STRLEN(platform)-1] = 0; + } + rv = aim_strdup(platform); + } + } + fclose(fp); + } + else { + if(warn) { + AIM_LOG_WARN("could not open platform filename '%s'", ONLP_CONFIG_PLATFORM_FILENAME); + } + } + } + return rv; +} + +static char* +platform_detect__(void) +{ +#if ONLP_CONFIG_INCLUDE_PLATFORM_STATIC == 1 + return aim_strdup(ONLP_CONFIG_PLATFORM_STATIC); +#endif + return platform_detect_fs__(1); +} + +static int +onlp_sys_init_locked__(void) +{ + int rv; + + const char* current_platform = platform_detect__(); + if(current_platform == NULL) { + AIM_DIE("Could not determine the current platform."); + } + const char* current_interface = onlp_sysi_platform_get(); + if(current_interface == NULL) { + AIM_DIE("The platform driver did not return an appropriate platform identifier."); + } + + if(strcmp(current_interface, current_platform)) { + /* They do not match. Ask the interface if it supports the current platform. */ + int rv = onlp_sysi_platform_set(current_platform); + if(rv < 0) { + AIM_DIE("The current platform interface (%s) does not support the current platform (%s). This is fatal.", + current_interface, current_platform); + } + } + + /* If we get here, its all good */ + aim_free((char*)current_platform); + rv = onlp_sysi_init(); + return rv; +} +ONLP_LOCKED_API0(onlp_sys_init); + +static uint8_t* +onie_data_get__(int* free) +{ + void* pa; + uint8_t* ma = NULL; + int size; + if(onlp_sysi_onie_data_phys_addr_get(&pa) == 0) { + ma = onlp_mmap((off_t)pa, 64*1024, "onie_data_get__"); + *free = 0; + } + else if(onlp_sysi_onie_data_get(&ma, &size) == 0) { + *free = 1; + } + else { + ma = NULL; + *free = 0; + } + return ma; +} + +static int +onlp_sys_info_get_locked__(onlp_sys_info_t* rv) +{ + if(rv == NULL) { + return -1; + } + + memset(rv, 0, sizeof(*rv)); + + /** + * Get the system ONIE information. + */ + int free; + uint8_t* onie_data = onie_data_get__(&free); + + if(onie_data) { + onlp_onie_decode(&rv->onie_info, onie_data, -1); + if(free) { + onlp_sysi_onie_data_free(onie_data); + } + } + else { + if(onlp_sysi_onie_info_get(&rv->onie_info) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + } + + /* + * Query the sys oids + */ + onlp_sysi_oids_get(rv->hdr.coids, AIM_ARRAYSIZE(rv->hdr.coids)); + + /* + * Platform Information + */ + onlp_sysi_platform_info_get(&rv->platform_info); + + return 0; +} +ONLP_LOCKED_API1(onlp_sys_info_get,onlp_sys_info_t*,rv); + +void +onlp_sys_info_free(onlp_sys_info_t* info) +{ + onlp_onie_info_free(&info->onie_info); + onlp_sysi_platform_info_free(&info->platform_info); +} + +void +onlp_sys_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_sys_info_t si; + + onlp_oid_dump_iof_init_default(&iof, pvs); + + if(ONLP_OID_TYPE_GET(id) != ONLP_OID_TYPE_SYS) { + return; + } + + iof_push(&iof, "System Information"); + rv = onlp_sys_info_get(&si); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + iof_pop(&iof); + return; + } + else { + onlp_onie_show(&si.onie_info, &iof.inherit); + iof_pop(&iof); + } + onlp_oid_table_dump(si.hdr.coids, pvs, flags); + onlp_sys_info_free(&si); +} + +void +onlp_sys_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_sys_info_t si; + int yaml; + + onlp_oid_show_iof_init_default(&iof, pvs, flags); + yaml = (flags & ONLP_OID_SHOW_F_YAML); + + if(id && ONLP_OID_TYPE_GET(id) != ONLP_OID_TYPE_SYS) { + return; + } + + rv = onlp_sys_info_get(&si); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + return; + } + +#define YPUSH(key) do { if(yaml) { iof_push(&iof, key); } } while(0) +#define YPOP() do { if(yaml) { iof_pop(&iof); } } while(0) + + /* + * The system information is not actually shown + * unless you specify EXTENDED or !RECURSIVE + */ + if(yaml || + flags & ONLP_OID_SHOW_F_EXTENDED || + (flags & ONLP_OID_SHOW_F_RECURSE) == 0) { + iof_push(&iof, "System Information"); + onlp_onie_show(&si.onie_info, &iof.inherit); + iof_pop(&iof); + } + + if(flags & ONLP_OID_SHOW_F_RECURSE) { + + onlp_oid_t* oidp; + + /** Show all Chassis Fans */ + YPUSH("Fans"); + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, FAN) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + YPOP(); + + /** Show all System Thermals */ + YPUSH("Thermals"); + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, THERMAL) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + YPOP(); + + /** Show all PSUs */ + YPUSH("PSUs"); + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, PSU) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + YPOP(); + + if(flags & ONLP_OID_SHOW_F_EXTENDED) { + /** Show all LEDs */ + YPUSH("LEDs"); + ONLP_OID_TABLE_ITER_TYPE(si.hdr.coids, oidp, LED) { + onlp_oid_show(*oidp, &iof.inherit, flags); + } + YPOP(); + } + } + onlp_sys_info_free(&si); +} + +int +onlp_sys_ioctl(int code, ...) +{ + int rv; + va_list vargs; + va_start(vargs, code); + rv = onlp_sys_vioctl(code, vargs); + va_end(vargs); + return rv; +} + +static int +onlp_sys_vioctl_locked__(int code, va_list vargs) +{ + return onlp_sysi_ioctl(code, vargs); +} +ONLP_LOCKED_API2(onlp_sys_vioctl, int, code, va_list, vargs); + diff --git a/packages/base/any/onlp/src/onlp/module/src/thermal.c b/packages/base/any/onlp/src/onlp/module/src/thermal.c new file mode 100644 index 00000000..eb4d567a --- /dev/null +++ b/packages/base/any/onlp/src/onlp/module/src/thermal.c @@ -0,0 +1,213 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Management. + * + ************************************************************/ +#include +#include +#include +#include "onlp_int.h" +#include "onlp_locks.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define VALIDATENR(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return; \ + } \ + } while(0) + + +static int +onlp_thermal_init_locked__(void) +{ + return onlp_thermali_init(); +} +ONLP_LOCKED_API0(onlp_thermal_init); + +#if ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES == 1 + +static int +onlp_thermali_info_from_json__(cJSON* data, onlp_thermal_info_t* info, int errorcheck) +{ + int rv; + int t; + + if(data == NULL) { + return (errorcheck) ? ONLP_STATUS_E_PARAM : 0; + } + + rv = cjson_util_lookup_int(data, (int*) &info->status, "status"); + if(rv < 0 && errorcheck) return rv; + + rv = cjson_util_lookup_int(data, &t, "mcelsius"); + if(rv < 0 && errorcheck) return rv; + info->mcelsius = t; + + return 0; +} + +#endif + +static int +onlp_thermal_info_get_locked__(onlp_oid_t oid, onlp_thermal_info_t* info) +{ + int rv; + VALIDATE(oid); + + rv = onlp_thermali_info_get(oid, info); + if(rv >= 0) { + +#if ONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES == 1 + int id = ONLP_OID_ID_GET(oid); + cJSON* entry = NULL; + + cjson_util_lookup(onlp_json_get(0), &entry, "overrides.thermal.%d", id); + onlp_thermali_info_from_json__(entry, info, 0); +#endif + + } + return rv; +} +ONLP_LOCKED_API2(onlp_thermal_info_get, onlp_oid_t, oid, onlp_thermal_info_t*, info); + +int +onlp_thermal_ioctl(int code, ...) +{ + int rv; + va_list vargs; + va_start(vargs, code); + rv = onlp_thermal_vioctl(code, vargs); + va_end(vargs); + return rv; +} + +static int +onlp_thermal_vioctl_locked__(int code, va_list vargs) +{ + return onlp_thermali_ioctl(code, vargs); +} +ONLP_LOCKED_API2(onlp_thermal_vioctl, int, code, va_list, vargs); + + +/************************************************************ + * + * Debug and Show Functions + * + ***********************************************************/ +void +onlp_thermal_dump(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_thermal_info_t info; + + VALIDATENR(id); + onlp_oid_dump_iof_init_default(&iof, pvs); + + iof_push(&iof, "thermal @ %d", ONLP_OID_ID_GET(id)); + rv = onlp_thermal_info_get(id, &info); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &info.hdr); + if(info.status & 1) { + /* Present */ + iof_iprintf(&iof, "Status: %{onlp_thermal_status_flags}", info.status); + iof_iprintf(&iof, "Caps: %{onlp_thermal_caps_flags}", info.caps); + iof_iprintf(&iof, "Temperature: %d", info.mcelsius); + iof_push(&iof, "thresholds"); + { + iof_iprintf(&iof, "Warning: %d", info.thresholds.warning); + iof_iprintf(&iof, "Error: %d", info.thresholds.error); + iof_iprintf(&iof, "Shutdown: %d", info.thresholds.shutdown); + iof_pop(&iof); + } + } + else { + iof_iprintf(&iof, "Not present."); + } + } + iof_pop(&iof); +} + +void +onlp_thermal_show(onlp_oid_t id, aim_pvs_t* pvs, uint32_t flags) +{ + int rv; + iof_t iof; + onlp_thermal_info_t ti; + VALIDATENR(id); + + onlp_oid_show_iof_init_default(&iof, pvs, flags); + + + rv = onlp_thermal_info_get(id, &ti); + iof_push(&iof, "Thermal %d", ONLP_OID_ID_GET(id)); + if(rv < 0) { + onlp_oid_info_get_error(&iof, rv); + } + else { + onlp_oid_show_description(&iof, &ti.hdr); + if(ti.status & 0x1) { + /* Present */ + if(ti.status & ONLP_THERMAL_STATUS_FAILED) { + iof_iprintf(&iof, "Status: Sensor FAILED"); + } + else { + iof_iprintf(&iof, "Status: Sensor Functional"); + if(ti.caps & ONLP_THERMAL_CAPS_GET_TEMPERATURE) { + iof_iprintf(&iof, "Temperature: %d.%d C.", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.mcelsius)); + } + if(ti.caps & ONLP_THERMAL_CAPS_GET_ANY_THRESHOLD) { + iof_push(&iof, "Thresholds"); + if(ti.caps & ONLP_THERMAL_CAPS_GET_WARNING_THRESHOLD) { + iof_iprintf(&iof, "Warning : %d.%d C.", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.warning)); + } + if(ti.caps & ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD) { + iof_iprintf(&iof, "Error : %d.%d C.", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.error)); + } + if(ti.caps & ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD) { + iof_iprintf(&iof, "Shutdown: %d.%d C.", + ONLP_MILLI_NORMAL_INTEGER_TENTHS(ti.thresholds.shutdown)); + } + iof_pop(&iof); + } + } + } + else { + /* Not present */ + iof_iprintf(&iof, "State: Missing."); + } + } + iof_pop(&iof); +} diff --git a/packages/base/any/onlp/src/onlp/onlp.doxy b/packages/base/any/onlp/src/onlp/onlp.doxy new file mode 100644 index 00000000..43efcd5c --- /dev/null +++ b/packages/base/any/onlp/src/onlp/onlp.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "onlp" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "ONLP Management Libraries." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/onlp/onlp.mk b/packages/base/any/onlp/src/onlp/onlp.mk new file mode 100644 index 00000000..44dfc4e5 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/onlp.mk @@ -0,0 +1,14 @@ + +############################################################################### +# +# Inclusive Makefile for the onlp module. +# +# Autogenerated 2015-11-02 19:25:27.026645 +# +############################################################################### +onlp_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(onlp_BASEDIR)/module/make.mk +include $(onlp_BASEDIR)/module/auto/make.mk +include $(onlp_BASEDIR)/module/src/make.mk +include $(onlp_BASEDIR)/utest/_make.mk + diff --git a/packages/base/any/onlp/src/onlp/utest/_make.mk b/packages/base/any/onlp/src/onlp/utest/_make.mk new file mode 100644 index 00000000..a1f45f28 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/utest/_make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +UMODULE := onlp +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/onlp/src/onlp/utest/main.c b/packages/base/any/onlp/src/onlp/utest/main.c new file mode 100644 index 00000000..e7e9e030 --- /dev/null +++ b/packages/base/any/onlp/src/onlp/utest/main.c @@ -0,0 +1,131 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/** + * Base functionality unit tests. + */ +#define __TRY(_prefix, _expr, _suffix) \ + do { \ + int _rv; \ + fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \ + fflush(stderr); \ + _rv = _expr ; \ + fprintf(stderr, "%s%s...%d\n", _prefix, #_expr, _rv); \ + fflush(stderr); \ + if(_rv < 0) { \ + AIM_DIE("%s%s: failed: %d", #_expr, _rv); \ + } \ + } while(0) + +#define __TRYNR(_prefix, _expr, _suffix) \ + do { \ + fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \ + fflush(stderr); \ + _expr ; \ + fprintf(stderr, "%s%s...Done\n", _prefix, #_expr); \ + fflush(stderr); \ + } while(0) + +#define TRY(_expr) __TRY(" ", _expr, "\r") +#define TRYNR(_expr) ___TRYNR(" ", _expr, "\r") +#define TEST(_expr) __TRYNR("", _expr, "\n"); + +/** + * Test Shared Locks + */ +void +shlock_test(void) +{ + onlp_shlock_t* lock = NULL; + + TRY(onlp_shlock_create(0xEEEF, &lock, "utest-lock:%d", 1)); + TRY(onlp_shlock_take(lock)); + TRY(onlp_shlock_give(lock)); + TRY(onlp_shlock_take(lock)); + TRY(onlp_shlock_give(lock)); + TRY(onlp_shlock_global_take()); + TRY(onlp_shlock_global_give()); + TRY(onlp_shlock_global_take()); + TRY(onlp_shlock_global_give()); + if(strcmp("utest-lock:1", onlp_shlock_name(lock))) { + AIM_DIE("lock name does not match (%s)", onlp_shlock_name(lock)); + } +} + +/** + * Test ONIE parsing + */ +void +onie_test(void) +{ + /* TODO */ +} + +int +iter__(onlp_oid_t oid, void* cookie) +{ + onlp_oid_hdr_t hdr; + onlp_oid_hdr_get(oid, &hdr); + printf("OID: 0x%x, D='%s'\n", oid, hdr.description); + return 0; +} + +#include +#include +#include +#include + +int +aim_main(int argc, char* argv[]) +{ + // TEST(shlock_test()); + + /* Example Platform Dump */ + onlp_init(); + onlp_platform_dump(&aim_pvs_stdout, ONLP_OID_DUMP_F_RECURSE); + onlp_oid_iterate(0, 0, iter__, NULL); + onlp_platform_show(&aim_pvs_stdout, ONLP_OID_SHOW_F_RECURSE|ONLP_OID_SHOW_F_EXTENDED); + + if(argv[1] && !strcmp("manage", argv[1])) { + onlp_sys_platform_manage_start(); + printf("Sleeping...\n"); + sleep(10); + printf("Stopping...\n"); + onlp_sys_platform_manage_stop(); + printf("Stopped.\n"); + } + return 0; +} diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/Makefile b/packages/base/any/onlp/src/onlp_platform_defaults/Makefile new file mode 100644 index 00000000..317c1c73 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/Makefile @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +include ../../init.mk +MODULE := onlp_platform_defaults +AUTOMODULE := onlp_platform_defaults +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/README b/packages/base/any/onlp/src/onlp_platform_defaults/README new file mode 100644 index 00000000..b3131171 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/README @@ -0,0 +1,6 @@ +############################################################################### +# +# onlp_platform_defaults README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/make.mk b/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/make.mk new file mode 100644 index 00000000..45d67f9c --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlp_platform_defaults Autogeneration +# +############################################################ + +onlp_platform_defaults_AUTO_DEFS := module/auto/onlp_platform_defaults.yml +onlp_platform_defaults_AUTO_DIRS := module/inc/onlp_platform_defaults module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/onlp_platform_defaults.yml b/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/onlp_platform_defaults.yml new file mode 100644 index 00000000..5474b25b --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/auto/onlp_platform_defaults.yml @@ -0,0 +1,76 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlp_platform_defaults Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB +- ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM: + doc: "Build as the onlp-platform library stub." + default: 0 + +log_types: &log_types +- called + +definitions: + cdefs: + ONLP_PLATFORM_DEFAULTS_CONFIG_HEADER: + defs: *cdefs + basename: onlp_platform_defaults_config + + aim_custom_log_macro: + onlp_platform_defaults: + flags: *log_types + prefix: ONLP_PLATFORM_DEFAULTS_LOG_FLAG_ + + enum: &enum + onlp_platform_defaults_log_flag: + members: *log_types + + portingmacro: + ONLP_PLATFORM_DEFAULTS: + macros: + - memset + - memcpy + - strncpy + - strlen diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults.x b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults.x new file mode 100644 index 00000000..8691049b --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults.x @@ -0,0 +1,39 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_config.h b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_config.h new file mode 100644 index 00000000..f90b417a --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_config.h @@ -0,0 +1,163 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + + +/**************************************************************************//** + * + * @file + * @brief onlp_platform_defaults Configuration Header + * + * @addtogroup onlp_platform_defaults-config + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_PLATFORM_DEFAULTS_CONFIG_H__ +#define __ONLP_PLATFORM_DEFAULTS_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING +#define ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT +#define ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT +#define ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB +#define ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI +#define ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM + * + * Build as the onlp-platform library stub. */ + + +#ifndef ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM +#define ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct onlp_platform_defaults_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} onlp_platform_defaults_config_settings_t; + +/** Configuration settings table. */ +/** onlp_platform_defaults_config_settings table. */ +extern onlp_platform_defaults_config_settings_t onlp_platform_defaults_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* onlp_platform_defaults_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int onlp_platform_defaults_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "onlp_platform_defaults_porting.h" + +#endif /* __ONLP_PLATFORM_DEFAULTS_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_dox.h b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_dox.h new file mode 100644 index 00000000..1759a517 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_dox.h @@ -0,0 +1,51 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * onlp_platform_defaults Doxygen Header + * + *****************************************************************************/ +#ifndef __ONLP_PLATFORM_DEFAULTS_DOX_H__ +#define __ONLP_PLATFORM_DEFAULTS_DOX_H__ + +/** + * @defgroup onlp_platform_defaults onlp_platform_defaults - onlp_platform_defaults Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup onlp_platform_defaults-onlp_platform_defaults Public Interface + * @defgroup onlp_platform_defaults-config Compile Time Configuration + * @defgroup onlp_platform_defaults-porting Porting Macros + * + * @} + * + */ + +#endif /* __ONLP_PLATFORM_DEFAULTS_DOX_H__ */ diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_porting.h b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_porting.h new file mode 100644 index 00000000..68c11143 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_porting.h @@ -0,0 +1,92 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * @file + * @brief onlp_platform_defaults Porting Macros. + * + * @addtogroup onlp_platform_defaults-porting + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_PLATFORM_DEFAULTS_PORTING_H__ +#define __ONLP_PLATFORM_DEFAULTS_PORTING_H__ + + +/* */ +#if ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ONLP_PLATFORM_DEFAULTS_MEMSET + #if defined(GLOBAL_MEMSET) + #define ONLP_PLATFORM_DEFAULTS_MEMSET GLOBAL_MEMSET + #elif ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB == 1 + #define ONLP_PLATFORM_DEFAULTS_MEMSET memset + #else + #error The macro ONLP_PLATFORM_DEFAULTS_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_PLATFORM_DEFAULTS_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ONLP_PLATFORM_DEFAULTS_MEMCPY GLOBAL_MEMCPY + #elif ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB == 1 + #define ONLP_PLATFORM_DEFAULTS_MEMCPY memcpy + #else + #error The macro ONLP_PLATFORM_DEFAULTS_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_PLATFORM_DEFAULTS_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define ONLP_PLATFORM_DEFAULTS_STRNCPY GLOBAL_STRNCPY + #elif ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB == 1 + #define ONLP_PLATFORM_DEFAULTS_STRNCPY strncpy + #else + #error The macro ONLP_PLATFORM_DEFAULTS_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_PLATFORM_DEFAULTS_STRLEN + #if defined(GLOBAL_STRLEN) + #define ONLP_PLATFORM_DEFAULTS_STRLEN GLOBAL_STRLEN + #elif ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB == 1 + #define ONLP_PLATFORM_DEFAULTS_STRLEN strlen + #else + #error The macro ONLP_PLATFORM_DEFAULTS_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ONLP_PLATFORM_DEFAULTS_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/make.mk b/packages/base/any/onlp/src/onlp_platform_defaults/module/make.mk new file mode 100644 index 00000000..d26765d7 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/make.mk @@ -0,0 +1,30 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +onlp_platform_defaults_INCLUDES := -I $(THIS_DIR)inc +onlp_platform_defaults_INTERNAL_INCLUDES := -I $(THIS_DIR)src +onlp_platform_defaults_DEPENDMODULE_ENTRIES := init:onlp_platform_defaults ucli:onlp_platform_defaults + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/fani.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/fani.c new file mode 100644 index 00000000..3ef9e111 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/fani.c @@ -0,0 +1,40 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +/** + * These are the default implementations for all currently + * defined interface functions. + */ +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_rpm_set(onlp_oid_t id, int rpm)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_percentage_set(onlp_oid_t id, int p)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_ioctl(onlp_oid_t id, va_list vargs)); + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/ledi.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/ledi.c new file mode 100644 index 00000000..89644ecf --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/ledi.c @@ -0,0 +1,32 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* rv)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_set(onlp_oid_t id, int on_or_off)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)); diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/make.mk b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/make.mk new file mode 100644 index 00000000..cdd92e3b --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +LIBRARY := onlp_platform_defaults +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_config.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_config.c new file mode 100644 index 00000000..1374b1bc --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_config.c @@ -0,0 +1,101 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* */ +#define __onlp_platform_defaults_config_STRINGIFY_NAME(_x) #_x +#define __onlp_platform_defaults_config_STRINGIFY_VALUE(_x) __onlp_platform_defaults_config_STRINGIFY_NAME(_x) +onlp_platform_defaults_config_settings_t onlp_platform_defaults_config_settings[] = +{ +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM + { __onlp_platform_defaults_config_STRINGIFY_NAME(ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM), __onlp_platform_defaults_config_STRINGIFY_VALUE(ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM) }, +#else +{ ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM(__onlp_platform_defaults_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __onlp_platform_defaults_config_STRINGIFY_VALUE +#undef __onlp_platform_defaults_config_STRINGIFY_NAME + +const char* +onlp_platform_defaults_config_lookup(const char* setting) +{ + int i; + for(i = 0; onlp_platform_defaults_config_settings[i].name; i++) { + if(strcmp(onlp_platform_defaults_config_settings[i].name, setting)) { + return onlp_platform_defaults_config_settings[i].value; + } + } + return NULL; +} + +int +onlp_platform_defaults_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; onlp_platform_defaults_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", onlp_platform_defaults_config_settings[i].name, onlp_platform_defaults_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_enums.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_enums.c new file mode 100644 index 00000000..a5d11157 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_enums.c @@ -0,0 +1,82 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include +#include "onlp_platform_defaults_int.h" + +/* */ +aim_map_si_t onlp_platform_defaults_log_flag_map[] = +{ + { "called", ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED }, + { NULL, 0 } +}; + +aim_map_si_t onlp_platform_defaults_log_flag_desc_map[] = +{ + { "None", ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED }, + { NULL, 0 } +}; + +const char* +onlp_platform_defaults_log_flag_name(onlp_platform_defaults_log_flag_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_platform_defaults_log_flag_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_platform_defaults_log_flag'"; + } +} + +int +onlp_platform_defaults_log_flag_value(const char* str, onlp_platform_defaults_log_flag_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_platform_defaults_log_flag_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_platform_defaults_log_flag_desc(onlp_platform_defaults_log_flag_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_platform_defaults_log_flag_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_platform_defaults_log_flag'"; + } +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_int.h b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_int.h new file mode 100644 index 00000000..c41c8ed0 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_int.h @@ -0,0 +1,90 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * onlp_platform_defaults Internal Header + * + *****************************************************************************/ +#ifndef __ONLP_PLATFORM_DEFAULTS_INT_H__ +#define __ONLP_PLATFORM_DEFAULTS_INT_H__ + +#include + +/* */ +/** onlp_platform_defaults_log_flag */ +typedef enum onlp_platform_defaults_log_flag_e { + ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, + ONLP_PLATFORM_DEFAULTS_LOG_FLAG_LAST = ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, + ONLP_PLATFORM_DEFAULTS_LOG_FLAG_COUNT, + ONLP_PLATFORM_DEFAULTS_LOG_FLAG_INVALID = -1, +} onlp_platform_defaults_log_flag_t; + +/** Strings macro. */ +#define ONLP_PLATFORM_DEFAULTS_LOG_FLAG_STRINGS \ +{\ + "called", \ +} +/** Enum names. */ +const char* onlp_platform_defaults_log_flag_name(onlp_platform_defaults_log_flag_t e); + +/** Enum values. */ +int onlp_platform_defaults_log_flag_value(const char* str, onlp_platform_defaults_log_flag_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_platform_defaults_log_flag_desc(onlp_platform_defaults_log_flag_t e); + +/** validator */ +#define ONLP_PLATFORM_DEFAULTS_LOG_FLAG_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED)) + +/** onlp_platform_defaults_log_flag_map table. */ +extern aim_map_si_t onlp_platform_defaults_log_flag_map[]; +/** onlp_platform_defaults_log_flag_desc_map table. */ +extern aim_map_si_t onlp_platform_defaults_log_flag_desc_map[]; +/* */ + + +#define __ONLP_DEFAULTI __attribute__((weak)) + +#define ONLP_SYSI_PLATFORM_NAME_DEFAULT "onlp-sysi-platform-default" + + +#define __ONLP_DEFAULTI_IMPLEMENTATION(__f) \ + int __ONLP_DEFAULTI __f \ + { \ + ONLP_PLATFORM_DEFAULTS_LOG_CALLED("using default %s", __func__); \ + return ONLP_STATUS_E_UNSUPPORTED; \ + } + +#define __ONLP_DEFAULTI_VIMPLEMENTATION(__f) \ + void __ONLP_DEFAULTI __f \ + { \ + ONLP_PLATFORM_DEFAULTS_LOG_CALLED("using default %s", __func__); \ + } + + + +#endif /* __ONLP_PLATFORM_DEFAULTS_INT_H__ */ diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.c new file mode 100644 index 00000000..646e0bd1 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.c @@ -0,0 +1,39 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +/* + * onlp_platform_defaults log struct. + */ +AIM_LOG_STRUCT_DEFINE( + ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT, + ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT, + onlp_platform_defaults_log_flag_map, + ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.h b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.h new file mode 100644 index 00000000..b5226d73 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_log.h @@ -0,0 +1,84 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLP_PLATFORM_DEFAULTS_LOG_H__ +#define __ONLP_PLATFORM_DEFAULTS_LOG_H__ + +#define AIM_LOG_MODULE_NAME onlp_platform_defaults +#include +#include "onlp_platform_defaults_int.h" + +/* */ + +/****************************************************************************** + * + * Custom Module Log Macros + * + *****************************************************************************/ + +/** Log a module-level called */ +#define ONLP_PLATFORM_DEFAULTS_LOG_MOD_CALLED(...) \ + AIM_LOG_MOD_CUSTOM(ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, "CALLED", __VA_ARGS__) +/** Log a module-level called with ratelimiting */ +#define ONLP_PLATFORM_DEFAULTS_LOG_MOD_RL_CALLED(_rl, _time, ...) \ + AIM_LOG_MOD_RL_CUSTOM(ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, "CALLED", _rl, _time, __VA_ARGS__) + +/****************************************************************************** + * + * Custom Object Log Macros + * + *****************************************************************************/ + +/** Log an object-level called */ +#define ONLP_PLATFORM_DEFAULTS_LOG_OBJ_CALLED(_obj, ...) \ + AIM_LOG_OBJ_CUSTOM(_obj, ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, "CALLED", __VA_ARGS__) +/** Log an object-level called with ratelimiting */ +#define ONLP_PLATFORM_DEFAULTS_LOG_OBJ_RL_CALLED(_obj, _rl, _time, ...) \ + AIM_LOG_OBJ_RL_CUSTOM(_obj, ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED, "CALLED", _rl, _time, __VA_ARGS__) + +/****************************************************************************** + * + * Default Macro Mappings + * + *****************************************************************************/ +#ifdef AIM_LOG_OBJ_DEFAULT + +/** CALLED -> OBJ_CALLED */ +#define ONLP_PLATFORM_DEFAULTS_LOG_CALLED ONLP_PLATFORM_DEFAULTS_LOG_OBJ_CALLED +/** RL_CALLED -> OBJ_RL_CALLED */ +#define ONLP_PLATFORM_DEFAULTS_LOG_RL_CALLED ONLP_PLATFORM_DEFAULTS_LOG_RL_OBJ_CALLED + + +#else + +/** CALLED -> MOD_CALLED */ +#define ONLP_PLATFORM_DEFAULTS_LOG_CALLED ONLP_PLATFORM_DEFAULTS_LOG_MOD_CALLED +/** RL_CALLED -> MOD_RL_CALLED */ +#define ONLP_PLATFORM_DEFAULTS_LOG_RL_CALLED ONLP_PLATFORM_DEFAULTS_LOG_MOD_RL_CALLED + +#endif +/* */ + +#endif /* __ONLP_PLATFORM_DEFAULTS_LOG_H__ */ diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_module.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_module.c new file mode 100644 index 00000000..7934bb3e --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/onlp_platform_defaults_module.c @@ -0,0 +1,51 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlp_platform_defaults_log.h" + +static int +datatypes_init__(void) +{ +#define ONLP_PLATFORM_DEFAULTS_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __onlp_platform_defaults_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +#if ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM == 0 +int __onlp_platform_version_default__ = 0; +#else +int __onlp_platform_version__ = 0; +#endif + + + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/psui.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/psui.c new file mode 100644 index 00000000..ce534c88 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/psui.c @@ -0,0 +1,31 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Power Supply Management Implementation. + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* rv)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)); diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sfpi.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sfpi.c new file mode 100644 index 00000000..30628819 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sfpi.c @@ -0,0 +1,42 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_is_present(int port)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_eeprom_read(int port, uint8_t data[256])); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dom_read(int port, uint8_t data[256])); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_post_insert(int port, sff_info_t* sff_info)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_port_map(int port, int* rport)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_denit(void)); +__ONLP_DEFAULTI_VIMPLEMENTATION(onlp_sfpi_debug(int port, aim_pvs_t* pvs)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_ioctl(int port, va_list vargs)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* rv)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)); diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sysi.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sysi.c new file mode 100644 index 00000000..95efb76c --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/sysi.c @@ -0,0 +1,63 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +const char* __ONLP_DEFAULTI +onlp_sysi_platform_get(void) +{ + /* + * This function should never be called. + * + * If we get here its because the platform libraries are + * not written, initialized, or setup properly before we execute. + */ + AIM_LOG_ERROR("The default implementation of onlp_sysi_platform_get() has been called."); + AIM_LOG_ERROR("This can happen for the following reasons, all fatal:"); + AIM_LOG_ERROR("* The ONLP build configuration is incorrect."); + AIM_LOG_ERROR("* The ONLP platform library for this platform does not contain the onlp_sysi_platform_get() symbol."); + AIM_LOG_ERROR("* The ONLP platform shared libraries are not setup properly before we executed."); + +#if ONLP_CONFIG_INCLUDE_PLATFORM_ERROR_CHECK == 1 + AIM_LOG_ERROR("* The platform cannot continue until this issue is resolved."); + abort(); +#endif + + return ONLP_SYSI_PLATFORM_NAME_DEFAULT; +} + +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_platform_set(const char* p)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_onie_data_phys_addr_get(void** physaddr)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_onie_data_get(uint8_t** data, int* size)); +__ONLP_DEFAULTI_VIMPLEMENTATION(onlp_sysi_onie_data_free(uint8_t* data)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_onie_info_get(onlp_onie_info_t* onie)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_oids_get(onlp_oid_t* table, int max)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_platform_info_get(onlp_platform_info_t* pi)); +__ONLP_DEFAULTI_VIMPLEMENTATION(onlp_sysi_platform_info_free(onlp_platform_info_t* pi)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_ioctl(int id, va_list vargs)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_platform_manage_fans(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_sysi_platform_manage_leds(void)); + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/module/src/thermali.c b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/thermali.c new file mode 100644 index 00000000..3593961c --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/module/src/thermali.c @@ -0,0 +1,31 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include "onlp_platform_defaults_int.h" +#include "onlp_platform_defaults_log.h" + +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_init(void)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv)); +__ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_ioctl(int code, va_list vargs)); diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.doxy b/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.doxy new file mode 100644 index 00000000..8472ae94 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "onlp_platform_defaults" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "ONLP Platform Default Implementations." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.mk b/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.mk new file mode 100644 index 00000000..6838b3a6 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/onlp_platform_defaults.mk @@ -0,0 +1,14 @@ + +############################################################################### +# +# Inclusive Makefile for the onlp_platform_defaults module. +# +# Autogenerated 2014-04-01 11:58:22.673523 +# +############################################################################### +onlp_platform_defaults_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(onlp_platform_defaults_BASEDIR)/module/make.mk +include $(onlp_platform_defaults_BASEDIR)/module/auto/make.mk +include $(onlp_platform_defaults_BASEDIR)/module/src/make.mk +include $(onlp_platform_defaults_BASEDIR)/utest/_make.mk + diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/utest/_make.mk b/packages/base/any/onlp/src/onlp_platform_defaults/utest/_make.mk new file mode 100644 index 00000000..9229525a --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/utest/_make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlp_platform_defaults Unit Test Makefile. +# +############################################################ + +UMODULE := onlp_platform_defaults +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/onlp/src/onlp_platform_defaults/utest/main.c b/packages/base/any/onlp/src/onlp_platform_defaults/utest/main.c new file mode 100644 index 00000000..5be1aa75 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_platform_defaults/utest/main.c @@ -0,0 +1,39 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include +#include +#include +#include + +int aim_main(int argc, char* argv[]) +{ + printf("onlp_platform_defaults Utest Is Empty\n"); + onlp_platform_defaults_config_show(&aim_pvs_stdout); + return 0; +} + diff --git a/packages/base/any/onlp/src/onlp_snmp/.gitignore b/packages/base/any/onlp/src/onlp_snmp/.gitignore new file mode 100644 index 00000000..131a4620 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/.gitignore @@ -0,0 +1 @@ +/onlp_snmp.mk diff --git a/packages/base/any/onlp/src/onlp_snmp/Makefile b/packages/base/any/onlp/src/onlp_snmp/Makefile new file mode 100644 index 00000000..c23d364a --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +include ../../init.mk +MODULE := onlp_snmp +AUTOMODULE := onlp_snmp +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/onlp_snmp/README b/packages/base/any/onlp/src/onlp_snmp/README new file mode 100644 index 00000000..82353733 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/README @@ -0,0 +1,6 @@ +############################################################################### +# +# onlp_snmp README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/auto/make.mk b/packages/base/any/onlp/src/onlp_snmp/module/auto/make.mk new file mode 100644 index 00000000..3854efa8 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# onlp_snmp Autogeneration +# +############################################################################### +onlp_snmp_AUTO_DEFS := module/auto/onlp_snmp.yml +onlp_snmp_AUTO_DIRS := module/inc/onlp_snmp module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/auto/onlp_snmp.yml b/packages/base/any/onlp/src/onlp_snmp/module/auto/onlp_snmp.yml new file mode 100644 index 00000000..7e71c183 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/auto/onlp_snmp.yml @@ -0,0 +1,116 @@ +############################################################################### +# +# onlp_snmp Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- ONLP_SNMP_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- ONLP_SNMP_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: ONLP_SNMP_CONFIG_PORTING_STDLIB +- ONLP_SNMP_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- ONLP_SNMP_CONFIG_MAX_NAME_LENGTH: + doc: "Maximum object name length." + default: 32 +- ONLP_SNMP_CONFIG_MAX_DESC_LENGTH: + doc: "Maximum object description length." + default: ONLP_OID_DESC_SIZE +- ONLP_SNMP_CONFIG_UPDATE_PERIOD: + doc: "Default update period in seconds." + default: 5 +- ONLP_SNMP_CONFIG_DEV_BASE_INDEX: + doc: "Base index." + default: 1 +- ONLP_SNMP_CONFIG_DEV_MAX_INDEX: + doc: "Maximum index." + default: 100 +- ONLP_SNMP_CONFIG_INCLUDE_THERMALS: + doc: "Include Thermals." + default: 1 +- ONLP_SNMP_CONFIG_INCLUDE_FANS: + doc: "Include Fans." + default: 1 +- ONLP_SNMP_CONFIG_INCLUDE_PSUS: + doc: "Include PSUS." + default: 1 +- ONLP_SNMP_CONFIG_INCLUDE_LEDS: + doc: "Include LEDs." + default: 1 +- ONLP_SNMP_CONFIG_INCLUDE_PLATFORM: + doc: "Include ONLP Platform MIB" + default: 1 +- ONLP_SNMP_CONFIG_AS_SUBAGENT: + doc: "Configure as an snmp_subagent client." + default: 0 + +definitions: + cdefs: + ONLP_SNMP_CONFIG_HEADER: + defs: *cdefs + basename: onlp_snmp_config + + portingmacro: + ONLP_SNMP: + macros: + - memset + - memcpy + - strncpy + + enum: + + ############################################################ + # + # The following must match the ONLP-SENSOR-MIB values. + # + ############################################################ + onlp_snmp_sensor_type: + tag: mib + members: + - temp : 1 + - fan : 2 + - psu : 3 + - led : 4 + - misc : 5 + - max : 5 + + onlp_snmp_sensor_status: + tag: mib + members: + - missing : 0 + - good : 1 + - failed : 2 + - unplugged : 3 + + onlp_snmp_fan_flow_type: + tag: mib + members: + - unknown : 0 + - b2f : 1 + - f2b : 2 + + onlp_snmp_psu_type: + tag: mib + members: + - unknown : 0 + - ac : 1 + - dc12 : 2 + - dc48 : 3 + + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.h new file mode 100644 index 00000000..f5b43ae5 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.h @@ -0,0 +1,30 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_SNMP_H__ +#define __ONLP_SNMP_H__ + +#include + +#endif /* __ONLP_SNMP_H__ */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.x b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.x new file mode 100644 index 00000000..4968d675 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_config.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_config.h new file mode 100644 index 00000000..fd02fe8a --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_config.h @@ -0,0 +1,229 @@ +/**************************************************************************//** + * + * @file + * @brief onlp_snmp Configuration Header + * + * @addtogroup onlp_snmp-config + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_SNMP_CONFIG_H__ +#define __ONLP_SNMP_CONFIG_H__ + +#include + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef ONLP_SNMP_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * ONLP_SNMP_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_LOGGING +#define ONLP_SNMP_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT +#define ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT +#define ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * ONLP_SNMP_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef ONLP_SNMP_CONFIG_PORTING_STDLIB +#define ONLP_SNMP_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLP_SNMP_CONFIG_PORTING_STDLIB +#endif + +/** + * ONLP_SNMP_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_UCLI +#define ONLP_SNMP_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * ONLP_SNMP_CONFIG_MAX_NAME_LENGTH + * + * Maximum object name length. */ + + +#ifndef ONLP_SNMP_CONFIG_MAX_NAME_LENGTH +#define ONLP_SNMP_CONFIG_MAX_NAME_LENGTH 32 +#endif + +/** + * ONLP_SNMP_CONFIG_MAX_DESC_LENGTH + * + * Maximum object description length. */ + + +#ifndef ONLP_SNMP_CONFIG_MAX_DESC_LENGTH +#define ONLP_SNMP_CONFIG_MAX_DESC_LENGTH ONLP_OID_DESC_SIZE +#endif + +/** + * ONLP_SNMP_CONFIG_UPDATE_PERIOD + * + * Default update period in seconds. */ + + +#ifndef ONLP_SNMP_CONFIG_UPDATE_PERIOD +#define ONLP_SNMP_CONFIG_UPDATE_PERIOD 5 +#endif + +/** + * ONLP_SNMP_CONFIG_DEV_BASE_INDEX + * + * Base index. */ + + +#ifndef ONLP_SNMP_CONFIG_DEV_BASE_INDEX +#define ONLP_SNMP_CONFIG_DEV_BASE_INDEX 1 +#endif + +/** + * ONLP_SNMP_CONFIG_DEV_MAX_INDEX + * + * Maximum index. */ + + +#ifndef ONLP_SNMP_CONFIG_DEV_MAX_INDEX +#define ONLP_SNMP_CONFIG_DEV_MAX_INDEX 100 +#endif + +/** + * ONLP_SNMP_CONFIG_INCLUDE_THERMALS + * + * Include Thermals. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_THERMALS +#define ONLP_SNMP_CONFIG_INCLUDE_THERMALS 1 +#endif + +/** + * ONLP_SNMP_CONFIG_INCLUDE_FANS + * + * Include Fans. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_FANS +#define ONLP_SNMP_CONFIG_INCLUDE_FANS 1 +#endif + +/** + * ONLP_SNMP_CONFIG_INCLUDE_PSUS + * + * Include PSUS. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_PSUS +#define ONLP_SNMP_CONFIG_INCLUDE_PSUS 1 +#endif + +/** + * ONLP_SNMP_CONFIG_INCLUDE_LEDS + * + * Include LEDs. */ + + +#ifndef ONLP_SNMP_CONFIG_INCLUDE_LEDS +#define ONLP_SNMP_CONFIG_INCLUDE_LEDS 1 +#endif + +/** + * ONLP_SNMP_CONFIG_AS_SUBAGENT + * + * Configure as an snmp_subagent client. */ + + +#ifndef ONLP_SNMP_CONFIG_AS_SUBAGENT +#define ONLP_SNMP_CONFIG_AS_SUBAGENT 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct onlp_snmp_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} onlp_snmp_config_settings_t; + +/** Configuration settings table. */ +/** onlp_snmp_config_settings table. */ +extern onlp_snmp_config_settings_t onlp_snmp_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* onlp_snmp_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int onlp_snmp_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "onlp_snmp_porting.h" + +#endif /* __ONLP_SNMP_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_dox.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_dox.h new file mode 100644 index 00000000..073e8b26 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * onlp_snmp Doxygen Header + * + *****************************************************************************/ +#ifndef __ONLP_SNMP_DOX_H__ +#define __ONLP_SNMP_DOX_H__ + +/** + * @defgroup onlp_snmp onlp_snmp - onlp_snmp Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup onlp_snmp-onlp_snmp Public Interface + * @defgroup onlp_snmp-config Compile Time Configuration + * @defgroup onlp_snmp-porting Porting Macros + * + * @} + * + */ + +#endif /* __ONLP_SNMP_DOX_H__ */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_platform_oids.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_platform_oids.h new file mode 100644 index 00000000..a8a1c5b9 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_platform_oids.h @@ -0,0 +1,54 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_SNMP_PLATFORM_OIDS_H__ +#define __ONLP_SNMP_PLATFORM_OIDS_H__ + +/** + * See: + * ONLP-PLATFORM-MIBS.txt + */ + +/** + * These are all currently defined as part of the Big Switch enterprise tree. + * + * In the future we should apply for an ONL Private Enterprise Number and + * redefine these appropriately. + */ + +#define ONLP_SNMP_PLATFORM_INFORMATION_OID 1,3,6,1,4,1,37538,2,1000 +#define ONLP_SNMP_PLATFORM_GENERAL_OID ONLP_SNMP_PLATFORM_INFORMATION_OID,1 +#define ONLP_SNMP_PLATFORM_SYSTEM_OID ONLP_SNMP_PLATFORM_GENERAL_OID,1 + + +/** + * TODO + */ + + +#endif /* __ONLP_SNMP_PLATFORM_OIDS_H__ */ + + + + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_porting.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_porting.h new file mode 100644 index 00000000..6bf16fb0 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_porting.h @@ -0,0 +1,57 @@ +/**************************************************************************//** + * + * @file + * @brief onlp_snmp Porting Macros. + * + * @addtogroup onlp_snmp-porting + * @{ + * + *****************************************************************************/ +#ifndef __ONLP_SNMP_PORTING_H__ +#define __ONLP_SNMP_PORTING_H__ + + +/* */ +#if ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ONLP_SNMP_MEMSET + #if defined(GLOBAL_MEMSET) + #define ONLP_SNMP_MEMSET GLOBAL_MEMSET + #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_SNMP_MEMSET memset + #else + #error The macro ONLP_SNMP_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_SNMP_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ONLP_SNMP_MEMCPY GLOBAL_MEMCPY + #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_SNMP_MEMCPY memcpy + #else + #error The macro ONLP_SNMP_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLP_SNMP_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define ONLP_SNMP_STRNCPY GLOBAL_STRNCPY + #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1 + #define ONLP_SNMP_STRNCPY strncpy + #else + #error The macro ONLP_SNMP_STRNCPY is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ONLP_SNMP_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensor_oids.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensor_oids.h new file mode 100644 index 00000000..e4a24888 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensor_oids.h @@ -0,0 +1,212 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_SNMP_SENSOR_OIDS_H__ +#define __ONLP_SNMP_SENSOR_OIDS_H__ + +/** + * See: + * ONLP-SENSOR-MIBS.txt + */ + +/** + * These are all currently defined as part of the Big Switch enterprise tree. + * + * In the future we should apply for an ONL Private Enterprise Number and + * redefine these appropriately. + */ + +#define ONLP_SNMP_SENSOR_OID 1,3,6,1,4,1,37538,2,3 + +#define ONLP_SNMP_SENSOR_ENTRY 1 + +/* Generic value */ +#define ONLP_SNMP_SENSOR_COLUMN_INDEX 1 +#define ONLP_SNMP_SENSOR_COLUMN_DEVNAME 2 + +/* This index counted from length of oid from right to left */ +#define OID_SENSOR_TYPE_INDEX 4 +#define OID_SENSOR_DEV_INDEX 1 +#define OID_SENSOR_COL_INDEX 2 + +#define ONLP_SNMP_SENSOR_DEV_BASE_INDEX 1 +#define ONLP_SNMP_SENSOR_DEV_MAX_INDEX 100 + + +#define ONLP_SNMP_SENSOR_OID_SUFFIX ONLP_SNMP_SENSOR_ENTRY, \ + ONLP_SNMP_SENSOR_COLUMN_INDEX, \ + ONLP_SNMP_SENSOR_DEV_BASE_INDEX + + + +#define ONLP_SNMP_SENSOR_OID_CREATE(_type) \ + ONLP_SNMP_SENSOR_OID,ONLP_SNMP_SENSOR_TYPE_##_type,ONLP_SNMP_SENSOR_OID_SUFFIX + +#define ONLP_SNMP_SENSOR_TEMP_OID ONLP_SNMP_SENSOR_OID_CREATE(TEMP) +#define ONLP_SNMP_SENSOR_FAN_OID ONLP_SNMP_SENSOR_OID_CREATE(FAN) +#define ONLP_SNMP_SENSOR_PSU_OID ONLP_SNMP_SENSOR_OID_CREATE(PSU) +#define ONLP_SNMP_SENSOR_LED_OID ONLP_SNMP_SENSOR_OID_CREATE(LED) +#define ONLP_SNMP_SENSOR_MISC_OID ONLP_SNMP_SENSOR_OID_CREATE(MISC) + +/* + * For legality check only, the sensor oid length from + * ONLP-SENSOR-MIB file + */ +#define ONLP_SNMP_SENSOR_OID_LENGTH 13 + + + + +/* */ +/** onlp_snmp_fan_flow_type */ +typedef enum onlp_snmp_fan_flow_type_e { + ONLP_SNMP_FAN_FLOW_TYPE_UNKNOWN = 0, + ONLP_SNMP_FAN_FLOW_TYPE_B2F = 1, + ONLP_SNMP_FAN_FLOW_TYPE_F2B = 2, +} onlp_snmp_fan_flow_type_t; + +/** onlp_snmp_sensor_status */ +typedef enum onlp_snmp_sensor_status_e { + ONLP_SNMP_SENSOR_STATUS_MISSING = 0, + ONLP_SNMP_SENSOR_STATUS_GOOD = 1, + ONLP_SNMP_SENSOR_STATUS_FAILED = 2, + ONLP_SNMP_SENSOR_STATUS_UNPLUGGED = 3, +} onlp_snmp_sensor_status_t; + +/** onlp_snmp_psu_type */ +typedef enum onlp_snmp_psu_type_e { + ONLP_SNMP_PSU_TYPE_UNKNOWN = 0, + ONLP_SNMP_PSU_TYPE_AC = 1, + ONLP_SNMP_PSU_TYPE_DC12 = 2, + ONLP_SNMP_PSU_TYPE_DC48 = 3, +} onlp_snmp_psu_type_t; + +/** onlp_snmp_sensor_type */ +typedef enum onlp_snmp_sensor_type_e { + ONLP_SNMP_SENSOR_TYPE_TEMP = 1, + ONLP_SNMP_SENSOR_TYPE_FAN = 2, + ONLP_SNMP_SENSOR_TYPE_PSU = 3, + ONLP_SNMP_SENSOR_TYPE_LED = 4, + ONLP_SNMP_SENSOR_TYPE_MISC = 5, + ONLP_SNMP_SENSOR_TYPE_MAX = 5, +} onlp_snmp_sensor_type_t; +/* */ + + + + + + + + + +/* */ +/** Enum names. */ +const char* onlp_snmp_fan_flow_type_name(onlp_snmp_fan_flow_type_t e); + +/** Enum values. */ +int onlp_snmp_fan_flow_type_value(const char* str, onlp_snmp_fan_flow_type_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_snmp_fan_flow_type_desc(onlp_snmp_fan_flow_type_t e); + +/** Enum validator. */ +int onlp_snmp_fan_flow_type_valid(onlp_snmp_fan_flow_type_t e); + +/** validator */ +#define ONLP_SNMP_FAN_FLOW_TYPE_VALID(_e) \ + (onlp_snmp_fan_flow_type_valid((_e))) + +/** onlp_snmp_fan_flow_type_map table. */ +extern aim_map_si_t onlp_snmp_fan_flow_type_map[]; +/** onlp_snmp_fan_flow_type_desc_map table. */ +extern aim_map_si_t onlp_snmp_fan_flow_type_desc_map[]; + +/** Enum names. */ +const char* onlp_snmp_sensor_status_name(onlp_snmp_sensor_status_t e); + +/** Enum values. */ +int onlp_snmp_sensor_status_value(const char* str, onlp_snmp_sensor_status_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_snmp_sensor_status_desc(onlp_snmp_sensor_status_t e); + +/** Enum validator. */ +int onlp_snmp_sensor_status_valid(onlp_snmp_sensor_status_t e); + +/** validator */ +#define ONLP_SNMP_SENSOR_STATUS_VALID(_e) \ + (onlp_snmp_sensor_status_valid((_e))) + +/** onlp_snmp_sensor_status_map table. */ +extern aim_map_si_t onlp_snmp_sensor_status_map[]; +/** onlp_snmp_sensor_status_desc_map table. */ +extern aim_map_si_t onlp_snmp_sensor_status_desc_map[]; + +/** Enum names. */ +const char* onlp_snmp_psu_type_name(onlp_snmp_psu_type_t e); + +/** Enum values. */ +int onlp_snmp_psu_type_value(const char* str, onlp_snmp_psu_type_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_snmp_psu_type_desc(onlp_snmp_psu_type_t e); + +/** Enum validator. */ +int onlp_snmp_psu_type_valid(onlp_snmp_psu_type_t e); + +/** validator */ +#define ONLP_SNMP_PSU_TYPE_VALID(_e) \ + (onlp_snmp_psu_type_valid((_e))) + +/** onlp_snmp_psu_type_map table. */ +extern aim_map_si_t onlp_snmp_psu_type_map[]; +/** onlp_snmp_psu_type_desc_map table. */ +extern aim_map_si_t onlp_snmp_psu_type_desc_map[]; + +/** Enum names. */ +const char* onlp_snmp_sensor_type_name(onlp_snmp_sensor_type_t e); + +/** Enum values. */ +int onlp_snmp_sensor_type_value(const char* str, onlp_snmp_sensor_type_t* e, int substr); + +/** Enum descriptions. */ +const char* onlp_snmp_sensor_type_desc(onlp_snmp_sensor_type_t e); + +/** Enum validator. */ +int onlp_snmp_sensor_type_valid(onlp_snmp_sensor_type_t e); + +/** validator */ +#define ONLP_SNMP_SENSOR_TYPE_VALID(_e) \ + (onlp_snmp_sensor_type_valid((_e))) + +/** onlp_snmp_sensor_type_map table. */ +extern aim_map_si_t onlp_snmp_sensor_type_map[]; +/** onlp_snmp_sensor_type_desc_map table. */ +extern aim_map_si_t onlp_snmp_sensor_type_desc_map[]; +/* */ + + +#endif /* __ONLP_SNMP_SENSOR_OIDS_H__ */ + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensors.h b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensors.h new file mode 100644 index 00000000..4ea505ff --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensors.h @@ -0,0 +1,34 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_SNMP_SENSORS_H__ +#define __ONLP_SNMP_SENSORS_H__ + +/** + * This handler is compatible with the snmp_subagent client registration + * system. + */ +int onlp_snmp_sensors_client(int enable, void* cookie); + +#endif /* __ONLP_SNMP_SENSORS_H__ */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/make.mk b/packages/base/any/onlp/src/onlp_snmp/module/make.mk new file mode 100644 index 00000000..9fc15445 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +onlp_snmp_INCLUDES := -I $(THIS_DIR)inc +onlp_snmp_INTERNAL_INCLUDES := -I $(THIS_DIR)src +onlp_snmp_DEPENDMODULE_ENTRIES := init:onlp_snmp ucli:onlp_snmp snmp_subagent:onlp_snmp +onlp_snmp_GLOBAL_LINK_LIBS += -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/Makefile b/packages/base/any/onlp/src/onlp_snmp/module/src/Makefile new file mode 100644 index 00000000..67864306 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py onlp_snmp_ucli.c + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/make.mk b/packages/base/any/onlp/src/onlp_snmp/module/src/make.mk new file mode 100644 index 00000000..6fb1db6b --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := onlp_snmp +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_config.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_config.c new file mode 100644 index 00000000..d62d0a31 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_config.c @@ -0,0 +1,126 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __onlp_snmp_config_STRINGIFY_NAME(_x) #_x +#define __onlp_snmp_config_STRINGIFY_VALUE(_x) __onlp_snmp_config_STRINGIFY_NAME(_x) +onlp_snmp_config_settings_t onlp_snmp_config_settings[] = +{ +#ifdef ONLP_SNMP_CONFIG_INCLUDE_LOGGING + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_LOGGING), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_LOGGING) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_LOGGING(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_PORTING_STDLIB + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_PORTING_STDLIB), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_PORTING_STDLIB) }, +#else +{ ONLP_SNMP_CONFIG_PORTING_STDLIB(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_INCLUDE_UCLI + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_UCLI), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_UCLI) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_UCLI(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_MAX_NAME_LENGTH + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_MAX_NAME_LENGTH), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_MAX_NAME_LENGTH) }, +#else +{ ONLP_SNMP_CONFIG_MAX_NAME_LENGTH(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_MAX_DESC_LENGTH + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_MAX_DESC_LENGTH), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_MAX_DESC_LENGTH) }, +#else +{ ONLP_SNMP_CONFIG_MAX_DESC_LENGTH(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_UPDATE_PERIOD + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_UPDATE_PERIOD), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_UPDATE_PERIOD) }, +#else +{ ONLP_SNMP_CONFIG_UPDATE_PERIOD(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_DEV_BASE_INDEX + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_DEV_BASE_INDEX), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_DEV_BASE_INDEX) }, +#else +{ ONLP_SNMP_CONFIG_DEV_BASE_INDEX(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_DEV_MAX_INDEX + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_DEV_MAX_INDEX), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_DEV_MAX_INDEX) }, +#else +{ ONLP_SNMP_CONFIG_DEV_MAX_INDEX(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_INCLUDE_THERMALS + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_THERMALS), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_THERMALS) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_THERMALS(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_INCLUDE_FANS + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_FANS), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_FANS) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_FANS(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_INCLUDE_PSUS + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_PSUS), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_PSUS) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_PSUS(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_INCLUDE_LEDS + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_INCLUDE_LEDS), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_INCLUDE_LEDS) }, +#else +{ ONLP_SNMP_CONFIG_INCLUDE_LEDS(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLP_SNMP_CONFIG_AS_SUBAGENT + { __onlp_snmp_config_STRINGIFY_NAME(ONLP_SNMP_CONFIG_AS_SUBAGENT), __onlp_snmp_config_STRINGIFY_VALUE(ONLP_SNMP_CONFIG_AS_SUBAGENT) }, +#else +{ ONLP_SNMP_CONFIG_AS_SUBAGENT(__onlp_snmp_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __onlp_snmp_config_STRINGIFY_VALUE +#undef __onlp_snmp_config_STRINGIFY_NAME + +const char* +onlp_snmp_config_lookup(const char* setting) +{ + int i; + for(i = 0; onlp_snmp_config_settings[i].name; i++) { + if(strcmp(onlp_snmp_config_settings[i].name, setting)) { + return onlp_snmp_config_settings[i].value; + } + } + return NULL; +} + +int +onlp_snmp_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; onlp_snmp_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", onlp_snmp_config_settings[i].name, onlp_snmp_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_enums.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_enums.c new file mode 100644 index 00000000..2891364b --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_enums.c @@ -0,0 +1,268 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include +#include + +/* */ +aim_map_si_t onlp_snmp_fan_flow_type_map[] = +{ + { "unknown", ONLP_SNMP_FAN_FLOW_TYPE_UNKNOWN }, + { "b2f", ONLP_SNMP_FAN_FLOW_TYPE_B2F }, + { "f2b", ONLP_SNMP_FAN_FLOW_TYPE_F2B }, + { NULL, 0 } +}; + +aim_map_si_t onlp_snmp_fan_flow_type_desc_map[] = +{ + { "None", ONLP_SNMP_FAN_FLOW_TYPE_UNKNOWN }, + { "None", ONLP_SNMP_FAN_FLOW_TYPE_B2F }, + { "None", ONLP_SNMP_FAN_FLOW_TYPE_F2B }, + { NULL, 0 } +}; + +const char* +onlp_snmp_fan_flow_type_name(onlp_snmp_fan_flow_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_fan_flow_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_fan_flow_type'"; + } +} + +int +onlp_snmp_fan_flow_type_value(const char* str, onlp_snmp_fan_flow_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_snmp_fan_flow_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_snmp_fan_flow_type_desc(onlp_snmp_fan_flow_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_fan_flow_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_fan_flow_type'"; + } +} + +int +onlp_snmp_fan_flow_type_valid(onlp_snmp_fan_flow_type_t e) +{ + return aim_map_si_i(NULL, e, onlp_snmp_fan_flow_type_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_snmp_sensor_status_map[] = +{ + { "missing", ONLP_SNMP_SENSOR_STATUS_MISSING }, + { "good", ONLP_SNMP_SENSOR_STATUS_GOOD }, + { "failed", ONLP_SNMP_SENSOR_STATUS_FAILED }, + { "unplugged", ONLP_SNMP_SENSOR_STATUS_UNPLUGGED }, + { NULL, 0 } +}; + +aim_map_si_t onlp_snmp_sensor_status_desc_map[] = +{ + { "None", ONLP_SNMP_SENSOR_STATUS_MISSING }, + { "None", ONLP_SNMP_SENSOR_STATUS_GOOD }, + { "None", ONLP_SNMP_SENSOR_STATUS_FAILED }, + { "None", ONLP_SNMP_SENSOR_STATUS_UNPLUGGED }, + { NULL, 0 } +}; + +const char* +onlp_snmp_sensor_status_name(onlp_snmp_sensor_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_sensor_status_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_sensor_status'"; + } +} + +int +onlp_snmp_sensor_status_value(const char* str, onlp_snmp_sensor_status_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_snmp_sensor_status_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_snmp_sensor_status_desc(onlp_snmp_sensor_status_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_sensor_status_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_sensor_status'"; + } +} + +int +onlp_snmp_sensor_status_valid(onlp_snmp_sensor_status_t e) +{ + return aim_map_si_i(NULL, e, onlp_snmp_sensor_status_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_snmp_psu_type_map[] = +{ + { "unknown", ONLP_SNMP_PSU_TYPE_UNKNOWN }, + { "ac", ONLP_SNMP_PSU_TYPE_AC }, + { "dc12", ONLP_SNMP_PSU_TYPE_DC12 }, + { "dc48", ONLP_SNMP_PSU_TYPE_DC48 }, + { NULL, 0 } +}; + +aim_map_si_t onlp_snmp_psu_type_desc_map[] = +{ + { "None", ONLP_SNMP_PSU_TYPE_UNKNOWN }, + { "None", ONLP_SNMP_PSU_TYPE_AC }, + { "None", ONLP_SNMP_PSU_TYPE_DC12 }, + { "None", ONLP_SNMP_PSU_TYPE_DC48 }, + { NULL, 0 } +}; + +const char* +onlp_snmp_psu_type_name(onlp_snmp_psu_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_psu_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_psu_type'"; + } +} + +int +onlp_snmp_psu_type_value(const char* str, onlp_snmp_psu_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_snmp_psu_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_snmp_psu_type_desc(onlp_snmp_psu_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_psu_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_psu_type'"; + } +} + +int +onlp_snmp_psu_type_valid(onlp_snmp_psu_type_t e) +{ + return aim_map_si_i(NULL, e, onlp_snmp_psu_type_map, 0) ? 1 : 0; +} + + +aim_map_si_t onlp_snmp_sensor_type_map[] = +{ + { "temp", ONLP_SNMP_SENSOR_TYPE_TEMP }, + { "fan", ONLP_SNMP_SENSOR_TYPE_FAN }, + { "psu", ONLP_SNMP_SENSOR_TYPE_PSU }, + { "led", ONLP_SNMP_SENSOR_TYPE_LED }, + { "misc", ONLP_SNMP_SENSOR_TYPE_MISC }, + { "max", ONLP_SNMP_SENSOR_TYPE_MAX }, + { NULL, 0 } +}; + +aim_map_si_t onlp_snmp_sensor_type_desc_map[] = +{ + { "None", ONLP_SNMP_SENSOR_TYPE_TEMP }, + { "None", ONLP_SNMP_SENSOR_TYPE_FAN }, + { "None", ONLP_SNMP_SENSOR_TYPE_PSU }, + { "None", ONLP_SNMP_SENSOR_TYPE_LED }, + { "None", ONLP_SNMP_SENSOR_TYPE_MISC }, + { "None", ONLP_SNMP_SENSOR_TYPE_MAX }, + { NULL, 0 } +}; + +const char* +onlp_snmp_sensor_type_name(onlp_snmp_sensor_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_sensor_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_sensor_type'"; + } +} + +int +onlp_snmp_sensor_type_value(const char* str, onlp_snmp_sensor_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, onlp_snmp_sensor_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +onlp_snmp_sensor_type_desc(onlp_snmp_sensor_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, onlp_snmp_sensor_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'onlp_snmp_sensor_type'"; + } +} + +int +onlp_snmp_sensor_type_valid(onlp_snmp_sensor_type_t e) +{ + return aim_map_si_i(NULL, e, onlp_snmp_sensor_type_map, 0) ? 1 : 0; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_int.h b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_int.h new file mode 100644 index 00000000..5cfd6493 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * onlp_snmp Internal Header + * + *****************************************************************************/ +#ifndef __ONLP_SNMP_INT_H__ +#define __ONLP_SNMP_INT_H__ + +#include + + +#endif /* __ONLP_SNMP_INT_H__ */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.c new file mode 100644 index 00000000..b727ca91 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "onlp_snmp_log.h" +/* + * onlp_snmp log struct. + */ +AIM_LOG_STRUCT_DEFINE( + ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT, + ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.h b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.h new file mode 100644 index 00000000..b11eecdb --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __ONLP_SNMP_LOG_H__ +#define __ONLP_SNMP_LOG_H__ + +#define AIM_LOG_MODULE_NAME onlp_snmp +#include + +#endif /* __ONLP_SNMP_LOG_H__ */ diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_module.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_module.c new file mode 100644 index 00000000..76b7ac4f --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_module.c @@ -0,0 +1,53 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include +#include +#include "onlp_snmp_log.h" + +static int +datatypes_init__(void) +{ +#define ONLP_SNMP_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __onlp_snmp_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); + onlp_init(); +} + +/** + * Used when integrated with the snmp_subagent module. + */ + +#include + +#include + +#ifdef DEPENDMODULE_INCLUDE_SNMP_SUBAGENT + +#include + +int onlp_snmp_snmp_subagent_register(void) +{ + return snmp_subagent_client_register("onlp_snmp_sensors", + onlp_snmp_sensors_client, + NULL); +} + +int onlp_snmp_snmp_subagent_unregister(void) +{ + return snmp_subagent_client_unregister("onlp_snmp_sensors"); +} + +#endif /* DEPENDMODULE_INCLUDE_SNMP_SUBAGENT */ + + + + diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_sensors.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_sensors.c new file mode 100644 index 00000000..03923cfc --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_sensors.c @@ -0,0 +1,1299 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include "onlp_snmp_log.h" + +/** + * Individual Sensor Control structure. + */ +typedef struct onlp_snmp_sensor_s { + int sensor_id; /* sensor identification */ + char name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH]; + char desc[ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + int sensor_type; + union sensor_info { + onlp_thermal_info_t ti; + onlp_fan_info_t fi; + onlp_psu_info_t pi; + onlp_led_info_t li; + uint32_t mi; /* this is for misc value */ + } sensor_info; + bool info_valid; /* true if sensor_info is valid */ + uint64_t last_update_time; /* last time called */ +} onlp_snmp_sensor_t; + + +/** + * NET SNMP Handler + */ +typedef void (*onlp_snmp_handler_fn)(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss); + +/* index into sensor_handler_fn array */ +#define UPDATE_HANDLER_IDX 0 + +/* + * Sensor Value Update period + */ +static uint32_t update_period__ = ONLP_SNMP_CONFIG_UPDATE_PERIOD; + +#define SENSOR_NEEDS_UPDATE(_current_time, _sensor) \ + ((_current_time - _sensor->last_update_time) > update_period__ * 1000 * 1000) + +#define SENSOR_SET_VALIDITY(_rv, _current_time, _sensor) \ + do { \ + if (_rv < 0) { \ + _sensor->info_valid = false; \ + } else { \ + _sensor->info_valid = true; \ + _sensor->last_update_time = _current_time; \ + } \ + } while(0) + + + +typedef struct onlp_snmp_sensor_ctrl_s { + char name[20]; + + /* Handle sensor OIDs */ + uint32_t handler_cnt; + onlp_snmp_handler_fn *handlers; + + uint32_t sensor_cnt; + /* + * Base index starts from 1, thus we add 1 + * Each sensor has a callback to get its value + */ + onlp_snmp_sensor_t *sensor_list[ONLP_SNMP_CONFIG_DEV_MAX_INDEX+1]; + +} onlp_snmp_sensor_ctrl_t; + +static onlp_snmp_sensor_ctrl_t sensor_ctrls__[ONLP_SNMP_SENSOR_TYPE_MAX+1]; + +static onlp_snmp_sensor_t* +get_sensor_reg__(onlp_snmp_sensor_ctrl_t *ss_type, int index) +{ + return ss_type->sensor_list[index]; +} + +static onlp_snmp_sensor_ctrl_t* +get_sensor_ctrl__(int sensor_type) +{ + return sensor_ctrls__ + sensor_type; +} + + + + +/** + * Thermal Sensor Handlers + */ + +static void +temp_update_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + uint64_t current = os_time_monotonic(); + + if (SENSOR_NEEDS_UPDATE(current, ss)) { + onlp_thermal_info_t *ti = &ss->sensor_info.ti; + onlp_oid_t oid = (onlp_oid_t) ss->sensor_id; + + int rv = onlp_thermal_info_get(oid, ti); + SENSOR_SET_VALIDITY(rv, current, ss); + } + + /* else use the last update info */ +} + +static void +temp_index_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + index); +} + +static void +temp_devname_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + + snprintf(device_name, sizeof(device_name), + "%s %s%s", "Thermal", ss->name, ss->desc); + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) device_name, + strlen(device_name)); +} + +static void +temp_status_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_thermal_info_t *ti = &ss->sensor_info.ti; + + if (!ss->info_valid) { + return; + } + + value = ONLP_SNMP_SENSOR_STATUS_MISSING; + if (ti->status & ONLP_THERMAL_STATUS_PRESENT) { + value = ONLP_SNMP_SENSOR_STATUS_GOOD; + if (ti->status & ONLP_THERMAL_STATUS_FAILED) { + value = ONLP_SNMP_SENSOR_STATUS_FAILED; + } + } + + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + value); +} + +static void +temp_value_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_thermal_info_t *ti = &ss->sensor_info.ti; + + if (!ss->info_valid) { + return; + } + + if (!(ti->status & ONLP_THERMAL_STATUS_PRESENT)) { + return; + } + + value = ti->mcelsius; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static onlp_snmp_handler_fn temp_handler_fn__[] = { + temp_update_handler__, + temp_index_handler__, + temp_devname_handler__, + temp_status_handler__, + temp_value_handler__, +}; + + + + + + +/** + * Fan Sensor Handlers + */ +static void +fan_update_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + uint64_t current = os_time_monotonic(); + + if (SENSOR_NEEDS_UPDATE(current, ss)) { + onlp_fan_info_t *fi = &ss->sensor_info.fi; + onlp_oid_t oid = (onlp_oid_t) ss->sensor_id; + + int rv = onlp_fan_info_get(oid, fi); + SENSOR_SET_VALIDITY(rv, current, ss); + } + + /* else use the last update info */ +} + +static void +fan_index_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + index); +} + +static void +fan_devname_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + snprintf(device_name, sizeof(device_name), + "%s %s%s", "Fan", ss->name, ss->desc); + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) device_name, + strlen(device_name)); +} + + +static void +fan_status_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + value = ONLP_SNMP_SENSOR_STATUS_MISSING; + if (fi->status & ONLP_FAN_STATUS_PRESENT) { + value = ONLP_SNMP_SENSOR_STATUS_GOOD; + if (fi->status & ONLP_FAN_STATUS_FAILED) { + value = ONLP_SNMP_SENSOR_STATUS_FAILED; + } + } + + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + value); +} + +static void +fan_flow_type_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int name_index; + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + name_index = ONLP_SNMP_FAN_FLOW_TYPE_UNKNOWN; + + if (fi->status & ONLP_FAN_STATUS_PRESENT) { + if (fi->status & ONLP_FAN_STATUS_B2F) { + name_index = ONLP_SNMP_FAN_FLOW_TYPE_B2F; + } else if (fi->status & ONLP_FAN_STATUS_F2B) { + name_index = ONLP_SNMP_FAN_FLOW_TYPE_F2B; + } else { + /* Unknown */ + } + } + + const char* s = onlp_snmp_fan_flow_type_name(name_index); + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char*)s, strlen(s)); +} + +static void +fan_rpm_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + if (!(fi->status & ONLP_FAN_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + value = fi->rpm; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +fan_pct_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + if (!(fi->status & ONLP_FAN_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = fi->percentage; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +fan_model_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + if (!(fi->status & ONLP_FAN_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + int len = strlen(fi->model); + if (len == 0) { + return; + } + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) fi->model, + len); +} + +static void +fan_serial_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + onlp_fan_info_t *fi = &ss->sensor_info.fi; + + if (!ss->info_valid) { + return; + } + + if (!(fi->status & ONLP_FAN_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + int len = strlen(fi->serial); + if (len == 0) { + return; + } + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) fi->serial, + len); +} + +static onlp_snmp_handler_fn fan_handler_fn__[] = { + fan_update_handler__, + fan_index_handler__, + fan_devname_handler__, + fan_status_handler__, + fan_flow_type_handler__, + fan_rpm_handler__, + fan_pct_handler__, + fan_model_handler__, + fan_serial_handler__ +}; + + + +/** + * PSU Handlers + */ +static void +psu_update_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + uint64_t current = os_time_monotonic(); + + if (SENSOR_NEEDS_UPDATE(current, ss)) { + onlp_psu_info_t *pi = &ss->sensor_info.pi; + onlp_oid_t oid = (onlp_oid_t) ss->sensor_id; + + int rv = onlp_psu_info_get(oid, pi); + SENSOR_SET_VALIDITY(rv, current, ss); + } + + /* else use the last update info */ +} + +static void +psu_index_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + index); +} + +static void +psu_devname_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + snprintf(device_name, sizeof(device_name), + "%s %s%s", "PSU", ss->name, ss->desc); + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) device_name, + strlen(device_name)); +} + +static void +psu_status_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + value = ONLP_SNMP_SENSOR_STATUS_MISSING; + if (pi->status & ONLP_PSU_STATUS_PRESENT) { + value = ONLP_SNMP_SENSOR_STATUS_GOOD; + + /* failed or good is always reported */ + if (pi->status & ONLP_PSU_STATUS_FAILED) { + value = ONLP_SNMP_SENSOR_STATUS_FAILED; + } + + /* if additional unplugged status is reported */ + if (pi->status & ONLP_PSU_STATUS_UNPLUGGED) { + value = ONLP_SNMP_SENSOR_STATUS_FAILED; + } + + } + + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + value); +} + +static void +psu_current_type_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int name_index; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + name_index = ONLP_SNMP_PSU_TYPE_UNKNOWN; + /* These values are mutual exclusive */ + if (pi->caps & ONLP_PSU_CAPS_AC) { + name_index = ONLP_SNMP_PSU_TYPE_AC; + } else if (pi->caps & ONLP_PSU_CAPS_DC12) { + name_index = ONLP_SNMP_PSU_TYPE_DC12; + } else if (pi->caps & ONLP_PSU_CAPS_DC48) { + name_index = ONLP_SNMP_PSU_TYPE_DC48; + } else { + /* Unknown type */ + } + + const char* s = onlp_snmp_psu_type_name(name_index); + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) s, strlen(s)); +} + +static void +psu_model_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + int len = strlen(pi->model); + if (len == 0) { + return; + } + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) pi->model, + len); +} + +static void +psu_serial_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + int len = strlen(pi->serial); + if (len == 0) { + return; + } + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) pi->serial, + len); +} + +static void +psu_vin_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + + value = pi->mvin; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +psu_vout_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present */ + return; + } + value = pi->mvout; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +psu_iin_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = pi->miin; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +psu_iout_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = pi->miout; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +psu_pin_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = pi->mpin; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +psu_pout_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss ) +{ + int value; + onlp_psu_info_t *pi = &ss->sensor_info.pi; + + if (!ss->info_valid) { + return; + } + + if (!(pi->status & ONLP_PSU_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = pi->mpout; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + + +static onlp_snmp_handler_fn psu_handler_fn__[] = { + psu_update_handler__, + psu_index_handler__, + psu_devname_handler__, + psu_status_handler__, + psu_current_type_handler__, + psu_model_handler__, + psu_vin_handler__, + psu_vout_handler__, + psu_iin_handler__, + psu_iout_handler__, + psu_pin_handler__, + psu_pout_handler__, + psu_serial_handler__ +}; + + +/** + * LED Handlers + */ +static void +led_update_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + uint64_t current = os_time_monotonic(); + + if (SENSOR_NEEDS_UPDATE(current, ss)) { + onlp_led_info_t *li = &ss->sensor_info.li; + onlp_oid_t oid = (onlp_oid_t) ss->sensor_id; + + int rv = onlp_led_info_get(oid, li); + SENSOR_SET_VALIDITY(rv, current, ss); + } + + /* else use the last update info */ +} + +static void +led_index_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + index); +} + +static void +led_devname_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + snprintf(device_name, sizeof(device_name), + "%s %s%s", "Led", ss->name, ss->desc); + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) device_name, + strlen(device_name)); +} + +static void +led_status_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_led_info_t *li = &ss->sensor_info.li; + + if (!ss->info_valid) { + return; + } + + value = li->status; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +led_value_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value; + onlp_led_info_t *li = &ss->sensor_info.li; + + if (!ss->info_valid) { + return; + } + + if (!(li->status & ONLP_LED_STATUS_PRESENT)) { + /* Simply return if failed to get or not present*/ + return; + } + value = li->mode; + + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static onlp_snmp_handler_fn led_handler_fn__[] = { + led_update_handler__, + led_index_handler__, + led_devname_handler__, + led_status_handler__, + led_value_handler__, +}; + + +/** + * Misc Handlers. + * Placeholder for unknown types + */ +static void +misc_update_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + ss->info_valid = 1; +} + +static void +misc_index_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + snmp_set_var_typed_integer(req->requestvb, + ASN_INTEGER, + index); +} + +static void +misc_devname_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + char device_name[ONLP_SNMP_CONFIG_MAX_NAME_LENGTH+ONLP_SNMP_CONFIG_MAX_DESC_LENGTH]; + snprintf(device_name, sizeof(device_name), + "%s %s%s", "Misc", ss->name, ss->desc); + + snmp_set_var_typed_value(req->requestvb, + ASN_OCTET_STR, + (u_char *) device_name, + strlen(device_name)); +} + +static void +misc_status_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value = 0; + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static void +misc_value_handler__(netsnmp_request_info *req, + uint32_t index, + onlp_snmp_sensor_t *ss) +{ + int value = 0; + snmp_set_var_typed_value(req->requestvb, + ASN_GAUGE, + (u_char *) &value, + sizeof(value)); +} + +static onlp_snmp_handler_fn misc_handler_fn__[] = { + misc_update_handler__, + misc_index_handler__, + misc_devname_handler__, + misc_status_handler__, + misc_value_handler__, +}; + + +/* + * OID HANDLER for all sensor types + * This is registered to NETSNMP using agentX + */ +static int +onlp_snmp_sensor_handler__(netsnmp_mib_handler *handler, + netsnmp_handler_registration *reg, + netsnmp_agent_request_info *agent_req, + netsnmp_request_info *req) +{ + + int ret = SNMP_ERR_NOERROR; + onlp_snmp_sensor_t *sensor; + + int sensor_type = req->requestvb->name[req->requestvb->name_length - OID_SENSOR_TYPE_INDEX]; + onlp_snmp_sensor_ctrl_t *ss_type = get_sensor_ctrl__(sensor_type); + + /* This is for index / device / value handler */ + int column = req->requestvb->name[req->requestvb->name_length - OID_SENSOR_COL_INDEX]; + + /* This is device index */ + int index = req->requestvb->name[req->requestvb->name_length - OID_SENSOR_DEV_INDEX]; + + if (agent_req->mode != MODE_GET && agent_req->mode != MODE_GETNEXT) { + /* If happen, just return */ + return ret; + } + + if(!onlp_snmp_sensor_type_valid(sensor_type)) { + /* If happen, just return */ + return ret; + } + + if (column >= ss_type->handler_cnt) { + /* If happen, just return */ + return ret; + } + + /* index start from 1 and equal to sensor_cnt */ + if (index < ONLP_SNMP_CONFIG_DEV_BASE_INDEX || index > ss_type->sensor_cnt) { + /* If happen, just return */ + return ret; + } + + sensor = get_sensor_reg__(ss_type, index); + if (!sensor) { + /* If happen, just return */ + return ret; + } + + if (!ss_type->handlers[UPDATE_HANDLER_IDX]) { + snmp_log(LOG_ALERT, + "No update handler for type=%d column=%d, index=%d", + sensor_type, column, index); + return ret; + } + ss_type->handlers[UPDATE_HANDLER_IDX](req, index, sensor); + + /* We select index/devname/value to handle for each device */ + if (ss_type->handlers[column]) { + (*ss_type->handlers[column])(req, index, sensor); + } + + return ret; +} + + + + +/* Register OID handler for a sensor type */ +static int +reg_snmp_sensor_helper__(int sensor_type, + oid *reg_oid, + size_t oid_len, + int dev_idx) +{ + int ret = MIB_REGISTRATION_FAILED; + + Netsnmp_Node_Handler *handler = onlp_snmp_sensor_handler__; + onlp_snmp_sensor_ctrl_t *ss_type = get_sensor_ctrl__(sensor_type); + uint32_t col_cnt = ss_type->handler_cnt; + char *table_name = ss_type->name; + + /* Use this to increase the column index in oid */ + u_long *oid_col = ®_oid[oid_len - OID_SENSOR_COL_INDEX]; + + /* Use this to increase the dev index of oid */ + reg_oid[oid_len - OID_SENSOR_DEV_INDEX] = dev_idx; + + snmp_log(LOG_DEBUG, "oid registrations: %s for dev_idx=%d", + table_name, dev_idx); + + /* + * Caller makes sure that this loop is run + * since *oid_col starts as 1st col + */ + for (; *oid_col < col_cnt; (*oid_col)++) { + netsnmp_handler_registration *reg; + + if (!ss_type->handlers[*oid_col]) + continue; + + reg = netsnmp_create_handler_registration(table_name, + handler, + reg_oid, + oid_len, + HANDLER_CAN_RONLY); + + /* Ofad enables verbose/trace to see this */ + snmp_log(LOG_INFO, "registering handler for %s column %ld, index %d", + table_name, *oid_col, dev_idx); + + /* If reg is null, this returns error */ + ret = netsnmp_register_instance(reg); + if(ret) { + break; + } + } + + return ret; + +} + +/* + * Register a sensor + * Caller must make sure that 1 sensor registered only once + * If it calls this twice, it will get 2 oid entries + * for the same sensor + * + * We want to keep this snmp code as simple as possible + */ +static int +onlp_snmp_sensor_reg__(int sensor_type, + onlp_snmp_sensor_t *sensor) +{ + oid otemp[] = { ONLP_SNMP_SENSOR_TEMP_OID }; + oid ofan[] = { ONLP_SNMP_SENSOR_FAN_OID }; + oid opsu[] = { ONLP_SNMP_SENSOR_PSU_OID }; + oid oled[] = { ONLP_SNMP_SENSOR_LED_OID }; + oid omisc[] = { ONLP_SNMP_SENSOR_MISC_OID }; + oid *o; + u_long o_len; + int ret = MIB_REGISTRATION_FAILED; + + onlp_snmp_sensor_ctrl_t *ss_type = get_sensor_ctrl__(sensor_type); + + /* We start with Base 1 */ + AIM_TRUE_OR_DIE(onlp_snmp_sensor_type_valid(sensor_type)); + AIM_TRUE_OR_DIE(sensor); + AIM_TRUE_OR_DIE(ss_type); + + switch(sensor_type) + { + case ONLP_SNMP_SENSOR_TYPE_TEMP: + o = otemp; + o_len = OID_LENGTH(otemp); + + /* Not init yet, init oid table */ + if (!ss_type->handlers) { + ss_type->handler_cnt = sizeof(temp_handler_fn__) / sizeof(temp_handler_fn__[0]); + ss_type->handlers = temp_handler_fn__; + snprintf(ss_type->name, sizeof(ss_type->name), "%s", "temp_table"); + } + break; + + case ONLP_SNMP_SENSOR_TYPE_FAN: + o = ofan; + o_len = OID_LENGTH(ofan); + + /* Not init yet, init oid table */ + if (!ss_type->handlers) { + ss_type->handler_cnt = sizeof(fan_handler_fn__) / sizeof(fan_handler_fn__[0]); + ss_type->handlers = fan_handler_fn__; + snprintf(ss_type->name, sizeof(ss_type->name), "%s", "fan_table"); + } + break; + + case ONLP_SNMP_SENSOR_TYPE_PSU: + o = opsu; + o_len = OID_LENGTH(opsu); + + /* Not init yet, init oid table */ + if (!ss_type->handlers) { + ss_type->handler_cnt = sizeof(psu_handler_fn__) / sizeof(psu_handler_fn__[0]); + ss_type->handlers = psu_handler_fn__; + snprintf(ss_type->name, sizeof(ss_type->name), "%s", "psu_table"); + + } + break; + + case ONLP_SNMP_SENSOR_TYPE_LED: + o = oled; + o_len = OID_LENGTH(oled); + + /* Not init yet, init oid table */ + if (!ss_type->handlers) { + ss_type->handler_cnt = sizeof(led_handler_fn__) / sizeof(led_handler_fn__[0]); + ss_type->handlers = led_handler_fn__; + snprintf(ss_type->name, sizeof(ss_type->name), "%s", "led_table"); + } + break; + + case ONLP_SNMP_SENSOR_TYPE_MISC: + o = omisc; + o_len = OID_LENGTH(omisc); + + /* Not init yet, init oid table */ + if (!ss_type->handlers) { + ss_type->handler_cnt = sizeof(misc_handler_fn__) / sizeof(misc_handler_fn__[0]); + ss_type->handlers = misc_handler_fn__; + snprintf(ss_type->name, sizeof(ss_type->name), "%s", "misc_table"); + } + break; + + default: + AIM_DIE("Invalid sensor value."); + break; + } + + /* + * sensor_cnt original is 0 + * When sensor_cnt == ONLP_SNMP_CONFIG_DEV_MAX_INDEX + * We stop adding + */ + if (ss_type->sensor_cnt < ONLP_SNMP_CONFIG_DEV_MAX_INDEX) { + /* Device index equal to ss_type->sensor_cnt */ + ss_type->sensor_cnt++; + + /* This entry must be null */ + AIM_TRUE_OR_DIE(!ss_type->sensor_list[ss_type->sensor_cnt]); + + snmp_log(LOG_INFO, "init type=%d, index=%d, id=%d", + sensor_type, ss_type->sensor_cnt, sensor->sensor_id); + + onlp_snmp_sensor_t *ss = AIM_MALLOC(sizeof(onlp_snmp_sensor_t)); + AIM_TRUE_OR_DIE(ss); + AIM_MEMCPY(ss, sensor, sizeof(*sensor)); + ss->sensor_type = sensor_type; + ss->info_valid = 0; + ss->last_update_time = 0; + + /* Assign sensor to the list */ + ss_type->sensor_list[ss_type->sensor_cnt] = ss; + + } else { + snmp_log(LOG_ALERT, + "Failed to register sensor type=%d id=%d, resource limited", + sensor_type, sensor->sensor_id); + return ret; + } + + AIM_TRUE_OR_DIE(o_len == ONLP_SNMP_SENSOR_OID_LENGTH, + "invalid oid length=%d", o_len); + + ret = reg_snmp_sensor_helper__(sensor_type, o, o_len, + ss_type->sensor_cnt); + if (ret) { + snmp_log(LOG_ALERT, + "Failed to register sensor type=%d id=%d, MIB_ERROR=%d", + sensor_type, sensor->sensor_id, ret); + } + + return ret; +} + + +static int +onlp_snmp_sensor_register_oid__(onlp_oid_t oid, void* cookie) +{ + onlp_oid_hdr_t hdr; + onlp_snmp_sensor_t s; + + onlp_oid_hdr_get(oid, &hdr); + + AIM_MEMSET(&s, 0x0, sizeof(onlp_snmp_sensor_t)); + switch(ONLP_OID_TYPE_GET(oid)) + { + case ONLP_OID_TYPE_THERMAL: +#if ONLP_SNMP_CONFIG_INCLUDE_THERMALS == 1 + s.sensor_id = oid; + sprintf(s.name, "%d - ", ONLP_OID_ID_GET(oid)); + aim_strlcpy(s.desc, hdr.description, sizeof(s.desc)); + if(onlp_snmp_sensor_reg__(ONLP_SNMP_SENSOR_TYPE_TEMP, &s) < 0) { + AIM_LOG_ERROR("onlp_snmp_sensor_reg for OID 0x%x failed.", oid); + } +#endif + break; + + case ONLP_OID_TYPE_FAN: +#if ONLP_SNMP_CONFIG_INCLUDE_FANS == 1 + s.sensor_id = oid; + sprintf(s.name, "%d - ", ONLP_OID_ID_GET(oid)); + aim_strlcpy(s.desc, hdr.description, sizeof(s.desc)); + if(onlp_snmp_sensor_reg__(ONLP_SNMP_SENSOR_TYPE_FAN, &s) < 0) { + AIM_LOG_ERROR("onlp_snmp_sensor_reg for OID 0x%x failed.", oid); + } +#endif + break; + + case ONLP_OID_TYPE_PSU: +#if ONLP_SNMP_CONFIG_INCLUDE_PSUS == 1 + /* Register Sensors for VIN,VOUT,IIN,IOUT,PIN,POUT */ + s.sensor_id = oid; + sprintf(s.name, "%d - ", ONLP_OID_ID_GET(oid)); + aim_strlcpy(s.desc, hdr.description, sizeof(s.desc)); + if(onlp_snmp_sensor_reg__(ONLP_SNMP_SENSOR_TYPE_PSU, &s) < 0) { + AIM_LOG_ERROR("onlp_snmp_sensor_reg for OID 0x%x failed.", oid); + } +#endif + break; + + default: + AIM_LOG_INFO("snmp type %s id %d unsupported", + onlp_oid_type_name(ONLP_OID_TYPE_GET(oid)), + ONLP_OID_ID_GET(oid)); + break; + } + + return 0; +} + + +/** + * Register Sensors + */ +void onlp_snmp_sensors_init(void) +{ + int rv; + AIM_LOG_MSG("%s", __FUNCTION__); + + /* Register all sensor OIDs */ + rv = onlp_oid_iterate(ONLP_OID_SYS, 0, onlp_snmp_sensor_register_oid__, NULL); + if (rv != ONLP_STATUS_OK) { + AIM_LOG_ERROR("%s error %d", __FUNCTION__, rv); + } else { + AIM_LOG_MSG("%s succeeded.", __FUNCTION__); + } +} + +int +onlp_snmp_sensors_client(int enable, void* cookie) +{ + onlp_snmp_sensors_init(); + return 0; +} diff --git a/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_ucli.c b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_ucli.c new file mode 100644 index 00000000..dd95a9b8 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/module/src/onlp_snmp_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if ONLP_SNMP_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +onlp_snmp_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(onlp_snmp) +} + +/* */ +/* */ + +static ucli_module_t +onlp_snmp_ucli_module__ = + { + "onlp_snmp_ucli", + NULL, + onlp_snmp_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +onlp_snmp_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&onlp_snmp_ucli_module__); + n = ucli_node_create("onlp_snmp", NULL, &onlp_snmp_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("onlp_snmp")); + return n; +} + +#else +void* +onlp_snmp_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/base/any/onlp/src/onlp_snmp/onlp_snmp.doxy b/packages/base/any/onlp/src/onlp_snmp/onlp_snmp.doxy new file mode 100644 index 00000000..dd7c5084 --- /dev/null +++ b/packages/base/any/onlp/src/onlp_snmp/onlp_snmp.doxy @@ -0,0 +1,1792 @@ +# Doxyfile 1.8.1.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "onlp_snmp" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "ONLP SNMP AgentX Library." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/onlpie/.gitignore b/packages/base/any/onlp/src/onlpie/.gitignore new file mode 100644 index 00000000..cc08e1f0 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/.gitignore @@ -0,0 +1,2 @@ +/onlpie.mk +/doc diff --git a/packages/base/any/onlp/src/onlpie/Makefile b/packages/base/any/onlp/src/onlpie/Makefile new file mode 100644 index 00000000..20fdb766 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/Makefile @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +include ../../init.mk +MODULE := onlpie +AUTOMODULE := onlpie +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/onlpie/README b/packages/base/any/onlp/src/onlpie/README new file mode 100644 index 00000000..df33f160 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/README @@ -0,0 +1,6 @@ +############################################################################### +# +# onlpie README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/onlpie/module/auto/make.mk b/packages/base/any/onlp/src/onlpie/module/auto/make.mk new file mode 100644 index 00000000..7e721a31 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/auto/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlpie Autogeneration +# +############################################################ + +onlpie_AUTO_DEFS := module/auto/onlpie.yml +onlpie_AUTO_DIRS := module/inc/onlpie module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/onlpie/module/auto/onlpie.yml b/packages/base/any/onlp/src/onlpie/module/auto/onlpie.yml new file mode 100644 index 00000000..ede2c821 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/auto/onlpie.yml @@ -0,0 +1,66 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlpie Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- ONLPIE_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- ONLPIE_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- ONLPIE_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: ONLPIE_CONFIG_PORTING_STDLIB +- ONLPIE_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + ONLPIE_CONFIG_HEADER: + defs: *cdefs + basename: onlpie_config + + portingmacro: + ONLPIE: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie.x b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie.x new file mode 100644 index 00000000..f6b52813 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie.x @@ -0,0 +1,34 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_config.h b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_config.h new file mode 100644 index 00000000..69a67eee --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_config.h @@ -0,0 +1,152 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * @file + * @brief onlpie Configuration Header + * + * @addtogroup onlpie-config + * @{ + * + *****************************************************************************/ +#ifndef __ONLPIE_CONFIG_H__ +#define __ONLPIE_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef ONLPIE_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * ONLPIE_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef ONLPIE_CONFIG_INCLUDE_LOGGING +#define ONLPIE_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT +#define ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * ONLPIE_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef ONLPIE_CONFIG_LOG_BITS_DEFAULT +#define ONLPIE_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * ONLPIE_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef ONLPIE_CONFIG_PORTING_STDLIB +#define ONLPIE_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLPIE_CONFIG_PORTING_STDLIB +#endif + +/** + * ONLPIE_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef ONLPIE_CONFIG_INCLUDE_UCLI +#define ONLPIE_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct onlpie_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} onlpie_config_settings_t; + +/** Configuration settings table. */ +/** onlpie_config_settings table. */ +extern onlpie_config_settings_t onlpie_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* onlpie_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int onlpie_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "onlpie_porting.h" + +#endif /* __ONLPIE_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_dox.h b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_dox.h new file mode 100644 index 00000000..a07bae67 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_dox.h @@ -0,0 +1,51 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/********************************************************//** + * + * onlpie Doxygen Header + * + ***********************************************************/ +#ifndef __ONLPIE_DOX_H__ +#define __ONLPIE_DOX_H__ + +/** + * @defgroup onlpie onlpie - onlpie Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup onlpie-onlpie Public Interface + * @defgroup onlpie-config Compile Time Configuration + * @defgroup onlpie-porting Porting Macros + * + * @} + * + */ + +#endif /* __ONLPIE_DOX_H__ */ diff --git a/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_porting.h b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_porting.h new file mode 100644 index 00000000..54482371 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/inc/onlpie/onlpie_porting.h @@ -0,0 +1,132 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/********************************************************//** + * + * @file + * @brief onlpie Porting Macros. + * + * @addtogroup onlpie-porting + * @{ + * + ***********************************************************/ +#ifndef __ONLPIE_PORTING_H__ +#define __ONLPIE_PORTING_H__ + + +/* */ +#if ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ONLPIE_MALLOC + #if defined(GLOBAL_MALLOC) + #define ONLPIE_MALLOC GLOBAL_MALLOC + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_MALLOC malloc + #else + #error The macro ONLPIE_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_FREE + #if defined(GLOBAL_FREE) + #define ONLPIE_FREE GLOBAL_FREE + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_FREE free + #else + #error The macro ONLPIE_FREE is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_MEMSET + #if defined(GLOBAL_MEMSET) + #define ONLPIE_MEMSET GLOBAL_MEMSET + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_MEMSET memset + #else + #error The macro ONLPIE_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ONLPIE_MEMCPY GLOBAL_MEMCPY + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_MEMCPY memcpy + #else + #error The macro ONLPIE_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define ONLPIE_STRNCPY GLOBAL_STRNCPY + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_STRNCPY strncpy + #else + #error The macro ONLPIE_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define ONLPIE_VSNPRINTF GLOBAL_VSNPRINTF + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_VSNPRINTF vsnprintf + #else + #error The macro ONLPIE_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define ONLPIE_SNPRINTF GLOBAL_SNPRINTF + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_SNPRINTF snprintf + #else + #error The macro ONLPIE_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ONLPIE_STRLEN + #if defined(GLOBAL_STRLEN) + #define ONLPIE_STRLEN GLOBAL_STRLEN + #elif ONLPIE_CONFIG_PORTING_STDLIB == 1 + #define ONLPIE_STRLEN strlen + #else + #error The macro ONLPIE_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ONLPIE_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlpie/module/make.mk b/packages/base/any/onlp/src/onlpie/module/make.mk new file mode 100644 index 00000000..77a442b3 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +onlpie_INCLUDES := -I $(THIS_DIR)inc +onlpie_INTERNAL_INCLUDES := -I $(THIS_DIR)src +onlpie_DEPENDMODULE_ENTRIES := init:onlpie ucli:onlpie + diff --git a/packages/base/any/onlp/src/onlpie/module/src/Makefile b/packages/base/any/onlp/src/onlpie/module/src/Makefile new file mode 100644 index 00000000..87a73132 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/Makefile @@ -0,0 +1,30 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Local source generation targets. +# +############################################################ + +include ../../../../init.mk + +ucli: + $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlpie_ucli.c + diff --git a/packages/base/any/onlp/src/onlpie/module/src/fani.c b/packages/base/any/onlp/src/onlpie/module/src/fani.c new file mode 100644 index 00000000..1e503f05 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/fani.c @@ -0,0 +1,148 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include "onlpie_int.h" + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + +/* + * Get the fan information. + */ + +/* Static fan information */ +onlp_fan_info_t finfo[] = { + { }, /* Not used */ + { + { ONLP_FAN_ID_CREATE(1), "Chassis Fan 1", 0 }, + 0x1, + ONLP_FAN_CAPS_B2F, + 9000, + 100, + ONLP_FAN_MODE_MAX, + "FAN1Model", + "FAN1SerialNumber", + }, + { + { ONLP_FAN_ID_CREATE(2), "Chassis Fan 2", 0 }, + 0x0, + }, + { + { ONLP_FAN_ID_CREATE(3), "PSU-1 Fan 1", 0 }, + 0x1, + ONLP_FAN_CAPS_B2F, + 5004, + 50, + ONLP_FAN_MODE_NORMAL, + }, + { + { ONLP_FAN_ID_CREATE(3), "PSU-1 Fan 2", 0 }, + 0x1, + ONLP_FAN_CAPS_B2F, + 5020, + 50, + ONLP_FAN_MODE_NORMAL, + }, +}; + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + *info = finfo[ONLP_OID_ID_GET(id)]; + return ONLP_STATUS_OK; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/base/any/onlp/src/onlpie/module/src/ledi.c b/packages/base/any/onlp/src/onlpie/module/src/ledi.c new file mode 100644 index 00000000..96bd591b --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/ledi.c @@ -0,0 +1,97 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include "onlpie_int.h" + +/* + * This function will be called prior to any other onlp_ledi_* functions. + */ +int +onlp_ledi_init(void) +{ + return ONLP_STATUS_OK; +} + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = + { + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(1), "Chassis LED 1", 0 }, + 0x1, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING, + ONLP_LED_MODE_RED + }, + { + { ONLP_LED_ID_CREATE(2), "Chassis LED 2", 0 }, + 0x0, + }, + }; + +int +onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + *info = linfo[ONLP_OID_ID_GET(id)]; + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/base/any/onlp/src/onlpie/module/src/make.mk b/packages/base/any/onlp/src/onlpie/module/src/make.mk new file mode 100644 index 00000000..b9698405 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +LIBRARY := onlpie +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +#$(LIBRARY)_LAST := 1 +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_config.c b/packages/base/any/onlp/src/onlpie/module/src/onlpie_config.c new file mode 100644 index 00000000..6447ca76 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_config.c @@ -0,0 +1,96 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* */ +#define __onlpie_config_STRINGIFY_NAME(_x) #_x +#define __onlpie_config_STRINGIFY_VALUE(_x) __onlpie_config_STRINGIFY_NAME(_x) +onlpie_config_settings_t onlpie_config_settings[] = +{ +#ifdef ONLPIE_CONFIG_INCLUDE_LOGGING + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_INCLUDE_LOGGING), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_INCLUDE_LOGGING) }, +#else +{ ONLPIE_CONFIG_INCLUDE_LOGGING(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_LOG_BITS_DEFAULT + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_LOG_BITS_DEFAULT), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ONLPIE_CONFIG_LOG_BITS_DEFAULT(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_PORTING_STDLIB + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_PORTING_STDLIB), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_PORTING_STDLIB) }, +#else +{ ONLPIE_CONFIG_PORTING_STDLIB(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPIE_CONFIG_INCLUDE_UCLI + { __onlpie_config_STRINGIFY_NAME(ONLPIE_CONFIG_INCLUDE_UCLI), __onlpie_config_STRINGIFY_VALUE(ONLPIE_CONFIG_INCLUDE_UCLI) }, +#else +{ ONLPIE_CONFIG_INCLUDE_UCLI(__onlpie_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __onlpie_config_STRINGIFY_VALUE +#undef __onlpie_config_STRINGIFY_NAME + +const char* +onlpie_config_lookup(const char* setting) +{ + int i; + for(i = 0; onlpie_config_settings[i].name; i++) { + if(strcmp(onlpie_config_settings[i].name, setting)) { + return onlpie_config_settings[i].value; + } + } + return NULL; +} + +int +onlpie_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; onlpie_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", onlpie_config_settings[i].name, onlpie_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_enums.c b/packages/base/any/onlp/src/onlpie/module/src/onlpie_enums.c new file mode 100644 index 00000000..a04af92c --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_enums.c @@ -0,0 +1,30 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_int.h b/packages/base/any/onlp/src/onlpie/module/src/onlpie_int.h new file mode 100644 index 00000000..2b86afc0 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_int.h @@ -0,0 +1,32 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLPIE_INT_H__ +#define __ONLPIE_INT_H__ + +#include + + +#endif /* __ONLPIE_INT_H__ */ diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.c b/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.c new file mode 100644 index 00000000..7b30448b --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.c @@ -0,0 +1,38 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlpie_log.h" +/* + * onlpie log struct. + */ +AIM_LOG_STRUCT_DEFINE( + ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT, + ONLPIE_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.h b/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.h new file mode 100644 index 00000000..03f6fb97 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_log.h @@ -0,0 +1,32 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLPIE_LOG_H__ +#define __ONLPIE_LOG_H__ + +#define AIM_LOG_MODULE_NAME onlpie +#include + +#endif /* __ONLPIE_LOG_H__ */ diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_module.c b/packages/base/any/onlp/src/onlpie/module/src/onlpie_module.c new file mode 100644 index 00000000..ac7bd25e --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_module.c @@ -0,0 +1,44 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlpie_log.h" + +static int +datatypes_init__(void) +{ +#define ONLPIE_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __onlpie_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/base/any/onlp/src/onlpie/module/src/onlpie_ucli.c b/packages/base/any/onlp/src/onlpie/module/src/onlpie_ucli.c new file mode 100644 index 00000000..b93a5fe2 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/onlpie_ucli.c @@ -0,0 +1,82 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#if ONLPIE_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +onlpie_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(onlpie) +} + +/* */ +/****************************************************************************** + * + * These handler table(s) were autogenerated from the symbols in this + * source file. + * + *****************************************************************************/ +static ucli_command_handler_f onlpie_ucli_ucli_handlers__[] = +{ + onlpie_ucli_ucli__config__, + NULL +}; +/******************************************************************************/ +/* */ + +static ucli_module_t +onlpie_ucli_module__ = + { + "onlpie_ucli", + NULL, + onlpie_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +onlpie_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&onlpie_ucli_module__); + n = ucli_node_create("onlpie", NULL, &onlpie_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("onlpie")); + return n; +} + +#else +void* +onlpie_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/base/any/onlp/src/onlpie/module/src/psui.c b/packages/base/any/onlp/src/onlpie/module/src/psui.c new file mode 100644 index 00000000..ec4af08d --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/psui.c @@ -0,0 +1,96 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "onlpie_int.h" + +/* + * This function will be called prior to any other onlp_psui functions. + */ +int +onlp_psui_init(void) +{ + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = + { + { }, /* Not used */ + { + { + ONLP_PSU_ID_CREATE(1), "PSU-1", 0, + /* This PSU has 2 fans */ + { ONLP_FAN_ID_CREATE(3), ONLP_FAN_ID_CREATE(4) } + }, + "ONLPIE PSU MODEL (AC)", "ONLPIE PSU SN", + 0x1, + ONLP_PSU_CAPS_AC | ONLP_PSU_CAPS_VIN | ONLP_PSU_CAPS_VOUT | ONLP_PSU_CAPS_IIN, + 241100, + 122200, + 23300, + 3440, + 0, + 0, + }, + { + { ONLP_PSU_ID_CREATE(2), "PSU-2", 0 }, + "", "", + 0, + }, + { + { ONLP_PSU_ID_CREATE(3), "PSU-3", 0 }, + "ONLPIE PSU MODEL (DC)", "ONLPIE PSU SN", + 0x1, + ONLP_PSU_CAPS_DC48, + 48100, + 12200, + 2300 + }, + }; + + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + *info = pinfo[ONLP_OID_ID_GET(id)]; + return ONLP_STATUS_OK; +} + +/* + * This is an optional generic ioctl() interface. + * Its purpose is to allow future expansion and + * custom functionality that is not otherwise exposed + * in the standard interface. + * + * The semantics of this function are platform specific. + * This function is completely optional. + */ +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} diff --git a/packages/base/any/onlp/src/onlpie/module/src/sfpi.c b/packages/base/any/onlp/src/onlpie/module/src/sfpi.c new file mode 100644 index 00000000..fec0378e --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/sfpi.c @@ -0,0 +1,201 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include "onlpie_log.h" + +/* + * If your platform does not support any SFP interfaces + * then none of these functions need to be provided. + */ + +/* + * This function will be called prior to all other onlp_sfpi_* functions. + */ +int +onlp_sfpi_init(void) +{ + AIM_LOG_MSG("%s", __func__); + return ONLP_STATUS_OK; +} + +/* + * This function should populate the give bitmap with + * all valid, SFP-capable port numbers. + * + * Only port numbers in this bitmap will be queried by the the + * ONLP framework. + * + * No SFPI functions will be called with ports that are + * not in this bitmap. You can ignore all error checking + * on the incoming ports defined in this interface. + */ +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* We simulate 4 SFP ports -- 17, 18, 19, and 20 */ + AIM_BITMAP_SET(bmap, 17); + AIM_BITMAP_SET(bmap, 18); + AIM_BITMAP_SET(bmap, 19); + AIM_BITMAP_SET(bmap, 20); + return ONLP_STATUS_OK; +} + +/* + * This function should return whether an SFP is inserted on the given + * port. + * + * Returns 1 if the SFP is present. + * Returns 0 if the SFP is not present. + * Returns ONLP_E_* if there was an error determining the status. + */ +int +onlp_sfpi_is_present(int port) +{ + /* In this example only ports 17 and 19 have SFPs inserted */ + if(port == 17 || port == 19) { + return 1; + } + return 0; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + AIM_BITMAP_CLR_ALL(dst); + AIM_BITMAP_SET(dst, 17); + AIM_BITMAP_SET(dst, 19); + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + AIM_BITMAP_CLR_ALL(dst); + AIM_BITMAP_SET(dst, 19); + return ONLP_STATUS_OK; +} + +/* + * This function reads the SFPs idrom and returns in + * in the data buffer provided. + */ +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + if(port == 17 || port == 19) { + /* These ports have SFPs inserted in this example */ + return ONLP_STATUS_OK; + } + else { + /* These ports have no SFPs inserted. */ + return ONLP_STATUS_E_MISSING; + } +} + +/* + * Manually enable or disable the given SFP. + * + */ +int +onlp_sfpi_enable_set(int port, int enable) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Returns whether the SFP is currently enabled or disabled. + */ +int +onlp_sfpi_enable_get(int port, int* enable) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * If the platform requires any setup or equalizer modifications + * based on the actual SFP that was inserted then that custom + * setup should be performed here. + * + * After a new SFP is detected by the ONLP framework this + * function will be called to perform the (optional) setup. + */ +int +onlp_sfpi_post_insert(int port, sff_info_t* sff_info) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Return the current status of the SFP. + * See onlp_sfp_status_t; + */ +int +onlp_sfpi_status_get(int port, uint32_t* status) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * De-initialize the SFPI subsystem. + */ +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + + +/* + * This function should display human-readable debug status + * of the given SFP. + * + * This function will be called for the purposes of system + * debug and technical support logs. + * + * You can provide any information here that might be useful in + * debugging functional system or link problems. + * + * Likely candidates for this output are the current status of + * any equalizers, preemphasis settings, etc that are platform + * specific and affect the performance of the SFP links but are otherwise + * opaque and unknown to the rest of the system. + * + */ +void +onlp_sfpi_debug(int port, aim_pvs_t* pvs) +{ + aim_printf(pvs, "Debug data for port %d goes here.", port); +} + +/* + * This is a generic ioctl interface. + */ +int +onlp_sfpi_ioctl(int port, va_list vargs) +{ + AIM_LOG_MSG("No ioctls supported."); + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/base/any/onlp/src/onlpie/module/src/sysi.c b/packages/base/any/onlp/src/onlpie/module/src/sysi.c new file mode 100644 index 00000000..5186aaab --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/sysi.c @@ -0,0 +1,186 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "onlpie_log.h" + + +/* + * This is the first function called by the ONLP framework. + * + * It should return the name of your platform driver. + * + * If the name of your platform driver is the same as the + * current platform then this driver will be used. + * + * If the name of the driver is different from the current + * platform, or the driver is capable of supporting multiple + * platform variants, see onlp_sysi_platform_set() below. + */ +const char* +onlp_sysi_platform_get(void) +{ + return "onlp-example-platform-driver"; +} + +/* + * This function will be called if onlp_sysi_platform_get() + * returns a platform name that is not equal to the current platform. + * + * If you are compatible with the given platform then return ONLP_STATUS_OK. + * If you can are not compatible return ONLP_STATUS_E_UNSUPPORTED. + * - This is fatal and will abort platform initialization. + */ + +int +onlp_sysi_platform_set(const char* name) +{ + /* + * For the purposes of this example we + * accept all platforms. + */ + return ONLP_STATUS_OK; +} + +/* + * This is the first function the ONLP framework will call + * after it has validated the the platform is supported using the mechanisms + * described above. + * + * If this function does not return ONL_STATUS_OK + * then platform initialization is aborted. + */ +int +onlp_sysi_init(void) +{ + AIM_LOG_MSG("%s", __func__); + return ONLP_STATUS_OK; +} + + +/* + * This function is called to return the physical base address + * of the ONIE boot rom. + * + * The ONLP framework will mmap() and parse the ONIE TLV structure + * from the given data. + * + * If you platform does not support a mappable address for the ONIE + * eeprom then you should not provide this function at all. + * + * For the purposes of this example we will provide it but + * return UNSUPPORTED (which is all the default implementation does). + * + */ +int +onlp_sysi_onie_data_phys_addr_get(void** pa) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * If you cannot provide a base address you must provide the ONLP + * framework the raw ONIE data through whatever means necessary. + * + * This function will be called as a backup in the event that + * onlp_sysi_onie_data_phys_addr_get() fails. + */ +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ + /* + * This represents the example ONIE data. + */ + static uint8_t onie_data[] = { + 'T', 'l', 'v','I','n','f','o', 0, + 0x1, 0x0, 0x0, + 0x21, 0x8, 'O', 'N', 'L', 'P', 'I', 'E', 0, 0, + 0x22, 0x3, 'O', 'N', 'L', + 0xFE, 0x4, 0x4b, 0x1b, 0x1d, 0xde, + }; + + if(onie_data[9] == 0 && onie_data[10] == 0) { + int len = sizeof(onie_data); + len -= 11; + onie_data[9] = (len & 0xFF00) >> 8; + onie_data[10] = (len & 0xFF); + } + + *data = onie_data; + return 0; +} + +/* + * IF the ONLP frame calles onlp_sysi_onie_data_get(), + * if will call this function to free the data when it + * is finished with it. + * + * This function is optional, and depends on the data + * you return in onlp_sysi_onie_data_get(). + */ +void +onlp_sysi_onie_data_free(uint8_t* data) +{ + /* + * We returned a static array in onlp_sysi_onie_data_get() + * so no free operation is required. + */ +} + +void +onlp_sysi_platform_manage(void) +{ + /* + *This function would normally implement things like the + * the thermal planning. + */ +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* This example supports 2 Thermal sensors on the chassis */ + *e++ = ONLP_THERMAL_ID_CREATE(1); + *e++ = ONLP_THERMAL_ID_CREATE(2); + + /* 3 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + *e++ = ONLP_PSU_ID_CREATE(3); + + /* 2 Fans */ + *e++ = ONLP_FAN_ID_CREATE(1); + *e++ = ONLP_FAN_ID_CREATE(2); + + /* 2 LEDs */ + *e++ = ONLP_LED_ID_CREATE(1); + *e++ = ONLP_LED_ID_CREATE(2); + + return 0; +} + diff --git a/packages/base/any/onlp/src/onlpie/module/src/thermali.c b/packages/base/any/onlp/src/onlpie/module/src/thermali.c new file mode 100644 index 00000000..646dcb81 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/module/src/thermali.c @@ -0,0 +1,63 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include "onlpie_log.h" + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + AIM_LOG_MSG("%s", __func__); + return ONLP_STATUS_OK; +} + + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv) +{ + /* Static values */ + onlp_thermal_info_t info[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal Sensor 1", 0}, 0x1, + ONLP_THERMAL_CAPS_ALL, + 23100, { 35000, 50000, 60000 }, }, + { { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal Sensor 2", 0}, 0x0, 0 } + }; + *rv = info[ONLP_OID_ID_GET(id)]; + + return ONLP_STATUS_OK; +} diff --git a/packages/base/any/onlp/src/onlpie/onlpie.doxy b/packages/base/any/onlp/src/onlpie/onlpie.doxy new file mode 100644 index 00000000..06b369d5 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/onlpie.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "onlpie" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Open Network Platform Linux Example Implementation." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/onlpie/utest/_make.mk b/packages/base/any/onlp/src/onlpie/utest/_make.mk new file mode 100644 index 00000000..2d4c5b37 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/utest/_make.mk @@ -0,0 +1,8 @@ +############################################################################### +# +# onlpie Unit Test Makefile. +# +############################################################################### +UMODULE := onlpie +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/onlp/src/onlpie/utest/main.c b/packages/base/any/onlp/src/onlpie/utest/main.c new file mode 100644 index 00000000..87156e81 --- /dev/null +++ b/packages/base/any/onlp/src/onlpie/utest/main.c @@ -0,0 +1,38 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#include +#include +#include +#include + +int aim_main(int argc, char* argv[]) +{ + printf("onlpie Utest Is Empty\n"); + onlpie_config_show(&aim_pvs_stdout); + return 0; +} + diff --git a/packages/base/any/onlp/src/onlplib/Makefile b/packages/base/any/onlp/src/onlplib/Makefile new file mode 100644 index 00000000..59f2aa68 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/Makefile @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +include ../../init.mk +MODULE := onlplib +AUTOMODULE := onlplib +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/onlplib/README b/packages/base/any/onlp/src/onlplib/README new file mode 100644 index 00000000..ad149ea1 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/README @@ -0,0 +1,6 @@ +############################################################################### +# +# onlplib README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/onlplib/module/auto/make.mk b/packages/base/any/onlp/src/onlplib/module/auto/make.mk new file mode 100644 index 00000000..39183429 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/auto/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlplib Autogeneration +# +############################################################ + +onlplib_AUTO_DEFS := module/auto/onlplib.yml +onlplib_AUTO_DIRS := module/inc/onlplib module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/onlplib/module/auto/onlplib.yml b/packages/base/any/onlp/src/onlplib/module/auto/onlplib.yml new file mode 100644 index 00000000..b13f63ab --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/auto/onlplib.yml @@ -0,0 +1,73 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlplib Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- ONLPLIB_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- ONLPLIB_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- ONLPLIB_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: ONLPLIB_CONFIG_PORTING_STDLIB +- ONLPLIB_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- ONLPLIB_CONFIG_INCLUDE_I2C: + doc: "Include Userspace I2C support." + default: 1 +- ONLPLIB_CONFIG_I2C_BLOCK_SIZE: + doc: "Maximum read and write block size." + default: 32 +- ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER: + doc: "Include the custom i2c header (include/linux/i2c-devices.h) to avoid conflicts with the kernel and i2c-dev packages." + default: 1 + +definitions: + cdefs: + ONLPLIB_CONFIG_HEADER: + defs: *cdefs + basename: onlplib_config + + portingmacro: + ONLPLIB: + macros: + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen + - atoi \ No newline at end of file diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/crc32.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/crc32.h new file mode 100644 index 00000000..df6926dc --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/crc32.h @@ -0,0 +1,40 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * CRC32 Calculations + * + ***********************************************************/ +#ifndef __ONLP_CRC32_H__ +#define __ONLP_CRC32_H__ + +#include + +/** + * @brief Calculate CRC32 on the given data buffer. + * @param crc CRC start + * @param buf The data buffer + * @param size The size of the data buffer. + * @returns The CRC32 value. + */ + +uint32_t onlp_crc32(uint32_t crc, const void *buf, int size); + +#endif /* __ONLP_CRC32_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/file.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/file.h new file mode 100644 index 00000000..ff1a6ca9 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/file.h @@ -0,0 +1,146 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLPLIB_FILE_H__ +#define __ONLPLIB_FILE_H__ + +#include + +/** + * @brief Read and return the contents of the given file. + * @param data Receives the data. + * @param max Maximum read size. + * @param len Receives the actual read length. + * @param fmt The filename format string. + * @param vargs The filename format string arguments. + */ +int onlp_file_vread(uint8_t* data, int max, int* len, const char* fmt, va_list vargs); + +/** + * @brief Read and return the contents of the given file. + * @param data Receives the data. + * @param max Maximum read size. + * @param len Receives the actual read length. + * @param fmt The filename format string. + * @param ... The filename format string arguments. + */ +int onlp_file_read(uint8_t* data, int max, int* len, const char* fmt, ...); + +/** + * @brief Read and return the integer contents of the given file. + * @param value Receives the integer value. + * @param fmt The filename format string. + * @param vargs The filename format string arguments. + */ +int onlp_file_vread_int(int* value, const char* fmt, va_list vargs); + +/** + * @brief Read and return the integer contents of the given file. + * @param value Receives the integer value. + * @param fmt The filename format string. + * @param ... The filename format string arguments. + */ +int onlp_file_read_int(int* value, const char* fmt, ...); + +/** + * @brief Read and return the maximum integer value contained in the given files. + * @param value Receives the maximum integer value. + * @param files Null terminated file list. + */ +int onlp_file_read_int_max(int* value, char** files); + +/** + * @brief Write data to the given file. + * @param data The data to write. + * @param len The length of the data. + * @param fmt The filename format string. + * @param vargs The filename format string arguments. + */ +int onlp_file_vwrite(uint8_t* data, int len, const char* fmt, va_list vargs); + +/** + * @brief Write data to the given file. + * @param data The data to write. + * @param len The length of the data. + * @param fmt The filename format string. + * @param ... The filename format string arguments. + */ +int onlp_file_write(uint8_t* data, int len, const char* fmt, ...); + + +/** + * @brief Write a string to the given file. + * @param str The string to write. + * @param fmt The filename format string. + * @param vargs The filename format string arguments. + */ +int onlp_file_vwrite_str(const char* str, const char* fmt, va_list vargs); + + +/** + * @brief Write a string to the given file. + * @param str The string to write. + * @param fmt The filename format string. + * @param ... The filename format string arguments. + */ +int onlp_file_write_str(const char* str, const char* fmt, ...); + +/** + * @brief Write an integer as a string to the given file. + * @param value The integer. + * @param fmt The filename format string. + * @param vargs The filename format string arguments. + */ +int onlp_file_vwrite_int(int value, const char* fmt, va_list vargs); + +/** + * @brief Write an integer as a string to the given file. + * @param value The integer. + * @param fmt The filename format string. + * @param ... The filename format string arguments. + */ +int onlp_file_write_int(int value, const char* fmt, ...); + + +/** + * @brief Open a file. + * @param flags The open flags + * @param fmt The filename format string + * @param ... The format arguments. + */ +int onlp_file_open(int flags, int log, const char* fmt, ...); + + +/** + * @brief Open a file. + * @param flags The open flags. + * @param fmt The filename format string. + * @param vargs The format arguments. + */ +int onlp_file_vopen(int flags, int log, const char* fmt, va_list vargs); + + + + +#endif /* __ONLPLIB_FILE_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/gpio.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/gpio.h new file mode 100644 index 00000000..3b26cc54 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/gpio.h @@ -0,0 +1,61 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_GPIO_H__ +#define __ONLP_GPIO_H__ + +#include + +typedef enum onlp_gpio_direction_e { + ONLP_GPIO_DIRECTION_NONE, + ONLP_GPIO_DIRECTION_IN, + ONLP_GPIO_DIRECTION_OUT, + ONLP_GPIO_DIRECTION_LOW, + ONLP_GPIO_DIRECTION_HIGH, +} onlp_gpio_direction_t; + +/** + * @brief Export the given GPIO and set its direction. + * @param gpio The gpio number. + * @param dir The gpio direction. + */ +int onlp_gpio_export(int gpio, onlp_gpio_direction_t dir); + +/** + * @brief Set the given GPIO value. + * @param gpio The gpio number. + * @param v The value to set. + * @param ... Additional GPIO and Value parameters. + */ +int onlp_gpio_set(int gpio, int v); + +/** + * @brief Get the given GPIO value. + * @param gpio The gpio number. + * @returns Returns the value or negative on error. + */ +int onlp_gpio_get(int gpio, int* rv); + + +#endif /* __ONLP_GPIO_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h new file mode 100644 index 00000000..b33df882 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h @@ -0,0 +1,155 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Common I2C processing for all platform implementations. + * + ***********************************************************/ +#ifndef __ONLP_I2C_H__ +#define __ONLP_I2C_H__ + +#include + +#if ONLPLIB_CONFIG_INCLUDE_I2C == 1 + +/** + * Use TENBIT mode. Default is to disable TENBIT mode. + */ +#define ONLP_I2C_F_TENBIT 0x1 + +/** + * Use SLAVE_FORCE instead of SLAVE when setting the + * i2c slave address. + */ +#define ONLP_I2C_F_FORCE 0x2 + +/** + * Enable PEC. + */ +#define ONLP_I2C_F_PEC 0x4 + +/** + * @brief Open and prepare for reading or writing. + * @param bus The i2c bus number. + * @param addr The slave address. + * @param flags See ONLP_I2C_F_* + * @note Normal applications will not use this function directly. + */ +int onlp_i2c_open(int bus, uint8_t addr, uint32_t flags); + + +/** + * @brief Read i2c data. + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param size The byte count. + * @param rdata [out] Receives the data. + * @param flags See ONLP_I2C_F_* + * @note This function reads a byte at a time. + * See onlp_i2c_read_block() for block reads. + */ + +int onlp_i2c_read(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* rdata, uint32_t flags); + +/** + * @brief Read i2c data blocks. + * @param bus The i2c bus number. + * @param add The slave address. + * @param offset The starting offset. + * @param size The byte count. + * @param flags Seel ONLP_I2C_F_* + * @note This function reads in increments of ONLPLIB_CONFIG_I2C_BLOCK_SIZE + */ +int onlp_i2c_block_read(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* rdata, uint32_t flags); + +/** + * @brief Write i2c data. + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param size The byte count. + * @param data The data to write. + * @param flags See ONLP_I2C_F_* + */ +int onlp_i2c_write(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* data, uint32_t flags); + +/** + * @brief Read a single byte over i2c + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param flags See ONLP_I2C_F_* + * @returns The byte if successfull, errno on error. + */ +int onlp_i2c_readb(int bus, uint8_t addr, uint8_t offset, uint32_t flags); + +/** + * @brief Write a single byte over i2c + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param byte The byte + * @param flags See ONLP_I2C_F_* + */ +int onlp_i2c_writeb(int bus, uint8_t addr, uint8_t offset, uint8_t byte, + uint32_t flags); + + +/** + * @brief Modify a single byte over i2c + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param andmask The and mask. + * @param ormask The or mask. + * @param flags See ONLP_I2C_F_* + */ +int onlp_i2c_modifyb(int bus, uint8_t addr, uint8_t offset, + uint8_t andmask, uint8_t ormask, uint32_t flags); + +/** + * @brief Read a word over i2c + * @param bus The i2c bus number. + * @param addr The address. + * @param offset The byte offset. + * @param flags See ONLP_I2C_F_* + * @returns The word if successfull, errno on error. + */ +int onlp_i2c_readw(int bus, uint8_t addr, uint8_t offset, uint32_t flags); + +/** + * @brief Write a word over i2c + * @param bus The i2c bus number. + * @param addr The slave address. + * @param offset The byte offset. + * @param byte The byte + * @param flags See ONLP_I2C_F_* + */ +int onlp_i2c_writew(int bus, uint8_t addr, uint8_t offset, uint16_t word, + uint32_t flags); + + +#endif /* ONLPLIB_CONFIG_INCLUDE_I2C */ + +#endif /* __ONLP_I2C_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/mmap.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/mmap.h new file mode 100644 index 00000000..06fa7d5a --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/mmap.h @@ -0,0 +1,44 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Common mmap() platform support. + * + ***********************************************************/ +#ifndef __ONLP_MMAP_H__ +#define __ONLP_MMAP_H__ + +#include +#include +#include + +/** + * @brief Map a physical address range. + * @param addr The physical + * @param size The size of the region to map. + * @param name The name of the memory region for debugging/logging purposes. + */ +void* onlp_mmap(off_t pa, uint32_t size, const char* name); + + + + + +#endif /* __ONLP_MMAP_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onie.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onie.h new file mode 100644 index 00000000..89e9255a --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onie.h @@ -0,0 +1,103 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Common ONIE Infrastructure Support. + * + ***********************************************************/ +#ifndef __ONLP_ONIE_H__ +#define __ONLP_ONIE_H__ + +#include +#include +#include +#include + +/** + * The ONIE specification defines the format of the system + * eeprom and the available fields that may be described there. + * + * This structure contains the decoded fields for application + * and platform use. + */ + +typedef struct onlp_onie_info_s { + + char* product_name; + char* part_number; + char* serial_number; + uint8_t mac[6]; + char* manufacture_date; + uint8_t device_version; + char* label_revision; + char* platform_name; + char* onie_version; + uint16_t mac_range; + char* manufacturer; + char* country_code; + char* vendor; + char* diag_version; + char* service_tag; + uint32_t crc; + + /** + * Vendor Extensions list, if available. + */ + list_head_t vx_list; + + /* Internal/debug */ + char* _hdr_id_string; + uint8_t _hdr_version; + uint8_t _hdr_length; + uint8_t _hdr_valid_crc; + +} onlp_onie_info_t; + + +typedef struct onlp_onie_vx_s { + list_links_t links; + uint8_t data[256]; + int size; +} onlp_onie_vx_t; + +/** + * Support for parsing ONIE eeprom data into the + * ONIE information structure is provided for all platforms. + */ + +int onlp_onie_decode(onlp_onie_info_t* rv, const uint8_t* data, int size); +int onlp_onie_decode_file(onlp_onie_info_t* rv, const char* file); + +/** + * Free an ONIE info structure. + */ +void onlp_onie_info_free(onlp_onie_info_t* info); + +/** + * Show the contents of an ONIE info structure. + */ +void onlp_onie_show(onlp_onie_info_t* info, aim_pvs_t* pvs); + +/** + * Dump the contents of an ONIE info structure as JSON + */ +void onlp_onie_show_json(onlp_onie_info_t* info, aim_pvs_t* pvs); + +#endif /* __ONLP_ONIE_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib.x b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib.x new file mode 100644 index 00000000..f8b4ac4d --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib.x @@ -0,0 +1,34 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_config.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_config.h new file mode 100644 index 00000000..fa79310d --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_config.h @@ -0,0 +1,183 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + + +/**************************************************************************//** + * + * @file + * @brief onlplib Configuration Header + * + * @addtogroup onlplib-config + * @{ + * + *****************************************************************************/ +#ifndef __ONLPLIB_CONFIG_H__ +#define __ONLPLIB_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef ONLPLIB_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * ONLPLIB_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef ONLPLIB_CONFIG_INCLUDE_LOGGING +#define ONLPLIB_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT +#define ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * ONLPLIB_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef ONLPLIB_CONFIG_LOG_BITS_DEFAULT +#define ONLPLIB_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * ONLPLIB_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef ONLPLIB_CONFIG_PORTING_STDLIB +#define ONLPLIB_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLPLIB_CONFIG_PORTING_STDLIB +#endif + +/** + * ONLPLIB_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef ONLPLIB_CONFIG_INCLUDE_UCLI +#define ONLPLIB_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * ONLPLIB_CONFIG_INCLUDE_I2C + * + * Include Userspace I2C support. */ + + +#ifndef ONLPLIB_CONFIG_INCLUDE_I2C +#define ONLPLIB_CONFIG_INCLUDE_I2C 1 +#endif + +/** + * ONLPLIB_CONFIG_I2C_BLOCK_SIZE + * + * Maximum read and write block size. */ + + +#ifndef ONLPLIB_CONFIG_I2C_BLOCK_SIZE +#define ONLPLIB_CONFIG_I2C_BLOCK_SIZE 32 +#endif + +/** + * ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER + * + * Include the custom i2c header (include/linux/i2c-devices.h) to avoid conflicts with the kernel and i2c-dev packages. */ + + +#ifndef ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER +#define ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER 1 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct onlplib_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} onlplib_config_settings_t; + +/** Configuration settings table. */ +/** onlplib_config_settings table. */ +extern onlplib_config_settings_t onlplib_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* onlplib_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int onlplib_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "onlplib_porting.h" + +#endif /* __ONLPLIB_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_dox.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_dox.h new file mode 100644 index 00000000..d4d52d46 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_dox.h @@ -0,0 +1,51 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/**************************************************************************//** + * + * onlplib Doxygen Header + * + *****************************************************************************/ +#ifndef __ONLPLIB_DOX_H__ +#define __ONLPLIB_DOX_H__ + +/** + * @defgroup onlplib onlplib - onlplib Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup onlplib-onlplib Public Interface + * @defgroup onlplib-config Compile Time Configuration + * @defgroup onlplib-porting Porting Macros + * + * @} + * + */ + +#endif /* __ONLPLIB_DOX_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_porting.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_porting.h new file mode 100644 index 00000000..678a4c6e --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/onlplib_porting.h @@ -0,0 +1,123 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + + +/**************************************************************************//** + * + * @file + * @brief onlplib Porting Macros. + * + * @addtogroup onlplib-porting + * @{ + * + *****************************************************************************/ +#ifndef __ONLPLIB_PORTING_H__ +#define __ONLPLIB_PORTING_H__ + + +/* */ +#if ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ONLPLIB_MEMSET + #if defined(GLOBAL_MEMSET) + #define ONLPLIB_MEMSET GLOBAL_MEMSET + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_MEMSET memset + #else + #error The macro ONLPLIB_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ONLPLIB_MEMCPY GLOBAL_MEMCPY + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_MEMCPY memcpy + #else + #error The macro ONLPLIB_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define ONLPLIB_STRNCPY GLOBAL_STRNCPY + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_STRNCPY strncpy + #else + #error The macro ONLPLIB_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define ONLPLIB_VSNPRINTF GLOBAL_VSNPRINTF + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_VSNPRINTF vsnprintf + #else + #error The macro ONLPLIB_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define ONLPLIB_SNPRINTF GLOBAL_SNPRINTF + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_SNPRINTF snprintf + #else + #error The macro ONLPLIB_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_STRLEN + #if defined(GLOBAL_STRLEN) + #define ONLPLIB_STRLEN GLOBAL_STRLEN + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_STRLEN strlen + #else + #error The macro ONLPLIB_STRLEN is required but cannot be defined. + #endif +#endif + +#ifndef ONLPLIB_ATOI + #if defined(GLOBAL_ATOI) + #define ONLPLIB_ATOI GLOBAL_ATOI + #elif ONLPLIB_CONFIG_PORTING_STDLIB == 1 + #define ONLPLIB_ATOI atoi + #else + #error The macro ONLPLIB_ATOI is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ONLPLIB_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/pi.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/pi.h new file mode 100644 index 00000000..e5c55e90 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/pi.h @@ -0,0 +1,54 @@ +/************************************************************** + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************** + * + * Platform Information + * + ************************************************************/ +#ifndef __ONLPLIB_PI_H__ +#define __ONLPLIB_PI_H__ + +#include + +/** + * Platform Information + */ +typedef struct onlp_platform_info_s { + + /** + * CPLD Versions + * + * Describes the internal CPLD version numbers, if applicable. + * + */ + char* cpld_versions; + + /** + * Additional version or platform information. + */ + char* other_versions; + +} onlp_platform_info_t; + +void onlp_platform_info_show_json(onlp_platform_info_t* pi, aim_pvs_t* pvs); + +void onlp_platform_info_show(onlp_platform_info_t* pi, aim_pvs_t* pvs); + +#endif /* __ONLPLIB_PI_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/sfp.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/sfp.h new file mode 100644 index 00000000..074d00d8 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/sfp.h @@ -0,0 +1,65 @@ +/************************************************************** + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************** + * + * Common SFP support routines. + * + ************************************************************/ +#ifndef __ONLPLIB_SFP_H__ +#define __ONLPLIB_SFP_H__ +#include + +/** + * + * @brief Determine SFP Presence from the given file. + * @param fname The filename + * @param present The string value that indicates 'SFP is present'. + * @param notpresent The string valud that indicates 'SFP is absent'. + * @notes If your SFP module presence is indicated through + * a file (like a GPIO) then you can use this to implement + * your onlp_sfpi_is_present() interface. + */ + +int onlplib_sfp_is_present_file(const char* fname, + const char* present, + const char* notpresent); +/** + * @brief Reset an SFP using writes to the given file. + * @param fname The filename. + * @param first This string will be written to the file. + * @param delay The amount of time to wait before the second write. + * @param second If specified, this string will be written to the + * the file after waiting the given delay. + * @notes If your SFP module reset is performed through + * a file (like a GPIO) you can use this function to implement your + * onlp_sfpi_reset() vector. + */ +int onlplib_sfp_reset_file(const char* file, const char* first, int delay_ms, + const char* second); +/** + * @brief Read an SFP eeprom from the given file. + * @param fname The filename. + * @param data Receives the data. + * @notes If your SFP module's eeprom is exported via a file + * (usually in /sys) then you can use this function + * to implement your onlp_sfpi_eeprom_read() interface. */ +int onlplib_sfp_eeprom_read_file(const char* fname, uint8_t data[256]); + +#endif /* __ONLPLIB_SFP_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/shlocks.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/shlocks.h new file mode 100644 index 00000000..9b7215a0 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/shlocks.h @@ -0,0 +1,103 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __ONLP_SHLOCKS_H__ +#define __ONLP_SHLOCKS_H__ + +#include +#include +#include + +typedef struct onlp_shlock_s onlp_shlock_t; + +/** + * @brief Create or retreive a shared memory region. + * @param id The shared memory id. + * @param size The size of the shared memory region (Only applicable for creation). + * @param rv [out] Receives the shared memory pointer. + * @returns 1 if the shared memory was newly created. + * @returns 0 if the shared memory already existing. + * @returns < 0 on error. + */ +int onlp_shmem_create(key_t id, uint32_t size, void** rv); + + +/** + * @brief Create a shared memory IPC mutex with the given id. + * @param The shared memory id. + * @param rv Receives the shared mutex. + */ +int onlp_shlock_create(key_t id, onlp_shlock_t** rv, + const char* name, ...); + +/** + * @brief Destroy a shared memory IPC mutex. + * @param shlock The shared mutex. + */ +int onlp_shlock_destroy(onlp_shlock_t* shlock); + +/** + * @brief Take a shared memory lock. + * @param shlock The shared lock. + */ +int onlp_shlock_take(onlp_shlock_t* shlock); + +/** + * @brief Give a shared memory lock. + * @param shlock The shared lock. + */ +int onlp_shlock_give(onlp_shlock_t* shlock); + +/** + * @brief Get a shared lock's name + * @param lock The lock. + */ +const char* onlp_shlock_name(onlp_shlock_t* lock); + + +/** + * A single global lock is always initialized + * and ready at startup. + */ +#define ONLP_SHLOCK_GLOBAL_KEY 0xF00DF00D + +/** + * @brief Initialize the global lock. + * @note You don't normally need to call this as + * it is performed at module initialization time. + */ +void onlp_shlock_global_init(void); + +/** + * @brief Take the global lock. + */ +int onlp_shlock_global_take(void); + +/** + * @brief Give the global lock. + */ +int onlp_shlock_global_give(void); + + +#endif /* __ONLP_SHLOCKS_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/util.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/util.h new file mode 100644 index 00000000..0c0e21e8 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/util.h @@ -0,0 +1,109 @@ +/************************************************************** + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************** + * + * Utilities + * + ************************************************************/ +#ifndef __ONLPLIB_UTIL_H__ +#define __ONLPLIB_UTIL_H__ + +#include + +#define ONLP_BITMASK(_bit) ( 1 << (_bit)) + +/** + * Set and & or masks for active low bits. + */ +#define ONLP_ACTIVE_LOW_MASKS(_enable, _bitmask, _andmask, _ormask) \ + do { \ + _andmask = (_enable) ? ~(_bitmask) : ~0; \ + _ormask = (_enable) ? 0 : (_bitmask); \ + } while(0) + +#define ONLP_ACTIVE_LOW_MASKS_BIT(_enable, _bit, _andmask, _ormask) \ + ONLP_ACTIVE_LOAS_MASKS(_enable, (1 << (_bit)), _andmask, _ormask) + +/** + * Set and & or masks for active high bits. + */ +#define ONLP_ACTIVE_HIGH_MASKS(_enable, _bitmask, _andmask, _ormask) \ + do { \ + _andmask = (_enable) ? ~0 : ~(_bitmask); \ + _ormask = (_enable) ? (_bitmask) : 0; \ + } while(0) + +#define ONLP_ACTIVE_HIGH_MASKS_BIT(_enable, _bit, _andmask, _ormask) \ + ONLP_ACTIVE_HIGH_MASKS(_enable, (1 << (_bit)), _andmask, _ormask) + + + +/** + * Range Checking + */ +#define ONLP_IN_RANGE(_v, _first, _last) \ + (((_v) >= _first) && ((_v) <= _last)) + +/** + * Bit Positions + */ +#define ONLP_BIT_POSITION(_size, _v, _offset, _bit) \ + do { \ + _offset = (_v) / (_size); \ + _bit = (_v) % (_size); \ + } while(0) + +#define ONLP_BITMASK_POSITION(_size, _v, _offset, _bitmask) \ + do { \ + ONLP_BIT_POSITION(_size, _v, _offset, _bitmask); \ + _bitmask = (1 << _bitmask); \ + } while(0) + +#define ONLP_BIT_POSITION_8(_v, _offset, _bit) \ + ONLP_BIT_POSITION(8, _v, _offset, _bit) +#define ONLP_BITMASK_POSITION_8(_v, _offset, _bitmask) \ + ONLP_BITMASK_POSITION(8, _v, _offset, _bitmask) + +#define ONLP_BIT_POSITION_16(_v, _offset, _bit) \ + ONLP_BIT_POSITION(16, _v, _offset, _bit) +#define ONLP_BITMASK_POSITION_16(_v, _offset, _bitmask) \ + ONLP_BITMASK_POSITION(16, _v, _offset, _bitmask) + +#define ONLP_BIT_POSITION_32(_v, _offset, _bit) \ + ONLP_BIT_POSITION(32, _v, _offset, _bit) +#define ONLP_BITMASK_POSITION_32(_v, _offset, _bitmask) \ + ONLP_BITMASK_POSITION(32, _v, _offset, _bitmask) + + +#define ONLP_VALIDATED_READ_AND_SHIFT_8(_read, _dst, _error) \ + do { \ + int _status = _read ; \ + if(_status < 0) { \ + return _error ; \ + } \ + else { \ + _dst <<= 8; \ + _dst |= _status; \ + } \ + } while(0) + + + +#endif /* __ONLPLIB_UTIL_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/make.mk b/packages/base/any/onlp/src/onlplib/module/make.mk new file mode 100644 index 00000000..846afa4f --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/make.mk @@ -0,0 +1,30 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +onlplib_INCLUDES := -I $(THIS_DIR)inc +onlplib_INTERNAL_INCLUDES := -I $(THIS_DIR)src +onlplib_DEPENDMODULE_ENTRIES := init:onlplib + diff --git a/packages/base/any/onlp/src/onlplib/module/src/crc32.c b/packages/base/any/onlp/src/onlplib/module/src/crc32.c new file mode 100644 index 00000000..22385644 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/crc32.c @@ -0,0 +1,104 @@ +/* + * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or + * code or tables extracted from it, as desired without restriction. + * + * First, the polynomial itself and its table of feedback terms. The + * polynomial is + * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 + * + * Note that we take it "backwards" and put the highest-order term in + * the lowest-order bit. The X^32 term is "implied"; the LSB is the + * X^31 term, etc. The X^0 term (usually shown as "+1") results in + * the MSB being 1 + * + * Note that the usual hardware shift register implementation, which + * is what we're using (we're merely optimizing it by doing eight-bit + * chunks at a time) shifts bits into the lowest-order term. In our + * implementation, that means shifting towards the right. Why do we + * do it this way? Because the calculated CRC must be transmitted in + * order from highest-order term to lowest-order term. UARTs transmit + * characters in order from LSB to MSB. By storing the CRC this way + * we hand it to the UART in the order low-byte to high-byte; the UART + * sends each low-bit to hight-bit; and the result is transmission bit + * by bit from highest- to lowest-order term without requiring any bit + * shuffling on our part. Reception works similarly + * + * The feedback terms table consists of 256, 32-bit entries. Notes + * + * The table can be generated at runtime if desired; code to do so + * is shown later. It might not be obvious, but the feedback + * terms simply represent the results of eight shift/xor opera + * tions for all combinations of data and CRC register values + * + * The values must be right-shifted by eight bits by the "updcrc + * logic; the shift must be unsigned (bring in zeroes). On some + * hardware you could probably optimize the shift in assembler by + * using byte-swap instructions + * polynomial $edb88320 + * + * + * CRC32 code derived from work by Gary S. Brown. + */ + +#include + +static uint32_t crc32_tab[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t +onlp_crc32(uint32_t crc, const void *buf, int size) +{ + const uint8_t *p; + + p = buf; + crc = crc ^ ~0U; + + while (size--) + crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); + + return crc ^ ~0U; +} + diff --git a/packages/base/any/onlp/src/onlplib/module/src/file.c b/packages/base/any/onlp/src/onlplib/module/src/file.c new file mode 100644 index 00000000..4d1ef1f7 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/file.c @@ -0,0 +1,221 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include "onlplib_log.h" +#include +#include + +int +onlp_file_vread(uint8_t* data, int max, int* len, const char* fmt, va_list vargs) +{ + int fd; + char fname[PATH_MAX]; + int rv; + + ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs); + + if ((fd = open(fname, O_RDONLY)) == -1) { + rv = ONLP_STATUS_E_MISSING; + } + else { + if ((*len = read(fd, data, max)) <= 0) { + AIM_LOG_ERROR("Failed to read input file '%s'", fname); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + close(fd); + } + return rv; +} + +int +onlp_file_read(uint8_t* data, int max, int* len, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vread(data, max, len, fmt, vargs); + va_end(vargs); + return rv; +} + +int +onlp_file_vread_int(int* value, const char* fmt, va_list vargs) +{ + int rv; + uint8_t data[32]; + int len; + rv = onlp_file_vread(data, sizeof(data), &len, fmt, vargs); + if(rv < 0) { + return rv; + } + *value = ONLPLIB_ATOI((char*)data); + return 0; + +} + +int +onlp_file_read_int(int* value, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vread_int(value, fmt, vargs); + va_end(vargs); + return rv; +} + +int +onlp_file_read_int_max(int* value, char** files) +{ + char** s = NULL; + int max = 0; + + if(value == NULL || files == NULL || *files == NULL) { + return ONLP_STATUS_E_PARAM; + } + + *value = 0; + + for(s = files; *s; s++) { + int value = 0; + int rv = onlp_file_read_int(&value, *s); + if(rv < 0) { + return rv; + } + if(max < value) { + max = value; + } + } + + *value = max; + return 0; +} + +int +onlp_file_vwrite(uint8_t* data, int len, const char* fmt, va_list vargs) +{ + int fd; + char fname[PATH_MAX]; + int rv; + int wlen; + + ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs); + + if ((fd = open(fname, O_WRONLY)) == -1) { + rv = ONLP_STATUS_E_MISSING; + } + else { + if ((wlen = write(fd, data, len)) != len) { + AIM_LOG_ERROR("Failed to write output file '%s'", fname); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + close(fd); + } + return rv; +} + +int +onlp_file_write(uint8_t* data, int len, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vwrite(data, len, fmt, vargs); + va_end(vargs); + return rv; +} + +int +onlp_file_vwrite_str(const char* str, const char* fmt, va_list vargs) +{ + return onlp_file_vwrite((uint8_t*)str, strlen(str)+1, fmt, vargs); +} + +int +onlp_file_write_str(const char* str, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vwrite_str(str, fmt, vargs); + va_end(vargs); + return rv; +} + +int +onlp_file_vwrite_int(int value, const char* fmt, va_list vargs) +{ + int rv; + char* s = aim_fstrdup("%d", value); + rv = onlp_file_vwrite_str(s, fmt, vargs); + aim_free(s); + return rv; +} + +int +onlp_file_write_int(int value, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vwrite_int(value, fmt, vargs); + va_end(vargs); + return rv; +} + +int +onlp_file_open(int flags, int log, const char* fmt, ...) +{ + int rv; + va_list vargs; + va_start(vargs, fmt); + rv = onlp_file_vopen(flags, log, fmt, vargs); + va_end(vargs); + return rv; +} + + +int +onlp_file_vopen(int flags, int log, const char* fmt, va_list vargs) +{ + int rv; + char fname[PATH_MAX]; + ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs); + rv = open(fname, flags); + if(rv < 0 && log) { + AIM_LOG_ERROR("failed to open file %s (0x%x): %{errno}", fname, flags, errno); + } + return rv; +} diff --git a/packages/base/any/onlp/src/onlplib/module/src/gpio.c b/packages/base/any/onlp/src/onlplib/module/src/gpio.c new file mode 100644 index 00000000..73c70cbf --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/gpio.c @@ -0,0 +1,90 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "onlplib_log.h" + +#define SYS_CLASS_GPIO_PATH "/sys/class/gpio/gpio%d" + +int +onlp_gpio_export(int gpio, onlp_gpio_direction_t direction) +{ + int fd; + int rv; + fd = onlp_file_open(O_RDONLY, 0, SYS_CLASS_GPIO_PATH, gpio); + if(fd < 0) { + /* Not exported yet */ + char g[32]; + ONLPLIB_SNPRINTF(g, sizeof(g)-1, "%d\n", gpio); + rv = onlp_file_write_str(g, "/sys/class/gpio/export"); + if(rv < 0) { + AIM_LOG_ERROR("Exporting gpio %d failed.", gpio); + return -1; + } + } + close(fd); + + const char* s; + switch(direction) + { + case ONLP_GPIO_DIRECTION_NONE: s = NULL; break; /* Don't set direction */ + case ONLP_GPIO_DIRECTION_IN: s = "in\n"; break; + case ONLP_GPIO_DIRECTION_OUT: s = "out\n"; break; + case ONLP_GPIO_DIRECTION_LOW: s = "low\n"; break; + case ONLP_GPIO_DIRECTION_HIGH: s = "high\n"; break; + default: + return ONLP_STATUS_E_PARAM; + } + + if(s) { + rv = onlp_file_write_str(s, SYS_CLASS_GPIO_PATH "/direction", gpio); + if(rv < 0) { + AIM_LOG_MSG("Failed to set gpio%d direction=%s: %{errno}", + gpio, direction, errno); + return -1; + } + } + return 0; +} + +int +onlp_gpio_set(int gpio, int v) +{ + char* str = (v) ? "1\n" : "0\n"; + return onlp_file_write((uint8_t*)str, strlen(str), + SYS_CLASS_GPIO_PATH "/value", gpio); +} + +int +onlp_gpio_get(int gpio, int* v) +{ + return onlp_file_read_int(v, SYS_CLASS_GPIO_PATH "/value", gpio); +} + diff --git a/packages/base/any/onlp/src/onlplib/module/src/i2c.c b/packages/base/any/onlp/src/onlplib/module/src/i2c.c new file mode 100644 index 00000000..5758450f --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/i2c.c @@ -0,0 +1,258 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#if ONLPLIB_CONFIG_INCLUDE_I2C == 1 + +#include +#include +#include + +#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include "onlplib_log.h" + +int +onlp_i2c_open(int bus, uint8_t addr, uint32_t flags) +{ + int fd; + int rv; + + fd = onlp_file_open(O_RDWR, 1, "/dev/i2c-%d", bus); + if(fd < 0) { + return fd; + } + + /* Set 10 or 7 bit mode */ + rv = ioctl(fd, I2C_TENBIT, (flags & ONLP_I2C_F_TENBIT) ? 1 : 0); + if(rv != 0) { + AIM_LOG_ERROR("i2c-%d: failed to set %d bit mode", + (flags & ONLP_I2C_F_TENBIT) ? 10 : 7); + goto error; + } + + /* Enable/Disable PEC */ + rv = ioctl(fd, I2C_PEC, (flags & ONLP_I2C_F_PEC) ? 1 : 0); + if(rv != 0) { + AIM_LOG_ERROR("i2c-%d: failed to set PEC mode %d", + (flags & ONLP_I2C_F_PEC) ? 1 : 0); + goto error; + } + + /* Set SLAVE or SLAVE_FORCE address */ + rv = ioctl(fd, + (flags & ONLP_I2C_F_FORCE) ? I2C_SLAVE_FORCE : I2C_SLAVE, + addr); + + if(rv != 0) { + AIM_LOG_ERROR("i2c-%d: %s slave address 0x%x failed: %{errno}", + bus, + (flags & ONLP_I2C_F_FORCE) ? "forcing" : "setting", + errno); + goto error; + } + + return fd; + + error: + close(fd); + return -1; +} + +int +onlp_i2c_block_read(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* rdata, uint32_t flags) +{ + int fd; + + fd = onlp_i2c_open(bus, addr, flags); + + if(fd < 0) { + return fd; + } + + int count = size; + uint8_t* p = rdata; + while(count > 0) { + int rsize = (count >= ONLPLIB_CONFIG_I2C_BLOCK_SIZE) ? ONLPLIB_CONFIG_I2C_BLOCK_SIZE : count; + int rv = i2c_smbus_read_i2c_block_data(fd, + p - rdata, + rsize, + p); + + if(rv != rsize) { + AIM_LOG_ERROR("i2c-%d: reading address 0x%x, offset %d, size=%d failed: %{errno}", + bus, addr, p - rdata, rsize, errno); + goto error; + } + + p += rsize; + count -= rsize; + } + + close(fd); + return 0; + + error: + close(fd); + return -1; +} + +int +onlp_i2c_read(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* rdata, uint32_t flags) +{ + int i; + int fd; + + fd = onlp_i2c_open(bus, addr, flags); + + if(fd < 0) { + return fd; + } + + for(i = 0; i < size; i++) { + uint32_t rv = i2c_smbus_read_byte_data(fd, offset+i); + if(rv < 0) { + AIM_LOG_ERROR("i2c-%d: reading address 0x%x, offset %d failed: %{errno}", + bus, addr, offset+i, errno); + goto error; + } + else { + rdata[i] = rv; + } + } + close(fd); + return 0; + + error: + close(fd); + return -1; +} + + +int +onlp_i2c_write(int bus, uint8_t addr, uint8_t offset, int size, + uint8_t* data, uint32_t flags) +{ + int i; + int fd; + + fd = onlp_i2c_open(bus, addr, flags); + + if(fd < 0) { + return fd; + } + + for(i = 0; i < size; i++) { + uint32_t rv = i2c_smbus_write_byte_data(fd, offset+i, data[i]); + if(rv < 0) { + AIM_LOG_ERROR("i2c-%d: writing address 0x%x, offset %d failed: %{errno}", + bus, addr, offset+i, errno); + goto error; + } + } + close(fd); + return 0; + + error: + close(fd); + return -1; +} + +int +onlp_i2c_readb(int bus, uint8_t addr, uint8_t offset, uint32_t flags) +{ + uint8_t byte; + int rv = onlp_i2c_read(bus, addr, offset, 1, &byte, flags); + return (rv < 0) ? rv : byte; +} + +int +onlp_i2c_writeb(int bus, uint8_t addr, uint8_t offset, uint8_t byte, + uint32_t flags) +{ + return onlp_i2c_write(bus, addr, offset, 1, &byte, flags); +} + +int +onlp_i2c_modifyb(int bus, uint8_t addr, uint8_t offset, + uint8_t andmask, uint8_t ormask, uint32_t flags) +{ + int v; + ONLP_IF_ERROR_RETURN(v=onlp_i2c_readb(bus, addr, offset, flags)); + v &= andmask; + v |= ormask; + return onlp_i2c_writeb(bus, addr, offset, v, flags); +} + + +int +onlp_i2c_readw(int bus, uint8_t addr, uint8_t offset, uint32_t flags) +{ + int fd; + int rv; + + fd = onlp_i2c_open(bus, addr, flags); + + if(fd < 0) { + return fd; + } + + rv = i2c_smbus_read_word_data(fd, offset); + + close(fd); + return rv; +} + +int +onlp_i2c_writew(int bus, uint8_t addr, uint8_t offset, uint16_t word, + uint32_t flags) +{ + int fd; + int rv; + + fd = onlp_i2c_open(bus, addr, flags); + + if(fd < 0) { + return fd; + } + + rv = i2c_smbus_write_word_data(fd, offset, word); + + close(fd); + return rv; + +} + +#endif /* ONLPLIB_CONFIG_INCLUDE_I2C */ diff --git a/packages/base/any/onlp/src/onlplib/module/src/make.mk b/packages/base/any/onlp/src/onlplib/module/src/make.mk new file mode 100644 index 00000000..12386a47 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ + +LIBRARY := onlplib +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/onlplib/module/src/mmap.c b/packages/base/any/onlp/src/onlplib/module/src/mmap.c new file mode 100644 index 00000000..6d164b65 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/mmap.c @@ -0,0 +1,65 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "onlplib_log.h" +#include +#include +#include +#include +#include +#include + +void* +onlp_mmap(off_t pa, uint32_t size, const char* name) +{ + int msize = 0; + int psize = getpagesize(); + + msize = (((size / psize) + 1) * psize); + + int fd = open("/dev/mem", O_RDWR | O_SYNC); + + if(fd <= 0) { + AIM_LOG_ERROR("open(/dev/mem) failed: %{errno}", errno); + return NULL; + } + + uint8_t* memory = mmap(NULL, + msize, + PROT_READ | PROT_WRITE, + MAP_SHARED, + fd, + pa); + + close(fd); + + if(memory == MAP_FAILED) { + AIM_LOG_ERROR("mmap() pa=0x%llx size=%d name=%s failed: %{errno}", + pa, size, errno); + return NULL; + } + return memory; +} + diff --git a/packages/base/any/onlp/src/onlplib/module/src/onie.c b/packages/base/any/onlp/src/onlplib/module/src/onie.c new file mode 100644 index 00000000..2ce139f2 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onie.c @@ -0,0 +1,432 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * ONIE System Board Information decoding. + * + * See: + * https://github.com/onie/onie/blob/master/docs/design-spec/hw_requirements.rst + * + * This code derived from the feature-sys-eeprom-tlv.patch in the ONIE + * distribution. + * + ***********************************************************/ + +#include +#include + +#include +#include +#include + +#include + +#include "onlplib_log.h" + +#include + +/** + * Header Field Constants + */ +#define TLV_INFO_ID_STRING "TlvInfo" +#define TLV_INFO_VERSION 0x01 +#define TLV_INFO_MAX_LEN 2048 +#define TLV_TOTAL_LEN_MAX (TLV_INFO_MAX_LEN - sizeof(tlvinfo_header_t)) + +/** + * Validate checksum + */ +static int checksum_validate__(const uint8_t *data); + + +/** + * ONIE TLV EEPROM Header + */ +typedef struct __attribute__ ((__packed__)) tlvinfo_header_s { + char signature[8]; /* 0x00 - 0x07 EEPROM Tag "TlvInfo" */ + uint8_t version; /* 0x08 Structure version */ + uint16_t totallen; /* 0x09 - 0x0A Length of all data which follows */ +} tlvinfo_header_t; + +/** + * ONIE TLV Entry + */ +typedef struct __attribute__ ((__packed__)) tlvinfo_tlv_s { + uint8_t type; + uint8_t length; + uint8_t value[0]; +} tlvinfo_tlv_t; + + +/** + * The TLV Types. + */ +#define TLV_CODE_PRODUCT_NAME 0x21 +#define TLV_CODE_PART_NUMBER 0x22 +#define TLV_CODE_SERIAL_NUMBER 0x23 +#define TLV_CODE_MAC_BASE 0x24 +#define TLV_CODE_MANUF_DATE 0x25 +#define TLV_CODE_DEVICE_VERSION 0x26 +#define TLV_CODE_LABEL_REVISION 0x27 +#define TLV_CODE_PLATFORM_NAME 0x28 +#define TLV_CODE_ONIE_VERSION 0x29 +#define TLV_CODE_MAC_SIZE 0x2A +#define TLV_CODE_MANUF_NAME 0x2B +#define TLV_CODE_MANUF_COUNTRY 0x2C +#define TLV_CODE_VENDOR_NAME 0x2D +#define TLV_CODE_DIAG_VERSION 0x2E +#define TLV_CODE_SERVICE_TAG 0x2F +#define TLV_CODE_VENDOR_EXT 0xFD +#define TLV_CODE_CRC_32 0xFE + + +static void +decode_tlv__(onlp_onie_info_t* info, tlvinfo_tlv_t * tlv) +{ + switch (tlv->type) + { + /* String TLVs */ +#define CASE_TLV_STRING(_info, _member, _code, _tlv) \ + case TLV_CODE_##_code : \ + { \ + if(_info -> _member) { \ + aim_free((void*) _info -> _member); \ + } \ + _info -> _member = aim_zmalloc(_tlv->length + 1); \ + memcpy((void*) _info -> _member, _tlv->value, _tlv->length); \ + break; \ + } + + CASE_TLV_STRING(info, product_name, PRODUCT_NAME, tlv); + CASE_TLV_STRING(info, part_number, PART_NUMBER, tlv); + CASE_TLV_STRING(info, serial_number, SERIAL_NUMBER, tlv); + CASE_TLV_STRING(info, manufacture_date, MANUF_DATE, tlv); + CASE_TLV_STRING(info, label_revision, LABEL_REVISION, tlv); + CASE_TLV_STRING(info, platform_name, PLATFORM_NAME, tlv); + CASE_TLV_STRING(info, onie_version, ONIE_VERSION, tlv); + CASE_TLV_STRING(info, manufacturer, MANUF_NAME, tlv); + CASE_TLV_STRING(info, country_code, MANUF_COUNTRY, tlv); + CASE_TLV_STRING(info, vendor, VENDOR_NAME, tlv); + CASE_TLV_STRING(info, service_tag, SERVICE_TAG, tlv); + CASE_TLV_STRING(info, diag_version, DIAG_VERSION, tlv); + + case TLV_CODE_MAC_BASE: + memcpy(info->mac, tlv->value, 6); + break; + + case TLV_CODE_DEVICE_VERSION: + info->device_version = tlv->value[0]; + break; + + case TLV_CODE_MAC_SIZE: + info->mac_range = (tlv->value[0] << 8) | tlv->value[1]; + break; + + case TLV_CODE_VENDOR_EXT: + { + onlp_onie_vx_t* vx = aim_zmalloc(sizeof(*vx)); + vx->size = tlv->length; + memcpy(vx->data, tlv->value, tlv->length); + list_push(&info->vx_list, &vx->links); + break; + } + + case TLV_CODE_CRC_32: + info->crc = + (tlv->value[0] << 24) | + (tlv->value[1] << 16) | + (tlv->value[2] << 8) | + (tlv->value[3]); + break; + + default: + AIM_LOG_WARN("ONIE data contains an unrecognized TLV code: 0x%.2x (ignored)", tlv->type); + break; + } +} + +/** + * is_valid_tlvinfo_header + * + * Perform sanity checks on the first 11 bytes of the TlvInfo EEPROM + * data pointed to by the parameter: + * 1. First 8 bytes contain null-terminated ASCII string "TlvInfo" + * 2. Version byte is 1 + * 3. Total length bytes contain value which is less than or equal + * to the allowed maximum (2048-11) + * + */ +static inline int is_valid_tlvinfo_header__(tlvinfo_header_t *hdr) +{ + return( (strcmp(hdr->signature, TLV_INFO_ID_STRING) == 0) && + (hdr->version == TLV_INFO_VERSION) && + (ntohs(hdr->totallen) <= TLV_TOTAL_LEN_MAX) ); +} + + +/** + * is_valid_tlv + * + * Perform basic sanity checks on a TLV field. The TLV is pointed to + * by the parameter provided. + * 1. The type code is not reserved (0x00 or 0xFF) + */ +static inline int is_valid_tlv__(tlvinfo_tlv_t *tlv) +{ + return( (tlv->type != 0x00) && + (tlv->type != 0xFF) ); + +} + + +int +onlp_onie_decode(onlp_onie_info_t* rv, const uint8_t* data, int size) +{ + int tlv_end; + int curr_tlv; + tlvinfo_header_t* data_hdr = (tlvinfo_header_t *) data; + tlvinfo_tlv_t* data_tlv; + + if(rv == NULL || data == NULL || (size && size < sizeof(*data_hdr))) { + return -1; + } + + memset(rv, 0, sizeof(*rv)); + list_init(&rv->vx_list); + + if ( !is_valid_tlvinfo_header__(data_hdr) ) { + AIM_LOG_ERROR("ONIE data is not in TlvInfo format."); + return -1; + } + + rv->_hdr_id_string = aim_strdup(data_hdr->signature); + rv->_hdr_version = data_hdr->version; + rv->_hdr_length = ntohs(data_hdr->totallen); + + /* We only parse TLV Header Version 1 */ + if(rv->_hdr_version != 1) { + AIM_LOG_ERROR("ONIE data header version %d id string %s is not supported.", rv->_hdr_version, rv->_hdr_id_string); + return -1; + } + + /* Validate CRC checksum before attempting to parse */ + if(checksum_validate__(data) != 0) { + /* Error already logged */ + return -1; + } + + + curr_tlv = sizeof(tlvinfo_header_t); + tlv_end = sizeof(tlvinfo_header_t) + ntohs(data_hdr->totallen); + while (curr_tlv < tlv_end) { + data_tlv = (tlvinfo_tlv_t *) &data[curr_tlv]; + if (!is_valid_tlv__(data_tlv)) { + AIM_LOG_ERROR("ONIE data invalid TLV field starting at offset %d\n", curr_tlv); + return -1; + } + decode_tlv__(rv, data_tlv); + curr_tlv += sizeof(tlvinfo_tlv_t) + data_tlv->length; + } + + return 0; +} + +int +onlp_onie_decode_file(onlp_onie_info_t* onie, const char* file) +{ + char* data; + FILE* fp = fopen(file, "rb"); + int rv = -1; + + if(fp) { + fseek(fp, 0L, SEEK_END); + int size = ftell(fp); + rewind(fp); + data = aim_malloc(size); + + rv = fread(data, 1, size, fp); + fclose(fp); + + if(rv == size) { + rv = onlp_onie_decode(onie, (uint8_t*)data, size); + } + + aim_free(data); + } + return rv; +} + +/** + * Validate the checksum in the provided TlvInfo EEPROM data. First, + * verify that the TlvInfo header is valid, then make sure the last + * TLV is a CRC-32 TLV. Then calculate the CRC over the EEPROM data + * and compare it to the value stored in the EEPROM CRC-32 TLV. + */ +static int +checksum_validate__(const uint8_t *data) +{ + tlvinfo_header_t* data_hdr = (tlvinfo_header_t *) data; + tlvinfo_tlv_t* data_crc; + unsigned int calc_crc; + unsigned int stored_crc; + + // Is the eeprom header valid? + if (!is_valid_tlvinfo_header__(data_hdr)) { + return 0; + } + + // Is the last TLV a CRC? + data_crc = (tlvinfo_tlv_t *) &data[sizeof(tlvinfo_header_t) + + ntohs(data_hdr->totallen) - (sizeof(tlvinfo_tlv_t) + 4)]; + + if ((data_crc->type != TLV_CODE_CRC_32) || (data_crc->length != 4)) { + AIM_LOG_ERROR("ONIE CRC TLV is invalid."); + return 0; + } + + // Calculate the checksum + calc_crc = onlp_crc32(0, (void *)data, + sizeof(tlvinfo_header_t) + ntohs(data_hdr->totallen) - 4); + stored_crc = (data_crc->value[0] << 24) | + (data_crc->value[1] << 16) | + (data_crc->value[2] << 8) | + data_crc->value[3]; + + if(calc_crc != stored_crc) { + AIM_LOG_ERROR("ONIE data crc error: expected 0x%.8x calculated 0x%.8x", + stored_crc, calc_crc); + return -1; + } + return 0; +} + +void +onlp_onie_info_free(onlp_onie_info_t* info) +{ + if(info) { + aim_free(info->product_name); + aim_free(info->part_number); + aim_free(info->serial_number); + aim_free(info->manufacture_date); + aim_free(info->label_revision); + aim_free(info->platform_name); + aim_free(info->onie_version); + aim_free(info->manufacturer); + aim_free(info->country_code); + aim_free(info->vendor); + aim_free(info->diag_version); + aim_free(info->service_tag); + aim_free(info->_hdr_id_string); + + list_links_t *cur, *next; + LIST_FOREACH_SAFE(&info->vx_list, cur, next) { + onlp_onie_vx_t* vx = container_of(cur, links, onlp_onie_vx_t); + aim_free(vx); + } + } +} + +void +onlp_onie_show(onlp_onie_info_t* info, aim_pvs_t* pvs) +{ + iof_t iof; + iof_init(&iof, pvs); + if(info->product_name) { + iof_iprintf(&iof, "Product Name: %s", info->product_name); + } + if(info->part_number) { + iof_iprintf(&iof, "Part Number: %s", info->part_number); + } + if(info->serial_number) { + iof_iprintf(&iof, "Serial Number: %s", info->serial_number); + } + if(info->mac) { + iof_iprintf(&iof, "MAC: %{mac}", info->mac); + } + if(info->mac_range) { + iof_iprintf(&iof, "MAC Range: %d", info->mac_range); + } + if(info->manufacturer) { + iof_iprintf(&iof, "Manufacturer: %s", info->manufacturer); + } + if(info->manufacture_date) { + iof_iprintf(&iof, "Manufacture Date: %s", info->manufacture_date); + } + if(info->vendor) { + iof_iprintf(&iof, "Vendor: %s", info->vendor); + } + if(info->platform_name) { + iof_iprintf(&iof, "Platform Name: %s", info->platform_name); + } + if(info->device_version) { + iof_iprintf(&iof, "Device Version: %u", info->device_version); + } + if(info->label_revision) { + iof_iprintf(&iof, "Label Revision: %s", info->label_revision); + } + if(info->country_code) { + iof_iprintf(&iof, "Country Code: %s", info->country_code); + } + if(info->diag_version) { + iof_iprintf(&iof, "Diag Version: %s", info->diag_version); + } + if(info->service_tag) { + iof_iprintf(&iof, "Service Tag: %s", info->service_tag); + } + if(info->onie_version) { + iof_iprintf(&iof, "ONIE Version: %s", info->onie_version); + } +} + +void +onlp_onie_show_json(onlp_onie_info_t* info, aim_pvs_t* pvs) +{ + aim_printf(pvs, "{\n"); + +#define STROUT(_name, _member) \ + do { \ + aim_printf(pvs, " \"%s\" : ", #_name); \ + if(info-> _member) { \ + aim_printf(pvs, "\"%s\",\n", info->_member); \ + } \ + else { \ + aim_printf(pvs, "null,\n"); \ + } \ + } while(0) + + STROUT(Product Name, product_name); + STROUT(Part Number, part_number); + STROUT(Serial Number, serial_number); + aim_printf(pvs, " \"MAC\": \"%{mac}\", ", info->mac); + aim_printf(pvs, " \"MAC Range\": %d,\n", info->mac_range); + STROUT(Manufacture Date,manufacture_date); + STROUT(Vendor,vendor); + STROUT(Platform Name,platform_name); + aim_printf(pvs, " \"Device Version\": %u,\n", info->device_version); + STROUT(Label Revision,label_revision); + STROUT(Country Code,country_code); + STROUT(Diag Version,diag_version); + STROUT(Service Tag,service_tag); + STROUT(ONIE Version,onie_version); + aim_printf(pvs, " \"CRC\": \"0x%x\"\n", info->crc); + aim_printf(pvs, "}\n"); +} + + diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_config.c b/packages/base/any/onlp/src/onlplib/module/src/onlplib_config.c new file mode 100644 index 00000000..672f2922 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_config.c @@ -0,0 +1,111 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* */ +#define __onlplib_config_STRINGIFY_NAME(_x) #_x +#define __onlplib_config_STRINGIFY_VALUE(_x) __onlplib_config_STRINGIFY_NAME(_x) +onlplib_config_settings_t onlplib_config_settings[] = +{ +#ifdef ONLPLIB_CONFIG_INCLUDE_LOGGING + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_INCLUDE_LOGGING), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_INCLUDE_LOGGING) }, +#else +{ ONLPLIB_CONFIG_INCLUDE_LOGGING(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_LOG_BITS_DEFAULT + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_LOG_BITS_DEFAULT), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ONLPLIB_CONFIG_LOG_BITS_DEFAULT(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_PORTING_STDLIB + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_PORTING_STDLIB), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_PORTING_STDLIB) }, +#else +{ ONLPLIB_CONFIG_PORTING_STDLIB(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_INCLUDE_UCLI + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_INCLUDE_UCLI), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_INCLUDE_UCLI) }, +#else +{ ONLPLIB_CONFIG_INCLUDE_UCLI(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_INCLUDE_I2C + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_INCLUDE_I2C), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_INCLUDE_I2C) }, +#else +{ ONLPLIB_CONFIG_INCLUDE_I2C(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_I2C_BLOCK_SIZE + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_I2C_BLOCK_SIZE), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_I2C_BLOCK_SIZE) }, +#else +{ ONLPLIB_CONFIG_I2C_BLOCK_SIZE(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER + { __onlplib_config_STRINGIFY_NAME(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER), __onlplib_config_STRINGIFY_VALUE(ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER) }, +#else +{ ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER(__onlplib_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __onlplib_config_STRINGIFY_VALUE +#undef __onlplib_config_STRINGIFY_NAME + +const char* +onlplib_config_lookup(const char* setting) +{ + int i; + for(i = 0; onlplib_config_settings[i].name; i++) { + if(strcmp(onlplib_config_settings[i].name, setting)) { + return onlplib_config_settings[i].value; + } + } + return NULL; +} + +int +onlplib_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; onlplib_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", onlplib_config_settings[i].name, onlplib_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_enums.c b/packages/base/any/onlp/src/onlplib/module/src/onlplib_enums.c new file mode 100644 index 00000000..104fb25a --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_enums.c @@ -0,0 +1,30 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_int.h b/packages/base/any/onlp/src/onlplib/module/src/onlplib_int.h new file mode 100644 index 00000000..c9fe6aa4 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_int.h @@ -0,0 +1,37 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/********************************************************//** + * + * onlplib Internal Header + * + ***********************************************************/ +#ifndef __ONLPLIB_INT_H__ +#define __ONLPLIB_INT_H__ + +#include + + +#endif /* __ONLPLIB_INT_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.c b/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.c new file mode 100644 index 00000000..808e7088 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.c @@ -0,0 +1,38 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlplib_log.h" +/* + * onlplib log struct. + */ +AIM_LOG_STRUCT_DEFINE( + ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT, + ONLPLIB_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.h b/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.h new file mode 100644 index 00000000..19dae806 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_log.h @@ -0,0 +1,32 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#ifndef __ONLPLIB_LOG_H__ +#define __ONLPLIB_LOG_H__ + +#define AIM_LOG_MODULE_NAME onlplib +#include + +#endif /* __ONLPLIB_LOG_H__ */ diff --git a/packages/base/any/onlp/src/onlplib/module/src/onlplib_module.c b/packages/base/any/onlp/src/onlplib/module/src/onlplib_module.c new file mode 100644 index 00000000..c5dd5f0a --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/onlplib_module.c @@ -0,0 +1,43 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include "onlplib_log.h" + +static int +datatypes_init__(void) +{ +#define ONLPLIB_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __onlplib_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + diff --git a/packages/base/any/onlp/src/onlplib/module/src/pi.c b/packages/base/any/onlp/src/onlplib/module/src/pi.c new file mode 100644 index 00000000..23a2f5d6 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/pi.c @@ -0,0 +1,62 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include +#include + +void +onlp_platform_info_show(onlp_platform_info_t* pi, aim_pvs_t* pvs) +{ + iof_t iof; + iof_init(&iof, pvs); + if(pi->cpld_versions) { + iof_iprintf(&iof, "CPLD Versions: %s", pi->cpld_versions); + } + if(pi->other_versions) { + iof_iprintf(&iof, "Other Versions: %s", pi->other_versions); + } +} + +void +onlp_platform_info_show_json(onlp_platform_info_t* pi, aim_pvs_t* pvs) +{ + aim_printf(pvs, "{\n"); + +#define STROUT(_name, _member, _comma) \ + do { \ + aim_printf(pvs, " \"%s\" : ", #_name); \ + if(pi-> _member) { \ + aim_printf(pvs, "\"%s\"%s\n", pi->_member, _comma); \ + } \ + else { \ + aim_printf(pvs, "null%s\n", _comma ); \ + } \ + } while(0) + + STROUT(CPLD Versions, cpld_versions, ","); + STROUT(Other Versions, other_versions, ""); + + aim_printf(pvs, "}\n"); +} diff --git a/packages/base/any/onlp/src/onlplib/module/src/sfp.c b/packages/base/any/onlp/src/onlplib/module/src/sfp.c new file mode 100644 index 00000000..88cbea71 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/sfp.c @@ -0,0 +1,130 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Common SFP Utilities for Platform implementations. + * + ************************************************************/ + +#include +#include "onlplib_int.h" +#include "onlplib_log.h" +#include +#include +#include +#include + + +int +onlplib_sfp_is_present_file(const char* fname, const char* present, + const char* notpresent) +{ + char buf[64] = {0}; + + int fd = open(fname, O_RDONLY); + if (fd < 0) { + return ONLP_STATUS_E_MISSING; + } + + ssize_t nrd = read(fd, buf, sizeof(buf)-1); + close(fd); + + if (nrd <= 0) { + AIM_LOG_INTERNAL("Failed to read SFP presence file '%s'", fname); + return ONLP_STATUS_E_INTERNAL; + } + + if(!strcmp(buf, present)) { + return 1; + } + + if(!strcmp(buf, notpresent)) { + return 0; + } + + return ONLP_STATUS_E_INTERNAL; +} + +int +onlplib_sfp_eeprom_read_file(const char* fname, uint8_t data[256]) +{ + int fd = open(fname, O_RDONLY); + if (fd < 0) { + return ONLP_STATUS_E_MISSING; + } + + int nrd = read(fd, data, 256); + close(fd); + + if (nrd != 256) { + AIM_LOG_INTERNAL("Failed to read EEPROM file '%s'", fname); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlplib_sfp_reset_file(const char* fname, + const char* first, int delay_ms, const char* second) +{ + int fd; + ssize_t nwr; + + /* Open the file */ + fd = open(fname, O_WRONLY); + if (fd < 0) { + return ONLP_STATUS_E_MISSING; + } + + /* Write the 'first' string to the file. */ + nwr = write(fd, first, strlen(first)); + close(fd); + + if (nwr != strlen(first)) { + AIM_LOG_INTERNAL("Failed to write to SFP reset file '%s'", fname); + return ONLP_STATUS_E_INTERNAL; + } + + /* If there is a second write provided, wait delay and the write it. */ + if(second) { + struct timespec delay; + + delay.tv_sec = delay_ms / 1000; + delay.tv_nsec = 1000000L * (delay_ms % 1000); + nanosleep(&delay, NULL); + + fd = open(fname, O_WRONLY); + if (fd < 0) { + AIM_LOG_INTERNAL("Failed to open SFP reset file '%s'", fname); + return ONLP_STATUS_E_INTERNAL; + } + } + + nwr = write(fd, second, strlen(second)); + close(fd); + + if (nwr != strlen(second)) { + AIM_LOG_INTERNAL("Failed to write to SFP reset file '%s'", fname); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} diff --git a/packages/base/any/onlp/src/onlplib/module/src/shlocks.c b/packages/base/any/onlp/src/onlplib/module/src/shlocks.c new file mode 100644 index 00000000..b3600fdc --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/module/src/shlocks.c @@ -0,0 +1,243 @@ +/************************************************************ + * + * + * Copyright 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * IPC Shared Memory Locks + * + ***********************************************************/ +#include +#include "onlplib_log.h" +#include +#include + +static int +shared_pthread_mutex_init__(pthread_mutex_t* mutex) +{ + int rv; + pthread_mutexattr_t ma; + + pthread_mutexattr_init(&ma); + + /* default to failed */ + rv = -1; + if(pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST) != 0) { + AIM_LOG_ERROR("setrobust() failed: %{errno}", errno); + } + else if(pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED) != 0) { + AIM_LOG_ERROR("setpshared() failed: %{errno}", errno); + } + else if(pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK) != 0) { + AIM_LOG_ERROR("settype() failed: %{errno}", errno); + } + else if(pthread_mutex_init(mutex, &ma) != 0) { + AIM_LOG_ERROR("mutex_init() failed: %{errno}", errno); + } + else { + /* Success */ + rv = 0; + } + pthread_mutexattr_destroy(&ma); + return rv; +} + +int +onlp_shmem_create(key_t key, uint32_t size, void** rvmem) +{ + int rv = 0; + int shmid; + + if(rvmem == NULL) { + return -1; + } + *rvmem = NULL; + +#define SHARED_MODE_FLAGS 0 + + + shmid = shmget(key, size, IPC_CREAT | IPC_EXCL | SHARED_MODE_FLAGS) ; + if(shmid == -1) { + if(errno == EEXIST) { + shmid = shmget(key, size, IPC_CREAT | SHARED_MODE_FLAGS); + if(shmid == -1) { + /* Exists, but could not be accessed */ + AIM_LOG_ERROR("shmget failed on existing segment: %{errno}", errno); + return -1; + } + else { + /* Already Exists */ + rv = 0; + } + } + } + else { + /* Newly created */ + rv = 1; + } + + *rvmem = shmat(shmid, 0, 0); + if(*rvmem == ( (void*) -1 )) { + AIM_LOG_ERROR("shmat failed on segment: %{errno}", errno); + rv = -1; + } + return rv; +} + + +struct onlp_shlock_s { + uint32_t magic; + char name[64]; + + pthread_mutex_t mutex; +}; + +#define SHLOCK_MAGIC 0xDEADBEEF + +static void +onlp_shlock_init__(onlp_shlock_t* l, const char* fmt, va_list vargs) +{ + if(l->magic != SHLOCK_MAGIC) { + if(shared_pthread_mutex_init__(&l->mutex) != 0) { + /* There is no useful recovery from this */ + AIM_DIE("shlock_init(): mutex_init failed\n"); + } + char* s = aim_vfstrdup(fmt, vargs); + aim_strlcpy(l->name, s, sizeof(l->name)); + l->magic = SHLOCK_MAGIC; + } +} + + +int +onlp_shlock_create(key_t id, onlp_shlock_t** rvl, const char* fmt, ...) +{ + + onlp_shlock_t* l = NULL; + int rv = onlp_shmem_create(id, sizeof(onlp_shlock_t), (void**)&l); + + if(rv >= 0) { + va_list vargs; + va_start(vargs, fmt); + /* Initialize if necessary */ + onlp_shlock_init__(l, fmt, vargs); + va_end(vargs); + *rvl = l; + } + else { + AIM_DIE("shlock_create(): shmem_create failed\n"); + rv = -1; + } + return rv; +} + +int +onlp_shlock_destroy(onlp_shlock_t* shlock) +{ + /* Nothing at the moment. */ + return 0; +} + +int +onlp_shlock_take(onlp_shlock_t* shlock) +{ + int rv; + + if(shlock == NULL) { + AIM_DIE("shlock_take(): lock is NULL"); + } + + rv = pthread_mutex_lock(&shlock->mutex); + if(rv == 0) { + /* All good. */ + return 0; + } + if(rv == EOWNERDEAD) { + /* + * We got the lock, but someone else aborted while holding it. + * No explicit recovery actions at this point. + */ + AIM_LOG_WARN("Detected EOWNERDEAD on take."); + pthread_mutex_consistent(&shlock->mutex); + return 0; + } + + /* + * No other runtime conditions are allowed. + * abort to make that obvious during debugging and development. + */ + AIM_DIE("mutex_lock failed: %{errno}", errno); + return -1; +} + + +/** + * @brief Give a shared memory lock. + * @param shlock The shared lock. + */ +int +onlp_shlock_give(onlp_shlock_t* shlock) +{ + if(shlock == NULL) { + AIM_DIE("shlock_give(): lock is NULL"); + } + + if(pthread_mutex_unlock(&shlock->mutex) != 0) { + AIM_DIE("mutex_unlock() failed: %{errno}", errno); + return -1; + } + return 0; +} + +const char* +onlp_shlock_name(onlp_shlock_t* lock) +{ + return lock->name; +} + + +static onlp_shlock_t* global_lock__ = NULL; + + +void +onlp_shlock_global_init(void) +{ + if(global_lock__ == NULL) { + if(onlp_shlock_create(ONLP_SHLOCK_GLOBAL_KEY, &global_lock__, + "onlp-global-lock") < 0) { + AIM_DIE("Global lock created failed."); + } + } +} + +int +onlp_shlock_global_take(void) +{ +#if ONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT == 0 + /* Always attempt initialization first */ + onlp_shlock_global_init(); +#endif + + return onlp_shlock_take(global_lock__); +} + +int +onlp_shlock_global_give(void) +{ + return onlp_shlock_give(global_lock__); +} diff --git a/packages/base/any/onlp/src/onlplib/onlplib.doxy b/packages/base/any/onlp/src/onlplib/onlplib.doxy new file mode 100644 index 00000000..d1ef73a6 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/onlplib.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "onlplib" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "ONLP Common Libraries." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/onlplib/onlplib.mk b/packages/base/any/onlp/src/onlplib/onlplib.mk new file mode 100644 index 00000000..8e140db6 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/onlplib.mk @@ -0,0 +1,14 @@ + +############################################################################### +# +# Inclusive Makefile for the onlplib module. +# +# Autogenerated 2015-10-12 20:50:57.003782 +# +############################################################################### +onlplib_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(onlplib_BASEDIR)/module/make.mk +include $(onlplib_BASEDIR)/module/auto/make.mk +include $(onlplib_BASEDIR)/module/src/make.mk +include $(onlplib_BASEDIR)/utest/_make.mk + diff --git a/packages/base/any/onlp/src/onlplib/utest/_make.mk b/packages/base/any/onlp/src/onlplib/utest/_make.mk new file mode 100644 index 00000000..8739f937 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/utest/_make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# Copyright 2014, 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# onlplib Unit Test Makefile. +# +############################################################ + +UMODULE := onlplib +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/onlp/src/onlplib/utest/main.c b/packages/base/any/onlp/src/onlplib/utest/main.c new file mode 100644 index 00000000..81320e41 --- /dev/null +++ b/packages/base/any/onlp/src/onlplib/utest/main.c @@ -0,0 +1,39 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +#include +#include +#include +#include + +int aim_main(int argc, char* argv[]) +{ + printf("onlplib Utest Is Empty\n"); + onlplib_config_show(&aim_pvs_stdout); + return 0; +} + diff --git a/packages/base/any/onlp/src/sff/Makefile b/packages/base/any/onlp/src/sff/Makefile new file mode 100644 index 00000000..ddbcaafa --- /dev/null +++ b/packages/base/any/onlp/src/sff/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +include ../../init.mk +MODULE := sff +AUTOMODULE := sff +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/onlp/src/sff/README b/packages/base/any/onlp/src/sff/README new file mode 100644 index 00000000..12717e2f --- /dev/null +++ b/packages/base/any/onlp/src/sff/README @@ -0,0 +1,6 @@ +############################################################################### +# +# sff README +# +############################################################################### + diff --git a/packages/base/any/onlp/src/sff/module/auto/make.mk b/packages/base/any/onlp/src/sff/module/auto/make.mk new file mode 100644 index 00000000..1232f5e6 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# sff Autogeneration +# +############################################################################### +sff_AUTO_DEFS := module/auto/sff.yml +sff_AUTO_DIRS := module/inc/sff module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/onlp/src/sff/module/auto/sff.yml b/packages/base/any/onlp/src/sff/module/auto/sff.yml new file mode 100644 index 00000000..0d39e223 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/auto/sff.yml @@ -0,0 +1,130 @@ +############################################################################### +# +# sff Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- SFF_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- SFF_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- SFF_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- SFF_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: SFF_CONFIG_PORTING_STDLIB +- SFF_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- SFF_CONFIG_INCLUDE_SFF_TOOL: + doc: "Include the SFF tool main entry point." + default: 0 +- SFF_CONFIG_INCLUDE_EXT_CC_CHECK: + doc: "Include extended checksum verification." + default: 0 + +sff_media_types: &sff_media_types +- COPPER: + desc: "Copper" +- FIBER: + desc: "Fiber" + +sff_module_types: &sff_module_types +- 40G_BASE_CR4: + desc: "40GBASE-CR4" +- 40G_BASE_SR4: + desc: "40GBASE-SR4" +- 40G_BASE_LR4: + desc: "40GBASE-LR4" +- 40G_BASE_ACTIVE: + desc: "40GBASE-ACTIVE" +- 40G_BASE_CR: + desc: "40GBASE-CR" +- 40G_BASE_SR2: + desc: "40GBASE-SR2" +- 10G_BASE_SR: + desc: "10GBASE-SR" +- 10G_BASE_LR: + desc: "10GBASE-LR" +- 10G_BASE_LRM: + desc: "10GBASE-LRM" +- 10G_BASE_ER: + desc: "10GBASE-ER" +- 10G_BASE_CR: + desc: "10GBASE-CR" +- 10G_BASE_SX: + desc: "10GBASE-SX" +- 10G_BASE_LX: + desc: "10GBASE-LX" +- 10G_BASE_ZR: + desc: "10GBASE-ZR" +- 10G_BASE_SRL: + desc: "10GBASE-SRL" +- 1G_BASE_SX: + desc: "1GBASE-SX" +- 1G_BASE_LX: + desc: "1GBASE-LX" +- 1G_BASE_CX: + desc: "1GBASE-CX" +- 1G_BASE_T: + desc: "1GBASE-T" +- 100_BASE_LX: + desc: "100BASE-LX" +- 100_BASE_FX: + desc: "100BASE-FX" + +sff_module_caps: &sff_module_caps +- F_100 : 0x1 +- F_1G : 0x2 +- F_10G : 0x4 +- F_40G : 0x8 +- F_100G : 0x10 + +sff_sfp_types: &sff_sfp_types +- SFP: + desc: "SFP" +- QSFP: + desc: "QSFP" +- QSFP_PLUS: + desc: "QSFP+" + + +definitions: + cdefs: + SFF_CONFIG_HEADER: + defs: *cdefs + basename: sff_config + + portingmacro: + SFF: + macros: + - memset + - memcpy + - strncpy + - strncmp + - strlen + - snprintf + + enum: &enums + sff_sfp_type: + members: *sff_sfp_types + sff_module_type: + members: *sff_module_types + sff_module_caps: + members: *sff_module_caps + sff_media_type: + members: *sff_media_types + + xenum: + SFF_ENUMERATION_ENTRY: + members: *enums \ No newline at end of file diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/8436.h b/packages/base/any/onlp/src/sff/module/inc/sff/8436.h new file mode 100644 index 00000000..3bedc8f8 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/8436.h @@ -0,0 +1,473 @@ +/********************************************************************** + * + * 8436.h + * + * idprom defintions for QSFP+ modules. + * + **********************************************************************/ + +#ifndef __SFF_8436_H__ +#define __SFF_8436_H__ + +#include +#include "sff/8472.h" + +/* identifier, bytes 128 page 0 (also byte 0) */ + +#define SFF8436_IDENT_UNKNOWN SFF8472_IDENT_UNKNOWN +#define SFF8436_IDENT_GBIC SFF8472_IDENT_GBIC +#define SFF8436_IDENT_BASEBOARD SFF8472_IDENT_BASEBOARD +#define SFF8436_IDENT_SFP SFF8472_IDENT_SFP +#define SFF8436_IDENT_XBI SFF8472_IDENT_XBI +#define SFF8436_IDENT_XENPAK SFF8472_IDENT_XENPAK +#define SFF8436_IDENT_XFP SFF8472_IDENT_XFP +#define SFF8436_IDENT_XFF SFF8472_IDENT_XFF +#define SFF8436_IDENT_XFPE SFF8472_IDENT_XFPE +#define SFF8436_IDENT_XPAK SFF8472_IDENT_XPAK +#define SFF8436_IDENT_X2 SFF8472_IDENT_X2 +#define SFF8436_IDENT_DWDM_SFP SFF8472_IDENT_DWDM_SFP +#define SFF8436_IDENT_QSFP SFF8472_IDENT_QSFP + +/* additional values from this spec */ +#define SFF8436_IDENT_QSFP_PLUS 0x0D + +#define SFF8436_MODULE_QSFP_PLUS(idprom) \ + ((idprom[0] == SFF8436_IDENT_QSFP) \ + || (idprom[0] == SFF8436_IDENT_QSFP_PLUS)) + +#define SFF8436_MODULE_QSFP_PLUS_V2(idprom) \ + ((idprom[128] == SFF8436_IDENT_QSFP) \ + || (idprom[128] == SFF8436_IDENT_QSFP_PLUS)) + +#define SFF8436_RX1_PWR(idprom) \ + (idprom[34] << 8 | idprom[34 + 1]) +#define SFF8436_RX2_PWR(idprom) \ + (idprom[36] << 8 | idprom[36 + 1]) +#define SFF8436_RX3_PWR(idprom) \ + (idprom[38] << 8 | idprom[38 + 1]) +#define SFF8436_RX4_PWR(idprom) \ + (idprom[40] << 8 | idprom[40 + 1]) + +#define SFF8436_TX1_BIAS(idprom) \ + (idprom[42] << 8 | idprom[42 + 1]) +#define SFF8436_TX2_BIAS(idprom) \ + (idprom[44] << 8 | idprom[44 + 1]) +#define SFF8436_TX3_BIAS(idprom) \ + (idprom[46] << 8 | idprom[46 + 1]) +#define SFF8436_TX4_BIAS(idprom) \ + (idprom[48] << 8 | idprom[48 + 1]) + +#define SFF8436_SFP_VOLT(idprom) \ + (idprom[26] << 8 | idprom[26 + 1]) +#define SFF8436_SFP_TEMP(idprom) \ + (idprom[22] << 8 | idprom[22 + 1]) + +/* connector value, byte 130 page 0 */ + +#define SFF8436_CONN_UNKNOWN SFF8472_CONN_UNKNOWN +#define SFF8436_CONN_SC SFF8472_CONN_SC +#define SFF8436_CONN_FC1_CU SFF8472_CONN_FC1_CU +#define SFF8436_CONN_FC2_CU SFF8472_CONN_FC2_CU +#define SFF8436_CONN_BNC SFF8472_CONN_BNC +#define SFF8436_CONN_FC_COAX SFF8472_CONN_FC_COAX +#define SFF8436_CONN_FJ SFF8472_CONN_FJ +#define SFF8436_CONN_LC SFF8472_CONN_LC +#define SFF8436_CONN_MT_RJ SFF8472_CONN_MT_RJ +#define SFF8436_CONN_MU SFF8472_CONN_MU +#define SFF8436_CONN_SG SFF8472_CONN_SG +#define SFF8436_CONN_SI_PIGTAIL SFF8472_CONN_SI_PIGTAIL +#define SFF8436_CONN_MPO SFF8472_CONN_MPO +#define SFF8436_CONN_HSSDC_II SFF8472_CONN_HSSDC_II +#define SFF8436_CONN_CU_PIGTAIL SFF8472_CONN_CU_PIGTAIL +#define SFF8436_CONN_RJ45 SFF8472_CONN_RJ45 + +/* addtional values from this spec */ +#define SFF8436_CONN_NONE 0x23 + +/* Amphenol QSFP, identified as "QSFP" (not "QSFP+") and copper + pigtail */ +#define SFF8436_MEDIA_40GE_CR(idprom) \ + (idprom[130] == SFF8436_CONN_CU_PIGTAIL) + +/* QSFP+ compliance codes, bytes 131-138 */ +#define SFF8436_CC131_XGE_BASE_LRM SFF8472_CC3_XGE_BASE_LRM +#define SFF8436_CC131_XGE_BASE_LR SFF8472_CC3_XGE_BASE_LR +#define SFF8436_CC131_XGE_BASE_SR SFF8472_CC3_XGE_BASE_SR +#define SFF8436_CC131_40GE_BASE_CR4 0x08 +#define SFF8436_CC131_40GE_BASE_SR4 0x04 +#define SFF8436_CC131_40GE_BASE_LR4 0x02 +#define SFF8436_CC131_40GE_ACTIVE 0x01 + +#define SFF8436_MEDIA_XGE_LRM(idprom) \ + ((idprom[131] & SFF8436_CC131_XGE_BASE_LRM) != 0) +#define SFF8436_MEDIA_XGE_LR(idprom) \ + ((idprom[131] & SFF8436_CC131_XGE_BASE_LR) != 0) +#define SFF8436_MEDIA_XGE_SR(idprom) \ + ((idprom[131] & SFF8436_CC131_XGE_BASE_SR) != 0) + +#define SFF8436_MEDIA_40GE_CR4(idprom) \ + ((idprom[131] & SFF8436_CC131_40GE_BASE_CR4) != 0) +#define SFF8436_MEDIA_40GE_SR4(idprom) \ + ((idprom[131] & SFF8436_CC131_40GE_BASE_SR4) != 0) +#define SFF8436_MEDIA_40GE_LR4(idprom) \ + ((idprom[131] & SFF8436_CC131_40GE_BASE_LR4) != 0) +#define SFF8436_MEDIA_40GE_ACTIVE(idprom) \ + ((idprom[131] & SFF8436_CC131_40GE_ACTIVE) != 0) + +#define SFF8436_MEDIA_NONE(idprom) \ + (idprom[131] == 0) + +#define SFF8436_CC132_40G_OTN 0x08 +#define SFF8436_CC132_OC48_LONG SFF8472_CC4_OC48_LONG +#define SFF8436_CC132_OC48_INTERMETIATE SFF8472_CC4_OC48_INTERMEDIATE +#define SFF8436_CC132_OC48_SHORT SFF8472_CC4_OC48_SHORT + +#define SFF8436_CC133_SAS_6G 0x20 +#define SFF8436_CC133_SAS_3G 0x10 + +#define SFF8436_CC134_GBE_BASE_T SFF8472_CC6_GBE_BASE_T +#define SFF8436_CC134_GBE_BASE_CX SFF8472_CC6_GBE_BASE_CX +#define SFF8436_CC134_GBE_BASE_LX SFF8472_CC6_GBE_BASE_LX +#define SFF8436_CC134_GBE_BASE_SX SFF8472_CC6_GBE_BASE_SX + +#define SFF8436_MEDIA_GBE_T(idprom) \ + ((idprom[134] & SFF8436_CC134_GBE_BASE_T) != 0) +#define SFF8436_MEDIA_GBE_CX(idprom) \ + ((idprom[134] & SFF8436_CC134_GBE_BASE_CX) != 0) +#define SFF8436_MEDIA_GBE_LX(idprom) \ + ((idprom[134] & SFF8436_CC134_GBE_BASE_LX) != 0) +#define SFF8436_MEDIA_GBE_SX(idprom) \ + ((idprom[134] & SFF8436_CC134_GBE_BASE_SX) != 0) + +#define SFF8436_CC135_FC_VERY_LONG SFF8472_CC7_FC_VERY_LONG +#define SFF8436_CC135_FC_SHORT SFF8472_CC7_FC_SHORT +#define SFF8436_CC135_FC_INTERMEDIATE SFF8472_CC7_FC_INTERMEDIATE +#define SFF8436_CC135_FC_LONG SFF8472_CC7_FC_LONG +#define SFF8436_CC135_FC_MEDIUM SFF8472_CC7_FC_MEDIUM +#define SFF8436_CC135_FC_TECH_LC SFF8472_CC7_FC_TECH_LC +#define SFF8436_CC135_FC_TECH_EL SFF8472_CC7_FC_TECH_EL +#define SFF8436_CC136_FC_TECH_EL SFF8472_CC8_FC_TECH_EL +#define SFF8436_CC136_FC_TECH_SN SFF8472_CC8_FC_TECH_SN +#define SFF8436_CC136_FC_TECH_SL SFF8472_CC8_FC_TECH_SL +#define SFF8436_CC136_FC_TECH_LL SFF8472_CC8_FC_TECH_LL + +#define SFF8436_TECH_FC_FIBER_LONG(idprom) \ + (((idprom[135] & SFF8436_CC135_FC_TECH_LC) != 0) \ + || ((idprom[136] & SFF8436_CC136_FC_TECH_LL) != 0)) + +#define SFF8436_TECH_FC_FIBER_SHORT(idprom) \ + (((idprom[136] & SFF8436_CC136_FC_TECH_SN) != 0) \ + || ((idprom[136] & SFF8436_CC136_FC_TECH_SL) != 0)) + +#define SFF8436_TECH_FC_FIBER(idprom) \ + (SFF8436_TECH_FC_FIBER_SHORT(idprom) \ + || SFF8436_TECH_FC_FIBER_LONG(idprom)) + +#define SFF8436_TECH_FC_COPPER(idprom) \ + (((idprom[135] & SFF8436_CC135_FC_TECH_EL) != 0) \ + || ((idprom[136] & SFF8436_CC136_FC_TECH_EL) != 0)) + +#define SFF8436_CC137_FC_MEDIA_TW SFF8472_CC9_FC_MEDIA_TW +#define SFF8436_CC137_FC_MEDIA_TP SFF8472_CC9_FC_MEDIA_TP +#define SFF8436_CC137_FC_MEDIA_MI SFF8472_CC9_FC_MEDIA_MI +#define SFF8436_CC137_FC_MEDIA_TV SFF8472_CC9_FC_MEDIA_TV +#define SFF8436_CC137_FC_MEDIA_M6 SFF8472_CC9_FC_MEDIA_M6 +#define SFF8436_CC137_FC_MEDIA_M5 SFF8472_CC9_FC_MEDIA_M5 +#define SFF8436_CC137_FC_MEDIA_OM3 0x02 +#define SFF8436_CC137_FC_MEDIA_SM SFF8472_CC9_FC_MEDIA_SM + +#define SFF8436_MEDIA_FC_FIBER_SM(idprom) \ + ((idprom[137] & SFF8436_CC137_FC_MEDIA_SM) != 0) + +#define SFF8436_MEDIA_FC_FIBER_MM(idprom) \ + (((idprom[137] & SFF8436_CC137_FC_MEDIA_OM3) != 0) \ + || ((idprom[137] & SFF8436_CC137_FC_MEDIA_M5) != 0) \ + || ((idprom[137] & SFF8436_CC137_FC_MEDIA_M6) != 0)) + +#define SFF8436_MEDIA_FC_FIBER(idprom) \ + (SFF8436_MEDIA_FC_FIBER_SM(idprom) \ + || SFF8436_MEDIA_FC_FIBER_MM(idprom)) + +#define SFF8436_MEDIA_FC_COPPER_TP(idprom) \ + (((idprom[137] & SFF8436_CC137_FC_MEDIA_TP) != 0) \ + || ((idprom[137] & SFF8436_CC137_FC_MEDIA_TW) != 0)) + +#define SFF8436_MEDIA_FC_COPPER_COAX(idprom) \ + (((idprom[137] & SFF8436_CC137_FC_MEDIA_TV) != 0) \ + || ((idprom[137] & SFF8436_CC137_FC_MEDIA_MI) != 0)) + +#define SFF8436_MEDIA_FC_COPPER(idprom) \ + (SFF8436_MEDIA_FC_COPPER_TP(idprom) \ + || SFF8436_MEDIA_FC_COPPER_COAX(idprom) + +#define SFF8436_CC138_FC_SPEED_100 SFF8472_CC10_FC_SPEED_100 +#define SFF8436_CC138_FC_SPEED_200 SFF8472_CC10_FC_SPEED_200 +#define SFF8436_CC138_FC_SPEED_400 SFF8472_CC10_FC_SPEED_400 +#define SFF8436_CC138_FC_SPEED_1600 SFF8472_CC10_FC_SPEED_1600 +#define SFF8436_CC138_FC_SPEED_800 SFF8472_CC10_FC_SPEED_800 +#define SFF8436_CC138_FC_SPEED_1200 SFF8472_CC10_FC_SPEED_1200 + +#define SFF8436_CC139_8B10B 0x01 +#define SFF8436_CC139_4B5B 0x02 +#define SFF8436_CC139_NRZ 0x03 +#define SFF8436_CC139_SONET 0x04 +#define SFF8436_CC139_64B66B 0x05 +#define SFF8436_CC139_MANCHESTER 0x06 + +#define SFF8436_CC164_INF_SDR 0x01 +#define SFF8436_CC164_INF_DDR 0x02 +#define SFF8436_CC164_INF_QDR 0x04 +#define SFF8436_CC164_INF_FDR 0x08 +#define SFF8436_CC164_INF_EDR 0x10 + +#define SFF8436_RX_PWR_TYPE_MASK 0x08 +#define SFF8436_DOM_GET_RXPWR_TYPE(idprom) \ + (idprom[220] & SFF8436_RX_PWR_TYPE_MASK) + +/* alternate ways to identify pre-standard 40G cables */ +static inline int +_sff8436_qsfp_40g_pre(const uint8_t* idprom) +{ + /* skip if not qsfp+ */ + if (!SFF8436_MODULE_QSFP_PLUS_V2(idprom)) + return 0; + + /* if any of the other standard bits are set, abort */ + if (SFF8436_MEDIA_40GE_CR4(idprom)) + return 0; + if (SFF8436_MEDIA_40GE_SR4(idprom)) + return 0; + if (SFF8436_MEDIA_40GE_LR4(idprom)) + return 0; + if (SFF8436_MEDIA_40GE_ACTIVE(idprom)) + return 0; + + /* since it is QSFP/QSFP+, let us assume 4 lanes */ + + /* QDR infiniband == 8G per lane, 32G total, probably 40G Ethernet + compliant */ + if ((idprom[164] & SFF8436_CC164_INF_QDR) != 0) + return 1; + + /* nominal BR > 100 * 100M (10G), likely 40G Ethernet compliant */ + if (idprom[140] >= 64) + return 1; + + return 0; +} + +static inline int +_sff8436_bitrate(const uint8_t *idprom) +{ + if (idprom[12] == 0) + return 0; + if (idprom[12] == 0xFF) + return 0; + long long br = (long long) idprom[12] * 100*1000000; + if ((br > 1000*1000000LL) && (br < 5*1000*1000000LL)) + return 1; + return 0; +} + +static inline int +_sff8436_length_sm(const uint8_t *idprom) +{ + return idprom[142] * 1000; +} + +static inline int +_sff8436_length_om3(const uint8_t *idprom) +{ + return idprom[143] * 2; +} + +static inline int +_sff8436_length_om2(const uint8_t *idprom) +{ + return idprom[144]; +} + +static inline int +_sff8436_length_om1(const uint8_t *idprom) +{ + return idprom[145]; +} + +static inline int +_sff8436_length_copper_active(const uint8_t *idprom) +{ + return idprom[146]; +} + +static inline int +_sff8436_wavelength(const uint8_t *idprom) +{ + return ((idprom[186] << 8) | idprom[187]) / 20; +} + +/* + * try to detect QSFP modules (outside of the 8436 spec) + */ +static inline int +_sff8436_qsfp_40g_sr2_bidi_pre(const uint8_t *idprom) +{ + /* module should be qsfp */ + if (!SFF8436_MODULE_QSFP_PLUS(idprom) + && !SFF8436_MODULE_QSFP_PLUS_V2(idprom)) + return 0; + + /* module should have LC connector */ + if (idprom[130] != SFF8436_CONN_LC) return 0; + + /* reject any unrelated compliance codes */ + if (SFF8436_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8436_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8436_MEDIA_XGE_SR(idprom)) return 0; + if (SFF8436_MEDIA_40GE_CR4(idprom)) return 0; + + /* do *not* report SR4 compliance */ + if (SFF8436_MEDIA_40GE_SR4(idprom)) return 0; + + if (SFF8436_MEDIA_40GE_LR4(idprom)) return 0; + if (SFF8436_MEDIA_40GE_ACTIVE(idprom)) return 0; + + /* make sure it's MM fiber */ + if (_sff8436_wavelength(idprom) != 850) return 0; + + /* make sure it reports a MM cable length */ + if (_sff8436_length_sm(idprom) > 0) return 0; + if (!_sff8436_length_om1(idprom) + && !_sff8436_length_om2(idprom) + && !_sff8436_length_om3(idprom)) + return 0; + + /* + * report a BR greater than 10G... + * for a two-fiber bidi cable we report 20G, but that is per fiber + */ + long long br = (long long) idprom[140] * 100 * 1000000; + if ((br >= 20LL*1000*1000000) && (br < 40LL*1000*1000000)) return 1; + return 0; + +} + +/* + * non-standard Cisco/Finisar QSFP MM (AOC?) + */ +static inline int +_sff8436_qsfp_40g_sr4_aoc_pre(const uint8_t *idprom) +{ + /* module should be qsfp */ + if (!SFF8436_MODULE_QSFP_PLUS(idprom) + && !SFF8436_MODULE_QSFP_PLUS_V2(idprom)) + return 0; + + /* no separable connector -- likely active */ + if (idprom[130] != SFF8436_CONN_NONE) return 0; + + /* reject any unrelated compliance codes */ + if (SFF8436_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8436_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8436_MEDIA_XGE_SR(idprom)) return 0; + if (SFF8436_MEDIA_40GE_CR4(idprom)) return 0; + + /* do *not* report SR4 compliance */ + if (SFF8436_MEDIA_40GE_SR4(idprom)) return 0; + + if (SFF8436_MEDIA_40GE_LR4(idprom)) return 0; + if (SFF8436_MEDIA_40GE_ACTIVE(idprom)) return 0; + + /* make sure it's MM fiber */ + if (_sff8436_wavelength(idprom) != 850) return 0; + + /* make sure it reports a MM cable length */ + if (_sff8436_length_sm(idprom) > 0) return 0; + if (!_sff8436_length_om1(idprom) + && !_sff8436_length_om2(idprom) + && !_sff8436_length_om3(idprom)) + return 0; + + /* + * report a BR roughly 10G (4 strands) + */ + long long br = (long long) idprom[140] * 100 * 1000000; + if ((br >= 10LL*1000*1000000) && (br < 15LL*1000*1000000)) return 1; + return 0; + +} + +/* + * 40G AOC breakout cable, e.g. Finisar + */ +static inline int +_sff8436_qsfp_40g_aoc_breakout(const uint8_t *idprom) +{ + /* module should be qsfp */ + if (!SFF8436_MODULE_QSFP_PLUS(idprom) + && !SFF8436_MODULE_QSFP_PLUS_V2(idprom)) + return 0; + + /* no separable connector -- likely active */ + if (idprom[130] != SFF8436_CONN_NONE) return 0; + + /* no media compliance, probably active or breakout */ + if (!SFF8436_MEDIA_NONE(idprom)) return 0; + + /* reject any 40G compliance codes */ + if (SFF8436_MEDIA_40GE_CR4(idprom)) return 0; + if (SFF8436_MEDIA_40GE_SR4(idprom)) return 0; + if (SFF8436_MEDIA_40GE_LR4(idprom)) return 0; + + /* also does not report as active! Ugh. */ + if (SFF8436_MEDIA_40GE_ACTIVE(idprom)) return 0; + + /* reject any unrelated compliance codes */ + if (SFF8436_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8436_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8436_MEDIA_XGE_SR(idprom)) return 0; + + /* make sure it's MM fiber */ + if (_sff8436_wavelength(idprom) != 850) return 0; + + /* does not report a fiber length, but does report a cable length */ + if (_sff8436_length_sm(idprom) > 0) return 0; + if (_sff8436_length_om1(idprom) > 0) return 0; + if (_sff8436_length_om2(idprom) > 0) return 0; + if (_sff8436_length_om3(idprom) > 0) return 0; + if (_sff8436_length_copper_active(idprom) == 0) return 0; + + /* maybe, possibly an AOC breakout cable */ + return 1; +} + +/* + * Infer cable length for fixed-length (AOC) optical cables + * + * XXX roth -- may also be able to cook up a rule for SFP+ cables too. + */ +static inline int +_sff8436_qsfp_40g_aoc_length(const uint8_t *idprom) +{ + /* module should be qsfp */ + if (!SFF8436_MODULE_QSFP_PLUS(idprom) + && !SFF8436_MODULE_QSFP_PLUS_V2(idprom)) + return -1; + + /* no separable connector -- likely active */ + if (idprom[130] != SFF8436_CONN_NONE) return -1; + + /* make sure it's MM fiber */ + if (_sff8436_wavelength(idprom) != 850) return 0; + + /* does not report a fiber length, but does report a cable length */ + if (_sff8436_length_sm(idprom) > 0) return -1; + if (_sff8436_length_om1(idprom) > 0) return -1; + if (_sff8436_length_om2(idprom) > 0) return -1; + if (_sff8436_length_om3(idprom) > 0) return -1; + if (_sff8436_length_copper_active(idprom) > 0) + return _sff8436_length_copper_active(idprom); + + return -1; +} + +#endif /* __SFF_8436_H__ */ diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/8472.h b/packages/base/any/onlp/src/sff/module/inc/sff/8472.h new file mode 100644 index 00000000..85c8e60c --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/8472.h @@ -0,0 +1,955 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * SFF 8472 Definitions. + * + ***********************************************************/ +#ifndef __SFF_8472_H__ +#define __SFF_8472_H__ + +#include +#include + +/****************************** + * + * All (most of) the gory details from table 3.5 of the SFF spec + * + ******************************/ + +/* identifier byte 0x00 */ + +#define SFF8472_IDENT_UNKNOWN 0x00 +#define SFF8472_IDENT_GBIC 0x01 +#define SFF8472_IDENT_BASEBOARD 0x02 +#define SFF8472_IDENT_SFP 0x03 +#define SFF8472_IDENT_XBI 0x04 +#define SFF8472_IDENT_XENPAK 0x05 +#define SFF8472_IDENT_XFP 0x06 +#define SFF8472_IDENT_XFF 0x07 +#define SFF8472_IDENT_XFPE 0x08 +#define SFF8472_IDENT_XPAK 0x09 +#define SFF8472_IDENT_X2 0x0A +#define SFF8472_IDENT_DWDM_SFP 0x0B +#define SFF8472_IDENT_QSFP 0x0C + +#define SFF8472_MODULE_SFP(idprom) \ + ((idprom[0] == SFF8472_IDENT_SFP) \ + || (idprom[0] == SFF8472_IDENT_DWDM_SFP)) + +/* connector byte 0x02 */ + +#define SFF8472_CONN_UNKNOWN 0x00 +#define SFF8472_CONN_SC 0x01 +#define SFF8472_CONN_FC1_CU 0x02 +#define SFF8472_CONN_FC2_CU 0x03 +#define SFF8472_CONN_BNC 0x04 +#define SFF8472_CONN_FC_COAX 0x05 +#define SFF8472_CONN_FJ 0x06 +#define SFF8472_CONN_LC 0x07 +#define SFF8472_CONN_MT_RJ 0x08 +#define SFF8472_CONN_MU 0x09 +#define SFF8472_CONN_SG 0x0A +#define SFF8472_CONN_SI_PIGTAIL 0x0B +#define SFF8472_CONN_MPO 0x0C +#define SFF8472_CONN_HSSDC_II 0x20 +#define SFF8472_CONN_CU_PIGTAIL 0x21 +#define SFF8472_CONN_RJ45 0x22 + +/* module compliance codes (SFP type) */ + +#define SFF8472_CC3_INF_1X_CU_PASSIVE 0x01 +#define SFF8472_CC3_INF_1X_CU_ACTIVE 0x02 +#define SFF8472_CC3_INF_1X_LX 0x04 +#define SFF8472_CC3_INF_1X_SX 0x08 +#define SFF8472_CC3_XGE_BASE_SR 0x10 +#define SFF8472_CC3_XGE_BASE_LR 0x20 +#define SFF8472_CC3_XGE_BASE_LRM 0x40 +#define SFF8472_CC3_XGE_BASE_ER 0x80 + +#define SFF8472_CC4_OC48_SHORT 0x01 +#define SFF8472_CC4_OC48_INTERMEDIATE 0x02 +#define SFF8472_CC4_OC48_LONG 0x04 +#define SFF8472_CC4_SONET 0x18 +#define SFF8472_CC4_OC192_SHORT 0x20 +#define SFF8472_CC4_ESCON_SMF 0x40 +#define SFF8472_CC4_ESCON_MMF 0x80 + +#define SFF8472_CC5_OC3_SHORT 0x01 +#define SFF8472_CC5_OC3_SMM_INTERMEDIATE 0x02 +#define SFF8472_CC5_OC3_SMM_LONG 0x04 +#define SFF8472_CC5_UNALLOCATED1 0x08 +#define SFF8472_CC5_OC12_SHORT 0x10 +#define SFF8472_CC5_OC12_SMM_INTERMEDIATE 0x20 +#define SFF8472_CC5_OC12_SMM_LONG 0x40 +#define SFF8472_CC5_UNALLOCATED2 0x80 + +#define SFF8472_CC6_GBE_BASE_SX 0x01 +#define SFF8472_CC6_GBE_BASE_LX 0x02 +#define SFF8472_CC6_GBE_BASE_CX 0x04 +#define SFF8472_CC6_GBE_BASE_T 0x08 +#define SFF8472_CC6_CBE_BASE_LX 0x10 +#define SFF8472_CC6_CBE_BASE_FX 0x20 +#define SFF8472_CC6_BASE_BX10 0x40 +#define SFF8472_CC6_BASE_PX 0x80 + +#define SFF8472_CC7_FC_TECH_EL 0x01 +#define SFF8472_CC7_FC_TECH_LC 0x02 +#define SFF8472_CC7_FC_TECH_SA 0x04 +#define SFF8472_CC7_FC_MEDIUM 0x08 +#define SFF8472_CC7_FC_LONG 0x10 +#define SFF8472_CC7_FC_INTERMEDIATE 0x20 +#define SFF8472_CC7_FC_SHORT 0x40 +#define SFF8472_CC7_FC_VERY_LONG 0x80 + +#define SFF8472_CC8_UNALLOCATED1 0x03 +#define SFF8472_CC8_SFP_PASSIVE 0x04 +#define SFF8472_CC8_SFP_ACTIVE 0x08 +#define SFF8472_CC8_FC_TECH_LL 0x10 +#define SFF8472_CC8_FC_TECH_SL 0x20 +#define SFF8472_CC8_FC_TECH_SN 0x40 +#define SFF8472_CC8_FC_TECH_EL 0x80 + +#define SFF8472_CC9_FC_MEDIA_SM 0x01 +#define SFF8472_CC9_UNALLOCATED1 0x02 +#define SFF8472_CC9_FC_MEDIA_M5 0x04 +#define SFF8472_CC9_FC_MEDIA_M6 0x08 +#define SFF8472_CC9_FC_MEDIA_TV 0x10 +#define SFF8472_CC9_FC_MEDIA_MI 0x20 +#define SFF8472_CC9_FC_MEDIA_TP 0x40 +#define SFF8472_CC9_FC_MEDIA_TW 0x80 + +#define SFF8472_CC10_FC_SPEED_100 0x01 +#define SFF8472_CC10_UNALLOCATED1 0x02 +#define SFF8472_CC10_FC_SPEED_200 0x04 +#define SFF8472_CC10_FC_SPEED_3200 0x08 +#define SFF8472_CC10_FC_SPEED_400 0x10 +#define SFF8472_CC10_FC_SPEED_1600 0x20 +#define SFF8472_CC10_FC_SPEED_800 0x40 +#define SFF8472_CC10_FC_SPEED_1200 0x80 + +#define SFF8472_CC36_XGE_UNALLOCATED 0x01 +#define SFF8472_CC36_UNALLOCATED1 0xF7 + +#define SFF8471_CC60_FC_PI_4_LIMITING 0x08 +#define SFF8471_CC60_SFF8431_LIMITING 0x04 +#define SFF8471_CC60_FC_PI_4 0x02 +#define SFF8471_CC60_SFF8431 0x01 + +/* diagnostic monitoring type 0x92 */ +#define SFF8472_DOM_IMPL 0x40 +#define SFF8472_DOM_EXTCAL 0x10 +#define SFF8472_DOM_RXPWRTYPE 0x08 + +#define SFF8472_DOM_SUPPORTED(idprom) \ + ((idprom[92] & SFF8472_DOM_IMPL)? 1:0) +#define SFF8472_DOM_USE_EXTCAL(idprom) \ + ((idprom[92] & SFF8472_DOM_EXTCAL)? 1:0) +#define SFF8472_DOM_GET_RXPWR_TYPE(idprom) \ + ((idprom[92] & SFF8472_DOM_RXPWRTYPE)? 1:0) + +/* SFF8472 A2 registers */ + +/* 32-bit little-endian calibration constants */ +#define SFF8472_CAL_RXPWR4 56 +#define SFF8472_CAL_RXPWR3 60 +#define SFF8472_CAL_RXPWR2 64 +#define SFF8472_CAL_RXPWR1 68 +#define SFF8472_CAL_RXPWR0 72 + +/* 16-bit little endian calibration constants */ +#define SFF8472_CAL_TXI_SLP 76 +#define SFF8472_CAL_TXI_OFF 78 +#define SFF8472_CAL_TXPWR_SLP 80 +#define SFF8472_CAL_TXPWR_OFF 82 +#define SFF8472_CAL_T_SLP 84 +#define SFF8472_CAL_T_OFF 86 +#define SFF8472_CAL_V_SLP 88 +#define SFF8472_CAL_V_OFF 90 + +#define SFF8472_RX_PWR(dom) \ + (dom[104] << 8 | dom[104 + 1]) +#define SFF8472_BIAS_CUR(dom) \ + (dom[100] << 8 | dom[100 + 1]) +#define SFF8472_SFP_VOLT(dom) \ + (dom[98] << 8 | dom[98 + 1]) +#define SFF8472_TX_PWR(dom) \ + (dom[102] << 8 | dom[102 + 1]) +#define SFF8472_SFP_TEMP(dom) \ + (dom[96] << 8 | dom[96 + 1]) + +#define SFF8472_MEDIA_XGE_SR(idprom) \ + ((idprom[3] & SFF8472_CC3_XGE_BASE_SR) != 0) +#define SFF8472_MEDIA_XGE_LR(idprom) \ + ((idprom[3] & SFF8472_CC3_XGE_BASE_LR) != 0) +#define SFF8472_MEDIA_XGE_LRM(idprom) \ + ((idprom[3] & SFF8472_CC3_XGE_BASE_LRM) != 0) +#define SFF8472_MEDIA_XGE_ER(idprom) \ + ((idprom[3] & SFF8472_CC3_XGE_BASE_ER) != 0) + +/* + * some CR cables identify as infiniband copper + * some CR cables identify as FC twinax + * some CR cables identify their electrical compliance + * using bytes 60,61 + * some CR cables identify as FC electrical intra- + * or inter-enclosure (bytes 7, 8) + */ + +static inline int +_sff8472_inf_1x(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 1; + return 0; +} + +static inline int +_sff8472_inf_1x_cu_active(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 0; + + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 1; + + return 0; +} + +static inline int +_sff8472_inf_1x_cu_passive(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 0; + + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 1; + + return 0; +} + +static inline int +_sff8472_fc_media(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 1; + return 0; +} + +static inline int +_sff8472_fc_media_tw(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 0; + + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 1; + + return 0; +} + +static inline int +_sff8472_fc_media_sm(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 0; + + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 1; + return 0; +} + +static inline int +_sff8472_fc_media_mm(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 0; + + if (((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) + && ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) == 0)) return 1; + if (((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) == 0) + && ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0)) return 1; + + return 0; +} + +static inline int +_sff8472_tech_fc(const uint8_t* idprom) +{ + if ((idprom[7] & SFF8472_CC7_FC_TECH_EL) != 0) return 1; + if ((idprom[7] & SFF8472_CC7_FC_TECH_LC) != 0) return 1; + if ((idprom[7] & SFF8472_CC7_FC_TECH_SA) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_EL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_LL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SN) != 0) return 1; + return 0; +} + +static inline int +_sff8472_tech_fc_el(const uint8_t* idprom) +{ + /* non-EL types */ + if ((idprom[7] & SFF8472_CC7_FC_TECH_LC) != 0) return 0; + if ((idprom[7] & SFF8472_CC7_FC_TECH_SA) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_LL) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SL) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SN) != 0) return 0; + + if (((idprom[7] & SFF8472_CC7_FC_TECH_EL) != 0) + || ((idprom[8] & SFF8472_CC8_FC_TECH_EL) != 0)) + return 1; + + return 0; +} + +static inline int +_sff8472_tech_fc_ll(const uint8_t* idprom) +{ + /* non-LL types */ + if ((idprom[7] & SFF8472_CC7_FC_TECH_EL) != 0) return 0; + if ((idprom[7] & SFF8472_CC7_FC_TECH_LC) != 0) return 0; + if ((idprom[7] & SFF8472_CC7_FC_TECH_SA) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SL) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SN) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_EL) != 0) return 0; + + if (((idprom[8] & SFF8472_CC8_FC_TECH_LL) != 0)) + return 1; + + return 0; +} + +/* do not specify an FC speed code unless you are actually FC */ +static inline int +_sff8472_fc_speed_ok(const uint8_t* idprom) +{ + if (_sff8472_tech_fc(idprom) + && (idprom[10] != 0)) + return 1; + if (!_sff8472_tech_fc(idprom) + && (idprom[10] == 0)) + return 1; + return 0; +} + +/* + * for dual ethernet/fc modules, we can infer the ethernet + * speed from the max FC speed + * (like, if the module mi-identifies itself as 10G and 1G + */ +static inline int +_sff8472_fc_speed_1g(const uint8_t *idprom) +{ + /* not FC, cannot infer speed */ + if (!_sff8472_tech_fc(idprom)) + return 0; + + /* 100MByte and 200MByte should be sufficient to identify as 1G */ + if (((idprom[10] & SFF8472_CC10_FC_SPEED_100) != 0) + || ((idprom[10] & SFF8472_CC10_FC_SPEED_200) != 0)) + return 1; + + return 0; +} + +static inline int +_sff8472_fc_speed_10g(const uint8_t *idprom) +{ + /* not FC, cannot infer speed */ + if (!_sff8472_tech_fc(idprom)) + return 0; + + /* check for any speed close to 10G */ + if (((idprom[10] & SFF8472_CC10_FC_SPEED_800) != 0) + || ((idprom[10] & SFF8472_CC10_FC_SPEED_1200) != 0) + || ((idprom[10] & SFF8472_CC10_FC_SPEED_1600) != 0) + || ((idprom[10] & SFF8472_CC10_FC_SPEED_3200) != 0)) + return 1; + + return 0; +} + +/* + * XXX roth + * some CR cables do not list an SFP+ active/passive bit, + * but register as active or passive via infiniband instead + */ + +static inline int +_sff8472_sfp_plus_passive(const uint8_t* idprom) +{ + if ((idprom[8] & SFF8472_CC8_SFP_PASSIVE) != 0) return 1; + + /* also allow pre-standard cables identifying as infiniband */ + if (_sff8472_inf_1x_cu_passive(idprom)) return 1; + + return 0; +} + +static inline int +_sff8472_sfp_plus_active(const uint8_t* idprom) +{ + if ((idprom[8] & SFF8472_CC8_SFP_ACTIVE) != 0) return 1; + + /* also allow pre-standard cables identifying as infiniband */ + if (_sff8472_inf_1x_cu_active(idprom)) return 1; + + return 0; +} + +/* + * XXX roth + * some pre-standard CR cables report a "wavelength" + * in byte 60, 61, pretending to be an optical module + */ + +#define _SFF8472_WAVELENGTH(idprom) \ + ((idprom[60] << 8) | idprom[61]) + +#define _SFF8472_COMPLIANCE_UNSPEC(idprom) \ + ((idprom[60] == 0) \ + && (idprom[61] == 0)) + +static inline int +_sff8472_compliance_passive_fc(const uint8_t* idprom) +{ + if (idprom[61] != 0) return 0; + + int byte = idprom[60]; + + if ((byte & SFF8471_CC60_FC_PI_4) == 0) return 0; + + /* no other wavelength-ish bits */ + byte &= ~SFF8471_CC60_FC_PI_4; + byte &= ~SFF8471_CC60_SFF8431; + if (byte != 0) return 0; + + return 1; +} + +static inline int +_sff8472_compliance_passive_sff(const uint8_t* idprom) +{ + if (idprom[61] != 0) return 0; + + int byte = idprom[60]; + + if ((byte & SFF8471_CC60_SFF8431) == 0) return 0; + + /* no other wavelength-ish bits */ + byte &= ~SFF8471_CC60_FC_PI_4; + byte &= ~SFF8471_CC60_SFF8431; + if (byte != 0) return 0; + + return 1; +} + +static inline int +_sff8472_compliance_active_fc(const uint8_t* idprom) +{ + if (idprom[61] != 0) return 0; + + int byte = idprom[60]; + + if (((byte & SFF8471_CC60_FC_PI_4) == 0) + && ((byte & SFF8471_CC60_FC_PI_4_LIMITING) == 0)) + return 0; + + /* no other wavelength-ish bits */ + byte &= ~SFF8471_CC60_FC_PI_4; + byte &= ~SFF8471_CC60_FC_PI_4_LIMITING; + byte &= ~SFF8471_CC60_SFF8431; + byte &= ~SFF8471_CC60_SFF8431_LIMITING; + if (byte != 0) return 0; + + if (idprom[61] != 0) return 0; + + return 1; +} + +static inline int +_sff8472_compliance_active_sff(const uint8_t* idprom) +{ + int byte = idprom[60]; + + if (((byte & SFF8471_CC60_SFF8431) == 0) + && ((byte & SFF8471_CC60_SFF8431_LIMITING) == 0)) + return 0; + + /* no other wavelength-ish bits */ + byte &= ~SFF8471_CC60_FC_PI_4; + byte &= ~SFF8471_CC60_FC_PI_4_LIMITING; + byte &= ~SFF8471_CC60_SFF8431; + byte &= ~SFF8471_CC60_SFF8431_LIMITING; + if (byte != 0) return 0; + + if (idprom[61] != 0) return 0; + + return 1; +} + +/* + * Cisco pre-standard CR cables + */ +static inline int +_sff8472_hack_cr(const uint8_t* idprom) +{ + /* vendor is 'OEM' */ + if (SFF_STRNCMP((char*)idprom+20, "OEM ", 4) != 0) return 0; + + /* model reads like 'SFP-H10GB-CU...' */ + if (SFF_STRNCMP((char*)idprom+40, "SFP-H10GB-CU", 12) != 0) return 0; + + /* S/N reads like 'CSC...' */ + if (SFF_STRNCMP((char*)idprom+68, "CSC", 3) != 0) return 0; + + /* + * congratulations, you have an expensive Cisco + * pre-standard CR cable. + */ + return 1; +} + +#define SFF8472_MEDIA_GBE_SX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_SX) != 0) +#define SFF8472_MEDIA_GBE_LX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_LX) != 0) +#define SFF8472_MEDIA_GBE_CX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_CX) != 0) +#define SFF8472_MEDIA_GBE_T(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_T) != 0) + +#define SFF8472_MEDIA_CBE_LX(idprom) \ + ((idprom[6] & SFF8472_CC6_CBE_BASE_LX) != 0) +#define SFF8472_MEDIA_CBE_FX(idprom) \ + ((idprom[6] & SFF8472_CC6_CBE_BASE_FX) != 0) + +/* + * XXX roth + * ZR Finisar optics don't list any ethernet + * or FC compliance, but *do* identify as having a high bit rate + */ + +static inline int +_sff8472_bitrate_xge(const uint8_t *idprom) +{ + if (idprom[12] == 0) + return 0; + if (idprom[12] == 0xFF) + return 0; + long long br = (long long) idprom[12] * 100*1000000; + if (br > 10LL*1000*1000000) + return 1; + return 0; +} + +static inline int +_sff8472_bitrate_gbe(const uint8_t *idprom) +{ + if (idprom[12] == 0) + return 0; + if (idprom[12] == 0xFF) + return 0; + long long br = (long long) idprom[12] * 100*1000000; + if (br > 1LL*1000*1000000 && br < 5LL*1000*1000000) + return 1; + return 0; +} + +static inline int +_sff8472_length_sm(const uint8_t *idprom) +{ + if ((idprom[14] == 0) && (idprom[15] == 0)) return 0; + if (idprom[14] != 0) + return idprom[14] * 1000; + return idprom[15] * 100; +} + +static inline int +_sff8472_length_om2(const uint8_t *idprom) +{ + return idprom[16] * 10; +} + +static inline int +_sff8472_length_om1(const uint8_t *idprom) +{ + return idprom[17] * 10; +} + +static inline int +_sff8472_length_om4(const uint8_t *idprom) +{ + return idprom[18] * 10; +} + +static inline int +_sff8472_length_cu(const uint8_t *idprom) +{ + return idprom[18]; +} + +static inline int +_sff8472_length_om3(const uint8_t *idprom) +{ + return idprom[19] * 10; +} + +/* grab-bag to detect pre-standard CR media */ +static inline int +_sff8472_media_cr_passive(const uint8_t* idprom) +{ + int maybe = 0; + + if (_sff8472_inf_1x_cu_passive(idprom)) + maybe = 1; + else if (_sff8472_inf_1x(idprom)) + return 0; + + if (_sff8472_tech_fc_el(idprom)) + maybe = 1; + else if (_sff8472_tech_fc(idprom)) + return 0; + + if (idprom[4] != 0) return 0; + if (idprom[5] != 0) return 0; + /* + * XXX roth -- PAN-934 -- Tyco CR cable advertises 1000BASE-CX, + * presumably because it is a 2-wire cable + */ + if ((idprom[6] != SFF8472_CC6_GBE_BASE_CX) + && (idprom[6] != 0)) + return 0; + + if (_sff8472_sfp_plus_passive(idprom)) + maybe = 1; + + if (_sff8472_fc_media_tw(idprom)) + maybe = 1; + else if (_sff8472_fc_media(idprom)) + return 0; + + if (!_sff8472_fc_speed_ok(idprom)) + return 0; + + /* + * XXX roth -- PAN-934 -- once we relax the checks here + * for 1000BASE-CX, we need to make sure we don't accept any + * 1G cables... make sure the FC speed is specified, + * and is high enough. + */ + if ((idprom[6] == SFF8472_CC6_GBE_BASE_CX) + && !_sff8472_tech_fc(idprom) + && !_sff8472_bitrate_xge(idprom)) + return 0; + if ((idprom[6] == SFF8472_CC6_GBE_BASE_CX) + && _sff8472_tech_fc(idprom) + && !_sff8472_fc_speed_10g(idprom)) + return 0; + + /* + * PAN-1233 -- cable identifies as 1000BASE-CX with a high BR + */ + if ((idprom[6] == SFF8472_CC6_GBE_BASE_CX) + && (_sff8472_length_cu(idprom) > 0) + && (_sff8472_bitrate_xge(idprom))) + maybe = 1; + + if (_sff8472_hack_cr(idprom)) + maybe = 1; + + if (maybe) { + if (!_sff8472_compliance_passive_fc(idprom) + && !_sff8472_compliance_passive_sff(idprom) + && (_SFF8472_WAVELENGTH(idprom) != 850) + && !_SFF8472_COMPLIANCE_UNSPEC(idprom) + && !_sff8472_hack_cr(idprom)) + return 0; + } + + return maybe; +} + +static inline int +_sff8472_media_cr_active(const uint8_t* idprom) +{ + int maybe = 0; + + if (_sff8472_inf_1x_cu_active(idprom)) + maybe = 1; + else if (_sff8472_inf_1x(idprom)) + return 0; + + if (_sff8472_tech_fc_el(idprom)) + maybe = 1; + else if (_sff8472_tech_fc(idprom)) + return 0; + + if (idprom[4] != 0) return 0; + if (idprom[5] != 0) return 0; + /* + * XXX roth -- PAN-1111 -- 3M CR cable advertises 1000BASE-CX, + * presumably because it is a 2-wire cable + */ + if ((idprom[6] != SFF8472_CC6_GBE_BASE_CX) + && (idprom[6] != 0)) + return 0; + + if (_sff8472_sfp_plus_active(idprom)) + maybe = 1; + + if (_sff8472_fc_media_tw(idprom)) + maybe = 1; + else if (_sff8472_fc_media(idprom)) + return 0; + + if (!_sff8472_fc_speed_ok(idprom)) + return 0; + + /* + * XXX roth -- PAN-1111 -- yet another CR cable + * that advertises as 1000BASE-CX. + */ + if ((idprom[6] == SFF8472_CC6_GBE_BASE_CX) + && !_sff8472_tech_fc(idprom)) + return 0; + if ((idprom[6] == SFF8472_CC6_GBE_BASE_CX) + && _sff8472_tech_fc(idprom) + && !_sff8472_fc_speed_10g(idprom)) + return 0; + + if (maybe) { + if (!_sff8472_compliance_active_fc(idprom) + && !_sff8472_compliance_active_sff(idprom) + && !_SFF8472_COMPLIANCE_UNSPEC(idprom)) + return 0; + } + + return maybe; +} + +static inline int +_sff8472_media_zr(const uint8_t *idprom) +{ + if (!SFF8472_MODULE_SFP(idprom)) return 0; + + /* should be LC connector */ + if ((idprom[2] & SFF8472_CONN_LC) == 0) return 0; + + /* do not advertise any other infiniband or ethernet features */ + if (_sff8472_inf_1x(idprom)) return 0; + if (SFF8472_MEDIA_XGE_SR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8472_MEDIA_XGE_ER(idprom)) return 0; + + /* advertise media and tech as per FC */ + if (_sff8472_tech_fc_ll(idprom) == 0) return 0; + if (_sff8472_fc_media_sm(idprom) == 0) return 0; + + /* at least 10GbE */ + if (!_sff8472_bitrate_xge(idprom)) return 0; + + /* at least 40km of single-mode */ + if ((idprom[14] > 40) && (idprom[15] == 0xff)) + return 1; + + return 0; + +} + +static inline int +_sff8472_media_srlite(const uint8_t *idprom) +{ + if (!SFF8472_MODULE_SFP(idprom)) return 0; + + /* should be LC connector */ + if ((idprom[2] & SFF8472_CONN_LC) == 0) return 0; + + /* do not advertise any other infiniband or ethernet features */ + if (_sff8472_inf_1x(idprom)) return 0; + if (SFF8472_MEDIA_XGE_SR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8472_MEDIA_XGE_ER(idprom)) return 0; + + /* do not advertise FC media */ + if (_sff8472_fc_media(idprom)) return 0; + if (_sff8472_tech_fc(idprom)) return 0; + + /* at least 10GbE */ + if (!_sff8472_bitrate_xge(idprom)) return 0; + + /* no single-mode fiber length */ + if (idprom[14] != 0) return 0; + if (idprom[15] != 0) return 0; + + /* some non-zero multi-mode fiber length */ + if (_sff8472_length_sm(idprom)) return 0; + if (_sff8472_length_om1(idprom)) return 1; + if (_sff8472_length_om2(idprom)) return 1; + if (_sff8472_length_om3(idprom)) return 1; + if (_sff8472_length_om4(idprom)) return 1; + return 0; + +} + +/* + * some modules (e.g. Finisar FTRJ8519P1BNL-B1, 1G Ethernet / + * 2G fiber) mis-identify as supporting 10G *and* 1G; + * in this case we do not want to enable 10G mode; + * we can verify this by looking at the FC speed field + */ + +static inline int +_sff8472_media_gbe_sx_fc_hack(const uint8_t *idprom) +{ + if (!SFF8472_MODULE_SFP(idprom)) return 0; + + /* module should report as SX */ + if (!SFF8472_MEDIA_GBE_SX(idprom)) return 0; + + /* module erroneously reports as 10G */ + if (!SFF8472_MEDIA_XGE_SR(idprom) + || !SFF8472_MEDIA_XGE_LR(idprom) + || !SFF8472_MEDIA_XGE_LRM(idprom) + || !SFF8472_MEDIA_XGE_ER(idprom)) return 0; + + /* module reports as 1G FC, but not 10G */ + if (_sff8472_fc_speed_1g(idprom) + && !_sff8472_fc_speed_10g(idprom)) + return 1; + else + return 0; +} + +static inline int +_sff8472_media_gbe_lx_fc_hack(const uint8_t *idprom) +{ + if (!SFF8472_MODULE_SFP(idprom)) return 0; + + /* module should report as LX */ + if (!SFF8472_MEDIA_GBE_LX(idprom)) return 0; + + /* module erroneously reports as 10G */ + if (!SFF8472_MEDIA_XGE_SR(idprom) + || !SFF8472_MEDIA_XGE_LR(idprom) + || !SFF8472_MEDIA_XGE_LRM(idprom) + || !SFF8472_MEDIA_XGE_ER(idprom)) return 0; + + /* module reports as 1G FC, but not 10G */ + if (_sff8472_fc_speed_1g(idprom) + && !_sff8472_fc_speed_10g(idprom)) + return 1; + else + return 0; +} + +/* + * Try to identify active SR cables, like breakouts + */ +static inline int +_sff8472_sfp_10g_aoc(const uint8_t *idprom) +{ + /* module should be sfp */ + if (!SFF8472_MODULE_SFP(idprom)) return 0; + + /* should report any normal specs */ + if (_sff8472_fc_media(idprom)) return 0; + if (_sff8472_tech_fc(idprom)) return 0; + + if (SFF8472_MEDIA_XGE_SR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LR(idprom)) return 0; + if (SFF8472_MEDIA_XGE_LRM(idprom)) return 0; + if (SFF8472_MEDIA_XGE_ER(idprom)) return 0; + + if (SFF8472_MEDIA_GBE_SX(idprom)) return 0; + if (SFF8472_MEDIA_GBE_LX(idprom)) return 0; + if (SFF8472_MEDIA_GBE_CX(idprom)) return 0; + if (SFF8472_MEDIA_GBE_T(idprom)) return 0; + if (SFF8472_MEDIA_CBE_LX(idprom)) return 0; + if (SFF8472_MEDIA_CBE_FX(idprom)) return 0; + + /* should be active */ + if (!_sff8472_sfp_plus_active(idprom)) return 0; + + /* should not report passive cable compliance */ + if (_sff8472_compliance_passive_fc(idprom)) return 0; + if (_sff8472_compliance_passive_sff(idprom)) return 0; + + /* should report active FC or SFF */ + if (!_sff8472_compliance_active_fc(idprom) + && !_sff8472_compliance_active_sff(idprom)) + return 0; + + /* nominal BR should be 10g */ + if (!_sff8472_bitrate_xge(idprom)) return 0; + + /* should be a short-ish cable */ + if (_sff8472_length_sm(idprom)) return 0; + if (_sff8472_length_om1(idprom)) return 0; + if (_sff8472_length_om2(idprom)) return 0; + if (_sff8472_length_om3(idprom)) return 0; + + if (!_sff8472_length_cu(idprom)) return 0; + if (_sff8472_length_cu(idprom) > 30) return 0; + + /* congratulations, probably an active optical cable */ + return 1; +} + +/* + * Infer cable length for fixed-length (AOC) optical cables + */ +static inline int +_sff8472_sfp_10g_aoc_length(const uint8_t *idprom) +{ + /* module should be qsfp */ + if (!SFF8472_MODULE_SFP(idprom)) return -1; + + /* does not report a fiber length, but does report a cable length */ + if (_sff8472_length_sm(idprom) > 0) return -1; + if (_sff8472_length_om1(idprom) > 0) return -1; + if (_sff8472_length_om2(idprom) > 0) return -1; + if (_sff8472_length_om3(idprom) > 0) return -1; + if (_sff8472_length_cu(idprom) > 0) + return _sff8472_length_cu(idprom); + + return -1; +} + +#endif diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/sff.h b/packages/base/any/onlp/src/sff/module/inc/sff/sff.h new file mode 100644 index 00000000..89892f32 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/sff.h @@ -0,0 +1,327 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __SFF_SFF_H__ +#define __SFF_SFF_H__ + +#include +#include + + +/* */ +/** sff_media_type */ +typedef enum sff_media_type_e { + SFF_MEDIA_TYPE_COPPER, + SFF_MEDIA_TYPE_FIBER, + SFF_MEDIA_TYPE_LAST = SFF_MEDIA_TYPE_FIBER, + SFF_MEDIA_TYPE_COUNT, + SFF_MEDIA_TYPE_INVALID = -1, +} sff_media_type_t; + +/** Strings macro. */ +#define SFF_MEDIA_TYPE_STRINGS \ +{\ + "COPPER", \ + "FIBER", \ +} +/** Enum names. */ +const char* sff_media_type_name(sff_media_type_t e); + +/** Enum values. */ +int sff_media_type_value(const char* str, sff_media_type_t* e, int substr); + +/** Enum descriptions. */ +const char* sff_media_type_desc(sff_media_type_t e); + +/** validator */ +#define SFF_MEDIA_TYPE_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= SFF_MEDIA_TYPE_FIBER)) + +/** sff_media_type_map table. */ +extern aim_map_si_t sff_media_type_map[]; +/** sff_media_type_desc_map table. */ +extern aim_map_si_t sff_media_type_desc_map[]; + +/** sff_module_type */ +typedef enum sff_module_type_e { + SFF_MODULE_TYPE_40G_BASE_CR4, + SFF_MODULE_TYPE_40G_BASE_SR4, + SFF_MODULE_TYPE_40G_BASE_LR4, + SFF_MODULE_TYPE_40G_BASE_ACTIVE, + SFF_MODULE_TYPE_40G_BASE_CR, + SFF_MODULE_TYPE_40G_BASE_SR2, + SFF_MODULE_TYPE_10G_BASE_SR, + SFF_MODULE_TYPE_10G_BASE_LR, + SFF_MODULE_TYPE_10G_BASE_LRM, + SFF_MODULE_TYPE_10G_BASE_ER, + SFF_MODULE_TYPE_10G_BASE_CR, + SFF_MODULE_TYPE_10G_BASE_SX, + SFF_MODULE_TYPE_10G_BASE_LX, + SFF_MODULE_TYPE_10G_BASE_ZR, + SFF_MODULE_TYPE_10G_BASE_SRL, + SFF_MODULE_TYPE_1G_BASE_SX, + SFF_MODULE_TYPE_1G_BASE_LX, + SFF_MODULE_TYPE_1G_BASE_CX, + SFF_MODULE_TYPE_1G_BASE_T, + SFF_MODULE_TYPE_100_BASE_LX, + SFF_MODULE_TYPE_100_BASE_FX, + SFF_MODULE_TYPE_LAST = SFF_MODULE_TYPE_100_BASE_FX, + SFF_MODULE_TYPE_COUNT, + SFF_MODULE_TYPE_INVALID = -1, +} sff_module_type_t; + +/** Strings macro. */ +#define SFF_MODULE_TYPE_STRINGS \ +{\ + "40G_BASE_CR4", \ + "40G_BASE_SR4", \ + "40G_BASE_LR4", \ + "40G_BASE_ACTIVE", \ + "40G_BASE_CR", \ + "40G_BASE_SR2", \ + "10G_BASE_SR", \ + "10G_BASE_LR", \ + "10G_BASE_LRM", \ + "10G_BASE_ER", \ + "10G_BASE_CR", \ + "10G_BASE_SX", \ + "10G_BASE_LX", \ + "10G_BASE_ZR", \ + "10G_BASE_SRL", \ + "1G_BASE_SX", \ + "1G_BASE_LX", \ + "1G_BASE_CX", \ + "1G_BASE_T", \ + "100_BASE_LX", \ + "100_BASE_FX", \ +} +/** Enum names. */ +const char* sff_module_type_name(sff_module_type_t e); + +/** Enum values. */ +int sff_module_type_value(const char* str, sff_module_type_t* e, int substr); + +/** Enum descriptions. */ +const char* sff_module_type_desc(sff_module_type_t e); + +/** validator */ +#define SFF_MODULE_TYPE_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= SFF_MODULE_TYPE_100_BASE_FX)) + +/** sff_module_type_map table. */ +extern aim_map_si_t sff_module_type_map[]; +/** sff_module_type_desc_map table. */ +extern aim_map_si_t sff_module_type_desc_map[]; + +/** sff_sfp_type */ +typedef enum sff_sfp_type_e { + SFF_SFP_TYPE_SFP, + SFF_SFP_TYPE_QSFP, + SFF_SFP_TYPE_QSFP_PLUS, + SFF_SFP_TYPE_LAST = SFF_SFP_TYPE_QSFP_PLUS, + SFF_SFP_TYPE_COUNT, + SFF_SFP_TYPE_INVALID = -1, +} sff_sfp_type_t; + +/** Strings macro. */ +#define SFF_SFP_TYPE_STRINGS \ +{\ + "SFP", \ + "QSFP", \ + "QSFP_PLUS", \ +} +/** Enum names. */ +const char* sff_sfp_type_name(sff_sfp_type_t e); + +/** Enum values. */ +int sff_sfp_type_value(const char* str, sff_sfp_type_t* e, int substr); + +/** Enum descriptions. */ +const char* sff_sfp_type_desc(sff_sfp_type_t e); + +/** validator */ +#define SFF_SFP_TYPE_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= SFF_SFP_TYPE_QSFP_PLUS)) + +/** sff_sfp_type_map table. */ +extern aim_map_si_t sff_sfp_type_map[]; +/** sff_sfp_type_desc_map table. */ +extern aim_map_si_t sff_sfp_type_desc_map[]; + +/** sff_module_caps */ +typedef enum sff_module_caps_e { + SFF_MODULE_CAPS_F_100 = 1, + SFF_MODULE_CAPS_F_1G = 2, + SFF_MODULE_CAPS_F_10G = 4, + SFF_MODULE_CAPS_F_40G = 8, + SFF_MODULE_CAPS_F_100G = 16, +} sff_module_caps_t; + +/** Enum names. */ +const char* sff_module_caps_name(sff_module_caps_t e); + +/** Enum values. */ +int sff_module_caps_value(const char* str, sff_module_caps_t* e, int substr); + +/** Enum descriptions. */ +const char* sff_module_caps_desc(sff_module_caps_t e); + +/** Enum validator. */ +int sff_module_caps_valid(sff_module_caps_t e); + +/** validator */ +#define SFF_MODULE_CAPS_VALID(_e) \ + (sff_module_caps_valid((_e))) + +/** sff_module_caps_map table. */ +extern aim_map_si_t sff_module_caps_map[]; +/** sff_module_caps_desc_map table. */ +extern aim_map_si_t sff_module_caps_desc_map[]; +/* */ + +/** + * @brief Determine the SFP type (from the idprom data). + * @param idprom The SFF idprom. + */ +sff_sfp_type_t sff_sfp_type_get(const uint8_t* idprom); + +/** + * @brief Determine the SFF module type (from the idprom data). + * @param idprom The SFF idprom. + */ +sff_module_type_t sff_module_type_get(const uint8_t* idprom); + +/** + * @brief Determine the SFF Media type (from the idprom data)./ + * @param idprom The SFF idprom. + */ +sff_media_type_t sff_media_type_get(const uint8_t* idprom); + + +/** + * @brief Determine the SFF module capabilities (from the idprom data). + * @param idprom The SFF idprom. + * @param caps [out] Receives the capabilities. + * @returns 0 on successful parse. + * @returns < 0 on error. + */ +int sff_module_caps_get(const uint8_t* idprom, uint32_t* caps); + + +/** + * Display a summary of the given SFF module. + * @param idprom The idprom data + * @param pvs The output pvs. + */ + +void sff_module_show(const uint8_t* idprom, aim_pvs_t* pvs); + + + +/** + * SFF Module Information Structure + */ +typedef struct sff_info_s { + /** Raw eeprom data */ + uint8_t eeprom[256]; + + /** Vendor Name */ + char vendor[17]; + /** Model Number */ + char model[17]; + /** Serial Number */ + char serial[17]; + + /** SFP Type */ + sff_sfp_type_t sfp_type; + /** SFP Type Name */ + const char* sfp_type_name; + + /** Module Type */ + sff_module_type_t module_type; + /** Module Type Name */ + const char* module_type_name; + + /** Media Type */ + sff_media_type_t media_type; + /** Media Type Name */ + const char* media_type_name; + + /** Capabilities */ + sff_module_caps_t caps; + + /** Cable length, if available */ + int length; + char length_desc[16]; + + /** computed checksums for idprom contents */ + uint8_t cc_base; + uint8_t cc_ext; + + /** whether this SFP is supported */ + int supported; + +} sff_info_t; + + +/** + * @brief Initialize an SFF module information structure. + * @param rv [out] Receives the data. + * @param eeprom Raw EEPROM data. + * @note if eeprom is != NULL it will be copied into rv->eeprom first. + * @note if eeprom is NULL it is assumed the rv->eeprom buffer + * has already been initialized. + */ +int sff_info_init(sff_info_t* rv, uint8_t* eeprom); + +/** + * @brief Initialize an SFF module information structure from a file. + * @param rv [out] Receives thh data. + * @param fname The filename. + */ +int sff_info_init_file(sff_info_t* rv, const char* fname); + +/** + * @brief Show an sff info structure. + * @param info The info structure. + * @param pvs The output pvs. + */ +void sff_info_show(sff_info_t* info, aim_pvs_t* pvs); + +/** + * @brief Invalidate an idprom data structure, + * such that any resulting sff_info_init will fail. + * @param eeprom The idprom buffer (256 bytes). + */ +void sff_info_invalidate(sff_info_t *info); + +/** + * @brief Determine if this is a valid SFP + * (whether or not we can parse it) + * @param info The info structure. + * @param verbose Whether to report errors on invalid contents. + */ +int sff_info_valid(sff_info_t *info, int verbose); + +#endif /* __SFF_SFF_H__ */ diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/sff.x b/packages/base/any/onlp/src/sff/module/inc/sff/sff.x new file mode 100644 index 00000000..d477a23b --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/sff.x @@ -0,0 +1,21 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* */ +#ifdef SFF_ENUMERATION_ENTRY +SFF_ENUMERATION_ENTRY(sff_media_type, "") +SFF_ENUMERATION_ENTRY(sff_sfp_type, "") +SFF_ENUMERATION_ENTRY(sff_module_type, "") +SFF_ENUMERATION_ENTRY(sff_module_caps, "") +#undef SFF_ENUMERATION_ENTRY +#endif +/* */ + + diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/sff_config.h b/packages/base/any/onlp/src/sff/module/inc/sff/sff_config.h new file mode 100644 index 00000000..966d24c4 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/sff_config.h @@ -0,0 +1,147 @@ +/**************************************************************************//** + * + * @file + * @brief sff Configuration Header + * + * @addtogroup sff-config + * @{ + * + *****************************************************************************/ +#ifndef __SFF_CONFIG_H__ +#define __SFF_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef SFF_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * SFF_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef SFF_CONFIG_INCLUDE_LOGGING +#define SFF_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * SFF_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef SFF_CONFIG_LOG_OPTIONS_DEFAULT +#define SFF_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * SFF_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef SFF_CONFIG_LOG_BITS_DEFAULT +#define SFF_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * SFF_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef SFF_CONFIG_PORTING_STDLIB +#define SFF_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS SFF_CONFIG_PORTING_STDLIB +#endif + +/** + * SFF_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef SFF_CONFIG_INCLUDE_UCLI +#define SFF_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * SFF_CONFIG_INCLUDE_SFF_TOOL + * + * Include the SFF tool main entry point. */ + + +#ifndef SFF_CONFIG_INCLUDE_SFF_TOOL +#define SFF_CONFIG_INCLUDE_SFF_TOOL 0 +#endif + +/** + * SFF_CONFIG_INCLUDE_EXT_CC_CHECK + * + * Include extended checksum verification. */ + + +#ifndef SFF_CONFIG_INCLUDE_EXT_CC_CHECK +#define SFF_CONFIG_INCLUDE_EXT_CC_CHECK 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct sff_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} sff_config_settings_t; + +/** Configuration settings table. */ +/** sff_config_settings table. */ +extern sff_config_settings_t sff_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* sff_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int sff_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "sff_porting.h" + +#endif /* __SFF_CONFIG_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/sff_dox.h b/packages/base/any/onlp/src/sff/module/inc/sff/sff_dox.h new file mode 100644 index 00000000..1b99e7c9 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/sff_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * sff Doxygen Header + * + *****************************************************************************/ +#ifndef __SFF_DOX_H__ +#define __SFF_DOX_H__ + +/** + * @defgroup sff sff - sff Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup sff-sff Public Interface + * @defgroup sff-config Compile Time Configuration + * @defgroup sff-porting Porting Macros + * + * @} + * + */ + +#endif /* __SFF_DOX_H__ */ diff --git a/packages/base/any/onlp/src/sff/module/inc/sff/sff_porting.h b/packages/base/any/onlp/src/sff/module/inc/sff/sff_porting.h new file mode 100644 index 00000000..2425036a --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/inc/sff/sff_porting.h @@ -0,0 +1,87 @@ +/**************************************************************************//** + * + * @file + * @brief sff Porting Macros. + * + * @addtogroup sff-porting + * @{ + * + *****************************************************************************/ +#ifndef __SFF_PORTING_H__ +#define __SFF_PORTING_H__ + + +/* */ +#if SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef SFF_MEMSET + #if defined(GLOBAL_MEMSET) + #define SFF_MEMSET GLOBAL_MEMSET + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_MEMSET memset + #else + #error The macro SFF_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef SFF_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define SFF_MEMCPY GLOBAL_MEMCPY + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_MEMCPY memcpy + #else + #error The macro SFF_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef SFF_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define SFF_STRNCPY GLOBAL_STRNCPY + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_STRNCPY strncpy + #else + #error The macro SFF_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef SFF_STRNCMP + #if defined(GLOBAL_STRNCMP) + #define SFF_STRNCMP GLOBAL_STRNCMP + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_STRNCMP strncmp + #else + #error The macro SFF_STRNCMP is required but cannot be defined. + #endif +#endif + +#ifndef SFF_STRLEN + #if defined(GLOBAL_STRLEN) + #define SFF_STRLEN GLOBAL_STRLEN + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_STRLEN strlen + #else + #error The macro SFF_STRLEN is required but cannot be defined. + #endif +#endif + +#ifndef SFF_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define SFF_SNPRINTF GLOBAL_SNPRINTF + #elif SFF_CONFIG_PORTING_STDLIB == 1 + #define SFF_SNPRINTF snprintf + #else + #error The macro SFF_SNPRINTF is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __SFF_PORTING_H__ */ +/* @} */ diff --git a/packages/base/any/onlp/src/sff/module/make.mk b/packages/base/any/onlp/src/sff/module/make.mk new file mode 100644 index 00000000..9f001b0e --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +sff_INCLUDES := -I $(THIS_DIR)inc +sff_INTERNAL_INCLUDES := -I $(THIS_DIR)src +sff_DEPENDMODULE_ENTRIES := init:sff + diff --git a/packages/base/any/onlp/src/sff/module/src/8472.c b/packages/base/any/onlp/src/sff/module/src/8472.c new file mode 100644 index 00000000..cb8d13a8 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/8472.c @@ -0,0 +1,328 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#if 0 + +/* + * some CR cables identify as infiniband copper + * some CR cables identify as FC twinax + * some CR cables identify their electrical compliance + * using bytes 60,61 + * some CR cables identify as FC electrical intra- + * or inter-enclosure (bytes 7, 8) + */ + +int +sff8472_inf_1x(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 1; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 1; + return 0; +} + +int +sff8472_inf_1x_cu_active(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 0; + + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 1; + + return 0; +} + +int +sff8472_inf_1x_cu_passive(const uint8_t* idprom) +{ + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_ACTIVE) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_LX) != 0) return 0; + if ((idprom[3] & SFF8472_CC3_INF_1X_SX) != 0) return 0; + + if ((idprom[3] & SFF8472_CC3_INF_1X_CU_PASSIVE) != 0) return 1; + + return 0; +} + +int +sff8472_fc_media(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 1; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 1; + return 0; +} + +int +sff8472_fc_media_tw(const uint8_t* idprom) +{ + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_SM) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M5) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_M6) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TV) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_MI) != 0) return 0; + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TP) != 0) return 0; + + if ((idprom[9] & SFF8472_CC9_FC_MEDIA_TW) != 0) return 1; + + return 0; +} + +int +sff8472_tech_fc(const uint8_t* idprom) +{ + if ((idprom[7] & SFF8472_CC7_FC_TECH_EL) != 0) return 1; + if ((idprom[7] & SFF8472_CC7_FC_TECH_LC) != 0) return 1; + if ((idprom[7] & SFF8472_CC7_FC_TECH_SA) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_EL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_LL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SL) != 0) return 1; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SN) != 0) return 1; + return 0; +} + +int +sff8472_tech_fc_el(const uint8_t* idprom) +{ + /* non-EL types */ + if ((idprom[7] & SFF8472_CC7_FC_TECH_LC) != 0) return 0; + if ((idprom[7] & SFF8472_CC7_FC_TECH_SA) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_LL) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SL) != 0) return 0; + if ((idprom[8] & SFF8472_CC8_FC_TECH_SN) != 0) return 0; + + if (((idprom[7] & SFF8472_CC7_FC_TECH_EL) != 0) + && ((idprom[8] & SFF8472_CC8_FC_TECH_EL) == 0)) + return 1; + if (((idprom[7] & SFF8472_CC7_FC_TECH_EL) == 0) + && ((idprom[8] & SFF8472_CC8_FC_TECH_EL) != 0)) + return 1; + + return 0; +} + +/* do not specify an FC speed code unless you actually FC */ +int +sff8472_fc_speed_ok(const uint8_t* idprom) +{ + if (_sff8472_tech_fc(idprom) + && (idprom[10] != 0)) + return 1; + if (!_sff8472_tech_fc(idprom) + && (idprom[10] == 0)) + return 1; + return 0; +} + +/* + * XXX roth + * some CR cables do not list an SFP+ active/passive bit, + * but register as active or passive via infiniband instead + */ + +int +sff8472_sfp_plus_passive(const uint8_t* idprom) +{ + if ((idprom[8] & SFF8472_CC8_SFP_PASSIVE) != 0) return 1; + + /* also allow pre-standard cables identifying as infiniband */ + if (_sff8472_inf_1x_cu_passive(idprom)) return 1; + + return 0; +} + +int +sff8472_sfp_plus_active(const uint8_t* idprom) +{ + if ((idprom[8] & SFF8472_CC8_SFP_ACTIVE) != 0) return 1; + + /* also allow pre-standard cables identifying as infiniband */ + if (_sff8472_inf_1x_cu_active(idprom)) return 1; + + return 0; +} + +/* + * XXX roth + * some pre-standard CR cables report a "wavelength" + * in byte 60, 61, pretending to be an optical module + */ + +#define _SFF8472_WAVELENGTH(idprom) \ + ((idprom[60] << 8) | idprom[61]) + +#define _SFF8472_COMPLIANCE_UNSPEC(idprom) \ + ((idprom[60] == 0) \ + && (idprom[61] == 0)) + +#define _SFF8472_COMPLIANCE_PASSIVE_FC(idprom) \ + (((idprom[60] & SFF8471_CC60_FC_PI_4) != 0) \ + && (idprom[61] == 0)) + +#define _SFF8472_COMPLIANCE_PASSIVE_SFF(idprom) \ + (((idprom[60] & SFF8471_CC60_SFF8431) != 0) \ + && (idprom[61] == 0)) + +#define _SFF8472_COMPLIANCE_ACTIVE_FC(idprom) \ + ((((idprom[60] & SFF8471_CC60_FC_PI_4) != 0) \ + || (idprom[60] & SFF8471_CC60_FC_PI_4_LIMITING) != 0) \ + && (idprom[61] == 0)) + +#define _SFF8472_COMPLIANCE_ACTIVE_SFF(idprom) \ + ((((idprom[60] & SFF8471_CC60_SFF8431) != 0) \ + || (idprom[60] & SFF8471_CC60_SFF8431_LIMITING) != 0) \ + && (idprom[61] == 0)) + +/* + * Cisco pre-standard CR cables + */ +int +sff8472_hack_cr(const uint8_t* idprom) +{ + /* vendor is 'OEM' */ + if (SFF_STRNCMP((char*)idprom+20, "OEM ", 4) != 0) return 0; + + /* model reads like 'SFP-H10GB-CU...' */ + if (SFF_STRNCMP((char*)idprom+40, "SFP-H10GB-CU", 12) != 0) return 0; + + /* S/N reads like 'CSC...' */ + if (SFF_STRNCMP((char*)idprom+68, "CSC", 3) != 0) return 0; + + /* + * congratulations, you have an expensive Cisco + * pre-standard CR cable. + */ + return 1; +} + +/* grab-bag to detect pre-standard CR media */ +int +sff8472_media_cr_passive(const uint8_t* idprom) +{ + int maybe = 0; + + if (_sff8472_inf_1x_cu_passive(idprom)) + maybe = 1; + else if (_sff8472_inf_1x(idprom)) + return 0; + + if (_sff8472_tech_fc_el(idprom)) + maybe = 1; + else if (_sff8472_tech_fc(idprom)) + return 0; + + if (idprom[4] != 0) return 0; + if (idprom[5] != 0) return 0; + if (idprom[6] != 0) return 0; + + if (_sff8472_sfp_plus_passive(idprom)) + maybe = 1; + + if (_sff8472_fc_media_tw(idprom)) + maybe = 1; + else if (_sff8472_fc_media(idprom)) + return 0; + + if (!_sff8472_fc_speed_ok(idprom)) + return 0; + + if (_sff8472_hack_cr(idprom)) + maybe = 1; + + if (maybe) { + if (!_SFF8472_COMPLIANCE_PASSIVE_FC(idprom) + && !_SFF8472_COMPLIANCE_PASSIVE_SFF(idprom) + && (_SFF8472_WAVELENGTH(idprom) != 850) + && !_SFF8472_COMPLIANCE_UNSPEC(idprom) + && !_sff8472_hack_cr(idprom)) + return 0; + } + + return maybe; +} + +int +sff8472_media_cr_active(const uint8_t* idprom) +{ + int maybe = 0; + + if (_sff8472_inf_1x_cu_active(idprom)) + maybe = 1; + else if (_sff8472_inf_1x(idprom)) + return 0; + + if (_sff8472_tech_fc_el(idprom)) + maybe = 1; + else if (_sff8472_tech_fc(idprom)) + return 0; + + if (idprom[4] != 0) return 0; + if (idprom[5] != 0) return 0; + if (idprom[6] != 0) return 0; + + if (_sff8472_sfp_plus_active(idprom)) + maybe = 1; + + if (_sff8472_fc_media_tw(idprom)) + maybe = 1; + else if (_sff8472_fc_media(idprom)) + return 0; + + if (!_sff8472_fc_speed_ok(idprom)) + return 0; + + if (maybe) { + if (!_SFF8472_COMPLIANCE_ACTIVE_FC(idprom) + && !_SFF8472_COMPLIANCE_ACTIVE_SFF(idprom) + && !_SFF8472_COMPLIANCE_UNSPEC(idprom)) + return 0; + } + + return maybe; +} + +#define SFF8472_MEDIA_GBE_SX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_SX) != 0) +#define SFF8472_MEDIA_GBE_LX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_LX) != 0) +#define SFF8472_MEDIA_GBE_CX(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_CX) != 0) +#define SFF8472_MEDIA_GBE_T(idprom) \ + ((idprom[6] & SFF8472_CC6_GBE_BASE_T) != 0) + +#define SFF8472_MEDIA_CBE_LX(idprom) \ + ((idprom[6] & SFF8472_CC6_CBE_BASE_LX) != 0) +#define SFF8472_MEDIA_CBE_FX(idprom) \ + ((idprom[6] & SFF8472_CC6_CBE_BASE_FX) != 0) + + +#endif diff --git a/packages/base/any/onlp/src/sff/module/src/Makefile b/packages/base/any/onlp/src/sff/module/src/Makefile new file mode 100644 index 00000000..cf47d083 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py sff_ucli.c + diff --git a/packages/base/any/onlp/src/sff/module/src/make.mk b/packages/base/any/onlp/src/sff/module/src/make.mk new file mode 100644 index 00000000..40aa534c --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := sff +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/base/any/onlp/src/sff/module/src/sff.c b/packages/base/any/onlp/src/sff/module/src/sff.c new file mode 100644 index 00000000..626df106 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff.c @@ -0,0 +1,532 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include "sff_log.h" +#include + +sff_sfp_type_t +sff_sfp_type_get(const uint8_t* idprom) +{ + if(idprom) { + if(SFF8472_MODULE_SFP(idprom)) { + return SFF_SFP_TYPE_SFP; + } + if(SFF8436_MODULE_QSFP_PLUS_V2(idprom)) { + return SFF_SFP_TYPE_QSFP_PLUS; + } + } + return SFF_SFP_TYPE_INVALID; +} + +sff_module_type_t +sff_module_type_get(const uint8_t* idprom) +{ + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && SFF8436_MEDIA_40GE_CR4(idprom)) + return SFF_MODULE_TYPE_40G_BASE_CR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && SFF8436_MEDIA_40GE_SR4(idprom)) + return SFF_MODULE_TYPE_40G_BASE_SR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && _sff8436_qsfp_40g_sr4_aoc_pre(idprom)) + return SFF_MODULE_TYPE_40G_BASE_SR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && SFF8436_MEDIA_40GE_LR4(idprom)) + return SFF_MODULE_TYPE_40G_BASE_LR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && SFF8436_MEDIA_40GE_ACTIVE(idprom)) + return SFF_MODULE_TYPE_40G_BASE_ACTIVE; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && _sff8436_qsfp_40g_aoc_breakout(idprom)) + return SFF_MODULE_TYPE_40G_BASE_SR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && SFF8436_MEDIA_40GE_CR(idprom)) + return SFF_MODULE_TYPE_40G_BASE_CR; + + /* pre-standard finisar optics */ + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && _sff8436_qsfp_40g_pre(idprom) + && (SFF8436_TECH_FC_FIBER_LONG(idprom) + || SFF8436_MEDIA_FC_FIBER_SM(idprom))) + return SFF_MODULE_TYPE_40G_BASE_LR4; + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && _sff8436_qsfp_40g_pre(idprom) + && (SFF8436_TECH_FC_FIBER_SHORT(idprom) + || SFF8436_MEDIA_FC_FIBER_MM(idprom))) + return SFF_MODULE_TYPE_40G_BASE_SR4; + + /* pre-standard QSFP-BiDi optics */ + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom) + && _sff8436_qsfp_40g_sr2_bidi_pre(idprom)) + return SFF_MODULE_TYPE_40G_BASE_SR2; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_XGE_SR(idprom) + && !_sff8472_media_gbe_sx_fc_hack(idprom)) + return SFF_MODULE_TYPE_10G_BASE_SR; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_XGE_LR(idprom) + && !_sff8472_media_gbe_lx_fc_hack(idprom)) + return SFF_MODULE_TYPE_10G_BASE_LR; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_XGE_LRM(idprom) + && !_sff8472_media_gbe_lx_fc_hack(idprom)) + return SFF_MODULE_TYPE_10G_BASE_LRM; + + /* + * XXX roth -- PAN-934 -- DAC cable erroneously reports ER, + * so we need to disallow infiniband features when matching here. + * See also _sff8472_media_cr_passive, which encodes some + * additional workarounds for these cables. + */ + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_XGE_ER(idprom) + && !_sff8472_inf_1x_cu_active(idprom) + && !_sff8472_inf_1x_cu_passive(idprom)) + return SFF_MODULE_TYPE_10G_BASE_ER; + + /* XXX roth - not sure on this one */ + if (SFF8472_MODULE_SFP(idprom) + && _sff8472_media_cr_passive(idprom)) + return SFF_MODULE_TYPE_10G_BASE_CR; + + if (SFF8472_MODULE_SFP(idprom) + && _sff8472_media_cr_active(idprom)) { + if (_sff8472_sfp_10g_aoc(idprom)) + return SFF_MODULE_TYPE_10G_BASE_SR; + else + return SFF_MODULE_TYPE_10G_BASE_CR; + } + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_GBE_SX(idprom)) + return SFF_MODULE_TYPE_1G_BASE_SX; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_GBE_LX(idprom)) + return SFF_MODULE_TYPE_1G_BASE_LX; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_GBE_CX(idprom)) + return SFF_MODULE_TYPE_1G_BASE_CX; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_GBE_T(idprom)) + return SFF_MODULE_TYPE_1G_BASE_T; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_GBE_LX(idprom)) + return SFF_MODULE_TYPE_1G_BASE_LX; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_CBE_LX(idprom)) + return SFF_MODULE_TYPE_100_BASE_LX; + + if (SFF8472_MODULE_SFP(idprom) + && SFF8472_MEDIA_CBE_FX(idprom)) + return SFF_MODULE_TYPE_100_BASE_FX; + + /* non-standard (e.g. Finisar) ZR media */ + if (SFF8472_MODULE_SFP(idprom) + && _sff8472_media_zr(idprom)) + return SFF_MODULE_TYPE_10G_BASE_ZR; + + /* non-standard (e.g. Finisar) SRL media */ + if (SFF8472_MODULE_SFP(idprom) + && _sff8472_media_srlite(idprom)) + return SFF_MODULE_TYPE_10G_BASE_SRL; + + return SFF_MODULE_TYPE_INVALID; +} + +sff_media_type_t +sff_media_type_get(const uint8_t* idprom) +{ + sff_module_type_t mt = sff_module_type_get(idprom); + + switch(mt) + { + case SFF_MODULE_TYPE_40G_BASE_CR4: + case SFF_MODULE_TYPE_40G_BASE_CR: + case SFF_MODULE_TYPE_10G_BASE_CR: + case SFF_MODULE_TYPE_1G_BASE_CX: + case SFF_MODULE_TYPE_1G_BASE_T: + return SFF_MEDIA_TYPE_COPPER; + + case SFF_MODULE_TYPE_40G_BASE_SR4: + case SFF_MODULE_TYPE_40G_BASE_LR4: + case SFF_MODULE_TYPE_40G_BASE_ACTIVE: + case SFF_MODULE_TYPE_40G_BASE_SR2: + case SFF_MODULE_TYPE_10G_BASE_SR: + case SFF_MODULE_TYPE_10G_BASE_LR: + case SFF_MODULE_TYPE_10G_BASE_LRM: + case SFF_MODULE_TYPE_10G_BASE_ER: + case SFF_MODULE_TYPE_10G_BASE_SX: + case SFF_MODULE_TYPE_10G_BASE_LX: + case SFF_MODULE_TYPE_10G_BASE_ZR: + case SFF_MODULE_TYPE_10G_BASE_SRL: + case SFF_MODULE_TYPE_1G_BASE_SX: + case SFF_MODULE_TYPE_1G_BASE_LX: + case SFF_MODULE_TYPE_100_BASE_LX: + case SFF_MODULE_TYPE_100_BASE_FX: + return SFF_MEDIA_TYPE_FIBER; + + case SFF_MODULE_TYPE_COUNT: + case SFF_MODULE_TYPE_INVALID: + return SFF_MEDIA_TYPE_INVALID; + } + + return SFF_MEDIA_TYPE_INVALID; +} + +int +sff_module_caps_get(const uint8_t* idprom, uint32_t *caps) +{ + if (idprom == NULL) + return -1; + if (caps == NULL) + return -1; + + sff_module_type_t mt = sff_module_type_get(idprom); + *caps = 0; + + switch(mt) + { + case SFF_MODULE_TYPE_40G_BASE_CR4: + case SFF_MODULE_TYPE_40G_BASE_SR4: + case SFF_MODULE_TYPE_40G_BASE_LR4: + case SFF_MODULE_TYPE_40G_BASE_ACTIVE: + case SFF_MODULE_TYPE_40G_BASE_CR: + case SFF_MODULE_TYPE_40G_BASE_SR2: + *caps |= SFF_MODULE_CAPS_F_40G; + return 0; + + case SFF_MODULE_TYPE_10G_BASE_SR: + case SFF_MODULE_TYPE_10G_BASE_LR: + case SFF_MODULE_TYPE_10G_BASE_LRM: + case SFF_MODULE_TYPE_10G_BASE_ER: + case SFF_MODULE_TYPE_10G_BASE_CR: + case SFF_MODULE_TYPE_10G_BASE_SX: + case SFF_MODULE_TYPE_10G_BASE_LX: + case SFF_MODULE_TYPE_10G_BASE_ZR: + case SFF_MODULE_TYPE_10G_BASE_SRL: + *caps |= SFF_MODULE_CAPS_F_10G; + return 0; + + case SFF_MODULE_TYPE_1G_BASE_SX: + case SFF_MODULE_TYPE_1G_BASE_LX: + case SFF_MODULE_TYPE_1G_BASE_CX: + case SFF_MODULE_TYPE_1G_BASE_T: + *caps |= SFF_MODULE_CAPS_F_1G; + return 0; + + case SFF_MODULE_TYPE_100_BASE_LX: + case SFF_MODULE_TYPE_100_BASE_FX: + *caps |= SFF_MODULE_CAPS_F_100; + return 0; + + default: + return -1; + } +} + +void +sff_module_show(const uint8_t* idprom, aim_pvs_t* pvs) +{ + + if (SFF8436_MODULE_QSFP_PLUS_V2(idprom)) { + aim_printf(pvs, + "%-12.12s %-16.16s %-16.16s %-16.16s\n", + sff_module_type_desc(sff_module_type_get(idprom)), + idprom+148, idprom+168, idprom+196); + } else { + aim_printf(pvs, + "%-12.12s %-16.16s %-16.16s %-16.16s\n", + sff_module_type_desc(sff_module_type_get(idprom)), + idprom+20, idprom+40, idprom+68); + } +} + +static void +make_printable__(char* string) +{ + char* p; + for(p = string; p && *p; p++) { + if(!isprint(*p)) { + *p = '?'; + } + } +} + +/** + * @brief Initialize an SFF module information structure. + * @param rv [out] Receives the data. + * @param eeprom Raw EEPROM data. + * @note if eeprom is != NULL it will be copied into rv->eeprom first. + * @note if eeprom is NULL it is assumed the rv->eeprom buffer + * has already been initialized. + */ +int +sff_info_init(sff_info_t* rv, uint8_t* eeprom) +{ + if(rv == NULL) { + return -1; + } + rv->supported = 0; + + if(eeprom) { + SFF_MEMCPY(rv->eeprom, eeprom, 256); + } + + if (SFF8472_MODULE_SFP(rv->eeprom)) { + /* See SFF-8472 pp22, pp28 */ + int i; + for (i = 0, rv->cc_base = 0; i < 63; ++i) + rv->cc_base = (rv->cc_base + rv->eeprom[i]) & 0xFF; + for (i = 64, rv->cc_ext = 0; i < 95; ++i) + rv->cc_ext = (rv->cc_ext + rv->eeprom[i]) & 0xFF; + } else if (SFF8436_MODULE_QSFP_PLUS_V2(rv->eeprom)) { + /* See SFF-8436 pp72, pp73 */ + int i; + for (i = 128, rv->cc_base = 0; i < 191; ++i) + rv->cc_base = (rv->cc_base + rv->eeprom[i]) & 0xFF; + for (i = 192, rv->cc_ext = 0; i < 223; ++i) + rv->cc_ext = (rv->cc_ext + rv->eeprom[i]) & 0xFF; + } + + if (!sff_info_valid(rv, 1)) return -1; + + rv->sfp_type = sff_sfp_type_get(rv->eeprom); + if(rv->sfp_type == SFF_SFP_TYPE_INVALID) { + AIM_LOG_ERROR("sff_info_init() failed: invalid sfp type"); + return -1; + } + rv->sfp_type_name = sff_sfp_type_desc(rv->sfp_type); + + rv->module_type = sff_module_type_get(rv->eeprom); + if(rv->module_type == SFF_MODULE_TYPE_INVALID) { + AIM_LOG_ERROR("sff_info_init() failed: invalid module type"); + return -1; + } + rv->module_type_name = sff_module_type_desc(rv->module_type); + + rv->media_type = sff_media_type_get(rv->eeprom); + rv->media_type_name = sff_media_type_desc(rv->media_type); + + if (sff_module_caps_get(rv->eeprom, &rv->caps) < 0) { + AIM_LOG_ERROR("sff_info_init() failed: invalid module caps"); + return -1; + } + + int aoc_length; + switch (rv->media_type) { + case SFF_MEDIA_TYPE_COPPER: + switch (rv->sfp_type) { + case SFF_SFP_TYPE_QSFP_PLUS: + rv->length = rv->eeprom[146]; + break; + case SFF_SFP_TYPE_SFP: + rv->length = rv->eeprom[18]; + break; + default: + rv->length = -1; + break; + } + break; + case SFF_MEDIA_TYPE_FIBER: + aoc_length = _sff8436_qsfp_40g_aoc_length(rv->eeprom); + if (aoc_length < 0) + aoc_length = _sff8472_sfp_10g_aoc_length(rv->eeprom); + if (aoc_length > 0) + rv->length = aoc_length; + else + rv->length = -1; + break; + default: + rv->length = -1; + } + + const uint8_t *vendor, *model, *serial; + + switch(rv->sfp_type) + { + case SFF_SFP_TYPE_QSFP_PLUS: + vendor=rv->eeprom+148; + model=rv->eeprom+168; + serial=rv->eeprom+196; + break; + + case SFF_SFP_TYPE_SFP: + default: + vendor=rv->eeprom+20; + model=rv->eeprom+40; + serial=rv->eeprom+68; + break; + } + + /* handle NULL fields, they should actually be space-padded */ + const char *empty = " "; + if (*vendor) { + aim_strlcpy(rv->vendor, (char*)vendor, sizeof(rv->vendor)); + make_printable__(rv->vendor); + } + else { + aim_strlcpy(rv->vendor, empty, 17); + } + if (*model) { + aim_strlcpy(rv->model, (char*)model, sizeof(rv->model)); + make_printable__(rv->model); + } + else { + aim_strlcpy(rv->model, empty, 17); + } + if (*serial) { + aim_strlcpy(rv->serial, (char*)serial, sizeof(rv->serial)); + make_printable__(rv->serial); + } + else { + aim_strlcpy(rv->serial, empty, 17); + } + + if(rv->length == -1) { + rv->length_desc[0] = 0; + } + else { + SFF_SNPRINTF(rv->length_desc, sizeof(rv->length_desc), "%dm", rv->length); + } + rv->supported = 1; + + return 0; +} + +void +sff_info_show(sff_info_t* info, aim_pvs_t* pvs) +{ + aim_printf(pvs, "Vendor: %s Model: %s SN: %s Type: %s Module: %s Media: %s Length: %d\n", + info->vendor, info->model, info->serial, info->sfp_type_name, + info->module_type_name, info->media_type_name, info->length); +} + +int +sff_info_init_file(sff_info_t* info, const char* fname) +{ + int rv; + FILE* fp; + + SFF_MEMSET(info, 0, sizeof(*info)); + + if( (fp = fopen(fname, "r")) == NULL) { + AIM_LOG_ERROR("Failed to open eeprom file %s: %{errno}"); + return -1; + } + + if( (rv = fread(info->eeprom, 1, 256, fp)) > 0) { + if( (rv=sff_info_init(info, NULL)) < 0) { + AIM_LOG_ERROR("sff_init() failed on data from file %s: %d\n", fname, rv); + rv = -1; + } + rv = 0; + } + else { + rv = -1; + } + fclose(fp); + return rv; +} + +void +sff_info_invalidate(sff_info_t *info) +{ + memset(info->eeprom, 0xFF, 256); + info->cc_base = 0xFF; + info->cc_ext = 0xFF; + info->supported = 0; +} + +int +sff_info_valid(sff_info_t *info, int verbose) +{ + if (SFF8436_MODULE_QSFP_PLUS_V2(info->eeprom)) { + + if (info->cc_base != info->eeprom[191]) { + if (verbose) { + AIM_LOG_ERROR("sff_info_valid() failed: invalid base QSFP checksum (0x%x should be 0x%x)", + info->eeprom[191], info->cc_base); + } + return 0; + } + +#if SFF_CONFIG_INCLUDE_EXT_CC_CHECK == 1 + if (info->cc_ext != info->eeprom[223]) { + if (verbose) { + AIM_LOG_ERROR("sff_info_valid() failed: invalid extended QSFP checksum (0x%x should be 0x%x)", + info->eeprom[223], info->cc_ext); + } + return 0; + } +#endif + + } else if (SFF8472_MODULE_SFP(info->eeprom)) { + + if (info->cc_base != info->eeprom[63]) { + if (verbose) { + AIM_LOG_ERROR("sff_info_valid() failed: invalid base SFP checksum (0x%x should be 0x%x)", + info->eeprom[63], info->cc_base); + } + return 0; + } + +#if SFF_CONFIG_INCLUDE_EXT_CC_CHECK == 1 + if (info->cc_ext != info->eeprom[95]) { + if (verbose) { + AIM_LOG_ERROR("sff_info_valid() failed: invalid extended SFP checksum (0x%x should be 0x%x)", + info->eeprom[95], info->cc_ext); + } + return 0; + } +#endif + + } else { + + if (verbose) { + AIM_LOG_ERROR("sff_info_valid() failed: invalid module type"); + } + + return 0; + } + + return 1; +} diff --git a/packages/base/any/onlp/src/sff/module/src/sff_config.c b/packages/base/any/onlp/src/sff/module/src/sff_config.c new file mode 100644 index 00000000..1e448f3b --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_config.c @@ -0,0 +1,86 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __sff_config_STRINGIFY_NAME(_x) #_x +#define __sff_config_STRINGIFY_VALUE(_x) __sff_config_STRINGIFY_NAME(_x) +sff_config_settings_t sff_config_settings[] = +{ +#ifdef SFF_CONFIG_INCLUDE_LOGGING + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_INCLUDE_LOGGING), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_INCLUDE_LOGGING) }, +#else +{ SFF_CONFIG_INCLUDE_LOGGING(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_LOG_OPTIONS_DEFAULT + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_LOG_OPTIONS_DEFAULT), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ SFF_CONFIG_LOG_OPTIONS_DEFAULT(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_LOG_BITS_DEFAULT + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_LOG_BITS_DEFAULT), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ SFF_CONFIG_LOG_BITS_DEFAULT(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_PORTING_STDLIB + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_PORTING_STDLIB), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_PORTING_STDLIB) }, +#else +{ SFF_CONFIG_PORTING_STDLIB(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_INCLUDE_UCLI + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_INCLUDE_UCLI), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_INCLUDE_UCLI) }, +#else +{ SFF_CONFIG_INCLUDE_UCLI(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_INCLUDE_SFF_TOOL + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_INCLUDE_SFF_TOOL), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_INCLUDE_SFF_TOOL) }, +#else +{ SFF_CONFIG_INCLUDE_SFF_TOOL(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef SFF_CONFIG_INCLUDE_EXT_CC_CHECK + { __sff_config_STRINGIFY_NAME(SFF_CONFIG_INCLUDE_EXT_CC_CHECK), __sff_config_STRINGIFY_VALUE(SFF_CONFIG_INCLUDE_EXT_CC_CHECK) }, +#else +{ SFF_CONFIG_INCLUDE_EXT_CC_CHECK(__sff_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __sff_config_STRINGIFY_VALUE +#undef __sff_config_STRINGIFY_NAME + +const char* +sff_config_lookup(const char* setting) +{ + int i; + for(i = 0; sff_config_settings[i].name; i++) { + if(strcmp(sff_config_settings[i].name, setting)) { + return sff_config_settings[i].value; + } + } + return NULL; +} + +int +sff_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; sff_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", sff_config_settings[i].name, sff_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/base/any/onlp/src/sff/module/src/sff_enums.c b/packages/base/any/onlp/src/sff/module/src/sff_enums.c new file mode 100644 index 00000000..1af10c5e --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_enums.c @@ -0,0 +1,278 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include +#include + +/* */ +aim_map_si_t sff_media_type_map[] = +{ + { "COPPER", SFF_MEDIA_TYPE_COPPER }, + { "FIBER", SFF_MEDIA_TYPE_FIBER }, + { NULL, 0 } +}; + +aim_map_si_t sff_media_type_desc_map[] = +{ + { "Copper", SFF_MEDIA_TYPE_COPPER }, + { "Fiber", SFF_MEDIA_TYPE_FIBER }, + { NULL, 0 } +}; + +const char* +sff_media_type_name(sff_media_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_media_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_media_type'"; + } +} + +int +sff_media_type_value(const char* str, sff_media_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, sff_media_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +sff_media_type_desc(sff_media_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_media_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_media_type'"; + } +} + + +aim_map_si_t sff_module_type_map[] = +{ + { "40G_BASE_CR4", SFF_MODULE_TYPE_40G_BASE_CR4 }, + { "40G_BASE_SR4", SFF_MODULE_TYPE_40G_BASE_SR4 }, + { "40G_BASE_LR4", SFF_MODULE_TYPE_40G_BASE_LR4 }, + { "40G_BASE_ACTIVE", SFF_MODULE_TYPE_40G_BASE_ACTIVE }, + { "40G_BASE_CR", SFF_MODULE_TYPE_40G_BASE_CR }, + { "40G_BASE_SR2", SFF_MODULE_TYPE_40G_BASE_SR2 }, + { "10G_BASE_SR", SFF_MODULE_TYPE_10G_BASE_SR }, + { "10G_BASE_LR", SFF_MODULE_TYPE_10G_BASE_LR }, + { "10G_BASE_LRM", SFF_MODULE_TYPE_10G_BASE_LRM }, + { "10G_BASE_ER", SFF_MODULE_TYPE_10G_BASE_ER }, + { "10G_BASE_CR", SFF_MODULE_TYPE_10G_BASE_CR }, + { "10G_BASE_SX", SFF_MODULE_TYPE_10G_BASE_SX }, + { "10G_BASE_LX", SFF_MODULE_TYPE_10G_BASE_LX }, + { "10G_BASE_ZR", SFF_MODULE_TYPE_10G_BASE_ZR }, + { "10G_BASE_SRL", SFF_MODULE_TYPE_10G_BASE_SRL }, + { "1G_BASE_SX", SFF_MODULE_TYPE_1G_BASE_SX }, + { "1G_BASE_LX", SFF_MODULE_TYPE_1G_BASE_LX }, + { "1G_BASE_CX", SFF_MODULE_TYPE_1G_BASE_CX }, + { "1G_BASE_T", SFF_MODULE_TYPE_1G_BASE_T }, + { "100_BASE_LX", SFF_MODULE_TYPE_100_BASE_LX }, + { "100_BASE_FX", SFF_MODULE_TYPE_100_BASE_FX }, + { NULL, 0 } +}; + +aim_map_si_t sff_module_type_desc_map[] = +{ + { "40GBASE-CR4", SFF_MODULE_TYPE_40G_BASE_CR4 }, + { "40GBASE-SR4", SFF_MODULE_TYPE_40G_BASE_SR4 }, + { "40GBASE-LR4", SFF_MODULE_TYPE_40G_BASE_LR4 }, + { "40GBASE-ACTIVE", SFF_MODULE_TYPE_40G_BASE_ACTIVE }, + { "40GBASE-CR", SFF_MODULE_TYPE_40G_BASE_CR }, + { "40GBASE-SR2", SFF_MODULE_TYPE_40G_BASE_SR2 }, + { "10GBASE-SR", SFF_MODULE_TYPE_10G_BASE_SR }, + { "10GBASE-LR", SFF_MODULE_TYPE_10G_BASE_LR }, + { "10GBASE-LRM", SFF_MODULE_TYPE_10G_BASE_LRM }, + { "10GBASE-ER", SFF_MODULE_TYPE_10G_BASE_ER }, + { "10GBASE-CR", SFF_MODULE_TYPE_10G_BASE_CR }, + { "10GBASE-SX", SFF_MODULE_TYPE_10G_BASE_SX }, + { "10GBASE-LX", SFF_MODULE_TYPE_10G_BASE_LX }, + { "10GBASE-ZR", SFF_MODULE_TYPE_10G_BASE_ZR }, + { "10GBASE-SRL", SFF_MODULE_TYPE_10G_BASE_SRL }, + { "1GBASE-SX", SFF_MODULE_TYPE_1G_BASE_SX }, + { "1GBASE-LX", SFF_MODULE_TYPE_1G_BASE_LX }, + { "1GBASE-CX", SFF_MODULE_TYPE_1G_BASE_CX }, + { "1GBASE-T", SFF_MODULE_TYPE_1G_BASE_T }, + { "100BASE-LX", SFF_MODULE_TYPE_100_BASE_LX }, + { "100BASE-FX", SFF_MODULE_TYPE_100_BASE_FX }, + { NULL, 0 } +}; + +const char* +sff_module_type_name(sff_module_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_module_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_module_type'"; + } +} + +int +sff_module_type_value(const char* str, sff_module_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, sff_module_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +sff_module_type_desc(sff_module_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_module_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_module_type'"; + } +} + + +aim_map_si_t sff_sfp_type_map[] = +{ + { "SFP", SFF_SFP_TYPE_SFP }, + { "QSFP", SFF_SFP_TYPE_QSFP }, + { "QSFP_PLUS", SFF_SFP_TYPE_QSFP_PLUS }, + { NULL, 0 } +}; + +aim_map_si_t sff_sfp_type_desc_map[] = +{ + { "SFP", SFF_SFP_TYPE_SFP }, + { "QSFP", SFF_SFP_TYPE_QSFP }, + { "QSFP+", SFF_SFP_TYPE_QSFP_PLUS }, + { NULL, 0 } +}; + +const char* +sff_sfp_type_name(sff_sfp_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_sfp_type_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_sfp_type'"; + } +} + +int +sff_sfp_type_value(const char* str, sff_sfp_type_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, sff_sfp_type_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +sff_sfp_type_desc(sff_sfp_type_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_sfp_type_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_sfp_type'"; + } +} + + +aim_map_si_t sff_module_caps_map[] = +{ + { "F_100", SFF_MODULE_CAPS_F_100 }, + { "F_1G", SFF_MODULE_CAPS_F_1G }, + { "F_10G", SFF_MODULE_CAPS_F_10G }, + { "F_40G", SFF_MODULE_CAPS_F_40G }, + { "F_100G", SFF_MODULE_CAPS_F_100G }, + { NULL, 0 } +}; + +aim_map_si_t sff_module_caps_desc_map[] = +{ + { "None", SFF_MODULE_CAPS_F_100 }, + { "None", SFF_MODULE_CAPS_F_1G }, + { "None", SFF_MODULE_CAPS_F_10G }, + { "None", SFF_MODULE_CAPS_F_40G }, + { "None", SFF_MODULE_CAPS_F_100G }, + { NULL, 0 } +}; + +const char* +sff_module_caps_name(sff_module_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_module_caps_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_module_caps'"; + } +} + +int +sff_module_caps_value(const char* str, sff_module_caps_t* e, int substr) +{ + int i; + AIM_REFERENCE(substr); + if(aim_map_si_s(&i, str, sff_module_caps_map, 0)) { + /* Enum Found */ + *e = i; + return 0; + } + else { + return -1; + } +} + +const char* +sff_module_caps_desc(sff_module_caps_t e) +{ + const char* name; + if(aim_map_si_i(&name, e, sff_module_caps_desc_map, 0)) { + return name; + } + else { + return "-invalid value for enum type 'sff_module_caps'"; + } +} + +int +sff_module_caps_valid(sff_module_caps_t e) +{ + return aim_map_si_i(NULL, e, sff_module_caps_map, 0) ? 1 : 0; +} + +/* */ + diff --git a/packages/base/any/onlp/src/sff/module/src/sff_int.h b/packages/base/any/onlp/src/sff/module/src/sff_int.h new file mode 100644 index 00000000..3a44e241 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * sff Internal Header + * + *****************************************************************************/ +#ifndef __SFF_INT_H__ +#define __SFF_INT_H__ + +#include + + +#endif /* __SFF_INT_H__ */ diff --git a/packages/base/any/onlp/src/sff/module/src/sff_log.c b/packages/base/any/onlp/src/sff/module/src/sff_log.c new file mode 100644 index 00000000..bd348d20 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "sff_log.h" +/* + * sff log struct. + */ +AIM_LOG_STRUCT_DEFINE( + SFF_CONFIG_LOG_OPTIONS_DEFAULT, + SFF_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/base/any/onlp/src/sff/module/src/sff_log.h b/packages/base/any/onlp/src/sff/module/src/sff_log.h new file mode 100644 index 00000000..5e564436 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __SFF_LOG_H__ +#define __SFF_LOG_H__ + +#define AIM_LOG_MODULE_NAME sff +#include + +#endif /* __SFF_LOG_H__ */ diff --git a/packages/base/any/onlp/src/sff/module/src/sff_module.c b/packages/base/any/onlp/src/sff/module/src/sff_module.c new file mode 100644 index 00000000..676a04b2 --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_module.c @@ -0,0 +1,23 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "sff_log.h" + +static int +datatypes_init__(void) +{ +#define SFF_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __sff_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + diff --git a/packages/base/any/onlp/src/sff/module/src/sff_tool.c b/packages/base/any/onlp/src/sff/module/src/sff_tool.c new file mode 100644 index 00000000..81427f9b --- /dev/null +++ b/packages/base/any/onlp/src/sff/module/src/sff_tool.c @@ -0,0 +1,143 @@ +/************************************************************ + * + * + * Copyright 2014, 2015 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * SFF Utility for eeprom files. + * + ***********************************************************/ +#include + +#if SFF_CONFIG_INCLUDE_SFF_TOOL == 1 + +#include +#include +#include +#include + +int +sff_tool(int argc, char* argv[]) +{ + int rv = 0; + int i; + int c; + + int s = 0; + int e = 0; + int help = 0; + int n = 0; + int v = 0; + int sin = 0; + + biglist_t* fnames=NULL; + + + while( (c = getopt(argc, argv, "sehnvi")) != -1) { + switch(c) + { + case 's': s = 1; break; + case 'e': e = 1; break; + case 'h': help=1; rv=0; break; + case 'n': n=1; break; + case 'v': v=1; break; + case 'i': sin=1; break; + default: help=1; rv = 1; break; + } + } + + if(help) { + printf("Usage: %s [OPTIONS] [FILES]\n", argv[0]); + printf(" -i Read eeprom data from stdin.\n"); + printf(" -s Read filenames from stdin. \n"); + printf(" -n Print the filename if successful.\n"); + printf(" -v Print the filename always.\n"); + printf(" -e Show the raw eeprom data.\n"); + printf(" -h Help.\n"); + return rv; + } + + if(sin) { + uint8_t data[512]; + if(fread(data, 256, 1, stdin) == 1) { + sff_info_t info; + sff_info_init(&info, data); + if(info.supported) { + sff_info_show(&info, &aim_pvs_stdout); + return 0; + } + else { + aim_printf(&aim_pvs_stderr, "The eeprom data could not be parsed.\n"); + } + } + else { + aim_printf(&aim_pvs_stderr, "Error reading eeprom data from stdin.\n"); + } + return 1; + } + + + + + if(s) { + /* Read filenames from stdin */ + char b[PATH_MAX]; + char* l; + while((l = fgets(b, PATH_MAX, stdin))) { + int len=SFF_STRLEN(l); + if(len) { + if(l[len-1] == '\n') { + l[len-1] = 0; + } + fnames = biglist_append(fnames, aim_strdup(l)); + } + } + } + + /* Read from command line. This can be used together with -s */ + for(i = optind; i < argc; i++) { + fnames = biglist_append(fnames, aim_strdup(argv[i])); + } + + biglist_t* ble; + char* f; + BIGLIST_FOREACH_DATA(ble, fnames, char*, f) { + sff_info_t info; + memset(&info, 0, sizeof(info)); + if( (rv = sff_info_init_file(&info, f)) >= 0) { + if(n || v) { + aim_printf(&aim_pvs_stdout, "%s\n", f); + } + if(e) { + aim_printf(&aim_pvs_stdout, "eeprom:\n%{data}\n", info.eeprom, sizeof(info.eeprom)); + } + sff_info_show(&info, &aim_pvs_stdout); + } + else if(v) { + aim_printf(&aim_pvs_stdout, "%s: failed.\n", f); + } + } + return 0; +} + +#else +int __not_empty__; +#endif + + + diff --git a/packages/base/any/onlp/src/sff/sff.doxy b/packages/base/any/onlp/src/sff/sff.doxy new file mode 100644 index 00000000..9f96f494 --- /dev/null +++ b/packages/base/any/onlp/src/sff/sff.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "sff" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Small Form Factor Support." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/base/any/onlp/src/sff/sff.mk b/packages/base/any/onlp/src/sff/sff.mk new file mode 100644 index 00000000..1d236923 --- /dev/null +++ b/packages/base/any/onlp/src/sff/sff.mk @@ -0,0 +1,14 @@ + +############################################################################### +# +# Inclusive Makefile for the sff module. +# +# Autogenerated 2014-08-14 16:23:30.067308 +# +############################################################################### +sff_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(sff_BASEDIR)/module/make.mk +include $(sff_BASEDIR)/module/auto/make.mk +include $(sff_BASEDIR)/module/src/make.mk +include $(sff_BASEDIR)/utest/_make.mk + diff --git a/packages/base/any/onlp/src/sff/utest/_make.mk b/packages/base/any/onlp/src/sff/utest/_make.mk new file mode 100644 index 00000000..e4492a2a --- /dev/null +++ b/packages/base/any/onlp/src/sff/utest/_make.mk @@ -0,0 +1,8 @@ +############################################################################### +# +# sff Unit Test Makefile. +# +############################################################################### +UMODULE := sff +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/onlp/src/sff/utest/main.c b/packages/base/any/onlp/src/sff/utest/main.c new file mode 100644 index 00000000..8152fa9b --- /dev/null +++ b/packages/base/any/onlp/src/sff/utest/main.c @@ -0,0 +1,1055 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include +#include +#include +#include +#include + +typedef struct { + sff_info_t info; +} eeprom_verify_t; + + +static eeprom_verify_t data[] = + { + { + { + { + 0x03, 0x04, 0x07, 0x00, 0x00, 0x00, 0x01, 0x20, 0x40, 0x0c, 0x05, 0x01, 0x15, 0x00, 0x00, 0x00, + 0x1e, 0x0f, 0x00, 0x00, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + 0x2e, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x54, 0x52, 0x4a, 0x38, 0x35, 0x31, 0x39, + 0x50, 0x31, 0x42, 0x4e, 0x4c, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x03, 0x52, 0x00, 0x66, + 0x00, 0x12, 0x00, 0x00, 0x50, 0x38, 0x4a, 0x32, 0x5a, 0x4e, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x30, 0x35, 0x31, 0x30, 0x33, 0x31, 0x20, 0x20, 0x58, 0x90, 0x01, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "FINISAR CORP. ", + "FTRJ8519P1BNL ", + "P8J2ZNC ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_1G_BASE_SX, + "1GBASE-SX", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_1G, + -1, + }, + }, + /* Amphenol 10GBASE-CR */ + { + /* sff info */ + { + /* eeprom */ + { + 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x41, 0x6d, 0x70, 0x68, 0x65, 0x6e, 0x6f, 0x6c, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x41, 0x50, 0x48, 0x35, 0x37, 0x31, 0x35, 0x34, 0x30, 0x30, 0x30, + 0x37, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4b, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0xfa, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x50, 0x46, 0x31, 0x30, 0x30, 0x38, 0x30, 0x30, 0x37, 0x30, 0x31, + 0x34, 0x37, 0x20, 0x20, 0x31, 0x30, 0x30, 0x33, 0x30, 0x32, 0x20, 0x20, 0x00, 0x00, 0x00, 0xa9, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + + "Amphenol ", + "571540007 ", + "APF10080070147 ", + + /* sfp_type */ + SFF_SFP_TYPE_SFP, + "SFP", + + /* module_type */ + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + + /* media_type */ + SFF_MEDIA_TYPE_COPPER, + "Copper", + + /* caps */ + SFF_MODULE_CAPS_F_10G, + + /* Length */ + 0x1 + }, + }, + /* CISCO-MOLEX */ + { + /* sff_info */ + { + /* eeprom */ + { + 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x43, 0x49, 0x53, 0x43, 0x4f, 0x2d, 0x4d, 0x4f, 0x4c, 0x45, 0x58, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x09, 0x3a, 0x37, 0x34, 0x37, 0x35, 0x32, 0x2d, 0x39, 0x35, + 0x31, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x20, 0x20, 0x01, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x00, 0x4d, 0x4f, 0x43, 0x31, 0x35, 0x34, 0x37, 0x30, 0x30, 0x30, 0x48, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x31, 0x31, 0x31, 0x32, 0x31, 0x20, 0x20, 0x00, 0x00, 0x00, 0x8f, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0xf9, 0x8e, 0x5a, + 0x43, 0x4f, 0x50, 0x51, 0x41, 0x41, 0x34, 0x4a, 0x41, 0x42, 0x33, 0x37, 0x2d, 0x30, 0x39, 0x36, + 0x30, 0x2d, 0x30, 0x33, 0x56, 0x30, 0x33, 0x20, 0x01, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0xcc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x46, 0x50, 0x2d, 0x48, 0x31, 0x30, 0x47, 0x42, 0x2d, 0x43, 0x55, 0x31, 0x4d, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb3, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "CISCO-MOLEX ", + "74752-9519 ", + "MOC1547000H ", + + /* sfp_type */ + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 0x1, + }, + }, + /* Unknown */ + { + /* sff_info */ + { + /* eeprom */ + { + 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x43, 0x39, 0x39, 0x39, 0x39, 0x2d, 0x31, 0x4d, + 0x2d, 0x50, 0x2d, 0x4c, 0x43, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0xa1, + 0x00, 0x00, 0x00, 0x00, 0x31, 0x33, 0x30, 0x35, 0x33, 0x30, 0x30, 0x30, 0x34, 0x31, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x33, 0x30, 0x34, 0x31, 0x33, 0x20, 0x20, 0x00, 0x00, 0x00, 0x1d, + 0x00, 0x00, 0x11, 0xb6, 0x7f, 0x7f, 0x08, 0x96, 0xee, 0x8e, 0x60, 0x37, 0xb4, 0xc8, 0x8b, 0x88, + 0x66, 0x9c, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xdd, 0x56, 0xe8, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + " ", + "C9999-1M-P-LC ", + "1305300041 ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 0x0, + }, + }, + /* CISCO-MOLEX */ + { + { + { + 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x43, 0x49, 0x53, 0x43, 0x4f, 0x2d, 0x4d, 0x4f, 0x4c, 0x45, 0x58, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x09, 0x3a, 0x37, 0x34, 0x37, 0x35, 0x32, 0x2d, 0x39, 0x35, + 0x32, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x20, 0x20, 0x01, 0x00, 0x00, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x4d, 0x4f, 0x43, 0x31, 0x36, 0x30, 0x33, 0x30, 0x42, 0x48, 0x34, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x30, 0x31, 0x31, 0x39, 0x20, 0x20, 0x00, 0x00, 0x00, 0xa5, + 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x04, 0x3b, 0x5b, + 0x43, 0x4f, 0x50, 0x51, 0x41, 0x41, 0x36, 0x4a, 0x41, 0x42, 0x33, 0x37, 0x2d, 0x30, 0x39, 0x36, + 0x31, 0x2d, 0x30, 0x33, 0x56, 0x30, 0x33, 0x20, 0x01, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0xcf, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x46, 0x50, 0x2d, 0x48, 0x31, 0x30, 0x47, 0x42, 0x2d, 0x43, 0x55, 0x33, 0x4d, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "CISCO-MOLEX ", + "74752-9520 ", + "MOC16030BH4 ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 0x3 + }, + }, + /* OEM */ + { + { + { + 0x00, 0x80, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x0d, 0x33, 0x0c, 0xcb, 0x0c, 0xcb, 0x0d, 0x33, 0x1b, 0xd5, 0x1b, 0x54, 0x18, 0xcd, 0x1c, + 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x03, 0x67, 0x00, 0x00, 0x00, 0x0a, 0x03, 0x00, 0x00, 0x4f, 0x45, 0x4d, 0x20, 0x20, + 0x0d, 0x00, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x67, 0x00, 0x00, 0x00, + 0x0a, 0x03, 0x00, 0x00, 0x4f, 0x45, 0x4d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x07, 0x00, 0x1e, 0x00, 0x51, 0x53, 0x46, 0x50, 0x2d, 0x34, 0x30, 0x47, + 0x2d, 0x53, 0x52, 0x34, 0x20, 0x20, 0x20, 0x20, 0x31, 0x41, 0x42, 0x68, 0x07, 0xd0, 0x46, 0x0c, + 0x00, 0x00, 0x00, 0xde, 0x41, 0x43, 0x52, 0x34, 0x30, 0x47, 0x30, 0x30, 0x34, 0x31, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x30, 0x38, 0x32, 0x37, 0x31, 0x39, 0x08, 0x00, 0x00, 0x8a, + 0x00, 0x00, 0x11, 0x9d, 0xf1, 0x68, 0x34, 0xac, 0xb2, 0x3d, 0xc6, 0x19, 0x53, 0x0b, 0xbf, 0xf0, + 0x2e, 0xe1, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0xfe, 0x58, 0x27, + }, + "OEM ", + "QSFP-40G-SR4 ", + "ACR40G0041 ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE-SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + -1, + }, + }, + { + { + { + 0x0d, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0d, 0x00, 0x23, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0xa0, 0x41, 0x6d, 0x70, 0x68, 0x65, 0x6e, 0x6f, 0x6c, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x78, 0xa7, 0x14, 0x36, 0x30, 0x33, 0x30, 0x32, 0x30, 0x30, 0x30, + 0x33, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x42, 0x20, 0x07, 0x0b, 0x00, 0x00, 0x46, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x50, 0x46, 0x31, 0x33, 0x30, 0x32, 0x30, 0x30, 0x33, 0x35, 0x41, + 0x52, 0x56, 0x20, 0x20, 0x31, 0x33, 0x30, 0x31, 0x31, 0x35, 0x20, 0x20, 0x00, 0x00, 0x00, 0xf9, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "Amphenol ", + "603020003 ", + "APF13020035ARV ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_CR4, + "40GBASE-CR4", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_40G, + 0x3 + }, + }, + /* Fiberstore */ + { + { + { + 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x46, 0x69, 0x62, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x40, 0x20, 0x31, 0x30, 0x47, 0x53, 0x46, 0x50, 0x2d, 0x50, + 0x43, 0x2d, 0x33, 0x30, 0x2d, 0x31, 0x20, 0x20, 0x41, 0x30, 0x20, 0x20, 0x00, 0x00, 0x00, 0xd9, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x53, 0x34, 0x30, 0x32, 0x31, 0x32, 0x44, 0x30, 0x31, 0x37, 0x36, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x34, 0x30, 0x32, 0x31, 0x33, 0x20, 0x20, 0x00, 0x00, 0x00, 0x8f, + 0x00, 0x00, 0x11, 0x4b, 0xd4, 0xe4, 0xc5, 0x99, 0xd1, 0xfb, 0xdb, 0x5e, 0xa2, 0xc4, 0x62, 0x0c, + 0xf2, 0x5b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0xfa, 0x99, + 0x43, 0x4f, 0x50, 0x51, 0x41, 0x41, 0x34, 0x4a, 0x41, 0x41, 0x33, 0x37, 0x2d, 0x30, 0x39, 0x36, + 0x30, 0x2d, 0x30, 0x32, 0x56, 0x30, 0x32, 0x20, 0x01, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0xc9, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x53, 0x46, 0x50, 0x2d, 0x48, 0x31, 0x30, 0x47, 0x42, 0x2d, 0x43, 0x55, 0x31, 0x4d, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb3, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "FiberStore ", + "10GSFP-PC-30-1 ", + "FS40212D0176 ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 0x1, + }, + }, + /* + * Finisar FTLX1871M3BCL, see PAN-1005 + * http://www.finisar.com/products/optical-modules/sfp-plus/FTLX1871M3BCL + * http://www.quagwire.com/ftlx1871m3bcl/ + * XXX roth -- from my reading, this is a 10GBASE-ZR module + */ + { + { + { + 0x03, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x06, 0x67, 0x00, 0x50, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + 0x2e, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x54, 0x4c, 0x58, 0x31, 0x38, 0x37, 0x31, + 0x4d, 0x33, 0x42, 0x43, 0x4c, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x06, 0x0e, 0x00, 0x33, + 0x06, 0x1a, 0x00, 0x00, 0x55, 0x50, 0x47, 0x30, 0x31, 0x57, 0x4a, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x33, 0x30, 0x34, 0x32, 0x39, 0x20, 0x20, 0x68, 0xf0, 0x05, 0xfe, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "FINISAR CORP. ", + "FTLX1871M3BCL ", + "UPG01WJ ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_ZR, + "1GBASE-ZR", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_10G, + -1, + }, + }, + /* + * Finisar FTLX8570D3BCL, see PAN-1006 + * http://www.finisar.com/products/optical-modules/sfp-plus/FTLX1671D3BCL + * http://www.quagwire.com/ftlx8570d3bcl/ + * XXX roth -- from my reading, this is a 10GBASE-SR-lite + */ + { + { + { + 0x03, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x00, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x0a, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + 0x2e, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x54, 0x4c, 0x58, 0x38, 0x35, 0x37, 0x30, + 0x44, 0x33, 0x42, 0x43, 0x4c, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x03, 0x52, 0x00, 0x1c, + 0x00, 0x1a, 0x00, 0x00, 0x50, 0x50, 0x34, 0x34, 0x51, 0x56, 0x31, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x33, 0x30, 0x32, 0x31, 0x37, 0x20, 0x20, 0x68, 0xf0, 0x03, 0xe3, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "FINISAR CORP. ", + "FTLX8570D3BCL ", + "PP44QV1 ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_SRL, + "1GBASE-SRL", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_10G, + -1, + }, + }, + /* + * Finisar FTRJ1319P1BTL-MD, see PAN-1011 + * http://www.technodirect.com/finisarsfp2125gb1310nm10kmlongwavetransceiverftrj1319p1btl-md.aspx + * XXX roth -- from my reading, this is a 1GBASE-LX optic + * (10km) but it supports 2G FC. + */ + { + { + { + 0x03, 0x04, 0x07, 0x00, 0x00, 0x00, 0x02, 0x12, 0x10, 0x01, 0x05, 0x01, 0x15, 0x00, 0x0a, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + 0x2e, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x54, 0x52, 0x4a, 0x31, 0x33, 0x31, 0x39, + 0x50, 0x31, 0x42, 0x54, 0x4c, 0x2d, 0x4d, 0x44, 0x41, 0x20, 0x20, 0x20, 0x05, 0x1e, 0x00, 0x88, + 0x00, 0x1a, 0x00, 0x00, 0x50, 0x44, 0x42, 0x31, 0x56, 0x51, 0x55, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x30, 0x38, 0x30, 0x33, 0x31, 0x37, 0x20, 0x20, 0x68, 0xb0, 0x01, 0xc9, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "FINISAR CORP. ", + "FTRJ1319P1BTL-MD", + "PDB1VQU ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_1G_BASE_LX, + "1GBASE-LR", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_1G, + -1, + }, + }, + /* + * Juniper/Tyco 10G CR, see PAN-934 + * + */ + { + { + { + 0x03, 0x04, 0x21, 0x81, 0x00, 0x00, 0x04, 0x41, 0x04, 0x80, 0xd5, 0x00, 0x67, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x54, 0x79, 0x63, 0x6f, 0x20, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, + 0x6e, 0x69, 0x63, 0x73, 0x00, 0x00, 0x40, 0x20, 0x32, 0x31, 0x30, 0x30, 0x38, 0x37, 0x30, 0x2d, + 0x31, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x8a, + 0x00, 0x00, 0x00, 0x00, 0x30, 0x39, 0x33, 0x35, 0x45, 0x30, 0x34, 0x38, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x31, 0x30, 0x30, 0x35, 0x30, 0x39, 0x30, 0x30, 0x00, 0x00, 0x00, 0x41, + 0x37, 0x34, 0x30, 0x2d, 0x30, 0x33, 0x30, 0x30, 0x37, 0x36, 0x20, 0x52, 0x45, 0x56, 0x20, 0x30, + 0x31, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "Tyco Electronics", + "2100870-1 ", + "0935E048 ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 1, + }, + }, + /* + * QSFP+ 40G-bidi + */ + { + { + { + /* 0 */ 0x0d, 0x00, 0x02, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 16 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 32 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 48 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 80 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 128 */ 0x0d, 0xdc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xce, 0x00, 0x00, 0x32, + /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x43, 0x49, 0x53, 0x43, 0x4f, 0x2d, 0x41, 0x56, 0x41, 0x47, 0x4f, 0x20, + /* 160 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x17, 0x6a, 0x41, 0x46, 0x42, 0x52, 0x2d, 0x37, 0x39, 0x45, + /* 176 */ 0x42, 0x50, 0x5a, 0x2d, 0x43, 0x53, 0x31, 0x20, 0x30, 0x31, 0x42, 0x68, 0x07, 0xd0, 0x46, 0x47, + /* 192 */ 0x00, 0x00, 0x0f, 0xde, 0x41, 0x56, 0x4d, 0x31, 0x38, 0x30, 0x39, 0x53, 0x30, 0x54, 0x47, 0x20, + /* 208 */ 0x20, 0x20, 0x20, 0x20, 0x31, 0x34, 0x30, 0x32, 0x32, 0x35, 0x20, 0x20, 0x08, 0x00, 0xf5, 0xcc, + /* 224 */ 0xf5, 0x00, 0x06, 0xd2, 0x04, 0x9c, 0x47, 0x09, 0xc5, 0xaf, 0xcf, 0xb7, 0x65, 0xd9, 0x72, 0x03, + /* 240 */ 0xea, 0x59, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x45, 0xbd, 0x94, + }, + "CISCO-AVAGO ", + "AFBR-79EBPZ-CS1 ", + "AVM1809S0TG ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR2, + "40GBASE-SR2", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + -1, + }, + }, + /* Cisco/Finisar 40G QSFP (QuadWire? AOC? Pigtail?) */ + { + { + { + /* 0x0000 */ 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0010 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0xde, 0x00, 0x00, 0x7f, 0x4d, 0x00, 0x00, 0x00, 0x00, + /* 0x0020 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0030 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0040 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0050 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0060 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0070 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + /* 0x0080 */ 0x0d, 0x10, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x67, 0x00, 0x00, 0x32, + /* 0x0090 */ 0x1e, 0x00, 0x0a, 0x00, 0x43, 0x49, 0x53, 0x43, 0x4f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 0x00a0 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x43, 0x42, 0x4e, 0x34, 0x31, 0x30, 0x51, + /* 0x00b0 */ 0x45, 0x32, 0x43, 0x31, 0x30, 0x2d, 0x43, 0x31, 0x41, 0x20, 0x42, 0x68, 0x07, 0xd0, 0x46, 0xaf, + /* 0x00c0 */ 0x00, 0x01, 0x04, 0xd8, 0x46, 0x49, 0x53, 0x31, 0x37, 0x33, 0x31, 0x30, 0x30, 0x35, 0x33, 0x2d, + /* 0x00d0 */ 0x41, 0x20, 0x20, 0x20, 0x31, 0x33, 0x30, 0x37, 0x33, 0x31, 0x20, 0x20, 0x0a, 0x00, 0xf6, 0x90, + /* 0x00e0 */ 0x00, 0x00, 0x02, 0x43, 0x59, 0xd3, 0x68, 0x03, 0x46, 0x83, 0x87, 0x75, 0x1f, 0xee, 0x94, 0x62, + /* 0x00f0 */ 0xb8, 0x98, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x5e, 0x75, 0x43, + }, + "CISCO ", + "FCBN410QE2C10-C1", + "FIS17310053-A ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + /* XXX roth -- FIXME */ + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE-SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + -1, + }, + }, + /* + * Dell/Amphenol 3M copper + * Identifies as intra-enclosure and inter-enclosure + */ + { + { + { + /* 0000 */ 0x03, 0x04, 0x21, 0x01, 0x00, 0x00, 0x00, 0x41, 0x84, 0x80, 0x55, 0x00, 0x67, 0x00, 0x00, 0x00, + /* 0010 */ 0x00, 0x00, 0x03, 0x00, 0x41, 0x6d, 0x70, 0x68, 0x65, 0x6e, 0x6f, 0x6c, 0x20, 0x20, 0x20, 0x20, + /* 0020 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x78, 0xa7, 0x14, 0x36, 0x31, 0x36, 0x37, 0x34, 0x30, 0x30, 0x30, + /* 0030 */ 0x33, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x43, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0xe3, + /* 0040 */ 0x00, 0x00, 0x00, 0x00, 0x43, 0x4e, 0x30, 0x35, 0x33, 0x48, 0x56, 0x4e, 0x34, 0x34, 0x4c, 0x38, + /* 0050 */ 0x37, 0x59, 0x59, 0x20, 0x31, 0x34, 0x30, 0x34, 0x32, 0x33, 0x20, 0x20, 0x00, 0x00, 0x00, 0x78, + /* 0060 */ 0x0f, 0x10, 0x00, 0xa3, 0x71, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0070 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0080 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0090 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00a0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00b0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00c0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00d0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00e0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 00f0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "Amphenol ", + "616740003 ", + "CN053HVN44L87YY ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 3, + }, + }, + /* + * Dell/Amphenol 3M copper + * Identifies as intra-enclosure and inter-enclosure + */ + { + { + { + /* 0x0000 */ 0x03, 0x04, 0x21, 0x02, 0x00, 0x00, 0x04, 0x41, 0x84, 0x80, 0xd5, 0x00, 0x67, 0x00, 0x00, 0x00, + /* 0x0010 */ 0x00, 0x00, 0x03, 0x00, 0x33, 0x4d, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 0x0020 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x31, 0x34, 0x31, 0x30, 0x2d, 0x50, 0x31, 0x37, + /* 0x0030 */ 0x2d, 0x30, 0x30, 0x2d, 0x33, 0x2e, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x1c, + /* 0x0040 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0050 */ 0x00, 0x00, 0x00, 0x00, 0x31, 0x32, 0x30, 0x32, 0x32, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, + /* 0x0060 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0070 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0080 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0090 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00b0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00c0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00d0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00e0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00f0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "3M ", + "1410-P17-00-3.00", + /* XXX roth -- NULL serial number ??!??111! */ + " ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 3, + }, + }, + { + { + { + 0x0d, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x14, 0x21, 0x00, 0x00, 0x83, 0x2c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0a, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, + 0x0c, 0x04, 0x00, 0x00, 0x00, 0x40, 0x40, 0x06, 0x00, 0x05, + 0x64, 0x00, 0x00, 0x32, 0x1e, 0x00, 0x00, 0x00, 0x45, 0x64, + 0x67, 0x65, 0x2d, 0x63, 0x6f, 0x72, 0x45, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x04, 0x70, 0x72, 0xcf, 0x4d, 0x30, + 0x4f, 0x45, 0x43, 0x36, 0x34, 0x30, 0x31, 0x54, 0x30, 0x30, + 0x5a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x42, 0x68, 0x07, 0xd0, + 0x46, 0xb0, 0x00, 0x00, 0x00, 0x12, 0x31, 0x45, 0x37, 0x51, + 0x54, 0x30, 0x30, 0x30, 0x33, 0x30, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x31, 0x34, 0x30, 0x37, 0x32, 0x38, 0x20, 0x20, + 0x08, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "Edge-corE ", + "M0OEC6401T00Z ", + "1E7QT00030 ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE_SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + -1, + } + }, + { + { + { + 0x0d, 0x03, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x30, 0x00, 0x00, 0x82, 0xa2, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, + 0x0c, 0x04, 0x00, 0x00, 0x00, 0x40, 0x40, 0x06, 0x00, 0x05, + 0x64, 0x00, 0x00, 0x32, 0x1e, 0x00, 0x00, 0x00, 0x45, 0x64, + 0x67, 0x65, 0x2d, 0x63, 0x6f, 0x72, 0x45, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x04, 0x70, 0x72, 0xcf, 0x4d, 0x30, + 0x4f, 0x45, 0x43, 0x36, 0x34, 0x30, 0x31, 0x54, 0x30, 0x30, + 0x5a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x42, 0x68, 0x07, 0xd0, + 0x46, 0xb0, 0x00, 0x00, 0x00, 0x12, 0x31, 0x45, 0x37, 0x51, + 0x54, 0x30, 0x30, 0x30, 0x32, 0x38, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x31, 0x34, 0x30, 0x37, 0x32, 0x38, 0x20, 0x20, + 0x08, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + "Edge-corE ", + "M0OEC6401T00Z ", + "1E7QT00028 ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE_SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + -1, + } + }, + { + { + { + 0x0d, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x17, 0x9f, 0x00, 0x00, 0x80, 0x29, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x44, 0xd5, 0x44, 0x3a, 0x48, 0xb1, + 0x4d, 0x30, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x8c, + 0x23, 0x04, 0x00, 0x00, 0x01, 0x40, 0x40, 0x02, 0x00, 0x05, + 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x46, 0x4f, + 0x52, 0x4d, 0x45, 0x52, 0x49, 0x43, 0x41, 0x4f, 0x45, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x04, 0x00, 0x00, 0x00, 0x54, 0x51, + 0x53, 0x2d, 0x51, 0x31, 0x4c, 0x48, 0x38, 0x2d, 0x58, 0x43, + 0x41, 0x31, 0x30, 0x20, 0x00, 0x00, 0x42, 0x68, 0x07, 0xd0, + 0x46, 0x4a, 0x00, 0x00, 0x05, 0x31, 0x39, 0x31, 0x33, 0x33, + 0x32, 0x4c, 0x30, 0x30, 0x30, 0x31, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x31, 0x33, 0x30, 0x38, 0x30, 0x36, 0x20, 0x20, + 0x08, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, + 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xf7, 0xf7, 0xf7, + 0xf7, 0xf7, 0xf7, 0xf7, 0xfe, 0xfe, + }, + "FORMERICAOE ", + "TQS-Q1LH8-XCA10 ", + "91332L0001 ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE_SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + 10, + }, + }, + { + /* + * PAN-1233 -- 10G IBM-Amphenol cable + */ + { + { + /* 0x0000 */ 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x06, 0x67, 0x00, 0x00, 0x00, + /* + * ^^^^ copper pigtail + * + * ^^^^ no 10G or IB codes + * + * ^^^^ ^^^^ no SONET (fiber) + * + * identifies as 1000BASE-CX ^^^^ + * + * no FC length code ^^^^ + * + * identifies as SFP+ passive ^^^^ + * + * no FC media, copper or otherwise ^^^^ + * + * no FC speed ^^^^ + * + * nominal bitrate 0x67 --> 10.3GB ^^^^ + */ + /* 0x0010 */ 0x00, 0x00, 0x03, 0x00, 0x49, 0x42, 0x4d, 0x2d, 0x41, 0x6d, 0x70, 0x68, 0x65, 0x6e, 0x6f, 0x6c, + /* + * ^^^^ copper cable length (3m) + */ + /* 0x0020 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x17, 0xef, 0x39, 0x30, 0x59, 0x39, 0x34, 0x32, 0x38, 0x2d, + /* 0x0030 */ 0x4e, 0x32, 0x38, 0x35, 0x30, 0x30, 0x41, 0x20, 0x46, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x7a, + /* 0x0040 */ 0x00, 0x00, 0x00, 0x00, 0x59, 0x33, 0x35, 0x30, 0x56, 0x54, 0x32, 0x42, 0x52, 0x31, 0x46, 0x47, + /* 0x0050 */ 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x31, 0x31, 0x32, 0x37, 0x20, 0x20, 0x00, 0x00, 0x00, 0x0d, + /* 0x0060 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0070 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0080 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0090 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00a0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00b0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00c0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00d0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00e0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00f0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "IBM-Amphenol ", + "90Y9428-N28500A ", + "Y350VT2BR1FG ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 3, + }, + }, + { + /* Verify string normalization for unprintable characters in the vendor, model, or serial number fields. */ + { + { + /* 0x0000 */ 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x06, 0x67, 0x00, 0x00, 0x00, + /* 0x0010 */ 0x00, 0x00, 0x03, 0x00, 0x49, 0x42, 0x4d, 0x2d, 0x41, 0x6d, 0x70, 0x68, 0x65, 0x6e, 0x6f, 0x6c, + /* 0x0020 */ 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x17, 0xef, 0x39, 0x30, 0x59, 0x39, 0x34, 0x32, 0x38, 0xFd, + /* 0x0030 */ 0x4e, 0x32, 0x38, 0x35, 0x30, 0x30, 0x41, 0x20, 0x46, 0x20, 0x20, 0x20, 0x01, 0x00, 0x00, 0x8a, + /* 0x0040 */ 0x00, 0x00, 0x00, 0x00, 0x59, 0x33, 0xF5, 0xF0, 0x56, 0x54, 0x32, 0x42, 0x52, 0x31, 0x46, 0x47, + /* 0x0050 */ 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x31, 0x31, 0x32, 0x37, 0x20, 0x20, 0x00, 0x00, 0x00, 0x8d, + /* 0x0060 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0070 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0080 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x0090 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00a0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00b0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00c0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00d0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00e0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + /* 0x00f0 */ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }, + "IBM-Amphenol????", + "90Y9428?N28500A ", + "Y3??VT2BR1FG ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_CR, + "10GBASE-CR", + SFF_MEDIA_TYPE_COPPER, + "Copper", + SFF_MODULE_CAPS_F_10G, + 3, + }, + }, + { + /* + * Finisar 40G AOC breakout cable + */ + { + { + /* 0x0000 */ 0x0d, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0010 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x9f, 0x00, 0x00, 0x80, 0xc2, 0x00, 0x00, 0x00, 0x00, + /* 0x0020 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0030 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0040 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0050 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0060 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0070 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + + /* 0x0080 */ 0x0d, 0x10, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x67, 0x00, 0x00, 0x00, + /* + * ^^^^ QSFP+ + * + * ^^^^ no separable connector (active?) + * + * ^^^^^ no media compliance (*NOT* 40G active) + * + * ^^^^ no SONET compliance + * + * ^^^^ no SAS compliance + * + * ^^^^ no GbE compliance + * + * ^^^^ ^^^^ no FC compliance + * + * ^^^^ no FC media + * + * ^^^^ no FC speed + * + * ^^^^ 64b66b + * + * ^^^^ nominal BR >= 10G + * no SM or OM3 length ^^^^ ^^^^ + */ + /* 0x0090 */ 0x00, 0x00, 0x03, 0x00, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + /* + * ^^^^ ^^^^ no OM1 or OM2 length + * + * ^^^^ 3M cable (copper or active) + */ + /* 0x00a0 */ 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x43, 0x42, 0x4e, 0x35, 0x31, 0x30, 0x51, + /* 0x00b0 */ 0x45, 0x32, 0x43, 0x30, 0x33, 0x20, 0x20, 0x20, 0x41, 0x20, 0x42, 0x68, 0x07, 0xd0, 0x46, 0x29, + /* + * ^^^^ ^^^^ 850nm + */ + /* 0x00c0 */ 0x00, 0x01, 0x04, 0xd8, 0x44, 0x53, 0x4b, 0x30, 0x34, 0x56, 0x52, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 0x00d0 */ 0x20, 0x20, 0x20, 0x20, 0x31, 0x34, 0x31, 0x31, 0x30, 0x34, 0x20, 0x20, 0x08, 0x00, 0xf6, 0x54, + /* 0x00e0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00f0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + "FINISAR CORP ", + "FCBN510QE2C03 ", + "DSK04VR ", + SFF_SFP_TYPE_QSFP_PLUS, + "QSFP+", + SFF_MODULE_TYPE_40G_BASE_SR4, + "40GBASE-SR4", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_40G, + 3, + }, + }, + { + /* + * Finisar 40G AOC breakout cable, 10G end + */ + { + { + /* 0x0000 */ 0x03, 0x04, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x06, 0x67, 0x00, 0x00, 0x00, + /* + * ^^^^ SFP+ + * + * ^^^^ copper pigtail (ugh) + * + * ^^^^ no 10G or IF compliance + * + * ^^^^ no SONET compliance + * + * ^^^^ no OC length spec + * + * ^^^^ no ethernet compliance + * + * ^^^^ no FC length or tech + * + * ^^^^ active cable, no FC tech + * + * ^^^^ no FC media + * + * ^^^^ no FC speed + * + * ^^^^ 64/66 encoding + * + * nominal BR >= 10G ^^^^ + * + * no SM length ^^^^ ^^^^ + */ + /* 0x0010 */ 0x00, 0x00, 0x01, 0x00, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x41, 0x52, 0x20, 0x43, 0x4f, 0x52, 0x50, + /* + * ^^^^ ^^^^ no MM length + * + * ^^^^ active/copper length 1m + * + * ^^^^ no OM3 length + * + */ + /* 0x0020 */ 0x2e, 0x20, 0x20, 0x20, 0x00, 0x00, 0x90, 0x65, 0x46, 0x43, 0x42, 0x4e, 0x35, 0x31, 0x30, 0x51, + /* 0x0030 */ 0x45, 0x32, 0x43, 0x30, 0x31, 0x20, 0x20, 0x20, 0x41, 0x20, 0x20, 0x20, 0x0c, 0x00, 0x00, 0xa9, + /* + * compliant with FC or SFF limiting ^^^^ ^^^^ + */ + /* 0x0040 */ 0x00, 0x12, 0x00, 0x00, 0x44, 0x53, 0x4a, 0x30, 0x35, 0x39, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, + /* 0x0050 */ 0x20, 0x20, 0x20, 0x20, 0x31, 0x34, 0x31, 0x30, 0x33, 0x30, 0x20, 0x20, 0x00, 0x00, 0x05, 0x72, + /* 0x0060 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0070 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0080 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x0090 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00a0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00b0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00c0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00d0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00e0 */ 0x00, 0x7f, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 0x00f0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, + }, + "FINISAR CORP. ", + "FCBN510QE2C01 ", + "DSJ059S ", + SFF_SFP_TYPE_SFP, + "SFP", + SFF_MODULE_TYPE_10G_BASE_SR, + "10GBASE-SR", + SFF_MEDIA_TYPE_FIBER, + "Fiber", + SFF_MODULE_CAPS_F_10G, + 1, + }, + }, + }; + + +int +aim_main(int argc, char* argv[]) +{ + int i; + + int first = 0; + int last = AIM_ARRAYSIZE(data)-1; + if(argv[1]) { + first = last = atoi(argv[1]); + } + + for(i = first; i <= last; i++) { + int rv; + sff_info_t info; + eeprom_verify_t* p = data+i; + + aim_printf(&aim_pvs_stdout, "Verifying entry %d: %s:%s:%s...\n", + i, + p->info.vendor, + p->info.model, + p->info.serial); + + + if( (rv=sff_info_init(&info, p->info.eeprom)) < 0) { + AIM_DIE("index=%d sff_info_init=%d\n", i, rv); + } + if (!info.supported) { + AIM_DIE("index=%d supported=0\n", i); + } + + if(strcmp(info.vendor, p->info.vendor)) { + AIM_DIE("index=%d vendor expected '%s' got '%s'", + i, p->info.vendor, info.vendor); + } + if(strcmp(info.model, p->info.model)) { + AIM_DIE("index=%d model expected '%s' got '%s'", + i, p->info.model, info.model); + } + if(strcmp(info.serial, p->info.serial)) { + AIM_DIE("index=%d serial expected '%s' got '%s'", + i, p->info.serial, info.serial); + } + if(info.sfp_type != p->info.sfp_type) { + AIM_DIE("index=%d sfp_type expected '%{sff_sfp_type}' got '%{sff_sfp_type}'", + i, p->info.sfp_type, info.sfp_type); + } + if(strcmp(info.sfp_type_name, p->info.sfp_type_name)) { + AIM_DIE("index=%d type_name expected '%s' got '%s'", + i, p->info.sfp_type, info.sfp_type); + } + if(info.module_type != p->info.module_type) { + AIM_DIE("index=%d module_type expected '%{sff_module_type}' got '%{sff_module_type}'", + i, p->info.module_type, info.module_type); + } + if(info.media_type != p->info.media_type) { + AIM_DIE("index=%d media_type expected '%{sff_media_type}' got '%{sff_media_type}'\n", + i, p->info.media_type, info.media_type); + } + if(strcmp(info.media_type_name, p->info.media_type_name)) { + AIM_DIE("index=%d media_type_name expected '%s' got '%s'", + i, p->info.media_type_name, info.media_type_name); + } + + if (info.caps != p->info.caps) { + AIM_DIE("index=%d caps expected '%{sff_module_caps}' got '%{sff_module_caps}'", + i, p->info.caps, info.caps); + } + + if(info.length != p->info.length) { + AIM_DIE("index=%d length expected %d got %d", + i, p->info.length, info.length); + } + + if(info.length == -1 && info.length_desc[0]) { + AIM_DIE("index=%d length_desc expected '%s' got '%s'", + i, '\0', info.length_desc); + } + else if(info.length != -1) { + char tmp[32]; + snprintf(tmp, sizeof(tmp), "%dm", info.length); + if(strcmp(tmp, info.length_desc)) { + AIM_DIE("index=%d length_desc expected '%s' got '%s'", + i, tmp, info.length_desc); + } + } + + aim_printf(&aim_pvs_stdout, "Verifying entry %d: %s:%s:%s...PASSED\n", + i, + p->info.vendor, + p->info.model, + p->info.serial); + + } + return 0; +} + diff --git a/packages/base/any/rootfs/APKG.yml b/packages/base/any/rootfs/APKG.yml new file mode 100644 index 00000000..03277efb --- /dev/null +++ b/packages/base/any/rootfs/APKG.yml @@ -0,0 +1,24 @@ +prerequisites: + broken: true + +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-rootfs + version: 1.0.0 + summary: Open Network Linux Root Filesystem + + files: + builds/rootfs-$ARCH.cpio.gz : $$PKG_INSTALL/ + builds/rootfs-$ARCH.sqsh : $$PKG_INSTALL/ + builds/manifest.json : $$PKG_INSTALL/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/any/rootfs/common/amd64-packages.yml b/packages/base/any/rootfs/common/amd64-packages.yml new file mode 100644 index 00000000..f06a44d0 --- /dev/null +++ b/packages/base/any/rootfs/common/amd64-packages.yml @@ -0,0 +1,13 @@ +############################################################ +# +# Common packages for all amd64 systems. +# +############################################################ +- dmidecode +- parted +- smartmontools +- grub2 + + + + diff --git a/packages/base/any/rootfs/common/common-packages.yml b/packages/base/any/rootfs/common/common-packages.yml new file mode 100644 index 00000000..b050c80a --- /dev/null +++ b/packages/base/any/rootfs/common/common-packages.yml @@ -0,0 +1,71 @@ +############################################################ +# +# Common Release Packages for all systems. +# +############################################################ +- locales +- python +- apt +- apt-utils +- procps +- net-tools +- iputils-ping +- less +- sudo +- openssh-server +- iproute +- resolvconf +- vim-tiny +- zile +- nano +- lsof +- mingetty +- traceroute +- realpath +- rsyslog +- nfs-common +- netbase +- bsdmainutils +- ifupdown +- psmisc +- make +- python-cherrypy3 +- python-tz +- scapy +- python-pypcap +- snmpd +- lm-sensors +- fancontrol +- pciutils +- usbutils +- mtd-utils +- kexec-tools +- i2c-tools +- module-init-tools +- isc-dhcp-client +- ntp +- wget +- ethtool +- localepurge +- telnetd +- python-pyinotify +- cpio +- util-linux +- dosfstools +- gnu-fdisk +- rssh +- u-boot-tools +- ntpdate +- onlp +- parted +- watchdog +- netplug +- binutils +- file +- smartmontools +- realpath +- iptables +- onl-faultd +- onl-loader-initscripts + + diff --git a/packages/base/any/rootfs/common/overlay/etc/adjtime b/packages/base/any/rootfs/common/overlay/etc/adjtime new file mode 100644 index 00000000..7481b115 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/adjtime @@ -0,0 +1 @@ +0.0 0 0.0 diff --git a/packages/base/any/rootfs/common/overlay/etc/filesystems b/packages/base/any/rootfs/common/overlay/etc/filesystems new file mode 100644 index 00000000..01350bea --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/filesystems @@ -0,0 +1,6 @@ +jffs2 +ubifs +vfat +ext4 +ext3 +ext2 diff --git a/packages/base/any/rootfs/common/overlay/etc/inetd.conf b/packages/base/any/rootfs/common/overlay/etc/inetd.conf new file mode 100644 index 00000000..367f8d08 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/inetd.conf @@ -0,0 +1,3 @@ +telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd +qotd stream tcp nowait telnetd /usr/sbin/tcpd /sbin/versiond + diff --git a/packages/base/any/rootfs/common/overlay/etc/init.d/initdev b/packages/base/any/rootfs/common/overlay/etc/init.d/initdev new file mode 100755 index 00000000..df9dd898 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/init.d/initdev @@ -0,0 +1,26 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: initdev +# Required-Start: +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Set up block and net devices +### END INIT INFO + +. /lib/lsb/init-functions + +log_action_begin_msg "Setting up block and net devices" + +ln -snf /proc/mounts /etc/mtab + +( cd /sys/class/block; for d in *; do /sbin/initblockdev $d add; done ) +if [ -d /sys/class/ubi ]; then + ( cd /sys/class/ubi; for d in *; do /sbin/initblockdev $d add; done ) +fi +( cd /sys/class/net; for d in *; do /sbin/initnetdev $d add; done ) + +initmounts + +log_action_end_msg 0 diff --git a/packages/base/any/rootfs/common/overlay/etc/profile.d/onl-platform-current.sh b/packages/base/any/rootfs/common/overlay/etc/profile.d/onl-platform-current.sh new file mode 100644 index 00000000..5237bbb8 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/profile.d/onl-platform-current.sh @@ -0,0 +1,7 @@ +############################################################ +# +# Add platform specific directories to path. +# +############################################################ +dir=/lib/platform-config/current/onl +export PATH="$PATH:$dir/bin:$dir/sbin:$dir/lib/bin:$dir/lib/sbin" diff --git a/packages/base/any/rootfs/common/overlay/etc/rssh.conf b/packages/base/any/rootfs/common/overlay/etc/rssh.conf new file mode 100644 index 00000000..37438ead --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/rssh.conf @@ -0,0 +1,3 @@ +logfacility = LOG_USER +allowsftp +umask = 022 diff --git a/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-block.rules b/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-block.rules new file mode 100644 index 00000000..f2345a37 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-block.rules @@ -0,0 +1 @@ +SUBSYSTEM=="block", RUN+="/sbin/initblockdev $kernel $env{ACTION}" diff --git a/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-net.rules b/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-net.rules new file mode 100644 index 00000000..627e65e4 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/etc/udev/rules.d/60-net.rules @@ -0,0 +1 @@ +SUBSYSTEM=="net", RUN+="/sbin/initnetdev $kernel $env{ACTION}" diff --git a/packages/base/any/rootfs/common/overlay/sbin/initblockdev b/packages/base/any/rootfs/common/overlay/sbin/initblockdev new file mode 100755 index 00000000..e4b7cc3d --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/sbin/initblockdev @@ -0,0 +1,62 @@ +#!/bin/bash +set -e +exec 9<$0 +flock -x 9 +case $2 in + add) + eval $(echo $1 | sed "s#^\(mmcblk[0-9]*\|ubi[0-9]*_[0-9]*\|mtdblock[0-9]*\|[a-z]*\)\(p[0-9]*\|[0-9]*\).*#dev='\1' part='\2'#") + if [ -e /etc/onl/recover ]; then + recover=$(cat /etc/onl/recover) + fi + devid= + if [ -e /sys/class/ubi/${dev}/device ]; then + eval $(realpath /sys/class/ubi/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#") + fi + if [ -e /sys/class/block/${dev}/device ]; then + eval $(realpath /sys/class/block/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#") + fi + while read i n; do + expr match "$i" "#" >/dev/null && continue || : + [ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && mount=/mnt/$n && break || : + expr match "@${dev}" "$i" >/dev/null && mount=/mnt/$n && break || : + done /dev/null)" = "070701" ]; then + mount=${mount}-recover + else + mkdir -p ${mount} + [ $(stat -c %D ${mount}) = $(stat -c %D /mnt) ] + if [ "$(dd if=/dev/${dev}${part} bs=1 skip=82 count=5 2>/dev/null)" = "FAT32" ] \ + || [ "$(dd if=/dev/${dev}${part} bs=1 skip=54 count=5 2>/dev/null)" = "FAT16" ]; then + if [ ! -e /etc/onl/kdump ]; then + if [ "$recover" = "fsck" ]; then + # Try to repair FAT filesystem automatically to prevent further + # damage (but skip it in kdump to save time and memory) + if dosfsck -a /dev/${dev}${part} >/dev/null 2>&1; then + : + else + dosfsck -n /dev/${dev}${part} >/dev/null 2>&1 + fi + else + dosfsck -n /dev/${dev}${part} >/dev/null 2>&1 + fi + fi + mount -o flush,dirsync,noatime,umask=0007 /dev/${dev}${part} ${mount} 2>/dev/null + else + mount -o noatime /dev/${dev}${part} ${mount} 2>/dev/null + fi + fi + echo -e "devid='${devid}'\ndev='${dev}'\npart='${part}'" >${mount}.conf + ;; + remove) + mtab=$(mktemp /tmp/tmp.XXXXXX) + cp /proc/mounts ${mtab} + while read dev mount x; do + if [ /dev/$1 = "${dev}" ]; then + rm -f ${mount}.conf + umount -l ${mount} 2>/dev/null || : + fi + done <${mtab} + rm -f ${mtab} + ;; +esac diff --git a/packages/base/any/rootfs/common/overlay/sbin/pgetty b/packages/base/any/rootfs/common/overlay/sbin/pgetty new file mode 100755 index 00000000..01ed10dc --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/sbin/pgetty @@ -0,0 +1,23 @@ +#!/bin/sh + +t=/dev/$1 +# if $1 is not set, use linux cmdline console as default tty +[ -z "$1" ] && { + tty=$(/bin/sed 's/.*console=\([^,]*\).*/\1/' /proc/cmdline) + t=/dev/$tty +} + +# Reset the console tty to standard settings +/bin/stty -F $t sane pass8 -ixon -cstopb clocal + +# Kill any processes with the console tty open before starting a new +# login session (login tries to do this, but vhangup() spares processes +# that ignore SIGHUP) +#/usr/bin/lsof -p ^$$ -t $t 0<&- 1>&- 2>&- | /usr/bin/xargs -r /bin/kill -9 + +# Flush tty input and output queues +#/sbin/flushtty <$t + +# We use mingetty instead of agetty, as the latter messes up the tty +# settings if it receives junk characters at the wrong speed +exec /sbin/mingetty --noclear $t diff --git a/packages/base/any/rootfs/common/overlay/sbin/watchdir b/packages/base/any/rootfs/common/overlay/sbin/watchdir new file mode 100755 index 00000000..3ff32aa7 --- /dev/null +++ b/packages/base/any/rootfs/common/overlay/sbin/watchdir @@ -0,0 +1,71 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# watchdir +# +############################################################ +import optparse, os.path, sys +import pyinotify + +#pyinotify.log.setLevel(pyinotify.logging.DEBUG) + +op = optparse.OptionParser( usage="%prog [OPTIONS] command") +op.add_option("-w", "--watchdir", action="append", + help="monitor watchdir for changes (may be used multiple times)") +op.add_option("--period", action="store", type="float", + help="run command at most every period sec (default=%default)") +op.add_option("-d", "--daemon", action="store_true", + help="run in background") +op.add_option("--logfile", action="store", + help="send output to logfile when running in background") +op.add_option("--pidfile", action="store", + help="write pid to pidfile when running in background") +op.set_defaults(period=0, logfile="/dev/stdout", pidfile=False) +opts, args = op.parse_args() + +if not opts.watchdir: + op.error("need at least one watchdir") + +os.close(0) +os.open("/dev/null", os.O_RDONLY) + +wm = pyinotify.WatchManager() +n = pyinotify.Notifier(wm, read_freq=opts.period) +def handle(event): + dir = None + for d in opts.watchdir: + if os.path.commonprefix([d, event.pathname]) == d: + dir = d + sys.stdout.write("%s: %s %s\n" % (dir, event.pathname, event)) + sys.stdout.flush() + if args: + os.spawnvp(os.P_WAIT, args[0], + args + [dir, event.pathname, event.maskname]) +wm.add_watch( + opts.watchdir, + pyinotify.IN_ATTRIB | pyinotify.IN_CREATE | pyinotify.IN_DELETE | + pyinotify.IN_MODIFY | pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO, + handle, + rec=True, + auto_add=True) +n.loop(daemonize=opts.daemon, stdout=opts.logfile, stderr=opts.logfile, + pid_file=opts.pidfile) diff --git a/packages/base/any/rootfs/common/powerpc-packages.yml b/packages/base/any/rootfs/common/powerpc-packages.yml new file mode 100644 index 00000000..618f3581 --- /dev/null +++ b/packages/base/any/rootfs/common/powerpc-packages.yml @@ -0,0 +1,10 @@ +############################################################ +# +# Common packages for all PowerPC systems. +# +############################################################ +- u-boot-tools + + + + diff --git a/packages/base/any/rootfs/standard/standard.yml b/packages/base/any/rootfs/standard/standard.yml new file mode 100644 index 00000000..b3a63767 --- /dev/null +++ b/packages/base/any/rootfs/standard/standard.yml @@ -0,0 +1,83 @@ +############################################################ +# +# Standard ONL Root Filesystem Configuration. +# +# Requires: +# ARCH, PLATFORM_LIST +# +# +############################################################ +Packages: &Packages + - !include $ONL/packages/base/any/rootfs/common/common-packages.yml + - !include $ONL/packages/base/any/rootfs/common/${ARCH}-packages.yml + - !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST} + +Multistrap: + General: + arch: ${ARCH} + cleanup: true + noauth: true + explicitsuite: false + unpack: true + debootstrap: Debian Local-All Local-Arch + aptsources: Debian + + Debian: + packages: *Packages + source: http://${APT_CACHE}${DEBIAN_MIRROR} + suite: ${DEBIAN_SUITE} + keyring: debian-archive-keyring + omitdebsrc: true + + Local-All: + source: ${ONL}/REPO/packages/all + omitdebsrc: true + + Local-Arch: + source: ${ONL}/REPO/packages/${ARCH} + omitdebsrc: true + +Configure: + overlays: + - ${ONL}/packages/base/any/rootfs/common/overlay + + update-rc.d: + - 'initdev defaults' + - 'onl-platform-baseconf defaults' + - 'faultd defaults' + - 'snmpd remove' + - 'ssh defaults' + - 'openbsd-inetd remove' + - 'ntp remove' + - 'nfs-common remove' + - 'rpcbind remove' + - 'motd remove' + - 'kexec remove' + - 'kexec-load remove' + - 'mountall-bootclean.sh remove' + - 'mountall.sh remove' + - 'checkfs.sh remove' + - 'mtab.sh remove' + - 'checkroot-bootclean.sh remove' + - 'checkroot.sh remove' + - 'mountnfs-bootclean.sh remove' + - 'mountnfs.sh remove' + - 'lm-sensors remove' + - 'netplug defaults' + - 'watchdog defaults' + - 'wd_keepalive remove' + + options: + clean: True + securetty: False + ttys: False + console: True + + users: + root: + password: onl + + manifest: + version: $ONL/make/version-onl.json + platforms: $PLATFORM_LIST + diff --git a/packages/base/any/templates/onlp-platform-any.yml b/packages/base/any/templates/onlp-platform-any.yml new file mode 100644 index 00000000..b4064604 --- /dev/null +++ b/packages/base/any/templates/onlp-platform-any.yml @@ -0,0 +1,31 @@ +############################################################ +# +# ONLP Platform Package Template +# +# Requires: PLATFORM, ARCH +# +############################################################ + +variables: + install: /lib/platform-config/$PLATFORM/onl + +common: + version: 1.0.0 + arch: $ARCH + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onlp-${PLATFORM} + summary: ONLP Package for the ${PLATFORM} platform. + platform-config: True + + files: + builds/lib/$BUILD_DIR/$TOOLCHAIN/bin/libonlp-${PLATFORM}.so : ${install}/lib/ + builds/onlpdump/$BUILD_DIR/$TOOLCHAIN/bin/onlpdump : ${install}/bin/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/any/templates/platform-config-platform.yml b/packages/base/any/templates/platform-config-platform.yml new file mode 100644 index 00000000..22630018 --- /dev/null +++ b/packages/base/any/templates/platform-config-platform.yml @@ -0,0 +1,22 @@ +############################################################ +# +# PKG template for all platform-config packages. +# +############################################################ +prerequisites: + packages: [ "onl-vendor-config-${VENDOR}:all" ] + +packages: + - name: onl-platform-config-${PLATFORM} + depends: onl-vendor-config-${VENDOR} + version: 1.0.0 + arch: $ARCH + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + summary: ONL Platform Configuration Package for the ${PLATFORM} + + files: + src/lib: /lib/platform-config/${PLATFORM}/onl + src/python : ${PY_INSTALL}/onl/platform/ + + changelog: Changes diff --git a/packages/base/any/templates/platform-config-vendor.yml b/packages/base/any/templates/platform-config-vendor.yml new file mode 100644 index 00000000..ad783f77 --- /dev/null +++ b/packages/base/any/templates/platform-config-vendor.yml @@ -0,0 +1,16 @@ +prerequisites: + packages: [ "onl-vendor-config-onl:all" ] + +packages: + - name: onl-vendor-config-${VENDOR} + depends: onl-vendor-config-onl + version: 1.0.0 + arch: all + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + summary: ONL Configuration Package for ${Vendor} Platforms + + files: + src/python/${VENDOR} : ${PY_INSTALL}/onl/platform/${VENDOR} + + changelog: Changes diff --git a/packages/base/powerpc/faultd/.gitignore b/packages/base/powerpc/faultd/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/base/powerpc/faultd/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/base/powerpc/faultd/Makefile b/packages/base/powerpc/faultd/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/faultd/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/faultd/PKG.yml b/packages/base/powerpc/faultd/PKG.yml new file mode 100644 index 00000000..cde9799a --- /dev/null +++ b/packages/base/powerpc/faultd/PKG.yml @@ -0,0 +1,5 @@ +!include $ONL/packages/base/any/faultd/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu + + + + diff --git a/packages/base/powerpc/faultd/builds/.gitignore b/packages/base/powerpc/faultd/builds/.gitignore new file mode 100644 index 00000000..2b62be93 --- /dev/null +++ b/packages/base/powerpc/faultd/builds/.gitignore @@ -0,0 +1,2 @@ +faultd-module.mk +faultd.mk diff --git a/packages/base/powerpc/faultd/builds/Makefile b/packages/base/powerpc/faultd/builds/Makefile new file mode 100644 index 00000000..06756034 --- /dev/null +++ b/packages/base/powerpc/faultd/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/faultd/builds/Makefile + diff --git a/packages/base/powerpc/fit/Makefile b/packages/base/powerpc/fit/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/fit/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/fit/buildroot/Makefile b/packages/base/powerpc/fit/buildroot/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/fit/buildroot/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/fit/buildroot/PKG.yml b/packages/base/powerpc/fit/buildroot/PKG.yml new file mode 100644 index 00000000..10da94c7 --- /dev/null +++ b/packages/base/powerpc/fit/buildroot/PKG.yml @@ -0,0 +1,23 @@ +prerequisites: + packages: + - onl-buildroot-initrd:powerpc + +common: + arch: powerpc + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-buildroot-fit + version: 1.0.0 + summary: Open Network Linux FIT Buildroot Image + + files: + builds/onl-buildroot-fit.itb : $$PKG_INSTALL/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/powerpc/fit/buildroot/builds/.gitignore b/packages/base/powerpc/fit/buildroot/builds/.gitignore new file mode 100644 index 00000000..126b5b2f --- /dev/null +++ b/packages/base/powerpc/fit/buildroot/builds/.gitignore @@ -0,0 +1,4 @@ +kernel-* +*.itb +*.its +loader-initrd-powerpc diff --git a/packages/base/powerpc/fit/buildroot/builds/Makefile b/packages/base/powerpc/fit/buildroot/builds/Makefile new file mode 100644 index 00000000..7077ab3f --- /dev/null +++ b/packages/base/powerpc/fit/buildroot/builds/Makefile @@ -0,0 +1,12 @@ +.PHONY: onl-buildroot-fit.itb onl-buildroot-fit.its + +onl-buildroot-fit.itb: + $(ONL)/tools/flat-image-tree.py --initrd onl-buildroot-initrd:powerpc,onl-buildroot-initrd-powerpc.cpio.gz --add-platform all --itb $@ + +onl-buildroot-fit.its: + $(ONL)/tools/flat-image-tree.py --initrd onl-buildroot-initrd:powerpc,onl-buildroot-initrd-powerpc.cpio.gz --add-platform all --its $@ + +its: onl-buildroot-fit.its + + + diff --git a/packages/base/powerpc/fit/loader/Makefile b/packages/base/powerpc/fit/loader/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/fit/loader/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/fit/loader/PKG.yml b/packages/base/powerpc/fit/loader/PKG.yml new file mode 100644 index 00000000..6c024bce --- /dev/null +++ b/packages/base/powerpc/fit/loader/PKG.yml @@ -0,0 +1,23 @@ +prerequisites: + packages: + - onl-loader-initrd:powerpc + +common: + arch: powerpc + version: 1.0.0 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onl-loader-fit + version: 1.0.0 + summary: Open Network Linux FIT Loader Image + + files: + builds/onl-loader-fit.itb : $$PKG_INSTALL/ + + changelog: Change changes changes., + + + + diff --git a/packages/base/powerpc/fit/loader/builds/.gitignore b/packages/base/powerpc/fit/loader/builds/.gitignore new file mode 100644 index 00000000..126b5b2f --- /dev/null +++ b/packages/base/powerpc/fit/loader/builds/.gitignore @@ -0,0 +1,4 @@ +kernel-* +*.itb +*.its +loader-initrd-powerpc diff --git a/packages/base/powerpc/fit/loader/builds/Makefile b/packages/base/powerpc/fit/loader/builds/Makefile new file mode 100644 index 00000000..45fdd23b --- /dev/null +++ b/packages/base/powerpc/fit/loader/builds/Makefile @@ -0,0 +1,12 @@ +.PHONY: onl-loader-fit.itb onl-loader-fit.its + +onl-loader-fit.itb: + $(ONL)/tools/flat-image-tree.py --initrd onl-loader-initrd:powerpc,onl-loader-initrd-powerpc.cpio.gz --add-platform initrd --itb $@ + +onl-loader-fit.its: + $(ONL)/tools/flat-image-tree.py --initrd onl-loader-initrd:powerpc,onl-loader-initrd-powerpc.cpio.gz --add-platform initrd --its $@ + +its: onl-loader-fit.its + + + diff --git a/packages/base/powerpc/initrds/loader/Makefile b/packages/base/powerpc/initrds/loader/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/initrds/loader/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/initrds/loader/PKG.yml b/packages/base/powerpc/initrds/loader/PKG.yml new file mode 100644 index 00000000..fa9ccaf4 --- /dev/null +++ b/packages/base/powerpc/initrds/loader/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/initrds/loader/APKG.yml ARCH=powerpc + diff --git a/packages/base/powerpc/initrds/loader/builds/.gitignore b/packages/base/powerpc/initrds/loader/builds/.gitignore new file mode 100644 index 00000000..1b4a5fd6 --- /dev/null +++ b/packages/base/powerpc/initrds/loader/builds/.gitignore @@ -0,0 +1,3 @@ +loader-rootfs +buildroot-makedevs +manifest.json diff --git a/packages/base/powerpc/initrds/loader/builds/Makefile b/packages/base/powerpc/initrds/loader/builds/Makefile new file mode 100644 index 00000000..3f4bc9ad --- /dev/null +++ b/packages/base/powerpc/initrds/loader/builds/Makefile @@ -0,0 +1,2 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/initrds/loader/builds/Makefile diff --git a/packages/base/powerpc/onlp/Makefile b/packages/base/powerpc/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/powerpc/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/powerpc/onlp/PKG.yml b/packages/base/powerpc/onlp/PKG.yml new file mode 100644 index 00000000..106916ca --- /dev/null +++ b/packages/base/powerpc/onlp/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/onlp/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu + diff --git a/packages/base/powerpc/onlp/builds/.gitignore b/packages/base/powerpc/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/base/powerpc/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/base/powerpc/onlp/builds/Makefile b/packages/base/powerpc/onlp/builds/Makefile new file mode 100644 index 00000000..1a15e2fe --- /dev/null +++ b/packages/base/powerpc/onlp/builds/Makefile @@ -0,0 +1,3 @@ +DIRECTORIES := onlp-platform-defaults onlp-platform onlp +include $(ONL)/make/subdirs.mk + diff --git a/packages/base/powerpc/onlp/builds/onlp-platform-defaults/.gitignore b/packages/base/powerpc/onlp/builds/onlp-platform-defaults/.gitignore new file mode 100644 index 00000000..4e86ab53 --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp-platform-defaults/.gitignore @@ -0,0 +1 @@ +libonlp-platform-defaults-module.mk diff --git a/packages/base/powerpc/onlp/builds/onlp-platform-defaults/Makefile b/packages/base/powerpc/onlp/builds/onlp-platform-defaults/Makefile new file mode 100644 index 00000000..b51c845a --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp-platform-defaults/Makefile @@ -0,0 +1,2 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile diff --git a/packages/base/powerpc/onlp/builds/onlp-platform/.gitignore b/packages/base/powerpc/onlp/builds/onlp-platform/.gitignore new file mode 100644 index 00000000..8979873a --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp-platform/.gitignore @@ -0,0 +1 @@ +libonlp-platform-module.mk diff --git a/packages/base/powerpc/onlp/builds/onlp-platform/Makefile b/packages/base/powerpc/onlp/builds/onlp-platform/Makefile new file mode 100644 index 00000000..7884c981 --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp-platform/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/onlp/builds/onlp-platform/Makefile + diff --git a/packages/base/powerpc/onlp/builds/onlp/.gitignore b/packages/base/powerpc/onlp/builds/onlp/.gitignore new file mode 100644 index 00000000..d850afd1 --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp/.gitignore @@ -0,0 +1 @@ +libonlp-module.mk diff --git a/packages/base/powerpc/onlp/builds/onlp/Makefile b/packages/base/powerpc/onlp/builds/onlp/Makefile new file mode 100644 index 00000000..f99f53c1 --- /dev/null +++ b/packages/base/powerpc/onlp/builds/onlp/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/onlp/builds/onlp/Makefile + diff --git a/packages/base/powerpc/rootfs/Makefile b/packages/base/powerpc/rootfs/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/base/powerpc/rootfs/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/base/powerpc/rootfs/PKG.yml b/packages/base/powerpc/rootfs/PKG.yml new file mode 100644 index 00000000..4289d348 --- /dev/null +++ b/packages/base/powerpc/rootfs/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/rootfs/APKG.yml ARCH=powerpc + diff --git a/packages/base/powerpc/rootfs/builds/.gitignore b/packages/base/powerpc/rootfs/builds/.gitignore new file mode 100644 index 00000000..ea55cee3 --- /dev/null +++ b/packages/base/powerpc/rootfs/builds/.gitignore @@ -0,0 +1,2 @@ +*.d/ +manifest.json diff --git a/packages/base/powerpc/rootfs/builds/Makefile b/packages/base/powerpc/rootfs/builds/Makefile new file mode 100644 index 00000000..77e9b471 --- /dev/null +++ b/packages/base/powerpc/rootfs/builds/Makefile @@ -0,0 +1,16 @@ +include $(ONL)/make/config.powerpc.mk + +# +# Default to include all available powerpc platforms. +# You override this with you own list or yaml file. +# +export PLATFORM_LIST=$(shell onlpm --list-platforms --arch powerpc --csv ) + +RFS_CONFIG := $(ONL)/packages/base/any/rootfs/standard/standard.yml +RFS_DIR := rootfs-powerpc.d +RFS_CPIO := rootfs-powerpc.cpio.gz +RFS_SQUASH := rootfs-powerpc.sqsh + +include $(ONL)/make/rfs.mk + + diff --git a/packages/platforms/Makefile b/packages/platforms/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/.gitignore b/packages/platforms/accton/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/packages/platforms/accton/Makefile b/packages/platforms/accton/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/.gitignore b/packages/platforms/accton/powerpc-accton-as4600-54t/.gitignore new file mode 100644 index 00000000..fb9f5ccf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-as4600-54t-r0.mk +onlpdump-module.mk +powerpc_accton_as4600_54t.mk diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/PKG.yml b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/PKG.yml new file mode 100644 index 00000000..de4d2976 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=powerpc-accton-as4600-54t-r0 ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/.gitignore b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/lib/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/lib/Makefile new file mode 100644 index 00000000..ea55bb48 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-as4600-54t-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_accton_as4600_54t onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-accton-as4600-54t-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..6b4b405c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump-module +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp powerpc_accton_as4600_54t onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/Makefile new file mode 100644 index 00000000..8bc59590 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_accton_as4600_54t +AUTOMODULE := powerpc_accton_as4600_54t +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..78b48b65 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_accton_as4600_54t Autogeneration +# +############################################################################### +powerpc_accton_as4600_54t_AUTO_DEFS := module/auto/powerpc_accton_as4600_54t.yml +powerpc_accton_as4600_54t_AUTO_DIRS := module/inc/powerpc_accton_as4600_54t module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/powerpc_accton_as4600_54t.yml b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/powerpc_accton_as4600_54t.yml new file mode 100644 index 00000000..e6f4196e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/auto/powerpc_accton_as4600_54t.yml @@ -0,0 +1,47 @@ +############################################################################### +# +# powerpc_accton_as4600_54t Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB +- POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + POWERPC_ACCTON_AS4600_54T_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_accton_as4600_54t_config + + portingmacro: + POWERPC_ACCTON_AS4600_54T: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t.x b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t.x new file mode 100644 index 00000000..44bf3678 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_config.h b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_config.h new file mode 100644 index 00000000..02d02446 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_config.h @@ -0,0 +1,127 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as4600_54t Configuration Header + * + * @addtogroup powerpc_accton_as4600_54t-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS4600_54T_CONFIG_H__ +#define __POWERPC_ACCTON_AS4600_54T_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING +#define POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB +#define POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI +#define POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_accton_as4600_54t_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_accton_as4600_54t_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_accton_as4600_54t_config_settings table. */ +extern powerpc_accton_as4600_54t_config_settings_t powerpc_accton_as4600_54t_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_accton_as4600_54t_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_accton_as4600_54t_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_accton_as4600_54t_porting.h" + +#endif /* __POWERPC_ACCTON_AS4600_54T_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_dox.h b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_dox.h new file mode 100644 index 00000000..57cf10ea --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_accton_as4600_54t Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS4600_54T_DOX_H__ +#define __POWERPC_ACCTON_AS4600_54T_DOX_H__ + +/** + * @defgroup powerpc_accton_as4600_54t powerpc_accton_as4600_54t - powerpc_as4600_54t Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_accton_as4600_54t-powerpc_accton_as4600_54t Public Interface + * @defgroup powerpc_accton_as4600_54t-config Compile Time Configuration + * @defgroup powerpc_accton_as4600_54t-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_ACCTON_AS4600_54T_DOX_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h new file mode 100644 index 00000000..36954258 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as4600_54t Porting Macros. + * + * @addtogroup powerpc_accton_as4600_54t-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS4600_54T_PORTING_H__ +#define __POWERPC_ACCTON_AS4600_54T_PORTING_H__ + + +/* */ +#if POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_MALLOC + #if defined(GLOBAL_MALLOC) + #define POWERPC_ACCTON_AS4600_54T_MALLOC GLOBAL_MALLOC + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_MALLOC malloc + #else + #error The macro POWERPC_ACCTON_AS4600_54T_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_FREE + #if defined(GLOBAL_FREE) + #define POWERPC_ACCTON_AS4600_54T_FREE GLOBAL_FREE + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_FREE free + #else + #error The macro POWERPC_ACCTON_AS4600_54T_FREE is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_ACCTON_AS4600_54T_MEMSET GLOBAL_MEMSET + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_MEMSET memset + #else + #error The macro POWERPC_ACCTON_AS4600_54T_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_ACCTON_AS4600_54T_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_MEMCPY memcpy + #else + #error The macro POWERPC_ACCTON_AS4600_54T_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_ACCTON_AS4600_54T_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_STRNCPY strncpy + #else + #error The macro POWERPC_ACCTON_AS4600_54T_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_ACCTON_AS4600_54T_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_ACCTON_AS4600_54T_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_ACCTON_AS4600_54T_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_SNPRINTF snprintf + #else + #error The macro POWERPC_ACCTON_AS4600_54T_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS4600_54T_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_ACCTON_AS4600_54T_STRLEN GLOBAL_STRLEN + #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS4600_54T_STRLEN strlen + #else + #error The macro POWERPC_ACCTON_AS4600_54T_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_ACCTON_AS4600_54T_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/make.mk b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..f12db84b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_accton_as4600_54t_INCLUDES := -I $(THIS_DIR)inc +powerpc_accton_as4600_54t_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_accton_as4600_54t_DEPENDMODULE_ENTRIES := init:powerpc_accton_as4600_54t + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..d7fb9c68 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/fani.c @@ -0,0 +1,528 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +//#include "onlpie_int.h" +#include "platform_lib.h" + +/*-- cpld --*/ +#define CPLD_BASE_ADDRESS 0xEA000000 +#define CPLD_REG_FAN_STATUS_OFFSET 0x0F +#define CPLD_REG_PSU_2_FAN_STATUS_OFFSET 0x13 +#define CPLD_REG_PSU_1_FAN_STATUS_OFFSET 0x14 + +/* FAN status mask + */ +#define CPLD_FAN_1_PRESENT_BIT_MASK 0x80 +#define CPLD_FAN_2_PRESENT_BIT_MASK 0x40 +#define CPLD_FAN_1_DIRECTION_BIT_MASK 0x20 +#define CPLD_FAN_2_DIRECTION_BIT_MASK 0x10 +#define CPLD_PSU_FAN_STATUS_BIT_MASK 0x8 +#define CPLD_PSU_POWER_GOOD_MASK 0x10 +#define CPLD_PSU_PRESENT_BIT_MASK 0x80 + +/*-- i2c --*/ +#define I2C_SLAVE_ADDR_ADT7473 0x2E +#define I2C_SLAVE_ADDR_PSU_1_PMBUS 0x1A +#define I2C_SLAVE_ADDR_PSU_2_PMBUS 0x19 + +/* FAN status register in the ADT7473 + */ +#define I2C_FAN_1_STATUS_REG_TACH_1_LOW 0x28 +#define I2C_FAN_1_STATUS_REG_TACH_1_HIGH 0x29 +#define I2C_FAN_2_STATUS_REG_TACH_3_LOW 0x2C +#define I2C_FAN_2_STATUS_REG_TACH_3_HIGH 0x2D + +#define I2C_FAN_1_DUTY_CYCLE_REG_PWM_1 0x30 +#define I2C_FAN_2_DUTY_CYCLE_REG_PWM_3 0x32 + +#define I2C_AC_PSU_CHICONY_REG_FAN_SPEED 0x90 +#define I2C_AC_PSU_CHICONY_REG_FAN_COMMAND 0x3B + +#define FAN_DUTY_CYCLE_MAX 0xFF +#define PSU_FAN_RPM_MAX 15000 + +typedef struct onlp_fan_cpld +{ + unsigned char cpld_offset; + unsigned char cpld_mask; +} onlp_fan_cpld_t; + +const onlp_fan_cpld_t fan_data[] = { +{}, +{CPLD_REG_FAN_STATUS_OFFSET, CPLD_FAN_1_PRESENT_BIT_MASK}, +{CPLD_REG_FAN_STATUS_OFFSET, CPLD_FAN_2_PRESENT_BIT_MASK}, +{CPLD_REG_PSU_1_FAN_STATUS_OFFSET, CPLD_PSU_FAN_STATUS_BIT_MASK}, +{CPLD_REG_PSU_2_FAN_STATUS_OFFSET, CPLD_PSU_FAN_STATUS_BIT_MASK}, +}; + +static volatile uint8_t* cpld_base__ = NULL; + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + + /* + * Bring both fans to max. + * These will be reduced after the first platform management sequence. + */ + onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), 100); + onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(2), 100); + return ONLP_STATUS_OK; +} + +/* + * Get the fan information. + */ + +/* Static fan information */ +onlp_fan_info_t finfo[] = { + { }, /* Not used */ + { + { ONLP_FAN_ID_CREATE(1), "Chassis Fan 1", 0 }, + 0x0, + ONLP_FAN_CAPS_F2B|ONLP_FAN_CAPS_SET_PERCENTAGE, + 0, + 0, + ONLP_FAN_MODE_INVALID, + }, + { + { ONLP_FAN_ID_CREATE(2), "Chassis Fan 2", 0 }, + 0x0, + ONLP_FAN_CAPS_F2B|ONLP_FAN_CAPS_SET_PERCENTAGE, + 0, + 0, + ONLP_FAN_MODE_INVALID, + }, + { + { ONLP_FAN_ID_CREATE(3), "PSU-1 Fan 1", 0 }, + 0x0, + 0, + 0, + 0, + ONLP_FAN_MODE_INVALID, + }, + { + { ONLP_FAN_ID_CREATE(4), "PSU-2 Fan 1", 0 }, + 0x0, + 0, + 0, + 0, + ONLP_FAN_MODE_INVALID, + }, +}; + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + unsigned int bus_id = 1, fid = ONLP_OID_ID_GET(id); + unsigned char val = 0, data[2]={0},i2c_addr; + unsigned short psu_fan_rpm =0; + int rc = 0, psu_model = PSU_MODULE_TYPE_UNKNOWN; + + *info = finfo[fid]; + + val = cpld_base__[fan_data[fid].cpld_offset]; + + switch (fid) + { + case 1: /* FAN 1 */ + /* update the present status + */ + if ((val & fan_data[fid].cpld_mask) == fan_data[fid].cpld_mask) + { + info->status &= ~ONLP_FAN_STATUS_PRESENT; + } + else + { + info->status |= ONLP_FAN_STATUS_PRESENT; + } + + /* Update the Direction + * 0: Back to front. 1: Front to back. + */ + if((val & CPLD_FAN_1_DIRECTION_BIT_MASK) == CPLD_FAN_1_DIRECTION_BIT_MASK) + { + info->status |= ONLP_FAN_STATUS_F2B; + info->status &= ~ONLP_FAN_STATUS_B2F; + } + else + { + info->status |= ONLP_FAN_STATUS_B2F; + info->status &= ~ONLP_FAN_STATUS_F2B; + } + +#if 0 /* Hardware issue, the rpm value is unstable.*/ + /* Get the information from I2C + */ + i2c_addr = I2C_SLAVE_ADDR_ADT7473; + + /* Get the status + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_FAN_1_STATUS_REG_TACH_1_LOW, 1, &data[0]); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + rc = I2C_nRead(bus_id, i2c_addr, I2C_FAN_1_STATUS_REG_TACH_1_HIGH, 1, &data[1]); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + if (data[0] == 0xFF && data[1] == 0xFF) + { + /* FAN fail + */ + info->status |= ONLP_FAN_STATUS_FAILED; + } + else + { + info->status &= ~ONLP_FAN_STATUS_FAILED; + } + + /* Update the rpm, Fan Speed (RPM) = (90,000 * 60)/Fan TACH Reading + */ + fan_tach = data[1]; + fan_tach = (fan_tach << 8) + data[0]; + + if (fan_tach != 0) + { + info->rpm = (90000 * 60) / fan_tach; + } +#endif + break; + + case 2: /* FAN 2 */ + if ((val & fan_data[fid].cpld_mask) == fan_data[fid].cpld_mask) + { + info->status &= ~ONLP_FAN_STATUS_PRESENT; + } + else + { + info->status |= ONLP_FAN_STATUS_PRESENT; + } + + if((val & CPLD_FAN_2_DIRECTION_BIT_MASK) == CPLD_FAN_2_DIRECTION_BIT_MASK) + { + info->status |= ONLP_FAN_STATUS_F2B; + info->status &= ~ONLP_FAN_STATUS_B2F; + } + else + { + info->status |= ONLP_FAN_STATUS_B2F; + info->status &= ~ONLP_FAN_STATUS_F2B; + } + +#if 0 /* Hardware issue, the rpm value is unstable.*/ + /* Get information from I2C + */ + i2c_addr = I2C_SLAVE_ADDR_ADT7473; + + /* Get the status + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_FAN_2_STATUS_REG_TACH_3_LOW, 1, &data[0]); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + rc = I2C_nRead(bus_id, i2c_addr, I2C_FAN_2_STATUS_REG_TACH_3_HIGH, 1, &data[1]); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + if (data[0] == 0xFF && data[1] == 0xFF) + { + info->status |= ONLP_FAN_STATUS_FAILED; + } + else + { + info->status &= ~ONLP_FAN_STATUS_FAILED; + } + + /* Get the rpm, Fan Speed (RPM) = (90,000 * 60)/Fan TACH Reading + */ + fan_tach = data[1]; + fan_tach = (fan_tach << 8) + data[0]; + + if (fan_tach != 0) + { + info->rpm = (90000 * 60) / fan_tach; + } +#endif + break; + + case 3: /* FAN in the PSU 1*/ + case 4: /* FAN in the PSU 2*/ + /* Get the PSU FAN status from CPLD + * 1: FAN is OK. 0: FAN is fail + */ + if ((val & fan_data[fid].cpld_mask) == fan_data[fid].cpld_mask) + { + info->status &= ~ONLP_FAN_STATUS_FAILED; + } + else + { + info->status |= ONLP_FAN_STATUS_FAILED; + } +#if 0 /*#if 0 for test only, need this code block*/ + /* PSU needs to verify status of power_good_12v + * if the power_good_12v is fail, we cant get the infomation from pmbus via i2c. + */ + if ((val & CPLD_PSU_POWER_GOOD_MASK) == CPLD_PSU_POWER_GOOD_MASK) + { + break; + } +#endif + psu_model = as4600_54t_get_psu_type(fid-2, NULL,0); /* fid 3: inside PSU1. fid 4: inside PSU2*/ + + switch (psu_model) + { + case PSU_MODULE_TYPE_AC_CHICONY_F2B: + info->status |= ONLP_FAN_STATUS_PRESENT; /* always present. */ + + /* Update the Direction. + * 0: Back to front. 1: Front to back. + */ + info->status |= ONLP_FAN_STATUS_F2B; + + /* update caps */ + info->caps |= ONLP_FAN_CAPS_F2B; + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE; + + break; + + case PSU_MODULE_TYPE_AC_CHICONY_B2F: + info->status |= ONLP_FAN_STATUS_PRESENT; /* always present. */ + + /* Update the Direction. + * 0: Back to front. 1: Front to back. + */ + info->status |= ONLP_FAN_STATUS_B2F; + + /* update caps */ + info->caps |= ONLP_FAN_CAPS_B2F; + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE; + + break; + + case PSU_MODULE_TYPE_DC_UMEC_48V_F2B: + info->status |= ONLP_FAN_STATUS_PRESENT; /* always present. */ + info->status |= ONLP_FAN_STATUS_F2B; + + /* update caps */ + info->caps |= ONLP_FAN_CAPS_F2B; + + /* DC power supply does not has PMBus, return directly. + */ + return ONLP_STATUS_OK; + + case PSU_MODULE_TYPE_DC_UMEC_48V_B2F: + info->status |= ONLP_FAN_STATUS_PRESENT; /* always present. */ + info->status |= ONLP_FAN_STATUS_B2F; + + /* update caps */ + info->caps |= ONLP_FAN_CAPS_B2F; + + return ONLP_STATUS_OK; + + default : + return ONLP_STATUS_E_UNSUPPORTED; + } + + /* Get the information from I2C + */ + if (fid == 3) + { + i2c_addr = I2C_SLAVE_ADDR_PSU_1_PMBUS; + } + else + { + i2c_addr = I2C_SLAVE_ADDR_PSU_2_PMBUS; + } + + rc = I2C_nRead(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_FAN_SPEED, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + psu_fan_rpm = (data[1] << 8) + data[0]; + info->rpm = parse_literal_format(psu_fan_rpm, 1); + + break; + + default: + return ONLP_STATUS_E_UNSUPPORTED; + } + + return ONLP_STATUS_OK; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + /* precentage: range 0~100. (0: trun off) + */ + unsigned int bus_id = 1, fan_prec_to_rpm = 0, fid = ONLP_OID_ID_GET(id); + unsigned char i2c_addr=0, adt_offset=0, duty_cycle=0, fanspeed[3] = {0}; + unsigned short pmbus_value =0; + int rc=0; + + if ( fid == 1 || fid == 2) + { + i2c_addr = I2C_SLAVE_ADDR_ADT7473; + duty_cycle = (unsigned char)( (p * FAN_DUTY_CYCLE_MAX) / 100); + + if (duty_cycle > FAN_DUTY_CYCLE_MAX) + { + duty_cycle = FAN_DUTY_CYCLE_MAX; + } + + if (fid == 1) /* FAN 1 */ + { + adt_offset = I2C_FAN_1_DUTY_CYCLE_REG_PWM_1; + } + else if (fid == 2) /* FAN 2 */ + { + adt_offset = I2C_FAN_2_DUTY_CYCLE_REG_PWM_3; + } + + /* write the status + */ + rc = I2C_nWrite(bus_id, i2c_addr, adt_offset, 1, &duty_cycle); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + } + else if (fid == 3 || fid == 4) + { + int crc_rem=0; + + if ( fid == 3) + { + i2c_addr = I2C_SLAVE_ADDR_PSU_1_PMBUS; + } + else + { + i2c_addr = I2C_SLAVE_ADDR_PSU_2_PMBUS; + } + + fan_prec_to_rpm = ( p * PSU_FAN_RPM_MAX ) / 100; + pmbus_value = int_to_pmbus_linear(fan_prec_to_rpm); + + fanspeed[0] = pmbus_value & 0xFF; + fanspeed[1] = (pmbus_value >> 8)& 0xFF; + + /* Create the PEC byte + */ + crc_calc((i2c_addr<<1), &crc_rem); + crc_calc(I2C_AC_PSU_CHICONY_REG_FAN_COMMAND, &crc_rem); + crc_calc(fanspeed[0], &crc_rem); + crc_calc(fanspeed[1], &crc_rem); + fanspeed[2] = crc_rem; + + rc = I2C_nWrite(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_FAN_COMMAND, 3, fanspeed); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + } + return ONLP_STATUS_OK; +} + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..b72c0cd1 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,294 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include +#include "powerpc_accton_as4600_54t_int.h" + +/* LED related data + */ +#define CPLD_BASE_ADDRESS 0xEA000000 +#define CPLD_SYSTEM_LED_CONTROL_OFFSET_1 0x4 /* DIAG/PSU1/PSU2 LED*/ +#define CPLD_SYSTEM_LED_CONTROL_OFFSET_2 0x5 /* FAN1/FAN2/MODULE1/MODULE2 LED */ + +#define CPLD_LED_DIAG_REG_MASK 0xC0 +#define CPLD_LED_DIAG_GREEN 0x40 +#define CPLD_LED_DIAG_AMBER 0x80 +#define CPLD_LED_DIAG_OFF 0xC0 + +#define CPLD_LED_PSU_1_REG_MASK 0x0C +#define CPLD_LED_PSU_1_GREEN 0x04 +#define CPLD_LED_PSU_1_AMBER 0x08 +#define CPLD_LED_PSU_1_OFF 0x0C + +#define CPLD_LED_PSU_2_REG_MASK 0x03 +#define CPLD_LED_PSU_2_GREEN 0x01 +#define CPLD_LED_PSU_2_AMBER 0x02 +#define CPLD_LED_PSU_2_OFF 0x03 + +#define CPLD_LED_FAN_1_REG_MASK 0xC0 +#define CPLD_LED_FAN_1_GREEN 0x40 +#define CPLD_LED_FAN_1_AMBER 0x80 +#define CPLD_LED_FAN_1_OFF 0xC0 + +#define CPLD_LED_FAN_2_REG_MASK 0x30 +#define CPLD_LED_FAN_2_GREEN 0x10 +#define CPLD_LED_FAN_2_AMBER 0x20 +#define CPLD_LED_FAN_2_OFF 0x30 + +#define CPLD_LED_MODULE_1_REG_MASK 0x0C +#define CPLD_LED_MODULE_1_GREEN 0x04 +#define CPLD_LED_MODULE_1_AMBER 0x08 +#define CPLD_LED_MODULE_1_OFF 0x0C + +#define CPLD_LED_MODULE_2_REG_MASK 0x03 +#define CPLD_LED_MODULE_2_GREEN 0x01 +#define CPLD_LED_MODULE_2_AMBER 0x02 +#define CPLD_LED_MODULE_2_OFF 0x03 + + +typedef struct onlp_led_cpld +{ + onlp_led_id_t lid; + unsigned char cpld_offset; + unsigned char cpld_mask; + unsigned char cpld_val; /* The CPLD mask for the given mode*/ + int mode; +} onlp_led_cpld_t; + +const onlp_led_cpld_t led_data[] = { +{LED_DIAG, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_OFF, ONLP_LED_MODE_OFF}, +{LED_DIAG, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_GREEN, ONLP_LED_MODE_GREEN}, +{LED_DIAG, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_PSU_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_1_REG_MASK, CPLD_LED_PSU_1_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_1_REG_MASK, CPLD_LED_PSU_1_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_1_REG_MASK, CPLD_LED_PSU_1_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_PSU_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_2_REG_MASK, CPLD_LED_PSU_2_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_2_REG_MASK, CPLD_LED_PSU_2_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_1, CPLD_LED_PSU_2_REG_MASK, CPLD_LED_PSU_2_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_FAN_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_1_REG_MASK, CPLD_LED_FAN_1_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_1_REG_MASK, CPLD_LED_FAN_1_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_1_REG_MASK, CPLD_LED_FAN_1_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_FAN_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_2_REG_MASK, CPLD_LED_FAN_2_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_2_REG_MASK, CPLD_LED_FAN_2_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_FAN_2_REG_MASK, CPLD_LED_FAN_2_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_MODULE_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_1_REG_MASK, CPLD_LED_MODULE_1_OFF, ONLP_LED_MODE_OFF}, +{LED_MODULE_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_1_REG_MASK, CPLD_LED_MODULE_1_GREEN, ONLP_LED_MODE_GREEN}, +{LED_MODULE_1, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_1_REG_MASK, CPLD_LED_MODULE_1_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_MODULE_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_2_REG_MASK, CPLD_LED_MODULE_2_OFF, ONLP_LED_MODE_OFF}, +{LED_MODULE_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_2_REG_MASK, CPLD_LED_MODULE_2_GREEN, ONLP_LED_MODE_GREEN}, +{LED_MODULE_2, CPLD_SYSTEM_LED_CONTROL_OFFSET_2, CPLD_LED_MODULE_2_REG_MASK, CPLD_LED_MODULE_2_AMBER, ONLP_LED_MODE_ORANGE} +}; + +static volatile uint8_t* cpld_base__ = NULL; + +static int +led_cpld_val_to_light_mode(enum onlp_led_id lid, unsigned char reg_val) +{ + int i; + + for (i = 0; i < sizeof(led_data)/sizeof(led_data[0]); i++) + { + if (lid != led_data[i].lid) + continue; + + if ((led_data[i].cpld_mask & reg_val) == led_data[i].cpld_val) + return led_data[i].mode; + } + + return ONLP_LED_MODE_OFF; +} + +static unsigned char +led_light_mode_to_cpld_val(onlp_led_id_t lid, onlp_led_mode_t mode, unsigned char orig_val) +{ + int i; + + for (i = 0; i < sizeof(led_data)/sizeof(led_data[0]); i++) + { + if (lid != led_data[i].lid || mode != led_data[i].mode) + continue; + + orig_val = led_data[i].cpld_val | (orig_val & (~led_data[i].cpld_mask)); + } + + return orig_val; +} + +/* + * This function will be called prior to any other onlp_ledi_* functions. + */ +int +onlp_ledi_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + + + /* + * Diag LED Off + */ + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_OFF); + + /* + * M1 and M2 LEDs off + */ + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(6), ONLP_LED_MODE_OFF); + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(7), ONLP_LED_MODE_OFF); + + return ONLP_STATUS_OK; +} + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = + { + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(1), "Chassis LED 1 (DIAG LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(2), "Chassis LED 2 (PSU1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(3), "Chassis LED 3 (PSU2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(4), "Chassis LED 4 (FAN1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(5), "Chassis LED 5 (FAN2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(6), "Chassis LED 6 (MODULE1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + { + { ONLP_LED_ID_CREATE(7), "Chassis LED 7 (MODULE2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_ORANGE, + ONLP_LED_MODE_OFF + }, + }; + +int +onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int i; + unsigned char data = 0, reg = 0; + + *info = linfo[ONLP_OID_ID_GET(id)]; + + for (i = 0; i < sizeof(led_data)/sizeof(led_data[0]); i++) + { + if (ONLP_OID_ID_GET(id) != led_data[i].lid) + continue; + + reg = led_data[i].cpld_offset; + } + + /* Set the mode () */ + info->mode = 0; + + data = cpld_base__[reg]; + info->mode |= led_cpld_val_to_light_mode(ONLP_OID_ID_GET(id), data); + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + return ONLP_STATUS_OK; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int i = 0; + unsigned char data = 0, reg; + + for (i = 0; i < sizeof(led_data)/sizeof(led_data[0]); i++) + { + if (ONLP_OID_ID_GET(id) != led_data[i].lid) + continue; + + reg = led_data[i].cpld_offset; + break; + } + + data = cpld_base__[reg]; + cpld_base__[reg] = led_light_mode_to_cpld_val(ONLP_OID_ID_GET(id), mode, data); + + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..acb1d020 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := powerpc_accton_as4600_54t +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..0865f20a --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,341 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +#define MAX_I2C_BUSSES 2 +#define I2C_PSU_MAX_EEPROM_ADDR 1 +#define I2C_BUFFER_MAXSIZE 16 +#define I2C_PSU_MODEL_NAME_LEN 13 +#define I2C_PSU_FAN_TYPE_STRING_LEN 4 /* only for CHICONY AC power supply*/ + +/*-- i2c slave address --*/ +#define I2C_SLAVE_ADDR_PSU_1_EEPROM 0x52 +#define I2C_SLAVE_ADDR_PSU_2_EEPROM 0x51 + +typedef struct platform_psu_eeprom_i2c +{ + unsigned char i2c_eeprom_addr[I2C_PSU_MAX_EEPROM_ADDR]; +} platfrom_psu_eeprom_i2c_t; + +static platfrom_psu_eeprom_i2c_t psu_data[] = { +{}, +{{I2C_SLAVE_ADDR_PSU_1_EEPROM}}, +{{I2C_SLAVE_ADDR_PSU_2_EEPROM}} +}; + +/* FUNCTION NAME : I2C_nRead + * PURPOSE : This function read the i2c slave device data + * INPUT : file,data_adr and count + * OUTPUT : buf + * RETUEN : I2C_SUCCESS/I2C_ERROR + * NOTES : + */ +int I2C_nRead +(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf) +{ + static unsigned char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + char fname[15]; + int i2c_fd = -1; + int ret = 0; + + if (bus_id >= MAX_I2C_BUSSES) + { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + i2c_fd = open(fname, O_RDWR); /* open device */ + + if (i2c_fd < 0) + { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_SLAVE_FORCE, i2c_addr); + + if (0 != ret) + { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + /* Returns the number of read bytes */ + /*s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, u8 command, + u8 length, u8 *values)*/ + if(i2c_smbus_read_i2c_block_data(i2c_fd, offset, size, sendbuffer) == -1) + { +// printf("%s(): failed to i2c_smbus_read_i2c_block_data(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + memcpy(buf, sendbuffer, size); + + close(i2c_fd); + return 0; + +} + +/* FUNCTION NAME : I2C_nWrite + * PURPOSE : This function write the data to I2C devices ! + * INPUT : i2c_fd,data_adr ,buf and count + * OUTPUT : + * RETUEN : ret/I2C_ERROR + * NOTES : + */ +int I2C_nWrite +(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf) +{ + static unsigned char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + int i2c_fd; + int ret = 0; + char fname[15]; + + if (bus_id >= MAX_I2C_BUSSES) + { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + + i2c_fd = open(fname, O_RDWR); /* open device */ + + if (i2c_fd < 0) + { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_PEC, 1);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set PEC %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_SLAVE, i2c_addr); + + if (0 != ret) + { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + /* write address: offset address */ + memcpy(sendbuffer, buf, size); + + if(i2c_smbus_write_i2c_block_data(i2c_fd, offset, size, sendbuffer) == -1) + { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + close(i2c_fd); + + return 0; +} + +int two_complement_to_int(unsigned short data, unsigned char valid_bit, unsigned short mask) +{ + unsigned short valid_data = data & mask; + int is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +/* Transfer the data format from chip value to decimal + * The chip value is linear format data bytes. Please refer to datasheet to get more detail info. + * The format: + * Bit 0~10: mantissa + * Bit 11~15: exponent + * Input value: multiplier_value. We use this input value to extend the decimal to milli-x. + */ +int parse_literal_format(unsigned short val, int multiplier_value) +{ + int exponent, mantissa; + + exponent = two_complement_to_int(val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(val & 0x7ff, 11, 0x7ff); + + if (exponent >= 0) + { + return (mantissa << exponent) * multiplier_value; + } + else + { + return (mantissa * multiplier_value)/(1 << -exponent); + } +} + +int int_to_pmbus_linear(int val) +{ + int mantissa = val, exponent = 0; + + while (1) + { + if (mantissa < 1024) + break; + + exponent++; + mantissa >>= 1; + } + return (exponent << 11) | mantissa; +} + +#ifdef CRC_LOOK_UP_TABLE +char CRC_8_table[256] = +{ +0x0, 0x7, 0xE, 0x9, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, +0x24, 0x23, 0x2A, 0x2D, 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, +0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, 0xE0, 0xE7, 0xEE, 0xE9, +0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, +0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, 0xA8, 0xAF, 0xA6, 0xA1, +0xB4, 0xB3, 0xBA, 0xBD, 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, +0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, 0xB7, 0xB0, 0xB9, 0xBE, +0xAB, 0xAC, 0xA5, 0xA2, 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, +0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, 0x1F, 0x18, 0x11, 0x16, +0x3, 0x4, 0xD, 0xA, 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, +0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, 0x89, 0x8E, 0x87, 0x80, +0x95, 0x92, 0x9B, 0x9C, 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, +0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, 0xC1, 0xC6, 0xCF, 0xC8, +0xDD, 0xDA, 0xD3, 0xD4, 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, +0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, 0x19, 0x1E, 0x17, 0x10, +0x5, 0x2, 0xB, 0xC, 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, +0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, 0x76, 0x71, 0x78, 0x7F, +0x6A, 0x6D, 0x64, 0x63, 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, +0x6, 0x1, 0x8, 0xF, 0x1A, 0x1D, 0x14, 0x13, 0xAE, 0xA9, 0xA0, 0xA7, +0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, +0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF, +0xFA, 0xFD, 0xF4 +};//for x^8 + x^2 + x + 1 +#endif + +void crc_calc(char data_in, int *remainder) +{ + *remainder = ((*remainder) ^ (data_in))<<8; + +#ifdef CRC_LOOK_UP_TABLE + *remainder = CRC_8_table[*remainder]; +#else + int genpoly = (0x107<<7);//x^8 + x^2 + x + 1 + int msb = 1<<15; + int i=0; + + for(i=8;i>0;i--) + { + if((*remainder & msb) != 0) + *remainder = *remainder ^ genpoly; + + genpoly = genpoly>>1; + msb = msb>>1; + } +#endif + +} + +int as4600_54t_get_psu_type(int pid, char* modelname, int modelname_len) +{ + int i=0, ret=PSU_MODULE_TYPE_UNKNOWN; /* User insert a nuknown PSU or Not plugged in.*/ + unsigned int bus_id = 1; + char model_name[I2C_PSU_MODEL_NAME_LEN+1] = {0}, fan_type[I2C_PSU_FAN_TYPE_STRING_LEN+1] = {0}; + + for (i=0; i + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +typedef enum psu_module_type_e { + PSU_MODULE_TYPE_UNKNOWN = 0, + PSU_MODULE_TYPE_AC_CHICONY_F2B, + PSU_MODULE_TYPE_AC_CHICONY_B2F, + PSU_MODULE_TYPE_DC_UMEC_48V_F2B, + PSU_MODULE_TYPE_DC_UMEC_48V_B2F +} psu_module_type_t; + +int i2c_write(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned char *buf); + +int i2c_read(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned char *buf); + +int I2C_nRead(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf); + +int I2C_nWrite(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf); + +int two_complement_to_int(unsigned short data, unsigned char valid_bit, unsigned short mask); + +int parse_literal_format(unsigned short val, int multiplier_value); + +int int_to_pmbus_linear(int val); + +void crc_calc(char data_in, int *rem); + +int as4600_54t_get_psu_type(int pid, char* modelname, int modelname_len); + +#endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_config.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_config.c new file mode 100644 index 00000000..349d7416 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_config.c @@ -0,0 +1,76 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(_x) __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(_x) +powerpc_accton_as4600_54t_config_settings_t powerpc_accton_as4600_54t_config_settings[] = +{ +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_LOGGING(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI + { __powerpc_accton_as4600_54t_config_STRINGIFY_NAME(POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI), __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_ACCTON_AS4600_54T_CONFIG_INCLUDE_UCLI(__powerpc_accton_as4600_54t_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_accton_as4600_54t_config_STRINGIFY_VALUE +#undef __powerpc_accton_as4600_54t_config_STRINGIFY_NAME + +const char* +powerpc_accton_as4600_54t_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_accton_as4600_54t_config_settings[i].name; i++) { + if(strcmp(powerpc_accton_as4600_54t_config_settings[i].name, setting)) { + return powerpc_accton_as4600_54t_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_accton_as4600_54t_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_accton_as4600_54t_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_accton_as4600_54t_config_settings[i].name, powerpc_accton_as4600_54t_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_enums.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_enums.c new file mode 100644 index 00000000..15f158cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_int.h b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_int.h new file mode 100644 index 00000000..c7a52814 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_int.h @@ -0,0 +1,23 @@ +/**************************************************************************//** + * + * powerpc_accton_as4600_54t Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS4600_54T_INT_H__ +#define __POWERPC_ACCTON_AS4600_54T_INT_H__ + +#include + +typedef enum onlp_led_id +{ + LED_DIAG = 1, + LED_PSU_1, + LED_PSU_2, + LED_FAN_1, + LED_FAN_2, + LED_MODULE_1, + LED_MODULE_2 +} onlp_led_id_t; + + +#endif /* __POWERPC_ACCTON_AS4600_54T_INT_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.c new file mode 100644 index 00000000..a4687492 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as4600_54t_log.h" +/* + * powerpc_accton_as4600_54t log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_ACCTON_AS4600_54T_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.h b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.h new file mode 100644 index 00000000..ccafbc44 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS4600_54T_LOG_H__ +#define __POWERPC_ACCTON_AS4600_54T_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_accton_as4600_54t +#include + +#endif /* __POWERPC_ACCTON_AS4600_54T_LOG_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_module.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_module.c new file mode 100644 index 00000000..dc08b351 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/powerpc_accton_as4600_54t_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as4600_54t_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_ACCTON_AS4600_54T_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_accton_as4600_54t_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..8466c4b3 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/psui.c @@ -0,0 +1,273 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +//#include "onlpie_int.h" +#include "platform_lib.h" + +/*-- i2c --*/ +#define I2C_SLAVE_ADDR_PSU_1_PMBUS 0x1A +#define I2C_SLAVE_ADDR_PSU_2_PMBUS 0x19 + +#define I2C_AC_PSU_CHICONY_REG_OUT_VOLT 0x8B +#define I2C_AC_PSU_CHICONY_REG_OUT_CURRENT 0x8C +#define I2C_AC_PSU_CHICONY_REG_OUT_POWER 0x96 +#define I2C_AC_PSU_CHICONY_REG_STATUS 0x79 + +#define I2C_AC_PSU_CHICONY_POWER_GOOD_NETAGED_MASK 0x8 + +/*-- cpld --*/ +#define CPLD_BASE_ADDRESS 0xEA000000 +#define CPLD_REG_PSU_1_STATUS_OFFSET 0x14 +#define CPLD_REG_PSU_2_STATUS_OFFSET 0x13 +#define CPLD_REG_PSU_PRESENT_MASK 0x80 +#define CPLD_REG_PSU_POWER_GOOD_MASK 0x10 + +#define PSU_PMBUS_DATA_MULTIPLIER 1000 + +typedef enum onlp_psu_id +{ + PSU_1 = 0, + PSU_2 +} onlp_psu_id_t; + +typedef struct onlp_psu_i2c +{ + onlp_psu_id_t pid; + unsigned char i2c_pmbus_addr; +} onlp_psu_i2c_t; + +typedef struct onlp_psu_cpld +{ + onlp_psu_id_t pid; + unsigned char cpld_addr; + unsigned char present_mask; /* Presnet: BA device needs to verify persent & power_good_12v*/ + unsigned char power_good_mask; +} onlp_psu_cpld_t; + +const onlp_psu_i2c_t psu_i2c_data[] = { +{}, +{PSU_1, I2C_SLAVE_ADDR_PSU_1_PMBUS}, +{PSU_2, I2C_SLAVE_ADDR_PSU_2_PMBUS} +}; + +const onlp_psu_cpld_t psu_cpld_data[] = { +{}, +{PSU_1, CPLD_REG_PSU_1_STATUS_OFFSET, CPLD_REG_PSU_PRESENT_MASK, CPLD_REG_PSU_POWER_GOOD_MASK}, +{PSU_2, CPLD_REG_PSU_2_STATUS_OFFSET, CPLD_REG_PSU_PRESENT_MASK, CPLD_REG_PSU_POWER_GOOD_MASK} +}; + +static volatile uint8_t* cpld_base__ = NULL; +/* + * This function will be called prior to any other onlp_psui functions. + */ +int +onlp_psui_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = + { + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(1), "PSU-1", 0, { 0 } }, + { 0 }, { 0 }, + 0x0, + 0x0, + 0, + 0, + 0, + 0, + 0, + 0, + }, + { + { ONLP_PSU_ID_CREATE(2), "PSU-2", 0, { 0 } }, + { 0 }, { 0 }, + 0x0, + 0x0, + 0, + 0, + 0, + 0, + 0, + 0, + } + }; + + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + unsigned int bus_id = 1, pid = ONLP_OID_ID_GET(id); + unsigned short volt_out=0, cur_out=0, pow_out=0; + unsigned char i2c_addr, val=0, data[2]={0}; + int rc=0, psu_model = PSU_MODULE_TYPE_UNKNOWN; + + *info = pinfo[ONLP_OID_ID_GET(id)]; + + val = cpld_base__[psu_cpld_data[pid].cpld_addr]; + + if ((val & psu_cpld_data[pid].present_mask) == 0 ) + { + info->status |= ONLP_PSU_STATUS_PRESENT; + } + else + { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + + psu_model = as4600_54t_get_psu_type(pid, info->model, sizeof(info->model)); + + switch (psu_model) + { + case PSU_MODULE_TYPE_AC_CHICONY_B2F: + case PSU_MODULE_TYPE_AC_CHICONY_F2B: + /* This PSU has 1 fan and 1 thermal sensor. Create the child oid. + */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(pid+2); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(pid+3); + info->caps |= ONLP_PSU_CAPS_AC; + + i2c_addr = psu_i2c_data[pid].i2c_pmbus_addr; + rc = I2C_nRead(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_STATUS, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + /* update the power good status + */ + if ( (data[1] & I2C_AC_PSU_CHICONY_POWER_GOOD_NETAGED_MASK) == I2C_AC_PSU_CHICONY_POWER_GOOD_NETAGED_MASK) + { + info->status |= ONLP_PSU_STATUS_FAILED; + } + else + { + info->status &= ~ONLP_PSU_STATUS_FAILED; + } + + /* update output voltage + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_OUT_VOLT, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + volt_out = (data[1] << 8) + data[0]; + info->mvout = parse_literal_format(volt_out, PSU_PMBUS_DATA_MULTIPLIER); + info->caps |= ONLP_PSU_CAPS_VOUT; + + /* update output current + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_OUT_CURRENT, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + cur_out = (data[1] << 8) + data[0]; + info->miout = parse_literal_format(cur_out, PSU_PMBUS_DATA_MULTIPLIER); + info->caps |= ONLP_PSU_CAPS_IOUT; + + /* CHICONY: Not support + */ + info->mvin = 0; + + /* update output power + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_AC_PSU_CHICONY_REG_OUT_POWER, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + pow_out = (data[1] << 8) + data[0]; + info->mpout = parse_literal_format(pow_out, PSU_PMBUS_DATA_MULTIPLIER); + info->caps |= ONLP_PSU_CAPS_POUT; + + rc = ONLP_STATUS_OK; + break; + + case PSU_MODULE_TYPE_DC_UMEC_48V_F2B: + case PSU_MODULE_TYPE_DC_UMEC_48V_B2F: + /* This PSU has 1 fan. Create the child oid. + */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(pid+2); + info->caps |= ONLP_PSU_CAPS_DC48; + + /* update the power good status + */ + if ((val & psu_cpld_data[pid].power_good_mask) == psu_cpld_data[pid].power_good_mask) + { + info->status |= ONLP_PSU_STATUS_FAILED; + } + else + { + info->status &= ~ONLP_PSU_STATUS_FAILED; + } + + rc = ONLP_STATUS_OK; + break; + + case PSU_MODULE_TYPE_UNKNOWN: /* User insert a nuknown PSU or unplugged.*/ + info->status |= ONLP_PSU_STATUS_UNPLUGGED; + rc = ONLP_STATUS_OK; + break; + + default: + rc = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return rc; + +} + +/* + * This is an optional generic ioctl() interface. + * Its purpose is to allow future expansion and + * custom functionality that is not otherwise exposed + * in the standard interface. + * + * The semantics of this function are platform specific. + * This function is completely optional. + */ +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..61ea9da8 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,417 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "powerpc_accton_as4600_54t_log.h" + +#include "platform_lib.h" + +#define CPLD_BASE_ADDRESS 0xEA000000 +#define CPLD_REG_SFP_PRESENT 0x0A +#define CPLD_REG_SFP_RX_LOSS 0x0B +#define CPLD_REG_SFP_TX_FAIL 0x0C +#define CPLD_REG_SFP_TX_DISABLE 0x0D +#define CPLD_SFP_1_BIT_MASK 0x80 +#define CPLD_SFP_2_BIT_MASK 0x40 +#define CPLD_SFP_3_BIT_MASK 0x20 +#define CPLD_SFP_4_BIT_MASK 0x10 + +#define I2C_SLAVE_ADDRESS_SFP_EEPROM_50 0x50 +#define I2C_SLAVE_ADDRESS_SFP_EEPROM_51 0x51 + +#define I2C_SLAVE_ADDR_PCA9548 0x70 + +#define PCA9548_PORT_0_BIT_MASK 0x01 +#define PCA9548_PORT_1_BIT_MASK 0x02 +#define PCA9548_PORT_2_BIT_MASK 0x04 +#define PCA9548_PORT_3_BIT_MASK 0x08 + +#define MAX_I2C_BUSSES 2 +#define I2C_BUFFER_MAXSIZE 16 + +static volatile uint8_t* cpld_base__ = NULL; + +int +onlp_sfpi_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Report all SFP-capable ports. + * BA: SFP 49, 50, 51, 52 + */ + AIM_BITMAP_SET(bmap, 48); + AIM_BITMAP_SET(bmap, 49); + AIM_BITMAP_SET(bmap, 50); + AIM_BITMAP_SET(bmap, 51); + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + unsigned char val; + val = cpld_base__[CPLD_REG_SFP_PRESENT]; + + AIM_BITMAP_MOD(dst, 48, (val & CPLD_SFP_1_BIT_MASK) ? 0 : 1); + AIM_BITMAP_MOD(dst, 49, (val & CPLD_SFP_2_BIT_MASK) ? 0 : 1); + AIM_BITMAP_MOD(dst, 50, (val & CPLD_SFP_3_BIT_MASK) ? 0 : 1); + AIM_BITMAP_MOD(dst, 51, (val & CPLD_SFP_4_BIT_MASK) ? 0 : 1); + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + unsigned char val; + val = cpld_base__[CPLD_REG_SFP_RX_LOSS]; + + AIM_BITMAP_MOD(dst, 48, (val & CPLD_SFP_1_BIT_MASK) ? 1 : 0); + AIM_BITMAP_MOD(dst, 49, (val & CPLD_SFP_2_BIT_MASK) ? 1 : 0); + AIM_BITMAP_MOD(dst, 50, (val & CPLD_SFP_3_BIT_MASK) ? 1 : 0); + AIM_BITMAP_MOD(dst, 51, (val & CPLD_SFP_4_BIT_MASK) ? 1 : 0); + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_is_present(int port) +{ + unsigned int regOffset; + unsigned char val, mask; + int rc = 0; + + regOffset = CPLD_REG_SFP_PRESENT; + + switch(port) + { + case 48: + mask = CPLD_SFP_1_BIT_MASK; + break; + case 49: + mask = CPLD_SFP_2_BIT_MASK; + break; + case 50: + mask = CPLD_SFP_3_BIT_MASK; + break; + case 51: + mask = CPLD_SFP_4_BIT_MASK; + break; + default: + return ONLP_STATUS_E_INTERNAL; + } + + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + val = cpld_base__[regOffset]; + rc = (val & mask) ? 0 : 1; + + return rc; +} + +static int +onlp_sfpi_read_addr__(int port, int addr, unsigned char *data) +{ + int i, rc = 0; + unsigned int bus_id = 0; + unsigned char mask = 0; + unsigned int i2c_addr; + + /* + * switch channel on i2c multiplexer + */ + switch(port) + { + case 48: + mask = PCA9548_PORT_0_BIT_MASK; + break; + case 49: + mask = PCA9548_PORT_1_BIT_MASK; + break; + case 50: + mask = PCA9548_PORT_2_BIT_MASK; + break; + case 51: + mask = PCA9548_PORT_3_BIT_MASK; + break; + default: + return ONLP_STATUS_E_INTERNAL; + } + i2c_addr = I2C_SLAVE_ADDR_PCA9548; + rc = I2C_nWrite(bus_id, i2c_addr, 0, 1, &mask); + if(0 != rc) + return ONLP_STATUS_E_INTERNAL; + + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + i2c_addr = addr; + for(i=0; i<16; i++) { + rc = I2C_nRead(bus_id, i2c_addr, i*I2C_BUFFER_MAXSIZE, I2C_BUFFER_MAXSIZE, data + i*I2C_BUFFER_MAXSIZE); + if(0 != rc) + return ONLP_STATUS_E_INTERNAL; + } + + return 0; +} + +int +onlp_sfpi_eeprom_read(int port, unsigned char *data) +{ + return onlp_sfpi_read_addr__(port, I2C_SLAVE_ADDRESS_SFP_EEPROM_50, + data); +} + +int +onlp_sfpi_dom_read(int port, unsigned char* data) +{ + return onlp_sfpi_read_addr__(port, I2C_SLAVE_ADDRESS_SFP_EEPROM_51, + data); +} + + +/* + * Manually enable or disable the given SFP. + * + */ +static int +tx_enable_set__(int port, int enable) +{ + /* If enable is 1, enable the SFP */ + /* If enable is 0, disable the SFP */ + unsigned int regOffset; + unsigned char val, mask; + + regOffset = CPLD_REG_SFP_TX_DISABLE; + + switch(port) + { + case 48: + mask = CPLD_SFP_1_BIT_MASK; + break; + case 49: + mask = CPLD_SFP_2_BIT_MASK; + break; + case 50: + mask = CPLD_SFP_3_BIT_MASK; + break; + case 51: + mask = CPLD_SFP_4_BIT_MASK; + break; + default: + return ONLP_STATUS_E_INVALID; + } + + /* read the current status. + */ + val = cpld_base__[regOffset]; + + /* CPLD value: + * 0: transmit Enable + * 1: transmit Disable + */ + if ( enable == 1) + { + val &= ~mask; + } + else + { + val |= mask; + } + + cpld_base__[regOffset] = val; + + return ONLP_STATUS_OK; +} + +/* + * Returns whether the SFP is currently enabled or disabled. + */ +static int +tx_enable_get__(int port, int* enable) +{ + unsigned int regOffset; + unsigned char val, mask; + + regOffset = CPLD_REG_SFP_TX_DISABLE; + + switch(port) + { + case 48: + mask = CPLD_SFP_1_BIT_MASK; + break; + case 49: + mask = CPLD_SFP_2_BIT_MASK; + break; + case 50: + mask = CPLD_SFP_3_BIT_MASK; + break; + case 51: + mask = CPLD_SFP_4_BIT_MASK; + break; + default: + return ONLP_STATUS_E_INTERNAL; + } + + val = cpld_base__[regOffset]; + + /* Return whether the SFP is currently enabled + * =0, if disable + * =1, if enalbe + */ + *enable = (val & mask) ? 0 : 1; + + return ONLP_STATUS_OK; +} + + +static int +control_flags_get__(int port, uint32_t* status) +{ + unsigned int regOffset1, regOffset2; + unsigned char val1, val2, mask; + + regOffset1 = CPLD_REG_SFP_RX_LOSS; + regOffset2 = CPLD_REG_SFP_TX_FAIL; + + *status = 0; + + switch(port) + { + case 48: + mask = CPLD_SFP_1_BIT_MASK; + break; + case 49: + mask = CPLD_SFP_2_BIT_MASK; + break; + case 50: + mask = CPLD_SFP_3_BIT_MASK; + break; + case 51: + mask = CPLD_SFP_4_BIT_MASK; + break; + default: + return ONLP_STATUS_E_INTERNAL; + } + + val1 = cpld_base__[regOffset1]; + val2 = cpld_base__[regOffset2]; + + /* Report any current status flags for the SFP */ + if ((val1 & mask) == mask) + { + *status |= ONLP_SFP_CONTROL_FLAG_RX_LOS; + } + + if ((val2 & mask) == mask) + { + *status |= ONLP_SFP_CONTROL_FLAG_TX_FAULT; + } + + return ONLP_STATUS_OK; +} + + +int +onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) +{ + switch(control) + { + case ONLP_SFP_CONTROL_TX_DISABLE: + return tx_enable_set__(port, !value); + default: + return ONLP_STATUS_E_UNSUPPORTED; + } +} +int +onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value) +{ + switch(control) + { + case ONLP_SFP_CONTROL_TX_DISABLE: + { + int rv; + ONLP_IF_ERROR_RETURN(rv = tx_enable_get__(port, value)); + *value = ! *value; + return ONLP_STATUS_OK; + } + + case ONLP_SFP_CONTROL_RX_LOS: + { + uint32_t flags = 0; + ONLP_IF_ERROR_RETURN(control_flags_get__(port, &flags)); + *value = (flags & ONLP_SFP_CONTROL_FLAG_RX_LOS) ? 1 : 0; + return ONLP_STATUS_OK; + } + + case ONLP_SFP_CONTROL_TX_FAULT: + { + uint32_t flags = 0; + ONLP_IF_ERROR_RETURN(control_flags_get__(port, &flags)); + *value = (flags & ONLP_SFP_CONTROL_FLAG_TX_FAULT) ? 1 : 0; + return ONLP_STATUS_OK; + } + + default: + return ONLP_STATUS_E_UNSUPPORTED; + } +} + +int +onlp_sfpi_denit(void) +{ + munmap((void*)cpld_base__, getpagesize()); + return 0; +} + + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..012c8e9b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,307 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include + +#include "powerpc_accton_as4600_54t_int.h" +#include "powerpc_accton_as4600_54t_log.h" + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-accton-as4600-54t-rX"; +} + +int +onlp_sysi_platform_set(const char* platform) +{ + /* + * Support all revisions of the 4600-54t + */ + if(strstr(platform, "powerpc-accton-as4600-54t-r")) { + return ONLP_STATUS_OK; + } + + if(strstr(platform, "powerpc-as4600-54t")) { + return ONLP_STATUS_OK; + } + + AIM_LOG_ERROR("No support for platform '%s'", platform); + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_init(void) +{ + return ONLP_STATUS_OK; +} + + +int +onlp_sysi_onie_data_phys_addr_get(void** physaddr) +{ + *physaddr = (void*)(0xeff70000); + return ONLP_STATUS_OK; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* 4 Thermal sensors on the chassis */ + *e++ = ONLP_THERMAL_ID_CREATE(1); + *e++ = ONLP_THERMAL_ID_CREATE(2); + *e++ = ONLP_THERMAL_ID_CREATE(3); + + /* 2 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + + /* 2 Fans */ + *e++ = ONLP_FAN_ID_CREATE(1); + *e++ = ONLP_FAN_ID_CREATE(2); + + /* 7 LEDs */ + *e++ = ONLP_LED_ID_CREATE(1); + *e++ = ONLP_LED_ID_CREATE(2); + *e++ = ONLP_LED_ID_CREATE(3); + *e++ = ONLP_LED_ID_CREATE(4); + *e++ = ONLP_LED_ID_CREATE(5); + *e++ = ONLP_LED_ID_CREATE(6); + *e++ = ONLP_LED_ID_CREATE(7); + + return 0; +} + + + +#include +#include +#include + +int +onlp_sysi_platform_manage_fans(void) +{ + /* This comes from the fan initialization */ + static int previous_percentage = 100; + int current_condition = 0; + + /* + * If any fan is missing or failed set the other to maximum. + */ + onlp_fan_info_t fi; + if( (onlp_fani_info_get(ONLP_FAN_ID_CREATE(1), &fi) < 0) || + (fi.status & ONLP_FAN_STATUS_FAILED) || + ((fi.status & 0x1) == 0) ) { + AIM_LOG_ERROR("Fan 1 missing or failed."); + current_condition = 3; + goto control; + } + + if( (onlp_fani_info_get(ONLP_FAN_ID_CREATE(2), &fi) < 0) || + (fi.status & ONLP_FAN_STATUS_FAILED) || + ((fi.status & 0x1) == 0) ) { + AIM_LOG_ERROR("Fan 2 missing or failed."); + current_condition = 3; + goto control; + } + + /* + * Temperature Condition + */ + onlp_thermal_info_t ti; + int percentage = 50; + int t1, t2; + + + if( (onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &ti) < 0) || + (ti.status & ONLP_THERMAL_STATUS_FAILED) || + ((ti.status & 0x1) == 0) ) { + current_condition = 3; + goto control; + } + else { + t1 = ti.mcelsius; + } + + if( (onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(2), &ti) < 0) || + (ti.status & ONLP_THERMAL_STATUS_FAILED) || + ((ti.status & 0x1) == 0) ) { + current_condition = 3; + goto control; + } + else { + t2 = ti.mcelsius; + } + + /* + * Determine current temperature condition if we aren't in + * an exception state: + */ + if(current_condition != 3) { + if(t1 >= 55000 || t2 >= 65000) { + current_condition = 1; + } + if(t1 < 45000 && t2 < 55000) { + current_condition = 2; + } + } + + control: + + switch(current_condition) + { + case 3: + percentage = 100; + break; + case 2: + switch(previous_percentage) + { + case 100: + percentage = 75; + break; + case 75: + percentage = 50; + break; + } + break; + case 1: + switch(previous_percentage) + { + case 50: + percentage = 75; + break; + case 75: + percentage = 100; + break; + } + break; + } + + AIM_LOG_MSG("Fans are now at %d%%", percentage); + onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), percentage); + onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(2), percentage); + previous_percentage = percentage; + return 0; +} + + +int +onlp_sysi_platform_manage_leds(void) +{ + + /* + * FAN Indicators + * + * Green - Good + * Amber - Present but Failed + * Off - Missing + * + */ + + /* + * FAN1 + */ + onlp_fan_info_t fi; + onlp_led_mode_t mode = ONLP_LED_MODE_GREEN; + if(onlp_fani_info_get(ONLP_FAN_ID_CREATE(1), &fi) < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if( (fi.status & 0x1) == 0) { + /* Not present -- Off */ + mode = ONLP_LED_MODE_OFF; + } + else if(fi.status & ONLP_FAN_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(LED_FAN_1, mode); + + /* + * FAN2 + */ + mode = ONLP_LED_MODE_GREEN; + if(onlp_fani_info_get(ONLP_FAN_ID_CREATE(2), &fi) < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if( (fi.status & 0x1) == 0) { + /* Not present -- Off */ + mode = ONLP_LED_MODE_OFF; + } + else if(fi.status & ONLP_FAN_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(LED_FAN_2, mode); + + + /* + * PSU Indicators + * + * Green - Good + * Amber - Present but failed/unplugged + * Off - Missing + * + */ + onlp_psu_info_t pi; + + /* PSU1 */ + mode = ONLP_LED_MODE_GREEN; + if(onlp_psui_info_get(ONLP_PSU_ID_CREATE(1), &pi) < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if( (pi.status & 0x1) == 0) { + /* Not present */ + mode = ONLP_LED_MODE_OFF; + } + else if(pi.status & ONLP_PSU_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + else if(pi.status & ONLP_PSU_STATUS_UNPLUGGED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(LED_PSU_1, mode); + + /* PSU2 */ + mode = ONLP_LED_MODE_GREEN; + if(onlp_psui_info_get(ONLP_PSU_ID_CREATE(2), &pi) < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if( (pi.status & 0x1) == 0) { + /* Not present */ + mode = ONLP_LED_MODE_OFF; + } + else if(pi.status & ONLP_PSU_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + else if(pi.status & ONLP_PSU_STATUS_UNPLUGGED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(LED_PSU_2, mode); + + return ONLP_STATUS_OK; +} diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..8e3fe96b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,293 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include "powerpc_accton_as4600_54t_log.h" +#include "platform_lib.h" + +/*-- i2c --*/ +/* slave address */ +#define I2C_SLAVE_ADDR_ADT7473 0x2E +#define I2C_SLAVE_ADDR_PCA9548 0x70 +#define I2C_SLAVE_ADDR_LMP75 0x49 +#define I2C_SLAVE_ADDR_PSU_1_PMBUS 0x1A +#define I2C_SLAVE_ADDR_PSU_2_PMBUS 0x19 + +#define I2C_PCA9548_PORT_7_BIT_MASK 0x80 + +/* chip register */ +#define I2C_THERMAL_1_REG_ADT7473_LOCAL 0x26 +#define I2C_THERMAL_2_REG_ADT7473_REMOTE_1 0x25 +#define I2C_THERMAL_REG_ADT7473_CONFIGURE_REG_5 0x7C +#define I2C_THERMAL_REG_ADT7473_EXTENDED_RESOLUTION_1 0x76 +#define I2C_THERMAL_REG_ADT7473_EXTENDED_RESOLUTION_2 0x77 +#define I2C_THERMAL_REG_AC_PSU_CHICONY_TEMPERATURE 0x8D +#define I2C_THERMAL_REG_AC_PSU_CHICONY_STATUS 0x79 + +#define I2C_THERMAL_ADT7473_TEMPERATURE_FORMAT_BIT_MASK 0x1 +#define I2C_THERMAL_REG_AC_PSU_CHICONY_STATUS_BIT_MASK (1<<2) + +#define THERMAL_ADT7473_EXT_RESOLUTION_BIT_MASK 0x3 /* capture 2 bit values*/ +#define THERMAL_1_ADT7473_EXT_RESOLUTION_SHIFT 4 /* bit 5:4 */ +#define THERMAL_2_ADT7473_EXT_RESOLUTION_SHIFT 2 /* bit 3:2 */ + +#define THERMAL_LMP75_RESOLUTION_BIT_MASK 0x3 /* capture 2 bit values*/ +#define THERMAL_3_LMP75_RESOLUTION_SHIFT 6 /* bit 7:6 */ + +#define TEMPERATURE_MULTIPLIER 1000 +#define TEMPERATURE_EXT_RESOLUTION 250 /* resolution is 0.25C */ + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + /* There are two format for temperature data in the chip ADT7473. + * The offset 64 format. The range of temperature is -64C ~ 191C. (Default) + * The two's complement format. The range of temperature is -128C ~ 127C. + * Due to the temperature range of TMP75 is -128C ~ 127C, we change the format of ADT7473 to two's complement format. + */ + unsigned int bus_id = 1; + unsigned char i2c_addr = 0, i2c_port=0, temp_format=0; + int rc=0; + + i2c_addr = I2C_SLAVE_ADDR_ADT7473; + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_REG_ADT7473_CONFIGURE_REG_5, 1, &temp_format); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + temp_format |= I2C_THERMAL_ADT7473_TEMPERATURE_FORMAT_BIT_MASK; + rc = I2C_nWrite(bus_id, i2c_addr, I2C_THERMAL_REG_ADT7473_CONFIGURE_REG_5, 1, &temp_format); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + /* Open the I2C 0 channel 7 for LMP75. + */ + bus_id = 0; + i2c_addr = I2C_SLAVE_ADDR_PCA9548; + i2c_port = (unsigned char)I2C_PCA9548_PORT_7_BIT_MASK; + + /* enable channel 7*/ + rc = I2C_nWrite(bus_id, i2c_addr, 0, 1, &i2c_port); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + /* wait for system config. + */ + sleep(1); + + return ONLP_STATUS_OK; +} + + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv) +{ + /* Static values */ + onlp_thermal_info_t info[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal Sensor 1 (Nearby FAN 2)", 0}, 0x0, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal Sensor 2 (CPU)", 0}, 0x0, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(3), "Chassis Thermal Sensor 3 (Nearby BCM MAC(56540) chip)", 0}, 0x0, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(4), "PSU-1 Thermal Sensor 1", 0}, 0x0, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(5), "PSU-2 Thermal Sensor 1", 0}, 0x0, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 } + }; + unsigned int bus_id = 1,tid = ONLP_OID_ID_GET(id); + unsigned char i2c_addr, temp, temp_ext2, data[2]={0}; + unsigned short psu_temp=0; + int fractional_part=0, integer_part=0; + int rc=0; + + *rv = info[ONLP_OID_ID_GET(id)]; + + switch (tid) + { + case 1: /* thermal sensor 1*/ + case 2: + /* update the present. (always present.) + */ + rv->status |= ONLP_THERMAL_STATUS_PRESENT; + + /* Get the information from I2C + */ + i2c_addr = I2C_SLAVE_ADDR_ADT7473; + + /* Get the temperature. + */ + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_REG_ADT7473_EXTENDED_RESOLUTION_2, 1, &temp_ext2); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ( tid == 1) + { + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_1_REG_ADT7473_LOCAL, 1, &temp); + if(0 != rc) + { + return ONLP_STATUS_E_INVALID; + } + + fractional_part = (temp_ext2 >> THERMAL_1_ADT7473_EXT_RESOLUTION_SHIFT) & THERMAL_ADT7473_EXT_RESOLUTION_BIT_MASK; + } + else + { + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_2_REG_ADT7473_REMOTE_1, 1, &temp); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + fractional_part = (temp_ext2 >> THERMAL_2_ADT7473_EXT_RESOLUTION_SHIFT) & THERMAL_ADT7473_EXT_RESOLUTION_BIT_MASK; + } + /* update the temperature + */ + integer_part = two_complement_to_int((unsigned short)temp, 8, 0xff); + rv->mcelsius = (integer_part * TEMPERATURE_MULTIPLIER) + (fractional_part * TEMPERATURE_EXT_RESOLUTION); + + /* update status + * Datasheet: temperature reading of -128 C (0x80) indicates a diode fault (open or short) on that channel. + */ + if (temp == 0x80) + { + rv->status |= ONLP_THERMAL_STATUS_FAILED; + } + else + { + rv->status &= ~ONLP_THERMAL_STATUS_FAILED; + } + break; + + case 3: + rv->status |= ONLP_THERMAL_STATUS_PRESENT; + + /* + * Open the I2C 0 channel 7 for LMP75. + */ + bus_id = 0; + i2c_addr = I2C_SLAVE_ADDR_PCA9548; + unsigned char i2c_port = (unsigned char)I2C_PCA9548_PORT_7_BIT_MASK; + + /* enable channel 7 */ + rc = I2C_nWrite(bus_id, i2c_addr, 0, 1, &i2c_port); + if(0 != rc) { + return ONLP_STATUS_E_INTERNAL; + } + + /* + * Get the information from I2C + */ + bus_id = 0; + i2c_addr = I2C_SLAVE_ADDR_LMP75; + + /* read 2 bytes + */ + rc = I2C_nRead(bus_id, i2c_addr, 0, 2, data); + + /* update the temperature + */ + temp = data[0]; + fractional_part = (data[1] >> THERMAL_3_LMP75_RESOLUTION_SHIFT) & THERMAL_LMP75_RESOLUTION_BIT_MASK; + + integer_part = two_complement_to_int((unsigned short)temp, 8, 0xff); + rv->mcelsius = (integer_part * TEMPERATURE_MULTIPLIER) + (fractional_part * TEMPERATURE_EXT_RESOLUTION); + + /* This chip does not support status, we can't verify the fail case. + */ + + break; + + case 4: /* PSU 1 */ + case 5: /* PSU 2 */ + rv->status |= ONLP_THERMAL_STATUS_PRESENT; /* always present. */ + + /* Get the information from I2C + */ + bus_id = 1; + if (tid == 4) + { + i2c_addr = I2C_SLAVE_ADDR_PSU_1_PMBUS; + } + else + { + i2c_addr = I2C_SLAVE_ADDR_PSU_2_PMBUS; + } + + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_REG_AC_PSU_CHICONY_TEMPERATURE, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + /* update the temperature + */ + psu_temp = (data[1] << 8) + data[0]; + rv->mcelsius = parse_literal_format(psu_temp, TEMPERATURE_MULTIPLIER); + + rc = I2C_nRead(bus_id, i2c_addr, I2C_THERMAL_REG_AC_PSU_CHICONY_STATUS, 2, data); + if(0 != rc) + { + return ONLP_STATUS_E_INTERNAL; + } + + /* update status + */ + if ((data[0] & I2C_THERMAL_REG_AC_PSU_CHICONY_STATUS_BIT_MASK) == I2C_THERMAL_REG_AC_PSU_CHICONY_STATUS_BIT_MASK) + { + rv->status |= ONLP_THERMAL_STATUS_FAILED; + } + else + { + rv->status &= ~ONLP_THERMAL_STATUS_FAILED; + } + + break; + + default: + break; + } + + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/Makefile b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/PKG.yml b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/PKG.yml new file mode 100644 index 00000000..b7d6c707 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as4600-54t-r0 diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/info b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/info new file mode 100644 index 00000000..5033d297 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/info @@ -0,0 +1,18 @@ +** Package Group: /home/jeff/ws/branches/ONL-NEXT-GEN/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/PKG.yml +packages: +- arch: powerpc + changelog: Changes + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + depends: onl-platform-config-accton + files: + src/lib: /lib/platform-config/powerpc-accton-as4600-54t-r0/onl + src/python: /usr/lib/python2.7/dist-packages/onl/platform/ + maintainer: support@bigswitch.com + name: onl-platform-config-powerpc-accton-as4600-54t-r0 + summary: ONL Platform Configuration Package for the powerpc-accton-as4600-54t-r0 + version: 1.0.0 +prerequisites: + packages: + - onl-vendor-config-accton:all + + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/boot/powerpc-accton-as4600-54t-r0 b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/boot/powerpc-accton-as4600-54t-r0 new file mode 100644 index 00000000..395fe8e9 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/boot/powerpc-accton-as4600-54t-r0 @@ -0,0 +1,11 @@ +############################################################ +# powerpc-accton-as4600-54t-r0 +############################################################ + +echo "soc.0/ff725000.ethernet ma1" > /etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" >> /etc/fw_env.config +echo "/dev/mtd2 0x00000000 0x00010000 0x00010000" >> /etc/fw_env.config + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/install/powerpc-as4600-54t.sh b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/install/powerpc-as4600-54t.sh new file mode 100644 index 00000000..005a8266 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/install/powerpc-as4600-54t.sh @@ -0,0 +1,32 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +############################################################ +# +# Installer scriptlet for the powerpc-as4600-54t +# + +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; fatload usb 0:1 0x10000000 onl-loader; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-as4600-54t; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/powerpc-accton-as4600-54t-r0.yml b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/powerpc-accton-as4600-54t-r0.yml new file mode 100644 index 00000000..aa758dbe --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/lib/powerpc-accton-as4600-54t-r0.yml @@ -0,0 +1,5 @@ +powerpc-accton-as4600-54t-r0: + flat_image_tree: + kernel: onl-kernel-3.9.6-powerpc-e500v:powerpc, kernel-3.9.6-powerpc-e500v.bin.gz + dtb: onl-kernel-3.9.6-powerpc-e500v:powerpc, powerpc-as4600-54t.dtb + diff --git a/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/python/powerpc_accton_as4600_54t_r0/__init__.py b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/python/powerpc_accton_as4600_54t_r0/__init__.py new file mode 100644 index 00000000..b0f245e8 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as4600-54t/platform-config/r0/src/python/powerpc_accton_as4600_54t_r0/__init__.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +############################################################ +# +# +# +############################################################ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as4600_54t_r0(OnlPlatformAccton): + + def model(self): + return 'AS4600-54T' + + def platform(self): + return 'powerpc-accton-as4600-54t-r0' + + def sys_oid_platform(self): + return ".4600.54" + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/.gitignore b/packages/platforms/accton/powerpc-accton-as5610-52x/.gitignore new file mode 100644 index 00000000..53afc0f4 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-as5610-52x-r0.mk +onlpdump.mk +powerpc_accton_as5610_52x.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/PKG.yml b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/PKG.yml new file mode 100644 index 00000000..1bc8f9c4 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=powerpc-accton-as5610-52x-r0 ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/.gitignore b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/lib/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/lib/Makefile new file mode 100644 index 00000000..66aeecdb --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-as5610-52x-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_accton_as5610_52x onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-accton-as5610-52x-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..5b542b87 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp powerpc_accton_as5610_52x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/Makefile new file mode 100644 index 00000000..7e36df83 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_accton_as5610_52x +AUTOMODULE := powerpc_accton_as5610_52x +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..abdb3f8e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_accton_as5610_52x Autogeneration +# +############################################################################### +powerpc_accton_as5610_52x_AUTO_DEFS := module/auto/powerpc_accton_as5610_52x.yml +powerpc_accton_as5610_52x_AUTO_DIRS := module/inc/powerpc_accton_as5610_52x module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/powerpc_accton_as5610_52x.yml b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/powerpc_accton_as5610_52x.yml new file mode 100644 index 00000000..ae36490f --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/auto/powerpc_accton_as5610_52x.yml @@ -0,0 +1,47 @@ +############################################################################### +# +# powerpc_accton_as5610_52x Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB +- POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + POWERPC_ACCTON_AS5610_52X_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_accton_as5610_52x_config + + portingmacro: + POWERPC_ACCTON_AS5610_52X: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x.x b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x.x new file mode 100644 index 00000000..f6c45f03 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_config.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_config.h new file mode 100644 index 00000000..8f0f9859 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_config.h @@ -0,0 +1,127 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as5610_52x Configuration Header + * + * @addtogroup powerpc_accton_as5610_52x-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5610_52X_CONFIG_H__ +#define __POWERPC_ACCTON_AS5610_52X_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING +#define POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB +#define POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI +#define POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_accton_as5610_52x_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_accton_as5610_52x_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_accton_as5610_52x_config_settings table. */ +extern powerpc_accton_as5610_52x_config_settings_t powerpc_accton_as5610_52x_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_accton_as5610_52x_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_accton_as5610_52x_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_accton_as5610_52x_porting.h" + +#endif /* __POWERPC_ACCTON_AS5610_52X_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_dox.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_dox.h new file mode 100644 index 00000000..5cea1c04 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_accton_as5610_52x Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5610_52X_DOX_H__ +#define __POWERPC_ACCTON_AS5610_52X_DOX_H__ + +/** + * @defgroup powerpc_accton_as5610_52x powerpc_accton_as5610_52x - powerpc_accton_as5610_52x Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_accton_as5610_52x-powerpc_accton_as5610_52x Public Interface + * @defgroup powerpc_accton_as5610_52x-config Compile Time Configuration + * @defgroup powerpc_accton_as5610_52x-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_ACCTON_AS5610_52X_DOX_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h new file mode 100644 index 00000000..6ad1547d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as5610_52x Porting Macros. + * + * @addtogroup powerpc_accton_as5610_52x-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5610_52X_PORTING_H__ +#define __POWERPC_ACCTON_AS5610_52X_PORTING_H__ + + +/* */ +#if POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_MALLOC + #if defined(GLOBAL_MALLOC) + #define POWERPC_ACCTON_AS5610_52X_MALLOC GLOBAL_MALLOC + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_MALLOC malloc + #else + #error The macro POWERPC_ACCTON_AS5610_52X_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_FREE + #if defined(GLOBAL_FREE) + #define POWERPC_ACCTON_AS5610_52X_FREE GLOBAL_FREE + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_FREE free + #else + #error The macro POWERPC_ACCTON_AS5610_52X_FREE is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_ACCTON_AS5610_52X_MEMSET GLOBAL_MEMSET + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_MEMSET memset + #else + #error The macro POWERPC_ACCTON_AS5610_52X_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_ACCTON_AS5610_52X_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_MEMCPY memcpy + #else + #error The macro POWERPC_ACCTON_AS5610_52X_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_ACCTON_AS5610_52X_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_STRNCPY strncpy + #else + #error The macro POWERPC_ACCTON_AS5610_52X_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_ACCTON_AS5610_52X_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_ACCTON_AS5610_52X_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_ACCTON_AS5610_52X_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_SNPRINTF snprintf + #else + #error The macro POWERPC_ACCTON_AS5610_52X_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5610_52X_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_ACCTON_AS5610_52X_STRLEN GLOBAL_STRLEN + #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5610_52X_STRLEN strlen + #else + #error The macro POWERPC_ACCTON_AS5610_52X_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_ACCTON_AS5610_52X_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/make.mk b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..f86f984a --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_accton_as5610_52x_INCLUDES := -I $(THIS_DIR)inc +powerpc_accton_as5610_52x_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_accton_as5610_52x_DEPENDMODULE_ENTRIES := init:powerpc_accton_as5610_52x + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..54677722 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/fani.c @@ -0,0 +1,411 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +#include +#include +#include + +#include "platform_lib.h" +//#include "onlpie_int.h" + +/* PSU/FAN tatus register in CPLD + */ +#define CPLD_BASE_ADDRESS 0xEA000000 + +#define CPLD_REG_PSU1_STATUS 0x02 +#define CPLD_REG_PSU2_STATUS 0x01 +#define CPLD_REG_SYS_STATUS 0x03 +#define CPLD_PSU_PRESENT_MASK 0x01 +#define CPLD_PSU_POWER_GOOD_MASK 0x02 +#define CPLD_PSU_FAN_FAILURE_MASK 0x04 +#define CPLD_FAN_PRESENT_MASK 0x04 +#define CPLD_FAN_FAILURE_MASK 0x08 +#define CPLD_FAN_DIRECTION_MASK 0x10 +#define CPLD_FAN_SPEED_CTL_REG 0x0D + +#define I2C_PSU_BUS_ID 0 +#define I2C_PSU1_SLAVE_ADDR_CFG 0x3E +#define I2C_PSU1_SLAVE_ADDR_EEPROM 0x3A +#define I2C_PSU2_SLAVE_ADDR_CFG 0x3D +#define I2C_PSU2_SLAVE_ADDR_EEPROM 0x39 +#define I2C_PSU_FAN_SPEED_CTL_REG 0x3B +#define I2C_PSU_FAN_STATUS_REG 0x81 +#define I2C_PSU_FAN_FAILURE_MASK 0x80 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +typedef enum onlp_fan_id +{ + FAN_ID_CHASSIS = 1, + FAN_ID_PSU1, + FAN_ID_PSU2 +} onlp_fan_id_t; + +/* + * Private functions for fan controller + */ +static int +chassis_fan_cpld_val_to_duty_cycle(unsigned char reg_val) +{ + if (reg_val >= 0x1F) { + return 100; + } + + return (reg_val * 3.25); +} + +static int +chassis_fan_duty_cycle_to_cpld_val(int duty_cycle) +{ + if (duty_cycle >= 100) { + return 0x1F; + } + + return (duty_cycle / 3.25); +} + +static volatile uint8_t* cpld_base__ = NULL; + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +/* + * Get the fan information. + */ + +/* Static fan information */ +onlp_fan_info_t finfo[] = { + { }, /* Not used */ + { + { ONLP_FAN_ID_CREATE(FAN_ID_CHASSIS), "Chassis Fan 1", 0 }, + }, + { + { ONLP_FAN_ID_CREATE(FAN_ID_PSU1), "PSU-1 Fan 1", ONLP_PSU_ID_CREATE(1) }, + }, + { + { ONLP_FAN_ID_CREATE(FAN_ID_PSU2), "PSU-2 Fan 1", ONLP_PSU_ID_CREATE(2) }, + } +}; + +static int +chassis_fan_get_info(onlp_fan_info_t* info) +{ + unsigned char data; + info->status = 0; + + data = cpld_base__[CPLD_REG_SYS_STATUS]; + + /* Get the present bit */ + if ((~data) & CPLD_FAN_PRESENT_MASK) { + info->status |= ONLP_FAN_STATUS_PRESENT; + } + + /* Get the failure bit */ + if (data & CPLD_FAN_FAILURE_MASK) { + info->status |= ONLP_FAN_STATUS_FAILED; + } + + /* Get the airflow direction */ + info->status |= (data & CPLD_FAN_DIRECTION_MASK) ? ONLP_FAN_STATUS_F2B : + ONLP_FAN_STATUS_B2F ; + + /* Get the capabilities + */ + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE; + info->caps |= ONLP_FAN_CAPS_GET_PERCENTAGE; + info->caps |= (data & CPLD_FAN_DIRECTION_MASK) ? ONLP_FAN_CAPS_F2B : ONLP_FAN_CAPS_B2F; + + /* Get the percentage + */ + data = cpld_base__[CPLD_FAN_SPEED_CTL_REG]; + info->percentage = chassis_fan_cpld_val_to_duty_cycle(data); + + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_fan_info_get(onlp_fan_info_t* info) +{ + int idx = ONLP_OID_ID_GET(info->hdr.id) - 2; + unsigned char speed[2] = {0}; + unsigned char status = 0; + unsigned char mux_ch[] = {0x2, 0x4}; + unsigned char cfg_addr[] = {I2C_PSU1_SLAVE_ADDR_CFG, I2C_PSU2_SLAVE_ADDR_CFG}; + + info->mode = ONLP_FAN_MODE_INVALID; /* Set current mode */ + info->rpm = 0; /* Set rpm as 0 since the fan controller does not support rpm reading */ + + /* Get operating status + */ + if (as5610_52x_i2c0_pca9548_channel_set(mux_ch[idx]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + if (i2c_nRead(I2C_PSU_BUS_ID, cfg_addr[idx], I2C_PSU_FAN_STATUS_REG, sizeof(status), &status) != 0) { + as5610_52x_i2c0_pca9548_channel_set(0); + return ONLP_STATUS_E_INTERNAL; + } + + if (status & I2C_PSU_FAN_FAILURE_MASK) { + info->status |= ONLP_FAN_STATUS_FAILED; + } + + /* Get the percentage + */ + if (i2c_nRead(I2C_PSU_BUS_ID, cfg_addr[idx], I2C_PSU_FAN_SPEED_CTL_REG, sizeof(speed), speed) != 0) { + as5610_52x_i2c0_pca9548_channel_set(0); + return ONLP_STATUS_E_INTERNAL; + } + info->percentage = speed[0]; + + /* Close psu channel + */ + as5610_52x_i2c0_pca9548_channel_set(0); + + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_f2b_fan_info_get(onlp_fan_info_t* info) +{ + info->status = ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B; + info->caps = ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_F2B; + + return psu_cpr_4011_fan_info_get(info); +} + +static int +psu_cpr_4011_b2f_fan_info_get(onlp_fan_info_t* info) +{ + info->status = ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F; + info->caps = ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_B2F; + + return psu_cpr_4011_fan_info_get(info); +} + +static int +psu_um400d_fan_info_get(onlp_fan_info_t* info) +{ + unsigned char cpld_offset, data; + + info->mode = ONLP_FAN_MODE_INVALID; /* Set current mode */ + info->rpm = 0; /* Set rpm as 0 since the fan controller does not support rpm reading */ + info->percentage = 0; + + /* Get operating status + */ + if (FAN_ID_PSU1 == ONLP_OID_ID_GET(info->hdr.id)) { + cpld_offset = CPLD_REG_PSU1_STATUS; + } + else { /* FAN_ID_PSU2 */ + cpld_offset = CPLD_REG_PSU2_STATUS; + } + + data = cpld_base__[cpld_offset]; + + if (!(data & CPLD_PSU_FAN_FAILURE_MASK)) { + info->status |= ONLP_FAN_STATUS_FAILED; + } + + return ONLP_STATUS_OK; +} + +static int +psu_um400d_f2b_fan_info_get(onlp_fan_info_t* info) +{ + info->status = ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B; + info->caps = ONLP_FAN_CAPS_F2B; + + return psu_um400d_fan_info_get(info); +} + +static int +psu_um400d_b2f_fan_info_get(onlp_fan_info_t* info) +{ + info->status = ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F; + info->caps = ONLP_FAN_CAPS_B2F; + + return psu_um400d_fan_info_get(info); +} + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + VALIDATE(id); + + *info = finfo[ONLP_OID_ID_GET(id)]; /* Set the onlp_oid_hdr_t */ + ONLP_OID_TABLE_CLEAR(info->hdr.coids); + + if (ONLP_OID_ID_GET(id) == FAN_ID_CHASSIS) { + return chassis_fan_get_info(info); + } + else { + int psu_id = ONLP_OID_ID_GET(id)-1; + as5610_52x_psu_type_t psu_type = as5610_52x_get_psu_type(psu_id, NULL, 0); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + return psu_cpr_4011_f2b_fan_info_get(info); + case PSU_TYPE_AC_B2F: + return psu_cpr_4011_b2f_fan_info_get(info); + case PSU_TYPE_DC_48V_F2B: + return psu_um400d_f2b_fan_info_get(info); + case PSU_TYPE_DC_48V_B2F: + return psu_um400d_b2f_fan_info_get(info); + default: + break; + } + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +static int +onlp_chassis_fan_percentage_set(int p) +{ + cpld_base__[CPLD_FAN_SPEED_CTL_REG] = chassis_fan_duty_cycle_to_cpld_val(p); + + return ONLP_STATUS_OK; +} + +static int +onlp_psu_cpr_4011_fan_percentage_set(onlp_oid_t id, int p) +{ + int i = ONLP_OID_ID_GET(id) - 2; + unsigned char mux_ch[] = {0x2, 0x4}; + unsigned char cfg_addr[] = {I2C_PSU1_SLAVE_ADDR_CFG, I2C_PSU2_SLAVE_ADDR_CFG}; + unsigned char speed[2] = {(unsigned char)p, 0}; + VALIDATE(id); + + if (as5610_52x_i2c0_pca9548_channel_set(mux_ch[i]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + if (i2c_nWrite(I2C_PSU_BUS_ID, cfg_addr[i], I2C_PSU_FAN_SPEED_CTL_REG, sizeof(speed), speed) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + VALIDATE(id); + + if (ONLP_OID_ID_GET(id) == FAN_ID_CHASSIS) { + return onlp_chassis_fan_percentage_set(p); + } + else if ((ONLP_OID_ID_GET(id) == FAN_ID_PSU1) || (ONLP_OID_ID_GET(id) == FAN_ID_PSU2)) { + as5610_52x_psu_type_t psu_type = as5610_52x_get_psu_type(ONLP_OID_ID_GET(id), NULL, 0); + + if (PSU_TYPE_AC_F2B == psu_type || PSU_TYPE_AC_B2F == psu_type) { + return onlp_psu_cpr_4011_fan_percentage_set(id, p); + } + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..353a5dd4 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,277 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ***********************************************************/ +#include +#include +#include +#include + +#include + +//#include "onlpie_int.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ +#define CPLD_BASE_ADDRESS 0xEA000000 + +#define CPLD_LED_PSU1_REG_MASK 0x03 +#define CPLD_LED_PSU1_GREEN 0x02 +#define CPLD_LED_PSU1_AMBER 0x01 +#define CPLD_LED_PSU1_OFF 0x03 + +#define CPLD_LED_PSU2_REG_MASK 0x0C +#define CPLD_LED_PSU2_GREEN 0x08 +#define CPLD_LED_PSU2_AMBER 0x04 +#define CPLD_LED_PSU2_OFF 0x0C + +#define CPLD_LED_DIAG_REG_MASK 0x30 +#define CPLD_LED_DIAG_GREEN 0x20 +#define CPLD_LED_DIAG_AMBER 0x10 +#define CPLD_LED_DIAG_OFF 0x00 + +#define CPLD_LED_FAN_REG_MASK 0xC0 +#define CPLD_LED_FAN_GREEN 0x40 +#define CPLD_LED_FAN_AMBER 0x80 +#define CPLD_LED_FAN_OFF 0xC0 + +#define CPLD_LED_LOC_REG_MASK 0x03 +#define CPLD_LED_LOC_OFF 0x01 +#define CPLD_LED_LOC_BLINK 0x03 + +typedef enum onlp_led_id +{ + LED_DIAG = 1, + LED_FAN, + LED_LOC, + LED_PSU1, + LED_PSU2 +} onlp_led_id_t; + +typedef struct onlp_led_cpld +{ + onlp_led_id_t lid; + unsigned char cpld_offset; + unsigned char cpld_mask; + unsigned char cpld_val; /* The CPLD mask for the given mode*/ + onlp_led_mode_t mode; +} onlp_led_cpld_t; + +const onlp_led_cpld_t led_data[] = { +{LED_PSU1, 0x13, CPLD_LED_PSU1_REG_MASK, CPLD_LED_PSU1_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU1, 0x13, CPLD_LED_PSU1_REG_MASK, CPLD_LED_PSU1_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU1, 0x13, CPLD_LED_PSU1_REG_MASK, CPLD_LED_PSU1_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_PSU2, 0x13, CPLD_LED_PSU2_REG_MASK, CPLD_LED_PSU2_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU2, 0x13, CPLD_LED_PSU2_REG_MASK, CPLD_LED_PSU2_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU2, 0x13, CPLD_LED_PSU2_REG_MASK, CPLD_LED_PSU2_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_DIAG, 0x13, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_OFF, ONLP_LED_MODE_OFF}, +{LED_DIAG, 0x13, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_GREEN, ONLP_LED_MODE_GREEN}, +{LED_DIAG, 0x13, CPLD_LED_DIAG_REG_MASK, CPLD_LED_DIAG_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_FAN, 0x13, CPLD_LED_FAN_REG_MASK, CPLD_LED_FAN_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN, 0x13, CPLD_LED_FAN_REG_MASK, CPLD_LED_FAN_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN, 0x13, CPLD_LED_FAN_REG_MASK, CPLD_LED_FAN_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_LOC, 0x15, CPLD_LED_LOC_REG_MASK, CPLD_LED_LOC_OFF, ONLP_LED_MODE_OFF}, +{LED_LOC, 0x15, CPLD_LED_LOC_REG_MASK, CPLD_LED_LOC_BLINK, ONLP_LED_MODE_ORANGE_BLINKING} +}; + +static int +onlp_led_cpld_val_to_light_mode(enum onlp_led_id lid, unsigned char reg_val) +{ + int i; + + for (i = 0; i < AIM_ARRAYSIZE(led_data); i++) { + if (lid != led_data[i].lid) { + continue; + } + + if ((led_data[i].cpld_mask & reg_val) == led_data[i].cpld_val) { + return led_data[i].mode; + } + } + + return ONLP_LED_MODE_OFF; +} + +static unsigned char +onlp_led_light_mode_to_cpld_val(onlp_led_id_t lid, onlp_led_mode_t mode, unsigned char orig_val) +{ + int i; + + for (i = 0; i < AIM_ARRAYSIZE(led_data); i++) { + if (lid != led_data[i].lid || mode != led_data[i].mode) { + continue; + } + + orig_val = led_data[i].cpld_val | (orig_val & (~led_data[i].cpld_mask)); + } + + return orig_val; +} + +static volatile uint8_t* cpld_base__ = NULL; + +/* + * This function will be called prior to any other onlp_ledi_* functions. + */ +int +onlp_ledi_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_DIAG), ONLP_LED_MODE_GREEN); + return ONLP_STATUS_OK; +} + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = +{ + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis DIAG LED", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN), "Chassis FAN LED", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_LOC), "Chassis Locator LED", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE_BLINKING, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis PSU1 LED", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis PSU2 LED", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, +}; + +int +onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int i; + unsigned char data = 0, reg = 0; + VALIDATE(id); + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[ONLP_OID_ID_GET(id)]; + + /* Set current mode */ + for (i = 0; i < AIM_ARRAYSIZE(led_data); i++) { + if (ONLP_OID_ID_GET(id) != led_data[i].lid) { + continue; + } + + reg = led_data[i].cpld_offset; + break; + } + + data = cpld_base__[reg]; + info->mode = onlp_led_cpld_val_to_light_mode(ONLP_OID_ID_GET(id), data); + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + VALIDATE(id); + + if (!on_or_off) { + return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int i = 0; + unsigned char data = 0, reg; + VALIDATE(id); + + for (i = 0; i < AIM_ARRAYSIZE(led_data); i++) { + if (ONLP_OID_ID_GET(id) != led_data[i].lid) { + continue; + } + + reg = led_data[i].cpld_offset; + break; + } + + data = cpld_base__[reg]; + cpld_base__[reg] = onlp_led_light_mode_to_cpld_val(ONLP_OID_ID_GET(id), mode, data); + + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..feee23d1 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +LIBRARY := powerpc_accton_as5610_52x +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..7816b3bb --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,537 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +#define CPLD_BASE_ADDRESS 0xEA000000 + +#define MAX_I2C_BUSSES 2 +#define I2C_BUFFER_MAXSIZE 16 + +#define PMBUS_LITERAL_DATA_MULTIPLIER 1000 + +static int mem_read(unsigned int base, unsigned int offset, unsigned char *val) +{ + int fd; + void* pMem; + + fd = open("/dev/mem", O_RDWR); + if (fd < 0) + { + printf("IO R/W: can't open /dev/mem.\n"); + return -1; + } + else + { + pMem = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, base); + + if (pMem == MAP_FAILED) + { + printf("IO R/W: can't get the address pointer (%s)\n", strerror(errno)); + close(fd); + return -1; + } + + *val = *((volatile unsigned char*)(pMem + offset)); + + if ( -1 == munmap(pMem, getpagesize() ) ) + printf("IO R/W: can't release the address pointer (%s)\n", strerror(errno)); + + close(fd); + } + + return 0; +} + +static int mem_write(unsigned int base, unsigned int offset, unsigned char val) +{ + int fd; + void* pMem; + + fd = open("/dev/mem", O_RDWR); + if (fd < 0) + { + printf("IO R/W: can't open /dev/mem.\n"); + return -1; + } + else + { + pMem = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,fd, base); + + if (pMem == MAP_FAILED) + { + printf("IO R/W: can't get the address pointer (%s)\n", strerror(errno)); + close(fd); + return -1; + } + + *((volatile unsigned char *)(pMem + offset)) = val; + + if ( -1 == munmap(pMem, getpagesize() ) ) + { + printf("IO R/W: can't release the address pointer (%s)\n", strerror(errno)); + } + + close(fd); + + return 0; + } +} + +int cpld_read(unsigned int regOffset, unsigned char *val) +{ + return mem_read((unsigned int)CPLD_BASE_ADDRESS, regOffset, val); +} + +int cpld_write(unsigned int regOffset, unsigned char val) +{ + return mem_write((unsigned int)CPLD_BASE_ADDRESS, regOffset, val); +} + +int i2c_write(unsigned int bus_id, unsigned char i2c_addr, + unsigned char offset, unsigned char *buf) +{ + static char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + int i2c_fd; + int ret = 0; + unsigned int len = 1; + char fname[15]; + + if (bus_id >= MAX_I2C_BUSSES) { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + i2c_fd = open(fname, O_RDWR); /* open device */ + if (i2c_fd < 0) { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + if (0 != ret) { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_SLAVE_FORCE, i2c_addr); + if (0 != ret) { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + /* write address: offset address */ + sendbuffer[0] = offset; + memcpy(sendbuffer+1, buf, len); + if ((ret = write (i2c_fd, sendbuffer, len + 1)) < 0) { + printf("%s(): failed to write i2c_fd(%d) \n", __FUNCTION__, i2c_fd); + close(i2c_fd); + return 1; + } + + close(i2c_fd); + return 0; +} + +int i2c_read(unsigned int bus_id, unsigned char i2c_addr, + unsigned char offset, unsigned char *buf) +{ + static char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + char fname[15]; + int i2c_fd = -1; + int ret = 0; + + if (bus_id >= MAX_I2C_BUSSES) { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + sendbuffer[0] = offset; + i2c_fd = open(fname, O_RDWR); /* open device */ + if (i2c_fd < 0) { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + if (0 != ret) { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_SLAVE_FORCE, i2c_addr); + if (0 != ret) { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + /* write data address: offset address */ + if ((ret = write(i2c_fd, sendbuffer, 1)) !=1 ) { + printf("%s(): failed to write data_adr=0x%x\n", __FUNCTION__, offset); + close(i2c_fd); + return 1; + } + + /* read data */ + if ((ret = read(i2c_fd, buf, 1)) < 0) { + printf("%s(): failed to read \n", __FUNCTION__); + close(i2c_fd); + return 1; + } + + close(i2c_fd); + return 0; +} + +/* FUNCTION NAME : i2c_nRead + * PURPOSE : This function read the i2c slave device data + * INPUT : file,data_adr and count + * OUTPUT : buf + * RETUEN : I2C_SUCCESS/I2C_ERROR + * NOTES : + */ +int i2c_nRead +(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf) +{ + static unsigned char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + char fname[15]; + int i2c_fd = -1; + int ret = 0; + + if (bus_id >= MAX_I2C_BUSSES) + { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + i2c_fd = open(fname, O_RDWR); /* open device */ + + if (i2c_fd < 0) + { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_SLAVE_FORCE, i2c_addr); + + if (0 != ret) + { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + /* Returns the number of read bytes */ + /*s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, u8 command, + u8 length, u8 *values)*/ + if(i2c_smbus_read_i2c_block_data(i2c_fd, offset, size, sendbuffer) == -1) + { + //printf("%s(): failed to i2c_smbus_read_i2c_block_data(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + memcpy(buf, sendbuffer, size); + + close(i2c_fd); + return 0; + +} + +/* FUNCTION NAME : i2c_nWrite + * PURPOSE : This function write the data to I2C devices ! + * INPUT : i2c_fd,data_adr ,buf and count + * OUTPUT : + * RETUEN : ret/I2C_ERROR + * NOTES : + */ +int +i2c_nWriteForce(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf, int force) +{ + static unsigned char sendbuffer[I2C_BUFFER_MAXSIZE + 1]; + int i2c_fd; + int ret = 0; + char fname[15]; + + if (bus_id >= MAX_I2C_BUSSES) + { + printf("%s(): bus(%d) \n", __FUNCTION__, bus_id); + return 1; + } + + sprintf(fname, "/dev/i2c-%d", bus_id); + + i2c_fd = open(fname, O_RDWR); /* open device */ + + if (i2c_fd < 0) + { + printf("%s(): failed to open %s \n", __FUNCTION__, fname); + return 1; + } + + ret = ioctl(i2c_fd, I2C_TENBIT, 0);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set 7 bit mode %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, I2C_PEC, 1);/* set i2c 7bit mode */ + + if (0 != ret) + { + printf("%s(): failed to set PEC %s \n", __FUNCTION__, fname); + close(i2c_fd); + return 1; + } + + ret = ioctl(i2c_fd, force ? I2C_SLAVE_FORCE : I2C_SLAVE, i2c_addr); + + if (0 != ret) + { + printf("%s(): failed to ioctl(%s=0x%x)\n", __FUNCTION__, + force ? "I2C_SLAVE_FORCE" : "I2C_SLAVE", i2c_addr); + close(i2c_fd); + return 1; + } + + /* write address: offset address */ + memcpy(sendbuffer, buf, size); + + if(i2c_smbus_write_i2c_block_data(i2c_fd, offset, size, sendbuffer) == -1) + { + printf("%s(): failed to ioctl(I2C_SLAVE=0x%x)\n", __FUNCTION__, i2c_addr); + close(i2c_fd); + return 1; + } + + close(i2c_fd); + + return 0; +} + +int +i2c_nWrite(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf) +{ + /* Default writes are unforced. */ + return i2c_nWriteForce(bus_id, i2c_addr, offset, size, buf, 0); +} + + +int two_complement_to_int(unsigned short data, unsigned char valid_bit, unsigned short mask) +{ + unsigned short valid_data = data & mask; + int is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +int +pmbus_parse_literal_format(unsigned short val) +{ + int exponent, mantissa; + + exponent = two_complement_to_int(val >> 11, 5, 0x1f); + mantissa = two_complement_to_int(val & 0x7ff, 11, 0x7ff); + + if (exponent >= 0) { + return (mantissa << exponent) * PMBUS_LITERAL_DATA_MULTIPLIER; + } + else { + return (mantissa * PMBUS_LITERAL_DATA_MULTIPLIER) / (1 << -exponent); + } +} + +int +pmbus_read_literal_data(unsigned char bus, unsigned char i2c_addr, unsigned char reg, int *val) +{ + unsigned char buf[2] = {0}; + *val = 0; + + if (i2c_nRead(bus, i2c_addr, reg, sizeof(buf), buf) != 0) { + printf("%s(%d): Failed to read literal data reg(0x%x)\r\n", __FUNCTION__, __LINE__, reg); + return -1; + } + + *val = pmbus_parse_literal_format((unsigned char)buf[1] << 8 | buf[0]); + + return 0; +} + +int +pmbus_parse_vout_format(unsigned char vout_mode, unsigned short val) +{ + int exponent, mantissa; + + exponent = two_complement_to_int(vout_mode, 5, 0x1f); + mantissa = val; + + if (exponent >= 0) { + return (mantissa << exponent) * PMBUS_LITERAL_DATA_MULTIPLIER; + } + else { + return (mantissa * PMBUS_LITERAL_DATA_MULTIPLIER) / (1 << -exponent); + } +} + +int +pmbus_read_vout_data(unsigned char bus, unsigned char i2c_addr, int *val) +{ + unsigned char vout_mode = 0; + unsigned char vout_val[2] = {0}; + *val = 0; + + /* Read VOUT_MODE first */ + if (i2c_nRead(bus, i2c_addr, 0x20, sizeof(vout_mode), &vout_mode) != 0) { + printf("%s(%d): Failed to read vout data reg(0x20)\r\n", __FUNCTION__, __LINE__); + return -1; + } + + /* Read VOUT */ + if (i2c_nRead(bus, i2c_addr, 0x8B, sizeof(vout_val), vout_val) != 0) { + printf("%s(%d): Failed to read vout data reg(0x8B)\r\n", __FUNCTION__, __LINE__); + return -1; + } + + *val = pmbus_parse_vout_format(vout_mode, vout_val[1] << 8 | vout_val[0]); + + return 0; +} + +int int_to_pmbus_linear(int val) +{ + int mantissa = val, exponent = 0; + + while (1) + { + if (mantissa < 1024) + break; + + exponent++; + mantissa >>= 1; + } + return (exponent << 11) | mantissa; +} + + +int as5610_52x_i2c0_pca9548_channel_set(unsigned char channel) +{ + /* + * The RTC lives on Channel0 of the PCA9548 and is also accessed by the kernel RTC driver. + * It has the PCA9548 reserved, which requires us to force the slave address programming. + * The PCA9548 kernel driver always rewrites the channel selector when accessing it. + * + * This is fine for the first production version but will need to be revisited. + */ + return i2c_nWriteForce(0, 0x70, 0x0, sizeof(channel), &channel, 1); +} + +#define I2C_PSU_BUS_ID 0 +#define I2C_PSU_MODEL_NAME_LEN 13 +#define I2C_AC_PSU1_SLAVE_ADDR_EEPROM 0x3A +#define I2C_AC_PSU2_SLAVE_ADDR_EEPROM 0x39 +#define I2C_DC_PSU1_SLAVE_ADDR_EEPROM 0x56 +#define I2C_DC_PSU2_SLAVE_ADDR_EEPROM 0x55 +#define I2C_CPR_4011_MODEL_NAME_REG 0x26 +#define I2C_UM400D_MODEL_NAME_REG 0x50 + +as5610_52x_psu_type_t as5610_52x_get_psu_type(int id, char* modelname, int modelname_len) +{ + as5610_52x_psu_type_t ret = PSU_TYPE_UNKNOWN; + unsigned char mux_ch[] = {0x2, 0x4}; + char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; + unsigned char ac_eeprom_addr[] = {I2C_AC_PSU1_SLAVE_ADDR_EEPROM, I2C_AC_PSU2_SLAVE_ADDR_EEPROM}; + unsigned char dc_eeprom_addr[] = {I2C_DC_PSU1_SLAVE_ADDR_EEPROM, I2C_DC_PSU2_SLAVE_ADDR_EEPROM}; + + /* Open channel to read eeprom of PSU + */ + if (as5610_52x_i2c0_pca9548_channel_set(mux_ch[id-1]) != 0) { + return PSU_TYPE_UNKNOWN; + } + + /* Get model name from eeprom to see if it is AC or DC power + */ + if (i2c_nRead(I2C_PSU_BUS_ID, ac_eeprom_addr[id-1], I2C_CPR_4011_MODEL_NAME_REG, + I2C_PSU_MODEL_NAME_LEN, (unsigned char*)model_name) == 0) + { + model_name[I2C_PSU_MODEL_NAME_LEN] = '\0'; + + if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { + ret = PSU_TYPE_AC_F2B; + } + else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { + ret = PSU_TYPE_AC_B2F; + } + } + else if (i2c_nRead(I2C_PSU_BUS_ID, dc_eeprom_addr[id-1], I2C_UM400D_MODEL_NAME_REG, + I2C_PSU_MODEL_NAME_LEN, (unsigned char*)model_name) == 0) + { + model_name[I2C_PSU_MODEL_NAME_LEN] = '\0'; + + if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { + ret = PSU_TYPE_DC_48V_B2F; + } + else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { + ret = PSU_TYPE_DC_48V_F2B; + } + } + + /* Close psu channel + */ + as5610_52x_i2c0_pca9548_channel_set(0); + + if(modelname) { + /* Return the model name in the given buffer */ + strncpy(modelname, model_name, modelname_len-1); + } + + return ret; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..00222c62 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,66 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +int cpld_read(unsigned int regOffset, unsigned char *val); + +int cpld_write(unsigned int regOffset, unsigned char val); + +int i2c_write(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned char *buf); + +int i2c_read(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned char *buf); + +int i2c_nRead(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf); + +int i2c_nWrite(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf); +int i2c_nWriteForce(unsigned int bus_id, unsigned char i2c_addr, unsigned char offset, unsigned int size, unsigned char * buf, int force); + +int two_complement_to_int(unsigned short data, unsigned char valid_bit, unsigned short mask); + +int pmbus_parse_literal_format(unsigned short val); + +int pmbus_read_literal_data(unsigned char bus, unsigned char i2c_addr, unsigned char reg, int *val); + +int pmbus_parse_vout_format(unsigned char vout_mode, unsigned short val); + +int pmbus_read_vout_data(unsigned char bus, unsigned char i2c_addr, int *val); + +int int_to_pmbus_linear(int val); + +int as5610_52x_i2c0_pca9548_channel_set(unsigned char channel); + +typedef enum as5610_52x_psu_type { + PSU_TYPE_UNKNOWN, + PSU_TYPE_AC_F2B, + PSU_TYPE_AC_B2F, + PSU_TYPE_DC_48V_F2B, + PSU_TYPE_DC_48V_B2F +} as5610_52x_psu_type_t; + +as5610_52x_psu_type_t as5610_52x_get_psu_type(int id, char* modelname, int size); + +#endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_config.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_config.c new file mode 100644 index 00000000..2bd453da --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_config.c @@ -0,0 +1,76 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(_x) __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(_x) +powerpc_accton_as5610_52x_config_settings_t powerpc_accton_as5610_52x_config_settings[] = +{ +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_LOGGING(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI + { __powerpc_accton_as5610_52x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI), __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_ACCTON_AS5610_52X_CONFIG_INCLUDE_UCLI(__powerpc_accton_as5610_52x_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_accton_as5610_52x_config_STRINGIFY_VALUE +#undef __powerpc_accton_as5610_52x_config_STRINGIFY_NAME + +const char* +powerpc_accton_as5610_52x_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_accton_as5610_52x_config_settings[i].name; i++) { + if(strcmp(powerpc_accton_as5610_52x_config_settings[i].name, setting)) { + return powerpc_accton_as5610_52x_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_accton_as5610_52x_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_accton_as5610_52x_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_accton_as5610_52x_config_settings[i].name, powerpc_accton_as5610_52x_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_enums.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_enums.c new file mode 100644 index 00000000..25e81bee --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_int.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_int.h new file mode 100644 index 00000000..a1f2ee18 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * powerpc_accton_as5610_52x Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5610_52X_INT_H__ +#define __POWERPC_ACCTON_AS5610_52X_INT_H__ + +#include + + +#endif /* __POWERPC_ACCTON_AS5610_52X_INT_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.c new file mode 100644 index 00000000..ea751dc0 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as5610_52x_log.h" +/* + * powerpc_accton_as5610_52x log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_ACCTON_AS5610_52X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.h b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.h new file mode 100644 index 00000000..b91d4593 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5610_52X_LOG_H__ +#define __POWERPC_ACCTON_AS5610_52X_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_accton_as5610_52x +#include + +#endif /* __POWERPC_ACCTON_AS5610_52X_LOG_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_module.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_module.c new file mode 100644 index 00000000..1a55a287 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/powerpc_accton_as5610_52x_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as5610_52x_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_ACCTON_AS5610_52X_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_accton_as5610_52x_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..09b26a5b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/psui.c @@ -0,0 +1,234 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include "powerpc_accton_as5610_52x_log.h" +#include "platform_lib.h" + +#define CPLD_BASE_ADDRESS 0xEA000000 + +/* PSU status register in CPLD + */ +#define CPLD_REG_PSU1_STATUS 0x2 +#define CPLD_REG_PSU2_STATUS 0x1 +#define CPLD_REG_SYS_STATUS 0x3 +#define CPLD_PSU_PRESENT_MASK 0x1 +#define CPLD_PSU_POWER_GOOD_MASK 0x2 + +/* i2c device info */ +#define I2C_PSU_BUS_ID 0 +#define I2C_AC_PSU1_SLAVE_ADDR_CFG 0x3E +#define I2C_AC_PSU2_SLAVE_ADDR_CFG 0x3D + +#define PSU_PMBUS_REG_READ_VIN 0x88 +#define PSU_PMBUS_REG_READ_VOUT 0x8B +#define PSU_PMBUS_REG_READ_IIN 0x89 +#define PSU_PMBUS_REG_READ_IOUT 0x8C +#define PSU_PMBUS_REG_READ_PIN 0x97 +#define PSU_PMBUS_REG_READ_POUT 0x96 +#define PSU_PMBUS_REG_VOUT_MODE 0x20 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static volatile uint8_t* cpld_base__ = NULL; + +int +onlp_psui_init(void) +{ + /* + * Map the CPLD address + */ + cpld_base__ = onlp_mmap(CPLD_BASE_ADDRESS, getpagesize(), __FILE__); + + if(cpld_base__ == NULL || cpld_base__ == MAP_FAILED) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +psu_cpr_4011_info_get(onlp_psu_info_t* info) +{ + int index = ONLP_OID_ID_GET(info->hdr.id); + unsigned char mux_ch[] = {0x2, 0x4}; + unsigned char cfg_addr[] = {I2C_AC_PSU1_SLAVE_ADDR_CFG, I2C_AC_PSU2_SLAVE_ADDR_CFG}; + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_AC; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + 1); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + 8); + + /* Open channel for PSU + */ + if (as5610_52x_i2c0_pca9548_channel_set(mux_ch[index-1]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Read voltage, current and power */ + if (pmbus_read_vout_data(I2C_PSU_BUS_ID, cfg_addr[index-1], &info->mvout) == 0) { + info->caps |= ONLP_PSU_CAPS_VOUT; + } + + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, cfg_addr[index-1], PSU_PMBUS_REG_READ_VIN, &info->mvin) == 0) { + info->caps |= ONLP_PSU_CAPS_VIN; + } + + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, cfg_addr[index-1], PSU_PMBUS_REG_READ_IOUT, &info->miout) == 0) { + info->caps |= ONLP_PSU_CAPS_IOUT; + } + + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, cfg_addr[index-1], PSU_PMBUS_REG_READ_IIN, &info->miin) == 0) { + info->caps |= ONLP_PSU_CAPS_IIN; + } + + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, cfg_addr[index-1], PSU_PMBUS_REG_READ_POUT, &info->mpout) == 0) { + info->caps |= ONLP_PSU_CAPS_POUT; + } + + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, cfg_addr[index-1], PSU_PMBUS_REG_READ_PIN, &info->mpin) == 0) { + info->caps |= ONLP_PSU_CAPS_PIN; + } + + /* Close psu channel + */ + if (as5610_52x_i2c0_pca9548_channel_set(0) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +psu_um400d_info_get(onlp_psu_info_t* info) +{ + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_DC48; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + 1); + + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = +{ + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(1), "PSU-1", 0 }, + }, + { + { ONLP_PSU_ID_CREATE(2), "PSU-2", 0 }, + } +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int ret = ONLP_STATUS_OK; + int index = ONLP_OID_ID_GET(id); + unsigned char cpld_offset, data; + as5610_52x_psu_type_t psu_type; + + VALIDATE(id); + + *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ + info->caps = 0; + info->mvout = 0; + info->mvin = 0; + info->miout = 0; + info->miin = 0; + info->mpout = 0; + info->mpin = 0; + ONLP_OID_TABLE_CLEAR(info->hdr.coids); + + /* Get the present state */ + cpld_offset = (index == 1) ? CPLD_REG_PSU1_STATUS: CPLD_REG_PSU2_STATUS; + data = cpld_base__[cpld_offset]; + + if (data & CPLD_PSU_PRESENT_MASK) { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + info->status |= ONLP_PSU_STATUS_PRESENT; + + /* Get power good status */ + if (!(data & CPLD_PSU_POWER_GOOD_MASK)) { + info->status |= ONLP_PSU_STATUS_FAILED; + } + + /* Get PSU type + */ + psu_type = as5610_52x_get_psu_type(index, info->model, sizeof(info->model)); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + case PSU_TYPE_AC_B2F: + ret = psu_cpr_4011_info_get(info); + break; + case PSU_TYPE_DC_48V_F2B: + case PSU_TYPE_DC_48V_B2F: + ret = psu_um400d_info_get(info); + break; + default: + ret = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return ret; +} + +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..11573775 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,4103 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include /* For O_RDWR && open */ +#include +#include +#include +#include + +#include "powerpc_accton_as5610_52x_log.h" +#include "platform_lib.h" + +#define MAX_I2C_BUSSES 2 +#define MAX_MUX_COUNT 2 +#define I2C_BUFFER_MAXSIZE 16 + +typedef struct mux_info { + unsigned char addr; + unsigned char ch; +} mux_info_t; + +typedef struct sfp_eeprom_hierarchy +{ + int port; + unsigned int bus; + mux_info_t mux[MAX_MUX_COUNT]; +} sfp_eeprom_hierarchy_t; + +#define SFP_IDPROM_ADDR 0x50 +#define SFP_DOM_ADDR 0x51 + +sfp_eeprom_hierarchy_t sfp_eeprom_data[] = { +{ 0, 1, { { 0x75, 0x1 }, { 0x74, 0x01} }}, +{ 1, 1, { { 0x75, 0x1 }, { 0x74, 0x02} }}, +{ 2, 1, { { 0x75, 0x1 }, { 0x74, 0x04} }}, +{ 3, 1, { { 0x75, 0x1 }, { 0x74, 0x08} }}, +{ 4, 1, { { 0x75, 0x1 }, { 0x74, 0x10} }}, +{ 5, 1, { { 0x75, 0x1 }, { 0x74, 0x20} }}, +{ 6, 1, { { 0x75, 0x1 }, { 0x74, 0x40} }}, +{ 7, 1, { { 0x75, 0x1 }, { 0x74, 0x80} }}, +{ 8, 1, { { 0x75, 0x2 }, { 0x74, 0x01} }}, +{ 9, 1, { { 0x75, 0x2 }, { 0x74, 0x02} }}, +{10, 1, { { 0x75, 0x2 }, { 0x74, 0x04} }}, +{11, 1, { { 0x75, 0x2 }, { 0x74, 0x08} }}, +{12, 1, { { 0x75, 0x2 }, { 0x74, 0x10} }}, +{13, 1, { { 0x75, 0x2 }, { 0x74, 0x20} }}, +{14, 1, { { 0x75, 0x2 }, { 0x74, 0x40} }}, +{15, 1, { { 0x75, 0x2 }, { 0x74, 0x80} }}, +{16, 1, { { 0x75, 0x4 }, { 0x74, 0x01} }}, +{17, 1, { { 0x75, 0x4 }, { 0x74, 0x02} }}, +{18, 1, { { 0x75, 0x4 }, { 0x74, 0x04} }}, +{19, 1, { { 0x75, 0x4 }, { 0x74, 0x08} }}, +{20, 1, { { 0x75, 0x4 }, { 0x74, 0x10} }}, +{21, 1, { { 0x75, 0x4 }, { 0x74, 0x20} }}, +{22, 1, { { 0x75, 0x4 }, { 0x74, 0x40} }}, +{23, 1, { { 0x75, 0x4 }, { 0x74, 0x80} }}, +{24, 1, { { 0x75, 0x8 }, { 0x74, 0x01} }}, +{25, 1, { { 0x75, 0x8 }, { 0x74, 0x02} }}, +{26, 1, { { 0x75, 0x8 }, { 0x74, 0x04} }}, +{27, 1, { { 0x75, 0x8 }, { 0x74, 0x08} }}, +{28, 1, { { 0x75, 0x8 }, { 0x74, 0x10} }}, +{29, 1, { { 0x75, 0x8 }, { 0x74, 0x20} }}, +{30, 1, { { 0x75, 0x8 }, { 0x74, 0x40} }}, +{31, 1, { { 0x75, 0x8 }, { 0x74, 0x80} }}, +{32, 1, { { 0x76, 0x1 }, { 0x74, 0x01} }}, +{33, 1, { { 0x76, 0x1 }, { 0x74, 0x02} }}, +{34, 1, { { 0x76, 0x1 }, { 0x74, 0x04} }}, +{35, 1, { { 0x76, 0x1 }, { 0x74, 0x08} }}, +{36, 1, { { 0x76, 0x1 }, { 0x74, 0x10} }}, +{37, 1, { { 0x76, 0x1 }, { 0x74, 0x20} }}, +{38, 1, { { 0x76, 0x1 }, { 0x74, 0x40} }}, +{39, 1, { { 0x76, 0x1 }, { 0x74, 0x80} }}, +{40, 1, { { 0x76, 0x2 }, { 0x74, 0x01} }}, +{41, 1, { { 0x76, 0x2 }, { 0x74, 0x02} }}, +{42, 1, { { 0x76, 0x2 }, { 0x74, 0x04} }}, +{43, 1, { { 0x76, 0x2 }, { 0x74, 0x08} }}, +{44, 1, { { 0x76, 0x2 }, { 0x74, 0x10} }}, +{45, 1, { { 0x76, 0x2 }, { 0x74, 0x20} }}, +{46, 1, { { 0x76, 0x2 }, { 0x74, 0x40} }}, +{47, 1, { { 0x76, 0x2 }, { 0x74, 0x80} }}, +{48, 1, { { 0x77, 0x1 }, { 0, 0} }}, +{49, 1, { { 0x77, 0x2 }, { 0, 0} }}, +{50, 1, { { 0x77, 0x4 }, { 0, 0} }}, +{51, 1, { { 0x77, 0x8 }, { 0, 0} }}, +}; + +typedef struct io_expander_info +{ + unsigned char addr; + unsigned char cfg_reg; + unsigned char status_reg; + unsigned char status_mask; +} io_expander_info_t; + +typedef struct sfp_io_expander_hierarchy +{ + int port; + unsigned int bus; + mux_info_t mux; + io_expander_info_t io_exp; +} sfp_io_expander_hierarchy_t; + +sfp_io_expander_hierarchy_t sfp_enable_data[] = { +{ 0, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x1}}, +{ 1, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x2}}, +{ 2, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x4}}, +{ 3, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x8}}, +{ 4, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x10}}, +{ 5, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x20}}, +{ 6, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x40}}, +{ 7, 1, {0x76, 0x8}, {0x24, 0x18, 0x0, 0x80}}, +{ 8, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x1}}, +{ 9, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x2}}, +{10, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x4}}, +{11, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x8}}, +{12, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x10}}, +{13, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x20}}, +{14, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x40}}, +{15, 1, {0x76, 0x8}, {0x24, 0x19, 0x1, 0x80}}, +{16, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x1}}, +{17, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x2}}, +{18, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x4}}, +{19, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x8}}, +{20, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x10}}, +{21, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x20}}, +{22, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x40}}, +{23, 1, {0x76, 0x8}, {0x24, 0x1A, 0x2, 0x80}}, +{24, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x1}}, +{25, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x2}}, +{26, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x4}}, +{27, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x8}}, +{28, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x10}}, +{29, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x20}}, +{30, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x40}}, +{31, 1, {0x76, 0x8}, {0x24, 0x1B, 0x3, 0x80}}, +{32, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x1}}, +{33, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x2}}, +{34, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x4}}, +{35, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x8}}, +{36, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x10}}, +{37, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x20}}, +{38, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x40}}, +{39, 1, {0x76, 0x8}, {0x24, 0x1C, 0x4, 0x80}}, +{40, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x1}}, +{41, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x2}}, +{42, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x4}}, +{43, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x8}}, +{44, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x10}}, +{45, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x20}}, +{46, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x40}}, +{47, 1, {0x76, 0x8}, {0x23, 0x1C, 0x4, 0x80}} +}; + +sfp_io_expander_hierarchy_t sfp_txfail_data[] = { +{ 0, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x1}}, +{ 1, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x2}}, +{ 2, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x4}}, +{ 3, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x8}}, +{ 4, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x10}}, +{ 5, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x20}}, +{ 6, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x40}}, +{ 7, 1, {0x76, 0x8}, {0x21, 0x18, 0x0, 0x80}}, +{ 8, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x1}}, +{ 9, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x2}}, +{10, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x4}}, +{11, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x8}}, +{12, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x10}}, +{13, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x20}}, +{14, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x40}}, +{15, 1, {0x76, 0x8}, {0x21, 0x19, 0x1, 0x80}}, +{16, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x1}}, +{17, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x2}}, +{18, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x4}}, +{19, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x8}}, +{20, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x10}}, +{21, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x20}}, +{22, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x40}}, +{23, 1, {0x76, 0x8}, {0x21, 0x1A, 0x2, 0x80}}, +{24, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x1}}, +{25, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x2}}, +{26, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x4}}, +{27, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x8}}, +{28, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x10}}, +{29, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x20}}, +{30, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x40}}, +{31, 1, {0x76, 0x8}, {0x21, 0x1B, 0x3, 0x80}}, +{32, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x1}}, +{33, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x2}}, +{34, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x4}}, +{35, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x8}}, +{36, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x10}}, +{37, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x20}}, +{38, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x40}}, +{39, 1, {0x76, 0x8}, {0x21, 0x1C, 0x4, 0x80}}, +{40, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x1}}, +{41, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x2}}, +{42, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x4}}, +{43, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x8}}, +{44, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x10}}, +{45, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x20}}, +{46, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x40}}, +{47, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x80}} +/* 48-51 ports(QSFP) do not support TX fail, + * so we don't need to define the data here. + */ +}; + +sfp_io_expander_hierarchy_t sfp_rxloss_data[] = { +{ 0, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x1}}, +{ 1, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x2}}, +{ 2, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x4}}, +{ 3, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x8}}, +{ 4, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x10}}, +{ 5, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x20}}, +{ 6, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x40}}, +{ 7, 1, {0x76, 0x8}, {0x22, 0x18, 0x0, 0x80}}, +{ 8, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x1}}, +{ 9, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x2}}, +{10, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x4}}, +{11, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x8}}, +{12, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x10}}, +{13, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x20}}, +{14, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x40}}, +{15, 1, {0x76, 0x8}, {0x22, 0x19, 0x1, 0x80}}, +{16, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x1}}, +{17, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x2}}, +{18, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x4}}, +{19, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x8}}, +{20, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x10}}, +{21, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x20}}, +{22, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x40}}, +{23, 1, {0x76, 0x8}, {0x22, 0x1A, 0x2, 0x80}}, +{24, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x1}}, +{25, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x2}}, +{26, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x4}}, +{27, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x8}}, +{28, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x10}}, +{29, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x20}}, +{30, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x40}}, +{31, 1, {0x76, 0x8}, {0x22, 0x1B, 0x3, 0x80}}, +{32, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x1}}, +{33, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x2}}, +{34, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x4}}, +{35, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x8}}, +{36, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x10}}, +{37, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x20}}, +{38, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x40}}, +{39, 1, {0x76, 0x8}, {0x22, 0x1C, 0x4, 0x80}}, +{40, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x1}}, +{41, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x2}}, +{42, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x4}}, +{43, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x8}}, +{44, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x10}}, +{45, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x20}}, +{46, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x40}}, +{47, 1, {0x76, 0x8}, {0x23, 0x18, 0x0, 0x80}} +/* 48-51 ports(QSFP) do not support RX Loss, + * so we don't need to define the data here. + */ +}; + +io_expander_info_t sfp_rxloss_all_data[] = { +{0x22, 0x18, 0x0, 0xFF}, /* Port 0-7 */ +{0x22, 0x19, 0x1, 0xFF}, /* Port 8-15 */ +{0x22, 0x1A, 0x2, 0xFF}, /* Port 16-23 */ +{0x22, 0x1B, 0x3, 0xFF}, /* Port 24-31 */ +{0x22, 0x1C, 0x4, 0xFF}, /* Port 32-39 */ +{0x23, 0x18, 0x0, 0xFF} /* Port 40-47 */ +/* 48-51 ports(QSFP) do not support RX Loss, + * so we don't need to define the data here. + */ +}; + +sfp_io_expander_hierarchy_t sfp_psnt_data[] = { +{ 0, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x1}}, +{ 1, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x2}}, +{ 2, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x4}}, +{ 3, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x8}}, +{ 4, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x10}}, +{ 5, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x20}}, +{ 6, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x40}}, +{ 7, 1, {0x76, 0x8}, {0x20, 0x18, 0x0, 0x80}}, +{ 8, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x1}}, +{ 9, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x2}}, +{10, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x4}}, +{11, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x8}}, +{12, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x10}}, +{13, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x20}}, +{14, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x40}}, +{15, 1, {0x76, 0x8}, {0x20, 0x19, 0x1, 0x80}}, +{16, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x1}}, +{17, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x2}}, +{18, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x4}}, +{19, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x8}}, +{20, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x10}}, +{21, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x20}}, +{22, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x40}}, +{23, 1, {0x76, 0x8}, {0x20, 0x1A, 0x2, 0x80}}, +{24, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x1}}, +{25, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x2}}, +{26, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x4}}, +{27, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x8}}, +{28, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x10}}, +{29, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x20}}, +{30, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x40}}, +{31, 1, {0x76, 0x8}, {0x20, 0x1B, 0x3, 0x80}}, +{32, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x1}}, +{33, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x2}}, +{34, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x4}}, +{35, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x8}}, +{36, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x10}}, +{37, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x20}}, +{38, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x40}}, +{39, 1, {0x76, 0x8}, {0x20, 0x1C, 0x4, 0x80}}, +{40, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x1}}, +{41, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x2}}, +{42, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x4}}, +{43, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x8}}, +{44, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x10}}, +{45, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x20}}, +{46, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x40}}, +{47, 1, {0x76, 0x8}, {0x23, 0x19, 0x1, 0x80}}, +{48, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x2}}, +{49, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x1}}, +{50, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x8}}, +{51, 1, {0x76, 0x8}, {0x23, 0x1A, 0x2, 0x4}} +}; + +io_expander_info_t sfp_psnt_all_data[] = { +{0x20, 0x18, 0x0, 0xFF}, +{0x20, 0x19, 0x1, 0xFF}, +{0x20, 0x1A, 0x2, 0xFF}, +{0x20, 0x1B, 0x3, 0xFF}, +{0x20, 0x1C, 0x4, 0xFF}, +{0x23, 0x19, 0x1, 0xFF}, +{0x23, 0x1A, 0x2, 0xF} +}; + +typedef struct equalizer_info { + unsigned int bus_id; + unsigned char i2c_addr; + unsigned char offset; + unsigned char data; +} equalizer_info_t; + +equalizer_info_t equalizer_data[] = { +{ 1,0x76, 0 ,0x08}, { 1,0x22, 0x18 ,0x00}, { 1,0x22, 0x19 ,0x00}, +{ 1,0x22, 0x1a ,0x00}, { 1,0x22, 0x1b ,0x00}, { 1,0x22, 0x1C ,0x00}, +{ 1,0x24, 0x18 ,0x00}, { 1,0x24, 0x19 ,0x00}, { 1,0x24, 0x1a ,0x00}, +{ 1,0x24, 0x1b ,0x00}, { 1,0x24, 0x1C ,0x00}, { 1,0x23, 0x18 ,0x00}, +{ 1,0x23, 0x1C ,0x00}, { 1,0x76, 0 ,0x00}, + +/* For QSFP TX EQ0 ~ EQ3 */ +{ 1,0x76, 0x0 ,0x02}, { 1,0x74, 0x0 ,0x10}, { 1,0x27, 0xff ,0x0c}, +{ 1,0x27, 0x36 ,0x01}, { 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, +{ 1,0x27, 0x15 ,0x12}, { 1,0x74, 0x0 ,0x00}, { 1,0x74, 0x0 ,0x20}, +{ 1,0x27, 0xff ,0x0c}, { 1,0x27, 0x36 ,0x01}, { 1,0x27, 0x0a ,0x1c}, +{ 1,0x27, 0x0a ,0x10}, { 1,0x27, 0x15 ,0x12}, { 1,0x74, 0x0 ,0x00}, +{ 1,0x74, 0x0 ,0x40}, { 1,0x27, 0xff ,0x0c}, { 1,0x27, 0x36 ,0x01}, +{ 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, { 1,0x27, 0x15 ,0x12}, +{ 1,0x74, 0x0 ,0x00}, { 1,0x74, 0x0 ,0x80}, { 1,0x27, 0xff ,0x0c}, +{ 1,0x27, 0x36 ,0x01}, { 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, +{ 1,0x27, 0x15 ,0x12}, { 1,0x74, 0x0 ,0x00}, { 1,0x76, 0x0 ,0x00}, + +/* For QSFP RX EQ0 ~ EQ3 */ +{ 1,0x77, 0x0 ,0x01}, { 1,0x27, 0xff ,0x0c}, { 1,0x27, 0x36 ,0x01}, +{ 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, { 1,0x27, 0x15 ,0x12}, +{ 1,0x77, 0x0 ,0x00}, { 1,0x77, 0x0 ,0x02}, { 1,0x27, 0xff ,0x0c}, +{ 1,0x27, 0x36 ,0x01}, { 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, +{ 1,0x27, 0x15 ,0x12}, { 1,0x77, 0x0 ,0x00}, { 1,0x77, 0x0 ,0x04}, +{ 1,0x27, 0xff ,0x0c}, { 1,0x27, 0x36 ,0x01}, { 1,0x27, 0x0a ,0x1c}, +{ 1,0x27, 0x0a ,0x10}, { 1,0x27, 0x15 ,0x12}, { 1,0x77, 0x0 ,0x00}, +{ 1,0x77, 0x0 ,0x08}, { 1,0x27, 0xff ,0x0c}, { 1,0x27, 0x36 ,0x01}, +{ 1,0x27, 0x0a ,0x1c}, { 1,0x27, 0x0a ,0x10}, { 1,0x27, 0x15 ,0x12}, +{ 1,0x77, 0x0 ,0x00} +}; + +static int init_equalizer(void) +{ + int i = 0, ret = ONLP_STATUS_OK; + + for (i = 0; i < AIM_ARRAYSIZE(equalizer_data); i++) { + if (i2c_nWrite(equalizer_data[i].bus_id, equalizer_data[i].i2c_addr, + equalizer_data[i].offset, sizeof(equalizer_data[i].data), &equalizer_data[i].data) != 0) + { + AIM_LOG_ERROR("init equalizer failed : bus(%d), addr(%x), reg(%x), val(%x)\r\n", + equalizer_data[i].bus_id, equalizer_data[i].i2c_addr, + equalizer_data[i].offset, equalizer_data[i].data); + ret = ONLP_STATUS_E_INTERNAL; + } + } + + return ret; +} + +static int init_qsfp_modsel(void) +{ + /* 40G QSFP need set MODSEL as low. */ + unsigned char buf[] = {0x4, 0, 0xf}; + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(1, 0x76, 0, sizeof(buf[0]), &buf[0]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Set IO expander 0x71 configuration register as output */ + if (i2c_nWrite(1, 0x71, 0x3, sizeof(buf[1]), &buf[1]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Set MODSEL of 48~51 ports as low */ + if (i2c_nWrite(1, 0x71, 0x1, sizeof(buf[2]), &buf[2]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +/************************************************************ + * + * SFPI Entry Points + * + ***********************************************************/ +int +onlp_sfpi_init(void) +{ + /* Called at initialization time */ + /* init equalizer */ + if (ONLP_STATUS_OK != init_equalizer()) { + AIM_LOG_ERROR("init_equalizer failed\r\n"); + return ONLP_STATUS_E_INTERNAL; + } + + /* init qsfp modsel as low */ + if (ONLP_STATUS_OK != init_qsfp_modsel()) { + AIM_LOG_ERROR("init_qsfp_modsel failed\r\n"); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Ports {0, 51} + */ + int p; + + for(p = 0; p < 52; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_is_present(int port) +{ + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + int i = 0; + unsigned char buf; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_psnt_data); i++) + { + if (port != sfp_psnt_data[i].port) { + continue; + } + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(sfp_psnt_data[i].bus, sfp_psnt_data[i].mux.addr, 0, sizeof(sfp_psnt_data[i].mux.ch), &sfp_psnt_data[i].mux.ch) != 0) { + return 0; + } + + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(sfp_psnt_data[i].bus, sfp_psnt_data[i].io_exp.addr, + sfp_psnt_data[i].io_exp.cfg_reg, sizeof(sfp_psnt_data[i].io_exp.status_mask), &sfp_psnt_data[i].io_exp.status_mask) != 0) { + return 0; + } + + /* Read from the input register to get the present state */ + if (i2c_nRead(sfp_psnt_data[i].bus, sfp_psnt_data[i].io_exp.addr, + sfp_psnt_data[i].io_exp.status_reg, sizeof(buf), &buf) != 0) { + return 0; + } + + return !(buf & sfp_psnt_data[i].io_exp.status_mask); + } + + return 0; +} + +static void +port_qsfp_ioexpander_presence_map__(int port, int* rport) +{ + switch(port) + { + case 48: *rport = 49; break; + case 49: *rport = 48; break; + case 50: *rport = 51; break; + case 51: *rport = 50; break; + default: *rport = port; break; + } +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + int i = 0; + unsigned char bytes[7]; + mux_info_t mux = {0x76, 0x8}; + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(1, mux.addr, 0, sizeof(mux.ch), &mux.ch) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + for (i = 0; i < AIM_ARRAYSIZE(sfp_psnt_all_data); i++) + { + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(1, sfp_psnt_all_data[i].addr, sfp_psnt_all_data[i].cfg_reg, + sizeof(sfp_psnt_all_data[i].status_mask), &sfp_psnt_all_data[i].status_mask) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Read from the input register to get the present state */ + if (i2c_nRead(1, sfp_psnt_all_data[i].addr, sfp_psnt_all_data[i].status_reg, + sizeof(bytes[i]), &bytes[i]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + bytes[i] = ~bytes[i]; + } + + /* Mask out non-existant QSFP ports */ + bytes[6] &= 0xF; + + /* Convert to 64 bit integer in port order */ + uint64_t presence_all = 0 ; + + for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { + presence_all <<= 8; + presence_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; presence_all; i++) { + int p; + port_qsfp_ioexpander_presence_map__(i, &p); + AIM_BITMAP_MOD(dst, p, (presence_all & 1)); + presence_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + int i = 0; + unsigned char bytes[6]; + mux_info_t mux = {0x76, 0x8}; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_rxloss_all_data); i++) { + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(1, mux.addr, 0, sizeof(mux.ch), &mux.ch) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(1, sfp_rxloss_all_data[i].addr, sfp_rxloss_all_data[i].cfg_reg, + sizeof(sfp_rxloss_all_data[i].status_mask), &sfp_rxloss_all_data[i].status_mask) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Read from the input register to get the rxloss state */ + if (i2c_nRead(1, sfp_rxloss_all_data[i].addr, sfp_rxloss_all_data[i].status_reg, + sizeof(bytes[i]), &bytes[i]) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + } + + /* Convert to 64 bit integer in port order */ + uint64_t rx_los_all = 0 ; + for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { + rx_los_all <<= 8; + rx_los_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; rx_los_all; i++) { + AIM_BITMAP_MOD(dst, i, (rx_los_all & 1)); + rx_los_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +static int +sfpi_read_addr__(int port, int addr, uint8_t data[256]) +{ + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + int sfp_idx = 0, i = 0; + + for (sfp_idx = 0; sfp_idx < AIM_ARRAYSIZE(sfp_eeprom_data); sfp_idx++) { + if (sfp_eeprom_data[sfp_idx].port == port) { + break; + } + } + + if (sfp_idx == AIM_ARRAYSIZE(sfp_eeprom_data)) { + return ONLP_STATUS_E_MISSING; + } + + // Step 1: Change the mux to the correct channel for the specified port number + for (i = 0; i < MAX_MUX_COUNT; i++) { + if (sfp_eeprom_data[sfp_idx].mux[i].addr == 0) { + break; + } + + if (0 != i2c_nWrite(sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, 0x0, + sizeof(sfp_eeprom_data[sfp_idx].mux[i].ch), + &sfp_eeprom_data[sfp_idx].mux[i].ch)) { + AIM_LOG_ERROR("Line = (%d): I2C write failed, bus=%d, addr=%d, ch = %d\r\n", + __LINE__, sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, sfp_eeprom_data[sfp_idx].mux[i].ch); + } + } + + // Step 2: Read eeprom data + for (i = 0; i < 16; i++) { + if (i2c_nRead(sfp_eeprom_data[sfp_idx].bus, addr, i*I2C_BUFFER_MAXSIZE, I2C_BUFFER_MAXSIZE, data + i*I2C_BUFFER_MAXSIZE) != 0) { + AIM_LOG_ERROR("Line = (%d), bus=%d, addr=%x, reg=(%x), sizeof(data)=%d\r\n", __LINE__, + sfp_eeprom_data[sfp_idx].bus, addr, i, sizeof(data)); + return ONLP_STATUS_E_MISSING; + } + } + + // Step 3: Turn off the channel + for (i = (MAX_MUX_COUNT-1); i >= 0; i--) { + unsigned char buf = 0; + + if (sfp_eeprom_data[sfp_idx].mux[i].addr == 0) { + continue; + } + + if (0 != i2c_nWrite(sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, 0x0, + sizeof(buf), &buf)) { + AIM_LOG_ERROR("Line = (%d): I2C write failed, bus=%d, addr=%x, ch = %d, sfp_idx=(%d)\r\n", + __LINE__, sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, buf, sfp_idx); + } + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + return sfpi_read_addr__(port, SFP_IDPROM_ADDR, data); +} + +int +onlp_sfpi_dom_read(int port, uint8_t data[256]) +{ + return sfpi_read_addr__(port, SFP_DOM_ADDR, data); +} + + +int +onlp_sfpi_enable_set(int port, int enable) +{ + /* If enable is 1, enable the SFP */ + /* If enable is 0, disable the SFP */ + int i = 0; + unsigned char buf; + sfp_io_expander_hierarchy_t *p = sfp_enable_data; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_enable_data); i++) { + if (port != p[i].port) { + continue; + } + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(p[i].bus, p[i].mux.addr, 0, sizeof(p[i].mux.ch), &p[i].mux.ch) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Set the configuration register of IO-expander as output */ + if (i2c_nRead(p[i].bus, p[i].io_exp.addr, p[i].io_exp.cfg_reg, sizeof(buf), &buf) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + buf &= ~p[i].io_exp.status_mask; + + if (i2c_nWrite(p[i].bus, p[i].io_exp.addr, p[i].io_exp.cfg_reg, sizeof(buf), &buf) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Read from the output register to get the current enable state */ + if (i2c_nRead(p[i].bus, p[i].io_exp.addr, p[i].io_exp.status_reg + 0x8, sizeof(buf), &buf) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Do the enable/disable action */ + buf = enable ? (buf | p[i].io_exp.status_mask) : (buf & ~p[i].io_exp.status_mask); + + if (i2c_nWrite(p[i].bus, p[i].io_exp.addr, p[i].io_exp.status_reg + 0x8, sizeof(buf), &buf) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; + } + + return ONLP_STATUS_E_MISSING; +} + +int +onlp_sfpi_enable_get(int port, int* enable) +{ + /* Return whether the SFP is currently enabled */ + int i = 0; + unsigned char buf; + sfp_io_expander_hierarchy_t *p = sfp_enable_data; + + *enable = 0; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_enable_data); i++) { + if (port != p[i].port) { + continue; + } + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(p[i].bus, p[i].mux.addr, 0, sizeof(p[i].mux.ch), &p[i].mux.ch) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(p[i].bus, p[i].io_exp.addr, p[i].io_exp.cfg_reg, sizeof(p[i].io_exp.status_mask), &p[i].io_exp.status_mask) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Read from the input register to get the enable state */ + if (i2c_nRead(p[i].bus, p[i].io_exp.addr, p[i].io_exp.status_reg, sizeof(buf), &buf) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + *enable = (buf & p[i].io_exp.status_mask) ? 1 : 0; + + return ONLP_STATUS_OK; + } + + return ONLP_STATUS_E_MISSING; +} + +static int is_rxloss(int port) +{ + int i = 0; + unsigned char buf; + sfp_io_expander_hierarchy_t *p = sfp_rxloss_data; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_rxloss_data); i++) { + if (port != p[i].port) + continue; + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(p[i].bus, p[i].mux.addr, 0, sizeof(p[i].mux.ch), &p[i].mux.ch) != 0) + return 0; + + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(p[i].bus, p[i].io_exp.addr, p[i].io_exp.cfg_reg, sizeof(p[i].io_exp.status_mask), &p[i].io_exp.status_mask) != 0) + return 0; + + /* Read from the input register to get the rxloss state */ + if (i2c_nRead(p[i].bus, p[i].io_exp.addr, p[i].io_exp.status_reg, sizeof(buf), &buf) != 0) + return 0; + + return (buf & p[i].io_exp.status_mask); + } + + return 0; +} + +static int is_txfailed(int port) +{ + int i = 0; + unsigned char buf; + sfp_io_expander_hierarchy_t *p = sfp_txfail_data; + + for (i = 0; i < AIM_ARRAYSIZE(sfp_txfail_data); i++) + { + if (port != p[i].port) { + continue; + } + + /* Set multiplexer to the corresponded channel */ + if (i2c_nWrite(p[i].bus, p[i].mux.addr, 0, sizeof(p[i].mux.ch), &p[i].mux.ch) != 0) { + return 0; + } + + /* Set the configuration register of IO-expander as input */ + if (i2c_nWrite(p[i].bus, p[i].io_exp.addr, p[i].io_exp.cfg_reg, sizeof(p[i].io_exp.status_mask), &p[i].io_exp.status_mask) != 0) { + return 0; + } + + /* Read from the input register to get the txfail state */ + if (i2c_nRead(p[i].bus, p[i].io_exp.addr, p[i].io_exp.status_reg, sizeof(buf), &buf) != 0) { + return 0; + } + + return (buf & p[i].io_exp.status_mask); + } + + return 0; +} + +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + +static int +control_set_power_override__(int port, uint8_t enable) +{ + int ret = ONLP_STATUS_OK; + int sfp_idx = 0, i = 0; + + for (sfp_idx = 0; sfp_idx < AIM_ARRAYSIZE(sfp_eeprom_data); sfp_idx++) { + if (sfp_eeprom_data[sfp_idx].port == port) { + break; + } + } + + if (sfp_idx == AIM_ARRAYSIZE(sfp_eeprom_data)) { + return ONLP_STATUS_E_MISSING; + } + + // Step 1: Change the mux to the correct channel for the specified port number + for (i = 0; i < MAX_MUX_COUNT; i++) { + if (sfp_eeprom_data[sfp_idx].mux[i].addr == 0) { + break; + } + + if (0 != i2c_nWrite(sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, 0x0, + sizeof(sfp_eeprom_data[sfp_idx].mux[i].ch), + &sfp_eeprom_data[sfp_idx].mux[i].ch)) { + AIM_LOG_ERROR("Line = (%d): I2C write failed, bus=%d, addr=%d, ch = %d\r\n", + __LINE__, sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, sfp_eeprom_data[sfp_idx].mux[i].ch); + return ONLP_STATUS_E_INTERNAL; + } + } + + // Step 2: Set eeprom byte 93(0x5D) bit0 (power-over-ride) + if (i2c_nWrite(sfp_eeprom_data[sfp_idx].bus, SFP_IDPROM_ADDR, 0x5D, sizeof(enable), &enable) != 0) { + AIM_LOG_ERROR("Line = (%d): I2C write LPMode failed, bus=%d, addr=%d, ch = %d\r\n", + __LINE__, sfp_eeprom_data[sfp_idx].bus, sfp_eeprom_data[sfp_idx].mux[i].addr); + ret = ONLP_STATUS_E_INTERNAL; + } + + // Step 3: Turn off the channel + for (i = (MAX_MUX_COUNT-1); i >= 0; i--) { + unsigned char buf = 0; + + if (sfp_eeprom_data[sfp_idx].mux[i].addr == 0) { + continue; + } + + if (0 != i2c_nWrite(sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, 0x0, sizeof(buf), &buf)) { + AIM_LOG_ERROR("Line = (%d): I2C write failed, bus=%d, addr=%x, ch = %d, sfp_idx=(%d)\r\n", + __LINE__, sfp_eeprom_data[sfp_idx].bus, + sfp_eeprom_data[sfp_idx].mux[i].addr, buf, sfp_idx); + ret = ONLP_STATUS_E_INTERNAL; + } + } + + /* Sleep 1ms for waiting power over ride mode to take place */ + usleep(1000); + + return ret; +} + +int +onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) +{ + switch(control) + { + case ONLP_SFP_CONTROL_POWER_OVERRIDE: + return control_set_power_override__(port, value); + default: + return ONLP_STATUS_E_UNSUPPORTED; + } +} + +int +onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value) +{ + switch(control) + { + + case ONLP_SFP_CONTROL_RX_LOS: + *value = is_rxloss(port) ? 1 : 0; + return ONLP_STATUS_OK; + + case ONLP_SFP_CONTROL_TX_FAULT: + *value = is_txfailed(port) ? 1 : 0; + return ONLP_STATUS_OK; + + default: + return ONLP_STATUS_E_UNSUPPORTED; + + } + +} + +#define NUM_OF_1G_10G_PORT 48 +#define NUM_OF_EQU_CFG_PER_PORT 2 /* TX & RX */ +#define NUM_OF_1G_CMD_PER_CFG 16 +#define NUM_OF_10G_CMD_PER_CFG 8 + +static equalizer_info_t equalizer_settings_1g[NUM_OF_1G_10G_PORT][NUM_OF_EQU_CFG_PER_PORT][NUM_OF_1G_CMD_PER_CFG] = { +{ + { + /* Front Port 1 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 1 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 2 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 2 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 3 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 3 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 4 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 4 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 5 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 5 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 6 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 6 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 7 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 7 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 8 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 8 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 9 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 9 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 10 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 10 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 11 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 11 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 12 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 12 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 13 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 13 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 14 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 14 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 15 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 15 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 16 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + }, + { + /* Front Port 16 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 17 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 17 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 18 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 18 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 19 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 19 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 20 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 20 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 21 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 21 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 22 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 22 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 23 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 23 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 24 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 24 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 25 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 25 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 26 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 26 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 27 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 27 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 28 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 28 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 29 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 29 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 30 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 30 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 31 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 31 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 32 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 32 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 33 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 33 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 34 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 34 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 35 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 35 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 36 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 36 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 37 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 37 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 38 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 38 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 39 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 39 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 40 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 40 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 41 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 41 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 42 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 42 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 43 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 43 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 44 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 44 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 45 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 45 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 46 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 46 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 47 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 47 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +}, +{ + { + /* Front Port 48 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00}, + }, + { + /* Front Port 48 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x00, 0x04}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x15, 0x10}, + {1, 0x27, 0x09, 0x20}, + {1, 0x27, 0x1e, 0x01}, + {1, 0x27, 0x3f, 0x80}, + {1, 0x27, 0x31, 0x00}, + {1, 0x27, 0x03, 0x00}, + {1, 0x27, 0x3A, 0x00}, + {1, 0x27, 0x40, 0x00}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00}, + } +} +}; + +static equalizer_info_t equalizer_settings_10g[NUM_OF_1G_10G_PORT][NUM_OF_EQU_CFG_PER_PORT][NUM_OF_10G_CMD_PER_CFG] = { +{ + { + /* Front Port 1 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 1 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 2 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 2 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 3 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 3 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 4 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 4 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 5 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 5 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 6 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 6 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 7 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 7 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 8 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 8 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 9 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 9 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 10 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 10 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 11 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 11 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 12 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 12 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 13 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 13 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 14 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 14 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 15 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 15 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 16 TX */ + {1, 0x75, 0x00, 0x08}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + }, + { + /* Front Port 16 RX */ + {1, 0x75, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 17 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 17 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 18 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 18 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 19 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 19 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 20 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 20 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 21 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 21 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 22 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 22 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 23 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 23 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 24 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 24 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 25 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 25 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 26 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 26 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 27 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 27 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 28 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 28 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 29 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 29 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 30 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 30 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 31 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 31 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 32 TX */ + {1, 0x76, 0x00, 0x01}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 32 RX */ + {1, 0x75, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 33 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 33 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 34 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 34 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 35 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 35 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 36 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 36 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x01}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 37 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 37 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 38 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 38 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 39 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 39 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 40 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 40 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x02}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 41 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 41 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 42 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 42 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 43 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 43 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 44 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 44 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x04}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 45 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 45 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 46 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 46 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 47 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x05}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 47 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x06}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +}, +{ + { + /* Front Port 48 TX */ + {1, 0x76, 0x00, 0x02}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x04}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x76, 0x00, 0x00} + }, + { + /* Front Port 48 RX */ + {1, 0x75, 0x00, 0x04}, + {1, 0x74, 0x00, 0x08}, + {1, 0x27, 0xff, 0x07}, + {1, 0x27, 0x36, 0x01}, + {1, 0x27, 0x0a, 0x1c}, + {1, 0x27, 0x0a, 0x10}, + {1, 0x74, 0x00, 0x00}, + {1, 0x75, 0x00, 0x00} + } +} +}; + +static int +program_1g_equalizer_settings(int port) +{ + int i, j; + + for (i = 0; i < NUM_OF_EQU_CFG_PER_PORT; i++) { + for (j = 0; j < NUM_OF_1G_CMD_PER_CFG; j++) { + if (i2c_nWrite(equalizer_settings_1g[port][i][j].bus_id, + equalizer_settings_1g[port][i][j].i2c_addr, + equalizer_settings_1g[port][i][j].offset, + sizeof(equalizer_settings_1g[port][i][j].data), + &equalizer_settings_1g[port][i][j].data) != 0) { + AIM_LOG_ERROR("program_1g_equalizer_settings failed at port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + } + } + + return ONLP_STATUS_OK; +} + +static int +program_10g_equalizer_settings(int port) +{ + int i, j; + + for (i = 0; i < NUM_OF_EQU_CFG_PER_PORT; i++) { + for (j = 0; j < NUM_OF_10G_CMD_PER_CFG; j++) { + if (i2c_nWrite(equalizer_settings_10g[port][i][j].bus_id, + equalizer_settings_10g[port][i][j].i2c_addr, + equalizer_settings_10g[port][i][j].offset, + sizeof(equalizer_settings_10g[port][i][j].data), + &equalizer_settings_10g[port][i][j].data) != 0) { + AIM_LOG_ERROR("program_10g_equalizer_settings failed at port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + } + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_post_insert(int port, sff_info_t* info) +{ + if (port < 0) { + return ONLP_STATUS_E_PARAM; + } + + if (port >= NUM_OF_1G_10G_PORT) { + return ONLP_STATUS_OK; + } + + switch(info->caps) + { + case SFF_MODULE_CAPS_F_1G: + return program_1g_equalizer_settings(port); + case SFF_MODULE_CAPS_F_10G: + return program_10g_equalizer_settings(port); + default: + return ONLP_STATUS_E_UNSUPPORTED; + } +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..76cc32b0 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,160 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "powerpc_accton_as5610_52x_log.h" + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-accton-as5610-52x-rX"; +} + +int +onlp_sysi_platform_set(const char* platform) +{ + /** Support all revisions of the 5610-52x */ + if(strstr(platform, "powerpc-accton-as5610-52x-r")) { + return ONLP_STATUS_OK; + } + if(strstr(platform, "powerpc-as5610-52x")) { + return ONLP_STATUS_OK; + } + + AIM_LOG_ERROR("No support for platform '%s'", platform); + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_init(void) +{ + return ONLP_STATUS_OK; +} + + +int +onlp_sysi_onie_data_phys_addr_get(void** physaddr) +{ + *physaddr = (void*)(0xeff70000); + return ONLP_STATUS_OK; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* 2 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + + /* 1 Fan */ + *e++ = ONLP_FAN_ID_CREATE(1); + + /* 8 Thermal sensors */ + *e++ = ONLP_THERMAL_ID_CREATE(1); + *e++ = ONLP_THERMAL_ID_CREATE(2); + *e++ = ONLP_THERMAL_ID_CREATE(3); + *e++ = ONLP_THERMAL_ID_CREATE(4); + *e++ = ONLP_THERMAL_ID_CREATE(5); + *e++ = ONLP_THERMAL_ID_CREATE(6); + *e++ = ONLP_THERMAL_ID_CREATE(7); + *e++ = ONLP_THERMAL_ID_CREATE(8); + + /* 5 LEDs */ + *e++ = ONLP_LED_ID_CREATE(1); + *e++ = ONLP_LED_ID_CREATE(2); + *e++ = ONLP_LED_ID_CREATE(3); + *e++ = ONLP_LED_ID_CREATE(4); + *e++ = ONLP_LED_ID_CREATE(5); + + return 0; +} + +int +onlp_sysi_platform_manage_fans(void) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +#include +#include +#include + +int +onlp_sysi_platform_manage_leds(void) +{ + int rv; + onlp_fan_info_t fi; + onlp_led_mode_t mode = ONLP_LED_MODE_GREEN; + + rv = onlp_fani_info_get(ONLP_FAN_ID_CREATE(1), &fi); + if(rv < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if((fi.status & 1) == 0) { + mode = ONLP_LED_MODE_OFF; + } + else if(fi.status & ONLP_FAN_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(2), mode); + + onlp_psu_info_t pi; + + mode = ONLP_LED_MODE_GREEN; + rv = onlp_psu_info_get(ONLP_PSU_ID_CREATE(1), &pi); + if(rv < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if((pi.status & 1) == 0) { + mode = ONLP_LED_MODE_OFF; + } + else if(pi.status & ONLP_PSU_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(4), mode); + + + mode = ONLP_LED_MODE_GREEN; + rv = onlp_psu_info_get(ONLP_PSU_ID_CREATE(2), &pi); + if(rv < 0) { + mode = ONLP_LED_MODE_ORANGE; + } + else if((pi.status & 1) == 0) { + mode = ONLP_LED_MODE_OFF; + } + else if(pi.status & ONLP_PSU_STATUS_FAILED) { + mode = ONLP_LED_MODE_ORANGE; + } + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(5), mode); + + return 0; +} + + + + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..583b198a --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,264 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +/* i2c device info */ +#define I2C_PSU_BUS_ID 0 +#define I2C_THERMAL_SENSOR_BUS_ID 0 +#define I2C_SLAVE_ADDR_PCA9548 0x70 +#define I2C_SLAVE_ADDR_MAX6581 0x4D +#define I2C_SLAVE_ADDR_NE1617A 0x18 + +#define I2C_REG_MAX6581_CONFIG 0x41 +#define I2C_MAX6581_REG_EXTENDED_RANGE_MASK 0x02 + +#define I2C_THERMAL_1_REG_ADT7473_LOCAL 0x26 +#define I2C_THERMAL_2_REG_ADT7473_REMOTE_1 0x25 +#define I2C_THERMAL_3_REG_ADT7473_REMOTE_2 0x27 +#define I2C_THERMAL_REG_ADT7473_EXTENDED 0x77 + +#define I2C_PSU1_SLAVE_ADDR_CFG 0x3E +#define I2C_PSU2_SLAVE_ADDR_CFG 0x3D + +#define TEMPERATURE_MULTIPLIER 1000 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static int +thermal_sensor_max6581_base_degree(void) +{ + unsigned char data = 0; + + /* Read configuration register to see if decimal place is supported + */ + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, I2C_REG_MAX6581_CONFIG, sizeof(data), &data) != 0) { + return 0; + } + + return (data & I2C_MAX6581_REG_EXTENDED_RANGE_MASK) ? -64 : 0; +} + +static int +thermal_sensor_max6581_info_get(onlp_thermal_info_t* info) +{ + unsigned char data = 0; + unsigned char temp_reg[7] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x8}; + unsigned char temp_reg_dp[7] = {0x9, 0x52, 0x53, 0x54, 0x55, 0x56, 0x58}; /* Register to read decimal place */ + int base_degree = thermal_sensor_max6581_base_degree(); + int index = ONLP_OID_ID_GET(info->hdr.id) - 1; + + /* Set the thermal status from diode fault(0x46) register */ + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, 0x46, sizeof(data), &data) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + if (data >> index & 0x1) { + info->status |= ONLP_THERMAL_STATUS_FAILED; + return ONLP_STATUS_E_INTERNAL; + } + + /* Read Main Temperature Register (High-Byte) Data*/ + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, temp_reg[index], sizeof(data), &data) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + info->mcelsius = (data + base_degree) * TEMPERATURE_MULTIPLIER; + + /* Read Extended-Resolution Temperature Register (Low-Byte) Data*/ + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, temp_reg_dp[index], sizeof(data), &data) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + info->mcelsius += (data >> 5) * 125; + //printf("Max6581 temperature(%d) = (%d)\r\n", ONLP_OID_ID_GET(info->hdr.id), info->mcelsius); + + return ONLP_STATUS_OK; +} + +static int +thermal_sensor_ne1617a_info_get(onlp_thermal_info_t* info) +{ + unsigned char data = 0; + + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_NE1617A, 0x1, sizeof(data), &data) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + info->mcelsius = data * TEMPERATURE_MULTIPLIER; + //printf("NE1617A temperature(%d) = (%d)\r\n", ONLP_OID_ID_GET(info->hdr.id), info->mcelsius); + + return ONLP_STATUS_OK; +} + +static int +thermal_sensor_cpr_4011_info_get(onlp_thermal_info_t* info) +{ + int temperature = 0; + unsigned char status = 0; + unsigned char i2c_addr; + + if (ONLP_OID_ID_GET(info->hdr.id) == 9) { + i2c_addr = I2C_PSU1_SLAVE_ADDR_CFG; + } + else { + i2c_addr = I2C_PSU2_SLAVE_ADDR_CFG; + } + + /* Get the STATUS_TEMPERATURE described in the PMBUS spec */ + if (i2c_nRead(I2C_PSU_BUS_ID, i2c_addr, 0x7D, sizeof(status), &status) != 0) + return ONLP_STATUS_E_INTERNAL; + + if (status & 0x90) { + info->status |= ONLP_THERMAL_STATUS_FAILED; + return ONLP_STATUS_E_INTERNAL; + } + + /* Get the temperature */ + if (pmbus_read_literal_data(I2C_PSU_BUS_ID, i2c_addr, 0x8D, &temperature) != 0) + return ONLP_STATUS_E_INTERNAL; + + info->caps |= ONLP_THERMAL_CAPS_GET_TEMPERATURE; + info->mcelsius = temperature; + + return ONLP_STATUS_OK; +} + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + unsigned char data = 0; + + if (as5610_52x_i2c0_pca9548_channel_set(0x80) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + /* Configure max6581 to enable the functionality to support decimal place reading */ + if (i2c_nRead(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, I2C_REG_MAX6581_CONFIG, sizeof(data), &data) != 0) { + as5610_52x_i2c0_pca9548_channel_set(0); + return ONLP_STATUS_E_INTERNAL; + } + + if (data & I2C_MAX6581_REG_EXTENDED_RANGE_MASK) { + as5610_52x_i2c0_pca9548_channel_set(0); + return ONLP_STATUS_OK; /* extended range is already enabled */ + } + + data |= I2C_MAX6581_REG_EXTENDED_RANGE_MASK; /* Enable extend range bit */ + + if (i2c_nWrite(I2C_THERMAL_SENSOR_BUS_ID, I2C_SLAVE_ADDR_MAX6581, I2C_REG_MAX6581_CONFIG, sizeof(data), &data) != 0) { + as5610_52x_i2c0_pca9548_channel_set(0); + return ONLP_STATUS_E_INTERNAL; + } + + sleep(1); + + return ONLP_STATUS_OK; +} + +/* Static values */ +static onlp_thermal_info_t tinfo[] = { +{ }, /* Not used */ +{ { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal Sensor 1 (near right-upper side of CPU)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal Sensor 2 (near right side of MAX6581)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(3), "Chassis Thermal Sensor 3 (near right side of MAC(Trident+)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(4), "Chassis Thermal Sensor 4 (near left down side of Equalizer_U57)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(5), "Chassis Thermal Sensor 5 (near right down side of MAC)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(6), "Chassis Thermal Sensor 6 (near upper side of Equalizer_U49)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(7), "Chassis Thermal Sensor 7 (near left down side of PCB)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(8), "Chassis Thermal Sensor 8 (inside CPU)", 0}, 0x1, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, +{ { ONLP_THERMAL_ID_CREATE(9), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(1)}, 0x1, 0 }, +{ { ONLP_THERMAL_ID_CREATE(10), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)}, 0x1, 0 } +}; + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) +{ + int ret = ONLP_STATUS_E_UNSUPPORTED; + VALIDATE(id); + *info = tinfo[ONLP_OID_ID_GET(id)]; /* Set the ID/Description/Present state */ + + /* Read the temperature and status */ + if (ONLP_OID_ID_GET(id) >= 1 && ONLP_OID_ID_GET(id) <= 7) { + /* Set multiplexer to the channel of thermal sensor */ + if (as5610_52x_i2c0_pca9548_channel_set(0x80) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + ret = thermal_sensor_max6581_info_get(info); + } + + if (ONLP_OID_ID_GET(id) == 8) { + /* Set multiplexer to the channel of thermal sensor */ + if (as5610_52x_i2c0_pca9548_channel_set(0x80) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + ret = thermal_sensor_ne1617a_info_get(info); + } + + if (ONLP_OID_ID_GET(id) == 9 || ONLP_OID_ID_GET(id) == 10) { + /* Check PSU type */ + as5610_52x_psu_type_t psu_type = as5610_52x_get_psu_type(ONLP_OID_ID_GET(id)-8, NULL, 0); + + if (PSU_TYPE_AC_F2B == psu_type || PSU_TYPE_AC_B2F == psu_type) { + /* Set multiplexer to the channel of thermal sensor */ + if (as5610_52x_i2c0_pca9548_channel_set(0x6) != 0) { + return ONLP_STATUS_E_INTERNAL; + } + + ret = thermal_sensor_cpr_4011_info_get(info); + } + } + + /* Close PSU channel + */ + as5610_52x_i2c0_pca9548_channel_set(0); + + return ret; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/Makefile b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/PKG.yml b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..f2c57796 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5610-52x-r0 diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/boot/powerpc-accton-as5610-52x-r0 b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/boot/powerpc-accton-as5610-52x-r0 new file mode 100644 index 00000000..a17562d0 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/boot/powerpc-accton-as5610-52x-r0 @@ -0,0 +1,10 @@ +############################################################ +# powerpc-accton-as5610-52x-r0 +############################################################ + +echo "soc.0/ff724000.ethernet ma1" >/etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd1 0x00000000 0x00010000 0x00010000" >> /etc/fw_env.config \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/install/powerpc-as5610-52x.sh b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/install/powerpc-as5610-52x.sh new file mode 100644 index 00000000..481345ff --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/install/powerpc-as5610-52x.sh @@ -0,0 +1,31 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Installer scriptlet for the powerpc-as5610-52x +# + +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; fatload usb 0:1 0x10000000 onl-loader; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-as5610-52x; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/powerpc-accton-as5610-52x-r0.yml b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/powerpc-accton-as5610-52x-r0.yml new file mode 100644 index 00000000..c03a6eb1 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/lib/powerpc-accton-as5610-52x-r0.yml @@ -0,0 +1,4 @@ +powerpc-accton-as5610-52x-r0: + flat_image_tree: + kernel: onl-kernel-3.9.6-powerpc-e500v:powerpc, kernel-3.9.6-powerpc-e500v.bin.gz + dtb: onl-kernel-3.9.6-powerpc-e500v:powerpc, powerpc-as5610-52x.dtb diff --git a/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/python/powerpc_accton_as5610_52x_r0/__init__.py b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/python/powerpc_accton_as5610_52x_r0/__init__.py new file mode 100644 index 00000000..f609f450 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5610-52x/platform-config/r0/src/python/powerpc_accton_as5610_52x_r0/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +############################################################ +# +# +# +############################################################ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as5610_52x_r0(OnlPlatformAccton): + + onie_base_address = "0xeff70000" + + def model(self): + return "AS5610-52X" + + def platform(self): + return 'powerpc-accton-as5610-52x-r0' + + def sys_oid_platform(self): + return ".5610.52" + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/.gitignore b/packages/platforms/accton/powerpc-accton-as5710-54x/.gitignore new file mode 100644 index 00000000..28a0697b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-as5710-54x-rX.mk +onlpdump.mk +powerpc_accton_as5710_54x.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/PKG.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/PKG.yml new file mode 100644 index 00000000..21802846 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/PKG.yml @@ -0,0 +1,48 @@ +variables: + r0_platform : powerpc-accton-as5710-54x + r0b_platform1 : powerpc-as5710-54x + r0b_platform2 : powerpc-accton-as5710-54x + + r0_install : /lib/platform-config/${r0_platform}-r0/onl + r0b_install1 : /lib/platform-config/${r0b_platform1}-r0b/onl + r0b_install2 : /lib/platform-config/${r0b_platform2}-r0b/onl + +common: + version: 1.0.0 + arch: powerpc + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onlp-${r0_platform}-r0 + summary: ONLP Package for the ${r0_platform}-r0 platform. + + files: + builds/lib/$BUILD_DIR/powerpc-linux-gnu/bin/libonlp-${r0_platform}-rX.so : ${r0_install}/lib/libonlp-${r0_platform}-r0.so + builds/onlpdump/$BUILD_DIR/powerpc-linux-gnu/bin/onlpdump : ${r0_install}/bin/ + + changelog: Change changes changes., + + + - name: onlp-${r0b_platform1}-r0b + summary: ONLP Package for the ${r0b_platform1}-r0b platform. + + files: + builds/lib/$BUILD_DIR/powerpc-linux-gnu/bin/libonlp-${r0_platform}-rX.so : ${r0b_install1}/lib/libonlp-${r0b_platform1}-r0b.so + builds/onlpdump/$BUILD_DIR/powerpc-linux-gnu/bin/onlpdump : ${r0b_install1}/bin/ + + changelog: Change changes changes., + + - name: onlp-${r0b_platform2}-r0b + summary: ONLP Package for the ${r0b_platform2}-r0b platform. + + files: + builds/lib/$BUILD_DIR/powerpc-linux-gnu/bin/libonlp-${r0_platform}-rX.so : ${r0b_install2}/lib/libonlp-${r0b_platform2}-r0b.so + builds/onlpdump/$BUILD_DIR/powerpc-linux-gnu/bin/onlpdump : ${r0b_install2}/bin/ + + changelog: Change changes changes., + + + + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/.gitignore b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/lib/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/lib/Makefile new file mode 100644 index 00000000..5feac365 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/lib/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-as5710-54x-rX +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_accton_as5710_54x onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-accton-as5710-54x-rX.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + +clean: superclean \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..1adcdd26 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp powerpc_accton_as5710_54x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/Makefile new file mode 100644 index 00000000..4cd12d84 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_accton_as5710_54x +AUTOMODULE := powerpc_accton_as5710_54x +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/README b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/README new file mode 100644 index 00000000..3f2b5105 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# powerpc_accton_as5710_54x README +# +############################################################################### + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..4584c81f --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_accton_as5710_54x Autogeneration +# +############################################################################### +powerpc_accton_as5710_54x_AUTO_DEFS := module/auto/powerpc_accton_as5710_54x.yml +powerpc_accton_as5710_54x_AUTO_DIRS := module/inc/powerpc_accton_as5710_54x module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/powerpc_accton_as5710_54x.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/powerpc_accton_as5710_54x.yml new file mode 100644 index 00000000..1778b3a5 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/auto/powerpc_accton_as5710_54x.yml @@ -0,0 +1,49 @@ +############################################################################### +# +# powerpc_accton_as5710_54x Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG: + doc: "Include debug tool." + default: 0 + +definitions: + cdefs: + POWERPC_ACCTON_AS5710_54X_R0_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_accton_as5710_54x_config + + portingmacro: + POWERPC_ACCTON_AS5710_54X_R0: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x.x b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x.x new file mode 100644 index 00000000..63b5425e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_config.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_config.h new file mode 100644 index 00000000..d4a3c0e3 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_config.h @@ -0,0 +1,137 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as5710_54x Configuration Header + * + * @addtogroup powerpc_accton_as5710_54x-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5710_54X_R0_CONFIG_H__ +#define __POWERPC_ACCTON_AS5710_54X_R0_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG + * + * Include debug tool. */ + + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG +#define POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_accton_as5710_54x_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_accton_as5710_54x_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_accton_as5710_54x_config_settings table. */ +extern powerpc_accton_as5710_54x_config_settings_t powerpc_accton_as5710_54x_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_accton_as5710_54x_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_accton_as5710_54x_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_accton_as5710_54x_porting.h" + +#endif /* __POWERPC_ACCTON_AS5710_54X_R0_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_dox.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_dox.h new file mode 100644 index 00000000..c61b8aea --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_accton_as5710_54x Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5710_54X_R0_DOX_H__ +#define __POWERPC_ACCTON_AS5710_54X_R0_DOX_H__ + +/** + * @defgroup powerpc_accton_as5710_54x powerpc_accton_as5710_54x - powerpc_accton_as5710_54x Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_accton_as5710_54x-powerpc_accton_as5710_54x Public Interface + * @defgroup powerpc_accton_as5710_54x-config Compile Time Configuration + * @defgroup powerpc_accton_as5710_54x-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_ACCTON_AS5710_54X_R0_DOX_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h new file mode 100644 index 00000000..f1592e6d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as5710_54x Porting Macros. + * + * @addtogroup powerpc_accton_as5710_54x-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5710_54X_R0_PORTING_H__ +#define __POWERPC_ACCTON_AS5710_54X_R0_PORTING_H__ + + +/* */ +#if POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_MALLOC + #if defined(GLOBAL_MALLOC) + #define POWERPC_ACCTON_AS5710_54X_R0_MALLOC GLOBAL_MALLOC + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_MALLOC malloc + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_FREE + #if defined(GLOBAL_FREE) + #define POWERPC_ACCTON_AS5710_54X_R0_FREE GLOBAL_FREE + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_FREE free + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_FREE is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_ACCTON_AS5710_54X_R0_MEMSET GLOBAL_MEMSET + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_MEMSET memset + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_ACCTON_AS5710_54X_R0_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_MEMCPY memcpy + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_ACCTON_AS5710_54X_R0_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_STRNCPY strncpy + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_ACCTON_AS5710_54X_R0_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_ACCTON_AS5710_54X_R0_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_SNPRINTF snprintf + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS5710_54X_R0_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_ACCTON_AS5710_54X_R0_STRLEN GLOBAL_STRLEN + #elif POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS5710_54X_R0_STRLEN strlen + #else + #error The macro POWERPC_ACCTON_AS5710_54X_R0_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_ACCTON_AS5710_54X_R0_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/make.mk b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..96dc610e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_accton_as5710_54x_INCLUDES := -I $(THIS_DIR)inc +powerpc_accton_as5710_54x_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_accton_as5710_54x_DEPENDMODULE_ENTRIES := init:powerpc_accton_as5710_54x ucli:powerpc_accton_as5710_54x + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..3caa8505 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py powerpc_accton_as5710_54x_ucli.c + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/debug.c new file mode 100644 index 00000000..2db0209f --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/debug.c @@ -0,0 +1,56 @@ +#include "powerpc_accton_as5710_54x_int.h" + +#if POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG == 1 + +#include + +static char help__[] = + "Usage: debug [options]\n" + " -c CPLD Versions\n" + " -h Help\n" + ; + + +static void +print_cpld_version__(void) +{ + /** Temporary until the ONLP I2C support is enabled for PPC */ + system("/usr/sbin/i2cget -y -f 3 0x60 0x1"); + system("/usr/sbin/i2cget -y -f 3 0x61 0x1"); + system("/usr/sbin/i2cget -y -f 3 0x62 0x1"); +} + + +int +powerpc_accton_as5710_54x_debug_main(int argc, char* argv[]) +{ + int c = 0; + int help = 0; + int rv = 0; + + while( (c = getopt(argc, argv, "ch")) != -1) { + switch(c) + { + case 'c': c = 1; break; + case 'h': help = 1; rv = 0; break; + default: help = 1; rv = 1; break; + } + + } + + if(help || argc == 1) { + printf("%s", help__); + return rv; + } + + if(c) { + print_cpld_version__(); + } + + + return 0; +} + +#endif + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..362b7b90 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/fani.c @@ -0,0 +1,420 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +#include +#include "platform_lib.h" + +#define PREFIX_PATH_ON_MAIN_BROAD "/sys/class/hwmon/hwmon11/" +#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/" +#define LOCAL_DEBUG 0 + + +#define FAN_RESERVED 0 +#define FAN_1_ON_MAIN_BROAD 1 +#define FAN_2_ON_MAIN_BROAD 2 +#define FAN_3_ON_MAIN_BROAD 3 +#define FAN_4_ON_MAIN_BROAD 4 +#define FAN_5_ON_MAIN_BROAD 5 +#define FAN_1_ON_PSU1 6 +#define FAN_1_ON_PSU2 7 + +#define PROJECT_NAME accton_as5710_54x_ + +#define LEN_FILE_NAME 50 + +typedef struct last_path_S +{ + char status[LEN_FILE_NAME]; + char speed[LEN_FILE_NAME]; + char direction[LEN_FILE_NAME]; + char ctrl_speed[LEN_FILE_NAME]; + char r_status[LEN_FILE_NAME]; + char r_speed[LEN_FILE_NAME]; +}last_path_T; + +#define _MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) \ + { #prj"fan"#id"_fault", #prj"fan"#id"_speed_rpm", #prj"fan"#id"_direction",\ + #prj"fan"#id"_duty_cycle_percentage", #prj"fanr"#id"_fault", #prj"fanr"#id"_speed_rpm" } + +#define MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) _MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) + + +#define MAKE_FAN_LAST_PATH_ON_PSU(folder) \ + {#folder"/psu_fan1_fault", #folder"/psu_fan1_speed_rpm", "",\ + #folder"/psu_fan1_duty_cycle_percentage", "", "" } + +static last_path_T last_path[] = /* must map with onlp_fan_id */ +{ + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_RESERVED), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_1_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_2_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_3_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_4_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_5_ON_MAIN_BROAD), + + MAKE_FAN_LAST_PATH_ON_PSU(5-003c), + MAKE_FAN_LAST_PATH_ON_PSU(6-003f), +}; + +#define MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BROAD), "Chassis Fan "#id, 0 }, \ + 0x0, \ + ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE, \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + +#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \ + 0x0, \ + 0, \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + + +/* Static fan information */ +onlp_fan_info_t linfo[] = { + { }, /* Not used */ + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(1), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(2), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(3), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(4), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(5), + MAKE_FAN_INFO_NODE_ON_PSU(1,1), + MAKE_FAN_INFO_NODE_ON_PSU(2,1), +}; + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +/* PSU relative marco */ +#define SET_PSU_TYPE_CPR_4011_F2B_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); \ + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE + +#define SET_PSU_TYPE_CPR_4011_B2F_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE + +#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) + +#define SET_PSU_TYPE_UM400D_B2F_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F) + + +static int +_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) +{ + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[65] = {0}; + + /* get fan/fanr fault status (turn on when any one fails) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].r_status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan/fanr direction (both : the same) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + if (atoi(r_data) == 0) /*F2B*/ + info->status |= ONLP_FAN_STATUS_F2B; + else + info->status |= ONLP_FAN_STATUS_B2F; + + /* get fan/fanr speed (take the average of two speeds) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = (info->rpm + atoi(r_data))/2; + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100)/16800; + + /* check present */ + if (info->rpm > 0) + info->status |= ONLP_FAN_STATUS_PRESENT; + + return ONLP_STATUS_OK; +} + +static int +_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) +{ + int psu_id, is_ac=0; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[50] = {0}; + psu_type_t psu_type; + + /* get fan other cap status according to psu type + */ + psu_id = (local_id-FAN_1_ON_PSU1) + 1; + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id); + + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type); + + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + SET_PSU_TYPE_CPR_4011_F2B_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_AC_B2F: + SET_PSU_TYPE_CPR_4011_B2F_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_DC_48V_F2B: + SET_PSU_TYPE_UM400D_F2B_FAN(info); + break; + case PSU_TYPE_DC_48V_B2F: + SET_PSU_TYPE_UM400D_B2F_FAN(info); + break; + default: + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + + break; + } + + if (1 == is_ac) + { + /* get fan fault status + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan speed + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100)/19328; + + } + + return ONLP_STATUS_OK; +} + + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + int rc = 0; + int local_id; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + *info = linfo[local_id]; + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + break; + + default: + rc =_onlp_fani_info_get_fan(local_id, info); + break; + } + + return rc; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + int fd, len, nbytes=10, local_id; + char data[10] = {0}; + char fullpath[70] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* reject p=0 (p=0, stop fan) */ + if (p == 0){ + return ONLP_STATUS_E_INVALID; + } + + /* get fullpath */ + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); + break; + default: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].ctrl_speed); + break; + } + + sprintf(data, "%d", p); + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + + + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..086fa81c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,324 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include +#include +#include +#include + +#include + +//#include "onlpie_int.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ +enum led_light_mode { /*must be the same with the definition @ kernel driver */ + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_AUTO, +}; + +int led_light_map_mode[][2] = +{ + {LED_MODE_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_GREEN, ONLP_LED_MODE_GREEN}, + {LED_MODE_AMBER, ONLP_LED_MODE_ORANGE}, + {LED_MODE_RED, ONLP_LED_MODE_RED}, + {LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, + {LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING}, + {LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING}, + {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, +}; + + +#define prefix_path "/sys/class/leds/accton_as5710_54x_led::" +#define filename "brightness" + +enum onlp_led_id +{ + LED_RESERVED = 0, + LED_DIAG, + LED_FAN, + LED_LOC, + LED_PSU1, + LED_PSU2, + LED_FAN1, + LED_FAN2, + LED_FAN3, + LED_FAN4, + LED_FAN5, +}; + +static char last_path[][10] = /* must map with onlp_led_id */ +{ + "reserved", + "diag", + "fan", + "loc", + "psu1", + "psu2", + "fan1", + "fan2", + "fan3", + "fan4", + "fan5", +}; + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = +{ + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis LED 1 (DIAG LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 2 (FAN LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_LOC), "Chassis LED 3 (LOC LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 4 (PSU1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 5 (PSU2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10 (FAN5 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, +}; + + +static int conver_led_light_mode_to_onl(int led_ligth_mode) +{ + int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]); + for(i=0; imode = conver_led_light_mode_to_onl(atoi(data)); + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + VALIDATE(id); + + if (!on_or_off) { + return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int fd, len, driver_mode, nbytes=1, local_id; + char data[2] = {0}; + char fullpath[50] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* get fullpath */ + if (strchr(last_path[local_id], '/') != NULL) + { + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + } + else + { + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + } + + driver_mode = conver_led_light_mode_to_driver(mode); + sprintf(data, "%d", driver_mode); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..98f25e91 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := powerpc_accton_as5710_54x +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..a6c114be --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,169 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeWriteInt(char *filename, int value, int data_len) +{ + char buf[8] = {0}; + sprintf(buf, "%d", value); + + return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len); +} + +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) + { + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_RDONLY)) == -1) { + return -1; + } + + if ((len = read(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len) +{ + int ret; + + if (data_len >= buf_size || data_len < 0) { + return -1; + } + + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); + + if (ret == 0) { + if (data_len) { + buffer[data_len] = '\0'; + } + else { + buffer[buf_size-1] = '\0'; + } + } + + return ret; +} + +#define I2C_PSU_MODEL_NAME_LEN 13 + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len) +{ + char *node = NULL; + char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; + + /* Check AC model name */ + node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_F2B; + } + else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_B2F; + } + } + + /* Check DC model name */ + memset(model_name, 0, sizeof(model_name)); + node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_model_name) : PSU2_DC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_B2F; + } + else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_F2B; + } + } + + return PSU_TYPE_UNKNOWN; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..75fa981f --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,77 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +#include "powerpc_accton_as5710_54x_log.h" + +#define PSU1_ID 1 +#define PSU2_ID 2 + +#define CHASSIS_FAN_COUNT 5 +#define CHASSIS_THERMAL_COUNT 5 + +#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/5-003c/" +#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/6-003f/" + +#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/5-0038/" +#define PSU1_DC_HWMON_PREFIX "/sys/bus/i2c/devices/5-0050/" +#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/6-003b/" +#define PSU2_DC_HWMON_PREFIX "/sys/bus/i2c/devices/6-0053/" + +#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node +#define PSU1_DC_HWMON_NODE(node) PSU1_DC_HWMON_PREFIX#node +#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node +#define PSU2_DC_HWMON_NODE(node) PSU2_DC_HWMON_PREFIX#node + +#define SFP_HWMON_PREFIX "/sys/bus/i2c/devices/3-0050/" +#define SFP_HWMON_NODE(node) SFP_HWMON_PREFIX#node +#define SFP_HWMON_DOM_PREFIX "/sys/bus/i2c/devices/3-0051/" +#define SFP_HWMON_DOM_NODE(node) SFP_HWMON_DOM_PREFIX#node + +int deviceNodeWriteInt(char *filename, int value, int data_len); +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len); +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len); + +typedef enum psu_type { + PSU_TYPE_UNKNOWN, + PSU_TYPE_AC_F2B, + PSU_TYPE_AC_B2F, + PSU_TYPE_DC_48V_F2B, + PSU_TYPE_DC_48V_B2F +} psu_type_t; + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len); + +typedef enum platform_id_e { + PLATFORM_ID_UNKNOWN, + PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_R0, + PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_RX, +} platform_id_t; + +extern platform_id_t platform_id; + +#endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_config.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_config.c new file mode 100644 index 00000000..9597e492 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_config.c @@ -0,0 +1,81 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(_x) __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(_x) +powerpc_accton_as5710_54x_config_settings_t powerpc_accton_as5710_54x_config_settings[] = +{ +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_LOGGING(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_STDLIB(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG + { __powerpc_accton_as5710_54x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG), __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG) }, +#else +{ POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_DEBUG(__powerpc_accton_as5710_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_accton_as5710_54x_config_STRINGIFY_VALUE +#undef __powerpc_accton_as5710_54x_config_STRINGIFY_NAME + +const char* +powerpc_accton_as5710_54x_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_accton_as5710_54x_config_settings[i].name; i++) { + if(strcmp(powerpc_accton_as5710_54x_config_settings[i].name, setting)) { + return powerpc_accton_as5710_54x_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_accton_as5710_54x_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_accton_as5710_54x_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_accton_as5710_54x_config_settings[i].name, powerpc_accton_as5710_54x_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_enums.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_enums.c new file mode 100644 index 00000000..bef1c06d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_int.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_int.h new file mode 100644 index 00000000..671fe08b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * powerpc_accton_as5710_54x Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5710_54X_R0_INT_H__ +#define __POWERPC_ACCTON_AS5710_54X_R0_INT_H__ + +#include + + +#endif /* __POWERPC_ACCTON_AS5710_54X_R0_INT_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.c new file mode 100644 index 00000000..b489e43c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as5710_54x_log.h" +/* + * powerpc_accton_as5710_54x log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_ACCTON_AS5710_54X_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.h b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.h new file mode 100644 index 00000000..609ab550 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS5710_54X_R0_LOG_H__ +#define __POWERPC_ACCTON_AS5710_54X_R0_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_accton_as5710_54x +#include + +#endif /* __POWERPC_ACCTON_AS5710_54X_R0_LOG_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_module.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_module.c new file mode 100644 index 00000000..99a8238b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as5710_54x_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_ACCTON_AS5710_54X_R0_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_accton_as5710_54x_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_ucli.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_ucli.c new file mode 100644 index 00000000..e235b0bb --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/powerpc_accton_as5710_54x_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if POWERPC_ACCTON_AS5710_54X_R0_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +powerpc_accton_as5710_54x_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(powerpc_accton_as5710_54x) +} + +/* */ +/* */ + +static ucli_module_t +powerpc_accton_as5710_54x_ucli_module__ = + { + "powerpc_accton_as5710_54x_ucli", + NULL, + powerpc_accton_as5710_54x_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +powerpc_accton_as5710_54x_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&powerpc_accton_as5710_54x_ucli_module__); + n = ucli_node_create("powerpc_accton_as5710_54x", NULL, &powerpc_accton_as5710_54x_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("powerpc_accton_as5710_54x")); + return n; +} + +#else +void* +powerpc_accton_as5710_54x_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..58e2deba --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/psui.c @@ -0,0 +1,247 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +#define PSU_STATUS_PRESENT 1 +#define PSU_STATUS_POWER_GOOD 1 + +#define PSU_NODE_MAX_INT_LEN 8 +#define PSU_NODE_MAX_PATH_LEN 64 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static int +psu_status_info_get(int id, int is_ac, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU1_AC_HWMON_PREFIX : PSU1_DC_HWMON_PREFIX, node); + } + else if (PSU2_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU2_AC_HWMON_PREFIX : PSU2_DC_HWMON_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int +psu_cpr_4011_pmbus_info_get(int id, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); + } + else { + sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +int +onlp_psui_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_info_get(onlp_psu_info_t* info) +{ + int val = 0; + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_AC; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT); + + /* Read voltage, current and power */ + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_out", &val) == 0) { + info->mvout = val; + info->caps |= ONLP_PSU_CAPS_VOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_in", &val) == 0) { + info->mvin = val; + info->caps |= ONLP_PSU_CAPS_VIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_out", &val) == 0) { + info->miout = val; + info->caps |= ONLP_PSU_CAPS_IOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_in", &val) == 0) { + info->miin = val; + info->caps |= ONLP_PSU_CAPS_IIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_out", &val) == 0) { + info->mpout = val; + info->caps |= ONLP_PSU_CAPS_POUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_in", &val) == 0) { + info->mpin = val; + info->caps |= ONLP_PSU_CAPS_PIN; + } + + return ONLP_STATUS_OK; +} + +int +psu_um400d_info_get(onlp_psu_info_t* info) +{ + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_DC48; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = +{ + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, + }, + { + { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, + } +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int val = 0; + int ret = ONLP_STATUS_OK; + int index = ONLP_OID_ID_GET(id); + psu_type_t psu_type; + + VALIDATE(id); + + memset(info, 0, sizeof(onlp_psu_info_t)); + *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ + + /* Get the present state */ + if (psu_status_info_get(index, 1, "psu_present", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_present)\r\n", index); + } + + if (val != PSU_STATUS_PRESENT) { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + info->status |= ONLP_PSU_STATUS_PRESENT; + + + /* Get power good status */ + if (psu_status_info_get(index, 1, "psu_power_good", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index); + } + + if (val != PSU_STATUS_POWER_GOOD) { + info->status |= ONLP_PSU_STATUS_FAILED; + } + + + /* Get PSU type + */ + psu_type = get_psu_type(index, info->model, sizeof(info->model)); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + case PSU_TYPE_AC_B2F: + ret = psu_cpr_4011_info_get(info); + break; + case PSU_TYPE_DC_48V_F2B: + case PSU_TYPE_DC_48V_B2F: + ret = psu_um400d_info_get(info); + break; + default: + ret = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return ret; +} + +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..2f595a8d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,442 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#include /* For O_RDWR && open */ +#include +#include +#include +#include + +#include "platform_lib.h" + +static int +as5710_54x_sfp_node_read_int(char *node_path, int *value, int data_len) +{ + int ret = 0; + char buf[8] = {0}; + *value = 0; + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int set_active_port(int port) +{ + return deviceNodeWriteInt(SFP_HWMON_NODE(sfp_active_port), port, 0); +} + +/************************************************************ + * + * SFPI Entry Points + * + ***********************************************************/ +int +onlp_sfpi_init(void) +{ + /* Called at initialization time */ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Ports {0, 54} + */ + int p; + + for(p = 0; p < 54; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_port_map(int port, int* rport) +{ + /* + * The QSFP port numbering on the powerpc-as5710-54x-r0b platform + * differs from the numbering on the production + * powerpc-accton-as5710-54x-r0 platform. + * + * The R0B box numbers the front panel QSFP ports as follows: + * + * 49 50 + * 51 52 + * 53 54 + * + * The production box numbers the front panel QSFP ports as follows: + * + * 49 52 + * 50 53 + * 51 54 + * + * The kernel SFP driver for all 5710 platforms uses the production + * portmapping. When running on the R0B platform we need to convert + * the logical SFP port number (from the front panel) to the physical + * SFP port number used by the kernel driver. + * + * SFP port numbers here are 0-based. + */ + + if(platform_id == PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_R0) { + switch(port) + { + case 48: + case 53: + /* These QSFP ports are numbered the same on both platforms */ + *rport = port; break; + case 50: + *rport = 49; break; + case 52: + *rport = 50; break; + case 49: + *rport = 51; break; + case 51: + *rport = 52; break; + default: + /* All others are identical */ + *rport = port; break; + } + } + else { + *rport = port; + } + return ONLP_STATUS_OK; +} + +/** + * The CPLD registers on the AS5710 use the original R0B QSFP (horizontal) + * portmapping. + * + * While the SFP driver handles the remap correctly for sfp_active_port() + * for both the R0 and R0B. When we have to interpret the CPLD register + * values directly, however, we need to apply the correct mapping from R0B -> R0. + */ +static void +port_qsfp_cpld_map__(int port, int* rport) +{ + if(platform_id == PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_RX) { + switch(port) + { + case 53: + case 48: /* The same */ *rport = port; break; + + case 50: *rport = 49; break; + case 52: *rport = 50; break; + case 49: *rport = 51; break; + case 51: *rport = 52; break; + default: *rport = port; break; + } + } + else { + *rport = port; + } +} + +int +onlp_sfpi_is_present(int port) +{ + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + int present; + + if (set_active_port(port+1) != 0) { + AIM_LOG_ERROR("Unable to set active port to port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (as5710_54x_sfp_node_read_int(SFP_HWMON_NODE(sfp_is_present), &present, 1) != 0) { + AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port); + set_active_port(0); + return ONLP_STATUS_E_INTERNAL; + } + + set_active_port(0); + + return present; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[7]; + FILE* fp = fopen(SFP_HWMON_NODE(sfp_is_present_all), "r"); + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3, + bytes+4, + bytes+5, + bytes+6 + ); + fclose(fp); + if(count != 7) { + /* Likely a CPLD read timeout. */ + AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Mask out non-existant QSFP ports */ + bytes[6] &= 0x3F; + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint64_t presence_all = 0 ; + for(i = 6; i >= 0; i--) { + presence_all <<= 8; + presence_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; presence_all; i++) { + int p; + port_qsfp_cpld_map__(i, &p); + AIM_BITMAP_MOD(dst, p, (presence_all & 1)); + presence_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[7]; + FILE* fp = fopen(SFP_HWMON_NODE(sfp_rx_los_all), "r"); + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_rx_los_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3, + bytes+4, + bytes+5 + ); + fclose(fp); + if(count != 6) { + AIM_LOG_ERROR("Unable to read all fields from the sfp_rx_los_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint64_t rx_los_all = 0 ; + for(i = 5; i >= 0; i--) { + rx_los_all <<= 8; + rx_los_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; rx_los_all; i++) { + int p; + port_qsfp_cpld_map__(i, &p); + AIM_BITMAP_MOD(dst, p, (rx_los_all & 1)); + rx_los_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + memset(data, 0, 256); + + if (set_active_port(port+1) != 0) { + AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (deviceNodeReadBinary(SFP_HWMON_NODE(sfp_eeprom), (char*)data, 256, 256) != 0) { + AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port); + set_active_port(0); + return ONLP_STATUS_E_INTERNAL; + } + + set_active_port(0); + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_dom_read(int port, uint8_t data[256]) +{ + /* + * Read the SFP DOM page into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + memset(data, 0, 256); + + if (set_active_port(port+1) != 0) { + AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (deviceNodeReadBinary(SFP_HWMON_DOM_NODE(eeprom), (char*)data, 256, 256) != 0) { + AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port); + set_active_port(0); + return ONLP_STATUS_E_INTERNAL; + } + + set_active_port(0); + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) +{ + int rv; + + + if (port < 0 || port >= 48) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + /* Set SFP active port */ + if (set_active_port(port+1) != 0) { + AIM_LOG_ERROR("Unable to set active port to port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + switch(control) + { + case ONLP_SFP_CONTROL_TX_DISABLE: + { + if (deviceNodeWriteInt(SFP_HWMON_NODE(sfp_tx_disable), value, 0) != 0) { + AIM_LOG_ERROR("Unable to set tx_disable status to port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + default: + rv = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + set_active_port(0); + return rv; +} + +int +onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value) +{ + int rv; + + if (port < 0 || port >= 48) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + /* Set SFP active port */ + if (set_active_port(port+1) != 0) { + AIM_LOG_ERROR("Unable to set active port to port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + switch(control) + { + case ONLP_SFP_CONTROL_RX_LOS: + { + if (as5710_54x_sfp_node_read_int(SFP_HWMON_NODE(sfp_rx_loss), value, 1) != 0) { + AIM_LOG_ERROR("Unable to read rx_loss status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + case ONLP_SFP_CONTROL_TX_FAULT: + { + if (as5710_54x_sfp_node_read_int(SFP_HWMON_NODE(sfp_tx_fault), value, 1) != 0) { + AIM_LOG_ERROR("Unable to read tx_fault status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + case ONLP_SFP_CONTROL_TX_DISABLE: + { + if (as5710_54x_sfp_node_read_int(SFP_HWMON_NODE(sfp_tx_disable), value, 0) != 0) { + AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + default: + rv = ONLP_STATUS_E_UNSUPPORTED; + } + + set_active_port(0); + return rv; +} + + +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..ce7efa8d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,279 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include "assert.h" +#include +#include +#include +#include "powerpc_accton_as5710_54x_log.h" +#include +#include +#include +#include +#include +#include "platform_lib.h" + +#define HW_INFO_PATH "/dev/mtd1" +#define HW_INFO_LENGTH 2*65536 +uint8_t hw_info[HW_INFO_LENGTH]={0}; + +platform_id_t platform_id = PLATFORM_ID_UNKNOWN; + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-accton-as5710-54x-rX"; +} + +int +onlp_sysi_platform_set(const char* platform) +{ + if(strstr(platform, "powerpc-accton-as5710-54x-r")) { + platform_id = PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_RX; + return ONLP_STATUS_OK; + } + if(strstr(platform, "powerpc-as5710-54x-r0b")) { + platform_id = PLATFORM_ID_POWERPC_ACCTON_AS5710_54X_R0; + return ONLP_STATUS_OK; + } + AIM_LOG_ERROR("No support for platform '%s'", platform); + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_onie_data_phys_addr_get(void** physaddr) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ + int fd, len, nbytes=HW_INFO_LENGTH; + /* get hw info */ + if ((fd = open(HW_INFO_PATH, O_RDONLY)) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ((len = read(fd, hw_info, nbytes)) < 0) + { + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + /* If the read byte count is less, the format is different and calc will be wrong*/ + if ((close(fd) == -1) || (len != nbytes)) + { + return ONLP_STATUS_E_INTERNAL; + } + *data = hw_info; + return 0; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + int i; + int n_led=10, n_thermal=5, n_fan=5; + + assert(max > (n_led+n_thermal+n_fan)); + + /* 2 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + + /* LEDs Item */ + for (i=1; i<=n_led; i++) + { + *e++ = ONLP_LED_ID_CREATE(i); + } + + /* THERMALs Item */ + for (i=1; i<=n_thermal; i++) + { + *e++ = ONLP_THERMAL_ID_CREATE(i); + } + + /* Fans Item */ + for (i=1; i<=n_fan; i++) + { + *e++ = ONLP_FAN_ID_CREATE(i); + } + + return 0; +} + +/* + * 1. If any FAN failed, set all the other fans as full speed (100%) + * 2. When (LM75-1 + LM75-2)/2 >= 49.5 C, set fan speed from 40% to 65%. + * 3. When (LM75-1 + LM75-2)/2 >= 53C, set fan speed from 65% to 80% + * 4. When (LM75-1 + LM75-2)/2 >= 57.7C, set fan speed from 80% to 100% + + * 5. When (LM75-1 + LM75-2)/2 <= 52.7C, set fan speed from 100% to 80% + * 6. When (LM75-1 + LM75-2)/2 <= 47.7C, set fan speed from 80% to 65% + * 7. When (LM75-1 + LM75-2)/2 <= 42.7C, set fan speed from 65% to 40% + * 8. The default FAN speed is 40% + */ +int +onlp_sysi_platform_manage_fans(void) +{ +#define LEV1_UP_TEMP 57500 /*temperature*/ +#define LEV1_DOWN_TEMP NULL /* unused */ +#define LEV1_SPEED_PERC 100 /*percentage*/ + +#define LEV2_UP_TEMP 53000 +#define LEV2_DOWN_TEMP 52700 +#define LEV2_SPEED_PERC 80 + +#define LEV3_UP_TEMP 49500 +#define LEV3_DOWN_TEMP 47700 +#define LEV3_SPEED_PERC 65 + +#define LEV4_UP_TEMP NULL /* unused */ +#define LEV4_DOWN_TEMP 42700 +#define LEV4_SPEED_PERC 40 + +#define FAN_NUM_ON_MAIN_BROAD 5 + +#define LOCAL_DEBUG 0 + + int rc, i; + int is_up; + int new_temp, temp1, temp2, diff; + static int new_perc = 0, ori_perc = 0; + static int ori_temp = 0; + onlp_thermal_info_t thermal_info; + onlp_fan_info_t fan_info; + + /* get new temperature */ + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(3), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + temp1 = thermal_info.mcelsius; + + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(4), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + temp2 = thermal_info.mcelsius; + + new_temp = (temp1+temp2)/2; + + /* check fan status */ + for (i=1; i<=FAN_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if (fan_info.status & ONLP_FAN_STATUS_FAILED) + { + new_perc = LEV1_SPEED_PERC; + goto _CTRL; + } + } + + diff = new_temp - ori_temp; + + if (diff == 0) + goto _EXIT; + else + is_up = (diff > 0 ? 1 : 0); + + if (is_up) + { + if (new_temp >= LEV1_UP_TEMP) + new_perc = LEV1_SPEED_PERC; + else if (new_temp >= LEV2_UP_TEMP) + new_perc = LEV2_SPEED_PERC; + else if (new_temp >= LEV3_UP_TEMP) + new_perc = LEV3_SPEED_PERC; + else + new_perc = LEV4_SPEED_PERC; + } + else + { + if (new_temp <= LEV4_DOWN_TEMP) + new_perc = LEV4_SPEED_PERC; + else if (new_temp <= LEV3_DOWN_TEMP) + new_perc = LEV3_SPEED_PERC; + else if (new_temp <= LEV2_DOWN_TEMP) + new_perc = LEV2_SPEED_PERC; + else + new_perc = LEV1_SPEED_PERC; + } + +_CTRL : + + if (LOCAL_DEBUG) + printf("\n[DEBUG][%s][%d]{ori:temp=%d, perc=%d} {new:temp=%d, perc=%d}\n", __FUNCTION__, __LINE__, + ori_temp, ori_perc, new_temp, new_perc); + + if (ori_perc == new_perc) + goto _EXIT; + + /* ctrl fans */ + AIM_LOG_INFO("Fan Speeds are now at %d%%", new_perc); + + if ((rc = onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), new_perc)) != ONLP_STATUS_OK) + goto _EXIT; + + /* update om */ + ori_perc = new_perc; + ori_temp = new_temp; + +_EXIT : + + return rc; +} + +int +onlp_sysi_platform_manage_leds(void) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +#include + +int +onlp_sysi_platform_info_get(onlp_platform_info_t* pi) +{ + int v1, v2, v3; + + v1 = onlp_i2c_readb(3, 0x60, 1, ONLP_I2C_F_FORCE); + v2 = onlp_i2c_readb(3, 0x61, 1, ONLP_I2C_F_FORCE); + v3 = onlp_i2c_readb(3, 0x62, 1, ONLP_I2C_F_FORCE); + pi->cpld_versions = aim_fstrdup("%d.%d.%d", v1, v2, v3); + + return 0; +} + +void +onlp_sysi_platform_info_free(onlp_platform_info_t* pi) +{ + aim_free(pi->cpld_versions); +} diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..84ed7fb4 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,175 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include + + + +#define prefix_path "/sys/bus/i2c/devices/" +#define filename "temp1_input" +#define LOCAL_DEBUG 0 + + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +enum onlp_thermal_id +{ + THERMAL_RESERVED = 0, + THERMAL_1_ON_CPU_BROAD, + THERMAL_2_ON_CPU_BROAD, + THERMAL_1_ON_MAIN_BROAD, + THERMAL_2_ON_MAIN_BROAD, + THERMAL_3_ON_MAIN_BROAD, + THERMAL_1_ON_PSU1, + THERMAL_1_ON_PSU2, +}; + +static char last_path[][30] = /* must map with onlp_thermal_id */ +{ + "reserved", + "0-0018", + "0-0018/temp2_input", + "9-0048", + "10-0049", + "11-004a", + "5-003c/psu_temp1_input", + "6-003f/psu_temp1_input", +}; + + +/* Static values */ +static onlp_thermal_info_t linfo[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_CPU_BROAD), "Chassis Thermal Sensor 1 (Sensor on CPU board)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_CPU_BROAD), "Chassis Thermal Sensor 2 (Measurement point on CPU)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 3 (Front middle)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 4 (Rear right)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 5 (Front right)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(1)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 } +}; + + + + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) +{ + int fd, len, nbytes = 10, temp_base=1, local_id; + char r_data[10] = {0}; + char fullpath[50] = {0}; + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + /* get fullpath */ + if (strchr(last_path[local_id], '/') != NULL) + { + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + } + else + { + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + } + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[local_id]; + + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + info->mcelsius = atoi(r_data)/temp_base; + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius); + + + if (THERMAL_2_ON_CPU_BROAD == local_id) /* need to check fault status */ + { + /* get fullpath */ + sprintf(fullpath, "%s%s", prefix_path, "0-0018/temp2_fault"); + + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + if (atoi(r_data)>0) + info->status |= ONLP_THERMAL_STATUS_FAILED; + } + + return ONLP_STATUS_OK; +} + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/powerpc_accton_as5710_54x.doxy b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/powerpc_accton_as5710_54x.doxy new file mode 100644 index 00000000..34bf1d5b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/onlp/builds/src/powerpc_accton_as5710_54x.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "powerpc_accton_as5710_54x" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "powerpc_accton_as5710_54x" + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/PKG.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..c49f5030 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5710-54x-r0 diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/boot/powerpc-accton-as5710-54x-r0 b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/boot/powerpc-accton-as5710-54x-r0 new file mode 100644 index 00000000..47478956 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/boot/powerpc-accton-as5710-54x-r0 @@ -0,0 +1,13 @@ +############################################################ +# powerpc-accton-as5710-54x-r0 +############################################################ + +echo "fsl,dpaa.16/ethernet.17 ma1" > /etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd6 0x00000000 0x00002000 0x00020000" >> /etc/fw_env.config + + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/install/powerpc-accton-as5710-54x-r0.sh b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/install/powerpc-accton-as5710-54x-r0.sh new file mode 100644 index 00000000..5360379a --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/install/powerpc-accton-as5710-54x-r0.sh @@ -0,0 +1,33 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Installer scriptlet for the powerpc-as5710-54x +# + +# The loader must be written raw to the first partition. +platform_loader_raw=1 +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; usbboot 0x10000000 0:1; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-accton-as5710-54x-r0; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/powerpc-accton-as5710-54x-r0.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/powerpc-accton-as5710-54x-r0.yml new file mode 100644 index 00000000..90f6555e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/lib/powerpc-accton-as5710-54x-r0.yml @@ -0,0 +1,6 @@ +powerpc-accton-as5710-54x-r0: + flat_image_tree: + kernel: onl-kernel-3.8.13-powerpc-e500mc:powerpc, kernel-3.8.13-powerpc-e500mc.bin.gz + dtb: onl-kernel-3.8.13-powerpc-e500mc:powerpc, powerpc-accton-as5710-54x-r0.dtb + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/python/powerpc_accton_as5710_54x_r0/__init__.py b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/python/powerpc_accton_as5710_54x_r0/__init__.py new file mode 100644 index 00000000..aa528a4c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0/src/python/powerpc_accton_as5710_54x_r0/__init__.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +############################################################ +# +# +# +############################################################ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as5710_54x_r0(OnlPlatformAccton): + + CPLDVERSION="cpldversion" + + def model(self): + return "AS5710-54X" + + def platform(self): + return 'powerpc-accton-as5710-54x-r0' + + def sys_oid_platform(self): + return ".5710.54" + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/Makefile b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/PKG.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/PKG.yml new file mode 100644 index 00000000..f74c34c8 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/PKG.yml @@ -0,0 +1 @@ +!include $ONL/packages/base/any/templates/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as5710-54x-r0b diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/boot/powerpc-accton-as5710-54x-r0b b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/boot/powerpc-accton-as5710-54x-r0b new file mode 100644 index 00000000..011e60f6 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/boot/powerpc-accton-as5710-54x-r0b @@ -0,0 +1,13 @@ +############################################################ +# powerpc-accton-as5710-54x-r0b +############################################################ + +echo "fsl,dpaa.16/ethernet.17 ma1" > /etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd6 0x00000000 0x00002000 0x00020000" >> /etc/fw_env.config + + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/install/powerpc-accton-as5710-54x-r0b.sh b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/install/powerpc-accton-as5710-54x-r0b.sh new file mode 100644 index 00000000..5360379a --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/install/powerpc-accton-as5710-54x-r0b.sh @@ -0,0 +1,33 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Installer scriptlet for the powerpc-as5710-54x +# + +# The loader must be written raw to the first partition. +platform_loader_raw=1 +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; usbboot 0x10000000 0:1; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-accton-as5710-54x-r0; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/powerpc-accton-as5710-54x-r0b.yml b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/powerpc-accton-as5710-54x-r0b.yml new file mode 100644 index 00000000..fd73d578 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/lib/powerpc-accton-as5710-54x-r0b.yml @@ -0,0 +1,6 @@ +powerpc-accton-as5710-54x-r0b: + flat_image_tree: + kernel: onl-kernel-3.8.13-powerpc-e500mc:powerpc, kernel-3.8.13-powerpc-e500mc.bin.gz + dtb: onl-kernel-3.8.13-powerpc-e500mc:powerpc, powerpc-accton-as5710-54x-r0.dtb + + diff --git a/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/python/powerpc_accton_as5710_54x_r0b/__init__.py b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/python/powerpc_accton_as5710_54x_r0b/__init__.py new file mode 100644 index 00000000..bd9f9834 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as5710-54x/platform-config/r0b/src/python/powerpc_accton_as5710_54x_r0b/__init__.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +############################################################ +# +############################################################ +import os +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as5710_54x_r0b(OnlPlatformAccton): + + CPLDVERSION="cpldversion" + + def model(self): + return "AS5710-54X (R0B)" + + def platform(self): + return 'powerpc-accton-as5710-54x-r0b' + + def sys_oid_platform(self): + return ".5710.54" + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/.gitignore b/packages/platforms/accton/powerpc-accton-as6700-32x/.gitignore new file mode 100644 index 00000000..dae49ebb --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-as6700-32x-rX.mk +onlpdump.mk +powerpc_accton_as6700_32x.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/PKG.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/PKG.yml new file mode 100644 index 00000000..0e1b7302 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/PKG.yml @@ -0,0 +1,34 @@ +variables: + platformbase: powerpc-accton-as6700-32x + r0_install: /lib/platform-config/${platformbase}-r0/onl + r1_install: /lib/platform-config/${platformbase}-r1/onl + +common: + version: 1.0.0 + arch: powerpc + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + changelog: Change changes changes., + + +packages: + - name: onlp-${platformbase}-r0 + summary: ONLP Package for the ${platformbase}-r0 platform. + + files: + builds/lib/$BUILD_DIR/powerpc-linux-gnu/bin/libonlp-${platformbase}-rX.so : ${r0_install}/lib/libonlp-${platformbase}-r0.so + builds/onlpdump/$BUILD_DIR/powerpc-linux-gnu/bin/onlpdump : ${r0_install}/bin/ + + - name: onlp-${platformbase}-r1 + summary: ONLP Package for the ${platformbase}-r1 platform. + + files: + builds/lib/$BUILD_DIR/powerpc-linux-gnu/bin/libonlp-${platformbase}-rX.so : ${r1_install}/lib/libonlp-${platformbase}-r1.so + builds/onlpdump/$BUILD_DIR/powerpc-linux-gnu/bin/onlpdump : ${r1_install}/bin/ + + + + + + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/.gitignore b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/lib/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/lib/Makefile new file mode 100644 index 00000000..3ccb9886 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-as6700-32x-rX +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_accton_as6700_32x onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-accton-as6700-32x-rX.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..a06b4ad1 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp powerpc_accton_as6700_32x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/Makefile new file mode 100644 index 00000000..4a090665 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_accton_as6700_32x +AUTOMODULE := powerpc_accton_as6700_32x +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/README b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/README new file mode 100644 index 00000000..cfc1560e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# powerpc_accton_as6700_32x README +# +############################################################################### + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..f98a3664 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_accton_as6700_32x Autogeneration +# +############################################################################### +powerpc_accton_as6700_32x_AUTO_DEFS := module/auto/powerpc_accton_as6700_32x.yml +powerpc_accton_as6700_32x_AUTO_DIRS := module/inc/powerpc_accton_as6700_32x module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/powerpc_accton_as6700_32x.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/powerpc_accton_as6700_32x.yml new file mode 100644 index 00000000..11b3a8da --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/auto/powerpc_accton_as6700_32x.yml @@ -0,0 +1,47 @@ +############################################################################### +# +# powerpc_accton_as6700_32x Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB +- POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + POWERPC_ACCTON_AS6700_32X_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_accton_as6700_32x_config + + portingmacro: + POWERPC_ACCTON_AS6700_32X: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x.x b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x.x new file mode 100644 index 00000000..f5440c37 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_config.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_config.h new file mode 100644 index 00000000..a29caffb --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_config.h @@ -0,0 +1,127 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as6700_32x Configuration Header + * + * @addtogroup powerpc_accton_as6700_32x-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS6700_32X_CONFIG_H__ +#define __POWERPC_ACCTON_AS6700_32X_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING +#define POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB +#define POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI +#define POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_accton_as6700_32x_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_accton_as6700_32x_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_accton_as6700_32x_config_settings table. */ +extern powerpc_accton_as6700_32x_config_settings_t powerpc_accton_as6700_32x_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_accton_as6700_32x_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_accton_as6700_32x_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_accton_as6700_32x_porting.h" + +#endif /* __POWERPC_ACCTON_AS6700_32X_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_dox.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_dox.h new file mode 100644 index 00000000..98e9574b --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_accton_as6700_32x Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS6700_32X_DOX_H__ +#define __POWERPC_ACCTON_AS6700_32X_DOX_H__ + +/** + * @defgroup powerpc_accton_as6700_32x powerpc_accton_as6700_32x - powerpc_accton_as6700_32x Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_accton_as6700_32x-powerpc_accton_as6700_32x Public Interface + * @defgroup powerpc_accton_as6700_32x-config Compile Time Configuration + * @defgroup powerpc_accton_as6700_32x-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_ACCTON_AS6700_32X_DOX_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h new file mode 100644 index 00000000..49a49125 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_accton_as6700_32x Porting Macros. + * + * @addtogroup powerpc_accton_as6700_32x-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS6700_32X_PORTING_H__ +#define __POWERPC_ACCTON_AS6700_32X_PORTING_H__ + + +/* */ +#if POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_MALLOC + #if defined(GLOBAL_MALLOC) + #define POWERPC_ACCTON_AS6700_32X_MALLOC GLOBAL_MALLOC + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_MALLOC malloc + #else + #error The macro POWERPC_ACCTON_AS6700_32X_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_FREE + #if defined(GLOBAL_FREE) + #define POWERPC_ACCTON_AS6700_32X_FREE GLOBAL_FREE + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_FREE free + #else + #error The macro POWERPC_ACCTON_AS6700_32X_FREE is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_ACCTON_AS6700_32X_MEMSET GLOBAL_MEMSET + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_MEMSET memset + #else + #error The macro POWERPC_ACCTON_AS6700_32X_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_ACCTON_AS6700_32X_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_MEMCPY memcpy + #else + #error The macro POWERPC_ACCTON_AS6700_32X_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_ACCTON_AS6700_32X_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_STRNCPY strncpy + #else + #error The macro POWERPC_ACCTON_AS6700_32X_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_ACCTON_AS6700_32X_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_ACCTON_AS6700_32X_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_ACCTON_AS6700_32X_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_SNPRINTF snprintf + #else + #error The macro POWERPC_ACCTON_AS6700_32X_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_ACCTON_AS6700_32X_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_ACCTON_AS6700_32X_STRLEN GLOBAL_STRLEN + #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_ACCTON_AS6700_32X_STRLEN strlen + #else + #error The macro POWERPC_ACCTON_AS6700_32X_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_ACCTON_AS6700_32X_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/make.mk b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..9a2a3a88 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_accton_as6700_32x_INCLUDES := -I $(THIS_DIR)inc +powerpc_accton_as6700_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_accton_as6700_32x_DEPENDMODULE_ENTRIES := init:powerpc_accton_as6700_32x + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..44d7258c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/fani.c @@ -0,0 +1,444 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +#include +#include "platform_lib.h" + +#define PREFIX_PATH_ON_MAIN_BROAD "/sys/class/hwmon/hwmon8/" +#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/" + +#define MAX_FAN_SPEED 15000 +#define MAX_PSU_FAN_SPEED 18000 + +#define LOCAL_DEBUG 0 + + +#define FAN_RESERVED 0 +#define FAN_1_ON_MAIN_BROAD 1 +#define FAN_2_ON_MAIN_BROAD 2 +#define FAN_3_ON_MAIN_BROAD 3 +#define FAN_4_ON_MAIN_BROAD 4 +#define FAN_5_ON_MAIN_BROAD 5 +#define FAN_1_ON_PSU1 6 +#define FAN_1_ON_PSU2 7 + +#define PROJECT_NAME accton_as6700_32x_ + +#define LEN_FILE_NAME 40 + +typedef struct last_path_S +{ + char speed_rpm[LEN_FILE_NAME]; + char a_speed_rpm[LEN_FILE_NAME]; + char direction[LEN_FILE_NAME]; + char fault[LEN_FILE_NAME]; + char duty_cycle_level[LEN_FILE_NAME]; + char duty_cycle_percentage[LEN_FILE_NAME]; +}last_path_T; + +#define _MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) \ + { #prj"fan"#id"_speed_rpm", #prj"fan"#id"a_speed_rpm", #prj"fan"#id"_direction", "", #prj"fan_duty_cycle_level", ""} + +#define MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) _MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(prj,id) + +#define MAKE_FAN_LAST_PATH_ON_PSU(folder) \ + { #folder"/psu_fan1_speed_rpm", "", "", #folder"/psu_fan1_fault", "", #folder"/psu_fan1_duty_cycle_percentage"} + +static last_path_T last_path[] = /* must map with onlp_fan_id */ +{ + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_RESERVED), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_1_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_2_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_3_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_4_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_MAIN_BROAD(PROJECT_NAME, FAN_5_ON_MAIN_BROAD), + MAKE_FAN_LAST_PATH_ON_PSU(6-003d), + MAKE_FAN_LAST_PATH_ON_PSU(6-003e), +}; + +#define MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BROAD), "Chassis Fan "#id, 0 }, \ + 0x0, \ + (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + +#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \ + 0x0, \ + 0, \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + + +/* Static fan information */ +onlp_fan_info_t linfo[] = { + { }, /* Not used */ + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(1), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(2), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(3), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(4), + MAKE_FAN_INFO_NODE_ON_MAIN_BROAD(5), + MAKE_FAN_INFO_NODE_ON_PSU(1,1), + MAKE_FAN_INFO_NODE_ON_PSU(2,1), +}; + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +/* PSU relative marco */ +#define SET_PSU_TYPE_CPR_4011_F2B_FAN(info) \ + info->status = (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); \ + info->caps = (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE) + +#define SET_PSU_TYPE_CPR_4011_B2F_FAN(info) \ + info->status = (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ + info->caps = (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE) + +#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ + info->status = (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) + +#define SET_PSU_TYPE_UM400D_B2F_FAN(info) \ + info->status = (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F) + + +static int +_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) +{ + int fd, len, nbytes = 10; + char r_data[10] = {0}; + int t_ra_data = 0, t_r_data = 0; + char fullpath[65] = {0}; + + /* get fan/fanr fault status (turn on when any one fails) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].speed_rpm); + OPEN_READ_FILE(fd, fullpath, r_data, nbytes, len); + + t_ra_data = atoi(r_data); + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].a_speed_rpm); + OPEN_READ_FILE(fd, fullpath, r_data, nbytes, len); + + t_r_data = atoi(r_data); + + if ( t_ra_data == 0 || t_r_data == 0 ) + info->status |= ONLP_FAN_STATUS_FAILED; + + if ( t_ra_data > 0 || t_r_data > 0 ) + { + info->status |= ONLP_FAN_STATUS_PRESENT; + } + + if ( t_ra_data >= t_r_data ) + { + info->rpm = t_r_data; + } + else + { + info->rpm = t_ra_data; + } + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].direction); + OPEN_READ_FILE(fd, fullpath, r_data,nbytes, len); + + if (atoi(r_data) == 0) /*B2F*/ + info->status |= ONLP_FAN_STATUS_F2B; + else + info->status |= ONLP_FAN_STATUS_B2F; + + info->percentage = info->rpm * 100 / MAX_FAN_SPEED; + + return ONLP_STATUS_OK; +} + + +static int +_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) +{ + int psu_id, is_ac=0; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[50] = {0}; + psu_type_t psu_type; + + /* get fan other cap status according to psu type + */ + psu_id = (local_id-FAN_1_ON_PSU1) + 1; + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id); + + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type); + + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + SET_PSU_TYPE_CPR_4011_F2B_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_AC_B2F: + SET_PSU_TYPE_CPR_4011_B2F_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_DC_48V_F2B: + SET_PSU_TYPE_UM400D_F2B_FAN(info); + break; + case PSU_TYPE_DC_48V_B2F: + SET_PSU_TYPE_UM400D_B2F_FAN(info); + break; + default: + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + + break; + } + + if (1 == is_ac) + { + /* get fan fault status + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].fault); + OPEN_READ_FILE(fd ,fullpath, r_data, nbytes, len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan rpm + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed_rpm); + OPEN_READ_FILE(fd, fullpath, r_data, nbytes, len); + info->rpm = atoi(r_data); + info->percentage = info->rpm * 100 / MAX_PSU_FAN_SPEED; + } + + return ONLP_STATUS_OK; +} + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + int rc = 0; + int local_id; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + *info = linfo[local_id]; + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + break; + + default: + rc =_onlp_fani_info_get_fan(local_id, info); + break; + } + + return rc; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + int fd, len, nbytes=10, local_id; + char data[10] = {0}; + char fullpath[70] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + if (p == 0) /* reject p=0 */ + { + return ONLP_STATUS_E_INVALID; + } + + /* get fullpath */ + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].duty_cycle_percentage); + break; + default: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BROAD, last_path[local_id].duty_cycle_level); + + /* normal fan power level and percentage. + * set fan power level by fuzzy control method + * {{0x00, 0}, {0x03, 37.5}, {0x04, 50}, {0x05, 62.5}, {0x06, 75}, {0x07, 100}}; + */ + if ( (0 < p) && (p < 38) ) + { + p = 3; + } + else if ( (38 <= p) && (p < 50) ) + { + p = 3; + } + else if ( (50 <= p) && (p < 63) ) + { + p = 4; + } + else if ( (63 <= p) && (p < 75) ) + { + p = 5; + } + else if ( (75 <= p) && (p < 100) ) + { + p = 6; + } + else if ( p ==100 ) + { + p = 7; + } + + break; + } + + sprintf(data, "%d", p); + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..f55d6c77 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,346 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + ***********************************************************/ +#include +#include +#include +#include +#include + +#include + +//#include "onlpie_int.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ +/* +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_AMBER, + LED_MODE_GREEN, + LED_MODE_AMBER_BLINK, + LED_MODE_GREEN_BLINK, + LED_MODE_AUTO, +};*/ +enum led_light_mode { + /* system led mode */ + LED_MODE_SYSTEM_OFF = 0, + LED_MODE_SYSTEM_GREEN_BLINK, + LED_MODE_SYSTEM_GREEN, + LED_MODE_SYSTEM_OFF_2, + + /* alarm led mode */ + LED_MODE_ALARM_OFF = 0, + LED_MODE_ALARM_RED_BLINK, + LED_MODE_ALARM_GREEN, + LED_MODE_ALARM_OFF_2, + + /* fan led mode */ + LED_MODE_FAN_GREEN = 0, + LED_MODE_FAN_RED +}; + + +int led_light_map_mode[][2] = +{ + {LED_MODE_SYSTEM_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_SYSTEM_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, + {LED_MODE_SYSTEM_GREEN, ONLP_LED_MODE_GREEN}, + {LED_MODE_SYSTEM_OFF_2, 0}, + + {LED_MODE_ALARM_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_ALARM_GREEN, ONLP_LED_MODE_GREEN}, + {LED_MODE_ALARM_RED_BLINK, ONLP_LED_MODE_RED_BLINKING}, + {LED_MODE_ALARM_OFF_2, 0}, + + {LED_MODE_FAN_RED, ONLP_LED_MODE_RED}, + {LED_MODE_FAN_GREEN, ONLP_LED_MODE_GREEN}, +}; + + +#define led_prefix_path "/sys/class/leds/accton_as6700_32x_led::" +#define led_filename "brightness" + +typedef enum onlp_led_id +{ + LED_RESERVED = 0, + LED_SYSTEM, + LED_ALARM, + LED_FAN1, + LED_FAN2, + LED_FAN3, + LED_FAN4, + LED_FAN5, +} onlp_led_id_t; + +static char onlp_led_node_subname[][10] = /* must map with onlp_led_id */ +{ + "reserved", + "system", + "alarm", + "fan1", + "fan2", + "fan3", + "fan4", + "fan5", +}; + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = +{ + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(LED_SYSTEM), "system", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_GREEN_BLINKING | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_ALARM), "alarm", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED_BLINKING | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN1), "fan1", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN2), "fan2", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN3), "fan3", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN4), "fan4", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN5), "fan5", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, +}; + + +static int conver_led_light_mode_to_onl(uint32_t id, int led_ligth_mode) +{ + int i, nsize,offset; + + switch(id) + { + case LED_SYSTEM: + nsize= 4; + offset=0; + break; + case LED_ALARM: + nsize= 8; + offset=4; + break; + case LED_FAN1: + case LED_FAN2: + case LED_FAN3: + case LED_FAN4: + case LED_FAN5: + nsize= 10; + offset=8; + break; + default: + return 0; + } + /*nsize= sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]);*/ + for(i=offset; imode = conver_led_light_mode_to_onl(ONLP_OID_ID_GET(id),atoi(data)); + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + VALIDATE(id); + + if (!on_or_off) { + return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int fd, len, driver_mode, nbytes=1; + char data[2] = {0}; + char fullpath[50] = {0}; + + VALIDATE(id); + + sprintf(fullpath, "%s%s/%s", led_prefix_path, onlp_led_node_subname[ONLP_OID_ID_GET(id)], led_filename); + + driver_mode = conver_led_light_mode_to_driver(ONLP_OID_ID_GET(id),mode); + sprintf(data, "%d", driver_mode); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY | O_CREAT, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..9c2543c2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := powerpc_accton_as6700_32x +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..a625c2de --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,164 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeWriteInt(char *filename, int value, int data_len) +{ + char buf[8] = {0}; + sprintf(buf, "%d", value); + + return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len); +} + +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_RDONLY)) == -1) { + return -1; + } + + if ((len = read(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len) +{ + int ret; + + if (data_len >= buf_size) { + return -1; + } + + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); + + if (ret == 0) { + buffer[buf_size-1] = '\0'; + } + + return ret; +} + +#define I2C_PSU_MODEL_NAME_LEN 13 + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len) +{ + char *node = NULL; + char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; + + /* Check AC model name */ + node = (id == PSU1_ID) ? PSU2_AC_HWMON_NODE(psu_model_name) : PSU1_AC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_F2B; + } + else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_B2F; + } + } + + /* Check DC model name */ + memset(model_name, 0, sizeof(model_name)); + node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_model_name) : PSU2_DC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_B2F; + } + else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_F2B; + } + } + + return PSU_TYPE_UNKNOWN; +} + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..f355ab66 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,77 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +#include "powerpc_accton_as6700_32x_log.h" + +#define PSU1_ID 1 +#define PSU2_ID 2 + +#define CHASSIS_FAN_COUNT 5 +#define CHASSIS_THERMAL_COUNT 8 +#define CHASSIS_SFP_COUNT 32 + +#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/6-003e/" +#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/6-003d/" + +#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/6-003a/" +#define PSU1_DC_HWMON_PREFIX "/sys/bus/i2c/devices/6-0052/" +#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/6-0039/" +#define PSU2_DC_HWMON_PREFIX "/sys/bus/i2c/devices/6-0051/" + +#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node +#define PSU1_DC_HWMON_NODE(node) PSU1_DC_HWMON_PREFIX#node +#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node +#define PSU2_DC_HWMON_NODE(node) PSU2_DC_HWMON_PREFIX#node + +#define SFP_MAP_API_2_FRONT_PORT(api_port) (api_port +1 ) +#define SFP_EEPROM_PREFIX "/sys/bus/i2c/drivers/acc_as6700_32x_sfp/1-0050/" +#define SFP_EEPROM_NODE(node) SFP_EEPROM_PREFIX#node + +int deviceNodeWriteInt(char *filename, int value, int data_len); +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len); +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len); + +typedef enum psu_type { + PSU_TYPE_UNKNOWN, + PSU_TYPE_AC_F2B, + PSU_TYPE_AC_B2F, + PSU_TYPE_DC_48V_F2B, + PSU_TYPE_DC_48V_B2F +} psu_type_t; + +typedef enum sfp_tranceiver_cable_type_e { + SFP_TRANCEIVER_CABLE_TYPE_FIBER=0, + SFP_TRANCEIVER_CABLE_TYPE_COPPER_1M=1, + SFP_TRANCEIVER_CABLE_TYPE_COPPER_3M=3, + SFP_TRANCEIVER_CABLE_TYPE_COPPER_5M=5, + SFP_TRANCEIVER_CABLE_TYPE_COPPER_7M=7 +} sfp_tranceiver_cable_type_t; + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len); + +#endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_config.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_config.c new file mode 100644 index 00000000..f42df2d2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_config.c @@ -0,0 +1,76 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(_x) __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(_x) +powerpc_accton_as6700_32x_config_settings_t powerpc_accton_as6700_32x_config_settings[] = +{ +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_LOGGING(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI + { __powerpc_accton_as6700_32x_config_STRINGIFY_NAME(POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI), __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE(POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_ACCTON_AS6700_32X_CONFIG_INCLUDE_UCLI(__powerpc_accton_as6700_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_accton_as6700_32x_config_STRINGIFY_VALUE +#undef __powerpc_accton_as6700_32x_config_STRINGIFY_NAME + +const char* +powerpc_accton_as6700_32x_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_accton_as6700_32x_config_settings[i].name; i++) { + if(strcmp(powerpc_accton_as6700_32x_config_settings[i].name, setting)) { + return powerpc_accton_as6700_32x_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_accton_as6700_32x_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_accton_as6700_32x_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_accton_as6700_32x_config_settings[i].name, powerpc_accton_as6700_32x_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_enums.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_enums.c new file mode 100644 index 00000000..8b625124 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_int.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_int.h new file mode 100644 index 00000000..b98f672e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * powerpc_accton_as6700_32x Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS6700_32X_INT_H__ +#define __POWERPC_ACCTON_AS6700_32X_INT_H__ + +#include + + +#endif /* __POWERPC_ACCTON_AS6700_32X_INT_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.c new file mode 100644 index 00000000..8e45b590 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as6700_32x_log.h" +/* + * powerpc_accton_as6700_32x log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_ACCTON_AS6700_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.h b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.h new file mode 100644 index 00000000..4732f22d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_ACCTON_AS6700_32X_LOG_H__ +#define __POWERPC_ACCTON_AS6700_32X_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_accton_as6700_32x +#include + +#endif /* __POWERPC_ACCTON_AS6700_32X_LOG_H__ */ diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_module.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_module.c new file mode 100644 index 00000000..6f7e4cca --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/powerpc_accton_as6700_32x_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_accton_as6700_32x_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_ACCTON_AS6700_32X_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_accton_as6700_32x_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..58e2deba --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/psui.c @@ -0,0 +1,247 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +#define PSU_STATUS_PRESENT 1 +#define PSU_STATUS_POWER_GOOD 1 + +#define PSU_NODE_MAX_INT_LEN 8 +#define PSU_NODE_MAX_PATH_LEN 64 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static int +psu_status_info_get(int id, int is_ac, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU1_AC_HWMON_PREFIX : PSU1_DC_HWMON_PREFIX, node); + } + else if (PSU2_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU2_AC_HWMON_PREFIX : PSU2_DC_HWMON_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int +psu_cpr_4011_pmbus_info_get(int id, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); + } + else { + sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +int +onlp_psui_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_info_get(onlp_psu_info_t* info) +{ + int val = 0; + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_AC; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT); + + /* Read voltage, current and power */ + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_out", &val) == 0) { + info->mvout = val; + info->caps |= ONLP_PSU_CAPS_VOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_in", &val) == 0) { + info->mvin = val; + info->caps |= ONLP_PSU_CAPS_VIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_out", &val) == 0) { + info->miout = val; + info->caps |= ONLP_PSU_CAPS_IOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_in", &val) == 0) { + info->miin = val; + info->caps |= ONLP_PSU_CAPS_IIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_out", &val) == 0) { + info->mpout = val; + info->caps |= ONLP_PSU_CAPS_POUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_in", &val) == 0) { + info->mpin = val; + info->caps |= ONLP_PSU_CAPS_PIN; + } + + return ONLP_STATUS_OK; +} + +int +psu_um400d_info_get(onlp_psu_info_t* info) +{ + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_DC48; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = +{ + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, + }, + { + { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, + } +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int val = 0; + int ret = ONLP_STATUS_OK; + int index = ONLP_OID_ID_GET(id); + psu_type_t psu_type; + + VALIDATE(id); + + memset(info, 0, sizeof(onlp_psu_info_t)); + *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ + + /* Get the present state */ + if (psu_status_info_get(index, 1, "psu_present", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_present)\r\n", index); + } + + if (val != PSU_STATUS_PRESENT) { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + info->status |= ONLP_PSU_STATUS_PRESENT; + + + /* Get power good status */ + if (psu_status_info_get(index, 1, "psu_power_good", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index); + } + + if (val != PSU_STATUS_POWER_GOOD) { + info->status |= ONLP_PSU_STATUS_FAILED; + } + + + /* Get PSU type + */ + psu_type = get_psu_type(index, info->model, sizeof(info->model)); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + case PSU_TYPE_AC_B2F: + ret = psu_cpr_4011_info_get(info); + break; + case PSU_TYPE_DC_48V_F2B: + case PSU_TYPE_DC_48V_B2F: + ret = psu_um400d_info_get(info); + break; + default: + ret = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return ret; +} + +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..e5044f2d --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,262 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#include /* For O_RDWR && open */ +#include +#include +#include +#include + +#include "platform_lib.h" + +static int +as6700_32x_sfp_node_read_int(char *node_path, int *value, int data_len) +{ + int ret = 0; + char buf[8] = {0}; + *value = 0; + + memset(buf, '\0', sizeof(buf)); + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int set_active_port(int front_port) +{ + return deviceNodeWriteInt(SFP_EEPROM_NODE(sfp_active_port), front_port, 0); +} + +static int set_equalizer_type(int type) +{ + return deviceNodeWriteInt(SFP_EEPROM_NODE(sfp_equalizer), type, 0); +} + +/************************************************************ + * + * SFPI Entry Points + * + ***********************************************************/ +int +onlp_sfpi_init(void) +{ + /* Called at initialization time */ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Ports {0, CHASSIS_SFP_COUNT} + */ + int p; + + for(p = 0; p < CHASSIS_SFP_COUNT; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_is_present(int port) +{ + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + int present = 0, front_port=0; + + front_port=SFP_MAP_API_2_FRONT_PORT(port); + if (set_active_port(front_port) < 0) { + AIM_LOG_ERROR("Unable to set active port to port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (as6700_32x_sfp_node_read_int(SFP_EEPROM_NODE(sfp_is_present), &present, 1) != 0) { + AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return present; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[4]; + FILE* fp = fopen(SFP_EEPROM_NODE(sfp_is_present_all), "r"); + + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3 + ); + fclose(fp); + if(count != AIM_ARRAYSIZE(bytes)) { + /* Likely a CPLD read timeout. */ + AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint32_t presence_all = 0 ; + for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { + presence_all <<= 8; + presence_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; presence_all; i++) { + AIM_BITMAP_MOD(dst, i, (presence_all & 1)); + presence_all >>= 1; + } + + return ONLP_STATUS_OK; +} + + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + int front_port=0; + + memset(data, 0, 256); + + front_port=SFP_MAP_API_2_FRONT_PORT(port); + if (set_active_port(front_port) < 0) { + AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (deviceNodeReadBinary(SFP_EEPROM_NODE(sfp_eeprom), (char*)data, 256, 256) != 0) { + AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_post_insert(int port, sff_info_t* info) +{ + /* + * IF any platform-programming must be performed based + * on the actual SFP that was inserted (for example, custom equalizer settings) + * then it should be performed by this function. + * + * If not custom programming must be performed, then do nothing. + * This function is optional. + */ + int front_port=0; + sfp_tranceiver_cable_type_t cable_type = SFP_TRANCEIVER_CABLE_TYPE_FIBER; + + switch(info->media_type) + { + case SFF_MEDIA_TYPE_FIBER: + cable_type = SFP_TRANCEIVER_CABLE_TYPE_FIBER; + break; + + case SFF_MEDIA_TYPE_COPPER: + switch(info->length) + { + case 1: + case 2: + AIM_LOG_MSG("Port %d EQ 1M", port); + cable_type = SFP_TRANCEIVER_CABLE_TYPE_COPPER_1M; + break; + case 3: + case 4: + AIM_LOG_MSG("Port %d EQ 3M", port); + cable_type = SFP_TRANCEIVER_CABLE_TYPE_COPPER_3M; break; + case 5: + case 6: + AIM_LOG_MSG("Port %d EQ 5M", port); + cable_type = SFP_TRANCEIVER_CABLE_TYPE_COPPER_5M; break; + case 7: + AIM_LOG_MSG("Port %d EQ 7M", port); + cable_type = SFP_TRANCEIVER_CABLE_TYPE_COPPER_7M; break; + default: + AIM_LOG_MSG("Port %d EQ 7M (MAX)", port); + /* Nothing beyond 7M is supported. Best we can do is use the 7M settings. */ + cable_type = SFP_TRANCEIVER_CABLE_TYPE_COPPER_7M; break; + } + break; + + default: + AIM_LOG_WARN("port(%d) media_type(%d) length(%d) is not supported\r\n", + port, info->media_type, info->length); + return ONLP_STATUS_E_INTERNAL; + } + + + front_port=SFP_MAP_API_2_FRONT_PORT(port); + if (set_active_port(front_port) < 0) { + AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + if (set_equalizer_type(cable_type) < 0) { + AIM_LOG_ERROR("Unable to set port(%d) media_type(%d) length(%d)\r\n", + port, info->media_type, info->length); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..edb3ccd7 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,460 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "powerpc_accton_as6700_32x_log.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HW_INFO_PATH "/dev/mtd3" +#define HW_INFO_LENGTH 65536 + +#define THERMAL_NUM_ON_MAIN_BROAD 8 +#define FAN_NUM_ON_MAIN_BROAD 5 + +typedef enum +{ + HPC_THERMAL_POLICY_NONE = 0, + HPC_THERMAL_POLICY_REDUNDANT_ISKU, + HPC_THERMAL_POLICY_REDUNDANT_ESKU, + HPC_THERMAL_POLICY_NONREDUNDANT_ISKU, + HPC_THERMAL_POLICY_NONREDUNDANT_ESKU, + HPC_THERMAL_POLICY_MISMATCH_ISKU, + HPC_THERMAL_POLICY_MISMATCH_ESKU, + HPC_THERMAL_POLICY_SHUTDOWAN, +} HPC_THERMAL_POLICY_t; + +typedef struct thermalPolicyTemp +{ + HPC_THERMAL_POLICY_t policy; + int tempCritical; /* Tc */ + int tempWarning; /* Ta */ + int tempNormal; /* Tb */ + unsigned char fanLowSpeed; + unsigned char fanHighSpeed; +} thermalPolicyTemp_t; + +thermalPolicyTemp_t thermalPolicyTempData[] = { + {HPC_THERMAL_POLICY_MISMATCH_ESKU, 79, 68, 62, 0x5, 0x7}, + {HPC_THERMAL_POLICY_MISMATCH_ISKU, 70, 63, 57, 0x5, 0x7}, + {HPC_THERMAL_POLICY_NONREDUNDANT_ESKU, 82, 71, 65, 0x5, 0x7}, + {HPC_THERMAL_POLICY_NONREDUNDANT_ISKU, 73, 66, 60, 0x5, 0x7}, + {HPC_THERMAL_POLICY_REDUNDANT_ESKU, 78, 67, 61, 0x4, 0x7}, + {HPC_THERMAL_POLICY_REDUNDANT_ISKU, 70, 60, 55, 0x4, 0x7} +}; + +typedef struct thermalPolicyFanCount +{ + int numofIntakeFan; + int numofExhaustFan; + int numofIntakePsu; + int numofExhaustPsu; + HPC_THERMAL_POLICY_t policy; +} thermalPolicyFanCount_t; + +thermalPolicyFanCount_t thermalPolicyFanData[] = { + {4, 0, 1, 0, HPC_THERMAL_POLICY_NONREDUNDANT_ISKU}, + {5, 0, 1, 0, HPC_THERMAL_POLICY_NONREDUNDANT_ISKU}, + {4, 0, 2, 0, HPC_THERMAL_POLICY_NONREDUNDANT_ISKU}, + {0, 4, 0, 1, HPC_THERMAL_POLICY_NONREDUNDANT_ESKU}, + {0, 5, 0, 1, HPC_THERMAL_POLICY_NONREDUNDANT_ESKU}, + {0, 4, 0, 2, HPC_THERMAL_POLICY_NONREDUNDANT_ESKU}, + {5, 0, 2, 0, HPC_THERMAL_POLICY_REDUNDANT_ISKU}, + {0, 5, 0, 2, HPC_THERMAL_POLICY_REDUNDANT_ESKU}, + {4, 1, 1, 0, HPC_THERMAL_POLICY_MISMATCH_ISKU}, + {1, 4, 0, 1, HPC_THERMAL_POLICY_MISMATCH_ESKU}, + {4, 1, 2, 0, HPC_THERMAL_POLICY_MISMATCH_ISKU}, + {1, 4, 0, 2, HPC_THERMAL_POLICY_MISMATCH_ESKU}, + {4, 0, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ISKU}, + {0, 4, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ESKU}, + {5, 0, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ISKU}, + {0, 5, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ESKU}, + {4, 1, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ISKU}, + {1, 4, 1, 1, HPC_THERMAL_POLICY_MISMATCH_ESKU} +}; + +uint8_t hw_info[HW_INFO_LENGTH]={0}; + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-accton-as6700-rX"; +} + + +int +onlp_sysi_onie_data_phys_addr_get(void** physaddr) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ + int fd, len, nbytes=HW_INFO_LENGTH; + /* get hw info */ + if ((fd = open(HW_INFO_PATH, O_RDONLY)) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ((len = read(fd, hw_info, nbytes)) < 0) + { + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + /* If the read byte count is less, the format is different and calc will be wrong*/ + if ((close(fd) == -1) || (len != nbytes)) + { + return ONLP_STATUS_E_INTERNAL; + } + *data = hw_info; + return 0; +} + +int +onlp_sysi_platform_set(const char* platform) +{ + if(strstr(platform, "powerpc-accton-as6700-32x-r")) { + return ONLP_STATUS_OK; + } + if(strstr(platform, "powerpc-as6700-32x-r")) { + return ONLP_STATUS_OK; + } + AIM_LOG_ERROR("No support for platform '%s'", platform); + return ONLP_STATUS_E_UNSUPPORTED; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + int i; + int n_thermal = THERMAL_NUM_ON_MAIN_BROAD, n_fan = FAN_NUM_ON_MAIN_BROAD; + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* THERMALs Item */ + /* Sensor status and temperature, + the temp1 does not have temp_fault.*/ + for (i=1; i<= n_thermal; i++) + { + *e++ = ONLP_THERMAL_ID_CREATE(i); + } + + for (i=1; i<= n_fan; i++) + { + *e++ = ONLP_FAN_ID_CREATE(i); + } + + /* 7 LEDs */ + *e++ = ONLP_LED_ID_CREATE(1); + *e++ = ONLP_LED_ID_CREATE(2); + *e++ = ONLP_LED_ID_CREATE(3); + *e++ = ONLP_LED_ID_CREATE(4); + *e++ = ONLP_LED_ID_CREATE(5); + *e++ = ONLP_LED_ID_CREATE(6); + *e++ = ONLP_LED_ID_CREATE(7); + + /* 2 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + + return 0; +} + +int +onlp_sysi_platform_manage_fans(void) +{ +#define PSU_NUM_ON_MAIN_BROAD 2 +#define FAN_NUM_ON_MAIN_BROAD_AND_PSU FAN_NUM_ON_MAIN_BROAD + PSU_NUM_ON_MAIN_BROAD +#define SYS_TEMPERATURE_MULTIPLIER 1000 +#define LOCAL_DEBUG 0 + + unsigned char new_level; + static int new_perc = 0; + int rc, i; + int num_of_i_fan_present = 0, num_of_e_fan_present = 0; + int num_of_psu_i_fan_present = 0, num_of_psu_e_fan_present = 0; + float max_temp = 0; + static unsigned char ori_level = 0; + onlp_thermal_info_t thermal_info; + onlp_fan_info_t fan_info; + HPC_THERMAL_POLICY_t policy = HPC_THERMAL_POLICY_NONE; + + /* check thermal status */ + for (i=1; i<= THERMAL_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(i), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][number of fan: %d]\n", __FUNCTION__, __LINE__, thermal_info.mcelsius); + + if (i == 1) /* TR1_CPU_TCASE = TR1_CPU_TJ -15C */ + max_temp = thermal_info.mcelsius - 15 * SYS_TEMPERATURE_MULTIPLIER; + else if (max_temp < thermal_info.mcelsius) + max_temp = thermal_info.mcelsius; + } + + /* check fan status */ + for (i=1; i<=FAN_NUM_ON_MAIN_BROAD_AND_PSU; i++) + { + if ((rc = onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if ((i<= FAN_NUM_ON_MAIN_BROAD) && (fan_info.status&ONLP_FAN_STATUS_PRESENT)) + { + if (fan_info.status&ONLP_FAN_STATUS_F2B) + { + num_of_i_fan_present++; + } + else if (fan_info.status&ONLP_FAN_STATUS_B2F) + { + num_of_e_fan_present++; + } + } + else if ((FAN_NUM_ON_MAIN_BROAD < i) && (fan_info.status&ONLP_FAN_STATUS_PRESENT) && (0 < fan_info.rpm)) + { + if (fan_info.status&ONLP_FAN_STATUS_F2B) + { + num_of_psu_i_fan_present++; + } + else if (fan_info.status&ONLP_FAN_STATUS_B2F) + { + num_of_psu_e_fan_present++; + } + } + } + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][number of fan: %d, %d, %d, %d, %f]\n", __FUNCTION__, __LINE__, num_of_i_fan_present, num_of_e_fan_present, + num_of_psu_i_fan_present, num_of_psu_e_fan_present, max_temp); + /* find policy */ + for (i=0; i < sizeof(thermalPolicyFanData) / sizeof(thermalPolicyFanCount_t); i++) + { + if ((thermalPolicyFanData[i].numofIntakeFan == num_of_i_fan_present) && + (thermalPolicyFanData[i].numofExhaustFan == num_of_e_fan_present) && + (thermalPolicyFanData[i].numofIntakePsu == num_of_psu_i_fan_present)&& + (thermalPolicyFanData[i].numofExhaustPsu == num_of_psu_e_fan_present)) + { + policy = thermalPolicyFanData[i].policy; + break; + } + } + + /* not match policy rule in the FRU table, setting shutdown process*/ + if (policy == HPC_THERMAL_POLICY_NONE) + { + /* shutdown */ + policy = HPC_THERMAL_POLICY_REDUNDANT_ISKU; + } + + /* find thermal profile */ + for (i=0; i < sizeof(thermalPolicyTempData) / sizeof(thermalPolicyTemp_t); i++) + { + if (policy == thermalPolicyTempData[i].policy) + { + if (max_temp <= thermalPolicyTempData[i].tempNormal*SYS_TEMPERATURE_MULTIPLIER) + { + new_level = thermalPolicyTempData[i].fanLowSpeed; + } + else if ((thermalPolicyTempData[i].tempWarning*SYS_TEMPERATURE_MULTIPLIER < max_temp) && + (max_temp <= thermalPolicyTempData[i].tempCritical*SYS_TEMPERATURE_MULTIPLIER) ) + { + new_level = thermalPolicyTempData[i].fanHighSpeed; + } + else if ( thermalPolicyTempData[i].tempCritical*SYS_TEMPERATURE_MULTIPLIER < max_temp) + { + /* shutdown */ + new_level = thermalPolicyTempData[i].fanHighSpeed; + } + else + { + goto _EXIT; + } + break; + } + } + + if (ori_level != new_level) + { + ori_level = new_level; + switch (new_level) + { + case 3: + new_perc = 37; + break; + case 4: + new_perc = 50; + break; + case 5: + new_perc = 63; + break; + case 6: + new_perc = 75; + break; + case 7: + new_perc = 100; + break; + default: + break; + } + } + else + { + goto _EXIT; + } + + if (LOCAL_DEBUG) + printf("\n[DEBUG][%s][%d]{perc=%d}\n", __FUNCTION__, __LINE__, new_perc); + + AIM_LOG_INFO("Fans are now at %d%%", new_perc); + /* ctrl fans */ + if ((rc = onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), new_perc)) != ONLP_STATUS_OK) + goto _EXIT; + +_EXIT : + + return rc; +} + + +/* + * 1. system led is control by CPLD, it shall always green after booting + * 2. When FAN/PSU/THERMAL is fail , alarm led shall be blink red. + */ +int +onlp_sysi_platform_manage_leds(void) +{ +#define PSU_NUM_ON_MAIN_BROAD 2 +#define LOCAL_DEBUG 0 + + int rc, i; + onlp_led_info_t led_info; + onlp_thermal_info_t thermal_info; + onlp_fan_info_t fan_info; + onlp_psu_info_t psu_info; + static int ori_status=0; + static int new_status=0; + /*int led_mode[]={ONLP_LED_MODE_OFF,ONLP_LED_MODE_RED_BLINKING,ONLP_LED_MODE_GREEN};*/ + + /* get led status */ + if ((rc = onlp_ledi_info_get(ONLP_LED_ID_CREATE(2), &led_info)) != ONLP_STATUS_OK) + goto _EXIT; + + ori_status=led_info.mode; + + /* check thermal status */ + for (i=1; i<= THERMAL_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(i), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if((thermal_info.status& ONLP_THERMAL_STATUS_FAILED)&&(thermal_info.status& ONLP_FAN_STATUS_PRESENT)) + { + new_status = ONLP_LED_MODE_RED_BLINKING; + goto _CTRL; + } + } + + + /* check fan status */ + for (i=1; i<=FAN_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if ((fan_info.status & ONLP_FAN_STATUS_FAILED)&&(fan_info.status& ONLP_FAN_STATUS_PRESENT)) + { + new_status = ONLP_LED_MODE_RED_BLINKING; + goto _CTRL; + } + } + + /* check psu status */ + for (i=1; i<=PSU_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_psui_info_get(ONLP_PSU_ID_CREATE(i), &psu_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if ((psu_info.status & ONLP_PSU_STATUS_FAILED)&& + (psu_info.status& ONLP_PSU_STATUS_PRESENT)&& + (psu_info.mvin>0)) + { + new_status = ONLP_LED_MODE_RED_BLINKING; + goto _CTRL; + } + } + + new_status = ONLP_LED_MODE_GREEN; + +_CTRL : + + if (LOCAL_DEBUG) + printf("\n[DEBUG][%s][%d]{ori:status=%d} {new:status=%d}\n", __FUNCTION__, __LINE__, + ori_status, new_status); + + if (ori_status == new_status) + goto _EXIT; + + /* ctrl alarm led */ + if ((rc = onlp_led_mode_set(ONLP_LED_ID_CREATE(2), new_status)) != ONLP_STATUS_OK) + goto _EXIT; + + /* update om */ + ori_status = new_status; + +_EXIT : + + return rc; +} + +#include + +int +onlp_sysi_platform_info_get(onlp_platform_info_t* pi) +{ + int v = onlp_i2c_readb(1, 0x31, 0, ONLP_I2C_F_FORCE); + if(v >= 0) { + pi->cpld_versions = aim_fstrdup("%d.%d", (v>>4), (v & 0xf)); + } + return 0; +} + +void +onlp_sysi_platform_info_free(onlp_platform_info_t* pi) +{ + aim_free(pi->cpld_versions); +} + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..1515c52e --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,209 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include + +#define prefix_path "/sys/bus/i2c/devices/" +#define filename "temp1_input" + +#define local_debug 0 + + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +enum onlp_thermal_id +{ + THERMAL_RESERVED = 0, + THERMAL_1_ON_MAIN_BROAD, + THERMAL_2_ON_MAIN_BROAD, + THERMAL_3_ON_MAIN_BROAD, + THERMAL_4_ON_MAIN_BROAD, + THERMAL_5_ON_MAIN_BROAD, + THERMAL_6_ON_MAIN_BROAD, + THERMAL_7_ON_MAIN_BROAD, + THERMAL_8_ON_MAIN_BROAD, + THERMAL_1_ON_PSU1, + THERMAL_1_ON_PSU2, +}; + +static char last_path[][30] = /* must map with onlp_thermal_id */ +{ + "reserved", + "4-004d/temp1", + "4-004d/temp2", + "4-004d/temp3", + "4-004d/temp4", + "4-004d/temp5", + "4-004d/temp6", + "4-004d/temp7", + "4-004d/temp8", + "6-003d/psu_temp1_input", + "6-003e/psu_temp1_input", +}; + + +/* Static values */ +static onlp_thermal_info_t linfo[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1 (CPU)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2 (Front middle)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3 (Front left)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "Chassis Thermal Sensor 4 (Rear right)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_5_ON_MAIN_BROAD), "Chassis Thermal Sensor 5 (Rear middle)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_6_ON_MAIN_BROAD), "Chassis Thermal Sensor 6 (Rear left)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_7_ON_MAIN_BROAD), "Chassis Thermal Sensor 7 (Front left corner)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_8_ON_MAIN_BROAD), "Chassis Thermal Sensor 8 (Next to PSU connector)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(1)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 } +}; + + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) +{ + int fd, len, nbytes = 10, temp_base = 1, local_id; + char r_data[10] = {0}, r2_data[10] = {0}; + char fullpath[50] = {0}, fullpath2[50] = {0}; //fullpath for get temp_input, fullpath for get temp_fault + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + if (local_debug) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + if (local_id <= THERMAL_8_ON_MAIN_BROAD) + { + sprintf(fullpath, "%s%s%s", prefix_path, last_path[local_id], "_input"); + sprintf(fullpath2, "%s%s%s", prefix_path, last_path[local_id], "_fault"); + } + else + { + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + } + + if (local_debug) + { + printf("\n[Debug][%s][%d][openfile: %s, %s]", __FUNCTION__, __LINE__, fullpath, fullpath2); + } + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[local_id]; + + /* Set current mode */ + if ((fd = open(fullpath, O_RDONLY)) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ((len = read(fd, r_data, nbytes)) <= 0) + { + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + /* If the read byte count is less, the format is different and calc will be wrong*/ + if (close(fd) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ((THERMAL_1_ON_MAIN_BROAD < local_id) && (local_id < THERMAL_1_ON_PSU1)) + { + /* Set current mode */ + if ((fd = open(fullpath2, O_RDONLY)) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + + if ((len = read(fd, r2_data, nbytes)) <= 0) + { + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + /* If the read byte count is less, the format is different and calc will be wrong*/ + if (close(fd) == -1) + { + return ONLP_STATUS_E_INTERNAL; + } + } + + if (local_debug) + { + printf("\n[Debug][%s][%d][read data: %s, %s]", __FUNCTION__, __LINE__, r_data, r2_data); + } + + info->mcelsius = atoi(r_data)/temp_base; + + if (atoi(r2_data) > 0) + info->status |= ONLP_THERMAL_STATUS_FAILED; + + if (local_debug) + { + printf("\n[Debug][%s][%d][save data: %d, %u]\n", __FUNCTION__, __LINE__, info->mcelsius, info->status); + } + + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/powerpc_accton_as6700_32x.doxy b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/powerpc_accton_as6700_32x.doxy new file mode 100644 index 00000000..5a09c9f2 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/onlp/builds/src/powerpc_accton_as6700_32x.doxy @@ -0,0 +1,1869 @@ +# Doxyfile 1.8.3.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "powerpc_accton_as6700_32x" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Accton AS6700-32X." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. Note that you specify absolute paths here, but also +# relative paths, which will be relative from the directory where doxygen is +# started. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, +# and language is one of the parsers supported by doxygen: IDL, Java, +# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, +# C++. For instance to make doxygen treat .inc files as Fortran files (default +# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note +# that for custom extensions you also need to set FILE_PATTERNS otherwise the +# files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented classes, +# or namespaces to their corresponding documentation. Such a link can be +# prevented in individual cases by by putting a percent sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES (the +# default) will make doxygen replace the get and set methods by a property in +# the documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if section-label ... \endif +# and \cond section-label ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. Do not use +# file names with spaces, bibtex cannot handle them. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page (index.html). +# This can be useful if you have a project on for instance GitHub and want reuse +# the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If left blank doxygen will +# generate a default style sheet. Note that it is recommended to use +# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this +# tag will in the future become obsolete. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional +# user-defined cascading style sheet that is included after the standard +# style sheets created by doxygen. Using this option one can overrule +# certain style aspects. This is preferred over using HTML_STYLESHEET +# since it does not replace the standard style sheet and is therefor more +# robust against future updates. Doxygen will copy the style sheet file to +# the output directory. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely +# identify the documentation publisher. This should be a reverse domain-name +# style string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and +# SVG. The default value is HTML-CSS, which is slower, but has the best +# compatibility. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a web server instead of a web client using Javascript. +# There are two flavours of web server based search depending on the +# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for +# searching and an index file used by the script. When EXTERNAL_SEARCH is +# enabled the indexing and searching needs to be provided by external tools. +# See the manual for details. + +SERVER_BASED_SEARCH = NO + +# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP +# script for searching. Instead the search results are written to an XML file +# which needs to be processed by an external indexer. Doxygen will invoke an +# external search engine pointed to by the SEARCHENGINE_URL option to obtain +# the search results. Doxygen ships with an example indexer (doxyindexer) and +# search engine (doxysearch.cgi) which are based on the open source search engine +# library Xapian. See the manual for configuration details. + +EXTERNAL_SEARCH = NO + +# The SEARCHENGINE_URL should point to a search engine hosted by a web server +# which will returned the search results when EXTERNAL_SEARCH is enabled. +# Doxygen ships with an example search engine (doxysearch) which is based on +# the open source search engine library Xapian. See the manual for configuration +# details. + +SEARCHENGINE_URL = + +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed +# search data is written to a file for indexing by an external tool. With the +# SEARCHDATA_FILE tag the name of this file can be specified. + +SEARCHDATA_FILE = searchdata.xml + +# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple +# projects and redirect the results back to the right project. + +EXTERNAL_SEARCH_ID = + +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen +# projects other than the one defined by this configuration file, but that are +# all added to the same external search index. Each project needs to have a +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id +# of to a relative location where the documentation can be found. +# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... + +EXTRA_SEARCH_MAPPINGS = + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/PKG.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..373917d0 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as6700-32x-r0 diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/boot/powerpc-accton-as6700-32x-r0 b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/boot/powerpc-accton-as6700-32x-r0 new file mode 100644 index 00000000..942441bf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/boot/powerpc-accton-as6700-32x-r0 @@ -0,0 +1,22 @@ +############################################################ +# powerpc-accton-as6700-32x-r0 +############################################################ + +echo "fsl,dpaa.16/ethernet.18 ma1" > /etc/onl/net +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd1 0x00000000 0x00002000 0x00010000" >> /etc/fw_env.config + +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +# echo "block/mmcblk0 mmcblk0p2 flash" > /etc/onl/mounts +# echo "block/mmcblk0 mmcblk0p3 flash2" >> /etc/onl/mounts + + + + + + + + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/install/powerpc-accton-as6700-32x-r0.sh b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/install/powerpc-accton-as6700-32x-r0.sh new file mode 100644 index 00000000..cf100fee --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/install/powerpc-accton-as6700-32x-r0.sh @@ -0,0 +1,32 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +############################################################ +# +# Installer scriptlet for the powerpc-as6700-32x +# + +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; fatload usb 0:1 0x10000000 onl-loader; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-accton-as6700-32x-r0; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/powerpc-accton-as6700-32x-r0.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/powerpc-accton-as6700-32x-r0.yml new file mode 100644 index 00000000..1444e53c --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/lib/powerpc-accton-as6700-32x-r0.yml @@ -0,0 +1,6 @@ +powerpc-accton-as6700-32x-r0: + flat_image_tree: + kernel: onl-kernel-3.8.13-powerpc-e500mc:powerpc, kernel-3.8.13-powerpc-e500mc.bin.gz + dtb: onl-kernel-3.8.13-powerpc-e500mc:powerpc, powerpc-accton-as6700-32x-r0.dtb + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/python/powerpc_accton_as6700_32x_r0/__init__.py b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/python/powerpc_accton_as6700_32x_r0/__init__.py new file mode 100644 index 00000000..5b719ea0 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r0/src/python/powerpc_accton_as6700_32x_r0/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +############################################################ +# +############################################################ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as6700_32x_r0(OnlPlatformAccton): + + def model(self): + return "AS6700-32X" + + def platform(self): + return 'powerpc-accton-as6700-32x-r0' + + def baseconfig(self): + with open("/etc/default/watchdog", 'a') as f: + f.write("run_watchdog=0\n"); + return True + + def sys_oid_platform(self): + return ".6700.32" + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/Makefile b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/PKG.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/PKG.yml new file mode 100644 index 00000000..36da0cab --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=accton PLATFORM=powerpc-accton-as6700-32x-r1 diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/boot/powerpc-accton-as6700-32x-r1 b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/boot/powerpc-accton-as6700-32x-r1 new file mode 100644 index 00000000..1ded5bc5 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/boot/powerpc-accton-as6700-32x-r1 @@ -0,0 +1,16 @@ +############################################################ +# powerpc-accton-as6700-32x-r1 +############################################################ + +echo "fsl,dpaa.16/ethernet.18 ma1" > /etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd1 0x00000000 0x00002000 0x00040000" >> /etc/fw_env.config + + + + + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/install/powerpc-accton-as6700-32x-r1.sh b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/install/powerpc-accton-as6700-32x-r1.sh new file mode 100644 index 00000000..41069d56 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/install/powerpc-accton-as6700-32x-r1.sh @@ -0,0 +1,32 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +############################################################ +# +# Installer scriptlet for the powerpc-as6700-32x +# + +# The loader is installed in the fat partition of the first USB storage device +platform_bootcmd='usb start; fatload usb 0:1 0x10000000 onl-loader; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-accton-as6700-32x-r1; bootm 0x10000000' + +platform_installer() { + # Standard installation to usb storage + installer_standard_blockdev_install sda 16M 64M "" +} \ No newline at end of file diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/powerpc-accton-as6700-32x-r1.yml b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/powerpc-accton-as6700-32x-r1.yml new file mode 100644 index 00000000..a115a2e9 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/lib/powerpc-accton-as6700-32x-r1.yml @@ -0,0 +1,6 @@ +powerpc-accton-as6700-32x-r1: + flat_image_tree: + kernel: onl-kernel-3.8.13-powerpc-e500mc:powerpc, kernel-3.8.13-powerpc-e500mc.bin.gz + dtb: onl-kernel-3.8.13-powerpc-e500mc:powerpc, powerpc-accton-as6700-32x-r1.dtb + + diff --git a/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/python/powerpc_accton_as6700_32x_r1/__init__.py b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/python/powerpc_accton_as6700_32x_r1/__init__.py new file mode 100644 index 00000000..3098e3b5 --- /dev/null +++ b/packages/platforms/accton/powerpc-accton-as6700-32x/platform-config/r1/src/python/powerpc_accton_as6700_32x_r1/__init__.py @@ -0,0 +1,24 @@ +#!/usr/bin/python +############################################################ +# +# +# +############################################################ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_powerpc_accton_as6700_32x_r1(OnlPlatformAccton): + + def model(self): + return "AS6700-32X" + + def platform(self): + return 'powerpc-accton-as6700-32x-r1' + + def baseconfig(self): + with open("/etc/default/watchdog", 'a') as f: + f.write("run_watchdog=0\n"); + return True + + def sys_oid_platform(self): + return ".6700.32" diff --git a/packages/platforms/accton/vendor-config/Makefile b/packages/platforms/accton/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/vendor-config/PKG.yml b/packages/platforms/accton/vendor-config/PKG.yml new file mode 100644 index 00000000..5121d667 --- /dev/null +++ b/packages/platforms/accton/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=accton Vendor=Accton diff --git a/packages/platforms/accton/vendor-config/src/python/accton/__init__.py b/packages/platforms/accton/vendor-config/src/python/accton/__init__.py new file mode 100644 index 00000000..0dbb90fb --- /dev/null +++ b/packages/platforms/accton/vendor-config/src/python/accton/__init__.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for Accton platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformAccton(OnlPlatformBase): + def manufacturer(self): + return "Accton" + + def sys_oid_vendor(self): + return ".259" diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/.gitignore b/packages/platforms/accton/x86-64-accton-as5712-54x/.gitignore new file mode 100644 index 00000000..da4ec396 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/.gitignore @@ -0,0 +1,3 @@ +libonlp-x86-64-accton-as5712-54x-r0.mk +onlpdump.mk +x86_64_accton_as5712_54x.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/PKG.yml b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/PKG.yml new file mode 100644 index 00000000..9977b55e --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/PKG.yml @@ -0,0 +1,19 @@ +variables: + platform: x86-64-accton-as5712-54x-r0 + install: /lib/platform-config/${platform}/onl + +common: + version: 1.0.0 + arch: amd64 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onlp-${platform} + summary: ONLP Package for the ${platform} platform. + + files: + builds/lib/$BUILD_DIR/x86_64-linux-gnu/bin/libonlp-${platform}.so : ${install}/lib/ + builds/onlpdump/$BUILD_DIR/x86_64-linux-gnu/bin/onlpdump : ${install}/lib/bin/ + + changelog: Change changes changes., diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/.gitignore b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/lib/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/lib/Makefile new file mode 100644 index 00000000..67c16a60 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.amd64.mk + +MODULE := libonlp-x86-64-accton-as5712-54x-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF x86_64_accton_as5712_54x onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-x86-64-accton-as5712-54x-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..6a32762f --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.amd64.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp x86_64_accton_as5712_54x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/Makefile new file mode 100644 index 00000000..af6cd0d0 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +include ../../init.mk +MODULE := x86_64_accton_as5712_54x +AUTOMODULE := x86_64_accton_as5712_54x +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/README b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/README new file mode 100644 index 00000000..72089c9a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# x86_64_accton_as5712_54x README +# +############################################################################### + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..513f4ada --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# x86_64_accton_as5712_54x Autogeneration +# +############################################################################### +x86_64_accton_as5712_54x_AUTO_DEFS := module/auto/x86_64_accton_as5712_54x.yml +x86_64_accton_as5712_54x_AUTO_DIRS := module/inc/x86_64_accton_as5712_54x module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/x86_64_accton_as5712_54x.yml b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/x86_64_accton_as5712_54x.yml new file mode 100644 index 00000000..5920c139 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/auto/x86_64_accton_as5712_54x.yml @@ -0,0 +1,47 @@ +############################################################################### +# +# x86_64_accton_as5712_54x Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB +- X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + X86_64_ACCTON_AS5712_54X_CONFIG_HEADER: + defs: *cdefs + basename: x86_64_accton_as5712_54x_config + + portingmacro: + X86_64_ACCTON_AS5712_54X: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x.x b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x.x new file mode 100644 index 00000000..79a7b1bf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_config.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_config.h new file mode 100644 index 00000000..84e6371b --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_config.h @@ -0,0 +1,127 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_accton_as5712_54x Configuration Header + * + * @addtogroup x86_64_accton_as5712_54x-config + * @{ + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS5712_54X_CONFIG_H__ +#define __X86_64_ACCTON_AS5712_54X_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef X86_64_ACCTON_AS5712_54X_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING +#define X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT +#define X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT +#define X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB +#define X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB +#endif + +/** + * X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI +#define X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct x86_64_accton_as5712_54x_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} x86_64_accton_as5712_54x_config_settings_t; + +/** Configuration settings table. */ +/** x86_64_accton_as5712_54x_config_settings table. */ +extern x86_64_accton_as5712_54x_config_settings_t x86_64_accton_as5712_54x_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* x86_64_accton_as5712_54x_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int x86_64_accton_as5712_54x_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "x86_64_accton_as5712_54x_porting.h" + +#endif /* __X86_64_ACCTON_AS5712_54X_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_dox.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_dox.h new file mode 100644 index 00000000..c539de2e --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * x86_64_accton_as5712_54x Doxygen Header + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS5712_54X_DOX_H__ +#define __X86_64_ACCTON_AS5712_54X_DOX_H__ + +/** + * @defgroup x86_64_accton_as5712_54x x86_64_accton_as5712_54x - x86_64_accton_as5712_54x Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup x86_64_accton_as5712_54x-x86_64_accton_as5712_54x Public Interface + * @defgroup x86_64_accton_as5712_54x-config Compile Time Configuration + * @defgroup x86_64_accton_as5712_54x-porting Porting Macros + * + * @} + * + */ + +#endif /* __X86_64_ACCTON_AS5712_54X_DOX_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h new file mode 100644 index 00000000..428ecaa0 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_accton_as5712_54x Porting Macros. + * + * @addtogroup x86_64_accton_as5712_54x-porting + * @{ + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS5712_54X_PORTING_H__ +#define __X86_64_ACCTON_AS5712_54X_PORTING_H__ + + +/* */ +#if X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_MALLOC + #if defined(GLOBAL_MALLOC) + #define X86_64_ACCTON_AS5712_54X_MALLOC GLOBAL_MALLOC + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_MALLOC malloc + #else + #error The macro X86_64_ACCTON_AS5712_54X_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_FREE + #if defined(GLOBAL_FREE) + #define X86_64_ACCTON_AS5712_54X_FREE GLOBAL_FREE + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_FREE free + #else + #error The macro X86_64_ACCTON_AS5712_54X_FREE is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_MEMSET + #if defined(GLOBAL_MEMSET) + #define X86_64_ACCTON_AS5712_54X_MEMSET GLOBAL_MEMSET + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_MEMSET memset + #else + #error The macro X86_64_ACCTON_AS5712_54X_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define X86_64_ACCTON_AS5712_54X_MEMCPY GLOBAL_MEMCPY + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_MEMCPY memcpy + #else + #error The macro X86_64_ACCTON_AS5712_54X_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define X86_64_ACCTON_AS5712_54X_STRNCPY GLOBAL_STRNCPY + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_STRNCPY strncpy + #else + #error The macro X86_64_ACCTON_AS5712_54X_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define X86_64_ACCTON_AS5712_54X_VSNPRINTF GLOBAL_VSNPRINTF + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_VSNPRINTF vsnprintf + #else + #error The macro X86_64_ACCTON_AS5712_54X_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define X86_64_ACCTON_AS5712_54X_SNPRINTF GLOBAL_SNPRINTF + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_SNPRINTF snprintf + #else + #error The macro X86_64_ACCTON_AS5712_54X_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS5712_54X_STRLEN + #if defined(GLOBAL_STRLEN) + #define X86_64_ACCTON_AS5712_54X_STRLEN GLOBAL_STRLEN + #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS5712_54X_STRLEN strlen + #else + #error The macro X86_64_ACCTON_AS5712_54X_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __X86_64_ACCTON_AS5712_54X_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/make.mk b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..337b892e --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +x86_64_accton_as5712_54x_INCLUDES := -I $(THIS_DIR)inc +x86_64_accton_as5712_54x_INTERNAL_INCLUDES := -I $(THIS_DIR)src +x86_64_accton_as5712_54x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as5712_54x ucli:x86_64_accton_as5712_54x + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..52b67374 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py x86_64_accton_as5712_54x_ucli.c + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/debug.c new file mode 100644 index 00000000..fa6eebd5 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/debug.c @@ -0,0 +1,45 @@ +#include "x86_64_accton_as5712_54x_int.h" + +#if X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_DEBUG == 1 + +#include + +static char help__[] = + "Usage: debug [options]\n" + " -c CPLD Versions\n" + " -h Help\n" + ; + +int +x86_64_accton_as5712_54x_debug_main(int argc, char* argv[]) +{ + int c = 0; + int help = 0; + int rv = 0; + + while( (c = getopt(argc, argv, "ch")) != -1) { + switch(c) + { + case 'c': c = 1; break; + case 'h': help = 1; rv = 0; break; + default: help = 1; rv = 1; break; + } + + } + + if(help || argc == 1) { + printf("%s", help__); + return rv; + } + + if(c) { + printf("Not implemented.\n"); + } + + + return 0; +} + +#endif + + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..47a53016 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/fani.c @@ -0,0 +1,420 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +#include +#include "platform_lib.h" + +#define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as5712_54x_fan/" +#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/" +#define LOCAL_DEBUG 0 + + +#define FAN_RESERVED 0 +#define FAN_1_ON_MAIN_BOARD 1 +#define FAN_2_ON_MAIN_BOARD 2 +#define FAN_3_ON_MAIN_BOARD 3 +#define FAN_4_ON_MAIN_BOARD 4 +#define FAN_5_ON_MAIN_BOARD 5 +#define FAN_1_ON_PSU1 6 +#define FAN_1_ON_PSU2 7 + +#define PROJECT_NAME + +#define LEN_FILE_NAME 50 + +typedef struct last_path_S +{ + char status[LEN_FILE_NAME]; + char speed[LEN_FILE_NAME]; + char direction[LEN_FILE_NAME]; + char ctrl_speed[LEN_FILE_NAME]; + char r_status[LEN_FILE_NAME]; + char r_speed[LEN_FILE_NAME]; +}last_path_T; + +#define _MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id) \ + { #prj"fan"#id"_fault", #prj"fan"#id"_speed_rpm", #prj"fan"#id"_direction",\ + #prj"fan"#id"_duty_cycle_percentage", #prj"fanr"#id"_fault", #prj"fanr"#id"_speed_rpm" } + +#define MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id) _MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(prj,id) + + +#define MAKE_FAN_LAST_PATH_ON_PSU(folder) \ + {#folder"/psu_fan1_fault", #folder"/psu_fan1_speed_rpm", "",\ + #folder"/psu_fan1_duty_cycle_percentage", "", "" } + +static last_path_T last_path[] = /* must map with onlp_fan_id */ +{ + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_RESERVED), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_1_ON_MAIN_BOARD), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD), + + MAKE_FAN_LAST_PATH_ON_PSU(57-003c), + MAKE_FAN_LAST_PATH_ON_PSU(58-003f), +}; + +#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BOARD), "Chassis Fan "#id, 0 }, \ + 0x0, \ + ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE, \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + +#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \ + 0x0, \ + 0, \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + + +/* Static fan information */ +onlp_fan_info_t linfo[] = { + { }, /* Not used */ + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(3), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(4), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(5), + MAKE_FAN_INFO_NODE_ON_PSU(1,1), + MAKE_FAN_INFO_NODE_ON_PSU(2,1), +}; + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +/* PSU relative marco */ +#define SET_PSU_TYPE_CPR_4011_F2B_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); \ + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE + +#define SET_PSU_TYPE_CPR_4011_B2F_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ + info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE + +#define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) + +#define SET_PSU_TYPE_UM400D_B2F_FAN(info) \ + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F) + + +static int +_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) +{ + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[65] = {0}; + + /* get fan/fanr fault status (turn on when any one fails) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan/fanr direction (both : the same) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + if (atoi(r_data) == 0) /*F2B*/ + info->status |= ONLP_FAN_STATUS_F2B; + else + info->status |= ONLP_FAN_STATUS_B2F; + + /* get fan/fanr speed (take the average of two speeds) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = (info->rpm + atoi(r_data))/2; + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100)/16800; + + /* check present */ + if (info->rpm > 0) + info->status |= ONLP_FAN_STATUS_PRESENT; + + return ONLP_STATUS_OK; +} + +static int +_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) +{ + int psu_id, is_ac=0; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[50] = {0}; + psu_type_t psu_type; + + /* get fan other cap status according to psu type + */ + psu_id = (local_id-FAN_1_ON_PSU1) + 1; + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id); + + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type); + + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + SET_PSU_TYPE_CPR_4011_F2B_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_AC_B2F: + SET_PSU_TYPE_CPR_4011_B2F_FAN(info); + is_ac = 1; + break; + case PSU_TYPE_DC_48V_F2B: + SET_PSU_TYPE_UM400D_F2B_FAN(info); + break; + case PSU_TYPE_DC_48V_B2F: + SET_PSU_TYPE_UM400D_B2F_FAN(info); + break; + default: + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + + break; + } + + if (1 == is_ac) + { + /* get fan fault status + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan speed + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100)/19328; + + } + + return ONLP_STATUS_OK; +} + + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + int rc = 0; + int local_id; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + *info = linfo[local_id]; + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + break; + + default: + rc =_onlp_fani_info_get_fan(local_id, info); + break; + } + + return rc; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + int fd, len, nbytes=10, local_id; + char data[10] = {0}; + char fullpath[70] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* reject p=0 (p=0, stop fan) */ + if (p == 0){ + return ONLP_STATUS_E_INVALID; + } + + /* get fullpath */ + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); + break; + default: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].ctrl_speed); + break; + } + + sprintf(data, "%d", p); + + if (LOCAL_DEBUG) + printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + + + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..8298d4b1 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,325 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include + +#include + +//#include "onlpie_int.h" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ +enum led_light_mode { /*must be the same with the definition @ kernel driver */ + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_AUTO, +}; + +int led_light_map_mode[][2] = +{ + {LED_MODE_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_GREEN, ONLP_LED_MODE_GREEN}, + {LED_MODE_AMBER, ONLP_LED_MODE_ORANGE}, + {LED_MODE_RED, ONLP_LED_MODE_RED}, + {LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, + {LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING}, + {LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING}, + {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, +}; + + +#define prefix_path "/sys/class/leds/accton_as5712_54x_led::" +#define filename "brightness" + +enum onlp_led_id +{ + LED_RESERVED = 0, + LED_DIAG, + LED_FAN, + LED_LOC, + LED_PSU1, + LED_PSU2, + LED_FAN1, + LED_FAN2, + LED_FAN3, + LED_FAN4, + LED_FAN5, +}; + +static char last_path[][10] = /* must map with onlp_led_id */ +{ + "reserved", + "diag", + "fan", + "loc", + "psu1", + "psu2", + "fan1", + "fan2", + "fan3", + "fan4", + "fan5", +}; + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = +{ + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis LED 1 (DIAG LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 2 (FAN LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_LOC), "Chassis LED 3 (LOC LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 4 (PSU1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 5 (PSU2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10 (FAN5 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, +}; + + +static int conver_led_light_mode_to_onl(int led_ligth_mode) +{ + int i, nsize = sizeof(led_light_map_mode)/sizeof(led_light_map_mode[0]); + for(i=0; imode = conver_led_light_mode_to_onl(atoi(data)); + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + VALIDATE(id); + + if (!on_or_off) { + return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int fd, len, driver_mode, nbytes=1, local_id; + char data[2] = {0}; + char fullpath[50] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* get fullpath */ + if (strchr(last_path[local_id], '/') != NULL) + { + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + } + else + { + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + } + + driver_mode = conver_led_light_mode_to_driver(mode); + sprintf(data, "%d", driver_mode); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if(fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if(len != nbytes){ + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..4025409b --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := x86_64_accton_as5712_54x +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..a6c114be --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,169 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeWriteInt(char *filename, int value, int data_len) +{ + char buf[8] = {0}; + sprintf(buf, "%d", value); + + return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len); +} + +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) + { + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_RDONLY)) == -1) { + return -1; + } + + if ((len = read(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len) +{ + int ret; + + if (data_len >= buf_size || data_len < 0) { + return -1; + } + + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); + + if (ret == 0) { + if (data_len) { + buffer[data_len] = '\0'; + } + else { + buffer[buf_size-1] = '\0'; + } + } + + return ret; +} + +#define I2C_PSU_MODEL_NAME_LEN 13 + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len) +{ + char *node = NULL; + char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; + + /* Check AC model name */ + node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_F2B; + } + else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_B2F; + } + } + + /* Check DC model name */ + memset(model_name, 0, sizeof(model_name)); + node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_model_name) : PSU2_DC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_B2F; + } + else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_DC_48V_F2B; + } + } + + return PSU_TYPE_UNKNOWN; +} + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..801d601f --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,69 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +#include "x86_64_accton_as5712_54x_log.h" + +#define PSU1_ID 1 +#define PSU2_ID 2 + +#define CHASSIS_FAN_COUNT 5 +#define CHASSIS_THERMAL_COUNT 3 + +#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/57-003c/" +#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/58-003f/" + +#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/57-0038/" +#define PSU1_DC_HWMON_PREFIX "/sys/bus/i2c/devices/57-0050/" +#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/58-003b/" +#define PSU2_DC_HWMON_PREFIX "/sys/bus/i2c/devices/58-0053/" + +#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node +#define PSU1_DC_HWMON_NODE(node) PSU1_DC_HWMON_PREFIX#node +#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node +#define PSU2_DC_HWMON_NODE(node) PSU2_DC_HWMON_PREFIX#node + +//#define SFP_HWMON_PREFIX "/sys/bus/i2c/devices/3-0050/" +//#define SFP_HWMON_NODE(node) SFP_HWMON_PREFIX#node + +#define IDPROM_PATH "/sys/devices/pci0000:00/0000:00:13.0/i2c-1/1-0057/eeprom" + +int deviceNodeWriteInt(char *filename, int value, int data_len); +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len); +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len); + +typedef enum psu_type { + PSU_TYPE_UNKNOWN, + PSU_TYPE_AC_F2B, + PSU_TYPE_AC_B2F, + PSU_TYPE_DC_48V_F2B, + PSU_TYPE_DC_48V_B2F +} psu_type_t; + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len); + +#endif /* __PLATFORM_LIB_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..73b04a21 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/psui.c @@ -0,0 +1,247 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +#define PSU_STATUS_PRESENT 1 +#define PSU_STATUS_POWER_GOOD 1 + +#define PSU_NODE_MAX_INT_LEN 8 +#define PSU_NODE_MAX_PATH_LEN 64 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static int +psu_status_info_get(int id, int is_ac, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU1_AC_HWMON_PREFIX : PSU1_DC_HWMON_PREFIX, node); + } + else if (PSU2_ID == id) { + sprintf(node_path, "%s%s", is_ac ? PSU2_AC_HWMON_PREFIX : PSU2_DC_HWMON_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int +psu_cpr_4011_pmbus_info_get(int id, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); + } + else { + sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +int +onlp_psui_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_info_get(onlp_psu_info_t* info) +{ + int val = 0; + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_AC; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT); + + /* Read voltage, current and power */ + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_out", &val) == 0) { + info->mvout = val; + info->caps |= ONLP_PSU_CAPS_VOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_in", &val) == 0) { + info->mvin = val; + info->caps |= ONLP_PSU_CAPS_VIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_out", &val) == 0) { + info->miout = val; + info->caps |= ONLP_PSU_CAPS_IOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_in", &val) == 0) { + info->miin = val; + info->caps |= ONLP_PSU_CAPS_IIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_out", &val) == 0) { + info->mpout = val; + info->caps |= ONLP_PSU_CAPS_POUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_in", &val) == 0) { + info->mpin = val; + info->caps |= ONLP_PSU_CAPS_PIN; + } + + return ONLP_STATUS_OK; +} + +int +psu_um400d_info_get(onlp_psu_info_t* info) +{ + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_DC48; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = +{ + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, + }, + { + { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, + } +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int val = 0; + int ret = ONLP_STATUS_OK; + int index = ONLP_OID_ID_GET(id); + psu_type_t psu_type; + + VALIDATE(id); + + memset(info, 0, sizeof(onlp_psu_info_t)); + *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ + + /* Get the present state */ + if (psu_status_info_get(index, 1, "psu_present", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_present)\r\n", index); + } + + if (val != PSU_STATUS_PRESENT) { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + info->status |= ONLP_PSU_STATUS_PRESENT; + + + /* Get power good status */ + if (psu_status_info_get(index, 1, "psu_power_good", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index); + } + + if (val != PSU_STATUS_POWER_GOOD) { + info->status |= ONLP_PSU_STATUS_FAILED; + } + + + /* Get PSU type + */ + psu_type = get_psu_type(index, info->model, sizeof(info->model)); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + case PSU_TYPE_AC_B2F: + ret = psu_cpr_4011_info_get(info); + break; + case PSU_TYPE_DC_48V_F2B: + case PSU_TYPE_DC_48V_B2F: + ret = psu_um400d_info_get(info); + break; + default: + ret = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return ret; +} + +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..45d3ae04 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,449 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#include /* For O_RDWR && open */ +#include +#include +#include +#include + +#include "platform_lib.h" + +#define MAX_SFP_PATH 64 +static char sfp_node_path[MAX_SFP_PATH] = {0}; +#define CPLD_MUX_BUS_START_INDEX 2 + +static int front_port_to_cpld_mux_index(int port) +{ + int rport = 0; + + switch (port) + { + case 49: + rport = 50; + break; + case 50: + rport = 52; + break; + case 51: + rport = 49; + break; + case 52: + rport = 51; + break; + default: + rport = port; + break; + } + + return (rport + CPLD_MUX_BUS_START_INDEX); +} + +static int +as5712_54x_sfp_node_read_int(char *node_path, int *value, int data_len) +{ + int ret = 0; + char buf[8] = {0}; + *value = 0; + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static char* +as5712_54x_sfp_get_port_path_addr(int port, int addr, char *node_name) +{ + sprintf(sfp_node_path, "/sys/bus/i2c/devices/%d-00%d/%s", + front_port_to_cpld_mux_index(port), addr, + node_name); + return sfp_node_path; +} + +static char* +as5712_54x_sfp_get_port_path(int port, char *node_name) +{ + return as5712_54x_sfp_get_port_path_addr(port, 50, node_name); +} + + +/************************************************************ + * + * SFPI Entry Points + * + ***********************************************************/ +int +onlp_sfpi_init(void) +{ + /* Called at initialization time */ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Ports {0, 54} + */ + int p; + + for(p = 0; p < 54; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_port_map(int port, int* rport) +{ + /* + * The QSFP port numbering on the powerpc-as5712-54x-r0b platform + * differs from the numbering on the production + * powerpc-accton-as5712-54x-r0 platform. + * + * The R0B box numbers the front panel QSFP ports as follows: + * + * 49 50 + * 51 52 + * 53 54 + * + * The production box numbers the front panel QSFP ports as follows: + * + * 49 52 + * 50 53 + * 51 54 + * + * The kernel SFP driver for all 5710 platforms uses the production + * portmapping. When running on the R0B platform we need to convert + * the logical SFP port number (from the front panel) to the physical + * SFP port number used by the kernel driver. + * + * SFP port numbers here are 0-based. + */ + switch(port) + { + case 48: + case 53: + /* These QSFP ports are numbered the same on both platforms */ + *rport = port; break; + case 50: + *rport = 49; break; + case 52: + *rport = 50; break; + case 49: + *rport = 51; break; + case 51: + *rport = 52; break; + default: + /* All others are identical */ + *rport = port; break; + } + + return ONLP_STATUS_OK; +} + +/** + * The CPLD registers on the as5712 use the original R0B QSFP (horizontal) + * portmapping. + * + * While the SFP driver handles the remap correctly for sfp_active_port() + * for both the R0 and R0B. When we have to interpret the CPLD register + * values directly, however, we need to apply the correct mapping from R0B -> R0. + */ +static void +port_qsfp_cpld_map__(int port, int* rport) +{ + switch(port) + { + case 53: + case 48: /* The same */ *rport = port; break; + case 50: *rport = 49; break; + case 52: *rport = 50; break; + case 49: *rport = 51; break; + case 51: *rport = 52; break; + default: *rport = port; break; + } +} + +int +onlp_sfpi_is_present(int port) +{ + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + int present; + char* path = as5712_54x_sfp_get_port_path(port, "sfp_is_present"); + + if (as5712_54x_sfp_node_read_int(path, &present, 1) != 0) { + AIM_LOG_INFO("Unable to read present status from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return present; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[7]; + char* path; + FILE* fp; + + path = as5712_54x_sfp_get_port_path(0, "sfp_is_present_all"); + fp = fopen(path, "r"); + + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3, + bytes+4, + bytes+5, + bytes+6 + ); + fclose(fp); + if(count != AIM_ARRAYSIZE(bytes)) { + /* Likely a CPLD read timeout. */ + AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Mask out non-existant QSFP ports */ + bytes[6] &= 0x3F; + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint64_t presence_all = 0 ; + for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { + presence_all <<= 8; + presence_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; presence_all; i++) { + int p; + port_qsfp_cpld_map__(i, &p); + AIM_BITMAP_MOD(dst, p, (presence_all & 1)); + presence_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[7]; + char* path; + FILE* fp; + + path = as5712_54x_sfp_get_port_path(0, "sfp_rx_los_all"); + fp = fopen(path, "r"); + + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_rx_los_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3, + bytes+4, + bytes+5 + ); + fclose(fp); + if(count != 6) { + AIM_LOG_ERROR("Unable to read all fields from the sfp_rx_los_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint64_t rx_los_all = 0 ; + for(i = 5; i >= 0; i--) { + rx_los_all <<= 8; + rx_los_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; rx_los_all; i++) { + int p; + port_qsfp_cpld_map__(i, &p); + AIM_BITMAP_MOD(dst, p, (rx_los_all & 1)); + rx_los_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + char* path = as5712_54x_sfp_get_port_path(port, "sfp_eeprom"); + + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + memset(data, 0, 256); + + if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) { + AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_dom_read(int port, uint8_t data[256]) +{ + char* path = as5712_54x_sfp_get_port_path_addr(port, 51, "sfp_eeprom"); + memset(data, 0, 256); + + if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) { + AIM_LOG_INFO("Unable to read eeprom from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) +{ + int rv; + + if (port < 0 || port >= 48) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + switch(control) + { + case ONLP_SFP_CONTROL_TX_DISABLE: + { + char* path = as5712_54x_sfp_get_port_path(port, "sfp_tx_disable"); + + if (deviceNodeWriteInt(path, value, 0) != 0) { + AIM_LOG_ERROR("Unable to set tx_disable status to port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + default: + rv = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return rv; +} + +int +onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value) +{ + int rv; + char* path = NULL; + + if (port < 0 || port >= 48) { + return ONLP_STATUS_E_UNSUPPORTED; + } + + switch(control) + { + case ONLP_SFP_CONTROL_RX_LOS: + { + path = as5712_54x_sfp_get_port_path(port, "sfp_rx_loss"); + + if (as5712_54x_sfp_node_read_int(path, value, 1) != 0) { + AIM_LOG_ERROR("Unable to read rx_loss status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + case ONLP_SFP_CONTROL_TX_FAULT: + { + path = as5712_54x_sfp_get_port_path(port, "sfp_tx_fault"); + + if (as5712_54x_sfp_node_read_int(path, value, 1) != 0) { + AIM_LOG_ERROR("Unable to read tx_fault status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + case ONLP_SFP_CONTROL_TX_DISABLE: + { + path = as5712_54x_sfp_get_port_path(port, "sfp_tx_disable"); + + if (as5712_54x_sfp_node_read_int(path, value, 0) != 0) { + AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port); + rv = ONLP_STATUS_E_INTERNAL; + } + else { + rv = ONLP_STATUS_OK; + } + break; + } + + default: + rv = ONLP_STATUS_E_UNSUPPORTED; + } + + return rv; +} + +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..0f8ea4bb --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,277 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include + +#include "x86_64_accton_as5712_54x_int.h" +#include "x86_64_accton_as5712_54x_log.h" +#include "platform_lib.h" +#include +#include + +#define LOCAL_DEBUG 0 + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s][len:%d]\n", __FUNCTION__, __LINE__, r_data, len); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +#define PREFIX_PATH_ON_CPLD_DEV "/sys/bus/i2c/devices/" +#define NUM_OF_CPLD 3 +static char arr_cplddev_name[NUM_OF_CPLD][10] = +{ + "0-0060", + "0-0061", + "0-0062" +}; + +const char* +onlp_sysi_platform_get(void) +{ + return "x86-64-accton-as5712-54x-r0"; +} + +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ + uint8_t* rdata = aim_zmalloc(256); + if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) { + if(*size == 256) { + *data = rdata; + return ONLP_STATUS_OK; + } + } + + aim_free(rdata); + *size = 0; + return ONLP_STATUS_E_INTERNAL; +} + +int +onlp_sysi_platform_info_get(onlp_platform_info_t* pi) +{ + int i, siz=NUM_OF_CPLD, v[NUM_OF_CPLD]={0}; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[65] = {0}; + + for (i=0; icpld_versions = aim_fstrdup("%d.%d.%d", v[0], v[1], v[2]); + else + printf("This CPLD numbers are wrong !! \n"); + + return 0; +} + +void +onlp_sysi_platform_info_free(onlp_platform_info_t* pi) +{ + aim_free(pi->cpld_versions); +} + + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + int i; + int n_led=10, n_thermal=4, n_fan=5; + + //assert(max > (n_led+n_thermal+n_fan)); + + /* 2 PSUs */ + *e++ = ONLP_PSU_ID_CREATE(1); + *e++ = ONLP_PSU_ID_CREATE(2); + + /* LEDs Item */ + for (i=1; i<=n_led; i++) + { + *e++ = ONLP_LED_ID_CREATE(i); + } + + /* THERMALs Item */ + for (i=1; i<=n_thermal; i++) + { + *e++ = ONLP_THERMAL_ID_CREATE(i); + } + + /* Fans Item */ + for (i=1; i<=n_fan; i++) + { + *e++ = ONLP_FAN_ID_CREATE(i); + } + + return 0; +} + +/* + * 1. If any FAN failed, set all the other fans as full speed (100%) + * 2. When (LM75-1 + LM75-2)/2 >= 49.5 C, set fan speed from 40% to 65%. + * 3. When (LM75-1 + LM75-2)/2 >= 53C, set fan speed from 65% to 80% + * 4. When (LM75-1 + LM75-2)/2 >= 57.7C, set fan speed from 80% to 100% + + * 5. When (LM75-1 + LM75-2)/2 <= 52.7C, set fan speed from 100% to 80% + * 6. When (LM75-1 + LM75-2)/2 <= 47.7C, set fan speed from 80% to 65% + * 7. When (LM75-1 + LM75-2)/2 <= 42.7C, set fan speed from 65% to 40% + * 8. The default FAN speed is 40% + */ +int +onlp_sysi_platform_manage_fans(void) +{ +#define LEV1_UP_TEMP 57500 /*temperature*/ +#define LEV1_DOWN_TEMP NULL /* unused */ +#define LEV1_SPEED_PERC 100 /*percentage*/ + +#define LEV2_UP_TEMP 53000 +#define LEV2_DOWN_TEMP 52700 +#define LEV2_SPEED_PERC 80 + +#define LEV3_UP_TEMP 49500 +#define LEV3_DOWN_TEMP 47700 +#define LEV3_SPEED_PERC 65 + +#define LEV4_UP_TEMP NULL /* unused */ +#define LEV4_DOWN_TEMP 42700 +#define LEV4_SPEED_PERC 40 + +#define FAN_NUM_ON_MAIN_BROAD 5 + + + int rc, i; + int is_up; + int new_temp, temp1, temp2, diff; + static int new_perc = 0, ori_perc = 0; + static int ori_temp = 0; + onlp_thermal_info_t thermal_info; + onlp_fan_info_t fan_info; + + /* get new temperature */ + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + temp1 = thermal_info.mcelsius; + + if ((rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(2), &thermal_info)) != ONLP_STATUS_OK) + goto _EXIT; + + temp2 = thermal_info.mcelsius; + + new_temp = (temp1+temp2)/2; + + /* check fan status */ + for (i=1; i<=FAN_NUM_ON_MAIN_BROAD; i++) + { + if ((rc = onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info)) != ONLP_STATUS_OK) + goto _EXIT; + + if (fan_info.status & ONLP_FAN_STATUS_FAILED) + { + new_perc = LEV1_SPEED_PERC; + goto _CTRL; + } + } + + diff = new_temp - ori_temp; + + if (diff == 0) + goto _EXIT; + else + is_up = (diff > 0 ? 1 : 0); + + if (is_up) + { + if (new_temp >= LEV1_UP_TEMP) + new_perc = LEV1_SPEED_PERC; + else if (new_temp >= LEV2_UP_TEMP) + new_perc = LEV2_SPEED_PERC; + else if (new_temp >= LEV3_UP_TEMP) + new_perc = LEV3_SPEED_PERC; + else + new_perc = LEV4_SPEED_PERC; + } + else + { + if (new_temp <= LEV4_DOWN_TEMP) + new_perc = LEV4_SPEED_PERC; + else if (new_temp <= LEV3_DOWN_TEMP) + new_perc = LEV3_SPEED_PERC; + else if (new_temp <= LEV2_DOWN_TEMP) + new_perc = LEV2_SPEED_PERC; + else + new_perc = LEV1_SPEED_PERC; + } + +_CTRL : + + if (LOCAL_DEBUG) + printf("\n[DEBUG][%s][%d]{ori:temp=%d, perc=%d} {new:temp=%d, perc=%d}\n", __FUNCTION__, __LINE__, + ori_temp, ori_perc, new_temp, new_perc); + + if (ori_perc == new_perc) + goto _EXIT; + + /* ctrl fans */ + AIM_LOG_INFO("Fan Speeds are now at %d%%", new_perc); + + if ((rc = onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), new_perc)) != ONLP_STATUS_OK) + goto _EXIT; + + /* update om */ + ori_perc = new_perc; + ori_temp = new_temp; + +_EXIT : + + return rc; +} + +int +onlp_sysi_platform_manage_leds(void) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..309f4b4a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,163 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2013 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include +#include + +#define prefix_path "/sys/bus/i2c/devices/" +#define filename "temp1_input" +#define LOCAL_DEBUG 0 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + if (LOCAL_DEBUG) \ + printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + + +enum onlp_thermal_id +{ + THERMAL_RESERVED = 0, + THERMAL_CPU_CORE, + THERMAL_1_ON_MAIN_BROAD, + THERMAL_2_ON_MAIN_BROAD, + THERMAL_3_ON_MAIN_BROAD, + THERMAL_1_ON_PSU1, + THERMAL_1_ON_PSU2, +}; + +static char* last_path[] = /* must map with onlp_thermal_id */ +{ + "reserved", + NULL, /* CPU_CORE files */ + "61-0048/", + "62-0049/", + "63-004a/", + "57-003c/psu_", + "58-003f/psu_", +}; + +static char* cpu_coretemp_files[] = + { + "/sys/devices/platform/coretemp.0/temp2_input", + "/sys/devices/platform/coretemp.0/temp3_input", + "/sys/devices/platform/coretemp.0/temp4_input", + "/sys/devices/platform/coretemp.0/temp5_input", + NULL, + }; + +/* Static values */ +static onlp_thermal_info_t linfo[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(THERMAL_CPU_CORE), "CPU Core", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1 (Front middle)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2 (Rear right)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3 (Front right)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(1)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 } +}; + + + + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) +{ + int fd, len, nbytes = 10, temp_base=1, local_id; + char r_data[10] = {0}; + char fullpath[50] = {0}; + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[local_id]; + + if(local_id == THERMAL_CPU_CORE) { + int rv = onlp_file_read_int_max(&info->mcelsius, cpu_coretemp_files); + return rv; + } + + /* get fullpath */ + sprintf(fullpath, "%s%s%s", prefix_path, last_path[local_id], filename); + + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + info->mcelsius = atoi(r_data)/temp_base; + + if (LOCAL_DEBUG) + printf("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius); + + return ONLP_STATUS_OK; +} + + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_config.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_config.c new file mode 100644 index 00000000..6076b19e --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_config.c @@ -0,0 +1,76 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(_x) #_x +#define __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(_x) __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(_x) +x86_64_accton_as5712_54x_config_settings_t x86_64_accton_as5712_54x_config_settings[] = +{ +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_LOGGING(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI + { __x86_64_accton_as5712_54x_config_STRINGIFY_NAME(X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI), __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI) }, +#else +{ X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI(__x86_64_accton_as5712_54x_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __x86_64_accton_as5712_54x_config_STRINGIFY_VALUE +#undef __x86_64_accton_as5712_54x_config_STRINGIFY_NAME + +const char* +x86_64_accton_as5712_54x_config_lookup(const char* setting) +{ + int i; + for(i = 0; x86_64_accton_as5712_54x_config_settings[i].name; i++) { + if(strcmp(x86_64_accton_as5712_54x_config_settings[i].name, setting)) { + return x86_64_accton_as5712_54x_config_settings[i].value; + } + } + return NULL; +} + +int +x86_64_accton_as5712_54x_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; x86_64_accton_as5712_54x_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", x86_64_accton_as5712_54x_config_settings[i].name, x86_64_accton_as5712_54x_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_enums.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_enums.c new file mode 100644 index 00000000..2ac2bb40 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_int.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_int.h new file mode 100644 index 00000000..e9fd753f --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * x86_64_accton_as5712_54x Internal Header + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS5712_54X_INT_H__ +#define __X86_64_ACCTON_AS5712_54X_INT_H__ + +#include + + +#endif /* __X86_64_ACCTON_AS5712_54X_INT_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.c new file mode 100644 index 00000000..88da4db9 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_accton_as5712_54x_log.h" +/* + * x86_64_accton_as5712_54x log struct. + */ +AIM_LOG_STRUCT_DEFINE( + X86_64_ACCTON_AS5712_54X_CONFIG_LOG_OPTIONS_DEFAULT, + X86_64_ACCTON_AS5712_54X_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + X86_64_ACCTON_AS5712_54X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.h b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.h new file mode 100644 index 00000000..4c3f5efc --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS5712_54X_LOG_H__ +#define __X86_64_ACCTON_AS5712_54X_LOG_H__ + +#define AIM_LOG_MODULE_NAME x86_64_accton_as5712_54x +#include + +#endif /* __X86_64_ACCTON_AS5712_54X_LOG_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_module.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_module.c new file mode 100644 index 00000000..5bdbd5df --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_accton_as5712_54x_log.h" + +static int +datatypes_init__(void) +{ +#define X86_64_ACCTON_AS5712_54X_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __x86_64_accton_as5712_54x_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_ucli.c b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_ucli.c new file mode 100644 index 00000000..7c5cf0a1 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/onlp/builds/src/module/src/x86_64_accton_as5712_54x_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if X86_64_ACCTON_AS5712_54X_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +x86_64_accton_as5712_54x_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_as5712_54x) +} + +/* */ +/* */ + +static ucli_module_t +x86_64_accton_as5712_54x_ucli_module__ = + { + "x86_64_accton_as5712_54x_ucli", + NULL, + x86_64_accton_as5712_54x_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +x86_64_accton_as5712_54x_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&x86_64_accton_as5712_54x_ucli_module__); + n = ucli_node_create("x86_64_accton_as5712_54x", NULL, &x86_64_accton_as5712_54x_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_as5712_54x")); + return n; +} + +#else +void* +x86_64_accton_as5712_54x_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/Makefile b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/PKG.yml b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..cc049fb9 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as5712-54x-r0 diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/grub.cfg b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/grub.cfg new file mode 100644 index 00000000..db3c8938 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/grub.cfg @@ -0,0 +1,21 @@ +serial --port=0x3f8 --speed=115200 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial +set timeout=5 + +# boot onl +menuentry OpenNetworkLinux { + search --no-floppy --label --set=root ONL-BOOT + echo 'Loading Open Network Linux ...' + insmod gzio + insmod part_msdos + linux /kernel-3.14-x86_64-all nopat console=ttyS0,115200n8 onl_platform=x86-64-accton-as5712-54x-r0 + initrd /initrd-amd64 +} + +# Menu entry to chainload ONIE +menuentry ONIE { + search --no-floppy --label --set=root ONIE-BOOT + echo 'Loading ONIE ...' + chainloader +1 +} diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5712-54x-r0 b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5712-54x-r0 new file mode 100644 index 00000000..269ab7ec --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/boot/x86-64-accton-as5712-54x-r0 @@ -0,0 +1,10 @@ +############################################################ +# +# x86-64-accton-as5712-54x-r0 +# +############################################################ +echo "pci0000:00/0000:00:14.0 ma1" > /etc/onl/net +echo "LABEL=FLASH * flash" > /etc/onl/mounts +echo "LABEL=FLASH2 * flash2" >> /etc/onl/mounts + + diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/install/x86-64-accton-as5712-54x-r0.sh b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/install/x86-64-accton-as5712-54x-r0.sh new file mode 100644 index 00000000..cbd26de6 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/lib/install/x86-64-accton-as5712-54x-r0.sh @@ -0,0 +1,15 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# Platform data goes here. + +platform_installer() { + # Standard isntallation to an available GPT partition + installer_standard_gpt_install +} diff --git a/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/python/x86_64_accton_as5712_54x_r0/__init__.py b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/python/x86_64_accton_as5712_54x_r0/__init__.py new file mode 100644 index 00000000..00cf421a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as5712-54x/platform-config/r0/src/python/x86_64_accton_as5712_54x_r0/__init__.py @@ -0,0 +1,61 @@ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_x86_64_accton_as5712_54x_r0(OnlPlatformAccton): + + def model(self): + return "AS5712-54X" + + def platform(self): + return "x86-64-accton-as5712-54x-r0" + + def sys_oid_platform(self): + return ".5712.54" + + def baseconfig(self): + ########### initialize I2C bus 0 ########### + # initialize CPLDs + self.new_i2c_devices( + [ + ('as5712_54x_cpld1', 0x60, 0), + ('as5712_54x_cpld2', 0x61, 0), + ('as5712_54x_cpld3', 0x62, 0), + ] + ) + # initialize SFP devices + for port in range(1, 49): + self.new_i2c_device('as5712_54x_sfp%d' % port, 0x50, port+1) + self.new_i2c_device('as5712_54x_sfp%d' % port, 0x51, port+1) + + # Initialize QSFP devices + self.new_i2c_device('as5712_54x_sfp49', 0x50, 50) + self.new_i2c_device('as5712_54x_sfp52', 0x50, 51) + self.new_i2c_device('as5712_54x_sfp50', 0x50, 52) + self.new_i2c_device('as5712_54x_sfp53', 0x50, 53) + self.new_i2c_device('as5712_54x_sfp51', 0x50, 54) + self.new_i2c_device('as5712_54x_sfp54', 0x50, 55) + + ########### initialize I2C bus 1 ########### + self.new_i2c_devices( + [ + # initiate multiplexer (PCA9548) + ('pca9548', 0x70, 1), + + # initiate PSU-1 + ('as5712_54x_psu', 0x38, 57), + ('cpr_4011_4mxx', 0x3c, 57), + + # initiate PSU-2 + ('as5712_54x_psu', 0x3b, 58), + ('cpr_4011_4mxx', 0x3f, 58), + + # initiate lm75 + ('lm75', 0x48, 61), + ('lm75', 0x49, 62), + ('lm75', 0x4a, 63), + ] + ) + + # ONIE System EEPROM + self.new_device('24c02', 0x57, '/sys/devices/pci0000:00/0000:00:13.0/i2c-1', '1-0057') + return True diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/.gitignore b/packages/platforms/accton/x86-64-accton-as6712-32x/.gitignore new file mode 100644 index 00000000..60541ef2 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/.gitignore @@ -0,0 +1,4 @@ +libonlp-x86-64-accton-as6712-32x-r0.mk +libonlp-x86-64-accton-as6712-54x-r0.mk +onlpdump.mk +x86_64_accton_as6712_32x.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/PKG.yml b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/PKG.yml new file mode 100644 index 00000000..2faa6ad1 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/PKG.yml @@ -0,0 +1,23 @@ +variables: + platform: x86-64-accton-as6712-32x-r0 + install: /lib/platform-config/${platform}/onl + +common: + version: 1.0.0 + arch: amd64 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + +packages: + - name: onlp-${platform} + summary: ONLP Package for the ${platform} platform. + + files: + builds/lib/$BUILD_DIR/x86_64-linux-gnu/bin/libonlp-${platform}.so : ${install}/lib/ + builds/onlpdump/$BUILD_DIR/x86_64-linux-gnu/bin/onlpdump : ${install}/lib/bin/ + + changelog: Change changes changes., + + + + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/.gitignore b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/lib/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/lib/Makefile new file mode 100644 index 00000000..aa1d8446 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/lib/Makefile @@ -0,0 +1,45 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/config.amd64.mk + +MODULE := libonlp-x86-64-accton-as6712-32x-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF x86_64_accton_as6712_32x onlplib +DEPENDMODULE_HEADERS := sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-x86-64-accton-as6712-32x-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/onlpdump/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..1f3700a8 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/onlpdump/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.amd64.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlp x86_64_accton_as6712_32x onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/Makefile new file mode 100644 index 00000000..c727e1b8 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := x86_64_accton_as6712_32x +AUTOMODULE := x86_64_accton_as6712_32x +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/make.mk b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..202cd5a8 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# x86_64_accton_as6712_32x Autogeneration +# +############################################################################### +x86_64_accton_as6712_32x_AUTO_DEFS := module/auto/x86_64_accton_as6712_32x.yml +x86_64_accton_as6712_32x_AUTO_DIRS := module/inc/x86_64_accton_as6712_32x module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/x86_64_accton_as6712_32x.yml b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/x86_64_accton_as6712_32x.yml new file mode 100644 index 00000000..2f325861 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/auto/x86_64_accton_as6712_32x.yml @@ -0,0 +1,50 @@ +############################################################################### +# +# x86_64_accton_as6712_32x Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB +- X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION: + doc: "Assume chassis fan direction is the same as the PSU fan direction." + default: 0 + + +definitions: + cdefs: + X86_64_ACCTON_AS6712_32X_CONFIG_HEADER: + defs: *cdefs + basename: x86_64_accton_as6712_32x_config + + portingmacro: + X86_64_ACCTON_AS6712_32X: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x.x b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x.x new file mode 100644 index 00000000..aa774b91 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_config.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_config.h new file mode 100644 index 00000000..473979e2 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_config.h @@ -0,0 +1,137 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_accton_as6712_32x Configuration Header + * + * @addtogroup x86_64_accton_as6712_32x-config + * @{ + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS6712_32X_CONFIG_H__ +#define __X86_64_ACCTON_AS6712_32X_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef X86_64_ACCTON_AS6712_32X_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING +#define X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT +#define X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT +#define X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB +#define X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI +#define X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION + * + * Assume chassis fan direction is the same as the PSU fan direction. */ + + +#ifndef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION +#define X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct x86_64_accton_as6712_32x_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} x86_64_accton_as6712_32x_config_settings_t; + +/** Configuration settings table. */ +/** x86_64_accton_as6712_32x_config_settings table. */ +extern x86_64_accton_as6712_32x_config_settings_t x86_64_accton_as6712_32x_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* x86_64_accton_as6712_32x_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int x86_64_accton_as6712_32x_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "x86_64_accton_as6712_32x_porting.h" + +#endif /* __X86_64_ACCTON_AS6712_32X_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_dox.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_dox.h new file mode 100644 index 00000000..68d657a0 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * x86_64_accton_as6712_32x Doxygen Header + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS6712_32X_DOX_H__ +#define __X86_64_ACCTON_AS6712_32X_DOX_H__ + +/** + * @defgroup x86_64_accton_as6712_32x x86_64_accton_as6712_32x - x86_64_accton_as6712_32x Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup x86_64_accton_as6712_32x-x86_64_accton_as6712_32x Public Interface + * @defgroup x86_64_accton_as6712_32x-config Compile Time Configuration + * @defgroup x86_64_accton_as6712_32x-porting Porting Macros + * + * @} + * + */ + +#endif /* __X86_64_ACCTON_AS6712_32X_DOX_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h new file mode 100644 index 00000000..ed715da6 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief x86_64_accton_as6712_32x Porting Macros. + * + * @addtogroup x86_64_accton_as6712_32x-porting + * @{ + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS6712_32X_PORTING_H__ +#define __X86_64_ACCTON_AS6712_32X_PORTING_H__ + + +/* */ +#if X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_MALLOC + #if defined(GLOBAL_MALLOC) + #define X86_64_ACCTON_AS6712_32X_MALLOC GLOBAL_MALLOC + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_MALLOC malloc + #else + #error The macro X86_64_ACCTON_AS6712_32X_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_FREE + #if defined(GLOBAL_FREE) + #define X86_64_ACCTON_AS6712_32X_FREE GLOBAL_FREE + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_FREE free + #else + #error The macro X86_64_ACCTON_AS6712_32X_FREE is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_MEMSET + #if defined(GLOBAL_MEMSET) + #define X86_64_ACCTON_AS6712_32X_MEMSET GLOBAL_MEMSET + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_MEMSET memset + #else + #error The macro X86_64_ACCTON_AS6712_32X_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define X86_64_ACCTON_AS6712_32X_MEMCPY GLOBAL_MEMCPY + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_MEMCPY memcpy + #else + #error The macro X86_64_ACCTON_AS6712_32X_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define X86_64_ACCTON_AS6712_32X_STRNCPY GLOBAL_STRNCPY + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_STRNCPY strncpy + #else + #error The macro X86_64_ACCTON_AS6712_32X_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define X86_64_ACCTON_AS6712_32X_VSNPRINTF GLOBAL_VSNPRINTF + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_VSNPRINTF vsnprintf + #else + #error The macro X86_64_ACCTON_AS6712_32X_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define X86_64_ACCTON_AS6712_32X_SNPRINTF GLOBAL_SNPRINTF + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_SNPRINTF snprintf + #else + #error The macro X86_64_ACCTON_AS6712_32X_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef X86_64_ACCTON_AS6712_32X_STRLEN + #if defined(GLOBAL_STRLEN) + #define X86_64_ACCTON_AS6712_32X_STRLEN GLOBAL_STRLEN + #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 + #define X86_64_ACCTON_AS6712_32X_STRLEN strlen + #else + #error The macro X86_64_ACCTON_AS6712_32X_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __X86_64_ACCTON_AS6712_32X_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/make.mk b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..ac67385a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +x86_64_accton_as6712_32x_INCLUDES := -I $(THIS_DIR)inc +x86_64_accton_as6712_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src +x86_64_accton_as6712_32x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as6712_32x ucli:x86_64_accton_as6712_32x + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..d1f6ae4f --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py x86_64_accton_as6712_32x_ucli.c + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/debug.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/debug.c new file mode 100644 index 00000000..8a8eb125 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/debug.c @@ -0,0 +1,45 @@ +#include "x86_64_accton_as6712_32x_int.h" + +#if X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEBUG == 1 + +#include + +static char help__[] = + "Usage: debug [options]\n" + " -c CPLD Versions\n" + " -h Help\n" + ; + +int +x86_64_accton_as6712_32x_debug_main(int argc, char* argv[]) +{ + int c = 0; + int help = 0; + int rv = 0; + + while( (c = getopt(argc, argv, "ch")) != -1) { + switch(c) + { + case 'c': c = 1; break; + case 'h': help = 1; rv = 0; break; + default: help = 1; rv = 1; break; + } + + } + + if(help || argc == 1) { + printf("%s", help__); + return rv; + } + + if(c) { + printf("Not implemented.\n"); + } + + + return 0; +} + +#endif + + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/fani.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..04af3103 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/fani.c @@ -0,0 +1,380 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Fan Platform Implementation Defaults. + * + ***********************************************************/ +#include +#include +#include +#include "platform_lib.h" + +#define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as6712_32x_fan/" +#define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/" + +#define MAX_FAN_SPEED 25500 +#define MAX_PSU_FAN_SPEED 19328 + +#define PROJECT_NAME +#define LEN_FILE_NAME 80 + +#define FAN_RESERVED 0 +#define FAN_1_ON_MAIN_BOARD 1 +#define FAN_2_ON_MAIN_BOARD 2 +#define FAN_3_ON_MAIN_BOARD 3 +#define FAN_4_ON_MAIN_BOARD 4 +#define FAN_5_ON_MAIN_BOARD 5 +#define FAN_1_ON_PSU1 6 +#define FAN_1_ON_PSU2 7 + +typedef struct fan_path_S +{ + char status[LEN_FILE_NAME]; + char speed[LEN_FILE_NAME]; + char direction[LEN_FILE_NAME]; + char ctrl_speed[LEN_FILE_NAME]; + char r_status[LEN_FILE_NAME]; + char r_speed[LEN_FILE_NAME]; +}fan_path_T; + +#define _MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id) \ + { #prj"fan"#id"_fault", #prj"fan"#id"_speed_rpm", #prj"fan"#id"_direction",\ + #prj"fan"#id"_duty_cycle_percentage", #prj"fanr"#id"_fault", #prj"fanr"#id"_speed_rpm" } + +#define MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id) _MAKE_FAN_PATH_ON_MAIN_BOARD(prj,id) + +#define MAKE_FAN_PATH_ON_PSU(folder) \ + {#folder"/psu_fan1_fault", #folder"/psu_fan1_speed_rpm", \ + #folder"/psu_fan1_duty_cycle_percentage", "", "" } + +static fan_path_T fan_path[] = /* must map with onlp_fan_id */ +{ + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_RESERVED), + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_1_ON_MAIN_BOARD), + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD), + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD), + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD), + MAKE_FAN_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD), + MAKE_FAN_PATH_ON_PSU(35-003c), + MAKE_FAN_PATH_ON_PSU(36-003f) +}; + +#define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##id##_ON_MAIN_BOARD), "Chassis Fan "#id, 0 }, \ + 0x0, \ + (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + +#define MAKE_FAN_INFO_NODE_ON_PSU(psu_id, fan_id) \ + { \ + { ONLP_FAN_ID_CREATE(FAN_##fan_id##_ON_PSU##psu_id), "Chassis PSU-"#psu_id " Fan "#fan_id, 0 }, \ + 0x0, \ + (ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE), \ + 0, \ + 0, \ + ONLP_FAN_MODE_INVALID, \ + } + +/* Static fan information */ +onlp_fan_info_t linfo[] = { + { }, /* Not used */ + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(1), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(2), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(3), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(4), + MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(5), + MAKE_FAN_INFO_NODE_ON_PSU(1,1), + MAKE_FAN_INFO_NODE_ON_PSU(2,1), +}; + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_FAN(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + DEBUG_PRINT("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + DEBUG_PRINT("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + +static int +_onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) +{ + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[65] = {0}; + + /* get fan/fanr fault status (turn on when any one fails) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].r_status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan/fanr direction (both : the same) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + + if (atoi(r_data) == 0) /*F2B*/ + info->status |= ONLP_FAN_STATUS_F2B; + else + info->status |= ONLP_FAN_STATUS_B2F; + + /* get fan/fanr speed (take the min from two speeds) + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (info->rpm > atoi(r_data)) + info->rpm = atoi(r_data); + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100)/MAX_FAN_SPEED; + + /* check present */ + if (info->rpm > 0) + info->status |= ONLP_FAN_STATUS_PRESENT; + + return ONLP_STATUS_OK; +} + +static int +_onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) +{ + int psu_id; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[80] = {0}; + psu_type_t psu_type; + + /* get fan fault status + */ + psu_id = (local_id-FAN_1_ON_PSU1) + 1; + DEBUG_PRINT("[Debug][%s][%d][psu_id: %d]\n", __FUNCTION__, __LINE__, psu_id); + + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ + DEBUG_PRINT("[Debug][%s][%d][psu_type: %d]\n", __FUNCTION__, __LINE__, psu_type); + + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B); + break; + case PSU_TYPE_AC_B2F: + info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); + break; + default: + DEBUG_PRINT("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + break; + } + /* get fan fault status + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) > 0) + info->status |= ONLP_FAN_STATUS_FAILED; + + /* get fan speed + */ + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); + + /* get speed percentage from rpm */ + info->percentage = (info->rpm * 100) / MAX_PSU_FAN_SPEED; + info->status |= ONLP_FAN_STATUS_PRESENT; + + return ONLP_STATUS_OK; +} + +/* + * This function will be called prior to all of onlp_fani_* functions. + */ +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) +{ + int rc = 0; + int local_id; + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + *info = linfo[local_id]; + + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + break; + case FAN_1_ON_MAIN_BOARD: + case FAN_2_ON_MAIN_BOARD: + case FAN_3_ON_MAIN_BOARD: + case FAN_4_ON_MAIN_BOARD: + case FAN_5_ON_MAIN_BOARD: + rc =_onlp_fani_info_get_fan(local_id, info); + break; + default: + rc = ONLP_STATUS_E_INVALID; + break; + } + + return rc; +} + +/* + * This function sets the speed of the given fan in RPM. + * + * This function will only be called if the fan supprots the RPM_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_rpm_set(onlp_oid_t id, int rpm) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan speed of the given OID as a percentage. + * + * This will only be called if the OID has the PERCENTAGE_SET + * capability. + * + * It is optional if you have no fans at all with this feature. + */ +int +onlp_fani_percentage_set(onlp_oid_t id, int p) +{ + int fd, len, nbytes=10, local_id; + char data[10] = {0}; + char fullpath[70] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* reject p=0 (p=0, stop fan) */ + if (p == 0){ + return ONLP_STATUS_E_INVALID; + } + + /* get fullpath */ + switch (local_id) + { + case FAN_1_ON_PSU1: + case FAN_1_ON_PSU2: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); + break; + case FAN_1_ON_MAIN_BOARD: + case FAN_2_ON_MAIN_BOARD: + case FAN_3_ON_MAIN_BOARD: + case FAN_4_ON_MAIN_BOARD: + case FAN_5_ON_MAIN_BOARD: + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].ctrl_speed); + break; + default: + return ONLP_STATUS_E_INVALID; + } + sprintf(data, "%d", p); + DEBUG_PRINT("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data); + + /* Create output file descriptor */ + fd = open(fullpath, O_WRONLY, 0644); + if (fd == -1){ + return ONLP_STATUS_E_INTERNAL; + } + + len = write (fd, data, (ssize_t) nbytes); + if (len != nbytes) { + close(fd); + return ONLP_STATUS_E_INTERNAL; + } + + close(fd); + return ONLP_STATUS_OK; +} + + +/* + * This function sets the fan speed of the given OID as per + * the predefined ONLP fan speed modes: off, slow, normal, fast, max. + * + * Interpretation of these modes is up to the platform. + * + */ +int +onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function sets the fan direction of the given OID. + * + * This function is only relevant if the fan OID supports both direction + * capabilities. + * + * This function is optional unless the functionality is available. + */ +int +onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * Generic fan ioctl. Optional. + */ +int +onlp_fani_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/ledi.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/ledi.c new file mode 100644 index 00000000..b81d6e65 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/ledi.c @@ -0,0 +1,328 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include + +#include "platform_lib.h" + +#define prefix_path "/sys/class/leds/accton_as6712_32x_led::" +#define filename "brightness" + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_LED(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +/* LED related data + */ +enum onlp_led_id +{ + LED_RESERVED = 0, + LED_PSU1, + LED_PSU2, + LED_DIAG, + LED_LOC, + LED_FAN, + LED_FAN1, + LED_FAN2, + LED_FAN3, + LED_FAN4, + LED_FAN5 +}; + +enum led_light_mode { + /* psu led mode */ + LED_MODE_PSU_OFF = 0, + LED_MODE_PSU_GREEN, + LED_MODE_PSU_AMBER, + LED_MODE_PSU_AUTO = 7, + + /* diag led mode*/ + LED_MODE_DIAG_OFF = 0, + LED_MODE_DIAG_GREEN, + LED_MODE_DIAG_AMBER, + LED_MODE_DIAG_GREEN_BLINK = 4, + + /* locator led mode*/ + LED_MODE_LOC_OFF = 0, + LED_MODE_LOC_AMBER = 2, + LED_MODE_LOC_AMBER_BLINKING = 5, + + /* fan led mode */ + LED_MODE_FAN_OFF = 0, + LED_MODE_FAN_GREEN, + LED_MODE_FAN_AMBER, + LED_MODE_FAN_AUTO = 7, + + /* fanX led mode */ + LED_MODE_FANX_OFF = 0, + LED_MODE_FANX_GREEN, + LED_MODE_FANX_RED = 3 +}; + +typedef struct led_light_mode_map { + enum onlp_led_id id; + enum led_light_mode driver_led_mode; + enum onlp_led_mode_e onlp_led_mode; +} led_light_mode_map_t; + +led_light_mode_map_t led_map[] = { +{LED_PSU1, LED_MODE_PSU_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU1, LED_MODE_PSU_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_PSU1, LED_MODE_PSU_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU1, LED_MODE_PSU_AUTO, ONLP_LED_MODE_AUTO}, +{LED_PSU2, LED_MODE_PSU_OFF, ONLP_LED_MODE_OFF}, +{LED_PSU2, LED_MODE_PSU_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_PSU2, LED_MODE_PSU_GREEN, ONLP_LED_MODE_GREEN}, +{LED_PSU2, LED_MODE_PSU_AUTO, ONLP_LED_MODE_AUTO}, +{LED_DIAG, LED_MODE_DIAG_OFF, ONLP_LED_MODE_OFF}, +{LED_DIAG, LED_MODE_DIAG_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_DIAG, LED_MODE_DIAG_GREEN, ONLP_LED_MODE_GREEN}, +{LED_DIAG, LED_MODE_DIAG_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, +{LED_LOC, LED_MODE_LOC_OFF, ONLP_LED_MODE_OFF}, +{LED_LOC, LED_MODE_LOC_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_LOC, LED_MODE_LOC_AMBER_BLINKING, ONLP_LED_MODE_ORANGE_BLINKING}, +{LED_FAN, LED_MODE_FAN_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN, LED_MODE_FAN_AMBER, ONLP_LED_MODE_ORANGE}, +{LED_FAN, LED_MODE_FAN_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN, LED_MODE_FAN_AUTO, ONLP_LED_MODE_AUTO}, +{LED_FAN1, LED_MODE_FANX_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN1, LED_MODE_FANX_RED, ONLP_LED_MODE_RED}, +{LED_FAN1, LED_MODE_FANX_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN2, LED_MODE_FANX_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN2, LED_MODE_FANX_RED, ONLP_LED_MODE_RED}, +{LED_FAN2, LED_MODE_FANX_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN3, LED_MODE_FANX_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN3, LED_MODE_FANX_RED, ONLP_LED_MODE_RED}, +{LED_FAN3, LED_MODE_FANX_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN4, LED_MODE_FANX_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN4, LED_MODE_FANX_RED, ONLP_LED_MODE_RED}, +{LED_FAN4, LED_MODE_FANX_GREEN, ONLP_LED_MODE_GREEN}, +{LED_FAN5, LED_MODE_FANX_OFF, ONLP_LED_MODE_OFF}, +{LED_FAN5, LED_MODE_FANX_RED, ONLP_LED_MODE_RED}, +{LED_FAN5, LED_MODE_FANX_GREEN, ONLP_LED_MODE_GREEN}}; + +static char last_path[][10] = /* must map with onlp_led_id */ +{ + "reserved", + "psu1", + "psu2", + "diag", + "loc", + "fan", + "fan1", + "fan2", + "fan3", + "fan4", + "fan5" +}; + +/* + * Get the information for the given LED OID. + */ +static onlp_led_info_t linfo[] = +{ + { }, /* Not used */ + { + { ONLP_LED_ID_CREATE(LED_PSU1), "Chassis LED 1 (PSU1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_PSU2), "Chassis LED 2 (PSU2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_DIAG), "Chassis LED 3 (DIAG LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_GREEN_BLINKING, + }, + { + { ONLP_LED_ID_CREATE(LED_LOC), "Chassis LED 4 (LOC LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_ORANGE_BLINKING, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN), "Chassis LED 5 (FAN LED)", 0 }, + ONLP_LED_STATUS_PRESENT, + ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_ORANGE | ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_AUTO, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + }, + { + { ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10(FAN5 LED)", 0 }, + ONLP_LED_STATUS_PRESENT, 0, + } +}; + +static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) +{ + int i, nsize = sizeof(led_map)/sizeof(led_map[0]); + + for (i = 0; i < nsize; i++) + { + if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) + { + return led_map[i].onlp_led_mode; + } + } + + return 0; +} + +static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) +{ + int i, nsize = sizeof(led_map)/sizeof(led_map[0]); + + for(i = 0; i < nsize; i++) + { + if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) + { + return led_map[i].driver_led_mode; + } + } + + return 0; +} + +/* + * This function will be called prior to any other onlp_ledi_* functions. + */ +int +onlp_ledi_init(void) +{ + return ONLP_STATUS_OK; +} + +int +onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) +{ + int local_id; + char data[2] = {0}; + char fullpath[50] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + + /* get fullpath */ + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[ONLP_OID_ID_GET(id)]; + + /* Set LED mode */ + if (deviceNodeReadString(fullpath, data, sizeof(data), 0) != 0) { + DEBUG_PRINT("%s(%d)\r\n", __FUNCTION__, __LINE__); + return ONLP_STATUS_E_INTERNAL; + } + + info->mode = driver_to_onlp_led_mode(local_id, atoi(data)); + + /* Set the on/off status */ + if (info->mode != ONLP_LED_MODE_OFF) { + info->status |= ONLP_LED_STATUS_ON; + } + + return ONLP_STATUS_OK; +} + +/* + * Turn an LED on or off. + * + * This function will only be called if the LED OID supports the ONOFF + * capability. + * + * What 'on' means in terms of colors or modes for multimode LEDs is + * up to the platform to decide. This is intended as baseline toggle mechanism. + */ +int +onlp_ledi_set(onlp_oid_t id, int on_or_off) +{ + VALIDATE(id); + + if (!on_or_off) { + return onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); + } + + return ONLP_STATUS_E_UNSUPPORTED; +} + +/* + * This function puts the LED into the given mode. It is a more functional + * interface for multimode LEDs. + * + * Only modes reported in the LED's capabilities will be attempted. + */ +int +onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) +{ + int local_id; + char fullpath[50] = {0}; + + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + + if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0) + { + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +/* + * Generic LED ioctl interface. + */ +int +onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/make.mk b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..e65c6116 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := x86_64_accton_as6712_32x +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.c new file mode 100644 index 00000000..5e9cf61a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.c @@ -0,0 +1,144 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "platform_lib.h" + +int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeWriteInt(char *filename, int value, int data_len) +{ + char buf[8] = {0}; + sprintf(buf, "%d", value); + + return deviceNodeWrite(filename, buf, sizeof(buf)-1, data_len); +} + +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) +{ + int fd; + int len; + + if ((buffer == NULL) || (buf_size < 0)) { + return -1; + } + + if ((fd = open(filename, O_RDONLY)) == -1) { + return -1; + } + + if ((len = read(fd, buffer, buf_size)) < 0) { + close(fd); + return -1; + } + + if ((close(fd) == -1)) { + return -1; + } + + if ((len > buf_size) || (data_len != 0 && len != data_len)) { + return -1; + } + + return 0; +} + +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len) +{ + int ret; + + if (data_len >= buf_size) { + return -1; + } + + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); + + if (ret == 0) { + buffer[buf_size-1] = '\0'; + } + + return ret; +} + +#define I2C_PSU_MODEL_NAME_LEN 13 + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len) +{ + char *node = NULL; + char model_name[I2C_PSU_MODEL_NAME_LEN + 1] = {0}; + + /* Check AC model name */ + node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_model_name) : PSU2_AC_HWMON_NODE(psu_model_name); + + if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { + if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_F2B; + } + else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { + if (modelname) { + strncpy(modelname, model_name, modelname_len-1); + } + return PSU_TYPE_AC_B2F; + } + } + + return PSU_TYPE_UNKNOWN; +} diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.h new file mode 100644 index 00000000..215c2259 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/platform_lib.h @@ -0,0 +1,72 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __PLATFORM_LIB_H__ +#define __PLATFORM_LIB_H__ + +#include "x86_64_accton_as6712_32x_log.h" + +#define CHASSIS_FAN_COUNT 5 +#define CHASSIS_THERMAL_COUNT 4 + +#define PSU1_ID 1 +#define PSU2_ID 2 + +#define PSU1_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/35-003c/" +#define PSU2_AC_PMBUS_PREFIX "/sys/bus/i2c/devices/36-003f/" + +#define PSU1_AC_PMBUS_NODE(node) PSU1_AC_PMBUS_PREFIX#node +#define PSU2_AC_PMBUS_NODE(node) PSU2_AC_PMBUS_PREFIX#node + +#define PSU1_AC_HWMON_PREFIX "/sys/bus/i2c/devices/35-0038/" +#define PSU2_AC_HWMON_PREFIX "/sys/bus/i2c/devices/36-003b/" + +#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node +#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node + +#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-1/1-0057/eeprom" + +int deviceNodeWriteInt(char *filename, int value, int data_len); +int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len); +int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len); + +typedef enum psu_type { + PSU_TYPE_UNKNOWN, + PSU_TYPE_AC_F2B, + PSU_TYPE_AC_B2F +} psu_type_t; + +psu_type_t get_psu_type(int id, char* modelname, int modelname_len); + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(format, ...) printf(format, __VA_ARGS__) +#else + #define DEBUG_PRINT(format, ...) +#endif + +#endif /* __PLATFORM_LIB_H__ */ + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/psui.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..28f69306 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/psui.c @@ -0,0 +1,224 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +#define PSU_STATUS_PRESENT 1 +#define PSU_STATUS_POWER_GOOD 1 + +#define PSU_NODE_MAX_INT_LEN 8 +#define PSU_NODE_MAX_PATH_LEN 64 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_PSU(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +static int +psu_status_info_get(int id, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", PSU1_AC_HWMON_PREFIX, node); + } + else if (PSU2_ID == id) { + sprintf(node_path, "%s%s", PSU2_AC_HWMON_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static int +psu_cpr_4011_pmbus_info_get(int id, char *node, int *value) +{ + int ret = 0; + char buf[PSU_NODE_MAX_INT_LEN + 1] = {0}; + char node_path[PSU_NODE_MAX_PATH_LEN] = {0}; + + *value = 0; + + if (PSU1_ID == id) { + sprintf(node_path, "%s%s", PSU1_AC_PMBUS_PREFIX, node); + } + else { + sprintf(node_path, "%s%s", PSU2_AC_PMBUS_PREFIX, node); + } + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), 0); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +int +onlp_psui_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +psu_cpr_4011_info_get(onlp_psu_info_t* info) +{ + int val = 0; + int index = ONLP_OID_ID_GET(info->hdr.id); + + /* Set capability + */ + info->caps = ONLP_PSU_CAPS_AC; + + if (info->status & ONLP_PSU_STATUS_FAILED) { + return ONLP_STATUS_OK; + } + + /* Set the associated oid_table */ + info->hdr.coids[0] = ONLP_FAN_ID_CREATE(index + CHASSIS_FAN_COUNT); + info->hdr.coids[1] = ONLP_THERMAL_ID_CREATE(index + CHASSIS_THERMAL_COUNT); + + /* Read voltage, current and power */ + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_out", &val) == 0) { + info->mvout = val; + info->caps |= ONLP_PSU_CAPS_VOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_v_in", &val) == 0) { + info->mvin = val; + info->caps |= ONLP_PSU_CAPS_VIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_out", &val) == 0) { + info->miout = val; + info->caps |= ONLP_PSU_CAPS_IOUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_i_in", &val) == 0) { + info->miin = val; + info->caps |= ONLP_PSU_CAPS_IIN; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_out", &val) == 0) { + info->mpout = val; + info->caps |= ONLP_PSU_CAPS_POUT; + } + + if (psu_cpr_4011_pmbus_info_get(index, "psu_p_in", &val) == 0) { + info->mpin = val; + info->caps |= ONLP_PSU_CAPS_PIN; + } + + return ONLP_STATUS_OK; +} + +/* + * Get all information about the given PSU oid. + */ +static onlp_psu_info_t pinfo[] = +{ + { }, /* Not used */ + { + { ONLP_PSU_ID_CREATE(PSU1_ID), "PSU-1", 0 }, + }, + { + { ONLP_PSU_ID_CREATE(PSU2_ID), "PSU-2", 0 }, + } +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int val = 0; + int ret = ONLP_STATUS_OK; + int index = ONLP_OID_ID_GET(id); + psu_type_t psu_type; + + VALIDATE(id); + + memset(info, 0, sizeof(onlp_psu_info_t)); + *info = pinfo[index]; /* Set the onlp_oid_hdr_t */ + + /* Get the present state */ + if (psu_status_info_get(index, "psu_present", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_present)\r\n", index); + } + + if (val != PSU_STATUS_PRESENT) { + info->status &= ~ONLP_PSU_STATUS_PRESENT; + return ONLP_STATUS_OK; + } + info->status |= ONLP_PSU_STATUS_PRESENT; + + + /* Get power good status */ + if (psu_status_info_get(index, "psu_power_good", &val) != 0) { + printf("Unable to read PSU(%d) node(psu_power_good)\r\n", index); + } + + if (val != PSU_STATUS_POWER_GOOD) { + info->status |= ONLP_PSU_STATUS_FAILED; + } + + + /* Get PSU type + */ + psu_type = get_psu_type(index, info->model, sizeof(info->model)); + + switch (psu_type) { + case PSU_TYPE_AC_F2B: + case PSU_TYPE_AC_B2F: + ret = psu_cpr_4011_info_get(info); + break; + default: + ret = ONLP_STATUS_E_UNSUPPORTED; + break; + } + + return ret; +} + +int +onlp_psui_ioctl(onlp_oid_t pid, va_list vargs) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sfpi.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..36f2b772 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,189 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include + +#include /* For O_RDWR && open */ +#include +#include +#include +#include + +#include "platform_lib.h" + +#define MAX_SFP_PATH 64 +static char sfp_node_path[MAX_SFP_PATH] = {0}; +#define FRONT_PORT_TO_CPLD_MUX_INDEX(port) (port+2) + +static int +as6712_32x_sfp_node_read_int(char *node_path, int *value, int data_len) +{ + int ret = 0; + char buf[8]; + *value = 0; + + ret = deviceNodeReadString(node_path, buf, sizeof(buf), data_len); + + if (ret == 0) { + *value = atoi(buf); + } + + return ret; +} + +static char* +as6712_32x_sfp_get_port_path(int port, char *node_name) +{ + sprintf(sfp_node_path, "/sys/bus/i2c/devices/%d-0050/%s", + FRONT_PORT_TO_CPLD_MUX_INDEX(port), + node_name); + + return sfp_node_path; +} + +/************************************************************ + * + * SFPI Entry Points + * + ***********************************************************/ +int +onlp_sfpi_init(void) +{ + /* Called at initialization time */ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + /* + * Ports {0, 32} + */ + int p; + AIM_BITMAP_CLR_ALL(bmap); + + for(p = 0; p < 32; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_is_present(int port) +{ + /* + * Return 1 if present. + * Return 0 if not present. + * Return < 0 if error. + */ + int present; + char* path = as6712_32x_sfp_get_port_path(port, "sfp_is_present"); + + if (as6712_32x_sfp_node_read_int(path, &present, 1) != 0) { + AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return present; +} + +int +onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + uint32_t bytes[4]; + char* path; + FILE* fp; + + path = as6712_32x_sfp_get_port_path(0, "sfp_is_present_all"); + fp = fopen(path, "r"); + + if(fp == NULL) { + AIM_LOG_ERROR("Unable to open the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + int count = fscanf(fp, "%x %x %x %x", + bytes+0, + bytes+1, + bytes+2, + bytes+3 + ); + fclose(fp); + if(count != AIM_ARRAYSIZE(bytes)) { + /* Likely a CPLD read timeout. */ + AIM_LOG_ERROR("Unable to read all fields from the sfp_is_present_all device file."); + return ONLP_STATUS_E_INTERNAL; + } + + /* Convert to 64 bit integer in port order */ + int i = 0; + uint32_t presence_all = 0 ; + for(i = AIM_ARRAYSIZE(bytes)-1; i >= 0; i--) { + presence_all <<= 8; + presence_all |= bytes[i]; + } + + /* Populate bitmap */ + for(i = 0; presence_all; i++) { + AIM_BITMAP_MOD(dst, i, (presence_all & 1)); + presence_all >>= 1; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst) +{ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + char* path = as6712_32x_sfp_get_port_path(port, "sfp_eeprom"); + + /* + * Read the SFP eeprom into data[] + * + * Return MISSING if SFP is missing. + * Return OK if eeprom is read + */ + memset(data, 0, 256); + + if (deviceNodeReadBinary(path, (char*)data, 256, 256) != 0) { + AIM_LOG_ERROR("Unable to read eeprom from port(%d)\r\n", port); + return ONLP_STATUS_E_INTERNAL; + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_denit(void) +{ + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sysi.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..4f145167 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,316 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "x86_64_accton_as6712_32x_int.h" +#include "x86_64_accton_as6712_32x_log.h" + +#include "platform_lib.h" + +#define NUM_OF_THERMAL_ON_MAIN_BROAD 5 +#define NUM_OF_FAN_ON_MAIN_BROAD 5 +#define NUM_OF_PSU_ON_MAIN_BROAD 2 +#define NUM_OF_LED_ON_MAIN_BROAD 10 + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + DEBUG_PRINT("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + DEBUG_PRINT("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + +#define PREFIX_PATH_ON_CPLD_DEV "/sys/bus/i2c/devices/" +#define NUM_OF_CPLD 3 +static char arr_cplddev_name[NUM_OF_CPLD][10] = +{ + "0-0060", + "0-0062", + "0-0064" +}; + +const char* +onlp_sysi_platform_get(void) +{ + return "x86-64-accton-as6712-32x-r0"; +} + + +int +onlp_sysi_onie_data_get(uint8_t** data, int* size) +{ + uint8_t* rdata = aim_zmalloc(256); + if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) { + if(*size == 256) { + *data = rdata; + return ONLP_STATUS_OK; + } + } + + aim_free(rdata); + *size = 0; + return ONLP_STATUS_E_INTERNAL; +} + +int +onlp_sysi_platform_info_get(onlp_platform_info_t* pi) +{ + int i, siz=NUM_OF_CPLD, v[NUM_OF_CPLD]; + int fd, len, nbytes = 10; + char r_data[10] = {0}; + char fullpath[65] = {0}; + + for (i=0; icpld_versions = aim_fstrdup("%d.%d.%d", v[0], v[1], v[2]); + else + printf("This CPLD numbers are wrong !! \n"); + + return 0; +} + +void +onlp_sysi_platform_info_free(onlp_platform_info_t* pi) +{ + aim_free(pi->cpld_versions); +} + + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + int i; + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* 4 Thermal sensors on the chassis */ + for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++) + { + *e++ = ONLP_THERMAL_ID_CREATE(i); + } + + /* 9 LEDs on the chassis */ + for (i = 1; i <= NUM_OF_LED_ON_MAIN_BROAD; i++) + { + *e++ = ONLP_LED_ID_CREATE(i); + } + + /* 4 Fans on the chassis */ + for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++) + { + *e++ = ONLP_FAN_ID_CREATE(i); + } + + /* 2 PSUs on the chassis */ + for (i = 1; i <= NUM_OF_PSU_ON_MAIN_BROAD; i++) + { + *e++ = ONLP_PSU_ID_CREATE(i); + } + + return 0; +} + +/* Fan speed control related data + */ +enum fan_duty_cycle { + FAN_DUTY_CYCLE_MIN = 40, + FAN_DUTY_CYCLE_65 = 65, + FAN_DUTY_CYCLE_80 = 80, + FAN_DUTY_CYCLE_MAX = 100 +}; + +typedef struct fan_ctrl_policy { + enum fan_duty_cycle duty_cycle; + int temp_down_adjust; /* The boundary temperature to down adjust fan speed */ + int temp_up_adjust; /* The boundary temperature to up adjust fan speed */ +} fan_ctrl_policy_t; + +fan_ctrl_policy_t fan_ctrl_policy_f2b[] = { +{FAN_DUTY_CYCLE_MIN, 0, 47950}, +{FAN_DUTY_CYCLE_65, 42050, 49650}, +{FAN_DUTY_CYCLE_80, 47050, 54050}, +{FAN_DUTY_CYCLE_MAX, 52050, 0} +}; + +fan_ctrl_policy_t fan_ctrl_policy_b2f[] = { +{FAN_DUTY_CYCLE_MIN, 0, 40850}, +{FAN_DUTY_CYCLE_65, 35400, 44850}, +{FAN_DUTY_CYCLE_80, 40400, 47400}, +{FAN_DUTY_CYCLE_MAX, 45400, 0} +}; + +#define FAN_SPEED_CTRL_PATH "/sys/devices/platform/as6712_32x_fan/fan1_duty_cycle_percentage" + +/* + * Front to Back + * 1. When (LM75-1 + LM75-4)/2 >= 47.95 C, please set CPLD's registor 0xd from "0x08" to "0x0d". (40% to 65%). + * 2. When (LM75-1 + LM75-4)/2 >= 49.65 C, please set CPLD's registor 0xd from "0x0d" to "0x10". (65% to 80%) + * 3. When (LM75-1 + LM75-4)/2 >= 54.05C, please set CPLD's registor 0x0d from "0x10" to "0x14". (80% to 100%) + * 4. When (LM75-1 + LM75-4)/2 <= 52.05C, please set CPLD's registor 0x0d from "0x14" to "0x10". (100% to 80%) + * 5. When (LM75-1 + LM75-4)/2 <= 47.05C, please set CPLD's registor 0x0d from "0x10" to "0x0d". (80% to 65%) + * 6. When (LM75-1 + LM75-4)/2 <= 42.05C, please set CPLD's registor 0x0d from "0x0d" to "0x08" (65% to 40%). + * 7. If CPLD's (0x60 address) registor 0x0C is not equal "0x0", for example "0x1~0x1f", + * please set CPLD's registor 0x0d to "0x14" (direct to 100%) <--- Due to FAN Failed occur. + * 8. Default value for FAN speed is 40% which is CPLD's registor 0x0d value is "0x08". + + * Back to Front + * 1. When (LM75-1 + LM75-4)/2 >= 40.85 C, please set CPLD's registor 0xd from "0x08" to "0x0d". (40% to 65%). + * 2. When (LM75-1 + LM75-4)/2 >= 44.85 C, please set CPLD's registor 0xd from "0x0d" to "0x10". (65% to 80%) + * 3. When (LM75-1 + LM75-4)/2 >= 47.4C, please set CPLD's registor 0x0d from "0x10" to "0x14". (80% to 100%) + * 4. When (LM75-1 + LM75-4)/2 <= 45.4C, please set CPLD's registor 0x0d from "0x14" to "0x10". (100% to 80%) + * 5. When (LM75-1 + LM75-4)/2 <= 40.4C, please set CPLD's registor 0x0d from "0x10" to "0x0d". (80% to 65%) + * 6. When (LM75-1 + LM75-4)/2 <= 35.4C, please set CPLD's registor 0x0d from "0x0d" to "0x08" (65% to 40%). + * 7. If CPLD's (0x60 address) registor 0x0C is not equal "0x0", for example "0x1~0x1f", + * please set CPLD's registor 0x0d to "0x14" (direct to 100%) <--- Due to FAN Failed occur. + * 8. Default value for FAN speed is 40% which is CPLD's registor 0x0d value is "0x08". + */ +int +onlp_sysi_platform_manage_fans(void) +{ + int i = 0, arr_size, avg_temp; + fan_ctrl_policy_t *policy; + int cur_duty_cycle, new_duty_cycle; + onlp_thermal_info_t thermal_1, thermal_4; + + int fd, len; + char buf[10] = {0}; + + /* Get each fan status + */ + for (i = 1; i <= NUM_OF_FAN_ON_MAIN_BROAD; i++) + { + onlp_fan_info_t fan_info; + + if (onlp_fani_info_get(ONLP_FAN_ID_CREATE(i), &fan_info) != ONLP_STATUS_OK) { + AIM_LOG_ERROR("Unable to get fan(%d) status", i); + return ONLP_STATUS_E_INTERNAL; + } + + /* Decision 1: Set fan as full speed if any fan is failed. + */ + if (!(fan_info.status & ONLP_FAN_STATUS_PRESENT) || fan_info.status & ONLP_FAN_STATUS_FAILED) { + AIM_LOG_MSG("Setting max"); + return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_CYCLE_MAX); + } + + /* Get fan direction (Only get the first one since all fan direction are the same) + */ + if (i == 1) { + if (fan_info.status & ONLP_FAN_STATUS_F2B) { + policy = fan_ctrl_policy_f2b; + arr_size = AIM_ARRAYSIZE(fan_ctrl_policy_f2b); + } + else { + policy = fan_ctrl_policy_b2f; + arr_size = AIM_ARRAYSIZE(fan_ctrl_policy_b2f); + } + } + } + + /* Get current fan speed + */ + fd = open(FAN_SPEED_CTRL_PATH, O_RDONLY); + if (fd == -1){ + AIM_LOG_ERROR("Unable to open fan speed control node (%s)", FAN_SPEED_CTRL_PATH); + return ONLP_STATUS_E_INTERNAL; + } + + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 0) { + AIM_LOG_ERROR("Unable to read fan speed from (%s)", FAN_SPEED_CTRL_PATH); + return ONLP_STATUS_E_INTERNAL; + } + cur_duty_cycle = atoi(buf); + + + /* Decision 2: If no matched fan speed is found from the policy, + * use FAN_DUTY_CYCLE_MIN as default speed + */ + for (i = 0; i < arr_size; i++) { + if (policy[i].duty_cycle != cur_duty_cycle) + continue; + + break; + } + + if (i == arr_size) { + return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), FAN_DUTY_CYCLE_MIN); + } + + /* Get current temperature + */ + if (onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &thermal_1) != ONLP_STATUS_OK || + onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(4), &thermal_4) != ONLP_STATUS_OK) { + AIM_LOG_ERROR("Unable to read thermal status"); + return ONLP_STATUS_E_INTERNAL; + } + avg_temp = (thermal_1.mcelsius + thermal_4.mcelsius) / 2; + + + /* Decision 3: Decide new fan speed depend on fan direction/current fan speed/temperature + */ + new_duty_cycle = cur_duty_cycle; + + if ((avg_temp >= policy[i].temp_up_adjust) && (cur_duty_cycle != FAN_DUTY_CYCLE_MAX)) { + new_duty_cycle = policy[i+1].duty_cycle; + } + else if ((avg_temp <= policy[i].temp_down_adjust) && (cur_duty_cycle != FAN_DUTY_CYCLE_MIN)) { + new_duty_cycle = policy[i-1].duty_cycle; + } + + if (new_duty_cycle == cur_duty_cycle) { + /* Duty cycle does not change, just return */ + return ONLP_STATUS_OK; + } + + return onlp_fani_percentage_set(ONLP_FAN_ID_CREATE(1), new_duty_cycle); +} + +int +onlp_sysi_platform_manage_leds(void) +{ + return ONLP_STATUS_E_UNSUPPORTED; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..58c51627 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,135 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * Copyright 2014 Accton Technology Corporation. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * Thermal Sensor Platform Implementation. + * + ***********************************************************/ +#include +#include +#include +#include +#include "platform_lib.h" + +#define prefix_path "/sys/bus/i2c/devices/" +#define filename "temp1_input" +#define LOCAL_DEBUG 0 + +#define VALIDATE(_id) \ + do { \ + if(!ONLP_OID_IS_THERMAL(_id)) { \ + return ONLP_STATUS_E_INVALID; \ + } \ + } while(0) + +#define OPEN_READ_FILE(fd,fullpath,data,nbytes,len) \ + DEBUG_PRINT("[Debug][%s][%d][openfile: %s]\n", __FUNCTION__, __LINE__, fullpath); \ + if ((fd = open(fullpath, O_RDONLY)) == -1) \ + return ONLP_STATUS_E_INTERNAL; \ + if ((len = read(fd, r_data, nbytes)) <= 0){ \ + close(fd); \ + return ONLP_STATUS_E_INTERNAL;} \ + DEBUG_PRINT("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ + if (close(fd) == -1) \ + return ONLP_STATUS_E_INTERNAL + +enum onlp_thermal_id +{ + THERMAL_RESERVED = 0, + THERMAL_1_ON_MAIN_BROAD, + THERMAL_2_ON_MAIN_BROAD, + THERMAL_3_ON_MAIN_BROAD, + THERMAL_4_ON_MAIN_BROAD, + THERMAL_1_ON_PSU1, + THERMAL_1_ON_PSU2, +}; + +static char last_path[][30] = /* must map with onlp_thermal_id */ +{ + "reserved", + "38-0048/temp1_input", + "39-0049/temp1_input", + "40-004a/temp1_input", + "41-004b/temp1_input", + "35-003c/psu_temp1_input", + "36-003f/psu_temp1_input", +}; + +/* Static values */ +static onlp_thermal_info_t linfo[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_MAIN_BROAD), "Chassis Thermal Sensor 1 (U18, MAC down side)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_2_ON_MAIN_BROAD), "Chassis Thermal Sensor 2 (U19, near USB HUB)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_3_ON_MAIN_BROAD), "Chassis Thermal Sensor 3 (U15, near LTC2990)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_4_ON_MAIN_BROAD), "Chassis Thermal Sensor 4 (U3, near SYS CPLD)", 0}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU1), "PSU-1 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU1_ID)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 }, + { { ONLP_THERMAL_ID_CREATE(THERMAL_1_ON_PSU2), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(PSU2_ID)}, + ONLP_THERMAL_STATUS_PRESENT, ONLP_THERMAL_CAPS_GET_TEMPERATURE, 0 } +}; + +/* + * This will be called to intiialize the thermali subsystem. + */ +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + +/* + * Retrieve the information structure for the given thermal OID. + * + * If the OID is invalid, return ONLP_E_STATUS_INVALID. + * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL. + * Otherwise, return ONLP_STATUS_OK with the OID's information. + * + * Note -- it is expected that you fill out the information + * structure even if the sensor described by the OID is not present. + */ +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) +{ + int fd, len, nbytes = 10, temp_base=1, local_id; + char r_data[10] = {0}; + char fullpath[50] = {0}; + VALIDATE(id); + + local_id = ONLP_OID_ID_GET(id); + DEBUG_PRINT("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); + + /* get fullpath */ + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + + /* Set the onlp_oid_hdr_t and capabilities */ + *info = linfo[local_id]; + + OPEN_READ_FILE(fd, fullpath, r_data, nbytes, len); + info->mcelsius = atoi(r_data) / temp_base; + DEBUG_PRINT("\n[Debug][%s][%d][save data: %d]\n", __FUNCTION__, __LINE__, info->mcelsius); + + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_config.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_config.c new file mode 100644 index 00000000..c07ca3b7 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_config.c @@ -0,0 +1,81 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(_x) #_x +#define __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(_x) __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(_x) +x86_64_accton_as6712_32x_config_settings_t x86_64_accton_as6712_32x_config_settings[] = +{ +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_LOGGING(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION + { __x86_64_accton_as6712_32x_config_STRINGIFY_NAME(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION), __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE(X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION) }, +#else +{ X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_DEFAULT_FAN_DIRECTION(__x86_64_accton_as6712_32x_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __x86_64_accton_as6712_32x_config_STRINGIFY_VALUE +#undef __x86_64_accton_as6712_32x_config_STRINGIFY_NAME + +const char* +x86_64_accton_as6712_32x_config_lookup(const char* setting) +{ + int i; + for(i = 0; x86_64_accton_as6712_32x_config_settings[i].name; i++) { + if(strcmp(x86_64_accton_as6712_32x_config_settings[i].name, setting)) { + return x86_64_accton_as6712_32x_config_settings[i].value; + } + } + return NULL; +} + +int +x86_64_accton_as6712_32x_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; x86_64_accton_as6712_32x_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", x86_64_accton_as6712_32x_config_settings[i].name, x86_64_accton_as6712_32x_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_enums.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_enums.c new file mode 100644 index 00000000..aba41a7a --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_int.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_int.h new file mode 100644 index 00000000..d116762b --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * x86_64_accton_as6712_32x Internal Header + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS6712_32X_INT_H__ +#define __X86_64_ACCTON_AS6712_32X_INT_H__ + +#include + + +#endif /* __X86_64_ACCTON_AS6712_32X_INT_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.c new file mode 100644 index 00000000..324c982b --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_accton_as6712_32x_log.h" +/* + * x86_64_accton_as6712_32x log struct. + */ +AIM_LOG_STRUCT_DEFINE( + X86_64_ACCTON_AS6712_32X_CONFIG_LOG_OPTIONS_DEFAULT, + X86_64_ACCTON_AS6712_32X_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + X86_64_ACCTON_AS6712_32X_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.h b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.h new file mode 100644 index 00000000..5ec3b567 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __X86_64_ACCTON_AS6712_32X_LOG_H__ +#define __X86_64_ACCTON_AS6712_32X_LOG_H__ + +#define AIM_LOG_MODULE_NAME x86_64_accton_as6712_32x +#include + +#endif /* __X86_64_ACCTON_AS6712_32X_LOG_H__ */ diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_module.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_module.c new file mode 100644 index 00000000..93f70380 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "x86_64_accton_as6712_32x_log.h" + +static int +datatypes_init__(void) +{ +#define X86_64_ACCTON_AS6712_32X_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __x86_64_accton_as6712_32x_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_ucli.c b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_ucli.c new file mode 100644 index 00000000..0b14a431 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/onlp/builds/src/module/src/x86_64_accton_as6712_32x_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if X86_64_ACCTON_AS6712_32X_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +x86_64_accton_as6712_32x_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(x86_64_accton_as6712_32x) +} + +/* */ +/* */ + +static ucli_module_t +x86_64_accton_as6712_32x_ucli_module__ = + { + "x86_64_accton_as6712_32x_ucli", + NULL, + x86_64_accton_as6712_32x_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +x86_64_accton_as6712_32x_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&x86_64_accton_as6712_32x_ucli_module__); + n = ucli_node_create("x86_64_accton_as6712_32x", NULL, &x86_64_accton_as6712_32x_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("x86_64_accton_as6712_32x")); + return n; +} + +#else +void* +x86_64_accton_as6712_32x_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/Makefile b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/PKG.yml b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..2d66982c --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as6712-32x-r0 diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/grub.cfg b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/grub.cfg new file mode 100644 index 00000000..3d4221e8 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/grub.cfg @@ -0,0 +1,21 @@ +serial --port=0x2f8 --speed=115200 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial +set timeout=5 + +# boot switch light +menuentry SL { + search --no-floppy --label --set=root SL-BOOT + echo 'Loading Switch Light ...' + insmod gzio + insmod part_msdos + linux /kernel-3.2-deb7-x86_64-all nopat console=ttyS1,115200n8 onl_platform=x86-64-accton-as6712-32x-r0 + initrd /initrd-amd64 +} + +# Menu entry to chainload ONIE +menuentry ONIE { + search --no-floppy --label --set=root ONIE-BOOT + echo 'Loading ONIE ...' + chainloader +1 +} diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/x86-64-accton-as6712-32x-r0 b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/x86-64-accton-as6712-32x-r0 new file mode 100644 index 00000000..a096ce1d --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/boot/x86-64-accton-as6712-32x-r0 @@ -0,0 +1,11 @@ +############################################################ +# +# x86-64-accton-as6712-32x-r0 +# +############################################################ +echo "pci0000:00/0000:00:14.0 ma1" >/etc/onl/net +echo "LABEL=FLASH * flash" > /etc/onl/mounts +echo "LABEL=FLASH2 * flash2" >> /etc/onl/mounts + + + diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/install/x86-64-accton-as6712-32x-r0.sh b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/install/x86-64-accton-as6712-32x-r0.sh new file mode 100644 index 00000000..cbd26de6 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/lib/install/x86-64-accton-as6712-32x-r0.sh @@ -0,0 +1,15 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# Platform data goes here. + +platform_installer() { + # Standard isntallation to an available GPT partition + installer_standard_gpt_install +} diff --git a/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/python/x86_64_accton_as6712_32x_r0/__init__.py b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/python/x86_64_accton_as6712_32x_r0/__init__.py new file mode 100644 index 00000000..d692f891 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as6712-32x/platform-config/r0/src/python/x86_64_accton_as6712_32x_r0/__init__.py @@ -0,0 +1,59 @@ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_x86_64_accton_as6712_32x_r0(OnlPlatformAccton): + + def model(self): + return "AS6712-32X" + + def platform(self): + return "x86-64-accton-as6712-32x-r0" + + def sys_oid_platform(self): + return ".6712.32" + + + def baseconfig(self): + + ########### initialize I2C bus 0 ########### + # initialize CPLD + self.new_i2c_devices( + [ + ('as6712_32x_cpld1', 0x60, 0), + ('as6712_32x_cpld2', 0x62, 0), + ('as6712_32x_cpld3', 0x64, 0), + ] + ) + + # initialize QSFP port 1~32 + for port in range(1, 33): + self.new_i2c_device('as6712_32x_sfp%d' % port, + 0x50, + port+1) + + ########### initialize I2C bus 1 ########### + self.new_i2c_devices( + [ + # initiate multiplexer (PCA9548) + ('pca9548', 0x70, 1), + + # initiate PSU-1 + ('as6712_32x_psu', 0x38, 35), + ('cpr_4011_4mxx', 0x3C, 35), + + # initiate PSU-2 + ('as6712_32x_psu', 0x3b, 36), + ('cpr_4011_4mxx', 0x3F, 36), + + # initiate lm75 + ('lm75', 0x48, 38), + ('lm75', 0x49, 39), + ('lm75', 0x4a, 40), + ('lm75', 0x4b, 41), + + # System eeprom. + ('24c02', 0x57, 1), + ] + ) + + return True diff --git a/packages/platforms/celestica/Makefile b/packages/platforms/celestica/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/celestica/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/celestica/vendor-config/Makefile b/packages/platforms/celestica/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/celestica/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/celestica/vendor-config/PKG.yml b/packages/platforms/celestica/vendor-config/PKG.yml new file mode 100644 index 00000000..4dbad12b --- /dev/null +++ b/packages/platforms/celestica/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=celestica Vendor=Celestica diff --git a/packages/platforms/celestica/vendor-config/src/python/celestica/__init__.py b/packages/platforms/celestica/vendor-config/src/python/celestica/__init__.py new file mode 100644 index 00000000..722f43d9 --- /dev/null +++ b/packages/platforms/celestica/vendor-config/src/python/celestica/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for Celestica platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformCelestica(OnlPlatformBase): + def manufacturer(self): + return "Celestica" + + def sys_oid_vendor(self): + return ".12290" + diff --git a/packages/platforms/dell/Makefile b/packages/platforms/dell/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/dell/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/dell/vendor-config/Makefile b/packages/platforms/dell/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/dell/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/dell/vendor-config/PKG.yml b/packages/platforms/dell/vendor-config/PKG.yml new file mode 100644 index 00000000..e4a67be4 --- /dev/null +++ b/packages/platforms/dell/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL/packages/base/any/templates/platform-config-vendor.yml VENDOR=dell Vendor=Dell diff --git a/packages/platforms/dell/vendor-config/src/python/dell/__init__.py b/packages/platforms/dell/vendor-config/src/python/dell/__init__.py new file mode 100644 index 00000000..8c2ee967 --- /dev/null +++ b/packages/platforms/dell/vendor-config/src/python/dell/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for DELL platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformDell(OnlPlatformBase): + + def manufacturer(self): + return "Dell" + + def sys_oid_vendor(self): + return ".674" diff --git a/packages/platforms/dni/Makefile b/packages/platforms/dni/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/dni/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/dni/vendor-config/Makefile b/packages/platforms/dni/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/dni/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/dni/vendor-config/PKG.yml b/packages/platforms/dni/vendor-config/PKG.yml new file mode 100644 index 00000000..9a964e11 --- /dev/null +++ b/packages/platforms/dni/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=dni Vendor=DNI diff --git a/packages/platforms/dni/vendor-config/src/python/dni/__init__.py b/packages/platforms/dni/vendor-config/src/python/dni/__init__.py new file mode 100644 index 00000000..83562176 --- /dev/null +++ b/packages/platforms/dni/vendor-config/src/python/dni/__init__.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for DNI platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformDNI(OnlPlatformBase): + def manufacturer(self): + return "DNI" + + def sys_oid_vendor(self): + return ".5324" diff --git a/packages/platforms/quanta/Makefile b/packages/platforms/quanta/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/.gitignore b/packages/platforms/quanta/powerpc-quanta-lb9/.gitignore new file mode 100644 index 00000000..e47d629c --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-quanta-lb9-r0.mk +onlpdump.mk +powerpc_quanta_lb9.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/PKG.yml b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/PKG.yml new file mode 100644 index 00000000..2e376951 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=powerpc-quanta-lb9-r0 ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/.gitignore b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/lib/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/lib/Makefile new file mode 100644 index 00000000..deced723 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/lib/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Shared and static library builds for the +# powerpc-quanta-lb9-r0 +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-quanta-lb9-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_quanta_lb9 onlplib sff cjson cjson_util quanta_sys_eeprom + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-quanta-lb9-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/onlpdump/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..a3f76848 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/onlpdump/Makefile @@ -0,0 +1,51 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +LIBRARY := onlpdumpmain +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk + +DEPENDMODULES := AIM IOF onlp powerpc_quanta_lb9 onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS quanta_sys_eeprom + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 + +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/Makefile new file mode 100644 index 00000000..f1dc1502 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_quanta_lb9 +AUTOMODULE := powerpc_quanta_lb9 +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/README b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/README new file mode 100644 index 00000000..ca7e67f3 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# powerpc_quanta_lb9 README +# +############################################################################### + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/make.mk b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..dc390dbe --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_quanta_lb9 Autogeneration +# +############################################################################### +powerpc_quanta_lb9_AUTO_DEFS := module/auto/powerpc_quanta_lb9.yml +powerpc_quanta_lb9_AUTO_DIRS := module/inc/powerpc_quanta_lb9 module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/powerpc_quanta_lb9.yml b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/powerpc_quanta_lb9.yml new file mode 100644 index 00000000..66b7a600 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/auto/powerpc_quanta_lb9.yml @@ -0,0 +1,116 @@ +############################################################################### +# +# powerpc_quanta_lb9 Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB +- POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD: + doc: "RPM Threshold at which the fan is considered to have failed." + default: 100 +- POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX: + doc: "Maximum system fan speed in front-to-back mode." + default: 14500 +- POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX: + doc: "Maximum system fan speed in back-to-front mode." + default: 24000 +- POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS: + doc: "Time to hold Phy GPIO in reset, in ms" + default: 100 + +definitions: + cdefs: + POWERPC_QUANTA_LB9_R0_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_quanta_lb9_config + + enum: &enums + + fan_id: + members: + - FAN1 : 1 + - FAN2 : 2 + - FAN3 : 3 + - FAN4 : 4 + - FAN5 : 5 + - FAN6 : 6 + + fan_oid: + members: + - FAN1 : ONLP_FAN_ID_CREATE(1) + - FAN2 : ONLP_FAN_ID_CREATE(2) + - FAN3 : ONLP_FAN_ID_CREATE(3) + - FAN4 : ONLP_FAN_ID_CREATE(4) + - FAN5 : ONLP_FAN_ID_CREATE(5) + - FAN6 : ONLP_FAN_ID_CREATE(6) + + psu_id: + members: + - PSU1 : 1 + - PSU2 : 2 + + psu_oid: + members: + - PSU1 : ONLP_PSU_ID_CREATE(1) + - PSU2 : ONLP_PSU_ID_CREATE(2) + + thermal_id: + members: + - THERMAL1 : 1 + - THERMAL2 : 2 + - THERMAL3 : 3 + - THERMAL4 : 4 + - THERMAL5 : 5 + - THERMAL6 : 6 + - THERMAL7 : 7 + - THERMAL8 : 8 + - THERMAL9 : 9 + - THERMAL10 : 10 + - THERMAL11 : 11 + + + thermal_oid: + members: + - THERMAL1 : ONLP_THERMAL_ID_CREATE(1) + - THERMAL2 : ONLP_THERMAL_ID_CREATE(2) + - THERMAL3 : ONLP_THERMAL_ID_CREATE(3) + - THERMAL4 : ONLP_THERMAL_ID_CREATE(4) + - THERMAL5 : ONLP_THERMAL_ID_CREATE(5) + - THERMAL6 : ONLP_THERMAL_ID_CREATE(6) + - THERMAL7 : ONLP_THERMAL_ID_CREATE(7) + - THERMAL8 : ONLP_THERMAL_ID_CREATE(8) + - THERMAL9 : ONLP_THERMAL_ID_CREATE(9) + - THERMAL10 : ONLP_THERMAL_ID_CREATE(10) + - THERMAL11 : ONLP_THERMAL_ID_CREATE(11) + + + portingmacro: + POWERPC_QUANTA_LB9_R0: + macros: + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9.x b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9.x new file mode 100644 index 00000000..d7cd4dd3 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_config.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_config.h new file mode 100644 index 00000000..cfa89474 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_config.h @@ -0,0 +1,167 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_quanta_lb9 Configuration Header + * + * @addtogroup powerpc_quanta_lb9-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_CONFIG_H__ +#define __POWERPC_QUANTA_LB9_R0_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_QUANTA_LB9_R0_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING +#define POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB +#define POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI +#define POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD + * + * RPM Threshold at which the fan is considered to have failed. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD +#define POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 100 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX + * + * Maximum system fan speed in front-to-back mode. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX +#define POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX 14500 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX + * + * Maximum system fan speed in back-to-front mode. */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX +#define POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX 24000 +#endif + +/** + * POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS + * + * Time to hold Phy GPIO in reset, in ms */ + + +#ifndef POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS +#define POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS 100 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_quanta_lb9_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_quanta_lb9_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_quanta_lb9_config_settings table. */ +extern powerpc_quanta_lb9_config_settings_t powerpc_quanta_lb9_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_quanta_lb9_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_quanta_lb9_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_quanta_lb9_porting.h" + +#endif /* __POWERPC_QUANTA_LB9_R0_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_dox.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_dox.h new file mode 100644 index 00000000..d85a874e --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_quanta_lb9 Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_DOX_H__ +#define __POWERPC_QUANTA_LB9_R0_DOX_H__ + +/** + * @defgroup powerpc_quanta_lb9 powerpc_quanta_lb9 - powerpc_quanta_lb9 Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_quanta_lb9-powerpc_quanta_lb9 Public Interface + * @defgroup powerpc_quanta_lb9-config Compile Time Configuration + * @defgroup powerpc_quanta_lb9-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_QUANTA_LB9_R0_DOX_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h new file mode 100644 index 00000000..5347380a --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h @@ -0,0 +1,87 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_quanta_lb9 Porting Macros. + * + * @addtogroup powerpc_quanta_lb9-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_PORTING_H__ +#define __POWERPC_QUANTA_LB9_R0_PORTING_H__ + + +/* */ +#if POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_QUANTA_LB9_R0_MEMSET GLOBAL_MEMSET + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_MEMSET memset + #else + #error The macro POWERPC_QUANTA_LB9_R0_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_QUANTA_LB9_R0_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_MEMCPY memcpy + #else + #error The macro POWERPC_QUANTA_LB9_R0_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_QUANTA_LB9_R0_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_STRNCPY strncpy + #else + #error The macro POWERPC_QUANTA_LB9_R0_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_QUANTA_LB9_R0_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_QUANTA_LB9_R0_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_QUANTA_LB9_R0_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_SNPRINTF snprintf + #else + #error The macro POWERPC_QUANTA_LB9_R0_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LB9_R0_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_QUANTA_LB9_R0_STRLEN GLOBAL_STRLEN + #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LB9_R0_STRLEN strlen + #else + #error The macro POWERPC_QUANTA_LB9_R0_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_QUANTA_LB9_R0_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/make.mk b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..fdaec4d1 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_quanta_lb9_INCLUDES := -I $(THIS_DIR)inc +powerpc_quanta_lb9_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_quanta_lb9_DEPENDMODULE_ENTRIES := init:powerpc_quanta_lb9 ucli:powerpc_quanta_lb9 + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..4828822b --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py powerpc_quanta_lb9_ucli.c + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/fani.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..2958417b --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/fani.c @@ -0,0 +1,147 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include "powerpc_quanta_lb9_int.h" +#include "powerpc_quanta_lb9_log.h" + +#include + +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + + +static int +sys_fan_info_get__(onlp_fan_info_t* info, int id) +{ + int rv; + const char* controller = powerpc_quanta_lb9_system_fan_dir(); + + if(controller == NULL) { + /* Error already reported. */ + return ONLP_STATUS_E_INTERNAL; + } + + rv = onlp_file_read_int(&info->rpm, + "%s/fan%d_input", controller, id); + + if(rv == ONLP_STATUS_E_INTERNAL) { + return rv; + } + + if(rv == ONLP_STATUS_E_MISSING) { + info->status &= ~1; + return 0; + } + + if(info->rpm <= POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) { + info->status |= ONLP_FAN_STATUS_FAILED; + } + + /* + * Calculate percentage based on current speed and the maximum. + */ + info->caps |= ONLP_FAN_CAPS_GET_PERCENTAGE; + if(info->status & ONLP_FAN_STATUS_F2B) { + info->percentage = info->rpm * 100 / POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX; + } + if(info->status & ONLP_FAN_STATUS_B2F) { + info->percentage = info->rpm * 100 / POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX; + } + + return 0; +} + +static int +psu_fan_info_get__(onlp_fan_info_t* info, int id) +{ + /* FAN5 -> PSU1 */ + /* FAN6 -> PSU2 */ + const char* dir = powerpc_quanta_lb8_r9_system_psu_dir(id-4); + + if(dir == NULL) { + /* Error already reported */ + return ONLP_STATUS_E_INTERNAL; + } + + return onlp_file_read_int(&info->rpm, "%s/fan1_input", dir); +} + + + +/* Onboard Fans */ +static onlp_fan_info_t fans__[] = { + { }, /* Not used */ + { { FAN_OID_FAN1, "Right", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN2, "Center Right", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN3, "Center Left", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN4, "Left", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN5, "PSU-1 Fan", 0 }, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN6, "PSU-2 Fan", 0 }, ONLP_FAN_STATUS_PRESENT }, + +}; + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* rv) +{ + *rv = fans__[ONLP_OID_ID_GET(id)]; + rv->caps |= ONLP_FAN_CAPS_GET_RPM; + + int direction = powerpc_quanta_lb9_system_airflow_get(); + int fid = ONLP_OID_ID_GET(id); + + if(direction == 0) { + rv->status |= ONLP_FAN_STATUS_F2B; + rv->caps |= ONLP_FAN_CAPS_F2B; + } + else { + rv->status |= ONLP_FAN_STATUS_B2F; + rv->caps |= ONLP_FAN_CAPS_B2F; + } + + + switch(fid) + { + case FAN_ID_FAN1: + case FAN_ID_FAN2: + case FAN_ID_FAN3: + case FAN_ID_FAN4: + { + return sys_fan_info_get__(rv, fid); + } + + case FAN_ID_FAN5: + case FAN_ID_FAN6: + { + return psu_fan_info_get__(rv, fid); + } + } + + return ONLP_STATUS_E_INVALID; +} diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/make.mk b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..ebca9688 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := powerpc_quanta_lb9 +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_config.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_config.c new file mode 100644 index 00000000..125fdbf2 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_config.c @@ -0,0 +1,96 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_quanta_lb9_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_quanta_lb9_config_STRINGIFY_VALUE(_x) __powerpc_quanta_lb9_config_STRINGIFY_NAME(_x) +powerpc_quanta_lb9_config_settings_t powerpc_quanta_lb9_config_settings[] = +{ +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_LOGGING(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_F2B_MAX(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_SYSFAN_RPM_B2F_MAX(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS + { __powerpc_quanta_lb9_config_STRINGIFY_NAME(POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS), __powerpc_quanta_lb9_config_STRINGIFY_VALUE(POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS) }, +#else +{ POWERPC_QUANTA_LB9_R0_CONFIG_PHY_RESET_DELAY_MS(__powerpc_quanta_lb9_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_quanta_lb9_config_STRINGIFY_VALUE +#undef __powerpc_quanta_lb9_config_STRINGIFY_NAME + +const char* +powerpc_quanta_lb9_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_quanta_lb9_config_settings[i].name; i++) { + if(strcmp(powerpc_quanta_lb9_config_settings[i].name, setting)) { + return powerpc_quanta_lb9_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_quanta_lb9_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_quanta_lb9_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_quanta_lb9_config_settings[i].name, powerpc_quanta_lb9_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_enums.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_enums.c new file mode 100644 index 00000000..9c47efac --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_int.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_int.h new file mode 100644 index 00000000..fbca0aa6 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_int.h @@ -0,0 +1,234 @@ +/**************************************************************************//** + * + * powerpc_quanta_lb9 Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_INT_H__ +#define __POWERPC_QUANTA_LB9_R0_INT_H__ + +#include +#include + + +/* */ +/** thermal_oid */ +typedef enum thermal_oid_e { + THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1), + THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2), + THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3), + THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4), + THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5), + THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6), + THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7), + THERMAL_OID_THERMAL8 = ONLP_THERMAL_ID_CREATE(8), + THERMAL_OID_THERMAL9 = ONLP_THERMAL_ID_CREATE(9), + THERMAL_OID_THERMAL10 = ONLP_THERMAL_ID_CREATE(10), + THERMAL_OID_THERMAL11 = ONLP_THERMAL_ID_CREATE(11), +} thermal_oid_t; + +/** Enum names. */ +const char* thermal_oid_name(thermal_oid_t e); + +/** Enum values. */ +int thermal_oid_value(const char* str, thermal_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* thermal_oid_desc(thermal_oid_t e); + +/** Enum validator. */ +int thermal_oid_valid(thermal_oid_t e); + +/** validator */ +#define THERMAL_OID_VALID(_e) \ + (thermal_oid_valid((_e))) + +/** thermal_oid_map table. */ +extern aim_map_si_t thermal_oid_map[]; +/** thermal_oid_desc_map table. */ +extern aim_map_si_t thermal_oid_desc_map[]; + +/** psu_oid */ +typedef enum psu_oid_e { + PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1), + PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2), +} psu_oid_t; + +/** Enum names. */ +const char* psu_oid_name(psu_oid_t e); + +/** Enum values. */ +int psu_oid_value(const char* str, psu_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* psu_oid_desc(psu_oid_t e); + +/** Enum validator. */ +int psu_oid_valid(psu_oid_t e); + +/** validator */ +#define PSU_OID_VALID(_e) \ + (psu_oid_valid((_e))) + +/** psu_oid_map table. */ +extern aim_map_si_t psu_oid_map[]; +/** psu_oid_desc_map table. */ +extern aim_map_si_t psu_oid_desc_map[]; + +/** thermal_id */ +typedef enum thermal_id_e { + THERMAL_ID_THERMAL1 = 1, + THERMAL_ID_THERMAL2 = 2, + THERMAL_ID_THERMAL3 = 3, + THERMAL_ID_THERMAL4 = 4, + THERMAL_ID_THERMAL5 = 5, + THERMAL_ID_THERMAL6 = 6, + THERMAL_ID_THERMAL7 = 7, + THERMAL_ID_THERMAL8 = 8, + THERMAL_ID_THERMAL9 = 9, + THERMAL_ID_THERMAL10 = 10, + THERMAL_ID_THERMAL11 = 11, +} thermal_id_t; + +/** Enum names. */ +const char* thermal_id_name(thermal_id_t e); + +/** Enum values. */ +int thermal_id_value(const char* str, thermal_id_t* e, int substr); + +/** Enum descriptions. */ +const char* thermal_id_desc(thermal_id_t e); + +/** Enum validator. */ +int thermal_id_valid(thermal_id_t e); + +/** validator */ +#define THERMAL_ID_VALID(_e) \ + (thermal_id_valid((_e))) + +/** thermal_id_map table. */ +extern aim_map_si_t thermal_id_map[]; +/** thermal_id_desc_map table. */ +extern aim_map_si_t thermal_id_desc_map[]; + +/** fan_id */ +typedef enum fan_id_e { + FAN_ID_FAN1 = 1, + FAN_ID_FAN2 = 2, + FAN_ID_FAN3 = 3, + FAN_ID_FAN4 = 4, + FAN_ID_FAN5 = 5, + FAN_ID_FAN6 = 6, +} fan_id_t; + +/** Enum names. */ +const char* fan_id_name(fan_id_t e); + +/** Enum values. */ +int fan_id_value(const char* str, fan_id_t* e, int substr); + +/** Enum descriptions. */ +const char* fan_id_desc(fan_id_t e); + +/** Enum validator. */ +int fan_id_valid(fan_id_t e); + +/** validator */ +#define FAN_ID_VALID(_e) \ + (fan_id_valid((_e))) + +/** fan_id_map table. */ +extern aim_map_si_t fan_id_map[]; +/** fan_id_desc_map table. */ +extern aim_map_si_t fan_id_desc_map[]; + +/** psu_id */ +typedef enum psu_id_e { + PSU_ID_PSU1 = 1, + PSU_ID_PSU2 = 2, +} psu_id_t; + +/** Enum names. */ +const char* psu_id_name(psu_id_t e); + +/** Enum values. */ +int psu_id_value(const char* str, psu_id_t* e, int substr); + +/** Enum descriptions. */ +const char* psu_id_desc(psu_id_t e); + +/** Enum validator. */ +int psu_id_valid(psu_id_t e); + +/** validator */ +#define PSU_ID_VALID(_e) \ + (psu_id_valid((_e))) + +/** psu_id_map table. */ +extern aim_map_si_t psu_id_map[]; +/** psu_id_desc_map table. */ +extern aim_map_si_t psu_id_desc_map[]; + +/** fan_oid */ +typedef enum fan_oid_e { + FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1), + FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2), + FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3), + FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4), + FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5), + FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6), +} fan_oid_t; + +/** Enum names. */ +const char* fan_oid_name(fan_oid_t e); + +/** Enum values. */ +int fan_oid_value(const char* str, fan_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* fan_oid_desc(fan_oid_t e); + +/** Enum validator. */ +int fan_oid_valid(fan_oid_t e); + +/** validator */ +#define FAN_OID_VALID(_e) \ + (fan_oid_valid((_e))) + +/** fan_oid_map table. */ +extern aim_map_si_t fan_oid_map[]; +/** fan_oid_desc_map table. */ +extern aim_map_si_t fan_oid_desc_map[]; +/* */ + + + +/* + * The LB9 has reverible airflow. + * There is a different controller for each direction. + * These are mutually exclusive at any given time. + */ + +/* This is the fan controller in F2B mode */ +#define SYS_CONTROLLER_PREFIX_F2B \ + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-5/5-002c" + +/* This is the fan controller in B2F mode */ +#define SYS_CONTROLLER_PREFIX_B2F \ + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-6/6-002f" + +/* The temperature controller for both modes */ +#define SYS_CONTROLLER_PREFIX_TEMPERATURE SYS_CONTROLLER_PREFIX_F2B + +/* + * PSU1 and PSU2 sys paths + */ +#define SYS_PSU1_PREFIX \ + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-7/7-0058" + +#define SYS_PSU2_PREFIX \ + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-8/8-0059" + + +#include "system.h" + +#endif /* __POWERPC_QUANTA_LB9_R0_INT_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.c new file mode 100644 index 00000000..8b237c61 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_quanta_lb9_log.h" +/* + * powerpc_quanta_lb9 log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_QUANTA_LB9_R0_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_QUANTA_LB9_R0_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_QUANTA_LB9_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.h new file mode 100644 index 00000000..fbd7af8e --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_LOG_H__ +#define __POWERPC_QUANTA_LB9_R0_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_quanta_lb9 +#include + +#endif /* __POWERPC_QUANTA_LB9_R0_LOG_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_module.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_module.c new file mode 100644 index 00000000..66a62ad9 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_quanta_lb9_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_QUANTA_LB9_R0_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_quanta_lb9_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_ucli.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_ucli.c new file mode 100644 index 00000000..20e77149 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/powerpc_quanta_lb9_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if POWERPC_QUANTA_LB9_R0_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +powerpc_quanta_lb9_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(powerpc_quanta_lb9) +} + +/* */ +/* */ + +static ucli_module_t +powerpc_quanta_lb9_ucli_module__ = + { + "powerpc_quanta_lb9_ucli", + NULL, + powerpc_quanta_lb9_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +powerpc_quanta_lb9_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&powerpc_quanta_lb9_ucli_module__); + n = ucli_node_create("powerpc_quanta_lb9", NULL, &powerpc_quanta_lb9_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("powerpc_quanta_lb9")); + return n; +} + +#else +void* +powerpc_quanta_lb9_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/psui.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..9cace756 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/psui.c @@ -0,0 +1,105 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include "powerpc_quanta_lb9_int.h" +#include "powerpc_quanta_lb9_log.h" + +int +onlp_psui_init(void) +{ + return 0; +} + +static onlp_psu_info_t psus__[] = { + { }, /* Not used */ + { + { + PSU_OID_PSU1, + "PSU-1", + 0, + { + FAN_OID_FAN5, + THERMAL_OID_THERMAL6, + THERMAL_OID_THERMAL7, + THERMAL_OID_THERMAL8, + }, + } + }, + { + { + PSU_OID_PSU2, + "PSU-2", + 0, + { + FAN_OID_FAN6, + THERMAL_OID_THERMAL9, + THERMAL_OID_THERMAL10, + THERMAL_OID_THERMAL11, + }, + } + }, +}; + + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int rv; + int pid = ONLP_OID_ID_GET(id); + *info = psus__[pid]; + const char* dir = powerpc_quanta_lb8_r9_system_psu_dir(pid); + + /* + * Todo -- use the GPIO to determine PSU presence. + * For this first version we'll approximate the status using + * the input voltage sensor. + */ + rv = onlp_file_read_int(&info->mvin, "%s/in1_input", dir); + if(rv == ONLP_STATUS_E_MISSING || info->mvin == 0) { + info->status &= ~1; + return 0; + } + else if(rv < 0) { + return rv; + } + else { + info->caps |= ONLP_PSU_CAPS_VIN; + } + + /* PSU is present and powered. */ + info->status |= 1; + strcpy(info->model, "PSU-LB9"); + info->caps |= ONLP_PSU_CAPS_AC; + + if(onlp_file_read_int(&info->miin, "%s/curr1_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_IIN; + } + if(onlp_file_read_int(&info->miout, "%s/curr2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_IOUT; + } + if(onlp_file_read_int(&info->mvout, "%s/in2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_VOUT; + /* Empirical */ + info->mvout /= 500; + } + if(onlp_file_read_int(&info->mpin, "%s/power1_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_PIN; + /* The pmbus driver reports power in micro-units */ + info->mpin /= 1000; + } + if(onlp_file_read_int(&info->mpout, "%s/power2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_POUT; + /* the pmbus driver reports power in micro-units */ + info->mpout /= 1000; + } + return ONLP_STATUS_OK; +} + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sfpi.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..aa277802 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,151 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * SFPI Interface for the Quanta LB9 + * + * This code was lifted wholesale and minimally ported + * from the previous implementation that preceded the ONLP interfaces. + * + * It should be ported in the future to use the services provided + * by the ONLP infrastructure directly. + * + ***********************************************************/ +#include +#include +#include +#include +#include "powerpc_quanta_lb9_log.h" + + +#include +#include +#include + +/** + * This table maps the presence gpio, reset gpio, and eeprom file + * for each SFP port. + */ +typedef struct sfpmap_s { + int sport; + int mod_abs_gpio_number; + int reset_gpio_number; + const char* mod_abs_gpio; + const char* reset_gpio; + const char* eeprom; + const char* dom; +} sfpmap_t; + +static sfpmap_t sfpmap__[] = + { + { + 48, + 112, 120, + "/sys/class/gpio/gpio112/value", + "/sys/class/gpio/gpio120/value", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-1/1-0050/eeprom", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-1/1-0051/eeprom" + }, + { + 49, + 113, 121, + "/sys/class/gpio/gpio113/value", + "/sys/class/gpio/gpio121/value", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-2/2-0050/eeprom", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-2/2-0051/eeprom" + }, + { + 50, + 114, 122, + "/sys/class/gpio/gpio114/value", + "/sys/class/gpio/gpio122/value", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-3/3-0050/eeprom", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-3/3-0051/eeprom" + }, + { + 51, + 115, 123, + "/sys/class/gpio/gpio115/value", + "/sys/class/gpio/gpio123/value", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-4/4-0050/eeprom", + "/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-4/4-0051/eeprom" + }, + }; + +#define SFP_GET(_port) (sfpmap__+ (_port - 48)) + +int +onlp_sfpi_init(void) +{ + /** + * Initialize the SFP presence and reset GPIOS. + */ + int i; + int rv; + for(i = 0; i < AIM_ARRAYSIZE(sfpmap__); i++) { + if( (rv = onlp_gpio_export(sfpmap__[i].mod_abs_gpio_number, ONLP_GPIO_DIRECTION_IN)) < 0) { + AIM_LOG_ERROR("Failed to initialize MOD_ABS gpio %d", + sfpmap__[i].mod_abs_gpio_number); + return -1; + } + if( (rv = onlp_gpio_export(sfpmap__[i].reset_gpio_number, ONLP_GPIO_DIRECTION_HIGH)) < 0) { + AIM_LOG_ERROR("Failed to initialize RESET gpio %d", + sfpmap__[i].reset_gpio_number); + return -1; + } + } + + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + int p; + + for(p = 48; p < 52; p++) { + AIM_BITMAP_SET(bmap, p); + } + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_is_present(int port) +{ + sfpmap_t* sfp = SFP_GET(port); + + return onlplib_sfp_is_present_file(sfp->mod_abs_gpio, + /* Present */ "0\n", + /* Absent */ "1\n"); +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + sfpmap_t* sfp = SFP_GET(port); + return onlplib_sfp_eeprom_read_file(sfp->eeprom, data); +} + +int +onlp_sfpi_dom_read(int port, uint8_t data[256]) +{ + sfpmap_t* sfp = SFP_GET(port); + return onlplib_sfp_eeprom_read_file(sfp->dom, data); +} diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sysi.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..d7ffa8dd --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,76 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "powerpc_quanta_lb9_int.h" +#include "powerpc_quanta_lb9_log.h" +#include + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-quanta-lb9-r0"; +} + +int +onlp_sysi_init(void) +{ + return ONLP_STATUS_OK; +} + +#define QUANTA_SYS_EEPROM_PATH \ +"/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/0-0053/eeprom" + + +int +onlp_sysi_onie_info_get(onlp_onie_info_t* onie) +{ + int rv; + quanta_sys_eeprom_t e; + rv = quanta_sys_eeprom_parse_file(QUANTA_SYS_EEPROM_PATH, &e); + if(rv >= 0) { + quanta_sys_eeprom_to_onie(&e, onie); + onie->platform_name = aim_strdup("powerpc-quanta-lb9"); + } + return rv; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + /* + * 5 Chassis Thermal Sensors + */ + *e++ = THERMAL_OID_THERMAL1; + *e++ = THERMAL_OID_THERMAL2; + *e++ = THERMAL_OID_THERMAL3; + *e++ = THERMAL_OID_THERMAL4; + *e++ = THERMAL_OID_THERMAL5; + + /* + * 4 Fans + */ + *e++ = FAN_OID_FAN1; + *e++ = FAN_OID_FAN2; + *e++ = FAN_OID_FAN3; + *e++ = FAN_OID_FAN4; + + /* + * 2 PSUs + */ + *e++ = PSU_OID_PSU1; + *e++ = PSU_OID_PSU2; + + /* + * Todo - LEDs + */ + return 0; +} diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.c new file mode 100644 index 00000000..ea68984a --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.c @@ -0,0 +1,75 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "powerpc_quanta_lb9_int.h" +#include "powerpc_quanta_lb9_log.h" +#include "system.h" + +int +powerpc_quanta_lb9_system_airflow_get(void) +{ + int i; + int f2b = 0; + int b2f = 0; + + for(i = 1; i < 5; i++) { + int rpm = 0; + onlp_file_read_int(&rpm, SYS_CONTROLLER_PREFIX_F2B "/fan%d_input", i); + f2b += rpm; + } + for(i = 1; i < 5; i++) { + int rpm = 0; + onlp_file_read_int(&rpm, SYS_CONTROLLER_PREFIX_B2F "/fan%d_input", i); + b2f += rpm; + } + + if(f2b && !b2f) { + return 0; + } + else if(b2f && !f2b) { + return 1; + } + else { + AIM_LOG_ERROR("Cannot determine active airflow controller."); + return -1; + } + return 0; +} + +char* +powerpc_quanta_lb9_system_fan_dir(void) +{ + /* + * Determine the correct HW monitor path based on + * current system settings. + */ + int airflow = powerpc_quanta_lb9_system_airflow_get(); + switch(airflow) + { + case 0: return SYS_CONTROLLER_PREFIX_F2B; break; + case 1: return SYS_CONTROLLER_PREFIX_B2F; break; + } + + /* Error message has already been reported. */ + return NULL; +} + +char* +powerpc_quanta_lb8_r9_system_psu_dir(int pid) +{ + switch(pid) + { + case PSU_ID_PSU1: return SYS_PSU1_PREFIX; break; + case PSU_ID_PSU2: return SYS_PSU2_PREFIX; break; + } + + AIM_LOG_ERROR("Invalid PSU id %d", pid); + return NULL; +} diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.h b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.h new file mode 100644 index 00000000..e581bebf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/system.h @@ -0,0 +1,18 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __POWERPC_QUANTA_LB9_R0_SYSTEM_H__ +#define __POWERPC_QUANTA_LB9_R0_SYSTEM_H__ + +int powerpc_quanta_lb9_system_airflow_get(void); + +char* powerpc_quanta_lb9_system_fan_dir(void); + +char* powerpc_quanta_lb8_r9_system_psu_dir(int pid); + +#endif /* __POWERPC_QUANTA_LB9_R0_SYSTEM_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/thermali.c b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..abfbff12 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,118 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "powerpc_quanta_lb9_int.h" +#include "powerpc_quanta_lb9_log.h" + +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +sys_thermal_info_get__(onlp_thermal_info_t* info, int id) +{ + int rv; + + /* Fixed for both F2B and B2F configurations */ + const char* controller = SYS_CONTROLLER_PREFIX_TEMPERATURE; + + rv = onlp_file_read_int(&info->mcelsius, + "%s//temp%d_input", controller, id); + + if(rv == ONLP_STATUS_E_INTERNAL) { + return rv; + } + + if(rv == ONLP_STATUS_E_MISSING) { + info->status &= ~1; + return 0; + } + + return ONLP_STATUS_OK; +} + +static int +psu_thermal_info_get__(onlp_thermal_info_t* info, int pid, int id) +{ + /* THERMAL6 -> PSU1 */ + /* THERMAL7 -> PSU2 */ + char* dir = powerpc_quanta_lb8_r9_system_psu_dir(pid); + info->status |= 1; + return onlp_file_read_int(&info->mcelsius, "%s/temp%d_input", dir, id); +} + +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv) +{ + int tid = ONLP_OID_ID_GET(id); + + static onlp_thermal_info_t info[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal 1", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal 2", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(3), "Chassis Thermal 3", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(4), "Chassis Thermal 4", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(5), "Chassis Thermal 5", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + + { { ONLP_THERMAL_ID_CREATE(6), "PSU-1 Thermal 1", 0 } }, + { { ONLP_THERMAL_ID_CREATE(7), "PSU-1 Thermal 2", 0 } }, + { { ONLP_THERMAL_ID_CREATE(8), "PSU-1 Thermal 3", 0 } }, + + { { ONLP_THERMAL_ID_CREATE(9), "PSU-2 Thermal 1", 0 } }, + { { ONLP_THERMAL_ID_CREATE(10), "PSU-2 Thermal 2", 0 } }, + { { ONLP_THERMAL_ID_CREATE(11), "PSU-2 Thermal 3", 0 } }, + }; + + *rv = info[tid]; + rv->caps |= ONLP_THERMAL_CAPS_GET_TEMPERATURE; + + switch(tid) + { + case THERMAL_ID_THERMAL1: + case THERMAL_ID_THERMAL2: + case THERMAL_ID_THERMAL3: + case THERMAL_ID_THERMAL4: + case THERMAL_ID_THERMAL5: + return sys_thermal_info_get__(rv, tid); + + case THERMAL_ID_THERMAL6: + case THERMAL_ID_THERMAL7: + case THERMAL_ID_THERMAL8: + return psu_thermal_info_get__(rv, 1, tid-5); + + + case THERMAL_ID_THERMAL9: + case THERMAL_ID_THERMAL10: + case THERMAL_ID_THERMAL11: + return psu_thermal_info_get__(rv, 2, tid-8); + + } + + return ONLP_STATUS_E_INVALID; +} + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/Makefile b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/PKG.yml b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/PKG.yml new file mode 100644 index 00000000..938d67ab --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=quanta PLATFORM=powerpc-quanta-lb9-r0 diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/boot/powerpc-quanta-lb9-r0 b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/boot/powerpc-quanta-lb9-r0 new file mode 100644 index 00000000..f8611386 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/boot/powerpc-quanta-lb9-r0 @@ -0,0 +1,12 @@ +############################################################ +# +# powerpc-quanta-lb9-r0 +# +############################################################ + +echo "e0000000.soc8541/e0024000.ethernet ma1" >/etc/onl/net +echo "block/sda sda2 flash" > /etc/onl/mounts +echo "block/sda sda3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd3 0x00000000 0x00002000 0x00020000" >> /etc/fw_env.config diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/fancontrol b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/fancontrol new file mode 100644 index 00000000..2fc0b55c --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/fancontrol @@ -0,0 +1,15 @@ +############################################################ +# +# Platform: Quanta LB9 +# +############################################################ + +INTERVAL=10 +DEVPATH=hwmon0=devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-5/5-002c +DEVNAME=hwmon0=adt7470 +FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input hwmon0/device/pwm2=hwmon0/device/temp1_input hwmon0/device/pwm3=hwmon0/device/temp1_input hwmon0/device/pwm4=hwmon0/device/temp1_input +FCFANS=hwmon0/device/pwm1=hwmon0/device/fan1_input hwmon0/device/pwm2=hwmon0/device/fan2_input hwmon0/device/pwm3=hwmon0/device/fan3_input hwmon0/device/pwm4=hwmon0/device/fan4_input +MINTEMP=hwmon0/device/pwm1=20 hwmon0/device/pwm2=20 hwmon0/device/pwm3=20 hwmon0/device/pwm4=20 +MAXTEMP=hwmon0/device/pwm1=60 hwmon0/device/pwm2=60 hwmon0/device/pwm3=60 hwmon0/device/pwm4=60 +MINSTART=hwmon0/device/pwm1=150 hwmon0/device/pwm2=150 hwmon0/device/pwm3=150 hwmon0/device/pwm4=150 +MINSTOP=hwmon0/device/pwm1=0 hwmon0/device/pwm2=0 hwmon0/device/pwm3=0 hwmon0/device/pwm4=0 diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/sensors3.conf b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/sensors3.conf new file mode 100644 index 00000000..a0618723 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/etc/sensors3.conf @@ -0,0 +1,72 @@ +############################################################ +# +# Platform: Quanta LB9 +# +############################################################ + +bus "i2c-5" "i2c-0-mux (chan_id 4)" +bus "i2c-6" "i2c-0-mux (chan_id 5)" +bus "i2c-7" "i2c-0-mux (chan_id 6)" +bus "i2c-8" "i2c-0-mux (chan_id 7)" + +chip "adt7470-i2c-5-2c" + label fan1 "Fan 1" + label fan2 "Fan 2" + label fan3 "Fan 3" + label fan4 "Fan 4" + label temp1 "Temp 1" + label temp2 "Temp 2" + label temp3 "Temp 3" + label temp4 "Temp 4" + label temp5 "Temp 5" + ignore temp6 + ignore temp7 + ignore temp8 + ignore temp9 + ignore temp10 + + +chip "adt7470-i2c-6-2f" + ignore fan1 + ignore fan2 + ignore fan3 + ignore fan4 + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore temp7 + ignore temp8 + ignore temp9 + ignore temp10 + + +chip "pmbus-i2c-7-58" + label fan1 "PSU-2 Fan" + label temp1 "PSU-2 Temp 1" + label temp2 "PSU-2 Temp 2" + label temp3 "PSU-2 Temp 3" + label in1 "PSU-2 Vin 1" + label in2 "PSU-2 Vout 1" + # in2 reads > 6000 V without this correction...(?) + compute in2 @/500,500*@ + label curr1 "PSU-2 Iin 1" + label curr2 "PSU-2 Iout 1" + label power1 "PSU-2 Pin 1" + label power2 "PSU-2 Pout 1" + +chip "pmbus-i2c-8-59" + label fan1 "PSU-1 Fan" + label temp1 "PSU-1 Temp 1" + label temp2 "PSU-1 Temp 2" + label temp3 "PSU-1 Temp 3" + label in1 "PSU-1 Vin 1" + label in2 "PSU-1 Vout 1" + # in2 reads > 6000 V without this correction...(?) + compute in2 @/500,500*@ + label curr1 "PSU-1 Iin 1" + label curr2 "PSU-1 Iout 1" + label power1 "PSU-1 Pin 1" + label power2 "PSU-1 Pout 1" diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/install/powerpc-quanta-lb9-r0.sh b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/install/powerpc-quanta-lb9-r0.sh new file mode 100644 index 00000000..22019c45 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/install/powerpc-quanta-lb9-r0.sh @@ -0,0 +1,34 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +############################################################ +# +# Installer scriptlet for the Quanta LB9. +# +# The loader must be written raw to the first partition. +platform_loader_raw=1 +# The bootcommand is to read the loader directly from the first partition and execute it. +platform_bootcmd='diskboot 0x10000000 0:1 ; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-quanta-lb9-r0; bootm 0x10000000#quanta-lb9-r0' + +platform_installer() { + # Standard installation on the CF card. + installer_standard_blockdev_install sda 16M 64M "" +} + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/powerpc-quanta-lb9-r0.yml b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/powerpc-quanta-lb9-r0.yml new file mode 100644 index 00000000..3d26cc6d --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/powerpc-quanta-lb9-r0.yml @@ -0,0 +1,5 @@ +powerpc-quanta-lb9-r0: + flat_image_tree: + kernel: onl-kernel-3.9.6-powerpc-e500v:powerpc, kernel-3.9.6-powerpc-e500v.bin.gz + dtb: onl-kernel-3.9.6-powerpc-e500v:powerpc, powerpc-quanta-lb9-r0.dtb + diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/sbin/sfpdump b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/sbin/sfpdump new file mode 100755 index 00000000..f3255f97 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/lib/sbin/sfpdump @@ -0,0 +1,40 @@ +#!/bin/sh +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Platform: Quanta LB9 +# +############################################################ + +n=49 +dump() { + echo "$2 port $n:" + hexdump -C /sys/class/i2c-dev/i2c-$1/device/$1-0050/eeprom 2>/dev/null + n=$((n+1)) +} + +# Linux assigns I2C bus numbers as it enumerates the I2C master/mux +# devices in the device tree breadth-first. The bus numbers below may +# change if the device tree changes. + +for i in $(seq 1 1 4); do + dump $i SFP +done diff --git a/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/python/powerpc_quanta_lb9_r0/__init__.py b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/python/powerpc_quanta_lb9_r0/__init__.py new file mode 100644 index 00000000..870d5c38 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-lb9/platform-config/r0/src/python/powerpc_quanta_lb9_r0/__init__.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# Platform Driver for the Quanta LB9 +# +############################################################ +from onl.platform.base import * +from onl.platform.quanta import * + +class OnlPlatform_powerpc_quanta_lb9_r0(OnlPlatformQuanta): + + def model(self): + return "LB9" + + def platform(self): + return "powerpc-quanta-lb9-r0" + + def baseconfig(self): + platform_fancontrol="%s/etc/fancontrol" % self.basedir_onl() + FAN_CONF = '/etc/fancontrol' + if os.path.exists(FAN_CONF): + os.unlink(FAN_CONF) + if os.path.exists(platform_fancontrol): + os.symlink(platform_fancontrol, FAN_CONF) + else: + sys.exit(1) + + subprocess.call("%s/sbin/gpio_init" % self.basedir_onl()) + return True + + def sys_oid_platform(self): + return ".1048.1" + + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/.gitignore b/packages/platforms/quanta/powerpc-quanta-ly2/.gitignore new file mode 100644 index 00000000..78ad7496 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/.gitignore @@ -0,0 +1,3 @@ +libonlp-powerpc-quanta-ly2-r0.mk +onlpdump.mk +powerpc_quanta_ly2.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/PKG.yml b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/PKG.yml new file mode 100644 index 00000000..f8f93525 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/onlp-platform-any.yml PLATFORM=powerpc-quanta-ly2-r0 ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/.gitignore b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/.gitignore new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/.gitignore @@ -0,0 +1 @@ + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/Makefile new file mode 100644 index 00000000..e7437cb2 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/Makefile @@ -0,0 +1,2 @@ +FILTER=src +include $(ONL)/make/subdirs.mk diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/Makefile new file mode 100644 index 00000000..60e3cf5a --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/Makefile @@ -0,0 +1,46 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Shared and static library builds for the +# powerpc-quanta-ly2-r0 +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +MODULE := libonlp-powerpc-quanta-ly2-r0 +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF powerpc_quanta_ly2 onlplib sff cjson cjson_util quanta_sys_eeprom + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-powerpc-quanta-ly2-r0.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/onlplib.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/onlplib.mk new file mode 100644 index 00000000..1569c035 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/onlplib.mk @@ -0,0 +1,10 @@ + +############################################################################### +# +# Inclusive Makefile for the onlplib module. +# +# Autogenerated 2015-11-13 21:31:17.833690 +# +############################################################################### +onlplib_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/quanta_sys_eeprom.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/quanta_sys_eeprom.mk new file mode 100644 index 00000000..a0ef3b6c --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/quanta_sys_eeprom.mk @@ -0,0 +1,10 @@ + +############################################################################### +# +# Inclusive Makefile for the quanta_sys_eeprom module. +# +# Autogenerated 2015-11-13 21:30:58.392873 +# +############################################################################### +quanta_sys_eeprom_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/sff.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/sff.mk new file mode 100644 index 00000000..d2226c96 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/lib/sff.mk @@ -0,0 +1,10 @@ + +############################################################################### +# +# Inclusive Makefile for the sff module. +# +# Autogenerated 2015-11-13 21:31:17.843759 +# +############################################################################### +sff_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/onlpdump/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/onlpdump/Makefile new file mode 100644 index 00000000..c4f3fe76 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/onlpdump/Makefile @@ -0,0 +1,51 @@ +############################################################ +# +# +# Copyright 2014 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +include $(ONL)/make/config.powerpc.mk + +.DEFAULT_GOAL := onlpdump + +MODULE := onlpdump +include $(BUILDER)/standardinit.mk + +LIBRARY := onlpdumpmain +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk + +DEPENDMODULES := AIM IOF onlp powerpc_quanta_ly2 onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS quanta_sys_eeprom + +include $(BUILDER)/dependmodules.mk + +BINARY := onlpdump +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 + +GLOBAL_LINK_LIBS += -lpthread -lm + +include $(BUILDER)/targets.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/Makefile new file mode 100644 index 00000000..f2d4c358 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/Makefile @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +include $(ONL)/make/config.mk + +MODULE := powerpc_quanta_ly2 +AUTOMODULE := powerpc_quanta_ly2 +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/README b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/README new file mode 100644 index 00000000..f65508b2 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/README @@ -0,0 +1,6 @@ +############################################################################### +# +# powerpc_quanta_ly2 README +# +############################################################################### + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/make.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/make.mk new file mode 100644 index 00000000..4b09e8e4 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# powerpc_quanta_ly2 Autogeneration +# +############################################################################### +powerpc_quanta_ly2_AUTO_DEFS := module/auto/powerpc_quanta_ly2.yml +powerpc_quanta_ly2_AUTO_DIRS := module/inc/powerpc_quanta_ly2 module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/powerpc_quanta_ly2.yml b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/powerpc_quanta_ly2.yml new file mode 100644 index 00000000..fe7e6305 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/auto/powerpc_quanta_ly2.yml @@ -0,0 +1,116 @@ +############################################################################### +# +# powerpc_quanta_ly2 Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB +- POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD: + doc: "RPM Threshold at which the fan is considered to have failed." + default: 100 +- POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX: + doc: "Maximum system front-to-back fan speed." + default: 13000 +- POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX: + doc: "Maximum system back-to-front fan speed." + default: 24000 +- POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS: + doc: "Time to hold Phy GPIO in reset, in ms" + default: 100 + +definitions: + cdefs: + POWERPC_QUANTA_LY2_R0_CONFIG_HEADER: + defs: *cdefs + basename: powerpc_quanta_ly2_config + + enum: &enums + + fan_id: + members: + - FAN1 : 1 + - FAN2 : 2 + - FAN3 : 3 + - FAN4 : 4 + - FAN5 : 5 + - FAN6 : 6 + + fan_oid: + members: + - FAN1 : ONLP_FAN_ID_CREATE(1) + - FAN2 : ONLP_FAN_ID_CREATE(2) + - FAN3 : ONLP_FAN_ID_CREATE(3) + - FAN4 : ONLP_FAN_ID_CREATE(4) + - FAN5 : ONLP_FAN_ID_CREATE(5) + - FAN6 : ONLP_FAN_ID_CREATE(6) + + psu_id: + members: + - PSU1 : 1 + - PSU2 : 2 + + psu_oid: + members: + - PSU1 : ONLP_PSU_ID_CREATE(1) + - PSU2 : ONLP_PSU_ID_CREATE(2) + + thermal_id: + members: + - THERMAL1 : 1 + - THERMAL2 : 2 + - THERMAL3 : 3 + - THERMAL4 : 4 + - THERMAL5 : 5 + - THERMAL6 : 6 + - THERMAL7 : 7 + - THERMAL8 : 8 + - THERMAL9 : 9 + - THERMAL10 : 10 + - THERMAL11 : 11 + + + thermal_oid: + members: + - THERMAL1 : ONLP_THERMAL_ID_CREATE(1) + - THERMAL2 : ONLP_THERMAL_ID_CREATE(2) + - THERMAL3 : ONLP_THERMAL_ID_CREATE(3) + - THERMAL4 : ONLP_THERMAL_ID_CREATE(4) + - THERMAL5 : ONLP_THERMAL_ID_CREATE(5) + - THERMAL6 : ONLP_THERMAL_ID_CREATE(6) + - THERMAL7 : ONLP_THERMAL_ID_CREATE(7) + - THERMAL8 : ONLP_THERMAL_ID_CREATE(8) + - THERMAL9 : ONLP_THERMAL_ID_CREATE(9) + - THERMAL10 : ONLP_THERMAL_ID_CREATE(10) + - THERMAL11 : ONLP_THERMAL_ID_CREATE(11) + + + portingmacro: + POWERPC_QUANTA_LY2_R0: + macros: + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2.x b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2.x new file mode 100644 index 00000000..601b463d --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_config.h b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_config.h new file mode 100644 index 00000000..c4d78eaf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_config.h @@ -0,0 +1,167 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_quanta_ly2 Configuration Header + * + * @addtogroup powerpc_quanta_ly2-config + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LY2_R0_CONFIG_H__ +#define __POWERPC_QUANTA_LY2_R0_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef POWERPC_QUANTA_LY2_R0_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING +#define POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT +#define POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT +#define POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB +#define POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI +#define POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI 0 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD + * + * RPM Threshold at which the fan is considered to have failed. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD +#define POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD 100 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX + * + * Maximum system front-to-back fan speed. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX +#define POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX 13000 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX + * + * Maximum system back-to-front fan speed. */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX +#define POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX 24000 +#endif + +/** + * POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS + * + * Time to hold Phy GPIO in reset, in ms */ + + +#ifndef POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS +#define POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS 100 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct powerpc_quanta_ly2_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} powerpc_quanta_ly2_config_settings_t; + +/** Configuration settings table. */ +/** powerpc_quanta_ly2_config_settings table. */ +extern powerpc_quanta_ly2_config_settings_t powerpc_quanta_ly2_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* powerpc_quanta_ly2_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int powerpc_quanta_ly2_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "powerpc_quanta_ly2_porting.h" + +#endif /* __POWERPC_QUANTA_LY2_R0_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_dox.h b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_dox.h new file mode 100644 index 00000000..e670a52f --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * powerpc_quanta_ly2 Doxygen Header + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LY2_R0_DOX_H__ +#define __POWERPC_QUANTA_LY2_R0_DOX_H__ + +/** + * @defgroup powerpc_quanta_ly2 powerpc_quanta_ly2 - powerpc_quanta_ly2 Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup powerpc_quanta_ly2-powerpc_quanta_ly2 Public Interface + * @defgroup powerpc_quanta_ly2-config Compile Time Configuration + * @defgroup powerpc_quanta_ly2-porting Porting Macros + * + * @} + * + */ + +#endif /* __POWERPC_QUANTA_LY2_R0_DOX_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h new file mode 100644 index 00000000..694782f8 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h @@ -0,0 +1,87 @@ +/**************************************************************************//** + * + * @file + * @brief powerpc_quanta_ly2 Porting Macros. + * + * @addtogroup powerpc_quanta_ly2-porting + * @{ + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LY2_R0_PORTING_H__ +#define __POWERPC_QUANTA_LY2_R0_PORTING_H__ + + +/* */ +#if POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_MEMSET + #if defined(GLOBAL_MEMSET) + #define POWERPC_QUANTA_LY2_R0_MEMSET GLOBAL_MEMSET + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_MEMSET memset + #else + #error The macro POWERPC_QUANTA_LY2_R0_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define POWERPC_QUANTA_LY2_R0_MEMCPY GLOBAL_MEMCPY + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_MEMCPY memcpy + #else + #error The macro POWERPC_QUANTA_LY2_R0_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define POWERPC_QUANTA_LY2_R0_STRNCPY GLOBAL_STRNCPY + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_STRNCPY strncpy + #else + #error The macro POWERPC_QUANTA_LY2_R0_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define POWERPC_QUANTA_LY2_R0_VSNPRINTF GLOBAL_VSNPRINTF + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_VSNPRINTF vsnprintf + #else + #error The macro POWERPC_QUANTA_LY2_R0_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define POWERPC_QUANTA_LY2_R0_SNPRINTF GLOBAL_SNPRINTF + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_SNPRINTF snprintf + #else + #error The macro POWERPC_QUANTA_LY2_R0_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef POWERPC_QUANTA_LY2_R0_STRLEN + #if defined(GLOBAL_STRLEN) + #define POWERPC_QUANTA_LY2_R0_STRLEN GLOBAL_STRLEN + #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 + #define POWERPC_QUANTA_LY2_R0_STRLEN strlen + #else + #error The macro POWERPC_QUANTA_LY2_R0_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __POWERPC_QUANTA_LY2_R0_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/make.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/make.mk new file mode 100644 index 00000000..1e6587c3 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +powerpc_quanta_ly2_INCLUDES := -I $(THIS_DIR)inc +powerpc_quanta_ly2_INTERNAL_INCLUDES := -I $(THIS_DIR)src +powerpc_quanta_ly2_DEPENDMODULE_ENTRIES := init:powerpc_quanta_ly2 ucli:powerpc_quanta_ly2 + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/Makefile new file mode 100644 index 00000000..5aef15cb --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py powerpc_quanta_ly2_ucli.c + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/fani.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/fani.c new file mode 100644 index 00000000..09c79996 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/fani.c @@ -0,0 +1,156 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include "powerpc_quanta_ly2_int.h" +#include "powerpc_quanta_ly2_log.h" + +#include + +int +onlp_fani_init(void) +{ + return ONLP_STATUS_OK; +} + + +static int +sys_fan_info_get__(onlp_fan_info_t* info, int id) +{ + int rv; + + rv = onlp_file_read_int(&info->rpm, + SYS_HWMON_PREFIX "/fan%d_input", id); + + if(rv == ONLP_STATUS_E_INTERNAL) { + return rv; + } + + if(rv == ONLP_STATUS_E_MISSING) { + info->status &= ~1; + return 0; + } + + if(info->rpm <= POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) { + info->status |= ONLP_FAN_STATUS_FAILED; + } + + /* + * Calculate percentage based on current speed and the maximum. + */ + info->caps |= ONLP_FAN_CAPS_GET_PERCENTAGE; + if(info->status & ONLP_FAN_STATUS_F2B) { + info->percentage = info->rpm * 100 / POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX; + } + if(info->status & ONLP_FAN_STATUS_B2F) { + info->percentage = info->rpm * 100 / POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX; + } + return 0; +} + +static int +psu_fan_info_get__(onlp_fan_info_t* info, int id) +{ + extern char* psu_paths[]; + + /* FAN5 -> PSU1 */ + /* FAN6 -> PSU2 */ + char* dir = psu_paths[id-4]; + return onlp_file_read_int(&info->rpm, "%s/fan1_input", dir); +} + + + +/* Onboard Fans */ +static onlp_fan_info_t fans__[] = { + { }, /* Not used */ + { { FAN_OID_FAN1, "Right", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN2, "Center Right", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN3, "Center Left", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN4, "Left", 0}, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN5, "PSU-1 Fan", 0 }, ONLP_FAN_STATUS_PRESENT }, + { { FAN_OID_FAN6, "PSU-2 Fan", 0 }, ONLP_FAN_STATUS_PRESENT }, + +}; + +int +onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* rv) +{ + *rv = fans__[ONLP_OID_ID_GET(id)]; + rv->caps |= ONLP_FAN_CAPS_GET_RPM; + + int len; + char direction[16] = {0}; + + int fid = ONLP_OID_ID_GET(id); + + /* Read the current airflow direction */ + onlp_file_read((uint8_t*)direction, sizeof(direction), &len, + SYS_HWMON_PREFIX "/fan_dir"); + +#define FAN_DIR_F2B "front-to-back" +#define FAN_DIR_B2F "back-to-front" + + if(!strncmp(direction, FAN_DIR_F2B, strlen(FAN_DIR_F2B))) { + rv->status |= ONLP_FAN_STATUS_F2B; + rv->caps |= ONLP_FAN_CAPS_F2B; + } + else if(!strncmp(direction, FAN_DIR_B2F, strlen(FAN_DIR_B2F))) { + rv->status |= ONLP_FAN_STATUS_B2F; + rv->caps |= ONLP_FAN_CAPS_B2F; + } + else { + AIM_LOG_WARN("Invalid fan direction: '%s'", direction); + } + + + switch(fid) + { + case FAN_ID_FAN1: + case FAN_ID_FAN2: + case FAN_ID_FAN3: + case FAN_ID_FAN4: + { + if(rv->status & ONLP_FAN_STATUS_F2B) { + return sys_fan_info_get__(rv, fid); + } + if(rv->status & ONLP_FAN_STATUS_B2F) { + return sys_fan_info_get__(rv, fid+4); + } + return ONLP_STATUS_E_INTERNAL; + } + + case FAN_ID_FAN5: + case FAN_ID_FAN6: + { + return psu_fan_info_get__(rv, fid); + } + } + + return ONLP_STATUS_E_INVALID; +} + + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/make.mk b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/make.mk new file mode 100644 index 00000000..ab21b759 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := powerpc_quanta_ly2 +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_config.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_config.c new file mode 100644 index 00000000..d1c9a6eb --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_config.c @@ -0,0 +1,96 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __powerpc_quanta_ly2_config_STRINGIFY_NAME(_x) #_x +#define __powerpc_quanta_ly2_config_STRINGIFY_VALUE(_x) __powerpc_quanta_ly2_config_STRINGIFY_NAME(_x) +powerpc_quanta_ly2_config_settings_t powerpc_quanta_ly2_config_settings[] = +{ +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_LOGGING(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_RPM_FAILURE_THRESHOLD(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_F2B_RPM_MAX(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_SYSFAN_B2F_RPM_MAX(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS + { __powerpc_quanta_ly2_config_STRINGIFY_NAME(POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS), __powerpc_quanta_ly2_config_STRINGIFY_VALUE(POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS) }, +#else +{ POWERPC_QUANTA_LY2_R0_CONFIG_PHY_RESET_DELAY_MS(__powerpc_quanta_ly2_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __powerpc_quanta_ly2_config_STRINGIFY_VALUE +#undef __powerpc_quanta_ly2_config_STRINGIFY_NAME + +const char* +powerpc_quanta_ly2_config_lookup(const char* setting) +{ + int i; + for(i = 0; powerpc_quanta_ly2_config_settings[i].name; i++) { + if(strcmp(powerpc_quanta_ly2_config_settings[i].name, setting)) { + return powerpc_quanta_ly2_config_settings[i].value; + } + } + return NULL; +} + +int +powerpc_quanta_ly2_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; powerpc_quanta_ly2_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", powerpc_quanta_ly2_config_settings[i].name, powerpc_quanta_ly2_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_enums.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_enums.c new file mode 100644 index 00000000..34f2904e --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_int.h b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_int.h new file mode 100644 index 00000000..fbe22afa --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_int.h @@ -0,0 +1,204 @@ +/**************************************************************************//** + * + * powerpc_quanta_ly2 Internal Header + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LY2_R0_INT_H__ +#define __POWERPC_QUANTA_LY2_R0_INT_H__ + +#include + +/* */ +/** thermal_oid */ +typedef enum thermal_oid_e { + THERMAL_OID_THERMAL1 = ONLP_THERMAL_ID_CREATE(1), + THERMAL_OID_THERMAL2 = ONLP_THERMAL_ID_CREATE(2), + THERMAL_OID_THERMAL3 = ONLP_THERMAL_ID_CREATE(3), + THERMAL_OID_THERMAL4 = ONLP_THERMAL_ID_CREATE(4), + THERMAL_OID_THERMAL5 = ONLP_THERMAL_ID_CREATE(5), + THERMAL_OID_THERMAL6 = ONLP_THERMAL_ID_CREATE(6), + THERMAL_OID_THERMAL7 = ONLP_THERMAL_ID_CREATE(7), + THERMAL_OID_THERMAL8 = ONLP_THERMAL_ID_CREATE(8), + THERMAL_OID_THERMAL9 = ONLP_THERMAL_ID_CREATE(9), + THERMAL_OID_THERMAL10 = ONLP_THERMAL_ID_CREATE(10), + THERMAL_OID_THERMAL11 = ONLP_THERMAL_ID_CREATE(11), +} thermal_oid_t; + +/** Enum names. */ +const char* thermal_oid_name(thermal_oid_t e); + +/** Enum values. */ +int thermal_oid_value(const char* str, thermal_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* thermal_oid_desc(thermal_oid_t e); + +/** Enum validator. */ +int thermal_oid_valid(thermal_oid_t e); + +/** validator */ +#define THERMAL_OID_VALID(_e) \ + (thermal_oid_valid((_e))) + +/** thermal_oid_map table. */ +extern aim_map_si_t thermal_oid_map[]; +/** thermal_oid_desc_map table. */ +extern aim_map_si_t thermal_oid_desc_map[]; + +/** psu_oid */ +typedef enum psu_oid_e { + PSU_OID_PSU1 = ONLP_PSU_ID_CREATE(1), + PSU_OID_PSU2 = ONLP_PSU_ID_CREATE(2), +} psu_oid_t; + +/** Enum names. */ +const char* psu_oid_name(psu_oid_t e); + +/** Enum values. */ +int psu_oid_value(const char* str, psu_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* psu_oid_desc(psu_oid_t e); + +/** Enum validator. */ +int psu_oid_valid(psu_oid_t e); + +/** validator */ +#define PSU_OID_VALID(_e) \ + (psu_oid_valid((_e))) + +/** psu_oid_map table. */ +extern aim_map_si_t psu_oid_map[]; +/** psu_oid_desc_map table. */ +extern aim_map_si_t psu_oid_desc_map[]; + +/** thermal_id */ +typedef enum thermal_id_e { + THERMAL_ID_THERMAL1 = 1, + THERMAL_ID_THERMAL2 = 2, + THERMAL_ID_THERMAL3 = 3, + THERMAL_ID_THERMAL4 = 4, + THERMAL_ID_THERMAL5 = 5, + THERMAL_ID_THERMAL6 = 6, + THERMAL_ID_THERMAL7 = 7, + THERMAL_ID_THERMAL8 = 8, + THERMAL_ID_THERMAL9 = 9, + THERMAL_ID_THERMAL10 = 10, + THERMAL_ID_THERMAL11 = 11, +} thermal_id_t; + +/** Enum names. */ +const char* thermal_id_name(thermal_id_t e); + +/** Enum values. */ +int thermal_id_value(const char* str, thermal_id_t* e, int substr); + +/** Enum descriptions. */ +const char* thermal_id_desc(thermal_id_t e); + +/** Enum validator. */ +int thermal_id_valid(thermal_id_t e); + +/** validator */ +#define THERMAL_ID_VALID(_e) \ + (thermal_id_valid((_e))) + +/** thermal_id_map table. */ +extern aim_map_si_t thermal_id_map[]; +/** thermal_id_desc_map table. */ +extern aim_map_si_t thermal_id_desc_map[]; + +/** fan_id */ +typedef enum fan_id_e { + FAN_ID_FAN1 = 1, + FAN_ID_FAN2 = 2, + FAN_ID_FAN3 = 3, + FAN_ID_FAN4 = 4, + FAN_ID_FAN5 = 5, + FAN_ID_FAN6 = 6, +} fan_id_t; + +/** Enum names. */ +const char* fan_id_name(fan_id_t e); + +/** Enum values. */ +int fan_id_value(const char* str, fan_id_t* e, int substr); + +/** Enum descriptions. */ +const char* fan_id_desc(fan_id_t e); + +/** Enum validator. */ +int fan_id_valid(fan_id_t e); + +/** validator */ +#define FAN_ID_VALID(_e) \ + (fan_id_valid((_e))) + +/** fan_id_map table. */ +extern aim_map_si_t fan_id_map[]; +/** fan_id_desc_map table. */ +extern aim_map_si_t fan_id_desc_map[]; + +/** psu_id */ +typedef enum psu_id_e { + PSU_ID_PSU1 = 1, + PSU_ID_PSU2 = 2, +} psu_id_t; + +/** Enum names. */ +const char* psu_id_name(psu_id_t e); + +/** Enum values. */ +int psu_id_value(const char* str, psu_id_t* e, int substr); + +/** Enum descriptions. */ +const char* psu_id_desc(psu_id_t e); + +/** Enum validator. */ +int psu_id_valid(psu_id_t e); + +/** validator */ +#define PSU_ID_VALID(_e) \ + (psu_id_valid((_e))) + +/** psu_id_map table. */ +extern aim_map_si_t psu_id_map[]; +/** psu_id_desc_map table. */ +extern aim_map_si_t psu_id_desc_map[]; + +/** fan_oid */ +typedef enum fan_oid_e { + FAN_OID_FAN1 = ONLP_FAN_ID_CREATE(1), + FAN_OID_FAN2 = ONLP_FAN_ID_CREATE(2), + FAN_OID_FAN3 = ONLP_FAN_ID_CREATE(3), + FAN_OID_FAN4 = ONLP_FAN_ID_CREATE(4), + FAN_OID_FAN5 = ONLP_FAN_ID_CREATE(5), + FAN_OID_FAN6 = ONLP_FAN_ID_CREATE(6), +} fan_oid_t; + +/** Enum names. */ +const char* fan_oid_name(fan_oid_t e); + +/** Enum values. */ +int fan_oid_value(const char* str, fan_oid_t* e, int substr); + +/** Enum descriptions. */ +const char* fan_oid_desc(fan_oid_t e); + +/** Enum validator. */ +int fan_oid_valid(fan_oid_t e); + +/** validator */ +#define FAN_OID_VALID(_e) \ + (fan_oid_valid((_e))) + +/** fan_oid_map table. */ +extern aim_map_si_t fan_oid_map[]; +/** fan_oid_desc_map table. */ +extern aim_map_si_t fan_oid_desc_map[]; +/* */ + + +#define SYS_HWMON_PREFIX "/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-4/4-002e" + +#endif /* __POWERPC_QUANTA_LY2_R0_INT_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.c new file mode 100644 index 00000000..9f9b295d --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_quanta_ly2_log.h" +/* + * powerpc_quanta_ly2 log struct. + */ +AIM_LOG_STRUCT_DEFINE( + POWERPC_QUANTA_LY2_R0_CONFIG_LOG_OPTIONS_DEFAULT, + POWERPC_QUANTA_LY2_R0_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + POWERPC_QUANTA_LY2_R0_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.h b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.h new file mode 100644 index 00000000..595b8e57 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __POWERPC_QUANTA_LY2_R0_LOG_H__ +#define __POWERPC_QUANTA_LY2_R0_LOG_H__ + +#define AIM_LOG_MODULE_NAME powerpc_quanta_ly2 +#include + +#endif /* __POWERPC_QUANTA_LY2_R0_LOG_H__ */ diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_module.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_module.c new file mode 100644 index 00000000..2b2fcff6 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_module.c @@ -0,0 +1,24 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "powerpc_quanta_ly2_log.h" + +static int +datatypes_init__(void) +{ +#define POWERPC_QUANTA_LY2_R0_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __powerpc_quanta_ly2_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + +int __onlp_platform_version__ = 1; diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_ucli.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_ucli.c new file mode 100644 index 00000000..55fdd021 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/powerpc_quanta_ly2_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if POWERPC_QUANTA_LY2_R0_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +powerpc_quanta_ly2_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(powerpc_quanta_ly2) +} + +/* */ +/* */ + +static ucli_module_t +powerpc_quanta_ly2_ucli_module__ = + { + "powerpc_quanta_ly2_ucli", + NULL, + powerpc_quanta_ly2_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +powerpc_quanta_ly2_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&powerpc_quanta_ly2_ucli_module__); + n = ucli_node_create("powerpc_quanta_ly2", NULL, &powerpc_quanta_ly2_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("powerpc_quanta_ly2")); + return n; +} + +#else +void* +powerpc_quanta_ly2_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/psui.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/psui.c new file mode 100644 index 00000000..8456e4a2 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/psui.c @@ -0,0 +1,109 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include "powerpc_quanta_ly2_int.h" +#include "powerpc_quanta_ly2_log.h" + +int +onlp_psui_init(void) +{ + return 0; +} + +static onlp_psu_info_t psus__[] = { + { }, /* Not used */ + { + { + PSU_OID_PSU1, + "PSU-1", + 0, + { + FAN_OID_FAN5, + THERMAL_OID_THERMAL6, + THERMAL_OID_THERMAL7, + THERMAL_OID_THERMAL8, + }, + } + }, + { + { + PSU_OID_PSU2, + "PSU-2", + 0, + { + FAN_OID_FAN6, + THERMAL_OID_THERMAL9, + THERMAL_OID_THERMAL10, + THERMAL_OID_THERMAL11, + }, + } + }, +}; + +char* psu_paths[] = { + NULL, /* Not used */ + "/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-6/6-0058", + "/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-7/7-0059", +}; + +int +onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) +{ + int rv; + int pid = ONLP_OID_ID_GET(id); + *info = psus__[pid]; + const char* dir = psu_paths[pid]; + + /* + * Todo -- use the GPIO to determine PSU presence. + * For this first version we'll approximate the status using + * the input voltage sensor. + */ + rv = onlp_file_read_int(&info->mvin, "%s/in1_input", dir); + if(rv == ONLP_STATUS_E_MISSING || info->mvin == 0) { + info->status &= ~1; + return 0; + } + else if(rv < 0) { + return rv; + } + else { + info->caps |= ONLP_PSU_CAPS_VIN; + } + + /* PSU is present and powered. */ + info->status |= 1; + strcpy(info->model, "PSU-LY2"); + info->caps |= ONLP_PSU_CAPS_AC; + + if(onlp_file_read_int(&info->miin, "%s/curr1_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_IIN; + } + if(onlp_file_read_int(&info->miout, "%s/curr2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_IOUT; + } + if(onlp_file_read_int(&info->mvout, "%s/in2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_VOUT; + /* Empirical */ + info->mvout /= 500; + } + if(onlp_file_read_int(&info->mpin, "%s/power1_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_PIN; + /* The pmbus driver reports power in micro-units */ + info->mpin /= 1000; + } + if(onlp_file_read_int(&info->mpout, "%s/power2_input", dir) == 0) { + info->caps |= ONLP_PSU_CAPS_POUT; + /* the pmbus driver reports power in micro-units */ + info->mpout /= 1000; + } + return ONLP_STATUS_OK; +} diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sfpi.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sfpi.c new file mode 100644 index 00000000..e1877b7e --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sfpi.c @@ -0,0 +1,170 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * SFPI Interface for the Quanta LY2 + * + ***********************************************************/ +#include +#include +#include +#include "powerpc_quanta_ly2_log.h" + +#include +#include + +/** + * This table maps the presence gpio, reset gpio, and eeprom file + * for each SFP port. + */ +typedef struct sfpmap_s { + int port; + const char* mod_present_gpio; + const char* reset_gpio; + const char* eeprom; + const char* dom; +} sfpmap_t; + +static sfpmap_t sfpmap__[] = + { + { 1, "/sys/class/gpio/gpio168/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-14/14-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-14/14-0051/eeprom" }, + { 2, "/sys/class/gpio/gpio169/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-15/15-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-15/15-0051/eeprom" }, + { 3, "/sys/class/gpio/gpio170/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-16/16-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-16/16-0051/eeprom" }, + { 4, "/sys/class/gpio/gpio171/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-17/17-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-17/17-0051/eeprom" }, + { 5, "/sys/class/gpio/gpio172/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-18/18-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-18/18-0051/eeprom" }, + { 6, "/sys/class/gpio/gpio173/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-19/19-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-19/19-0051/eeprom" }, + { 7, "/sys/class/gpio/gpio174/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-20/20-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-20/20-0051/eeprom" }, + { 8, "/sys/class/gpio/gpio175/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-21/21-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-21/21-0051/eeprom" }, + { 9, "/sys/class/gpio/gpio176/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-22/22-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-22/22-0051/eeprom" }, + { 10, "/sys/class/gpio/gpio177/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-23/23-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-23/23-0051/eeprom" }, + { 11, "/sys/class/gpio/gpio178/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-24/24-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-24/24-0051/eeprom" }, + { 12, "/sys/class/gpio/gpio179/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-25/25-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-25/25-0051/eeprom" }, + { 13, "/sys/class/gpio/gpio180/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-26/26-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-26/26-0051/eeprom" }, + { 14, "/sys/class/gpio/gpio181/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-27/27-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-27/27-0051/eeprom" }, + { 15, "/sys/class/gpio/gpio182/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-28/28-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-28/28-0051/eeprom" }, + { 16, "/sys/class/gpio/gpio183/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-29/29-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-29/29-0051/eeprom" }, + { 17, "/sys/class/gpio/gpio144/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-30/30-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-30/30-0051/eeprom" }, + { 18, "/sys/class/gpio/gpio145/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-31/31-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-31/31-0051/eeprom" }, + { 19, "/sys/class/gpio/gpio146/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-32/32-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-32/32-0051/eeprom" }, + { 20, "/sys/class/gpio/gpio147/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-33/33-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-33/33-0051/eeprom" }, + { 21, "/sys/class/gpio/gpio148/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-34/34-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-34/34-0051/eeprom" }, + { 22, "/sys/class/gpio/gpio149/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0051/eeprom" }, + { 23, "/sys/class/gpio/gpio150/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-36/36-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0051/eeprom" }, + { 24, "/sys/class/gpio/gpio151/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-37/37-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-37/37-0051/eeprom" }, + { 25, "/sys/class/gpio/gpio152/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-38/38-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-38/38-0051/eeprom" }, + { 26, "/sys/class/gpio/gpio153/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-39/39-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-39/39-0051/eeprom" }, + { 27, "/sys/class/gpio/gpio154/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-40/40-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-40/40-0051/eeprom" }, + { 28, "/sys/class/gpio/gpio155/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-41/41-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-41/41-0051/eeprom" }, + { 29, "/sys/class/gpio/gpio156/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-42/42-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-42/42-0051/eeprom" }, + { 30, "/sys/class/gpio/gpio157/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-43/43-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-43/43-0051/eeprom" }, + { 31, "/sys/class/gpio/gpio158/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-44/44-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-44/44-0051/eeprom" }, + { 32, "/sys/class/gpio/gpio159/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-45/45-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-45/45-0051/eeprom" }, + { 33, "/sys/class/gpio/gpio120/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-46/46-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-46/46-0051/eeprom" }, + { 34, "/sys/class/gpio/gpio121/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-47/47-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-47/47-0051/eeprom" }, + { 35, "/sys/class/gpio/gpio122/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-48/48-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-48/48-0051/eeprom" }, + { 36, "/sys/class/gpio/gpio123/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-49/49-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-49/49-0051/eeprom" }, + { 37, "/sys/class/gpio/gpio124/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-50/50-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-50/50-0051/eeprom" }, + { 38, "/sys/class/gpio/gpio125/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-51/51-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-51/51-0051/eeprom" }, + { 39, "/sys/class/gpio/gpio126/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-52/52-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-52/52-0051/eeprom" }, + { 40, "/sys/class/gpio/gpio127/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-53/53-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-53/53-0051/eeprom" }, + { 41, "/sys/class/gpio/gpio128/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-54/54-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-54/54-0051/eeprom" }, + { 42, "/sys/class/gpio/gpio129/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-55/55-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-55/55-0051/eeprom" }, + { 43, "/sys/class/gpio/gpio130/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-56/56-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-56/56-0051/eeprom" }, + { 44, "/sys/class/gpio/gpio131/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-57/57-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-57/57-0051/eeprom" }, + { 45, "/sys/class/gpio/gpio132/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-58/58-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-58/58-0051/eeprom" }, + { 46, "/sys/class/gpio/gpio133/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-59/59-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-59/59-0051/eeprom" }, + { 47, "/sys/class/gpio/gpio134/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-60/60-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-60/60-0051/eeprom" }, + { 48, "/sys/class/gpio/gpio135/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-61/61-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-61/61-0051/eeprom" }, + { 49, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-10/10-0050/eeprom", NULL }, + { 50, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-11/11-0050/eeprom", NULL }, + { 51, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-12/12-0050/eeprom", NULL }, + { 52, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-13/13-0050/eeprom", NULL }, + }; + + +int +onlp_sfpi_init(void) +{ + return ONLP_STATUS_OK; +} + +int +onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap) +{ + int p; + + for(p = 0; p < 52; p++) { + AIM_BITMAP_SET(bmap, p); + } + + return ONLP_STATUS_OK; +} + +#define SFP_GET(_port) (sfpmap__ + _port) + +int +onlp_sfpi_is_present(int port) +{ + sfpmap_t* sfp = SFP_GET(port); + if(sfp->mod_present_gpio) { + return onlplib_sfp_is_present_file(sfp->mod_present_gpio, + /* Present */ "1\n", + /* Absent */ "0\n"); + } + else { + /** + * If we can open and read a byte from the EEPROM file + * then we consider it present. + */ + int fd = open(sfp->eeprom, O_RDONLY); + if (fd < 0) { + /* Not Present */ + return 0; + } + int rv; + uint8_t byte; + + if(read(fd, &byte, 1) == 1) { + /* Present */ + rv = 1; + } + else { + /* No Present */ + rv = 0; + } + close(fd); + return rv; + } +} + +int +onlp_sfpi_eeprom_read(int port, uint8_t data[256]) +{ + sfpmap_t* sfp = SFP_GET(port); + return onlplib_sfp_eeprom_read_file(sfp->eeprom, data); +} + +int +onlp_sfpi_dom_read(int port, uint8_t data[256]) +{ + sfpmap_t* sfp = SFP_GET(port); + return onlplib_sfp_eeprom_read_file(sfp->dom, data); +} + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sysi.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sysi.c new file mode 100644 index 00000000..19379a12 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/sysi.c @@ -0,0 +1,76 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include "powerpc_quanta_ly2_int.h" +#include "powerpc_quanta_ly2_log.h" +#include + +const char* +onlp_sysi_platform_get(void) +{ + return "powerpc-quanta-ly2-r0"; +} + +int +onlp_sysi_init(void) +{ + return ONLP_STATUS_OK; +} + +#define QUANTA_SYS_EEPROM_PATH \ +"/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-2/2-0054/eeprom" + +int +onlp_sysi_onie_info_get(onlp_onie_info_t* onie) +{ + int rv; + quanta_sys_eeprom_t e; + rv = quanta_sys_eeprom_parse_file(QUANTA_SYS_EEPROM_PATH, &e); + if(rv >= 0) { + quanta_sys_eeprom_to_onie(&e, onie); + onie->platform_name = aim_strdup("powerpc-quanta-ly2-r0"); + } + return rv; +} + +int +onlp_sysi_oids_get(onlp_oid_t* table, int max) +{ + onlp_oid_t* e = table; + memset(table, 0, max*sizeof(onlp_oid_t)); + + + /* + * 5 Chassis Thermal Sensors + */ + *e++ = THERMAL_OID_THERMAL1; + *e++ = THERMAL_OID_THERMAL2; + *e++ = THERMAL_OID_THERMAL3; + *e++ = THERMAL_OID_THERMAL4; + *e++ = THERMAL_OID_THERMAL5; + + /* + * 4 Fans + */ + *e++ = FAN_OID_FAN1; + *e++ = FAN_OID_FAN2; + *e++ = FAN_OID_FAN3; + *e++ = FAN_OID_FAN4; + + /* + * 2 PSUs + */ + *e++ = PSU_OID_PSU1; + *e++ = PSU_OID_PSU2; + + /* + * Todo - LEDs + */ + return 0; +} diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/thermali.c b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/thermali.c new file mode 100644 index 00000000..7d6167c4 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/onlp/builds/src/module/src/thermali.c @@ -0,0 +1,115 @@ +/************************************************************ + * + * + * Copyright 2014 Big Switch Networks, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include "powerpc_quanta_ly2_int.h" +#include "powerpc_quanta_ly2_log.h" + +int +onlp_thermali_init(void) +{ + return ONLP_STATUS_OK; +} + +static int +sys_thermal_info_get__(onlp_thermal_info_t* info, int id) +{ + int rv; + + rv = onlp_file_read_int(&info->mcelsius, + SYS_HWMON_PREFIX "/temp%d_input", id); + + if(rv == ONLP_STATUS_E_INTERNAL) { + return rv; + } + + if(rv == ONLP_STATUS_E_MISSING) { + info->status &= ~1; + return 0; + } + + return ONLP_STATUS_OK; +} + +static int +psu_thermal_info_get__(onlp_thermal_info_t* info, int pid, int id) +{ + /* THERMAL6 -> PSU1 */ + /* THERMAL7 -> PSU2 */ + extern char* psu_paths[]; + char* dir = psu_paths[pid]; + info->status |= 1; + return onlp_file_read_int(&info->mcelsius, "%s/temp%d_input", dir, id); +} + +int +onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv) +{ + int tid = ONLP_OID_ID_GET(id); + + static onlp_thermal_info_t info[] = { + { }, /* Not used */ + { { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal 1", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal 2", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(3), "Chassis Thermal 3", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(4), "Chassis Thermal 4", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + { { ONLP_THERMAL_ID_CREATE(5), "Chassis Thermal 5", 0}, ONLP_THERMAL_STATUS_PRESENT, }, + + { { ONLP_THERMAL_ID_CREATE(6), "PSU-1 Thermal 1", 0 } }, + { { ONLP_THERMAL_ID_CREATE(7), "PSU-1 Thermal 2", 0 } }, + { { ONLP_THERMAL_ID_CREATE(8), "PSU-1 Thermal 3", 0 } }, + + { { ONLP_THERMAL_ID_CREATE(9), "PSU-2 Thermal 1", 0 } }, + { { ONLP_THERMAL_ID_CREATE(10), "PSU-2 Thermal 2", 0 } }, + { { ONLP_THERMAL_ID_CREATE(11), "PSU-2 Thermal 3", 0 } }, + }; + + *rv = info[tid]; + rv->caps |= ONLP_THERMAL_CAPS_GET_TEMPERATURE; + + switch(tid) + { + case THERMAL_ID_THERMAL1: + case THERMAL_ID_THERMAL2: + case THERMAL_ID_THERMAL3: + case THERMAL_ID_THERMAL4: + case THERMAL_ID_THERMAL5: + return sys_thermal_info_get__(rv, tid); + + case THERMAL_ID_THERMAL6: + case THERMAL_ID_THERMAL7: + case THERMAL_ID_THERMAL8: + return psu_thermal_info_get__(rv, 1, tid-5); + + + case THERMAL_ID_THERMAL9: + case THERMAL_ID_THERMAL10: + case THERMAL_ID_THERMAL11: + return psu_thermal_info_get__(rv, 2, tid-8); + + } + + return ONLP_STATUS_E_INVALID; +} diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/Makefile b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/PKG.yml b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/PKG.yml new file mode 100644 index 00000000..ae6045cb --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=powerpc VENDOR=quanta PLATFORM=powerpc-quanta-ly2-r0 diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/boot/powerpc-quanta-ly2-r0 b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/boot/powerpc-quanta-ly2-r0 new file mode 100644 index 00000000..4f0f57e7 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/boot/powerpc-quanta-ly2-r0 @@ -0,0 +1,32 @@ +# -*- sh -*- +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# powerpc-quanta-ly2-r0 +# +############################################################ + +echo "soc.0/ffe24000.ethernet ma1" >/etc/onl/net +echo "block/mmcblk0 mmcblk0p2 flash" > /etc/onl/mounts +echo "block/mmcblk0 mmcblk0p3 flash2" >> /etc/onl/mounts + +echo "# MTD device name Device offset Env. size Flash sector size" > /etc/fw_env.config +echo "/dev/mtd2 0x00000000 0x00002000 0x00020000" >> /etc/fw_env.config diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/fancontrol b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/fancontrol new file mode 100644 index 00000000..77480a2f --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/fancontrol @@ -0,0 +1,15 @@ +############################################################ +# +# Platform: Quanta LY2 +# +############################################################ + +INTERVAL=10 +DEVPATH=hwmon0=devices/soc.0/ffe03000.i2c/i2c-0/i2c-4/4-002e +DEVNAME=hwmon0=quanta_ly_hwmon +FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input hwmon0/device/pwm2=hwmon0/device/temp1_input hwmon0/device/pwm3=hwmon0/device/temp1_input hwmon0/device/pwm4=hwmon0/device/temp1_input +FCFANS=hwmon0/device/pwm1=hwmon0/device/fan1_input hwmon0/device/pwm2=hwmon0/device/fan2_input hwmon0/device/pwm3=hwmon0/device/fan3_input hwmon0/device/pwm4=hwmon0/device/fan4_input +MINTEMP=hwmon0/device/pwm1=20 hwmon0/device/pwm2=20 hwmon0/device/pwm3=20 hwmon0/device/pwm4=20 +MAXTEMP=hwmon0/device/pwm1=60 hwmon0/device/pwm2=60 hwmon0/device/pwm3=60 hwmon0/device/pwm4=60 +MINSTART=hwmon0/device/pwm1=150 hwmon0/device/pwm2=150 hwmon0/device/pwm3=150 hwmon0/device/pwm4=150 +MINSTOP=hwmon0/device/pwm1=0 hwmon0/device/pwm2=0 hwmon0/device/pwm3=0 hwmon0/device/pwm4=0 diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/sensors3.conf b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/sensors3.conf new file mode 100644 index 00000000..8da532e9 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/etc/sensors3.conf @@ -0,0 +1,43 @@ +############################################################ +# +# Platform: Quanta LY2 +# +############################################################ + +chip "quanta_ly_hwmon-*" + label fan1 "Fan 1" + label fan2 "Fan 2" + label fan3 "Fan 3" + label fan4 "Fan 4" + label temp1 "Temp 1" + label temp2 "Temp 2" + label temp3 "Temp 3" + label temp4 "Temp 4" + label temp5 "Temp 5" + +chip "pmbus-*" + label in1 "Vin" + ignore in2 + label in3 "Vout" + compute in3 @/500,500*@ + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label fan1 "Fan 5" + label temp1 "Temp 6" + label temp2 "Temp 7" + label temp3 "Temp 8" + label power1 "Pin" + label power2 "Pout" + ignore power3 + ignore power4 + ignore power5 + ignore power6 + label curr1 "Iin" + label curr2 "Iout" + ignore curr3 + ignore curr4 + ignore curr5 + ignore curr6 + ignore curr7 diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/install/powerpc-quanta-ly2-r0.sh b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/install/powerpc-quanta-ly2-r0.sh new file mode 100644 index 00000000..408ba621 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/install/powerpc-quanta-ly2-r0.sh @@ -0,0 +1,33 @@ +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +############################################################ +# +# Installer scriptlet for the Quanta LY2. +# + +# The bootcommand is to read the loader directly from the first partition and execute it. +platform_bootcmd='mmc part 0; fatload mmc 0:1 0x10000000 onl-loader; setenv bootargs console=$consoledev,$baudrate onl_platform=powerpc-quanta-ly2-r0; bootm 0x10000000' + +platform_installer() { + # Standard installation on the CF card. + installer_standard_blockdev_install mmcblk0 16M 64M "" +} + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/powerpc-quanta-ly2-r0.yml b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/powerpc-quanta-ly2-r0.yml new file mode 100644 index 00000000..38b1f7d4 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/powerpc-quanta-ly2-r0.yml @@ -0,0 +1,5 @@ +powerpc-quanta-ly2-r0: + flat_image_tree: + kernel: onl-kernel-3.9.6-powerpc-e500v:powerpc, kernel-3.9.6-powerpc-e500v.bin.gz + dtb: onl-kernel-3.9.6-powerpc-e500v:powerpc, powerpc-quanta-ly2-r0.dtb + diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/sbin/sfpdump b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/sbin/sfpdump new file mode 100755 index 00000000..d6a9d392 --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/lib/sbin/sfpdump @@ -0,0 +1,52 @@ +#!/bin/bash +############################################################ +# +# +# Copyright 2013, 2014 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Platform: Quanta LY2 +# +# Linux assigns I2C bus numbers as it enumerates the I2C master/mux +# devices in the device tree breadth-first. The bus numbers below may +# change if the device tree changes. +# +# XXX roth -- does not reflect the device ordering the DTS file! +# +############################################################ + +base=/sys/devices/soc.0/ffe03100.i2c/i2c-1 +first=`/bin/ls -1d $base/i2c-* | /usr/bin/head -1` +first=${first##*/} +first=${first#i2c-} + +for port in $(seq 1 1 48); do + mux=$[ ( $port - 1 ) / 16 ] + dev=$[ ( ( $port - 1 ) & 0xF) ^ 0x1 ] + gdev=$[ $first + 4 + ( $mux * 16 ) + $dev ] + eep=$(printf "%s/i2c-%d/%d-0050/eeprom" $base $gdev $gdev) + echo "SFP port $port:" + hexdump -C $eep 2>/dev/null +done + +for port in $(seq 49 1 52); do + gdev=$[ $port - 49 + $first ] + eep=$(printf "%s/i2c-%d/%d-0050/eeprom" $base $gdev $gdev) + echo "QSFP port $port:" + hexdump -C $eep 2>/dev/null +done diff --git a/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/python/powerpc_quanta_ly2_r0/__init__.py b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/python/powerpc_quanta_ly2_r0/__init__.py new file mode 100644 index 00000000..4f6e625b --- /dev/null +++ b/packages/platforms/quanta/powerpc-quanta-ly2/platform-config/r0/src/python/powerpc_quanta_ly2_r0/__init__.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +############################################################ +# +############################################################ +import subprocess +from onl.platform.base import * +from onl.platform.quanta import * + +class OnlPlatform_powerpc_quanta_ly2_r0(OnlPlatformQuanta): + + def model(self): + return "LY2" + + def platform(self): + return "powerpc-quanta-ly2-r0" + + def baseconfig(self): + fan_dir='/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-4/4-002e/fan_dir' + if os.path.exists(fan_dir): + with open(fan_dir) as f: + data = f.read() + if data == 'front-to-back': + platform_fancontrol="%s/etc/fancontrol" % self.basedir_onl() + elif data == 'back-to-front': + platform_fancontrol="%s/etc/fancontrol.b2f" % self.basedir_onl() + else: + sys.exit(1) + else: + sys.exit(1) + FAN_CONF = '/etc/fancontrol' + if os.path.exists(FAN_CONF): + os.unlink(FAN_CONF) + if os.path.exists(platform_fancontrol): + os.symlink(platform_fancontrol, FAN_CONF) + else: + sys.exit(1) + + subprocess.call("%s/sbin/gpio_init" % self.basedir_onl()) + return True + + def sys_oid_platform(self): + return ".3048.1" + + + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/Makefile b/packages/platforms/quanta/src/quanta_sys_eeprom/Makefile new file mode 100644 index 00000000..eeee420c --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### +include ../../init.mk +MODULE := quanta_sys_eeprom +AUTOMODULE := quanta_sys_eeprom +include $(BUILDER)/definemodule.mk diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/README b/packages/platforms/quanta/src/quanta_sys_eeprom/README new file mode 100644 index 00000000..5f3a831b --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/README @@ -0,0 +1,6 @@ +############################################################################### +# +# quanta_sys_eeprom README +# +############################################################################### + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/make.mk b/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/make.mk new file mode 100644 index 00000000..14fa6e02 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# quanta_sys_eeprom Autogeneration +# +############################################################################### +quanta_sys_eeprom_AUTO_DEFS := module/auto/quanta_sys_eeprom.yml +quanta_sys_eeprom_AUTO_DIRS := module/inc/quanta_sys_eeprom module/src +include $(BUILDER)/auto.mk + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml b/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml new file mode 100644 index 00000000..c4104d0f --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml @@ -0,0 +1,47 @@ +############################################################################### +# +# quanta_sys_eeprom Autogeneration Definitions. +# +############################################################################### + +cdefs: &cdefs +- QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB +- QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 + + +definitions: + cdefs: + QUANTA_SYS_EEPROM_CONFIG_HEADER: + defs: *cdefs + basename: quanta_sys_eeprom_config + + portingmacro: + QUANTA_SYS_EEPROM: + macros: + - malloc + - free + - memset + - memcpy + - strncpy + - vsnprintf + - snprintf + - strlen diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/eeprom.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/eeprom.h new file mode 100644 index 00000000..48742dfb --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/eeprom.h @@ -0,0 +1,67 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#ifndef __QUANTA_SYS_EEPROM_EEPROM_H__ +#define __QUANTA_SYS_EEPROM_EEPROM_H__ + +#include +#include +#include + +typedef struct quanta_sys_eeprom_data_s { + +#define EEPROM_STR_MAX 32 + + char product_name[EEPROM_STR_MAX]; + char model_name[EEPROM_STR_MAX]; + char part_number[EEPROM_STR_MAX]; + char serial_number[EEPROM_STR_MAX]; + char manufacture_date[EEPROM_STR_MAX]; + char label_version[EEPROM_STR_MAX]; + uint8_t mac_address[6]; + uint32_t hardware_version; + uint32_t software_version; + uint32_t card_type; + uint32_t crc; + +} quanta_sys_eeprom_t; + +/** + * @brief Parse the given data in EEPROM format. + * @param data The eeprom data. + * @param size The length of the data. + * @param rv Receives the eeprom information. + */ +int quanta_sys_eeprom_parse_data(const uint8_t* data, int size, + quanta_sys_eeprom_t* rv); + +/** + * @brief Parse the given file in EEPROM format. + * @param file The eeprom file. + * @param rv Receives the eeprom information. + */ +int quanta_sys_eeprom_parse_file(const char* file, quanta_sys_eeprom_t* rv); + + +/** + * @brief Convert The sys-eeprom to the onie-eeprom format. + * @param src Source structure. + * @param dst Destination structure. + */ +int quanta_sys_eeprom_to_onie(const quanta_sys_eeprom_t* src, + onlp_onie_info_t* dst); + +/** + * @brief Show the contents of the given eeprom data; + * @param pvs The output pvs. + * @param e The eeprom structure. + */ + +int quanta_sys_eeprom_show(aim_pvs_t* pvs, quanta_sys_eeprom_t* e); + +#endif /* __QUANTA_SYS_EEPROM_EEPROM_H__ */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom.x b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom.x new file mode 100644 index 00000000..119e0e61 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom.x @@ -0,0 +1,14 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.xmacro(ALL).define> */ +/* */ + +/* <--auto.start.xenum(ALL).define> */ +/* */ + + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_config.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_config.h new file mode 100644 index 00000000..fa49f275 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_config.h @@ -0,0 +1,127 @@ +/**************************************************************************//** + * + * @file + * @brief quanta_sys_eeprom Configuration Header + * + * @addtogroup quanta_sys_eeprom-config + * @{ + * + *****************************************************************************/ +#ifndef __QUANTA_SYS_EEPROM_CONFIG_H__ +#define __QUANTA_SYS_EEPROM_CONFIG_H__ + +#ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG +#include +#endif +#ifdef QUANTA_SYS_EEPROM_INCLUDE_CUSTOM_CONFIG +#include +#endif + +/* */ +#include +/** + * QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING + * + * Include or exclude logging. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING +#define QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING 1 +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT + * + * Default enabled log options. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT +#define QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT + * + * Default enabled log bits. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT +#define QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * + * Default enabled custom log bits. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB + * + * Default all porting macros to use the C standard libraries. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB +#define QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB 1 +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * + * Include standard library headers for stdlib porting macros. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB +#endif + +/** + * QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI + * + * Include generic uCli support. */ + + +#ifndef QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI +#define QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI 0 +#endif + + + +/** + * All compile time options can be queried or displayed + */ + +/** Configuration settings structure. */ +typedef struct quanta_sys_eeprom_config_settings_s { + /** name */ + const char* name; + /** value */ + const char* value; +} quanta_sys_eeprom_config_settings_t; + +/** Configuration settings table. */ +/** quanta_sys_eeprom_config_settings table. */ +extern quanta_sys_eeprom_config_settings_t quanta_sys_eeprom_config_settings[]; + +/** + * @brief Lookup a configuration setting. + * @param setting The name of the configuration option to lookup. + */ +const char* quanta_sys_eeprom_config_lookup(const char* setting); + +/** + * @brief Show the compile-time configuration. + * @param pvs The output stream. + */ +int quanta_sys_eeprom_config_show(struct aim_pvs_s* pvs); + +/* */ + +#include "quanta_sys_eeprom_porting.h" + +#endif /* __QUANTA_SYS_EEPROM_CONFIG_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_dox.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_dox.h new file mode 100644 index 00000000..4b4a79e9 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_dox.h @@ -0,0 +1,26 @@ +/**************************************************************************//** + * + * quanta_sys_eeprom Doxygen Header + * + *****************************************************************************/ +#ifndef __QUANTA_SYS_EEPROM_DOX_H__ +#define __QUANTA_SYS_EEPROM_DOX_H__ + +/** + * @defgroup quanta_sys_eeprom quanta_sys_eeprom - quanta_sys_eeprom Description + * + +The documentation overview for this module should go here. + + * + * @{ + * + * @defgroup quanta_sys_eeprom-quanta_sys_eeprom Public Interface + * @defgroup quanta_sys_eeprom-config Compile Time Configuration + * @defgroup quanta_sys_eeprom-porting Porting Macros + * + * @} + * + */ + +#endif /* __QUANTA_SYS_EEPROM_DOX_H__ */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h new file mode 100644 index 00000000..e6ecb0f9 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h @@ -0,0 +1,107 @@ +/**************************************************************************//** + * + * @file + * @brief quanta_sys_eeprom Porting Macros. + * + * @addtogroup quanta_sys_eeprom-porting + * @{ + * + *****************************************************************************/ +#ifndef __QUANTA_SYS_EEPROM_PORTING_H__ +#define __QUANTA_SYS_EEPROM_PORTING_H__ + + +/* */ +#if QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef QUANTA_SYS_EEPROM_MALLOC + #if defined(GLOBAL_MALLOC) + #define QUANTA_SYS_EEPROM_MALLOC GLOBAL_MALLOC + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_MALLOC malloc + #else + #error The macro QUANTA_SYS_EEPROM_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_FREE + #if defined(GLOBAL_FREE) + #define QUANTA_SYS_EEPROM_FREE GLOBAL_FREE + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_FREE free + #else + #error The macro QUANTA_SYS_EEPROM_FREE is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_MEMSET + #if defined(GLOBAL_MEMSET) + #define QUANTA_SYS_EEPROM_MEMSET GLOBAL_MEMSET + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_MEMSET memset + #else + #error The macro QUANTA_SYS_EEPROM_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define QUANTA_SYS_EEPROM_MEMCPY GLOBAL_MEMCPY + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_MEMCPY memcpy + #else + #error The macro QUANTA_SYS_EEPROM_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_STRNCPY + #if defined(GLOBAL_STRNCPY) + #define QUANTA_SYS_EEPROM_STRNCPY GLOBAL_STRNCPY + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_STRNCPY strncpy + #else + #error The macro QUANTA_SYS_EEPROM_STRNCPY is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define QUANTA_SYS_EEPROM_VSNPRINTF GLOBAL_VSNPRINTF + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_VSNPRINTF vsnprintf + #else + #error The macro QUANTA_SYS_EEPROM_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define QUANTA_SYS_EEPROM_SNPRINTF GLOBAL_SNPRINTF + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_SNPRINTF snprintf + #else + #error The macro QUANTA_SYS_EEPROM_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef QUANTA_SYS_EEPROM_STRLEN + #if defined(GLOBAL_STRLEN) + #define QUANTA_SYS_EEPROM_STRLEN GLOBAL_STRLEN + #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 + #define QUANTA_SYS_EEPROM_STRLEN strlen + #else + #error The macro QUANTA_SYS_EEPROM_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __QUANTA_SYS_EEPROM_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/make.mk b/packages/platforms/quanta/src/quanta_sys_eeprom/module/make.mk new file mode 100644 index 00000000..3ea6888c --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/make.mk @@ -0,0 +1,10 @@ +############################################################################### +# +# +# +############################################################################### +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +quanta_sys_eeprom_INCLUDES := -I $(THIS_DIR)inc +quanta_sys_eeprom_INTERNAL_INCLUDES := -I $(THIS_DIR)src +quanta_sys_eeprom_DEPENDMODULE_ENTRIES := init:quanta_sys_eeprom ucli:quanta_sys_eeprom + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/Makefile b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/Makefile new file mode 100644 index 00000000..807674bf --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/Makefile @@ -0,0 +1,9 @@ +############################################################################### +# +# Local source generation targets. +# +############################################################################### + +ucli: + @../../../../tools/uclihandlers.py quanta_sys_eeprom_ucli.c + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/eeprom.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/eeprom.c new file mode 100644 index 00000000..d24f01dc --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/eeprom.c @@ -0,0 +1,160 @@ +/************************************************************ + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include +#include +#include "quanta_sys_eeprom_log.h" +#include + +int +quanta_sys_eeprom_parse_data(const uint8_t* data, int size, + quanta_sys_eeprom_t* rv) +{ + /* + * EEPROM Magic: 0xFF 0x01 0xE0 + */ + const uint8_t* p = data; + if(!rv || size < 3 || *p++ != 0xFF || *p++ != 0x01 || *p++ != 0xE0) { + return -1; + } + + memset(rv, 0, sizeof(*rv)); + + while(p < (data+size)) { + uint8_t code = *p++; + int clen = *p++; + if(clen < 1) { + break; + } + switch(code) + { +#define EEPROM_STRCPY(_field) strncpy(rv->_field, (char*)p, clen) +#define EEPROM_LONG(_field) rv->_field = (p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]) + + case 0x1: + /* Product Name */ + EEPROM_STRCPY(product_name); + break; + case 0x2: + /* Part Number */ + EEPROM_STRCPY(part_number); + break; + case 0x3: + /* Serial Number */ + EEPROM_STRCPY(serial_number); + break; + case 0x4: + /* MAC */ + memcpy(rv->mac_address, p, 6); + break; + + case 0x5: + /* Manufacture Date */ + { + struct tm time_tm; + time_t time_time; + memset(&time_tm, 0, sizeof(time_tm)); + + time_tm.tm_year = (p[0] << 8 | p[1]) - 1900; + time_tm.tm_mon = p[2] - 1; + time_tm.tm_mday = p[3]; + time_time = mktime(&time_tm); + struct tm* gtm = gmtime(&time_time); + strftime(rv->manufacture_date, + sizeof(rv->manufacture_date), + "%m/%d/%Y %H:%M:%S", + gtm); + break; + } + + case 0x6: + /* Card Type */ + EEPROM_LONG(card_type); + break; + case 0x7: + /* Hardware Version */ + EEPROM_LONG(hardware_version); + break; + case 0x8: + /* Label Version */ + EEPROM_STRCPY(label_version); + break; + case 0x9: + /* Model Name */ + EEPROM_STRCPY(model_name); + break; + case 0xA: + /* Software Version */ + EEPROM_LONG(software_version); + break; + + case 0x00: + /* CRC */ + rv->crc = p[0] << 8 | p[1]; + return 0; + } + p+=clen; + } + return 0; +} + +int +quanta_sys_eeprom_parse_file(const char* file, quanta_sys_eeprom_t* e) +{ + int rv; + uint8_t data[256]; + int len; + + rv = onlp_file_read(data, sizeof(data), &len, (char*)file); + if(rv >= 0) { + rv = quanta_sys_eeprom_parse_data(data, sizeof(data), e); + } + return rv; +} + + +int +quanta_sys_eeprom_to_onie(const quanta_sys_eeprom_t* src, + onlp_onie_info_t* dst) +{ + if(src == NULL || dst == NULL) { + return -1; + } + + memset(dst, 0, sizeof(*dst)); + list_init(&dst->vx_list); + dst->product_name = aim_strdup(src->product_name); + dst->part_number = aim_strdup(src->part_number); + dst->serial_number = aim_strdup(src->serial_number); + memcpy(dst->mac, src->mac_address, 6); + dst->manufacture_date = aim_strdup(src->manufacture_date); + dst->label_revision = aim_strdup(src->label_version); + dst->mac_range = 1; + dst->manufacturer = aim_strdup("Quanta"); + dst->vendor = aim_strdup("QuantaMesh"); + return 0; +} + +int +quanta_sys_eeprom_show(aim_pvs_t* pvs, quanta_sys_eeprom_t* e) +{ + aim_printf(pvs, "Product Name: %s\n", e->product_name); + aim_printf(pvs, "Model Name: %s\n", e->model_name); + aim_printf(pvs, "Part Number: %s\n", e->part_number); + aim_printf(pvs, "Serial Number: %s\n", e->serial_number); + aim_printf(pvs, "Manufacture Date: %s\n", e->manufacture_date); + aim_printf(pvs, "Label Version: %s\n", e->label_version); + aim_printf(pvs, "MAC: %{mac}\n", e->mac_address); + aim_printf(pvs, "Hardware Version: 0x%x (%d)\n", e->hardware_version, e->hardware_version); + aim_printf(pvs, "Software Version: 0x%x (%d)\n", e->software_version, e->software_version); + aim_printf(pvs, "Card Type: 0x%x (%d)\n", e->card_type, e->card_type); + aim_printf(pvs, "CRC: 0x%.2x\n", e->crc); + return 0; +} + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/make.mk b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/make.mk new file mode 100644 index 00000000..25432f2a --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/make.mk @@ -0,0 +1,9 @@ +############################################################################### +# +# +# +############################################################################### + +LIBRARY := quanta_sys_eeprom +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/lib.mk diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_config.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_config.c new file mode 100644 index 00000000..388154f9 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_config.c @@ -0,0 +1,76 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* */ +#define __quanta_sys_eeprom_config_STRINGIFY_NAME(_x) #_x +#define __quanta_sys_eeprom_config_STRINGIFY_VALUE(_x) __quanta_sys_eeprom_config_STRINGIFY_NAME(_x) +quanta_sys_eeprom_config_settings_t quanta_sys_eeprom_config_settings[] = +{ +#ifdef QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_INCLUDE_LOGGING(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI + { __quanta_sys_eeprom_config_STRINGIFY_NAME(QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI), __quanta_sys_eeprom_config_STRINGIFY_VALUE(QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI) }, +#else +{ QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI(__quanta_sys_eeprom_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __quanta_sys_eeprom_config_STRINGIFY_VALUE +#undef __quanta_sys_eeprom_config_STRINGIFY_NAME + +const char* +quanta_sys_eeprom_config_lookup(const char* setting) +{ + int i; + for(i = 0; quanta_sys_eeprom_config_settings[i].name; i++) { + if(strcmp(quanta_sys_eeprom_config_settings[i].name, setting)) { + return quanta_sys_eeprom_config_settings[i].value; + } + } + return NULL; +} + +int +quanta_sys_eeprom_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; quanta_sys_eeprom_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", quanta_sys_eeprom_config_settings[i].name, quanta_sys_eeprom_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_enums.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_enums.c new file mode 100644 index 00000000..c020dfb0 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_enums.c @@ -0,0 +1,10 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +/* <--auto.start.enum(ALL).source> */ +/* */ + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_int.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_int.h new file mode 100644 index 00000000..698446ce --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_int.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * quanta_sys_eeprom Internal Header + * + *****************************************************************************/ +#ifndef __QUANTA_SYS_EEPROM_INT_H__ +#define __QUANTA_SYS_EEPROM_INT_H__ + +#include + + +#endif /* __QUANTA_SYS_EEPROM_INT_H__ */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.c new file mode 100644 index 00000000..c1a3854a --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.c @@ -0,0 +1,18 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "quanta_sys_eeprom_log.h" +/* + * quanta_sys_eeprom log struct. + */ +AIM_LOG_STRUCT_DEFINE( + QUANTA_SYS_EEPROM_CONFIG_LOG_OPTIONS_DEFAULT, + QUANTA_SYS_EEPROM_CONFIG_LOG_BITS_DEFAULT, + NULL, /* Custom log map */ + QUANTA_SYS_EEPROM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ); + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.h b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.h new file mode 100644 index 00000000..0952006a --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_log.h @@ -0,0 +1,12 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#ifndef __QUANTA_SYS_EEPROM_LOG_H__ +#define __QUANTA_SYS_EEPROM_LOG_H__ + +#define AIM_LOG_MODULE_NAME quanta_sys_eeprom +#include + +#endif /* __QUANTA_SYS_EEPROM_LOG_H__ */ diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_module.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_module.c new file mode 100644 index 00000000..4c296e37 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_module.c @@ -0,0 +1,23 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#include "quanta_sys_eeprom_log.h" + +static int +datatypes_init__(void) +{ +#define QUANTA_SYS_EEPROM_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#include + return 0; +} + +void __quanta_sys_eeprom_module_init__(void) +{ + AIM_LOG_STRUCT_REGISTER(); + datatypes_init__(); +} + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_ucli.c b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_ucli.c new file mode 100644 index 00000000..221bf196 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/module/src/quanta_sys_eeprom_ucli.c @@ -0,0 +1,50 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include + +#if QUANTA_SYS_EEPROM_CONFIG_INCLUDE_UCLI == 1 + +#include +#include +#include + +static ucli_status_t +quanta_sys_eeprom_ucli_ucli__config__(ucli_context_t* uc) +{ + UCLI_HANDLER_MACRO_MODULE_CONFIG(quanta_sys_eeprom) +} + +/* */ +/* */ + +static ucli_module_t +quanta_sys_eeprom_ucli_module__ = + { + "quanta_sys_eeprom_ucli", + NULL, + quanta_sys_eeprom_ucli_ucli_handlers__, + NULL, + NULL, + }; + +ucli_node_t* +quanta_sys_eeprom_ucli_node_create(void) +{ + ucli_node_t* n; + ucli_module_init(&quanta_sys_eeprom_ucli_module__); + n = ucli_node_create("quanta_sys_eeprom", NULL, &quanta_sys_eeprom_ucli_module__); + ucli_node_subnode_add(n, ucli_module_log_node_create("quanta_sys_eeprom")); + return n; +} + +#else +void* +quanta_sys_eeprom_ucli_node_create(void) +{ + return NULL; +} +#endif + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.doxy b/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.doxy new file mode 100644 index 00000000..0e916828 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.doxy @@ -0,0 +1,1792 @@ +# Doxyfile 1.8.1.2 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" "). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or sequence of words) that should +# identify the project. Note that if you do not use Doxywizard you need +# to put quotes around the project name if it contains spaces. + +PROJECT_NAME = "quanta_sys_eeprom" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer +# a quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Quanta System EEPROM decoder." + +# With the PROJECT_LOGO tag one can specify an logo or icon that is +# included in the documentation. The maximum height of the logo should not +# exceed 55 pixels and the maximum width should not exceed 200 pixels. +# Doxygen will copy the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful if your file system +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding +# "class=itcl::class" will allow you to use the command class in the +# itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this +# tag. The format is ext=language, where ext is a file extension, and language +# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, +# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions +# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all +# comments according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you +# can mix doxygen, HTML, and XML commands with Markdown formatting. +# Disable only in case of backward compatibilities issues. + +MARKDOWN_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also makes the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and +# unions are shown inside the group in which they are included (e.g. using +# @ingroup) instead of on a separate page (for HTML and Man pages) or +# section (for LaTeX and RTF). + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and +# unions with only public data fields will be shown inline in the documentation +# of the scope in which they are defined (i.e. file, namespace, or group +# documentation), provided this scope is documented. If set to NO (the default), +# structs, classes, and unions are shown on a separate page (for HTML and Man +# pages) or section (for LaTeX and RTF). + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penalty. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will roughly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +SYMBOL_CACHE_SIZE = 0 + +# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be +# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given +# their name and scope. Since this can be an expensive process and often the +# same symbol appear multiple times in the code, doxygen keeps a cache of +# pre-resolved symbols. If the cache is too small doxygen will become slower. +# If the cache is too large, memory is wasted. The cache size is given by this +# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespaces are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen +# will sort the (brief and detailed) documentation of class members so that +# constructors and destructors are listed first. If set to NO (the default) +# the constructors will appear in the respective orders defined by +# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. +# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO +# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to +# do proper type resolution of all parameters of a function it will reject a +# match between the prototype and the implementation of a member function even +# if there is only one candidate or it is obvious which candidate to choose +# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen +# will still accept a match between prototype and implementation in such cases. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or macro consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and macros in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. +# You can optionally specify a file name after the option, if omitted +# DoxygenLayout.xml will be used as the name of the layout file. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files +# containing the references data. This must be a list of .bib files. The +# .bib extension is automatically appended if omitted. Using this command +# requires the bibtex tool to be installed. See also +# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style +# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this +# feature you need bibtex and perl available in the search path. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_NO_PARAMDOC option can be enabled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = module/inc + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh +# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py +# *.f90 *.f *.for *.vhd *.vhdl + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty or if +# non of the patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) +# and it is also possible to disable source filtering for a specific pattern +# using *.ext= (so without naming a filter). This option only has effect when +# FILTER_SOURCE_FILES is enabled. + +FILTER_SOURCE_PATTERNS = + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C, C++ and Fortran comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. +# Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. Note that when using a custom header you are responsible +# for the proper inclusion of any scripts and style sheets that doxygen +# needs, which is dependent on the configuration options used. +# It is advised to generate a default header using "doxygen -w html +# header.html footer.html stylesheet.css YourConfigFile" and then modify +# that header. Note that the header is subject to change so you typically +# have to redo this when upgrading to a newer version of doxygen or when +# changing the value of configuration settings such as GENERATE_TREEVIEW! + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# style sheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that +# the files will be copied as-is; there are no commands or markers available. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. +# Doxygen will adjust the colors in the style sheet and background images +# according to this color. Hue is specified as an angle on a colorwheel, +# see http://en.wikipedia.org/wiki/Hue for more information. +# For instance the value 0 represents red, 60 is yellow, 120 is green, +# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. +# The allowed range is 0 to 359. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of +# the colors in the HTML output. For a value of 0 the output will use +# grayscales only. A value of 255 will produce the most vivid colors. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to +# the luminance component of the colors in the HTML output. Values below +# 100 gradually make the output lighter, whereas values above 100 make +# the output darker. The value divided by 100 is the actual gamma applied, +# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, +# and 100 does not change the gamma. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of +# entries shown in the various tree structured indices initially; the user +# can expand and collapse entries dynamically later on. Doxygen will expand +# the tree to such a level that at most the specified number of entries are +# visible (unless a fully collapsed tree already exceeds this amount). +# So setting the number of entries 1 will produce a full collapsed tree by +# default. 0 is a special value representing an infinite number of entries +# and will result in a full expanded tree by default. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated +# that can be used as input for Qt's qhelpgenerator to generate a +# Qt Compressed Help (.qch) of the generated HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to +# add. For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see +# +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's +# filter section matches. +# +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files +# will be generated, which together with the HTML files, form an Eclipse help +# plugin. To install this plugin and make it available under the help contents +# menu in Eclipse, the contents of the directory containing the HTML and XML +# files needs to be copied into the plugins directory of eclipse. The name of +# the directory within the plugins directory should be the same as +# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before +# the help appears. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have +# this name. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) +# at top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. Since the tabs have the same information as the +# navigation tree you can set this option to NO if you already set +# GENERATE_TREEVIEW to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. +# Since the tree basically has the same information as the tab index you +# could consider to set DISABLE_INDEX to NO when enabling this option. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values +# (range [0,1..20]) that doxygen will group on one line in the generated HTML +# documentation. Note that a value of 0 will completely suppress the enum +# values from appearing in the overview section. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open +# links to external symbols imported via tag files in a separate window. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are +# not supported properly for IE 6.0, but are supported on all modern browsers. +# Note that when changing this option you need to delete any form_*.png files +# in the HTML output before the changes have effect. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax +# (see http://www.mathjax.org) which uses client side Javascript for the +# rendering instead of using prerendered bitmaps. Use this if you do not +# have LaTeX installed or if you want to formulas look prettier in the HTML +# output. When enabled you may also need to install MathJax separately and +# configure the path to it using the MATHJAX_RELPATH option. + +USE_MATHJAX = NO + +# When MathJax is enabled you need to specify the location relative to the +# HTML output directory using the MATHJAX_RELPATH option. The destination +# directory should contain the MathJax.js script. For instance, if the mathjax +# directory is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to +# the MathJax Content Delivery Network so you can quickly see the result without +# installing MathJax. +# However, it is strongly recommended to install a local +# copy of MathJax from http://www.mathjax.org before deployment. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension +# names that should be enabled during MathJax rendering. + +MATHJAX_EXTENSIONS = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box +# for the HTML output. The underlying search engine uses javascript +# and DHTML and should work on any modern browser. Note that when using +# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets +# (GENERATE_DOCSET) there is already a search function so this one should +# typically be disabled. For large projects the javascript based search engine +# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. + +SEARCHENGINE = YES + +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be +# implemented using a PHP enabled web server instead of at the web client +# using Javascript. Doxygen will generate the search PHP script and index +# file to put on the web server. The advantage of the server +# based approach is that it scales better to large projects and allows +# full text search. The disadvantages are that it is more difficult to setup +# and does not have live searching capabilities. + +SERVER_BASED_SEARCH = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. +# Note that when enabling USE_PDFLATEX this option is only used for +# generating bitmaps for formulas in the HTML output, but not in the +# Makefile that is written to the output directory. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4 + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for +# the generated latex document. The footer should contain everything after +# the last chapter. If it is left blank doxygen will generate a +# standard footer. Notice: only use this tag if you know what you are doing! + +LATEX_FOOTER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +# If LATEX_SOURCE_CODE is set to YES then doxygen will include +# source code with syntax highlighting in the LaTeX output. +# Note that which sources are shown also depends on other settings +# such as SOURCE_BROWSER. + +LATEX_SOURCE_CODE = NO + +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the +# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See +# http://en.wikipedia.org/wiki/BibTeX for more info. + +LATEX_BIB_STYLE = plain + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load style sheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. +# This is useful +# if you want to understand what is going on. +# On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# pointed to by INCLUDE_PATH will be searched when a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition that +# overrules the definition found in the source code. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all references to function-like macros +# that are alone on a line, have an all uppercase name, and do not end with a +# semicolon, because these will confuse the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. For each +# tag file the location of the external documentation should be added. The +# format of a tag file without this location is as follows: +# +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths +# or URLs. Note that each tag file must have a unique name (where the name does +# NOT include the path). If a tag file is not located in the directory in which +# doxygen is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option also works with HAVE_DOT disabled, but it is recommended to +# install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is +# allowed to run in parallel. When set to 0 (the default) doxygen will +# base this on the number of processors available in the system. You can set it +# explicitly to a value larger than 0 to get control over the balance +# between CPU load and processing speed. + +DOT_NUM_THREADS = 0 + +# By default doxygen will use the Helvetica font for all dot files that +# doxygen generates. When you want a differently looking font you can specify +# the font name using DOT_FONTNAME. You need to make sure dot is able to find +# the font, which can be done by putting it in a standard location or by setting +# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. + +DOT_FONTNAME = Helvetica + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the Helvetica font. +# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to +# set the path where dot can find it. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If the UML_LOOK tag is enabled, the fields and methods are shown inside +# the class node. If there are many fields or methods and many nodes the +# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS +# threshold limits the number of items for each type to make the size more +# managable. Set this to 0 for no limit. Note that the threshold may be +# exceeded by 50 percent before the limit is enforced. + +UML_LIMIT_NUM_FIELDS = 10 + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will generate a graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are svg, png, jpg, or gif. +# If left blank png will be used. If you choose svg you need to set +# HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible in IE 9+ (other browsers do not have this requirement). + +DOT_IMAGE_FORMAT = png + +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to +# enable generation of interactive SVG images that allow zooming and panning. +# Note that this requires a modern browser other than Internet Explorer. +# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you +# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files +# visible. Older versions of IE do not have SVG support. + +INTERACTIVE_SVG = NO + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MSCFILE_DIRS tag can be used to specify one or more directories that +# contain msc files that are included in the documentation (see the +# \mscfile command). + +MSCFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = YES + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.mk b/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.mk new file mode 100644 index 00000000..0f74073f --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/quanta_sys_eeprom.mk @@ -0,0 +1,14 @@ + +############################################################################### +# +# Inclusive Makefile for the quanta_sys_eeprom module. +# +# Autogenerated 2014-08-03 09:25:20.039252 +# +############################################################################### +quanta_sys_eeprom_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(quanta_sys_eeprom_BASEDIR)/module/make.mk +include $(quanta_sys_eeprom_BASEDIR)/module/auto/make.mk +include $(quanta_sys_eeprom_BASEDIR)/module/src/make.mk +include $(quanta_sys_eeprom_BASEDIR)/utest/_make.mk + diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/utest/_make.mk b/packages/platforms/quanta/src/quanta_sys_eeprom/utest/_make.mk new file mode 100644 index 00000000..68d24b79 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/utest/_make.mk @@ -0,0 +1,8 @@ +############################################################################### +# +# quanta_sys_eeprom Unit Test Makefile. +# +############################################################################### +UMODULE := quanta_sys_eeprom +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/platforms/quanta/src/quanta_sys_eeprom/utest/main.c b/packages/platforms/quanta/src/quanta_sys_eeprom/utest/main.c new file mode 100644 index 00000000..88eeba92 --- /dev/null +++ b/packages/platforms/quanta/src/quanta_sys_eeprom/utest/main.c @@ -0,0 +1,155 @@ +/**************************************************************************//** + * + * + * + *****************************************************************************/ +#include +#include + +#include +#include +#include +#include + + +struct eeprom_data_s { + uint8_t eeprom[256]; + quanta_sys_eeprom_t data; +} test_data__[] = + { + { + { + 0xff, 0x01, 0xe0, 0x01, 0x03, 0x4c, 0x59, 0x32, 0x02, 0x0b, 0x31, + 0x4c, 0x59, 0x32, 0x42, 0x5a, 0x5a, 0x30, 0x30, 0x30, 0x52, 0x03, + 0x0d, 0x51, 0x54, 0x46, 0x43, 0x45, 0x41, 0x33, 0x32, 0x31, 0x30, + 0x30, 0x32, 0x31, 0x04, 0x06, 0x08, 0x9e, 0x01, 0xce, 0xde, 0x75, + 0x05, 0x04, 0x07, 0xdd, 0x05, 0x0a, 0x06, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x07, 0x04, 0x00, 0x03, 0x00, 0x00, 0x08, 0x01, 0x31, 0x09, + 0x0a, 0x51, 0x55, 0x41, 0x4e, 0x54, 0x41, 0x20, 0x4c, 0x59, 0x32, + 0x0a, 0x04, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x02, 0xfb, 0x67, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + "LY2", + "QUANTA LY2", + "1LY2BZZ000R", + "QTFCEA3210021", + "05/10/2013 08:00:00", + "1", + {0x08, 0x9e, 0x01, 0xce, 0xde, 0x75}, + 0x30000, + 0xf201, + 0x1, + 0xfb67, + }, + }, + { + { + 0xff, 0x01, 0xe0, 0x01, 0x03, 0x4c, 0x59, 0x32, 0x02, 0x0b, + 0x31, 0x4c, 0x59, 0x32, 0x42, 0x5a, 0x5a, 0x30, 0x30, 0x30, + 0x38, 0x03, 0x0d, 0x51, 0x54, 0x46, 0x43, 0x45, 0x41, 0x32, + 0x34, 0x32, 0x30, 0x30, 0x32, 0x32, 0x04, 0x06, 0x08, 0x9e, + 0x01, 0x53, 0x78, 0xa6, 0x05, 0x04, 0x07, 0xdc, 0x0a, 0x0f, + 0x06, 0x04, 0x00, 0x00, 0x00, 0x01, 0x07, 0x04, 0x00, 0x03, + 0x00, 0x00, 0x08, 0x01, 0x31, 0x09, 0x0a, 0x51, 0x55, 0x41, + 0x4e, 0x54, 0x41, 0x20, 0x4c, 0x59, 0x32, 0x0a, 0x04, 0x00, + 0x00, 0xf2, 0x01, 0x00, 0x02, 0xc0, 0x74, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + "LY2", + "QUANTA LY2", + "1LY2BZZ0008", + "QTFCEA2420022", + "10/15/2012 08:00:00", + "1", + {0x08, 0x9e, 0x01, 0x53, 0x78, 0xa6}, + 0x30000, + 0xf201, + 0x1, + 0xc074, + }, + }, + { + { + 0xff, 0x01, 0xe0, 0x01, 0x03, 0x4c, 0x42, 0x39, 0x02, 0x0b, + 0x31, 0x4c, 0x42, 0x39, 0x42, 0x5a, 0x5a, 0x30, 0x53, 0x54, + 0x51, 0x03, 0x0d, 0x51, 0x54, 0x46, 0x43, 0x41, 0x36, 0x33, + 0x32, 0x38, 0x30, 0x30, 0x30, 0x31, 0x04, 0x06, 0x08, 0x9e, + 0x01, 0xce, 0xbd, 0x2d, 0x05, 0x04, 0x07, 0xdd, 0x07, 0x05, + 0x06, 0x04, 0x00, 0x00, 0x00, 0x01, 0x07, 0x04, 0x01, 0x00, + 0x00, 0x00, 0x08, 0x01, 0x31, 0x09, 0x0a, 0x51, 0x55, 0x41, + 0x4e, 0x54, 0x41, 0x20, 0x4c, 0x42, 0x39, 0x0a, 0x04, 0x00, + 0x00, 0xb9, 0x01, 0x00, 0x02, 0x56, 0xc0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + "LB9", + "QUANTA LB9", + "1LB9BZZ0STQ", + "QTFCA63280001", + "07/05/2013 08:00:00", + "1", + {0x08,0x9e,0x01,0xce,0xbd,0x2d}, + 0x1000000, + 0xb901, + 0x1, + 0x56c0, + }, + }, + { + { + 0xff, 0x01, 0xe0, 0x01, 0x03, 0x4c, 0x42, 0x39, 0x02, 0x0b, + 0x31, 0x4c, 0x42, 0x39, 0x42, 0x5a, 0x5a, 0x30, 0x53, 0x54, + 0x45, 0x03, 0x0d, 0x51, 0x54, 0x46, 0x43, 0x58, 0x49, 0x32, + 0x34, 0x36, 0x30, 0x32, 0x30, 0x33, 0x04, 0x06, 0x04, 0x7d, + 0x7b, 0xfc, 0xa7, 0x43, 0x05, 0x04, 0x07, 0xdc, 0x08, 0x05, + 0x06, 0x04, 0x00, 0x00, 0x00, 0x01, 0x07, 0x04, 0x01, 0x00, + 0x00, 0x00, 0x08, 0x01, 0x31, 0x09, 0x0a, 0x51, 0x55, 0x41, + 0x4e, 0x54, 0x41, 0x20, 0x4c, 0x42, 0x39, 0x0a, 0x04, 0x00, + 0x00, 0xb9, 0x01, 0x00, 0x02, 0x41, 0x53, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + { + "LB9", + "QUANTA LB9", + "1LB9BZZ0STE", + "QTFCXI2460203", + "08/05/2012 08:00:00", + "1", + {0x04,0x7d,0x7b,0x0fc,0xa7,0x43}, + 0x1000000, + 0xb901, + 0x1, + 0x4153, + }, + }, + }; + + +int aim_main(int argc, char* argv[]) +{ + int i; + quanta_sys_eeprom_t e; + + + for(i = 0; i < AIM_ARRAYSIZE(test_data__); i++) { + if(quanta_sys_eeprom_parse_data(test_data__[i].eeprom, + sizeof(test_data__[i].eeprom), + &e) < 0) { + AIM_DIE("parse entry %d failed."); + } + if(memcmp(&e, &test_data__[i].data, sizeof(e))) { + printf("Mismatch entry %d\n", i); + printf("Expected: \n"); + quanta_sys_eeprom_show(&aim_pvs_stdout, &test_data__[i].data); + printf("\nGot: \n"); + quanta_sys_eeprom_show(&aim_pvs_stdout, &e); + AIM_DIE("Entry %d failed", i); + } + } + return 0; +} + diff --git a/packages/platforms/quanta/vendor-config/Makefile b/packages/platforms/quanta/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/quanta/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/quanta/vendor-config/PKG.yml b/packages/platforms/quanta/vendor-config/PKG.yml new file mode 100644 index 00000000..1427c55c --- /dev/null +++ b/packages/platforms/quanta/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=quanta Vendor=Quanta diff --git a/packages/platforms/quanta/vendor-config/src/python/quanta/__init__.py b/packages/platforms/quanta/vendor-config/src/python/quanta/__init__.py new file mode 100644 index 00000000..8d5adc04 --- /dev/null +++ b/packages/platforms/quanta/vendor-config/src/python/quanta/__init__.py @@ -0,0 +1,23 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for Quanta platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformQuanta(OnlPlatformBase): + + def manufacturer(self): + return "Quanta" + + def sys_oid_vendor(self): + return ".7244" diff --git a/packages/platforms/wnc/Makefile b/packages/platforms/wnc/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/wnc/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/wnc/vendor-config/Makefile b/packages/platforms/wnc/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/wnc/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/wnc/vendor-config/PKG.yml b/packages/platforms/wnc/vendor-config/PKG.yml new file mode 100644 index 00000000..21d8efac --- /dev/null +++ b/packages/platforms/wnc/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=wnc Vendor=WNC diff --git a/packages/platforms/wnc/vendor-config/src/python/wnc/__init__.py b/packages/platforms/wnc/vendor-config/src/python/wnc/__init__.py new file mode 100644 index 00000000..2002920a --- /dev/null +++ b/packages/platforms/wnc/vendor-config/src/python/wnc/__init__.py @@ -0,0 +1,22 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# OnlPlatform support for WNC platforms. +# +############################################################ +from onl.platform.base import * + +class OnlPlatformWNC(OnlPlatformBase): + def manufacturer(self): + return "WNC" + + def sys_oid_vendor(self): + return ".15756" diff --git a/setup.env b/setup.env new file mode 100755 index 00000000..d07696ef --- /dev/null +++ b/setup.env @@ -0,0 +1,33 @@ +#!/bin/bash +############################################################ +# +# The settings in this script are required +# and should be sourced into you local build shell. +# +############################################################ + +# The root of the ONL build tree is here +export ONL=$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd) + +# The ONL package dir is here: +export ONLPM_OPTION_PACKAGEDIRS="$ONL/packages" + +# The ONL repo dir is here: +export ONLPM_OPTION_REPO="$ONL/REPO" + +# The ONL build tools should be included in the local path: +export PATH="$ONL/tools/scripts:$ONL/tools:$PATH" + +# Parallel Make Jobs +# Default parallel build settings +export MAKEFLAGS="-j64" + +# These submodules are required for almost everything. +$ONL/tools/submodules.py $ONL sm/infra +$ONL/tools/submodules.py $ONL sm/bigcode + +# Version files +$ONL/tools/make-versions.py --import-file=$ONL/tools/onlvi --class-name=OnlVersionImplementation --output-dir $ONL/make + + + diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 00000000..c00df136 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +*.deb diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 00000000..f93f06cd --- /dev/null +++ b/tools/Makefile @@ -0,0 +1 @@ +include $(shell onl.pkg.mk.sh) \ No newline at end of file diff --git a/tools/cpiomod.py b/tools/cpiomod.py new file mode 100755 index 00000000..26ccef6a --- /dev/null +++ b/tools/cpiomod.py @@ -0,0 +1,74 @@ +#!/usr/bin/python +import sys +import os +import argparse +import subprocess +import shutil +import tempfile + +ap = argparse.ArgumentParser(description="CPIO Modify Tool.") + +ap.add_argument("--cpio", help="Input cpio gzip", required=True) +ap.add_argument("--add-directory", nargs='+', help="Add the given directory to the root of the cpio.", default=[]) +ap.add_argument("--makedevs", nargs='+', help="Run makedevs", default=[]) +ap.add_argument("--ls", action='store_true', help="List files in CPIO and exit.") +ap.add_argument("--out", help="New CPIO") + +ops = ap.parse_args() + +# +# This is all pretty hacky right now +# + +class CpioManager(object): + def __init__(self): + pass + + def __denit__(self): + self.close(None) + + def open(self, cpio): + self.dir = tempfile.mkdtemp() + if os.system("cd %s && gzip -dc %s | sudo cpio -id" % ( + self.dir, os.path.abspath(cpio))) != 0: + raise Exception("Could not unpack cpio %s" % cpio) + + def add_directory(self, directory): + if not os.path.isdir(directory): + raise Exception("Directory %s does not exist" % directory) + + if os.system("tar -c --exclude '.*~' -C %s . | sudo tar -x -C %s" % (directory, self.dir)) != 0: + raise Exception("Could not add directory %s" % directory) + + def makedevs(self, devfile): + if os.system("sudo %s -d %s %s" % (os.path.join(os.getenv('SWITCHLIGHT'), "tools", "makedevs"), os.path.abspath(devfile), self.dir)) != 0: + raise Exception("Could not run makedevs") + + def close(self, ncpio): + if ncpio: + os.system("cd %s && find . | sudo cpio -H newc -o | gzip -f > %s" % (self.dir, os.path.abspath(ncpio))) + os.system("sudo rm -rf %s" % (self.dir)) + self.dir = None + + def list(self): + os.system("cd %s && find . -exec ls -l {} \; " % (self.dir)) + +cm = CpioManager() +cm.open(ops.cpio) + +if ops.ls: + cm.list() + sys.exit(0) + +for d in ops.add_directory: + cm.add_directory(d) + +for md in ops.makedevs: + cm.makedevs(md) + +cm.close(ops.out) + + + + + diff --git a/tools/filenamer.py b/tools/filenamer.py new file mode 100755 index 00000000..f8fff0f3 --- /dev/null +++ b/tools/filenamer.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +############################################################ +# +# This script provides the file naming scheme for +# various build products (Switch Images, Installers, etc) +# +import argparse +import json + +ap=argparse.ArgumentParser(description="ONL File Namer") +ap.add_argument("--type", help="File Type.", choices = [ 'swi', 'installer' ], required=True) +ap.add_argument("--manifest", help="File manifest.", required=True) +ap.add_argument("file", help="File.") +ops = ap.parse_args() + +manifest = json.load(open(ops.manifest)) +versions = manifest['version'] +versions['UARCH'] = manifest['arch'].upper() + +if ops.type == 'swi': + print "%(FNAME_PRODUCT_VERSION)s_ONL-OS_%(FNAME_BUILD_ID)s_%(UARCH)s.swi" % versions +elif ops.type == 'installer': + print "%(FNAME_PRODUCT_VERSION)s_ONL-OS_%(FNAME_BUILD_ID)s_%(UARCH)s_SWI-INSTALLER" % versions +else: + raise ValueError("Unknown type '%s'" % ops.type) + + + + + + + diff --git a/tools/flat-image-tree.py b/tools/flat-image-tree.py new file mode 100755 index 00000000..58d02038 --- /dev/null +++ b/tools/flat-image-tree.py @@ -0,0 +1,319 @@ +#!/usr/bin/python +############################################################ +# +# Flat Image Tree Generator +# +############################################################ +import subprocess +import yaml +import tempfile +import json + +class Image(object): + """Base ITS Image Class""" + + def __init__(self, type_, data, compression='none'): + + self.type = type_ + self.compression = compression + self.load = None + self.entry = None + self.os = None + + if ',' in data: + # Shorthand for tuple specifier + data = tuple([ x.strip() for x in data.split(',') ]) + + if(isinstance(data, tuple)): + # + # The data specifies an ONLPM (package,file) pair. + # + self.data = subprocess.check_output("onlpm --quiet --find-file %s %s" % data, shell=True).strip() + else: + self.data = data + + self.name = os.path.basename(self.data) + self.description = self.name + + + def wl(self, line, indent=" "): + self.handle.write("%s%s\n" % (indent, line)) + + def start_image(self, f): + self.handle = f + self.wl("""%s {""" % self.name) + self.wl(""" description = "%s";""" % self.description) + self.wl(""" type = "%s";""" % self.type) + self.wl(""" data = /incbin/("%s");""" % self.data) + self.wl(""" arch = "powerpc";""") + self.wl(""" compression = "%s";""" % self.compression) + if self.os: + self.wl(""" os = %s;""" % self.os) + if self.load: + self.wl(""" load = %s;""" % self.load) + if self.entry: + self.wl(""" entry = %s;""" % self.entry) + + def include_hashes(self,f): + self.wl(""" hash@1 {""") + self.wl(""" algo = "md5";""") + self.wl(""" };""") + self.wl(""" hash@2 {""") + self.wl(""" algo = "sha1";""") + self.wl(""" };""") + + def end_image(self, f): + self.wl("""};""") + + +class KernelImage(Image): + """Kernel image entry""" + + def __init__(self, fname): + Image.__init__(self, "kernel", fname, compression='gzip') + self.load = "<0x0>" + self.entry = "<0x0>" + self.os = '"linux"' + + def write(self, f): + self.start_image(f) + self.include_hashes(f) + self.end_image(f) + +class InitrdImage(Image): + """Initrd image entry""" + + def __init__(self, fname): + Image.__init__(self, "ramdisk", fname, compression='gzip') + self.load = "<0x1000000>" + self.entry ="<0x1000000>" + self.os = '"linux"' + + def write(self, f): + self.start_image(f) + self.include_hashes(f) + self.end_image(f) + +class DtbImage(Image): + """DTB Image Entry""" + + def __init__(self, fname): + Image.__init__(self, "flat_dt", fname, compression="none") + + def write(self, f): + self.start_image(f) + self.end_image(f) + + +class FlatImageTree(object): + """Generates a FIT .its file""" + + def __init__(self, description): + self.kernels = [] + self.dtbs = [] + self.initrds = [] + self.description = description + self.configurations = {} + + def add_initrd(self, initrd): + self.initrds.append(initrd) + + def add_kernel(self, kernel): + self.kernels.append(kernel) + + def add_dtb(self, dtb): + self.dtbs.append(dtb) + + def add_config(self, name, kernel, dtb, initrd=None): + if name in self.configurations: + raise KeyError("Configuration '%s' already exists." % name) + + self.add_kernel(kernel) + self.add_dtb(dtb) + if initrd: + self.add_initrd(initrd) + else: + # Use the first initrd as the default. + if len(self.initrds) == 0: + raise ValueError("No default initrd available while adding configuration '%s'" % name) + else: + initrd = self.initrds[0] + + self.configurations[name] = (kernel, dtb, initrd) + + def add_dict(self, name, d): + if name in d: + d = d[name] + + if 'flat_image_tree' in d: + d = d['flat_image_tree'] + + kernel = d.get('kernel', None) + if kernel is None: + raise KeyError("Configuration for %s does not contain a kernel key." % name) + + dtb = d.get('dtb', None) + if dtb is None: + raise KeyError("Configuration for %s does not contain a dtb key." % name) + + initrd = d.get('initrd', None) + + self.add_config(name, kernel, dtb, initrd) + + + def add_yaml(self, name, fname): + d = yaml.load(open(fname)) + self.add_dict(name, d) + + def add_platform_package(self, package): + print package + platform = package.replace(":powerpc", "").replace("onl-platform-config-", "") + y = subprocess.check_output("onlpm --quiet --find-file %s %s.yml" % (package, platform), shell=True).strip() + self.add_yaml(platform, y) + + def add_platform(self, platform): + if ":powerpc" in platform: + self.add_platform_package(platform) + else: + self.add_platform_package("onl-platform-config-%s:powerpc" % platform) + + def write(self, fname): + with open(fname, "w") as f: + self.writef(f) + + def writef(self, f): + + kdict = {} + for k in set(self.kernels): + kdict[k] = KernelImage(k) + + ddict = {} + for d in set(self.dtbs): + ddict[d] = DtbImage(d) + + idict = {} + for i in set(self.initrds): + idict[i] = InitrdImage(i) + + + + f.write("""/* \n""") + f.write(""" * %s\n""" % self.description) + f.write(""" */\n""") + f.write("""\n""") + f.write("""/dts-v1/;\n""") + f.write("""/ {\n""") + f.write(""" description = "%s";\n""" % self.description) + f.write(""" #address-cells = <0x1>;\n""") + f.write("""\n""") + f.write(""" images {\n\n""") + + f.write(""" /* Kernel Images */\n""") + for k in set(self.kernels): + KernelImage(k).write(f) + + f.write("""\n""") + f.write(""" /* DTB Images */\n""") + for d in set(self.dtbs): + DtbImage(d).write(f) + + f.write("""\n""") + f.write(""" /* Initrd Images */\n""") + for i in set(self.initrds): + InitrdImage(i).write(f) + + f.write(""" };\n""") + f.write(""" configurations {\n""") + for (name, (kernel, dtb, initrd)) in self.configurations.iteritems(): + f.write(""" %s {\n""" % name) + f.write(""" description = "%s";\n""" % name) + f.write(""" kernel = "%s";\n""" % (kdict[kernel].name)) + f.write(""" ramdisk = "%s";\n""" % (idict[initrd].name)) + f.write(""" fdt = "%s";\n""" % (ddict[dtb].name)) + f.write(""" };\n\n""") + f.write(""" };\n""") + f.write("""};\n""") + + +############################################################ + +if __name__ == '__main__': + import os + import sys + import argparse + + ap = argparse.ArgumentParser(description="UBoot Flat Image Tree Generator.") + ap.add_argument("--initrd", nargs='+', action='append', help="Add initrds.") + ap.add_argument("--kernel", nargs='+', action='append', help="Add kernels.") + ap.add_argument("--dtb", nargs='+', action='append', help="Add dtbs.") + ap.add_argument("--add-yaml", nargs='+', action='append', help="Add a configuration from a yaml configuration file.") + ap.add_argument("--add-platform", nargs='+', action='append', help="Add the given ONL platforms to the configuration.") + ap.add_argument("--desc", nargs=1, help="Flat Image Tree description", default="ONL Flat Image Tree.") + ap.add_argument("--itb", metavar='itb-file', help="Compile result to an image tree blob file.") + ap.add_argument("--its", metavar='its-file', help="Write result to an image tree source file.") + + ops=ap.parse_args() + + fit = FlatImageTree(ops.desc) + initrd=None + + if ops.initrd: + for ilist in ops.initrd: + for initrd in ilist: + fit.add_initrd(initrd) + # hack for now + initrd = initrd + + if ops.kernel: + for klist in ops.kernel: + for kernel in klist: + fit.add_kernel(kernel) + + if ops.dtb: + for dlist in ops.dtb: + for dtb in dlist: + fit.add_dtb(dtb) + + if ops.add_yaml: + for ylist in ops.add_yaml: + for y in ylist: + fit.add_yaml(y) + + if ops.add_platform == [['all']]: + # Add support for all powerpc platform. + ops.add_platform = [ subprocess.check_output("onlpm --list-platforms --arch powerpc", shell=True).split() ] + + if ops.add_platform == [['initrd']]: + # Add support for the platforms listed in the initrd's platform manifest + (package,f) = initrd.split(':') + mfile = subprocess.check_output("onlpm --find-file %s:powerpc manifest.json" % (package), shell=True).strip() + manifest = json.load(open(mfile)) + ops.add_platform = [[ "%s" % p for p in manifest['platforms'] ]] + + + if ops.add_platform: + for plist in ops.add_platform: + for platform in plist: + fit.add_platform(platform) + + if ops.itb is None: + if ops.its is None: + fit.writef(sys.stdout) + else: + fit.write(ops.its) + else: + its = ops.its + if its is None: + its = tempfile.NamedTemporaryFile(delete=False) + fit.writef(its) + its.close() + its = its.name + else: + fit.write(its) + + if os.system("mkimage -f %s %s" % (its, ops.itb)) != 0: + raise RuntimeError("Device tree compilation failed. See %s." % its) + + if ops.its is None: + os.unlink(its) + diff --git a/tools/make-versions.py b/tools/make-versions.py new file mode 100755 index 00000000..a5c0ae17 --- /dev/null +++ b/tools/make-versions.py @@ -0,0 +1,96 @@ +#!/usr/bin/python +############################################################ +import os +import sys +import argparse +import subprocess +import json +import pprint +import yaml + +class OnlVersionsGenerator(object): + def __init__(self, ops): + + sys.path.append(os.path.dirname(ops.import_file)) + m = __import__(os.path.basename(ops.import_file)) + + if hasattr(m, ops.class_name): + self.implementation = getattr(m, ops.class_name)() + else: + raise ValueError("The import file %s does not contain a class named %s" % (ops.import_file, ops.class_name)) + + self.ops = ops + self.build_sha1 = subprocess.check_output("git rev-list HEAD -1", shell=True).strip() + self.build_timestamp =subprocess.check_output("date +%Y-%m-%d.%H:%M", shell=True).strip() + + def generate_all(self): + for product in self.implementation.PRODUCTS: + for config in product.get('builds', [None]): + data = {} + data['product'] = product + data['build_timestamp'] = self.build_timestamp + data['build_sha1'] = self.build_sha1 + if config is not None: + data['build_config'] = config + self.generate(data) + + def generate(self, d): + data = {} + directory = dir(self.implementation) + for attribute in directory: + if attribute.startswith("V_"): + key = attribute.replace("V_", "") + data[key] = getattr(self.implementation, attribute)(d) + + + if not os.path.isdir(self.ops.output_dir): + os.makedirs(ops.output_dir) + + basename = "version-%s" % (d['product']['id'].lower()) + if 'build_config' in d: + basename += "-%s" % d['build_config'] + + # JSON + fname = os.path.join(self.ops.output_dir, basename + '.json') + if not os.path.exists(fname) or self.ops.force: + with open(fname, "w") as f: + json.dump(data, f, indent=2) + + # mk + fname = os.path.join(self.ops.output_dir, basename + '.mk') + if not os.path.exists(fname) or self.ops.force: + with open(fname, "w") as f: + for k in sorted(data.keys()): + f.write("%s%s=%s\n" % ("export " if self.ops.export else "", k, data[k])) + f.write("\n") + + # sh + fname = os.path.join(self.ops.output_dir, basename + '.sh') + if not os.path.exists(fname) or self.ops.force: + with open(fname, "w") as f: + for k in sorted(data.keys()): + f.write("%s%s='%s'\n" % ("export " if self.ops.export else "", k, data[k])) + f.write("\n") + + if self.ops.print_: + pprint.pprint(data, indent=2) + + +if __name__ == '__main__': + import argparse + + ap = argparse.ArgumentParser(description="ONL Version Tool") + ap.add_argument("--import-file", required=True, help="The path the python file containing the implementation class.") + ap.add_argument("--class-name", required=True, help="The name of the implementation class.") + ap.add_argument("--output-dir", required=True, help="Location for generated files.") + ap.add_argument("--force", action='store_true', help="Force regeneration.") + ap.add_argument("--export", action='store_true', help="Include export keyword in .sh and .mk versions.") + ap.add_argument("--print", action='store_true', help="Print version data.", dest='print_') + ops = ap.parse_args() + + o = OnlVersionsGenerator(ops) + o.generate_all() + + + + diff --git a/tools/makedevs b/tools/makedevs new file mode 100755 index 00000000..2573bc85 Binary files /dev/null and b/tools/makedevs differ diff --git a/tools/onl-platform-pkgs.py b/tools/onl-platform-pkgs.py new file mode 100755 index 00000000..fd2d1b5a --- /dev/null +++ b/tools/onl-platform-pkgs.py @@ -0,0 +1,50 @@ +#!/usr/bin/python +############################################################ +# +# This script expects a yaml file containing the list +# of platforms that are to be included in the +# build. +# +# It produces a YAML list on stdout of all +# packages necessary to support the given list +# of platforms. +# +import onlyaml +import argparse +import onlu +import os + +ap = argparse.ArgumentParser(description='ONL Platform Package Lister') +ap.add_argument('platforms', metavar='PLATFORM-LIST|YAML-FILE', help='YAML file containing the list of platforms.') +ap.add_argument("--no-builtins", action='store_true', help='Skip builtin ONL packages.') +ap.add_argument("--add-patterns", help="Additional package patterns.", nargs='+', default=[]) + +ops = ap.parse_args() + +if os.path.exists(ops.platforms): + platforms = onlyaml.loadf(ops.platforms) +else: + platforms = ops.platforms.split(',') + +# +# The following ONL packages are needed for each platform: +# +# The platform-config package +# The ONLP package +# +ONL_PATTERNS = [ "onlp-%(platform)s", "onl-platform-config-%(platform)s" ] + +PATTERNS = list(onlu.sflatten(ops.add_patterns)) + +if not ops.no_builtins: + PATTERNS = ONL_PATTERNS + PATTERNS + +for p in platforms: + for pattern in PATTERNS: + print "- ", pattern % dict(platform=p) + + + + + + diff --git a/tools/onlpm.py b/tools/onlpm.py new file mode 100755 index 00000000..b120297d --- /dev/null +++ b/tools/onlpm.py @@ -0,0 +1,1232 @@ +#!/usr/bin/python +############################################################ +# +# ONL Package Management +# +############################################################ +import argparse +import os +import sys +import logging +import yaml +import tempfile +import shutil +import pprint +import subprocess +import glob +import submodules +import onlyaml +import onlu +from string import Template +import re + +logger = onlu.init_logging('onlpm') + +class OnlPackageError(Exception): + """General Package Error Exception + + This class is used to communicate user-level configuration + and runtime errors related to package contents, package + building, and similar operations. + + This exception should be caught at the highest level and + the error message comminicated to the user.""" + + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + + +class OnlPackageMissingError(OnlPackageError): + def __init__(self, pkg): + self.value = "Package %s does not exist." % pkg + + +class OnlPackageMissingFileError(OnlPackageError): + def __init__(self, p, f): + self.value = "Package %s does not contain the file %s." % (p, f) + +class OnlPackageMissingDirError(OnlPackageError): + def __init__(self, p, d): + self.value = "Package %s does not contain the directory %s." % (p, d) + + +class OnlPackage(object): + """Individual Debian Package Builder Class + + This class builds a single debian package from a package specification. + The package specification is a dictionary with the following keys: + + name: The name of the package + version: The version of the package + arch: The package architecture + copyright: The copyright string or path to copyright file + changelog: The changelog string or path to changelog file + maintainer: The package maintainer address + summary: The package summary description + *desc: The package description (defaults to summary) + files: A dict containing source/dst pairs. + A src can be a file or a directory + A dst can be a file or a directory + A list containing src,dst pairs. + *depends: List of package dependencies + *docs : List of documentation files + + Keys marked with an asterisk are optional. All others are required.""" + + # These are built-in defaults for some package keys + DEFAULTS = { + 'vendor' : 'Open Network Linux', + 'url' : 'http://opennetlinux.org', + 'license' : 'unknown', + + # Default Python Package Installation + 'PY_INSTALL' : '/usr/lib/python2.7/dist-packages', + + # Default Builder build directory name. Must match setup.env + 'BUILD_DIR' : 'BUILD', + + # Default Templates Location + 'ONL_TEMPLATES' : "%s/packages/base/any/templates" % os.getenv("ONL") + + } + + ############################################################ + # + # 'pdict' is the main package dictionary. + # 'cdict' is the "common" key dictionary (optional) + # 'ddict' is the "default" key dictionary + # + # The union of 'pdict' + 'cdict' + 'ddict' must provide a complete + # package specification containing all required keys. + # + # 'dir_' is the parent directory of the package. + # File contents for the package specification may be absolute or + # relative to this directory. + # + ############################################################ + def __init__(self, pdict, dir_, cdict=None, ddict=None): + """Initialize package object. + + 'pdict' : The main package dictionary + 'cdict' : The "common" key dictionary (optional) + 'ddict' : The "default" key dictionary + 'dir_' : The parent directory of the package. + File contents for the package specification may be absolute or + relative to this directory. + + The union of 'pdict' + 'cdict' + 'ddict' must provide a complete + package specification containing all required keys.""" + + # Default key value dictionary + if ddict is None: + ddict = self.DEFAULTS + + # Optional common value dictionary + if cdict is None: + cdict = {} + + # + # The key value precedence is package dict, common dict, default dict. + # + self.pkg = dict(ddict.items() + cdict.items() + pdict.items()) + + # Validate all required package keys are present and well-formed. + if not 'external' in self.pkg: + self._validate() + + # Save package working directory for future build steps. + self.dir = dir_ + + + + def id(self): + """Cannonical package identifier. + + The package identifier is : + + The version numbers and suffixes related to the package are ignored + for the purposes of the identifier. It is assumed that any given + set of packages used in creating a particular system will only + be at a single revision at a time.""" + + return self.pkg['name'] + ':' + self.pkg['arch'] + + + @staticmethod + def idparse(pkgid, ex=True): + """Parse a cannonical package identifier. + + pkgid: string of the form : + ex: If true, a package expection is raised if it cannot be parsed. + + Returns a tuple of the form (name, arch), or (False,False)""" + try: + # (name, arch) + return tuple(pkgid.split(':')) + except ValueError: + if ex: + raise OnlPackageError("%s is not a valid package specification." % pkg) + else: + return (False,False) + + + def __str__(self): + """Package key contents.""" + return pprint.pformat(self.pkg) + + + def _validate_key(self, key, type_, required=True): + """Validate a given key (option dependent).""" + + if key not in self.pkg: + if required: + raise OnlPackageError("'%s' is required but not specified in the package file." % key) + else: + return False + + if type(self.pkg[key]) is str and type_ is list: + self.pkg[key] = [ self.pkg[key] ] + + if type(self.pkg[key]) in [ float , int ]: + self.pkg[key] = str(self.pkg[key]) + + if type(self.pkg[key]) != type_: + raise OnlPackageError("key '%s' is the wrong type (%s should be %s)" % ( + key, type(pkg[key]), type_)) + + return True + + + + def filepath(self, filename): + """Return the file path for a given package file.""" + p = None + if os.path.isabs(filename): + p = filename + else: + p = os.path.join(self.dir, filename) + logger.debug("package file: %s" % p) + return p + + + def _validate_files(self): + """Validate the existence of the required input files for the current package.""" + + files = [] + if type(self.pkg['files']) is dict: + for (s,d) in self.pkg['files'].iteritems(): + files.append((s,d)) + elif type(self.pkg['files']) is list: + for e in self.pkg['files']: + if type(e) is dict: + for (s,d) in e.iteritems(): + files.append((s,d)) + elif type(e) in [ list, tuple ]: + if len(e) != 2: + raise OnlPackageError("Too many filenames: '%s'" % (e)) + else: + files.append((e[0], e[1])) + else: + raise OnlPackageError("File entry '%s' is invalid." % (e)) + + # + # Make sure all source files exist. + # + for f in files: + fp = self.filepath(f[0]) + if not os.path.exists(fp): + raise OnlPackageError("Source file or directory '%s' does not exist." % fp) + + # + # Perform destination-file substitutions. + # + flist = [] + for f in files: + s = Template(f[1]) + dst = s.substitute(dict(PKG=self.pkg['name'], PKG_INSTALL='/usr/share/onl/packages/%s/%s' % (self.pkg['arch'], self.pkg['name']))) + flist.append((f[0], dst)) + + self.pkg['files'] = flist + + + def _validate(self): + """Validate the package contents.""" + + self._validate_key('name', str) + self._validate_key('arch', str) + self._validate_key('copyright', str) + self._validate_key('changelog', str) + self._validate_key('version', str) + self._validate_key('maintainer', str) + self._validate_key('depends', list, False) + self._validate_key('priority', str, False) + self._validate_key('summary', str) + self._validate_key('docs', list, False) + self._validate_key('vendor', str) + self._validate_key('url', str) + self._validate_key('license', str) + + if not self._validate_key('desc', str, False): + self.pkg['desc'] = self.pkg['summary'] + + self.pkg['description'] = "%s\n%s" % (self.pkg['summary'], self.pkg['desc']) + + return True + + + + def build(self, dir_=None): + """Build the debian package. + + When this method is called it is assumed that all file + prerequisites for the package have already been built + or met. This is simply the packaging stage. + + 'dir_' : This is the output directory in which the package + should be left. If unspecified the package's local directory + will contain the package file.""" + + + if 'external' in self.pkg: + # Package file built externally + epkg = self.pkg['external'] + if os.path.exists(epkg): + return epkg + else: + raise OnlPackageError("The external package file '%s' does not exist." % epkg); + + + + # Make sure all required files exist + if 'files' in self.pkg: + self._validate_files() + + # If dir_ is not specified, leave package in local package directory. + if dir_ is None: + dir_ = self.dir + + workdir = tempfile.mkdtemp() + root = os.path.join(workdir, "root"); + os.mkdir(root); + + # The package file will be built into the workdir + self.pkg['__workdir'] = workdir + + for (src,dst) in self.pkg['files']: + + if dst.startswith('/'): + dst = dst[1:] + + src = self.filepath(src) + + if os.path.isdir(src): + # + # Copy entire src directory to target directory + # + dstpath = os.path.join(root, dst) + logger.debug("Copytree %s -> %s" % (src, dstpath)) + shutil.copytree(src, dstpath) + else: + # + # If the destination ends in a '/' it means copy the filename + # as-is to that directory. + # + # If not, its a full rename to the destination. + # + if dst.endswith('/'): + dstpath = os.path.join(root, dst) + if not os.path.exists(dstpath): + os.makedirs(dstpath) + shutil.copy(src, dstpath) + else: + dstpath = os.path.join(root, os.path.dirname(dst)) + if not os.path.exists(dstpath): + os.makedirs(dstpath) + shutil.copyfile(src, os.path.join(root, dst)) + shutil.copymode(src, os.path.join(root, dst)) + + + for (link,src) in self.pkg.get('links', {}).iteritems(): + logger.info("Linking %s -> %s..." % (link, src)) + link = os.path.join(root, link) + os.symlink(src, link) + + # + # FPM doesn't seem to have a doc option so we copy documentation + # files directly into place. + # + for src in self.pkg.get('docs', []): + if not os.path.exists(src): + raise OnlPackageError("Documentation source file '%s' does not exist." % src) + + dstpath = os.path.join(root, "usr/share/doc/%(name)s" % self.pkg) + if not os.path.exists(dstpath): + os.makedirs(dstpath) + shutil.copy(src, dstpath) + + changelog = os.path.join(workdir, 'changelog') + copyright_ = os.path.join(workdir, 'copyright') + + # + # Export changelog and copyright files from the PKG dict + # to the workdir for processing. + # + # The copyright and changelog data can be embedded directly + # int the PKG file or kept as separate files. + # + + def copy_str_or_file(src, dst): + if os.path.exists(src): + shutil.copyfile(src, dst) + else: + with open(dst, "w") as f: + f.write(src) + f.write("\n") + + copy_str_or_file(self.pkg['copyright'], copyright_) + copy_str_or_file(self.pkg['changelog'], changelog) + + + ############################################################ + # + # Invoke fpm with all necessary options. + # + ############################################################ + self.pkg['__root'] = root + + command = """fpm -p %(__workdir)s -f -C %(__root)s -s dir -t deb -n %(name)s -v %(version)s -a %(arch)s -m %(maintainer)s --description "%(description)s" --url "%(url)s" --license "%(license)s" --vendor "%(vendor)s" """ % self.pkg + + for dep in self.pkg.get('depends', []): + command = command + "-d %s " % dep + + for provides in onlu.sflatten(self.pkg.get('provides', [])): + command = command + "--provides %s " % provides + + if 'init' in self.pkg: + if not os.path.exists(self.pkg['init']): + raise OnlPackageError("Init script '%s' does not exist." % self.pkg['init']) + command = command + "--deb-init %s" % self.pkg['init'] + + if 'post-install' in self.pkg: + if not os.path.exists(self.pkg['post-install']): + raise OnlPackageError("Post-install script '%s' does not exist." % self.pkg['post-install']) + command = command + "--after-install %s" % self.pkg['post-install'] + + onlu.execute(command) + + # Grab the package from the workdir. There can be only one. + sys.stdout.write(workdir) + files = glob.glob(os.path.join(workdir, '*.deb')) + if len(files) == 0: + raise OnlPackageError("No debian package.") + elif len(files) > 1: + raise OnlPackageError("Too many packages.") + else: + # Move to the target directory + shutil.copy(files[0], dir_) + + # Remove entire work directory. + shutil.rmtree(workdir) + + # Return the path to the final built package + return os.path.join(dir_, os.path.basename(files[0])) + + + def tagged(self, tag): + return tag in self.pkg.get('tags',[]) + +class OnlPackageGroup(object): + """Debian Package Group + + A Package Group is defined in a Package Group File. It contains common + package settings, multiple package declarations, and a common build step. + + All packages are built through their parent PackageGroup object. + """ + + def __init__(self): + self.filtered = False + + + def prerequisite_packages(self): + return list(onlu.sflatten(self._pkgs.get('prerequisites', {}).get('packages', []))) + + def prerequisite_submodules(self): + return self._pkgs.get('prerequisites', {}).get('submodules', []) + + def prerequisites(self): + return self._pkgs.get('prerequisites', {}) + + def load(self, pkg): + if not os.path.exists(pkg): + raise OnlPackageError("Package file '%s' does not exist." % pkg) + + pkg_data = onlyaml.loadf(pkg, OnlPackage.DEFAULTS) + + pkglist = [] + + # + # Package declarations are dicts. + # + if(type(pkg_data) is not dict): + raise OnlPackageError("The package file '%s' is empty or malformed." % pkg) + + if 'packages' not in pkg_data: + raise OnlPackageError("The package file '%s' does not contain a packages declaration." % pkg) + + if type(pkg_data['packages']) is not list: + raise OnlPackageError("The packages declaration is not a list.") + + self.packages = [] + for p in pkg_data['packages']: + self.packages.append(OnlPackage(p, os.path.dirname(pkg), + pkg_data.get('common', None), + None)) + + # This is used for the pkg_info dump + self._pkg_info = pkg_data.copy() + self._pkgs = pkg_data + self._pkgs['__source'] = os.path.abspath(pkg) + self._pkgs['__directory'] = os.path.dirname(self._pkgs['__source']) + self._pkgs['__mtime'] = os.path.getmtime(pkg) + + def reload(self): + """Reload our package file if it has changed.""" + + if ( (self._pkgs['__mtime'] != os.path.getmtime(self._pkgs['__source'])) or + (self._pkgs.get('reload', False)) ): + logger.debug("Reloading updated package file %s..." % self._pkgs['__source']) + self.load(self._pkgs['__source']) + + + def __str__(self): + return "\n".join( self.list().keys() ) + + def list(self): + rv = {} + lst = [ p.id() for p in self.packages ] + for p in self.packages: + rv[p.id()] = self.prerequisites() + return rv + + def pkg_info(self): + return ("** Package Group: %s\n" % self._pkgs['__source'] + + yaml.dump(self._pkg_info, default_flow_style = False) + + "\n") + + def __contains__(self, pkg): + """The current package group contains the given package id.""" + for p in self.packages: + if pkg == 'all' or p.id() == pkg: + return True + return False + + def is_child(self, dir_): + return self._pkgs['__directory'].startswith(dir_) + + + def gmake_locked(self, target, operation): + + buildpaths = [] + if self._pkgs.get('build', True) and not os.environ.get('NOBUILD', False): + buildpaths = [ + os.path.join(self._pkgs['__directory'], 'builds'), + os.path.join(self._pkgs['__directory'], 'BUILDS'), + ] + + for bp in buildpaths: + if os.path.exists(bp): + MAKE = os.environ.get('MAKE', "make") + cmd = MAKE + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + target + onlu.execute(cmd, + ex=OnlPackageError('%s failed.' % operation)) + + def build(self, dir_=None): + """Build all packages in the current group. + + dir_ : The output directory for the package group. + The default is the package group parent directory. + + The option to build individual packages is not provided. + The assumption is that the packages defined in the group are + related and should always be built together. + + It is also assumed that all packages in the group have a common + build step. That build step is performed once, and all packages + are then built from the artifacts as defined in the package + specifications. + + This assures there are not mismatches in the contents of packages + from the same group and that there are no unecessary invocations of + the build steps. + """ + + products = [] + + with onlu.Lock(os.path.join(self._pkgs['__directory'], '.lock')): + self.gmake_locked("", 'Build') + for p in self.packages: + products.append(p.build(dir_=dir_)) + + return products + + def clean(self, dir_=None): + with onlu.Lock(os.path.join(self._pkgs['__directory'], '.lock')): + self.gmake_locked("clean", 'Clean') + + +class OnlPackageRepo(object): + """Package Repository and Interchange Class + + This class implements access to a single package repository. + Packages can be: + 1. Installed in the repository. + 2. Looked up in the repository. + 3. Extracted from the repository. + 4. Extracted into a local cache whose file contents + can be used by other packages with dependencies on those + contents.""" + + def __init__(self, root, packagedir='packages'): + """Initialize a repo object. + + root : The root directory that should be used for this repository.""" + + self.root = root + + if not os.path.exists(root): + os.makedirs(root) + + # The package subdirectory goes here + self.repo = os.path.join(root, packagedir) + + # The extract cache goes here + self.extracts = os.path.join(root, 'extracts') + + # All access to the repository is locked + self.lock = onlu.Lock(os.path.join(root, '.lock')) + + def add_packages(self, pkglist): + """Add a package or list of packages to the repository.""" + with self.lock: + for p in pkglist if type(pkglist) is list else [ pkglist ]: + if not os.path.exists(p): + raise OnlPackageError("Package file '%s' does not exist." % p) + logger.info("adding package '%s'..." % p) + underscores = p.split('_') + # Package name is the first entry + package = underscores[0] + # Architecture is the last entry (.deb) + arch = underscores[-1].split('.')[0] + logger.debug("+ /bin/cp %s %s/%s", p, self.repo, arch) + dstdir = os.path.join(self.repo, arch) + if not os.path.exists(dstdir): + os.makedirs(dstdir) + logger.info("dstdir=%s"% dstdir) + shutil.copy(p, dstdir) + extract_dir = os.path.join(self.extracts, arch, package) + if os.path.exists(extract_dir): + # Make sure the package gets re-extracted the next time it's requested by clearing any existing extract in the cache. + logger.info("removed previous extract directory %s...", extract_dir) + logger.debug("+ /bin/rm -fr %s", extract_dir) + shutil.rmtree(extract_dir) + + def remove_packages(self, pkglist): + with self.lock: + for p in pkglist if type(pkglist) is list else [ pkglist ]: + path = self.lookup(p) + if path: + logger.info("removing package %s..." % p) + os.unlink(path) + + def lookup_all(self, pkg): + """Lookup all packages in the repo matching the given package identifier.""" + with self.lock: + rv = [] + (name, arch) = OnlPackage.idparse(pkg) + dirname = os.path.join(self.repo, arch) + if os.path.exists(dirname): + manifest = os.listdir(dirname) + rv = [ os.path.join(dirname, x) for x in manifest if arch in x and "%s_" % name in x ] + return rv + + def __contains__(self, pkg): + r = self.lookup_all(pkg) + return len(r) != 0 + + def lookup(self, pkg, ex=False): + """Lookup a package in the repo. The package must be unique and exist.""" + r = self.lookup_all(pkg) + if len(r) == 0: + if ex: + raise OnlPackageError("Package %s is not in the repository." % pkg) + return False + elif len(r) > 1: + if ex: + raise OnlPackageError("Multiple matches for package identifier '%s': %s" % (pkg, r)) + return False + else: + return r[0] + + def extract(self, pkg, dstdir=None, prefix=True, force=False, remove_ts=False, sudo=False): + """Extract the given package. + + pkg : The package identifier. Must be unique in the repo. + dstdir : The parent directory which will contain the extracted package contents. + The default is the local repo's extract cache. + force: If True, the package will be extracted even if its contents are already valid in the extract cache.""" + + PKG_TIMESTAMP = '.PKG.TIMESTAMP' + + with self.lock: + path = self.lookup(pkg) + if path: + + if dstdir is None: + dstdir = self.extracts + + if prefix: + edir = os.path.join(dstdir, pkg.replace(':', '_')) + else: + edir = dstdir + + if not force and os.path.exists(os.path.join(edir, PKG_TIMESTAMP)): + if (os.path.getmtime(os.path.join(edir, PKG_TIMESTAMP)) == + os.path.getmtime(path)): + # Existing extract is identical to source package + logger.debug("Existing extract for %s matches the package file." % pkg) + else: + # Existing extract must be removed. + logger.warn("Existing extract for %s does not match." % pkg) + force=True + else: + # Status unknown. Really shouldn't happen. + force=True + + if force: + if os.path.exists(edir) and prefix: + shutil.rmtree(edir) + if not os.path.exists(edir): + os.makedirs(edir) + + onlu.execute([ 'dpkg', '-x', path, edir ], sudo=sudo) + onlu.execute([ 'touch', '-r', path, os.path.join(edir, PKG_TIMESTAMP) ], sudo=sudo) + + if remove_ts and os.path.exists(os.path.join(edir, PKG_TIMESTAMP)): + onlu.execute([ 'rm', os.path.join(edir, PKG_TIMESTAMP) ], sudo=sudo) + + return edir + + return False + + def contents(self, pkg): + with self.lock: + path = self.lookup(pkg) + if path: + print "** %s contents:" % path + onlu.execute(['dpkg', '-c', path]) + + + def get_file(self, pkg, filename, force=False, ex=True): + """Get a file contained in the given package. + + The package will be extracted (if necessary) into the extract cache + and the path to the requested file will be returned. + + force: Passed to extract() as the force option.""" + + edir = self.extract(pkg, force=force) + for root, dirs, files in os.walk(edir): + for file_ in files: + if file_ == filename: + return os.path.join(root, file_) + + if ex: + raise OnlPackageMissingFileError(pkg, filename) + + return None + + + def get_dir(self, pkg, dirname, force=False, ex=True): + """Get a directory contained in the given package. + + The package will be extracted (if necessary) into the extract cache + and the path to the requested directory will be returned. + + force: Passed to extract() as the force option.""" + + edir = self.extract(pkg, force=force) + for root, dirs, files in os.walk(edir): + if os.path.basename(root) == dirname and root != edir: + return root + + if ex: + raise OnlPackageMissingDirError(pkg, dirname) + + return None + +class OnlPackageManager(object): + + def __init__(self): + # Stores all loaded package groups. + self.package_groups = [] + self.opr = None + + def set_repo(self, repodir): + self.opr = OnlPackageRepo(repodir, ops.repo_package_dir) + + + def filter(self, subdir=None, arch=None, substr=None): + + for pg in self.package_groups: + + if subdir and not pg.is_child(subdir): + pg.filtered = True + + + def load(self, basedir, usecache=True, rebuildcache=False): + pkgspec = [ 'PKG.yml', 'pkg.yml' ] + + import cPickle as pickle + CACHE=os.path.join(basedir, '.PKGs.cache') + + # Lock the CACHE file + with onlu.Lock(CACHE + ".lock"): + if usecache: + if os.path.exists(CACHE): + if rebuildcache: + logger.debug("Removing package cache %s" % CACHE) + os.unlink(CACHE) + else: + logger.debug("Loading from package cache %s" % CACHE) + self.package_groups = pickle.load(open(CACHE, "rb")) + + # Validate and update the cache + for pg in self.package_groups: + pg.reload() + + # Update cache and return + pickle.dump(self.package_groups, open(CACHE, "wb")) + return + else: + if os.path.exists(CACHE): + logger.debug("Removing package cache %s" % CACHE) + os.unlink(CACHE) + + + for root, dirs, files in os.walk(basedir): + for f in files: + if f in pkgspec: + if "%s.disabled" % f in files: + logger.warn("Skipping %s due to .disabled file)." % os.path.join(root, f)) + else: + pg = OnlPackageGroup() + try: + logger.debug('Loading package file %s...' % os.path.join(root, f)) + pg.load(os.path.join(root, f)) + logger.debug(' Loaded package file %s' % os.path.join(root, f)) + self.package_groups.append(pg) + except OnlPackageError, e: + logger.error("%s: " % e) + logger.warn("Skipping %s due to errors." % os.path.join(root, f)) + + if usecache: + # Write the package cache + logger.debug("Writing the package cache %s..." % CACHE) + pickle.dump(self.package_groups, open(CACHE, "wb")) + + + def __contains__(self, pkg): + for pg in self.package_groups: + if pkg == 'all' or pkg in pg: + return True + return False + + def build(self, pkg=None, dir_=None, filtered=True, prereqs_only=False): + + built = False + + for pg in self.package_groups: + if pkg is None or pkg in pg: + + if filtered and pg.filtered: + continue + + if not prereqs_only: + # + # Process prerequisite submodules. + # Only due this if we are building the actual package, + # not processing the package dependencies. + # + for sub in pg.prerequisite_submodules(): + root = sub.get('root', None) + path = sub.get('path', None) + depth = sub.get('depth', None) + recursive = sub.get('recursive', None) + + if not root: + raise OnlPackageError("Submodule prerequisite in package %s does not have a root key." % pkg) + + if not path: + raise OnlPackageError("Submodule prerequisite in package %s does not have a path key." % pkg) + + try: + manager = submodules.OnlSubmoduleManager(root) + manager.require(path, depth=depth, recursive=recursive) + except submodules.OnlSubmoduleError, e: + raise OnlPackageError(e.value) + + # Process prerequisite packages + for pr in pg.prerequisite_packages(): + logger.info("Requiring prerequisite package %s..." % pr) + self.require(pr, build_missing=True) + + if not prereqs_only: + # Build package + products = pg.build(dir_=dir_) + if self.opr: + # Add results to our repo + self.opr.add_packages(products) + + built = True + + if not built: + raise OnlPackageMissingError(pkg) + + def clean(self, pkg=None, dir_=None): + for pg in self.package_groups: + if pkg is None or pkg in pg: + products = pg.clean(dir_=dir_) + if self.opr: + # Remove results from our repo + self.opr.remove_packages(products) + + def require(self, pkg, force=False, build_missing=False, skip_missing=False, + try_arches=None): + + if pkg not in self and try_arches: + for a in try_arches: + p = "%s:%s" % (pkg, a) + if p in self: + pkg = p; + break + + if pkg not in self: + if skip_missing: + return + # Can't require a package we don't have + raise OnlPackageMissingError(pkg) + + if force or (pkg not in self.opr and build_missing): + logger.info("Rebuilding %s... " % pkg) + self.build(pkg, filtered=False) + else: + if pkg in self.opr: + self.build(pkg, filtered=False, prereqs_only=True) + + if pkg not in self.opr: + raise OnlPackageError("Package %s is required but has not been built." % pkg) + + + def __str__(self): + return "\n".join(self.list()) + + def filtered_package_groups(self): + return [ pg for pg in self.package_groups if not pg.filtered ] + + def list(self): + rv = {} + for pg in self.filtered_package_groups(): + for (p,d) in pg.list().iteritems(): + rv[p] = d + return rv + + def pmake(self, handle=sys.stdout): + packages = self.list() + + # Collect some dependency data + TARGETS={} + ARCHS={} + + for (p,d) in packages.iteritems(): + (name,arch) = p.split(':') + target = p.replace(':', '_') + depends = " ".join(d.get('packages', [])).replace(':', '_') + + TARGETS[target] = TARGETS.get(target, {}) + TARGETS[target][arch] = arch + TARGETS[target]['name'] = target + TARGETS[target]['depends'] = depends + TARGETS[target]['package'] = p + ARCHS[arch] = ARCHS.get(arch, []) + ARCHS[arch].append(TARGETS[target]) + + if d.get('broken', False): + TARGETS[target]['stage'] = 20 + elif len(depends) == 0: + TARGETS[target]['stage'] = 0 + else: + TARGETS[target]['stage'] = 1 + + + handle.write("############################################################\n") + handle.write("#\n") + handle.write("# These are the rules that build each individual package.\n") + handle.write("#\n") + handle.write("############################################################\n") + for (t, d) in TARGETS.iteritems(): + handle.write("%s : %s\n" % (t, d['depends'])) + handle.write("\ttouch building/%s\n" % t) + handle.write("\tonlpm.py --require %s\n" % d['package']) + handle.write("\tmv building/%s finished/\n" % (t)) + + for (arch, targets) in ARCHS.iteritems(): + handle.write("############################################################\n") + handle.write("#\n") + handle.write("# These rules represent the build stages for arch='%s'\n" % arch) + handle.write("#\n") + handle.write("############################################################\n") + STAGES = {} + for t in targets: + STAGES[t['stage']] = STAGES.get(t['stage'], []) + STAGES[t['stage']].append(t['name']) + + for stage in range(0, 10): + handle.write("arch_%s_stage%s: %s\n\n" % (arch, stage, " ".join(STAGES.get(stage, [])))) + + for arch in ARCHS.keys(): + handle.write("arch_%s:\n" % arch) + for stage in range(0, 10): + handle.write("\t$(MAKE) arch_%s_stage%s\n" % (arch, stage)) + handle.write("\n") + + + + def pkg_info(self): + return "\n".join([ pg.pkg_info() for pg in self.package_groups if not pg.filtered ]) + +if __name__ == '__main__': + + ap = argparse.ArgumentParser("onlpm") + ap.add_argument("--repo", default=os.environ.get('ONLPM_OPTION_REPO', None)) + ap.add_argument("--repo-package-dir", default=os.environ.get('ONLPM_OPTION_REPO_PACKAGE_DIR', 'packages')) + ap.add_argument("--packagedirs", nargs='+', metavar='PACKAGEDIR') + ap.add_argument("--subdir", default=os.getcwd()) + ap.add_argument("--extract", metavar='PACKAGE') + ap.add_argument("--extract-dir", nargs=2, metavar=('PACKAGE', 'DIR'), action='append') + ap.add_argument("--force", action='store_true') + ap.add_argument("--list", action='store_true'); + ap.add_argument("--list-all", action='store_true') + ap.add_argument("--list-tagged") + ap.add_argument("--list-platforms", action='store_true') + ap.add_argument("--csv", action='store_true') + ap.add_argument("--show-group", action='store_true') + ap.add_argument("--arch") + ap.add_argument("--pmake", action='store_true') + ap.add_argument("--prereq-packages", action='store_true') + ap.add_argument("--lookup", metavar='PACKAGE') + ap.add_argument("--find-file", nargs=2, metavar=('PACKAGE', 'FILE')) + ap.add_argument("--find-dir", nargs=2, metavar=('PACKAGE', 'DIR')) + ap.add_argument("--link-file", nargs=3, metavar=('PACKAGE', 'FILE', 'DST'), action='append') + ap.add_argument("--link-dir", nargs=3, metavar=('PACKAGE', 'FILE', 'DST'), action='append') + ap.add_argument("--copy-file", nargs=3, metavar=('PACKAGE', 'FILE', 'DST'), action='append') + ap.add_argument("--build", nargs='+', metavar='PACKAGE') + ap.add_argument("--clean", nargs='+', metavar='PACKAGE') + ap.add_argument("--require", nargs='+', metavar='PACKAGE') + ap.add_argument("--no-build-missing", action='store_true') + ap.add_argument("--contents", nargs='+', metavar='PACKAGE') + ap.add_argument("--delete", nargs='+', metavar='PACKAGE') + ap.add_argument("--sudo", action='store_true') + ap.add_argument("--verbose", action='store_true') + ap.add_argument("--quiet", action='store_true') + ap.add_argument("--rebuild-pkg-cache", action='store_true', default=os.environ.get('ONLPM_OPTION_REBUILD_PKG_CACHE', False)) + ap.add_argument("--no-pkg-cache", action='store_true', default=os.environ.get('ONLPM_OPTION_NO_PKG_CACHE', False)) + ap.add_argument("--pkg-info", action='store_true') + ap.add_argument("--skip-missing", action='store_true') + ap.add_argument("--try-arches", nargs='+', metavar='ARCH') + ap.add_argument("--in-repo", nargs='+', metavar='PACKAGE') + ops = ap.parse_args() + + # + # The packagedirs and repo options can be inherited from the environment + # to make it easier to customize the settings for a given project. + # + # If these options are none it means neither was specified on the + # commandline or environment. + # + if not ops.packagedirs: + if 'ONLPM_OPTION_PACKAGEDIRS' not in os.environ: + logger.error("No packagedirs specified. Please use the --packagedirs option or set ONLPM_OPTION_PACKAGEDIRS in the environment.") + sys.exit(1) + ops.packagedirs = os.environ['ONLPM_OPTION_PACKAGEDIRS'].split(':') + + if not ops.repo: + logger.error("No repo directory specified. Please use the --repo option or set ONLPM_OPTION_REPO in the environment.") + sys.exit(1) + + + logger.setLevel(logging.INFO) + if ops.quiet: + logger.setLevel(logging.ERROR) + if ops.verbose or os.environ.get('ONLPM_VERBOSE', None): + logger.setLevel(logging.DEBUG) + + try: + + pm = OnlPackageManager() + if ops.repo: + logger.debug("Setting repo as '%s'..." % ops.repo) + pm.set_repo(ops.repo) + + if ops.in_repo: + for p in ops.in_repo: + print "%s: %s" % (p, p in pm.opr) + sys.exit(0) + + for pdir in ops.packagedirs: + logger.debug("Loading package dir %s..." % pdir) + pm.load(pdir, usecache=not ops.no_pkg_cache, rebuildcache=ops.rebuild_pkg_cache) + logger.debug(" Loaded package dir %s" % pdir) + + if ops.list_tagged: + for pg in pm.package_groups: + for p in pg.packages: + if p.tagged(ops.list_tagged): + if ops.arch in [ p.pkg['arch'], "all", None ]: + print "%-64s" % p.id(), + if ops.show_group: + print "[ ", pg._pkgs['__source'], "]", + print + + if ops.list_platforms: + platforms = [] + for pg in pm.package_groups: + for p in pg.packages: + (name, arch) = OnlPackage.idparse(p.id()) + m = re.match(r'onl-platform-config-(?P.*)', name) + if m: + if ops.arch in [ arch, "all", None ]: + platforms.append(m.groups('platform')[0]) + + if ops.csv: + print ','.join(platforms) + else: + for p in platforms: + print "%-64s" % p + + # List all packages, no filtering + if ops.list_all: + print pm + + pm.filter(subdir = ops.subdir) + + if ops.list: + print pm + + if ops.pmake: + pm.pmake() + + if ops.pkg_info: + print pm.pkg_info() + + + ############################################################ + # + # Build all packages. + # + ############################################################ + if ops.clean: + raise OnlPackageError("Clean not implemented yet.") + for p in ops.clean: + if p in pm: + pm.clean(p) + else: + raise OnlPackageMissingError(p) + + if ops.build: + for p in ops.build: + if p in pm: + pm.build(p) + else: + raise OnlPackageMissingError(p) + + if ops.require: + for p in ops.require: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing, + skip_missing=ops.skip_missing, try_arches=ops.try_arches) + + if ops.find_file: + (p, f) = ops.find_file + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + path = pm.opr.get_file(p, f) + print path + + if ops.find_dir: + (p, d) = ops.find_dir + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + path = pm.opr.get_dir(p, d) + print path + + if ops.link_file: + for (p, f, dst) in ops.link_file: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + path = pm.opr.get_file(p, f) + if dst == '.': + dst = f + if os.path.exists(dst): + os.unlink(dst) + os.symlink(path, dst) + + if ops.link_dir: + for (p, d, dst) in ops.link_dir: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + path = pm.opr.get_dir(p, d) + if dst == '.': + dst = d + if os.path.exists(dst): + os.unlink(dst) + os.symlink(path, dst) + + if ops.copy_file: + for (p, f, dst) in ops.copy_file: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + path = pm.opr.get_file(p, f) + if dst == '.': + dst = f + if os.path.exists(dst): + os.unlink(dst) + shutil.copyfile(path, dst); + + if ops.extract_dir: + for (p, d) in ops.extract_dir: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + pm.opr.extract(p, dstdir=d, prefix=False, force=True, remove_ts=True, sudo=ops.sudo) + + ############################################################ + # + # Show the contents of the given packages. + # + ############################################################ + if ops.contents: + for p in ops.contents: + pm.require(p, force=ops.force, build_missing=not ops.no_build_missing) + pm.opr.contents(p) + + + + ############################################################ + # + # Delete the given packages from the repo + # + ############################################################ + if ops.delete: + pm.opr.remove_packages(ops.delete) + + except (OnlPackageError, onlyaml.OnlYamlError), e: + logger.error(e) + sys.exit(1) + + diff --git a/tools/onlrfs.py b/tools/onlrfs.py new file mode 100755 index 00000000..d5dca62f --- /dev/null +++ b/tools/onlrfs.py @@ -0,0 +1,463 @@ +#!/usr/bin/python +############################################################ +# +# ONL Root Filesystem Generator +# +############################################################ +import argparse +import os +import sys +import logging +import yaml +import tempfile +import shutil +import pprint +import fcntl +import subprocess +import glob +import submodules +import StringIO +from collections import Iterable +import onlyaml +import onlu +import fileinput +import crypt +import string +import random +import re +import json + +logger = onlu.init_logging('onlrfs') + +class OnlRfsError(Exception): + """General Error Exception""" + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + + + + +class OnlRfsSystemAdmin(object): + + def __init__(self, chroot): + self.chroot = chroot + + @staticmethod + def gen_salt(): + # return an eight character salt value + salt_map = './' + string.digits + string.ascii_uppercase + \ + string.ascii_lowercase + rand = random.SystemRandom() + salt = '' + for i in range(0, 8): + salt += salt_map[rand.randint(0, 63)] + return salt + + @staticmethod + def chmod(mode, file_): + onlu.execute("sudo chmod %s %s" % (mode, file_), + ex=OnlRfsError("Could not change permissions (%s) on file %s" % (mode, file_))) + + def userdel(self): + pf = os.path.join(self.chroot, 'etc/password') + sf = os.path.join(self.chroot, 'etc/shadow') + + self.chmod("a+w", pf); + self.chmod("a+w", sf); + + # Can't use the userdel command because of potential uid 0 in-user problems while running ourselves + for line in fileinput.input(pf, inplace=True): + if not line.startswith('%s:' % username): + print line, + for line in fileinput.input(sf, inplace=True): + if not line.startswith('%s:' % username): + print line, + + self.chmod("go-w", pf); + self.chmod("go-w", sf); + + def useradd(self, username, uid, password, shell, deleteFirst=True): + args = [ 'useradd', '--non-unique', '--shell', shell, '--home-dir', '/root', + '--uid', '0', '--gid', '0', '--group', 'root' ] + + if deleteFirst: + self.userdel(username) + + if password: + epassword=crypt.crypt(password, '$1$%s$' % self.gen_salt()); + args = args + ['-p', epassword ] + + args.append(username) + + onlu.execute(args, + ex=OnlRfsError("Adding user '%s' failed." % username)) + + if password is None: + onlu.execute("passwd -d %s" % username, + chroot=self.chroot, + ex=OnlRfsError("Error deleting password for user '%s'" % username)) + + logger.info("user %s password %s", username, password) + + + def user_password_set(self, username, password): + logger.info("user %s password now %s", username, password) + epassword=crypt.crypt(password, '$1$%s$' % self.gen_salt()); + onlu.execute(['usermod', '-p', epassword, username], + chroot=self.chroot, + ex=OnlRfsError("Error setting password for user '%s'" % username)) + + def user_shell_set(self, username, shell): + onlu.execute('chsh --shell %s %s' % (shell, username), chroot=self.chroot, + ex=OnlRfsError("Error setting shell %s for user %s" % (shell, username))) + + def user_disable(self, username): + self.user_shell_set(username, '/bin/false') + + + +class OnlMultistrapConfig(object): + def __init__(self, config): + self.config = config + self.__validate() + + def __validate_key(self, d, k, type_, required=False): + pass + + def __validate(self): + """Validate the contents of our configuration.""" + + # There must be a General section. + general = self.config.get('General', None) + + if general is None: + raise OnlRfsError("Section 'General' is missing from the multistrap configuration.") + + self.__validate_key(general, 'arch', str, True) + self.__validate_key(general, 'debootstrap', str, True) + + for e in general['debootstrap'].split(): + if e not in self.config: + raise OnlRfsError("Section '%s' is specified in the debootstrap option but does not exist in the configuration." % e) + + self.localrepos = [] + + def generate_handle(self, handle): + for (name, fields) in self.config.iteritems(): + handle.write("[%s]\n" % name) + for (k,v) in fields.iteritems(): + + if type(v) is bool: + v = 'true' if v == True else 'false' + if type(v) is list: + v = " ".join(onlu.sflatten(v)) + + if k == 'source' and os.path.exists(v): + self.localrepos.append(v) + v = "copy:%s ./" % v + + if k == 'packages' and type(v) is list: + raise OnlRfsError("packages=%s" % v) + + handle.write("%s=%s\n" % (k, v)) + handle.write("\n") + + def generate_file(self, fname=None): + if fname is None: + h = tempfile.NamedTemporaryFile(delete=False) + fname = h.name + elif fname == '-' or fname == 'stdout': + h = sys.stdout + else: + h = open(fname, "w") + self.generate_handle(h) + return fname + + def get_packages(self): + pkgs = [] + for (name, fields) in self.config.iteritems(): + for (k,v) in fields.iteritems(): + if k == 'packages': + if type(v) is list: + pkgs = pkgs + list(onlu.sflatten(v)) + else: + pkgs = pkgs + v.split() + return pkgs + + def __str__(self): + handle = StringIO.StringIO() + self.generate_handle(handle) + return handle.getvalue() + + +class OnlRfsBuilder(object): + + DEFAULTS = dict( + DEBIAN_SUITE='wheezy', + DEBIAN_MIRROR='mirrors.kernel.org/debian/', + APT_CACHE='127.0.0.1:3142/' + ) + + MULTISTRAP='/usr/sbin/multistrap' + QEMU_PPC='/usr/bin/qemu-ppc-static' + BINFMT_PPC='/proc/sys/fs/binfmt_misc/qemu-ppc' + + def __init__(self, config, arch, **kwargs): + self.kwargs = kwargs + self.arch = arch + self.kwargs['ARCH'] = arch + self.kwargs.update(self.DEFAULTS) + self.__load(config) + self.__validate() + + def __load(self, config): + if not os.path.exists(config): + raise OnlRfsError("Configuration file '%s' does not exist." % config) + self.config = onlyaml.loadf(config, self.kwargs) + + def __validate(self): + + if not os.path.exists(self.MULTISTRAP): + raise OnlRfsError("%s is missing." % self.MULTISTRAP) + + if self.arch == 'powerpc': + if not os.path.exists(self.QEMU_PPC): + raise OnlRfsError("%s is missing." % self.QEMU_PPC) + + if not 'Multistrap' in self.config: + raise OnlRfsError("The Multistrap configuration section is missing.") + + self.ms = OnlMultistrapConfig(self.config['Multistrap']) + + + def get_packages(self): + return self.ms.get_packages() + + def msconfig(self, fname): + return self.ms.generate_file(fname) + + def multistrap(self, dir_): + msconfig = self.ms.generate_file() + + # Optional local package updates + for r in self.ms.localrepos: + logger.info("Updating %s" % r) + if os.path.exists(os.path.join(r, 'Makefile')): + onlu.execute("make -C %s" % r) + + if os.path.exists(dir_): + onlu.execute("sudo rm -rf %s" % dir_, + ex=OnlRfsError("Could not remove target directory.")) + + if onlu.execute("sudo %s -d %s -f %s" % (self.MULTISTRAP, dir_, msconfig)) == 100: + raise OnlRfsError("Multistrap APT failure.") + + if os.getenv("MULTISTRAP_DEBUG"): + raise OnlRfsError("Multistrap debug.") + + + def dpkg_configure(self, dir_): + if self.arch == 'powerpc': + onlu.execute('sudo cp %s %s' % (self.QEMU_PPC, os.path.join(dir_, 'usr/bin'))) + + script = os.path.join(dir_, "tmp/configure.sh") + with open(script, "w") as f: + os.chmod(script, 0700) + f.write(""" +#!/bin/bash -ex +/bin/echo -e "#!/bin/sh\\nexit 101" >/usr/sbin/policy-rc.d +chmod +x /usr/sbin/policy-rc.d +export DEBIAN_FRONTEND=noninteractive +export DEBCONF_NONINTERACTIVE_SEEN=true +echo "127.0.0.1 localhost" >/etc/hosts +touch /etc/fstab +echo "localhost" >/etc/hostname +if [ -f /var/lib/dpkg/info/dash.preinst ]; then + /var/lib/dpkg/info/dash.preinst install +fi +if [ -f /usr/sbin/locale-gen ]; then + echo "en_US.UTF-8 UTF-8" >/etc/locale.gen + /usr/sbin/locale-gen + update-locale LANG=en_US.UTF-8 +fi + +dpkg --configure -a || true +dpkg --configure -a # configure any packages that failed the first time and abort on failure. + +rm -f /usr/sbin/policy-rc.d + """) + + logger.info("dpkg-configure filesystem...") + + onlu.execute("sudo chroot %s /tmp/configure.sh" % dir_, + ex=OnlRfsError("Post Configuration failed.")) + os.unlink(script) + + + + def configure(self, dir_): + + try: + + onlu.execute("sudo mount -t devtmpfs dev %s" % os.path.join(dir_, "dev"), + ex=OnlRfsError("Could not mount dev in new filesystem.")) + + onlu.execute("sudo mount -t proc proc %s" % os.path.join(dir_, "proc"), + ex=OnlRfsError("Could not mount proc in new filesystem.")) + + script = os.path.join(dir_, "tmp/configure.sh") + + if not os.getenv('NO_DPKG_CONFIGURE'): + self.dpkg_configure(dir_) + + Configure = self.config.get('Configure', None) + if Configure: + for overlay in Configure.get('overlays', []): + logger.info("Overlay %s..." % overlay) + onlu.execute('tar -C %s -c --exclude "*~" . | sudo tar -C %s -x -v --no-same-owner' % (overlay, dir_), + ex=OnlRfsError("Overlay '%s' failed." % overlay)) + + for update in Configure.get('update-rc.d', []): + onlu.execute("sudo chroot %s /usr/sbin/update-rc.d %s" % (dir_, update), + ex=OnlRfsError("update-rc.d %s failed." % (update))) + + for script in Configure.get('scripts', []): + logger.info("Configuration script %s..." % script) + onlu.execute("sudo %s %s" % (script, dir_), + ex=OnlRfsError("script '%s' failed." % script)) + + + for command in Configure.get('commands', []): + if '__rfs__' in command: + command = command % dict(__rfs__=dir_) + logger.info("Configuration command '%s'..." % command) + onlu.execute(command, + ex=OnlRfsError("Command '%s' failed." % command)) + + for (user, values) in Configure.get('users', {}).iteritems(): + ua = OnlRfsSystemAdmin(dir_) + + if 'password' in values: + ua.user_password_set(user, values['password']) + + + options = Configure.get('options', {}) + if options.get('clean', False): + logger.info("Cleaning Filesystem...") + + if not options.get('securetty', True): + f = os.path.join(dir_, 'etc/securetty') + if os.path.exists(f): + logger.info("Removing %s" % f) + onlu.execute('sudo rm %s' % f, + ex=OnlRfsError('Could not remove file %s' % f)) + + if not options.get('ttys', False): + f = os.path.join(dir_, 'etc/inittab') + ua.chmod('a+w', f) + ua.chmod('a+w', os.path.dirname(f)) + + logger.info("Clearing %s ttys..." % f) + for line in fileinput.input(f, inplace=True): + if re.match("^[123456]:.*", line): + line = "#" + line + print line, + + ua.chmod('go-w', f) + ua.chmod('go-w', os.path.dirname(f)) + + if options.get('console', True): + logger.info('Configuring Console Access in %s' % f) + f = os.path.join(dir_, 'etc/inittab') + ua.chmod('a+w', f) + ua.chmod('a+w', os.path.dirname(f)) + with open(f, 'a') as h: + h.write("T0:23:respawn:/sbin/pgetty\n") + ua.chmod('go-w', f) + ua.chmod('go-w', os.path.dirname(f)) + + + manifest = Configure.get('manifest', {}) + if manifest: + mname = "%s/etc/onl/rootfs/manifest.json" % dir_ + onlu.execute("sudo mkdir -p %s" % os.path.dirname(mname)) + onlu.execute("sudo touch %s" % mname) + onlu.execute("sudo chmod a+w %s" % mname) + md = {} + md['version'] = json.load(open(manifest['version'])) + md['arch'] = self.arch + if os.path.exists(manifest['platforms']): + md['platforms'] = yaml.load(open(manifest['platforms'])) + else: + md['platforms'] = manifest['platforms'].split() + with open(mname, "w") as f: + json.dump(md, f, indent=2) + onlu.execute("sudo chmod a-w %s" % mname) + + finally: + onlu.execute("sudo umount -l %s %s" % (os.path.join(dir_, "dev"), os.path.join(dir_, "proc"))) + + +if __name__ == '__main__': + + ap = argparse.ArgumentParser(description="ONL Root Filesystem Generator") + ap.add_argument("--arch", required=True) + ap.add_argument("--config", required=True) + ap.add_argument("--dir") + ap.add_argument("--show-packages", action='store_true') + ap.add_argument("--no-build-packages", action='store_true') + ap.add_argument("--msconfig") + ap.add_argument("--multistrap-only", action='store_true') + ap.add_argument("--no-multistrap", action='store_true') + ap.add_argument("--cpio") + ap.add_argument("--squash") + + ops = ap.parse_args() + + try: + x = OnlRfsBuilder(ops.config, ops.arch) + + if ops.msconfig: + x.msconfig(ops.msconfig) + sys.exit(0) + + if ops.show_packages: + print "\n".join(x.get_packages()) + sys.exit(0) + + if ops.dir is None: + raise OnlRfsError("argument --dir is required") + + if not ops.no_build_packages: + pkgs = x.get_packages() + # Invoke onlpm to build all required (local) packages. + onlu.execute("onlpm --try-arches %s all --skip-missing --require %s" % (ops.arch, " ".join(pkgs)), + ex=OnlRfsError("Failed to build all required packages.")) + + + if ops.multistrap_only: + x.multistrap(ops.dir) + sys.exit(0) + + if not ops.no_multistrap and not os.getenv('NO_MULTISTRAP'): + x.multistrap(ops.dir) + + x.configure(ops.dir) + + if ops.cpio: + if onlu.execute("make-cpio.sh %s %s" % (ops.dir, ops.cpio)) != 0: + raise OnlRfsError("cpio creation failed.") + + if ops.squash: + if os.path.exists(ops.squash): + os.unlink(ops.squash) + if onlu.execute("sudo mksquashfs %s %s -no-progress -noappend -comp gzip" % (ops.dir, ops.squash)) != 0: + if os.path.exists(ops.squash): + os.unlink(ops.squash) + raise OnlRfsError("Squash creation failed.") + + except (OnlRfsError, onlyaml.OnlYamlError), e: + logger.error(e.value) diff --git a/tools/onlu.py b/tools/onlu.py new file mode 100644 index 00000000..a3c33c04 --- /dev/null +++ b/tools/onlu.py @@ -0,0 +1,158 @@ +#!/usr/bin/python +############################################################ +# +# Common utilities for the ONL python tools. +# +############################################################ +import logging +import subprocess +from collections import Iterable +import sys +import os +import fcntl + +logger = None + +# Cheap colored terminal logging. Fixme. +def color_logging(): + if sys.stderr.isatty(): + logging.addLevelName( logging.WARNING, "\033[1;31m%s\033[1;0m" % logging.getLevelName(logging.WARNING)) + logging.addLevelName( logging.ERROR, "\033[1;41m%s\033[1;0m" % logging.getLevelName(logging.ERROR)) + + +def init_logging(name, lvl=logging.DEBUG): + global logger + logging.basicConfig() + logger = logging.getLogger(name) + logger.setLevel(lvl) + color_logging() + return logger + + +############################################################ +# +# Log and execute system commands +# +def execute(args, sudo=False, chroot=None, ex=None): + + if type(args) is str: + # Must be executed through the shell + shell=True + else: + shell = False + + if chroot and os.geteuid() != 0: + # Must be executed under sudo + sudo = True + + if chroot: + if type(args) is str: + args = "chroot %s %s" % (chroot, args) + elif type(args) in (list,tuple): + args = ['chroot', chroot] + list(args) + + if sudo: + if type(args) is str: + args = "sudo %s" % (args) + elif type(args) in (list, tuple): + args = [ 'sudo' ] + list(args) + + + logger.debug("Executing:%s", args) + + try: + subprocess.check_call(args, shell=shell) + return 0 + except subprocess.CalledProcessError, e: + if ex: + raise ex + return e.returncode + + +# Flatten lists if string lists +def sflatten(coll): + for i in coll: + if isinstance(i, Iterable) and not isinstance(i, basestring): + for subc in sflatten(i): + if subc: + yield subc + else: + yield i + + + +def gen_salt(): + # return an eight character salt value + salt_map = './' + string.digits + string.ascii_uppercase + \ + string.ascii_lowercase + rand = random.SystemRandom() + salt = '' + for i in range(0, 8): + salt += salt_map[rand.randint(0, 63)] + return salt + + + +############################################################ +# +# Delete a user +# +def userdel(username): + # Can't use the userdel command because of potential uid 0 in-user problems while running ourselves + for line in fileinput.input('/etc/passwd', inplace=True): + if not line.startswith('%s:' % username): + print line, + for line in fileinput.input('/etc/shadow', inplace=True): + if not line.startswith('%s:' % username): + print line, + +############################################################ +# +# Add a user +# +def useradd(username, uid, password, shell, deleteFirst=True): + args = [ 'useradd', '--non-unique', '--shell', shell, '--home-dir', '/root', + '--uid', '0', '--gid', '0', '--group', 'root' ] + + if deleteFirst: + userdel(username) + + if password: + epassword=crypt.crypt(password, '$1$%s$' % gen_salt()); + args = args + ['-p', epassword] + + args.append(username) + + cc(args); + + if password is None: + cc(('passwd', '-d', username)) + + logger.info("user %s password %s", username, password) + + +class Lock(object): + """File Locking class.""" + + def __init__(self, filename): + self.filename = filename + self.handle = open(filename, 'w') + + def take(self): + # logger.debug("taking lock %s" % self.filename) + fcntl.flock(self.handle, fcntl.LOCK_EX) + # logger.debug("took lock %s" % self.filename) + + def give(self): + fcntl.flock(self.handle, fcntl.LOCK_UN) + # logger.debug("released lock %s" % self.filename) + + def __enter__(self): + self.take() + + def __exit__(self ,type, value, traceback): + self.give() + + def __del__(self): + self.handle.close() + diff --git a/tools/onlvi.py b/tools/onlvi.py new file mode 100644 index 00000000..811ff4d1 --- /dev/null +++ b/tools/onlvi.py @@ -0,0 +1,52 @@ +class OnlVersionImplementation(object): + + PRODUCTS = [ + { + "id" : "ONL", + "version": "2.0.0" + } + ] + + + def V_OS_NAME(self, data): + return "Open Network Linux OS" + + def V_BUILD_SHA1(self, data): + return data['build_sha1'] + + def V_BUILD_SHORT_SHA1(self, data): + return self.V_BUILD_SHA1(data)[0:7] + + def V_BUILD_TIMESTAMP(self, data): + return data['build_timestamp'] + + def V_FNAME_BUILD_TIMESTAMP(self, data): + return self.V_BUILD_TIMESTAMP(data).replace(':', '') + + def V_BUILD_ID(self, data): + return "%s-%s" % (self.V_BUILD_TIMESTAMP(data), self.V_BUILD_SHORT_SHA1(data)) + + def V_FNAME_BUILD_ID(self, data): + return "%s-%s" % (self.V_FNAME_BUILD_TIMESTAMP(data), self.V_BUILD_SHORT_SHA1(data)) + + def V_PRODUCT_ID_VERSION(self, data): + return data['product']['version'] + + def V_VERSION_ID(self, data): + return "ONL-%s" % (self.V_PRODUCT_ID_VERSION(data)) + + def V_FNAME_VERSION_ID(self, data): + return self.V_VERSION_ID(data) + + def V_PRODUCT_VERSION(self, data): + return "ONL-%s" % (self.V_PRODUCT_ID_VERSION(data)) + + def V_FNAME_PRODUCT_VERSION(self, data): + return "ONL-%s" % (self.V_PRODUCT_ID_VERSION(data)) + + def V_VERSION_STRING(self, data): + return "%s %s, %s" % (self.V_OS_NAME(data), self.V_VERSION_ID(data), self.V_BUILD_ID(data)) + + def V_RELEASE_ID(self, data): + return "%s,%s" % (self.V_VERSION_ID(data), self.V_BUILD_ID(data)) + diff --git a/tools/onlyaml.py b/tools/onlyaml.py new file mode 100755 index 00000000..5d1c038d --- /dev/null +++ b/tools/onlyaml.py @@ -0,0 +1,134 @@ +#!/usr/bin/python +############################################################ +# +# Extended YAML Support +# +# Supports include files and variable interpolations. +# +############################################################ +import yaml +import os +import pprint +import tempfile +from string import Template + +class OnlYamlError(Exception): + """General Error Exception""" + def __init__(self, value): + self.value = value + + def __str__(self): + return self.value + + +def loadf(fname, vard={}): + + # Apply variable interpolation: + def interpolate(s, d): + + error_string = "Yaml variable substitution error: '%s' could not be resolved." + + try: + template = Template(s) + s = template.substitute(d) + except KeyError as e: + raise OnlYamlError(error_string % (e.args[0])) + except: + raise + + return s + + variables = {} + + # Files can reference environment variables + variables.update(os.environ) + + # Files can reference their own directory. + variables['__DIR__'] = os.path.dirname(os.path.abspath(fname)) + + # Files can reference invokation parameters. + variables.update(vard) + + # Yaml Include constructor. Allows variables. + def onlyaml_include(loader, node): + # Get the path out of the yaml file + directive = node.value + fields = directive.split() + fname = fields[0] + options = fields[1:] + + for opt in options: + try: + (k,v) = opt.split('=') + except ValueError: + raise OnlYamlError("Bad include directive: %s" % opt) + variables[k] = v; + + fname = interpolate(fname, variables) + + if not os.path.isabs(fname): + fname = os.path.join(os.path.dirname(loader.name), fname) + + if not os.path.exists(fname): + raise OnlYamlError("Include file '%s' (from %s) does not exist." % (fname, loader.name)) + + return loadf(fname, variables) + + # Yaml dynamic constructor. Allow dynamically generated yaml. + def onlyaml_script(loader, node): + directive = interpolate(node.value, variables) + tf = tempfile.NamedTemporaryFile() + tf.close() + if os.system("%s > %s" % (directive, tf.name)) != 0: + raise OnlYamlError("Script execution '%s' failed." % directive) + return loadf(tf.name, variables) + + + yaml.add_constructor("!include", onlyaml_include) + yaml.add_constructor("!script", onlyaml_script) + + # First load: grab the variables dict + string = open(fname).read() + try: + data = yaml.load(string) + except Exception, e: + raise OnlYamlError("%s\n(filename: %s)" % (e, fname)) + + if type(data) is dict: + variables.update(data.get('variables', {})) + + for (k,v) in data.get('variables', {}).iteritems(): + k = interpolate(k, variables) + v = interpolate(v, variables) + variables[k] = v + + + ############################################################ + # + # Interpolate the entire package contents using the + # generated variables dict and reload it. + # + ############################################################ + string = interpolate(string, variables) + + try: + data = yaml.load(string) + except OnlYamlError, e: + raise e + except Exception, e: + raise OnlYamlError("Interpolation produced invalid results:\n%s\n" % string) + + return data + + +if __name__ == '__main__': + import sys + try: + if len(sys.argv) == 2: + print yaml.dump(loadf(sys.argv[1])) + else: + sys.stderr.write("usage: %s \n" % sys.argv[0]) + except OnlYamlError, e: + sys.stderr.write("error: %s\n" % e.value) + + diff --git a/tools/scripts/apply-patches.sh b/tools/scripts/apply-patches.sh new file mode 100755 index 00000000..d6cbf160 --- /dev/null +++ b/tools/scripts/apply-patches.sh @@ -0,0 +1,50 @@ +#! /bin/sh +############################################################ +# +# +# Copyright 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# +# +############################################################ +set -e + +KERNDIR=$1 +PATCHDIR=$2 + +if [ -f "${PATCHDIR}/series" ]; then + # + # The series file contains the patch order. + # + for p in `cat ${PATCHDIR}/series`; do + echo "Appying ${p}..." + patch --batch -p 1 -d ${KERNDIR} < "${PATCHDIR}/${p}" + done +else + # + # Patch order is implied by filenames. + # + for p in `ls ${PATCHDIR}/*.patch | sort`; do + echo "Applying ${p}..." + patch --batch -p 1 -d ${KERNDIR} < ${p} + done +fi + + + diff --git a/tools/scripts/kmodcopy.sh b/tools/scripts/kmodcopy.sh new file mode 100755 index 00000000..69610830 --- /dev/null +++ b/tools/scripts/kmodcopy.sh @@ -0,0 +1,24 @@ +#!/bin/bash +############################################################ +# +# This script will copy the given kernel module +# into the appropriately versioned subdirectory. +# +# $1 is the source kernel module +# $2 is the destination base directory. +# +# The file will be copied into $2/$(modver)/$1 +# +############################################################ +set -ex + +srcfile=$1 +dstroot=$2 +modver=`/sbin/modinfo -F vermagic $1 | awk '{ print $1 }'` +dstdir="${dstroot}/${modver}" +mkdir -p "${dstdir}" +cp "${srcfile}" "${dstdir}" + + + + diff --git a/tools/scripts/make-cpio.sh b/tools/scripts/make-cpio.sh new file mode 100755 index 00000000..addff78a --- /dev/null +++ b/tools/scripts/make-cpio.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + +if [ "${UID}" != 0 ]; then + exec sudo $0 "$@" +fi + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "usage: $0 src-dir dst-cpio-gz-file" + exit 1 +fi + +SRCDIR=`readlink -f $1` +DSTCPIOGZ=`readlink -f $2` + +if [ ! -d "$SRCDIR" ]; then + echo "src-dir does not exist or is not a directory." + exit 1 +fi + +if [ -e "$DSTCPIOGZ" ]; then + echo "Removing existing $DSTCPIOGZ" +fi + +cd "$SRCDIR" && find . | cpio -H newc -o | gzip -f > "$DSTCPIOGZ" diff --git a/tools/scripts/manifest.sh b/tools/scripts/manifest.sh new file mode 100755 index 00000000..59f1e74f --- /dev/null +++ b/tools/scripts/manifest.sh @@ -0,0 +1,26 @@ +#!/bin/bash +############################################################ +# +# Make sure the local module manifest.mk is generated. +# +############################################################ +ONL=$1 +BUILDER=$2 +QUIET=$3 + +if [ -z "$ONL" ] || [ -z "$BUILDER" ]; then + echo "usage: $0 onl-dir builder-dir" + exit 1 +fi + +if [ ! -f "$ONL/.manifest.mk" ]; then + cd "$ONL" && "$BUILDER/tools/manifesttool.py" make + mv "$ONL/Manifest.mk" "$ONL/.manifest.mk" +fi + +if [ -z "$QUIET" ]; then + echo "$ONL/.manifest.mk" +fi + + + diff --git a/tools/scripts/onlpm b/tools/scripts/onlpm new file mode 100755 index 00000000..03ac60ce --- /dev/null +++ b/tools/scripts/onlpm @@ -0,0 +1,8 @@ +#!/bin/sh +############################################################ +# +# Invoke onlpm.py in the local directory. +# +############################################################ +ONLPM_PY=${ONLPM_PY:-onlpm.py} +$ONLPM_PY "$@" diff --git a/tools/scripts/submodule-updated.sh b/tools/scripts/submodule-updated.sh new file mode 100755 index 00000000..f1e166ce --- /dev/null +++ b/tools/scripts/submodule-updated.sh @@ -0,0 +1,26 @@ +#!/bin/bash +############################################################ +# +# This script is called whenever a submodule is updated +# in the repository. +# +# When a submodule is updated there are two things that need +# to happen: +# +# 1. The module manifest needs to be regenerated. +# 2. The package cache needs to be regenerated. +# +############################################################ + +# Removing the manifest causes it to be regenerated. +rm -rf $ONL/.manifest.mk + +# Rebuild pkg cache +onlpm.py --rebuild-pkg-cache + + + + + + + diff --git a/tools/scripts/tree-copy.sh b/tools/scripts/tree-copy.sh new file mode 100755 index 00000000..071413bb --- /dev/null +++ b/tools/scripts/tree-copy.sh @@ -0,0 +1,35 @@ +#!/bin/bash +############################################################ +# +# +# Copyright 2015 Big Switch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +# +# Simple tree copy preserving paths. +# Similar to 'cp --parents' but works with absolute src +# and destination paths. +# +############################################################ +SRCDIR=$1 +SRCPATH=$2 +DSTDIR=$3 +DSTPATH=$(dirname "${SRCPATH}") + +echo "Copying tree ${SRCPATH}..." +mkdir -p "${DSTDIR}/${DSTPATH}" +cp -R "${SRCDIR}/${SRCPATH}" "${DSTDIR}/${DSTPATH}" diff --git a/tools/sjson.py b/tools/sjson.py new file mode 100755 index 00000000..12b7917f --- /dev/null +++ b/tools/sjson.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +############################################################ +# +# Simple JSON Generator +# +############################################################ +import argparse +import json +import os +import sys + + +def setkeypath(d, kvt): + """Set a key tree to a value in the given dict. + + The key tree is specified as k1.k2..kN-1.kN""" + + (key, value) = kvt + ktree = key.split('.') + for k in ktree: + if k == ktree[-1]: + d[k] = value + return + elif k not in d: + d[k] = {} + + d = d[k] + + +ap=argparse.ArgumentParser(description="Simple JSON Generator.") + +ap.add_argument("--kj", nargs=2, metavar=('KEY', 'FILE|STR'), help="Add json data.") +ap.add_argument("--kv", nargs=2, metavar=('KEY', 'VALUE'), help="Add key/value pair.") +ap.add_argument("--kl", nargs='+', metavar=('KEY', 'ENTRY'), help="Add key/list pair.") +ap.add_argument("--out", metavar='FILENAME', help="Write output to the given file. The default is stdout") +ap.add_argument("--indent", nargs=1, help="Json output indentation value. Default is 2", default=2) +ap.add_argument("--no-nl", action='store_true', help="No newline at the end of the output.") +ops = ap.parse_args(); + + +g_data={} + +if ops.kj: + (k, j) = ops.kj + if os.path.exists(j): + v = json.load(open(j)) + else: + v = json.loads(j) + setkeypath(g_data, (k, v)) + +if ops.kv: + setkeypath(g_data, ops.kv) + +if ops.kl: + k = ops.kl.pop(0) + setkeypath(g_data, (k, ops.kl)) + +out=sys.stdout +if ops.out and ops.out not in ['-', 'stdout']: + print ops.out + out = open(ops.out, "w") + +json.dump(g_data, out, indent=ops.indent) +if not ops.no_nl: + out.write('\n') + diff --git a/tools/submodules.py b/tools/submodules.py new file mode 100755 index 00000000..991178c4 --- /dev/null +++ b/tools/submodules.py @@ -0,0 +1,137 @@ +#!/usr/bin/python +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# +# Submodule management. +# +############################################################ +import os +import sys +import subprocess +import shutil +import logging + +logging.basicConfig() +logger = logging.getLogger("submodules") +logger.setLevel(logging.INFO) + + +def check_call(cmd, *args, **kwargs): + if type(cmd) == str: + logger.debug("+ " + cmd) + else: + logger.debug("+ " + " ".join(cmd)) + return subprocess.check_call(cmd, *args, **kwargs) + +def check_output(cmd, *args, **kwargs): + if type(cmd) == str: + logger.debug("+ " + cmd) + else: + logger.debug("+ " + " ".join(cmd)) + return subprocess.check_output(cmd, *args, **kwargs) + + +class OnlSubmoduleError(Exception): + """General Package Error Exception""" + + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + +class OnlSubmoduleManager(object): + def __init__(self, root): + if not os.path.exists(os.path.join(root, ".git")): + raise OnlSubmoduleError("%s is not a git repository." % root) + if not os.path.exists(os.path.join(root, ".gitmodules")): + raise OnlSubmoduleError("The git repository %s does not contain any submodules." % root) + + self.root = root + self.get_status() + + def get_status(self): + self.status = {} + try: + for entry in check_output(['git', 'submodule', 'status'], cwd=self.root).split("\n"): + data = entry.split() + if len(data) >= 2: + self.status[data[1]] = data[0] + except subprocess.CalledProcessError: + raise OnlSubmoduleError("git command(s) failed") + + + def validate(self, path): + if not path in self.status: + raise OnlSubmoduleError("Submodule %s does not exist in repository %s" % (path, self.root)) + + def update(self, path, depth=None, recursive=False): + self.validate(path) + + if depth: + logger.debug("shallow clone depth=%d", int(depth)) + # Shallow clone first + url = check_output(['git', 'config', '-f', '.gitmodules', '--get', + 'submodule.' + path + '.url' ], cwd=self.root) + url = url.rstrip('\n') + args = [ 'git', 'clone', '--depth', depth, url, path ] + try: + check_call(args, cwd=self.root) + except subprocess.CalledProcessError: + raise OnlSubmoduleError("git error cloning module %s" % path) + + # full or partial update + args = [ 'git', 'submodule', 'update', '--init' ] + if recursive: + args.append("--recursive") + args.append(path) + try: + check_call(args, cwd=self.root) + except subprocess.CalledProcessError: + raise OnlSubmoduleError("git error updating module %s" % path) + + + # + # Run any repository-specific post-submodule-init scripts. + # + script = os.path.join(self.root, 'tools', 'scripts', 'submodule-updated.sh') + if os.path.exists(script): + try: + check_call([script, path], cwd=self.root) + except subprocess.CalledProcessError: + # Target doesn't exists + raise OnlSubmoduleError("The repository post-init script %s failed." % script) + + + def require(self, path, depth=None, recursive=False): + self.get_status() + self.validate(path) + if self.status[path][0] == '-': + self.update(path, depth=depth, recursive=recursive) + + +if __name__ == '__main__': + + import argparse + ap = argparse.ArgumentParser(description='Submodule Manager') + + ap.add_argument("root", help="The root of the git repository in which to operate.") + ap.add_argument("path", help="The submodule path to initialize.") + ap.add_argument("--depth", help="Shallow submodule clone to given depth.") + ap.add_argument("--recursive", help="Recursive update.", action='store_true') + + ops = ap.parse_args() + + try: + sm = OnlSubmoduleManager(ops.root) + sm.require(ops.path) + except OnlSubmoduleError, e: + logger.error("%s" % e.value) +