├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── init.mk
├── modules
├── Makefile
├── Manifest.mk
├── onlp
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlp.yml
│ │ ├── inc
│ │ │ └── onlp
│ │ │ │ ├── fan.h
│ │ │ │ ├── led.h
│ │ │ │ ├── oids.h
│ │ │ │ ├── onlp.h
│ │ │ │ ├── onlp.x
│ │ │ │ ├── onlp_config.h
│ │ │ │ ├── onlp_dox.h
│ │ │ │ ├── onlp_porting.h
│ │ │ │ ├── platformi
│ │ │ │ ├── fani.h
│ │ │ │ ├── ledi.h
│ │ │ │ ├── psui.h
│ │ │ │ ├── sfpi.h
│ │ │ │ ├── sysi.h
│ │ │ │ └── thermali.h
│ │ │ │ ├── psu.h
│ │ │ │ ├── sfp.h
│ │ │ │ ├── sys.h
│ │ │ │ └── thermal.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── Makefile
│ │ │ ├── fan.c
│ │ │ ├── led.c
│ │ │ ├── make.mk
│ │ │ ├── oids.c
│ │ │ ├── onlp.c
│ │ │ ├── onlp_config.c
│ │ │ ├── onlp_enums.c
│ │ │ ├── onlp_int.h
│ │ │ ├── onlp_json.c
│ │ │ ├── onlp_json.h
│ │ │ ├── onlp_locks.c
│ │ │ ├── onlp_locks.h
│ │ │ ├── onlp_log.c
│ │ │ ├── onlp_log.h
│ │ │ ├── onlp_main.c
│ │ │ ├── onlp_module.c
│ │ │ ├── onlp_ucli.c
│ │ │ ├── onlp_util.c
│ │ │ ├── platform_dump.c
│ │ │ ├── platform_manager.c
│ │ │ ├── psu.c
│ │ │ ├── sfp.c
│ │ │ ├── sys.c
│ │ │ └── thermal.c
│ ├── onlp.doxy
│ ├── onlp.mk
│ └── utest
│ │ ├── _make.mk
│ │ └── main.c
├── onlp_platform_defaults
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlp_platform_defaults.yml
│ │ ├── inc
│ │ │ └── onlp_platform_defaults
│ │ │ │ ├── onlp_platform_defaults.x
│ │ │ │ ├── onlp_platform_defaults_config.h
│ │ │ │ ├── onlp_platform_defaults_dox.h
│ │ │ │ └── onlp_platform_defaults_porting.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── fani.c
│ │ │ ├── ledi.c
│ │ │ ├── make.mk
│ │ │ ├── onlp_platform_defaults_config.c
│ │ │ ├── onlp_platform_defaults_enums.c
│ │ │ ├── onlp_platform_defaults_int.h
│ │ │ ├── onlp_platform_defaults_log.c
│ │ │ ├── onlp_platform_defaults_log.h
│ │ │ ├── onlp_platform_defaults_module.c
│ │ │ ├── psui.c
│ │ │ ├── sfpi.c
│ │ │ ├── sysi.c
│ │ │ └── thermali.c
│ ├── onlp_platform_defaults.doxy
│ ├── onlp_platform_defaults.mk
│ └── utest
│ │ ├── _make.mk
│ │ └── main.c
├── onlp_snmp
│ ├── .gitignore
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlp_snmp.yml
│ │ ├── inc
│ │ │ └── onlp_snmp
│ │ │ │ ├── onlp_snmp.h
│ │ │ │ ├── onlp_snmp.x
│ │ │ │ ├── onlp_snmp_config.h
│ │ │ │ ├── onlp_snmp_dox.h
│ │ │ │ ├── onlp_snmp_platform_oids.h
│ │ │ │ ├── onlp_snmp_porting.h
│ │ │ │ ├── onlp_snmp_sensor_oids.h
│ │ │ │ └── onlp_snmp_sensors.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── Makefile
│ │ │ ├── make.mk
│ │ │ ├── onlp_snmp_config.c
│ │ │ ├── onlp_snmp_enums.c
│ │ │ ├── onlp_snmp_int.h
│ │ │ ├── onlp_snmp_log.c
│ │ │ ├── onlp_snmp_log.h
│ │ │ ├── onlp_snmp_module.c
│ │ │ ├── onlp_snmp_sensors.c
│ │ │ └── onlp_snmp_ucli.c
│ └── onlp_snmp.doxy
├── onlpie
│ ├── .gitignore
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlpie.yml
│ │ ├── inc
│ │ │ └── onlpie
│ │ │ │ ├── onlpie.x
│ │ │ │ ├── onlpie_config.h
│ │ │ │ ├── onlpie_dox.h
│ │ │ │ └── onlpie_porting.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── Makefile
│ │ │ ├── fani.c
│ │ │ ├── ledi.c
│ │ │ ├── make.mk
│ │ │ ├── onlpie_config.c
│ │ │ ├── onlpie_enums.c
│ │ │ ├── onlpie_int.h
│ │ │ ├── onlpie_log.c
│ │ │ ├── onlpie_log.h
│ │ │ ├── onlpie_module.c
│ │ │ ├── onlpie_ucli.c
│ │ │ ├── psui.c
│ │ │ ├── sfpi.c
│ │ │ ├── sysi.c
│ │ │ └── thermali.c
│ ├── onlpie.doxy
│ └── utest
│ │ ├── _make.mk
│ │ └── main.c
├── onlplib
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlplib.yml
│ │ ├── inc
│ │ │ └── onlplib
│ │ │ │ ├── crc32.h
│ │ │ │ ├── file.h
│ │ │ │ ├── gpio.h
│ │ │ │ ├── i2c.h
│ │ │ │ ├── mmap.h
│ │ │ │ ├── onie.h
│ │ │ │ ├── onlplib.x
│ │ │ │ ├── onlplib_config.h
│ │ │ │ ├── onlplib_dox.h
│ │ │ │ ├── onlplib_porting.h
│ │ │ │ ├── pi.h
│ │ │ │ ├── sfp.h
│ │ │ │ ├── shlocks.h
│ │ │ │ ├── thermal.h
│ │ │ │ └── util.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── crc32.c
│ │ │ ├── file.c
│ │ │ ├── gpio.c
│ │ │ ├── i2c.c
│ │ │ ├── make.mk
│ │ │ ├── mmap.c
│ │ │ ├── onie.c
│ │ │ ├── onlplib_config.c
│ │ │ ├── onlplib_enums.c
│ │ │ ├── onlplib_int.h
│ │ │ ├── onlplib_log.c
│ │ │ ├── onlplib_log.h
│ │ │ ├── onlplib_module.c
│ │ │ ├── pi.c
│ │ │ ├── sfp.c
│ │ │ ├── shlocks.c
│ │ │ └── thermal.c
│ ├── onlplib.doxy
│ ├── onlplib.mk
│ └── utest
│ │ ├── _make.mk
│ │ └── main.c
├── onlpsim
│ ├── .gitignore
│ ├── Makefile
│ ├── README
│ ├── module
│ │ ├── auto
│ │ │ ├── make.mk
│ │ │ └── onlpsim.yml
│ │ ├── inc
│ │ │ └── onlpsim
│ │ │ │ ├── onlpsim.x
│ │ │ │ ├── onlpsim_config.h
│ │ │ │ ├── onlpsim_dox.h
│ │ │ │ └── onlpsim_porting.h
│ │ ├── make.mk
│ │ └── src
│ │ │ ├── Makefile
│ │ │ ├── fani.c
│ │ │ ├── ledi.c
│ │ │ ├── make.mk
│ │ │ ├── onlpsim_config.c
│ │ │ ├── onlpsim_enums.c
│ │ │ ├── onlpsim_int.h
│ │ │ ├── onlpsim_log.c
│ │ │ ├── onlpsim_log.h
│ │ │ ├── onlpsim_module.c
│ │ │ ├── onlpsim_ucli.c
│ │ │ ├── psui.c
│ │ │ ├── sfpi.c
│ │ │ ├── sysi.c
│ │ │ └── thermali.c
│ └── onlpsim.doxy
└── sff
│ ├── Makefile
│ ├── README
│ ├── module
│ ├── auto
│ │ ├── make.mk
│ │ └── sff.yml
│ ├── inc
│ │ └── sff
│ │ │ ├── 8436.h
│ │ │ ├── 8472.h
│ │ │ ├── 8636.h
│ │ │ ├── sff.h
│ │ │ ├── sff.x
│ │ │ ├── sff_config.h
│ │ │ ├── sff_db.h
│ │ │ ├── sff_dox.h
│ │ │ └── sff_porting.h
│ ├── make.mk
│ └── src
│ │ ├── 8472.c
│ │ ├── Makefile
│ │ ├── make.mk
│ │ ├── sff.c
│ │ ├── sff_config.c
│ │ ├── sff_db.c
│ │ ├── sff_enums.c
│ │ ├── sff_int.h
│ │ ├── sff_log.c
│ │ ├── sff_log.h
│ │ ├── sff_module.c
│ │ └── sff_tool.c
│ ├── sff.doxy
│ ├── sff.mk
│ └── utest
│ ├── _make.mk
│ └── main.c
├── targets
├── .gitignore
├── Makefile
├── mtool
│ ├── .gitignore
│ ├── Makefile
│ └── main.c
├── platform-simulation
│ ├── Makefile
│ ├── lib
│ │ ├── .gitignore
│ │ └── Makefile
│ └── onlpdump
│ │ ├── .gitignore
│ │ └── Makefile
├── sfftool
│ ├── .gitignore
│ └── Makefile
└── utests
│ ├── Makefile
│ ├── onlp
│ └── Makefile
│ ├── onlp_platform_defaults
│ └── Makefile
│ ├── onlpie
│ └── Makefile
│ ├── onlplib
│ └── Makefile
│ └── sff
│ └── Makefile
└── tools
├── infra.py
└── newmodule.py
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "submodules/infra"]
2 | path = submodules/infra
3 | url = git@github.com:floodlight/infra
4 | [submodule "submodules/bigcode"]
5 | path = submodules/bigcode
6 | url = git@github.com:floodlight/bigcode
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Open Network Linux Platform Infrastructure Repository
2 | =====================================================
3 |
4 | Submodule that contains hardware platform APIs and drivers.
5 |
6 | See PortingGuide in main ONL distribution for more documentation.
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/init.mk:
--------------------------------------------------------------------------------
1 | ################################################################
2 | #
3 | #
4 | # Copyright 2013, 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ################################################################
21 |
22 | #
23 | # The root of of our repository is here:
24 | #
25 | ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
26 |
27 | #
28 | # Resolve submodule dependencies.
29 | #
30 | ifndef SUBMODULE_INFRA
31 | ifdef SUBMODULES
32 | SUBMODULE_INFRA := $(SUBMODULES)/infra
33 | else
34 | SUBMODULE_INFRA := $(ROOT)/submodules/infra
35 | endif
36 | endif
37 |
38 | ifndef SUBMODULE_BIGCODE
39 | ifdef SUBMODULES
40 | SUBMODULE_BIGCODE := $(SUBMODULES)/bigcode
41 | else
42 | SUBMODULE_BIGCODE := $(ROOT)/submodules/bigcode
43 | endif
44 | endif
45 |
46 | export SUBMODULE_INFRA
47 | export BUILDER := $(SUBMODULE_INFRA)/builder/unix
48 |
49 | MODULE_DIRS := $(ROOT)/modules $(SUBMODULE_INFRA)/modules $(SUBMODULE_BIGCODE)/modules
50 |
51 | .show-submodules:
52 | @echo infra @ $(SUBMODULE_INFRA)
53 | @echo bigcode @ $(SUBMODULE_BIGCODE)
54 |
55 | #
56 | # These are the subdirectories in the current directory
57 | #
58 | ifdef MAKESUBDIRS
59 | ifndef SUBDIRS
60 | SUBDIRS=$(patsubst %/,%, $(wildcard */))
61 | endif
62 | makesubdirs $(MAKECMDGOALS):
63 | @$(foreach d,$(SUBDIRS), test ! -f $(d)/Makefile || $(MAKE) -C $(d) $(MAKECMDGOALS) || exit 1;)
64 | endif
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/modules/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ################################################################
21 | include ../init.mk
22 |
23 | -include Manifest.mk
24 |
25 | include $(BUILDER)/moduledir.mk
26 |
27 | #
28 | # Available targets
29 | #
30 | moduledir_show_targets::
31 | @echo " autogen Make autogen in all modules."
32 |
33 | autogen:
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/modules/Manifest.mk:
--------------------------------------------------------------------------------
1 |
2 | ##############################################################################
3 | #
4 | # Builder Module Manifest.
5 | #
6 | # Autogenerated 2016-02-19 15:48:59.903189
7 | #
8 | ##############################################################################
9 | BASEDIR := $(dir $(lastword $(MAKEFILE_LIST)))
10 | onlp_BASEDIR := $(BASEDIR)onlp
11 | onlp_platform_defaults_BASEDIR := $(BASEDIR)onlp_platform_defaults
12 | onlp_snmp_BASEDIR := $(BASEDIR)onlp_snmp
13 | onlpie_BASEDIR := $(BASEDIR)onlpie
14 | onlplib_BASEDIR := $(BASEDIR)onlplib
15 | onlpsim_BASEDIR := $(BASEDIR)onlpsim
16 | sff_BASEDIR := $(BASEDIR)sff
17 |
18 |
19 | ALL_MODULES := $(ALL_MODULES) onlp onlp_platform_defaults onlp_snmp onlpie onlplib onlpsim sff
20 |
--------------------------------------------------------------------------------
/modules/onlp/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../init.mk
27 | MODULE := onlp
28 | AUTOMODULE := onlp
29 | include $(BUILDER)/definemodule.mk
30 |
--------------------------------------------------------------------------------
/modules/onlp/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlp README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlp/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlp Autogeneration
23 | #
24 | ############################################################
25 |
26 | onlp_AUTO_DEFS := module/auto/onlp.yml
27 | onlp_AUTO_DIRS := module/inc/onlp module/src
28 | include $(BUILDER)/auto.mk
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlp/module/inc/onlp/onlp.x:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 |
29 | /* */
30 | #ifdef ONLP_OID_TYPE_ENTRY
31 | ONLP_OID_TYPE_ENTRY(SYS, 1)
32 | ONLP_OID_TYPE_ENTRY(THERMAL, 2)
33 | ONLP_OID_TYPE_ENTRY(FAN, 3)
34 | ONLP_OID_TYPE_ENTRY(PSU, 4)
35 | ONLP_OID_TYPE_ENTRY(LED, 5)
36 | ONLP_OID_TYPE_ENTRY(MODULE, 6)
37 | ONLP_OID_TYPE_ENTRY(RTC, 7)
38 | #undef ONLP_OID_TYPE_ENTRY
39 | #endif
40 | /* */
41 |
42 | /* */
43 | #ifdef ONLP_ENUMERATION_ENTRY
44 | ONLP_ENUMERATION_ENTRY(onlp_fan_caps, "")
45 | ONLP_ENUMERATION_ENTRY(onlp_fan_dir, "")
46 | ONLP_ENUMERATION_ENTRY(onlp_fan_mode, "")
47 | ONLP_ENUMERATION_ENTRY(onlp_fan_status, "")
48 | ONLP_ENUMERATION_ENTRY(onlp_led_caps, "")
49 | ONLP_ENUMERATION_ENTRY(onlp_led_mode, "")
50 | ONLP_ENUMERATION_ENTRY(onlp_led_status, "")
51 | ONLP_ENUMERATION_ENTRY(onlp_oid_type, "")
52 | ONLP_ENUMERATION_ENTRY(onlp_psu_caps, "")
53 | ONLP_ENUMERATION_ENTRY(onlp_psu_status, "")
54 | ONLP_ENUMERATION_ENTRY(onlp_sfp_control, "")
55 | ONLP_ENUMERATION_ENTRY(onlp_sfp_control_flag, "")
56 | ONLP_ENUMERATION_ENTRY(onlp_status, "")
57 | ONLP_ENUMERATION_ENTRY(onlp_thermal_caps, "")
58 | ONLP_ENUMERATION_ENTRY(onlp_thermal_status, "")
59 | ONLP_ENUMERATION_ENTRY(onlp_thermal_threshold, "")
60 | #undef ONLP_ENUMERATION_ENTRY
61 | #endif
62 | /* */
63 |
64 |
65 |
--------------------------------------------------------------------------------
/modules/onlp/module/inc/onlp/onlp_dox.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_DOX_H__
26 | #define __ONLP_DOX_H__
27 |
28 | /**
29 | * @defgroup onlp onlp - onlp Description
30 | *
31 |
32 | The documentation overview for this module should go here.
33 |
34 | *
35 | * @{
36 | *
37 | * @defgroup onlp-onlp Public Interface
38 | * @defgroup onlp-config Compile Time Configuration
39 | * @defgroup onlp-porting Porting Macros
40 | *
41 | * @}
42 | *
43 | */
44 |
45 | #endif /* __ONLP_DOX_H__ */
46 |
--------------------------------------------------------------------------------
/modules/onlp/module/inc/onlp/platformi/ledi.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * LED Platform Implementation.
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_LEDI_H__
26 | #define __ONLP_LEDI_H__
27 |
28 | #include
29 |
30 | /**
31 | * @brief Initialize the LED subsystem.
32 | */
33 | int onlp_ledi_init(void);
34 |
35 | /**
36 | * @brief Get the information for the given LED
37 | * @param id The LED OID
38 | * @param rv [out] Receives the LED information.
39 | */
40 | int onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* rv);
41 |
42 | /**
43 | * @brief Get the LED operational status.
44 | * @param id The LED OID
45 | * @param rv [out] Receives the operational status.
46 | */
47 | int onlp_ledi_status_get(onlp_oid_t id, uint32_t* rv);
48 |
49 | /**
50 | * @brief Get the LED header.
51 | * @param id The LED OID
52 | * @param rv [out] Receives the header.
53 | */
54 | int onlp_ledi_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv);
55 |
56 | /**
57 | * @brief Turn an LED on or off
58 | * @param id The LED OID
59 | * @param on_or_off (boolean) on if 1 off if 0
60 | * @param This function is only relevant if the ONOFF capability is set.
61 | * @notes See onlp_led_set() for a description of the default behavior.
62 | */
63 | int onlp_ledi_set(onlp_oid_t id, int on_or_off);
64 |
65 | /**
66 | * @brief LED ioctl
67 | * @param id The LED OID
68 | * @param vargs The variable argument list for the ioctl call.
69 | */
70 | int onlp_ledi_ioctl(onlp_oid_t id, va_list vargs);
71 |
72 | /**
73 | * @brief Set the LED mode.
74 | * @param id The LED OID
75 | * @param mode The new mode.
76 | * @notes Only called if the mode is advertised in the LED capabilities.
77 | */
78 | int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode);
79 |
80 | /**
81 | * @brief Set the LED character.
82 | * @param id The LED OID
83 | * @param c The character..
84 | * @notes Only called if the char capability is set.
85 | */
86 | int onlp_ledi_char_set(onlp_oid_t id, char c);
87 | #endif /* __ONLP_LED_H__ */
88 |
--------------------------------------------------------------------------------
/modules/onlp/module/inc/onlp/platformi/psui.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Power Supply Management Implementation.
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_PSUI_H__
26 | #define __ONLP_PSUI_H__
27 |
28 | #include
29 |
30 | /**
31 | * @brief Initialize the PSU subsystem.
32 | */
33 | int onlp_psui_init(void);
34 |
35 | /**
36 | * @brief Get the information structure for the given PSU
37 | * @param id The PSU OID
38 | * @param rv [out] Receives the PSU information.
39 | */
40 | int onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* rv);
41 |
42 | /**
43 | * @brief Get the PSU's operational status.
44 | * @param id The PSU OID.
45 | * @param rv [out] Receives the operational status.
46 | */
47 | int onlp_psui_status_get(onlp_oid_t id, uint32_t* rv);
48 |
49 | /**
50 | * @brief Get the PSU's oid header.
51 | * @param id The PSU OID.
52 | * @param rv [out] Receives the header.
53 | */
54 | int onlp_psui_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv);
55 |
56 | /**
57 | * @brief Generic PSU ioctl
58 | * @param id The PSU OID
59 | * @param vargs The variable argument list for the ioctl call.
60 | */
61 | int onlp_psui_ioctl(onlp_oid_t pid, va_list vargs);
62 |
63 |
64 | #endif /* __ONLP_PSUI_H__ */
65 |
--------------------------------------------------------------------------------
/modules/onlp/module/inc/onlp/platformi/thermali.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Thermal Sensor Platform Implementation.
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_THERMALI_H__
26 | #define __ONLP_THERMALI_H__
27 |
28 | #include
29 |
30 | /**
31 | * @brief Initialize the thermal subsystem.
32 | */
33 | int onlp_thermali_init(void);
34 |
35 |
36 | /**
37 | * @brief Get the information for the given thermal OID.
38 | * @param id The Thermal OID
39 | * @param rv [out] Receives the thermal information.
40 | */
41 | int onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv);
42 |
43 | /**
44 | * @brief Retrieve the thermal's operational status.
45 | * @param id The thermal oid.
46 | * @param rv [out] Receives the operational status.
47 | */
48 | int onlp_thermali_status_get(onlp_oid_t id, uint32_t* rv);
49 |
50 | /**
51 | * @brief Retrieve the thermal's oid header.
52 | * @param id The thermal oid.
53 | * @param rv [out] Receives the header.
54 | */
55 | int onlp_thermali_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv);
56 |
57 | /**
58 | * @brief Generic ioctl.
59 | */
60 | int onlp_thermali_ioctl(int id, va_list vargs);
61 |
62 | #endif /* __ONLP_THERMALI_H__ */
63 |
--------------------------------------------------------------------------------
/modules/onlp/module/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
27 | onlp_INCLUDES := -I $(THIS_DIR)inc
28 | onlp_INTERNAL_INCLUDES := -I $(THIS_DIR)src
29 | onlp_DEPENDMODULE_ENTRIES := init:onlp ucli:onlp
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # Local source generation targets.
23 | #
24 | ############################################################
25 | include ../../../../init.mk
26 |
27 | ucli:
28 | $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlp_ucli.c
29 |
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | LIBRARY := onlp
26 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
27 | include $(BUILDER)/lib.mk
28 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 |
35 | #include "onlp_int.h"
36 | #include "onlp_json.h"
37 | #include "onlp_locks.h"
38 |
39 | int
40 | onlp_init(void)
41 | {
42 | extern void __onlp_module_init__(void);
43 | __onlp_module_init__();
44 |
45 | char* cfile;
46 |
47 | if( (cfile=getenv(ONLP_CONFIG_CONFIGURATION_ENV)) == NULL) {
48 | cfile = ONLP_CONFIG_CONFIGURATION_FILENAME;
49 | }
50 |
51 | #if ONLP_CONFIG_INCLUDE_API_LOCK == 1
52 | onlp_api_lock_init();
53 | #endif
54 |
55 |
56 | onlp_json_init(cfile);
57 | onlp_sys_init();
58 | onlp_sfp_init();
59 | onlp_led_init();
60 | onlp_psu_init();
61 | onlp_fan_init();
62 | onlp_thermal_init();
63 | return 0;
64 | }
65 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_int.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_INT_H__
26 | #define __ONLP_INT_H__
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include "onlp_json.h"
34 |
35 | /** Default IOF initializations for dump() and show() routines */
36 | void onlp_oid_show_iof_init_default(iof_t* iof, aim_pvs_t* pvs, uint32_t flags);
37 | void onlp_oid_dump_iof_init_default(iof_t* iof, aim_pvs_t* pvs);
38 |
39 | /** Default error message when the status of an OID cannot be retreived */
40 | void onlp_oid_info_get_error(iof_t* iof, int error);
41 |
42 | /** Standard OID description output */
43 | void onlp_oid_show_description(iof_t* iof, onlp_oid_hdr_t* hdr);
44 | /** Standard message when an OID is missing. */
45 | void onlp_oid_show_state_missing(iof_t* iof);
46 |
47 | #endif /* __ONLP_INT_H__ */
48 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_json.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include "onlp_json.h"
26 | #include "onlp_log.h"
27 | #include
28 |
29 | static cJSON* root__ = NULL;
30 | static char* file__ = NULL;
31 |
32 | void
33 | onlp_json_init(const char* fname)
34 | {
35 | int rv;
36 | onlp_json_denit();
37 |
38 | rv = cjson_util_parse_file(fname, &root__);
39 | if(rv < 0 || root__ == NULL) {
40 | root__ = cJSON_Parse("{}");
41 | }
42 | else {
43 | file__ = aim_strdup(fname);
44 | }
45 |
46 | }
47 |
48 | cJSON*
49 | onlp_json_get(int reload)
50 | {
51 | if(reload) {
52 | onlp_json_init(file__);
53 | }
54 | return root__;
55 | }
56 |
57 | void
58 | onlp_json_denit(void)
59 | {
60 | if(root__) {
61 | cJSON_Delete(root__);
62 | root__ = NULL;
63 | }
64 | if(file__) {
65 | aim_free(file__);
66 | file__ = NULL;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_json.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLP_JSON_H__
27 | #define __ONLP_JSON_H__
28 |
29 | #include
30 | #include "onlp_int.h"
31 | #include
32 |
33 | /**
34 | * @brief Initialize the JSON configuration data.
35 | * @param fname JSON configuration filename.
36 | */
37 | void onlp_json_init(const char* fname);
38 |
39 | /**
40 | * @brief Get the JSON configuration root.
41 | * @param reload Option to reload the config file first.
42 | */
43 | cJSON* onlp_json_get(int reload);
44 |
45 | void onlp_json_denit(void);
46 |
47 |
48 | #endif /* __ONLP_JSON_H__ */
49 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_log.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlp_log.h"
29 | /*
30 | * onlp log struct.
31 | */
32 | AIM_LOG_STRUCT_DEFINE(
33 | ONLP_CONFIG_LOG_OPTIONS_DEFAULT,
34 | ONLP_CONFIG_LOG_BITS_DEFAULT,
35 | NULL, /* Custom log map */
36 | ONLP_CONFIG_LOG_CUSTOM_BITS_DEFAULT
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_log.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLP_LOG_H__
27 | #define __ONLP_LOG_H__
28 |
29 | #define AIM_LOG_MODULE_NAME onlp
30 | #include
31 |
32 | #endif /* __ONLP_LOG_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_ucli.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #if ONLP_CONFIG_INCLUDE_UCLI == 1
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | static ucli_status_t
35 | onlp_ucli_ucli__config__(ucli_context_t* uc)
36 | {
37 | UCLI_HANDLER_MACRO_MODULE_CONFIG(onlp)
38 | }
39 |
40 | /* */
41 | /******************************************************************************
42 | *
43 | * These handler table(s) were autogenerated from the symbols in this
44 | * source file.
45 | *
46 | *****************************************************************************/
47 | static ucli_command_handler_f onlp_ucli_ucli_handlers__[] =
48 | {
49 | onlp_ucli_ucli__config__,
50 | NULL
51 | };
52 | /******************************************************************************/
53 | /* */
54 |
55 | static ucli_module_t
56 | onlp_ucli_module__ =
57 | {
58 | "onlp_ucli",
59 | NULL,
60 | onlp_ucli_ucli_handlers__,
61 | NULL,
62 | NULL,
63 | };
64 |
65 | ucli_node_t*
66 | onlp_ucli_node_create(void)
67 | {
68 | ucli_node_t* n;
69 | ucli_module_init(&onlp_ucli_module__);
70 | n = ucli_node_create("onlp", NULL, &onlp_ucli_module__);
71 | ucli_node_subnode_add(n, ucli_module_log_node_create("onlp"));
72 | return n;
73 | }
74 |
75 | #else
76 | void*
77 | onlp_ucli_node_create(void)
78 | {
79 | return NULL;
80 | }
81 | #endif
82 |
83 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/onlp_util.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include
27 | #include "onlp_int.h"
28 |
29 | /**
30 | * The OID dump() and show() routines
31 | * need a default IOF.
32 | */
33 | void
34 | onlp_oid_dump_iof_init_default(iof_t* iof, aim_pvs_t* pvs)
35 | {
36 | if(iof_init(iof, pvs) == 0) {
37 | /* Default settings */
38 | iof->indent_factor=4;
39 | iof->level=1;
40 | iof->indent_terminator="";
41 | }
42 | }
43 | void
44 | onlp_oid_show_iof_init_default(iof_t* iof, aim_pvs_t* pvs, uint32_t flags)
45 | {
46 | if(iof_init(iof, pvs) == 0) {
47 | /* Default settings */
48 | iof->indent_factor=2;
49 | iof->level=1;
50 | iof->indent_terminator="";
51 | iof->pop_string = NULL;
52 | iof->push_string = "";
53 | }
54 | }
55 |
56 | void
57 | onlp_oid_info_get_error(iof_t* iof, int error)
58 | {
59 | iof_iprintf(iof, "Error retrieving status: %{onlp_status}", error);
60 | }
61 | void
62 | onlp_oid_show_description(iof_t* iof, onlp_oid_hdr_t* hdr)
63 | {
64 | iof_iprintf(iof, "Description: %s", hdr->description);
65 | }
66 |
67 | void
68 | onlp_oid_show_state_missing(iof_t* iof)
69 | {
70 | iof_iprintf(iof, "State: Missing");
71 | }
72 |
--------------------------------------------------------------------------------
/modules/onlp/module/src/platform_dump.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | void
31 | onlp_platform_dump(aim_pvs_t* pvs, uint32_t flags)
32 | {
33 | /* Dump all OIDS, starting with the SYS OID */
34 | onlp_oid_dump(ONLP_OID_SYS, pvs, flags);
35 | aim_printf(pvs, "\nSFPs:\n");
36 | /* Dump all SFPs */
37 | onlp_sfp_dump(pvs);
38 | }
39 |
40 | void
41 | onlp_platform_show(aim_pvs_t* pvs, uint32_t flags)
42 | {
43 | onlp_oid_show(ONLP_OID_SYS, pvs, flags);
44 | }
45 |
--------------------------------------------------------------------------------
/modules/onlp/onlp.mk:
--------------------------------------------------------------------------------
1 |
2 | ###############################################################################
3 | #
4 | # Inclusive Makefile for the onlp module.
5 | #
6 | # Autogenerated 2016-12-11 15:35:35.369404
7 | #
8 | ###############################################################################
9 | onlp_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
10 | include $(onlp_BASEDIR)module/make.mk
11 | include $(onlp_BASEDIR)module/auto/make.mk
12 | include $(onlp_BASEDIR)module/src/make.mk
13 | include $(onlp_BASEDIR)utest/_make.mk
14 |
15 |
--------------------------------------------------------------------------------
/modules/onlp/utest/_make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | UMODULE := onlp
27 | UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | include $(BUILDER)/utest.mk
29 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../init.mk
27 | MODULE := onlp_platform_defaults
28 | AUTOMODULE := onlp_platform_defaults
29 | include $(BUILDER)/definemodule.mk
30 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlp_platform_defaults README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlp_platform_defaults Autogeneration
23 | #
24 | ############################################################
25 |
26 | onlp_platform_defaults_AUTO_DEFS := module/auto/onlp_platform_defaults.yml
27 | onlp_platform_defaults_AUTO_DIRS := module/inc/onlp_platform_defaults module/src
28 | include $(BUILDER)/auto.mk
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/auto/onlp_platform_defaults.yml:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlp_platform_defaults Autogeneration Definitions.
23 | #
24 | ############################################################
25 |
26 | cdefs: &cdefs
27 | - ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_LOGGING:
28 | doc: "Include or exclude logging."
29 | default: 1
30 | - ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT:
31 | doc: "Default enabled log options."
32 | default: AIM_LOG_OPTIONS_DEFAULT
33 | - ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT:
34 | doc: "Default enabled log bits."
35 | default: AIM_LOG_BITS_DEFAULT
36 | - ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
37 | doc: "Default enabled custom log bits."
38 | default: 0
39 | - ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB:
40 | doc: "Default all porting macros to use the C standard libraries."
41 | default: 1
42 | - ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
43 | doc: "Include standard library headers for stdlib porting macros."
44 | default: ONLP_PLATFORM_DEFAULTS_CONFIG_PORTING_STDLIB
45 | - ONLP_PLATFORM_DEFAULTS_CONFIG_INCLUDE_UCLI:
46 | doc: "Include generic uCli support."
47 | default: 0
48 | - ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM:
49 | doc: "Build as the onlp-platform library stub."
50 | default: 0
51 |
52 | log_types: &log_types
53 | - called
54 |
55 | definitions:
56 | cdefs:
57 | ONLP_PLATFORM_DEFAULTS_CONFIG_HEADER:
58 | defs: *cdefs
59 | basename: onlp_platform_defaults_config
60 |
61 | aim_custom_log_macro:
62 | onlp_platform_defaults:
63 | flags: *log_types
64 | prefix: ONLP_PLATFORM_DEFAULTS_LOG_FLAG_
65 |
66 | enum: &enum
67 | onlp_platform_defaults_log_flag:
68 | members: *log_types
69 |
70 | portingmacro:
71 | ONLP_PLATFORM_DEFAULTS:
72 | macros:
73 | - memset
74 | - memcpy
75 | - strncpy
76 | - strlen
77 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults.x:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /**************************************************************************//**
27 | *
28 | *
29 | *
30 | *****************************************************************************/
31 | #include
32 |
33 | /* <--auto.start.xmacro(ALL).define> */
34 | /* */
35 |
36 | /* <--auto.start.xenum(ALL).define> */
37 | /* */
38 |
39 |
40 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/inc/onlp_platform_defaults/onlp_platform_defaults_dox.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /**************************************************************************//**
27 | *
28 | * onlp_platform_defaults Doxygen Header
29 | *
30 | *****************************************************************************/
31 | #ifndef __ONLP_PLATFORM_DEFAULTS_DOX_H__
32 | #define __ONLP_PLATFORM_DEFAULTS_DOX_H__
33 |
34 | /**
35 | * @defgroup onlp_platform_defaults onlp_platform_defaults - onlp_platform_defaults Description
36 | *
37 |
38 | The documentation overview for this module should go here.
39 |
40 | *
41 | * @{
42 | *
43 | * @defgroup onlp_platform_defaults-onlp_platform_defaults Public Interface
44 | * @defgroup onlp_platform_defaults-config Compile Time Configuration
45 | * @defgroup onlp_platform_defaults-porting Porting Macros
46 | *
47 | * @}
48 | *
49 | */
50 |
51 | #endif /* __ONLP_PLATFORM_DEFAULTS_DOX_H__ */
52 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
27 | onlp_platform_defaults_INCLUDES := -I $(THIS_DIR)inc
28 | onlp_platform_defaults_INTERNAL_INCLUDES := -I $(THIS_DIR)src
29 | onlp_platform_defaults_DEPENDMODULE_ENTRIES := init:onlp_platform_defaults ucli:onlp_platform_defaults
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/fani.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Fan Platform Implementation Defaults.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlp_platform_defaults_int.h"
27 | #include "onlp_platform_defaults_log.h"
28 |
29 | /**
30 | * These are the default implementations for all currently
31 | * defined interface functions.
32 | */
33 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_init(void));
34 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info));
35 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_status_get(onlp_oid_t id, uint32_t* status));
36 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* hdr));
37 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_rpm_set(onlp_oid_t id, int rpm));
38 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_percentage_set(onlp_oid_t id, int p));
39 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_mode_set(onlp_oid_t id, onlp_fan_mode_t mode));
40 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_dir_set(onlp_oid_t id, onlp_fan_dir_t dir));
41 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_fani_ioctl(onlp_oid_t id, va_list vargs));
42 |
43 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/ledi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | ***********************************************************/
24 | #include
25 | #include "onlp_platform_defaults_int.h"
26 | #include "onlp_platform_defaults_log.h"
27 |
28 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_init(void));
29 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* rv));
30 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_status_get(onlp_oid_t id, uint32_t* rv));
31 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv));
32 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_set(onlp_oid_t id, int on_or_off));
33 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_ioctl(onlp_oid_t id, va_list vargs));
34 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode));
35 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_ledi_char_set(onlp_oid_t id, char c));
36 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | LIBRARY := onlp_platform_defaults
27 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | include $(BUILDER)/lib.mk
29 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/onlp_platform_defaults_enums.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 | #include "onlp_platform_defaults_int.h"
28 |
29 | /* */
30 | aim_map_si_t onlp_platform_defaults_log_flag_map[] =
31 | {
32 | { "called", ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED },
33 | { NULL, 0 }
34 | };
35 |
36 | aim_map_si_t onlp_platform_defaults_log_flag_desc_map[] =
37 | {
38 | { "None", ONLP_PLATFORM_DEFAULTS_LOG_FLAG_CALLED },
39 | { NULL, 0 }
40 | };
41 |
42 | const char*
43 | onlp_platform_defaults_log_flag_name(onlp_platform_defaults_log_flag_t e)
44 | {
45 | const char* name;
46 | if(aim_map_si_i(&name, e, onlp_platform_defaults_log_flag_map, 0)) {
47 | return name;
48 | }
49 | else {
50 | return "-invalid value for enum type 'onlp_platform_defaults_log_flag'";
51 | }
52 | }
53 |
54 | int
55 | onlp_platform_defaults_log_flag_value(const char* str, onlp_platform_defaults_log_flag_t* e, int substr)
56 | {
57 | int i;
58 | AIM_REFERENCE(substr);
59 | if(aim_map_si_s(&i, str, onlp_platform_defaults_log_flag_map, 0)) {
60 | /* Enum Found */
61 | *e = i;
62 | return 0;
63 | }
64 | else {
65 | return -1;
66 | }
67 | }
68 |
69 | const char*
70 | onlp_platform_defaults_log_flag_desc(onlp_platform_defaults_log_flag_t e)
71 | {
72 | const char* name;
73 | if(aim_map_si_i(&name, e, onlp_platform_defaults_log_flag_desc_map, 0)) {
74 | return name;
75 | }
76 | else {
77 | return "-invalid value for enum type 'onlp_platform_defaults_log_flag'";
78 | }
79 | }
80 |
81 | /* */
82 |
83 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/onlp_platform_defaults_log.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 | #include "onlp_platform_defaults_int.h"
28 | #include "onlp_platform_defaults_log.h"
29 |
30 | /*
31 | * onlp_platform_defaults log struct.
32 | */
33 | AIM_LOG_STRUCT_DEFINE(
34 | ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_OPTIONS_DEFAULT,
35 | ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_BITS_DEFAULT,
36 | onlp_platform_defaults_log_flag_map,
37 | ONLP_PLATFORM_DEFAULTS_CONFIG_LOG_CUSTOM_BITS_DEFAULT
38 | );
39 |
40 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/onlp_platform_defaults_module.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlp_platform_defaults_log.h"
29 |
30 | static int
31 | datatypes_init__(void)
32 | {
33 | #define ONLP_PLATFORM_DEFAULTS_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
34 | #include
35 | return 0;
36 | }
37 |
38 | void __onlp_platform_defaults_module_init__(void)
39 | {
40 | AIM_LOG_STRUCT_REGISTER();
41 | datatypes_init__();
42 | }
43 |
44 | #if ONLP_PLATFORM_DEFAULTS_CONFIG_AS_PLATFORM == 0
45 | int __onlp_platform_version_default__ = 0;
46 | #else
47 | int __onlp_platform_version__ = 0;
48 | #endif
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/psui.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Power Supply Management Implementation.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlp_platform_defaults_int.h"
27 | #include "onlp_platform_defaults_log.h"
28 |
29 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_init(void));
30 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* rv));
31 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_status_get(onlp_oid_t id, uint32_t* rv));
32 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv));
33 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_psui_ioctl(onlp_oid_t pid, va_list vargs));
34 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/sfpi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | ***********************************************************/
24 | #include
25 | #include "onlp_platform_defaults_int.h"
26 | #include "onlp_platform_defaults_log.h"
27 |
28 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_init(void));
29 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap));
30 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_is_present(int port));
31 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst));
32 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst));
33 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_eeprom_read(int port, uint8_t data[256]));
34 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dom_read(int port, uint8_t data[256]));
35 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_post_insert(int port, sff_info_t* sff_info));
36 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_port_map(int port, int* rport));
37 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_denit(void));
38 | __ONLP_DEFAULTI_VIMPLEMENTATION(onlp_sfpi_debug(int port, aim_pvs_t* pvs));
39 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_ioctl(int port, va_list vargs));
40 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_supported(int port, onlp_sfp_control_t control, int* rv));
41 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value));
42 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value));
43 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_readb(int port, uint8_t devaddr, uint8_t addr));
44 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value));
45 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr));
46 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value));
47 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/module/src/thermali.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Thermal Sensor Platform Implementation.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlp_platform_defaults_int.h"
27 | #include "onlp_platform_defaults_log.h"
28 |
29 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_init(void));
30 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv));
31 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_status_get(onlp_oid_t id, uint32_t* rv));
32 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_hdr_get(onlp_oid_t id, onlp_oid_hdr_t* rv));
33 | __ONLP_DEFAULTI_IMPLEMENTATION(onlp_thermali_ioctl(int code, va_list vargs));
34 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/onlp_platform_defaults.mk:
--------------------------------------------------------------------------------
1 |
2 | ###############################################################################
3 | #
4 | # Inclusive Makefile for the onlp_platform_defaults module.
5 | #
6 | # Autogenerated 2016-05-17 13:22:27.275132
7 | #
8 | ###############################################################################
9 | onlp_platform_defaults_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
10 | include $(onlp_platform_defaults_BASEDIR)module/make.mk
11 | include $(onlp_platform_defaults_BASEDIR)module/auto/make.mk
12 | include $(onlp_platform_defaults_BASEDIR)module/src/make.mk
13 | include $(onlp_platform_defaults_BASEDIR)utest/_make.mk
14 |
15 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/utest/_make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlp_platform_defaults Unit Test Makefile.
23 | #
24 | ############################################################
25 |
26 | UMODULE := onlp_platform_defaults
27 | UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | include $(BUILDER)/utest.mk
29 |
--------------------------------------------------------------------------------
/modules/onlp_platform_defaults/utest/main.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | int aim_main(int argc, char* argv[])
34 | {
35 | printf("onlp_platform_defaults Utest Is Empty\n");
36 | onlp_platform_defaults_config_show(&aim_pvs_stdout);
37 | return 0;
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/.gitignore:
--------------------------------------------------------------------------------
1 | /onlp_snmp.mk
2 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/Makefile:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 | include ../../init.mk
7 | MODULE := onlp_snmp
8 | AUTOMODULE := onlp_snmp
9 | include $(BUILDER)/definemodule.mk
10 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlp_snmp README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlp_snmp Autogeneration
4 | #
5 | ###############################################################################
6 | onlp_snmp_AUTO_DEFS := module/auto/onlp_snmp.yml
7 | onlp_snmp_AUTO_DIRS := module/inc/onlp_snmp module/src
8 | include $(BUILDER)/auto.mk
9 |
10 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_SNMP_H__
26 | #define __ONLP_SNMP_H__
27 |
28 | #include
29 |
30 | #endif /* __ONLP_SNMP_H__ */
31 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp.x:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | /* <--auto.start.xmacro(ALL).define> */
9 | /* */
10 |
11 | /* <--auto.start.xenum(ALL).define> */
12 | /* */
13 |
14 |
15 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_dox.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * onlp_snmp Doxygen Header
4 | *
5 | *****************************************************************************/
6 | #ifndef __ONLP_SNMP_DOX_H__
7 | #define __ONLP_SNMP_DOX_H__
8 |
9 | /**
10 | * @defgroup onlp_snmp onlp_snmp - onlp_snmp Description
11 | *
12 |
13 | The documentation overview for this module should go here.
14 |
15 | *
16 | * @{
17 | *
18 | * @defgroup onlp_snmp-onlp_snmp Public Interface
19 | * @defgroup onlp_snmp-config Compile Time Configuration
20 | * @defgroup onlp_snmp-porting Porting Macros
21 | *
22 | * @}
23 | *
24 | */
25 |
26 | #endif /* __ONLP_SNMP_DOX_H__ */
27 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_platform_oids.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_SNMP_PLATFORM_OIDS_H__
26 | #define __ONLP_SNMP_PLATFORM_OIDS_H__
27 |
28 | /**
29 | * See:
30 | * ONLP-PLATFORM-MIBS.txt
31 | */
32 |
33 | /**
34 | * These are all currently defined as part of the Big Switch enterprise tree.
35 | *
36 | * In the future we should apply for an ONL Private Enterprise Number and
37 | * redefine these appropriately.
38 | */
39 |
40 | #define ONLP_SNMP_PLATFORM_INFORMATION_OID 1,3,6,1,4,1,37538,2,1000
41 | #define ONLP_SNMP_PLATFORM_GENERAL_OID ONLP_SNMP_PLATFORM_INFORMATION_OID,1
42 | #define ONLP_SNMP_PLATFORM_SYSTEM_OID ONLP_SNMP_PLATFORM_GENERAL_OID,1
43 |
44 |
45 | /**
46 | * TODO
47 | */
48 |
49 |
50 | #endif /* __ONLP_SNMP_PLATFORM_OIDS_H__ */
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_porting.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * @file
4 | * @brief onlp_snmp Porting Macros.
5 | *
6 | * @addtogroup onlp_snmp-porting
7 | * @{
8 | *
9 | *****************************************************************************/
10 | #ifndef __ONLP_SNMP_PORTING_H__
11 | #define __ONLP_SNMP_PORTING_H__
12 |
13 |
14 | /* */
15 | #if ONLP_SNMP_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #endif
22 |
23 | #ifndef ONLP_SNMP_MEMSET
24 | #if defined(GLOBAL_MEMSET)
25 | #define ONLP_SNMP_MEMSET GLOBAL_MEMSET
26 | #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1
27 | #define ONLP_SNMP_MEMSET memset
28 | #else
29 | #error The macro ONLP_SNMP_MEMSET is required but cannot be defined.
30 | #endif
31 | #endif
32 |
33 | #ifndef ONLP_SNMP_MEMCPY
34 | #if defined(GLOBAL_MEMCPY)
35 | #define ONLP_SNMP_MEMCPY GLOBAL_MEMCPY
36 | #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1
37 | #define ONLP_SNMP_MEMCPY memcpy
38 | #else
39 | #error The macro ONLP_SNMP_MEMCPY is required but cannot be defined.
40 | #endif
41 | #endif
42 |
43 | #ifndef ONLP_SNMP_STRNCPY
44 | #if defined(GLOBAL_STRNCPY)
45 | #define ONLP_SNMP_STRNCPY GLOBAL_STRNCPY
46 | #elif ONLP_SNMP_CONFIG_PORTING_STDLIB == 1
47 | #define ONLP_SNMP_STRNCPY strncpy
48 | #else
49 | #error The macro ONLP_SNMP_STRNCPY is required but cannot be defined.
50 | #endif
51 | #endif
52 |
53 | /* */
54 |
55 |
56 | #endif /* __ONLP_SNMP_PORTING_H__ */
57 | /* @} */
58 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/inc/onlp_snmp/onlp_snmp_sensors.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_SNMP_SENSORS_H__
26 | #define __ONLP_SNMP_SENSORS_H__
27 |
28 | /**
29 | * This handler is compatible with the snmp_subagent client registration
30 | * system.
31 | */
32 | int onlp_snmp_sensors_client(int enable, void* cookie);
33 |
34 | #endif /* __ONLP_SNMP_SENSORS_H__ */
35 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
7 | onlp_snmp_INCLUDES := -I $(THIS_DIR)inc
8 | onlp_snmp_INTERNAL_INCLUDES := -I $(THIS_DIR)src
9 | onlp_snmp_DEPENDMODULE_ENTRIES := init:onlp_snmp ucli:onlp_snmp snmp_subagent:onlp_snmp
10 | onlp_snmp_GLOBAL_LINK_LIBS += -lnetsnmpagent -lnetsnmphelpers -lnetsnmpmibs -lnetsnmp
11 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/Makefile:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # Local source generation targets.
4 | #
5 | ###############################################################################
6 |
7 | ucli:
8 | @../../../../tools/uclihandlers.py onlp_snmp_ucli.c
9 |
10 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 |
7 | LIBRARY := onlp_snmp
8 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
9 | include $(BUILDER)/lib.mk
10 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/onlp_snmp_int.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * onlp_snmp Internal Header
4 | *
5 | *****************************************************************************/
6 | #ifndef __ONLP_SNMP_INT_H__
7 | #define __ONLP_SNMP_INT_H__
8 |
9 | #include
10 |
11 |
12 | #endif /* __ONLP_SNMP_INT_H__ */
13 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/onlp_snmp_log.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | #include "onlp_snmp_log.h"
9 | /*
10 | * onlp_snmp log struct.
11 | */
12 | AIM_LOG_STRUCT_DEFINE(
13 | ONLP_SNMP_CONFIG_LOG_OPTIONS_DEFAULT,
14 | ONLP_SNMP_CONFIG_LOG_BITS_DEFAULT,
15 | NULL, /* Custom log map */
16 | ONLP_SNMP_CONFIG_LOG_CUSTOM_BITS_DEFAULT
17 | );
18 |
19 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/onlp_snmp_log.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #ifndef __ONLP_SNMP_LOG_H__
7 | #define __ONLP_SNMP_LOG_H__
8 |
9 | #define AIM_LOG_MODULE_NAME onlp_snmp
10 | #include
11 |
12 | #endif /* __ONLP_SNMP_LOG_H__ */
13 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/onlp_snmp_module.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 | #include
8 | #include "onlp_snmp_log.h"
9 |
10 | static int
11 | datatypes_init__(void)
12 | {
13 | #define ONLP_SNMP_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
14 | #include
15 | return 0;
16 | }
17 |
18 | void __onlp_snmp_module_init__(void)
19 | {
20 | AIM_LOG_STRUCT_REGISTER();
21 | datatypes_init__();
22 | onlp_init();
23 | }
24 |
25 | /**
26 | * Used when integrated with the snmp_subagent module.
27 | */
28 |
29 | #include
30 |
31 | #include
32 |
33 | #ifdef DEPENDMODULE_INCLUDE_SNMP_SUBAGENT
34 |
35 | #include
36 |
37 | int onlp_snmp_snmp_subagent_register(void)
38 | {
39 | return snmp_subagent_client_register("onlp_snmp_sensors",
40 | onlp_snmp_sensors_client,
41 | NULL);
42 | }
43 |
44 | int onlp_snmp_snmp_subagent_unregister(void)
45 | {
46 | return snmp_subagent_client_unregister("onlp_snmp_sensors");
47 | }
48 |
49 | #endif /* DEPENDMODULE_INCLUDE_SNMP_SUBAGENT */
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/modules/onlp_snmp/module/src/onlp_snmp_ucli.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | #if ONLP_SNMP_CONFIG_INCLUDE_UCLI == 1
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | static ucli_status_t
15 | onlp_snmp_ucli_ucli__config__(ucli_context_t* uc)
16 | {
17 | UCLI_HANDLER_MACRO_MODULE_CONFIG(onlp_snmp)
18 | }
19 |
20 | /* */
21 | /* */
22 |
23 | static ucli_module_t
24 | onlp_snmp_ucli_module__ =
25 | {
26 | "onlp_snmp_ucli",
27 | NULL,
28 | onlp_snmp_ucli_ucli_handlers__,
29 | NULL,
30 | NULL,
31 | };
32 |
33 | ucli_node_t*
34 | onlp_snmp_ucli_node_create(void)
35 | {
36 | ucli_node_t* n;
37 | ucli_module_init(&onlp_snmp_ucli_module__);
38 | n = ucli_node_create("onlp_snmp", NULL, &onlp_snmp_ucli_module__);
39 | ucli_node_subnode_add(n, ucli_module_log_node_create("onlp_snmp"));
40 | return n;
41 | }
42 |
43 | #else
44 | void*
45 | onlp_snmp_ucli_node_create(void)
46 | {
47 | return NULL;
48 | }
49 | #endif
50 |
51 |
--------------------------------------------------------------------------------
/modules/onlpie/.gitignore:
--------------------------------------------------------------------------------
1 | /onlpie.mk
2 | /doc
3 |
--------------------------------------------------------------------------------
/modules/onlpie/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../init.mk
27 | MODULE := onlpie
28 | AUTOMODULE := onlpie
29 | include $(BUILDER)/definemodule.mk
30 |
--------------------------------------------------------------------------------
/modules/onlpie/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlpie README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlpie/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlpie Autogeneration
23 | #
24 | ############################################################
25 |
26 | onlpie_AUTO_DEFS := module/auto/onlpie.yml
27 | onlpie_AUTO_DIRS := module/inc/onlpie module/src
28 | include $(BUILDER)/auto.mk
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlpie/module/auto/onlpie.yml:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlpie Autogeneration Definitions.
23 | #
24 | ############################################################
25 |
26 | cdefs: &cdefs
27 | - ONLPIE_CONFIG_INCLUDE_LOGGING:
28 | doc: "Include or exclude logging."
29 | default: 1
30 | - ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT:
31 | doc: "Default enabled log options."
32 | default: AIM_LOG_OPTIONS_DEFAULT
33 | - ONLPIE_CONFIG_LOG_BITS_DEFAULT:
34 | doc: "Default enabled log bits."
35 | default: AIM_LOG_BITS_DEFAULT
36 | - ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
37 | doc: "Default enabled custom log bits."
38 | default: 0
39 | - ONLPIE_CONFIG_PORTING_STDLIB:
40 | doc: "Default all porting macros to use the C standard libraries."
41 | default: 1
42 | - ONLPIE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
43 | doc: "Include standard library headers for stdlib porting macros."
44 | default: ONLPIE_CONFIG_PORTING_STDLIB
45 | - ONLPIE_CONFIG_INCLUDE_UCLI:
46 | doc: "Include generic uCli support."
47 | default: 0
48 |
49 |
50 | definitions:
51 | cdefs:
52 | ONLPIE_CONFIG_HEADER:
53 | defs: *cdefs
54 | basename: onlpie_config
55 |
56 | portingmacro:
57 | ONLPIE:
58 | macros:
59 | - malloc
60 | - free
61 | - memset
62 | - memcpy
63 | - strncpy
64 | - vsnprintf
65 | - snprintf
66 | - strlen
67 |
--------------------------------------------------------------------------------
/modules/onlpie/module/inc/onlpie/onlpie.x:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.xmacro(ALL).define> */
29 | /* */
30 |
31 | /* <--auto.start.xenum(ALL).define> */
32 | /* */
33 |
34 |
35 |
--------------------------------------------------------------------------------
/modules/onlpie/module/inc/onlpie/onlpie_dox.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /********************************************************//**
27 | *
28 | * onlpie Doxygen Header
29 | *
30 | ***********************************************************/
31 | #ifndef __ONLPIE_DOX_H__
32 | #define __ONLPIE_DOX_H__
33 |
34 | /**
35 | * @defgroup onlpie onlpie - onlpie Description
36 | *
37 |
38 | The documentation overview for this module should go here.
39 |
40 | *
41 | * @{
42 | *
43 | * @defgroup onlpie-onlpie Public Interface
44 | * @defgroup onlpie-config Compile Time Configuration
45 | * @defgroup onlpie-porting Porting Macros
46 | *
47 | * @}
48 | *
49 | */
50 |
51 | #endif /* __ONLPIE_DOX_H__ */
52 |
--------------------------------------------------------------------------------
/modules/onlpie/module/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
26 | onlpie_INCLUDES := -I $(THIS_DIR)inc
27 | onlpie_INTERNAL_INCLUDES := -I $(THIS_DIR)src
28 | onlpie_DEPENDMODULE_ENTRIES := init:onlpie ucli:onlpie
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # Local source generation targets.
23 | #
24 | ############################################################
25 |
26 | include ../../../../init.mk
27 |
28 | ucli:
29 | $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlpie_ucli.c
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/ledi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | ***********************************************************/
24 | #include
25 | #include "onlpie_int.h"
26 |
27 | /*
28 | * This function will be called prior to any other onlp_ledi_* functions.
29 | */
30 | int
31 | onlp_ledi_init(void)
32 | {
33 | return ONLP_STATUS_OK;
34 | }
35 |
36 | /*
37 | * Get the information for the given LED OID.
38 | */
39 | static onlp_led_info_t linfo[] =
40 | {
41 | { }, /* Not used */
42 | {
43 | { ONLP_LED_ID_CREATE(1), "Chassis LED 1", 0 },
44 | 0x1,
45 | ONLP_LED_CAPS_ON_OFF | ONLP_LED_CAPS_RED | ONLP_LED_CAPS_RED_BLINKING,
46 | ONLP_LED_MODE_RED
47 | },
48 | {
49 | { ONLP_LED_ID_CREATE(2), "Chassis LED 2", 0 },
50 | 0x0,
51 | },
52 | };
53 |
54 | int
55 | onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info)
56 | {
57 | *info = linfo[ONLP_OID_ID_GET(id)];
58 | return ONLP_STATUS_OK;
59 | }
60 |
61 | /*
62 | * Turn an LED on or off.
63 | *
64 | * This function will only be called if the LED OID supports the ONOFF
65 | * capability.
66 | *
67 | * What 'on' means in terms of colors or modes for multimode LEDs is
68 | * up to the platform to decide. This is intended as baseline toggle mechanism.
69 | */
70 | int
71 | onlp_ledi_set(onlp_oid_t id, int on_or_off)
72 | {
73 | return ONLP_STATUS_E_UNSUPPORTED;
74 | }
75 |
76 | /*
77 | * This function puts the LED into the given mode. It is a more functional
78 | * interface for multimode LEDs.
79 | *
80 | * Only modes reported in the LED's capabilities will be attempted.
81 | */
82 | int
83 | onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode)
84 | {
85 | return ONLP_STATUS_E_UNSUPPORTED;
86 | }
87 |
88 | /*
89 | * Generic LED ioctl interface.
90 | */
91 | int
92 | onlp_ledi_ioctl(onlp_oid_t id, va_list vargs)
93 | {
94 | return ONLP_STATUS_E_UNSUPPORTED;
95 | }
96 |
97 |
98 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | LIBRARY := onlpie
27 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | #$(LIBRARY)_LAST := 1
29 | include $(BUILDER)/lib.mk
30 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_enums.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.enum(ALL).source> */
29 | /* */
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_int.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLPIE_INT_H__
27 | #define __ONLPIE_INT_H__
28 |
29 | #include
30 |
31 |
32 | #endif /* __ONLPIE_INT_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_log.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlpie_log.h"
29 | /*
30 | * onlpie log struct.
31 | */
32 | AIM_LOG_STRUCT_DEFINE(
33 | ONLPIE_CONFIG_LOG_OPTIONS_DEFAULT,
34 | ONLPIE_CONFIG_LOG_BITS_DEFAULT,
35 | NULL, /* Custom log map */
36 | ONLPIE_CONFIG_LOG_CUSTOM_BITS_DEFAULT
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_log.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLPIE_LOG_H__
27 | #define __ONLPIE_LOG_H__
28 |
29 | #define AIM_LOG_MODULE_NAME onlpie
30 | #include
31 |
32 | #endif /* __ONLPIE_LOG_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_module.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlpie_log.h"
29 |
30 | static int
31 | datatypes_init__(void)
32 | {
33 | #define ONLPIE_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
34 | #include
35 | return 0;
36 | }
37 |
38 | void __onlpie_module_init__(void)
39 | {
40 | AIM_LOG_STRUCT_REGISTER();
41 | datatypes_init__();
42 | }
43 |
44 | int __onlp_platform_version__ = 1;
45 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/onlpie_ucli.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #if ONLPIE_CONFIG_INCLUDE_UCLI == 1
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | static ucli_status_t
35 | onlpie_ucli_ucli__config__(ucli_context_t* uc)
36 | {
37 | UCLI_HANDLER_MACRO_MODULE_CONFIG(onlpie)
38 | }
39 |
40 | /* */
41 | /******************************************************************************
42 | *
43 | * These handler table(s) were autogenerated from the symbols in this
44 | * source file.
45 | *
46 | *****************************************************************************/
47 | static ucli_command_handler_f onlpie_ucli_ucli_handlers__[] =
48 | {
49 | onlpie_ucli_ucli__config__,
50 | NULL
51 | };
52 | /******************************************************************************/
53 | /* */
54 |
55 | static ucli_module_t
56 | onlpie_ucli_module__ =
57 | {
58 | "onlpie_ucli",
59 | NULL,
60 | onlpie_ucli_ucli_handlers__,
61 | NULL,
62 | NULL,
63 | };
64 |
65 | ucli_node_t*
66 | onlpie_ucli_node_create(void)
67 | {
68 | ucli_node_t* n;
69 | ucli_module_init(&onlpie_ucli_module__);
70 | n = ucli_node_create("onlpie", NULL, &onlpie_ucli_module__);
71 | ucli_node_subnode_add(n, ucli_module_log_node_create("onlpie"));
72 | return n;
73 | }
74 |
75 | #else
76 | void*
77 | onlpie_ucli_node_create(void)
78 | {
79 | return NULL;
80 | }
81 | #endif
82 |
83 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/psui.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlpie_int.h"
27 |
28 | /*
29 | * This function will be called prior to any other onlp_psui functions.
30 | */
31 | int
32 | onlp_psui_init(void)
33 | {
34 | return ONLP_STATUS_OK;
35 | }
36 |
37 | /*
38 | * Get all information about the given PSU oid.
39 | */
40 | static onlp_psu_info_t pinfo[] =
41 | {
42 | { }, /* Not used */
43 | {
44 | {
45 | ONLP_PSU_ID_CREATE(1), "PSU-1", 0,
46 | /* This PSU has 2 fans */
47 | { ONLP_FAN_ID_CREATE(3), ONLP_FAN_ID_CREATE(4) }
48 | },
49 | "ONLPIE PSU MODEL (AC)", "ONLPIE PSU SN",
50 | 0x1,
51 | ONLP_PSU_CAPS_AC | ONLP_PSU_CAPS_VIN | ONLP_PSU_CAPS_VOUT | ONLP_PSU_CAPS_IIN,
52 | 241100,
53 | 122200,
54 | 23300,
55 | 3440,
56 | 0,
57 | 0,
58 | },
59 | {
60 | { ONLP_PSU_ID_CREATE(2), "PSU-2", 0 },
61 | "", "",
62 | 0,
63 | },
64 | {
65 | { ONLP_PSU_ID_CREATE(3), "PSU-3", 0 },
66 | "ONLPIE PSU MODEL (DC)", "ONLPIE PSU SN",
67 | 0x1,
68 | ONLP_PSU_CAPS_DC48,
69 | 48100,
70 | 12200,
71 | 2300
72 | },
73 | };
74 |
75 |
76 | int
77 | onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info)
78 | {
79 | *info = pinfo[ONLP_OID_ID_GET(id)];
80 | return ONLP_STATUS_OK;
81 | }
82 |
83 | /*
84 | * This is an optional generic ioctl() interface.
85 | * Its purpose is to allow future expansion and
86 | * custom functionality that is not otherwise exposed
87 | * in the standard interface.
88 | *
89 | * The semantics of this function are platform specific.
90 | * This function is completely optional.
91 | */
92 | int
93 | onlp_psui_ioctl(onlp_oid_t pid, va_list vargs)
94 | {
95 | return ONLP_STATUS_E_UNSUPPORTED;
96 | }
97 |
--------------------------------------------------------------------------------
/modules/onlpie/module/src/thermali.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Thermal Sensor Platform Implementation.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlpie_log.h"
27 |
28 | /*
29 | * This will be called to intiialize the thermali subsystem.
30 | */
31 | int
32 | onlp_thermali_init(void)
33 | {
34 | AIM_LOG_MSG("%s", __func__);
35 | return ONLP_STATUS_OK;
36 | }
37 |
38 |
39 | /*
40 | * Retrieve the information structure for the given thermal OID.
41 | *
42 | * If the OID is invalid, return ONLP_E_STATUS_INVALID.
43 | * If an unexpected error occurs, return ONLP_E_STATUS_INTERNAL.
44 | * Otherwise, return ONLP_STATUS_OK with the OID's information.
45 | *
46 | * Note -- it is expected that you fill out the information
47 | * structure even if the sensor described by the OID is not present.
48 | */
49 | int
50 | onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* rv)
51 | {
52 | /* Static values */
53 | onlp_thermal_info_t info[] = {
54 | { }, /* Not used */
55 | { { ONLP_THERMAL_ID_CREATE(1), "Chassis Thermal Sensor 1", 0}, 0x1,
56 | ONLP_THERMAL_CAPS_ALL,
57 | 23100, { 35000, 50000, 60000 }, },
58 | { { ONLP_THERMAL_ID_CREATE(2), "Chassis Thermal Sensor 2", 0}, 0x0, 0 }
59 | };
60 | *rv = info[ONLP_OID_ID_GET(id)];
61 |
62 | return ONLP_STATUS_OK;
63 | }
64 |
--------------------------------------------------------------------------------
/modules/onlpie/utest/_make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlpie Unit Test Makefile.
4 | #
5 | ###############################################################################
6 | UMODULE := onlpie
7 | UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
8 | include $(BUILDER)/utest.mk
9 |
--------------------------------------------------------------------------------
/modules/onlpie/utest/main.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | int aim_main(int argc, char* argv[])
33 | {
34 | printf("onlpie Utest Is Empty\n");
35 | onlpie_config_show(&aim_pvs_stdout);
36 | return 0;
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/modules/onlplib/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../init.mk
27 | MODULE := onlplib
28 | AUTOMODULE := onlplib
29 | include $(BUILDER)/definemodule.mk
30 |
--------------------------------------------------------------------------------
/modules/onlplib/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlplib README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlplib/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlplib Autogeneration
23 | #
24 | ############################################################
25 |
26 | onlplib_AUTO_DEFS := module/auto/onlplib.yml
27 | onlplib_AUTO_DIRS := module/inc/onlplib module/src
28 | include $(BUILDER)/auto.mk
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlplib/module/auto/onlplib.yml:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlplib Autogeneration Definitions.
23 | #
24 | ############################################################
25 |
26 | cdefs: &cdefs
27 | - ONLPLIB_CONFIG_INCLUDE_LOGGING:
28 | doc: "Include or exclude logging."
29 | default: 1
30 | - ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT:
31 | doc: "Default enabled log options."
32 | default: AIM_LOG_OPTIONS_DEFAULT
33 | - ONLPLIB_CONFIG_LOG_BITS_DEFAULT:
34 | doc: "Default enabled log bits."
35 | default: AIM_LOG_BITS_DEFAULT
36 | - ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
37 | doc: "Default enabled custom log bits."
38 | default: 0
39 | - ONLPLIB_CONFIG_PORTING_STDLIB:
40 | doc: "Default all porting macros to use the C standard libraries."
41 | default: 1
42 | - ONLPLIB_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
43 | doc: "Include standard library headers for stdlib porting macros."
44 | default: ONLPLIB_CONFIG_PORTING_STDLIB
45 | - ONLPLIB_CONFIG_INCLUDE_UCLI:
46 | doc: "Include generic uCli support."
47 | default: 0
48 | - ONLPLIB_CONFIG_INCLUDE_I2C:
49 | doc: "Include Userspace I2C support."
50 | default: 1
51 | - ONLPLIB_CONFIG_I2C_BLOCK_SIZE:
52 | doc: "Maximum read and write block size."
53 | default: 32
54 | - ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER:
55 | doc: "Include the custom i2c header (include/linux/i2c-devices.h) to avoid conflicts with the kernel and i2c-dev packages."
56 | default: 1
57 |
58 | definitions:
59 | cdefs:
60 | ONLPLIB_CONFIG_HEADER:
61 | defs: *cdefs
62 | basename: onlplib_config
63 |
64 | portingmacro:
65 | ONLPLIB:
66 | macros:
67 | - memset
68 | - memcpy
69 | - strncpy
70 | - vsnprintf
71 | - snprintf
72 | - strlen
73 | - atoi
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/crc32.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * CRC32 Calculations
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_CRC32_H__
26 | #define __ONLP_CRC32_H__
27 |
28 | #include
29 |
30 | /**
31 | * @brief Calculate CRC32 on the given data buffer.
32 | * @param crc CRC start
33 | * @param buf The data buffer
34 | * @param size The size of the data buffer.
35 | * @returns The CRC32 value.
36 | */
37 |
38 | uint32_t onlp_crc32(uint32_t crc, const void *buf, int size);
39 |
40 | #endif /* __ONLP_CRC32_H__ */
41 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/gpio.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_GPIO_H__
26 | #define __ONLP_GPIO_H__
27 |
28 | #include
29 |
30 | typedef enum onlp_gpio_direction_e {
31 | ONLP_GPIO_DIRECTION_NONE,
32 | ONLP_GPIO_DIRECTION_IN,
33 | ONLP_GPIO_DIRECTION_OUT,
34 | ONLP_GPIO_DIRECTION_LOW,
35 | ONLP_GPIO_DIRECTION_HIGH,
36 | } onlp_gpio_direction_t;
37 |
38 | /**
39 | * @brief Export the given GPIO and set its direction.
40 | * @param gpio The gpio number.
41 | * @param dir The gpio direction.
42 | */
43 | int onlp_gpio_export(int gpio, onlp_gpio_direction_t dir);
44 |
45 | /**
46 | * @brief Set the given GPIO value.
47 | * @param gpio The gpio number.
48 | * @param v The value to set.
49 | * @param ... Additional GPIO and Value parameters.
50 | */
51 | int onlp_gpio_set(int gpio, int v);
52 |
53 | /**
54 | * @brief Get the given GPIO value.
55 | * @param gpio The gpio number.
56 | * @returns Returns the value or negative on error.
57 | */
58 | int onlp_gpio_get(int gpio, int* rv);
59 |
60 |
61 | #endif /* __ONLP_GPIO_H__ */
62 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/mmap.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Common mmap() platform support.
23 | *
24 | ***********************************************************/
25 | #ifndef __ONLP_MMAP_H__
26 | #define __ONLP_MMAP_H__
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | /**
33 | * @brief Map a physical address range.
34 | * @param addr The physical
35 | * @param size The size of the region to map.
36 | * @param name The name of the memory region for debugging/logging purposes.
37 | */
38 | void* onlp_mmap(off_t pa, uint32_t size, const char* name);
39 |
40 |
41 |
42 |
43 |
44 | #endif /* __ONLP_MMAP_H__ */
45 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/onlplib.x:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.xmacro(ALL).define> */
29 | /* */
30 |
31 | /* <--auto.start.xenum(ALL).define> */
32 | /* */
33 |
34 |
35 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/onlplib_dox.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /**************************************************************************//**
27 | *
28 | * onlplib Doxygen Header
29 | *
30 | *****************************************************************************/
31 | #ifndef __ONLPLIB_DOX_H__
32 | #define __ONLPLIB_DOX_H__
33 |
34 | /**
35 | * @defgroup onlplib onlplib - onlplib Description
36 | *
37 |
38 | The documentation overview for this module should go here.
39 |
40 | *
41 | * @{
42 | *
43 | * @defgroup onlplib-onlplib Public Interface
44 | * @defgroup onlplib-config Compile Time Configuration
45 | * @defgroup onlplib-porting Porting Macros
46 | *
47 | * @}
48 | *
49 | */
50 |
51 | #endif /* __ONLPLIB_DOX_H__ */
52 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/pi.h:
--------------------------------------------------------------------------------
1 | /**************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | **************************************************************
21 | *
22 | * Platform Information
23 | *
24 | ************************************************************/
25 | #ifndef __ONLPLIB_PI_H__
26 | #define __ONLPLIB_PI_H__
27 |
28 | #include
29 |
30 | /**
31 | * Platform Information
32 | */
33 | typedef struct onlp_platform_info_s {
34 |
35 | /**
36 | * CPLD Versions
37 | *
38 | * Describes the internal CPLD version numbers, if applicable.
39 | *
40 | */
41 | char* cpld_versions;
42 |
43 | /**
44 | * Additional version or platform information.
45 | */
46 | char* other_versions;
47 |
48 | } onlp_platform_info_t;
49 |
50 | void onlp_platform_info_show_json(onlp_platform_info_t* pi, aim_pvs_t* pvs);
51 |
52 | void onlp_platform_info_show(onlp_platform_info_t* pi, aim_pvs_t* pvs);
53 |
54 | #endif /* __ONLPLIB_PI_H__ */
55 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/sfp.h:
--------------------------------------------------------------------------------
1 | /**************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | **************************************************************
21 | *
22 | * Common SFP support routines.
23 | *
24 | ************************************************************/
25 | #ifndef __ONLPLIB_SFP_H__
26 | #define __ONLPLIB_SFP_H__
27 | #include
28 |
29 | /**
30 | *
31 | * @brief Determine SFP Presence from the given file.
32 | * @param fname The filename
33 | * @param present The string value that indicates 'SFP is present'.
34 | * @param notpresent The string valud that indicates 'SFP is absent'.
35 | * @notes If your SFP module presence is indicated through
36 | * a file (like a GPIO) then you can use this to implement
37 | * your onlp_sfpi_is_present() interface.
38 | */
39 |
40 | int onlplib_sfp_is_present_file(const char* fname,
41 | const char* present,
42 | const char* notpresent);
43 | /**
44 | * @brief Reset an SFP using writes to the given file.
45 | * @param fname The filename.
46 | * @param first This string will be written to the file.
47 | * @param delay The amount of time to wait before the second write.
48 | * @param second If specified, this string will be written to the
49 | * the file after waiting the given delay.
50 | * @notes If your SFP module reset is performed through
51 | * a file (like a GPIO) you can use this function to implement your
52 | * onlp_sfpi_reset() vector.
53 | */
54 | int onlplib_sfp_reset_file(const char* file, const char* first, int delay_ms,
55 | const char* second);
56 | /**
57 | * @brief Read an SFP eeprom from the given file.
58 | * @param fname The filename.
59 | * @param data Receives the data.
60 | * @notes If your SFP module's eeprom is exported via a file
61 | * (usually in /sys) then you can use this function
62 | * to implement your onlp_sfpi_eeprom_read() interface. */
63 | int onlplib_sfp_eeprom_read_file(const char* fname, uint8_t data[256]);
64 |
65 | #endif /* __ONLPLIB_SFP_H__ */
66 |
--------------------------------------------------------------------------------
/modules/onlplib/module/inc/onlplib/thermal.h:
--------------------------------------------------------------------------------
1 | /**************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | **************************************************************
21 | *
22 | * Common thermal support routines.
23 | *
24 | ************************************************************/
25 | #ifndef __ONLPLIB_THERMAL_H__
26 | #define __ONLPLIB_THERMAL_H__
27 | #include
28 | #include
29 | /**
30 | * @brief Read the mcelsius value from the given file.
31 | * @param fname Filename
32 | * @param info Thermal info structure.
33 | */
34 | int onlplib_thermal_read_file(const char* fname, onlp_thermal_info_t* info);
35 |
36 | #endif /* __ONLPLIB_THERMAL_H__ */
37 |
--------------------------------------------------------------------------------
/modules/onlplib/module/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
27 | onlplib_INCLUDES := -I $(THIS_DIR)inc
28 | onlplib_INTERNAL_INCLUDES := -I $(THIS_DIR)src
29 | onlplib_DEPENDMODULE_ENTRIES := init:onlplib
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | LIBRARY := onlplib
27 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | include $(BUILDER)/lib.mk
29 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/mmap.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlplib_log.h"
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | void*
35 | onlp_mmap(off_t pa, uint32_t size, const char* name)
36 | {
37 | int msize = 0;
38 | int psize = getpagesize();
39 |
40 | msize = (((size / psize) + 1) * psize);
41 |
42 | int fd = open("/dev/mem", O_RDWR | O_SYNC);
43 |
44 | if(fd <= 0) {
45 | AIM_LOG_ERROR("open(/dev/mem) failed: %{errno}", errno);
46 | return NULL;
47 | }
48 |
49 | uint8_t* memory = mmap(NULL,
50 | msize,
51 | PROT_READ | PROT_WRITE,
52 | MAP_SHARED,
53 | fd,
54 | pa);
55 |
56 | close(fd);
57 |
58 | if(memory == MAP_FAILED) {
59 | AIM_LOG_ERROR("mmap() pa=0x%llx size=%d name=%s failed: %{errno}",
60 | pa, size, errno);
61 | return NULL;
62 | }
63 | return memory;
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/onlplib_enums.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.enum(ALL).source> */
29 | /* */
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/onlplib_int.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /********************************************************//**
27 | *
28 | * onlplib Internal Header
29 | *
30 | ***********************************************************/
31 | #ifndef __ONLPLIB_INT_H__
32 | #define __ONLPLIB_INT_H__
33 |
34 | #include
35 |
36 |
37 | #endif /* __ONLPLIB_INT_H__ */
38 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/onlplib_log.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlplib_log.h"
29 | /*
30 | * onlplib log struct.
31 | */
32 | AIM_LOG_STRUCT_DEFINE(
33 | ONLPLIB_CONFIG_LOG_OPTIONS_DEFAULT,
34 | ONLPLIB_CONFIG_LOG_BITS_DEFAULT,
35 | NULL, /* Custom log map */
36 | ONLPLIB_CONFIG_LOG_CUSTOM_BITS_DEFAULT
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/onlplib_log.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLPLIB_LOG_H__
27 | #define __ONLPLIB_LOG_H__
28 |
29 | #define AIM_LOG_MODULE_NAME onlplib
30 | #include
31 |
32 | #endif /* __ONLPLIB_LOG_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/onlplib_module.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlplib_log.h"
29 |
30 | static int
31 | datatypes_init__(void)
32 | {
33 | #define ONLPLIB_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
34 | #include
35 | return 0;
36 | }
37 |
38 | void __onlplib_module_init__(void)
39 | {
40 | AIM_LOG_STRUCT_REGISTER();
41 | datatypes_init__();
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/pi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 | #include
28 |
29 | void
30 | onlp_platform_info_show(onlp_platform_info_t* pi, aim_pvs_t* pvs)
31 | {
32 | iof_t iof;
33 | iof_init(&iof, pvs);
34 | if(pi->cpld_versions) {
35 | iof_iprintf(&iof, "CPLD Versions: %s", pi->cpld_versions);
36 | }
37 | if(pi->other_versions) {
38 | iof_iprintf(&iof, "Other Versions: %s", pi->other_versions);
39 | }
40 | }
41 |
42 | void
43 | onlp_platform_info_show_json(onlp_platform_info_t* pi, aim_pvs_t* pvs)
44 | {
45 | aim_printf(pvs, "{\n");
46 |
47 | #define STROUT(_name, _member, _comma) \
48 | do { \
49 | aim_printf(pvs, " \"%s\" : ", #_name); \
50 | if(pi-> _member) { \
51 | aim_printf(pvs, "\"%s\"%s\n", pi->_member, _comma); \
52 | } \
53 | else { \
54 | aim_printf(pvs, "null%s\n", _comma ); \
55 | } \
56 | } while(0)
57 |
58 | STROUT(CPLD Versions, cpld_versions, ",");
59 | STROUT(Other Versions, other_versions, "");
60 |
61 | aim_printf(pvs, "}\n");
62 | }
63 |
--------------------------------------------------------------------------------
/modules/onlplib/module/src/thermal.c:
--------------------------------------------------------------------------------
1 | /**************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | **************************************************************
21 | *
22 | * Common thermal support routines.
23 | *
24 | ************************************************************/
25 | #include
26 | #include
27 | #include
28 |
29 | int
30 | onlplib_thermal_read_file(const char* fname, onlp_thermal_info_t* info)
31 | {
32 | int ret;
33 | int rv = onlp_file_read_int(&info->mcelsius, fname);
34 |
35 | if(rv == ONLP_STATUS_E_MISSING) {
36 | /* Absent */
37 | info->status = 0;
38 | ret = 0;
39 | }
40 | else if(rv >= 0) {
41 | /* Present */
42 | info->status |= 1;
43 | ret = 0;
44 | }
45 | else {
46 | /** Other error. */
47 | ret = ONLP_STATUS_E_INTERNAL;
48 | }
49 | return ret;
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/modules/onlplib/onlplib.mk:
--------------------------------------------------------------------------------
1 |
2 | ###############################################################################
3 | #
4 | # Inclusive Makefile for the onlplib module.
5 | #
6 | # Autogenerated 2016-05-17 13:22:27.221373
7 | #
8 | ###############################################################################
9 | onlplib_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
10 | include $(onlplib_BASEDIR)module/make.mk
11 | include $(onlplib_BASEDIR)module/auto/make.mk
12 | include $(onlplib_BASEDIR)module/src/make.mk
13 | include $(onlplib_BASEDIR)utest/_make.mk
14 |
15 |
--------------------------------------------------------------------------------
/modules/onlplib/utest/_make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlplib Unit Test Makefile.
23 | #
24 | ############################################################
25 |
26 | UMODULE := onlplib
27 | UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | include $(BUILDER)/utest.mk
29 |
--------------------------------------------------------------------------------
/modules/onlplib/utest/main.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | int aim_main(int argc, char* argv[])
34 | {
35 | printf("onlplib Utest Is Empty\n");
36 | onlplib_config_show(&aim_pvs_stdout);
37 | return 0;
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/modules/onlpsim/.gitignore:
--------------------------------------------------------------------------------
1 | /onlpsim.mk
2 | /doc
3 |
--------------------------------------------------------------------------------
/modules/onlpsim/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../init.mk
27 | MODULE := onlpsim
28 | AUTOMODULE := onlpsim
29 | include $(BUILDER)/definemodule.mk
30 |
--------------------------------------------------------------------------------
/modules/onlpsim/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # onlpsim README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlpsim Autogeneration
23 | #
24 | ############################################################
25 |
26 | onlpsim_AUTO_DEFS := module/auto/onlpsim.yml
27 | onlpsim_AUTO_DIRS := module/inc/onlpsim module/src
28 | include $(BUILDER)/auto.mk
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/auto/onlpsim.yml:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # onlpsim Autogeneration Definitions.
23 | #
24 | ############################################################
25 |
26 | cdefs: &cdefs
27 | - ONLPSIM_CONFIG_INCLUDE_LOGGING:
28 | doc: "Include or exclude logging."
29 | default: 1
30 | - ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT:
31 | doc: "Default enabled log options."
32 | default: AIM_LOG_OPTIONS_DEFAULT
33 | - ONLPSIM_CONFIG_LOG_BITS_DEFAULT:
34 | doc: "Default enabled log bits."
35 | default: AIM_LOG_BITS_DEFAULT
36 | - ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
37 | doc: "Default enabled custom log bits."
38 | default: 0
39 | - ONLPSIM_CONFIG_PORTING_STDLIB:
40 | doc: "Default all porting macros to use the C standard libraries."
41 | default: 1
42 | - ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
43 | doc: "Include standard library headers for stdlib porting macros."
44 | default: ONLPSIM_CONFIG_PORTING_STDLIB
45 | - ONLPSIM_CONFIG_INCLUDE_UCLI:
46 | doc: "Include generic uCli support."
47 | default: 0
48 | - ONLPSIM_CONFIG_SFP_COUNT:
49 | doc: "SFP Count."
50 | default: 0
51 |
52 | definitions:
53 | cdefs:
54 | ONLPSIM_CONFIG_HEADER:
55 | defs: *cdefs
56 | basename: onlpsim_config
57 |
58 | portingmacro:
59 | ONLPSIM:
60 | macros:
61 | - malloc
62 | - free
63 | - memset
64 | - memcpy
65 | - strncpy
66 | - vsnprintf
67 | - snprintf
68 | - strlen
69 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/inc/onlpsim/onlpsim.x:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.xmacro(ALL).define> */
29 | /* */
30 |
31 | /* <--auto.start.xenum(ALL).define> */
32 | /* */
33 |
34 |
35 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/inc/onlpsim/onlpsim_dox.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | /********************************************************//**
27 | *
28 | * onlpsim Doxygen Header
29 | *
30 | ***********************************************************/
31 | #ifndef __ONLPSIM_DOX_H__
32 | #define __ONLPSIM_DOX_H__
33 |
34 | /**
35 | * @defgroup onlpsim onlpsim - onlpsim Description
36 | *
37 |
38 | The documentation overview for this module should go here.
39 |
40 | *
41 | * @{
42 | *
43 | * @defgroup onlpsim-onlpsim Public Interface
44 | * @defgroup onlpsim-config Compile Time Configuration
45 | * @defgroup onlpsim-porting Porting Macros
46 | *
47 | * @}
48 | *
49 | */
50 |
51 | #endif /* __ONLPSIM_DOX_H__ */
52 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
26 | onlpsim_INCLUDES := -I $(THIS_DIR)inc
27 | onlpsim_INTERNAL_INCLUDES := -I $(THIS_DIR)src
28 | onlpsim_DEPENDMODULE_ENTRIES := init:onlpsim ucli:onlpsim
29 |
30 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # Local source generation targets.
23 | #
24 | ############################################################
25 |
26 | include ../../../../init.mk
27 |
28 | ucli:
29 | $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlpsim_ucli.c
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/fani.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Fan Platform Implementation Defaults.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlpsim_int.h"
27 |
28 | /*
29 | * This function will be called prior to all of onlp_fani_* functions.
30 | */
31 | int
32 | onlp_fani_init(void)
33 | {
34 | return ONLP_STATUS_OK;
35 | }
36 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/ledi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | ***********************************************************/
24 | #include
25 | #include "onlpsim_int.h"
26 |
27 | int
28 | onlp_ledi_init(void)
29 | {
30 | return ONLP_STATUS_OK;
31 | }
32 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | LIBRARY := onlpsim
27 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 | #$(LIBRARY)_LAST := 1
29 | include $(BUILDER)/lib.mk
30 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_enums.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | /* <--auto.start.enum(ALL).source> */
29 | /* */
30 |
31 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_int.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLPSIM_INT_H__
27 | #define __ONLPSIM_INT_H__
28 |
29 | #include
30 |
31 |
32 | #endif /* __ONLPSIM_INT_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_log.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlpsim_log.h"
29 | /*
30 | * onlpsim log struct.
31 | */
32 | AIM_LOG_STRUCT_DEFINE(
33 | ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT,
34 | ONLPSIM_CONFIG_LOG_BITS_DEFAULT,
35 | NULL, /* Custom log map */
36 | ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT
37 | );
38 |
39 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_log.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #ifndef __ONLPSIM_LOG_H__
27 | #define __ONLPSIM_LOG_H__
28 |
29 | #define AIM_LOG_MODULE_NAME onlpsim
30 | #include
31 |
32 | #endif /* __ONLPSIM_LOG_H__ */
33 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_module.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #include "onlpsim_log.h"
29 |
30 | static int
31 | datatypes_init__(void)
32 | {
33 | #define ONLPSIM_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
34 | #include
35 | return 0;
36 | }
37 |
38 | void __onlpsim_module_init__(void)
39 | {
40 | AIM_LOG_STRUCT_REGISTER();
41 | datatypes_init__();
42 | }
43 |
44 | int __onlp_platform_version__ = 1;
45 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/onlpsim_ucli.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 |
26 | #include
27 |
28 | #if ONLPSIM_CONFIG_INCLUDE_UCLI == 1
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | static ucli_status_t
35 | onlpsim_ucli_ucli__config__(ucli_context_t* uc)
36 | {
37 | UCLI_HANDLER_MACRO_MODULE_CONFIG(onlpsim)
38 | }
39 |
40 | /* */
41 | /******************************************************************************
42 | *
43 | * These handler table(s) were autogenerated from the symbols in this
44 | * source file.
45 | *
46 | *****************************************************************************/
47 | static ucli_command_handler_f onlpsim_ucli_ucli_handlers__[] =
48 | {
49 | onlpsim_ucli_ucli__config__,
50 | NULL
51 | };
52 | /******************************************************************************/
53 | /* */
54 |
55 | static ucli_module_t
56 | onlpsim_ucli_module__ =
57 | {
58 | "onlpsim_ucli",
59 | NULL,
60 | onlpsim_ucli_ucli_handlers__,
61 | NULL,
62 | NULL,
63 | };
64 |
65 | ucli_node_t*
66 | onlpsim_ucli_node_create(void)
67 | {
68 | ucli_node_t* n;
69 | ucli_module_init(&onlpsim_ucli_module__);
70 | n = ucli_node_create("onlpsim", NULL, &onlpsim_ucli_module__);
71 | ucli_node_subnode_add(n, ucli_module_log_node_create("onlpsim"));
72 | return n;
73 | }
74 |
75 | #else
76 | void*
77 | onlpsim_ucli_node_create(void)
78 | {
79 | return NULL;
80 | }
81 | #endif
82 |
83 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/psui.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlpsim_int.h"
27 |
28 | int
29 | onlp_psui_init(void)
30 | {
31 | return ONLP_STATUS_OK;
32 | }
33 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/sfpi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | ***********************************************************/
24 | #include
25 | #include
26 | #include "onlpsim_log.h"
27 |
28 | static int sfp_count__ = ONLPSIM_CONFIG_SFP_COUNT;
29 |
30 | int
31 | onlp_sfpi_init(void)
32 | {
33 | return ONLP_STATUS_OK;
34 | }
35 |
36 | int
37 | onlp_sfpi_bitmap_get(onlp_sfp_bitmap_t* bmap)
38 | {
39 | int p;
40 | for(p = 0; p < sfp_count__; p++) {
41 | AIM_BITMAP_SET(bmap, p);
42 | }
43 | return ONLP_STATUS_OK;
44 | }
45 |
46 | int
47 | onlp_sfpi_is_present(int port)
48 | {
49 | return 0;
50 | }
51 |
52 | int
53 | onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
54 | {
55 | AIM_BITMAP_CLR_ALL(dst);
56 | return ONLP_STATUS_OK;
57 | }
58 |
59 | /*
60 | * This function reads the SFPs idrom and returns in
61 | * in the data buffer provided.
62 | */
63 | int
64 | onlp_sfpi_eeprom_read(int port, uint8_t data[256])
65 | {
66 | return ONLP_STATUS_E_MISSING;
67 | }
68 |
69 | /*
70 | * De-initialize the SFPI subsystem.
71 | */
72 | int
73 | onlp_sfpi_denit(void)
74 | {
75 | return ONLP_STATUS_OK;
76 | }
77 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/sysi.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #include
26 | #include
27 | #include "onlpsim_log.h"
28 |
29 | const char*
30 | onlp_sysi_platform_get(void)
31 | {
32 | return "onlp-simulation-driver";
33 | }
34 |
35 | int
36 | onlp_sysi_platform_set(const char* name)
37 | {
38 | /* We accept all platforms */
39 | return ONLP_STATUS_OK;
40 | }
41 |
42 | int
43 | onlp_sysi_init(void)
44 | {
45 | return ONLP_STATUS_OK;
46 | }
47 |
48 | int
49 | onlp_sysi_onie_data_phys_addr_get(void** pa)
50 | {
51 | return ONLP_STATUS_E_UNSUPPORTED;
52 | }
53 |
54 | int
55 | onlp_sysi_onie_data_get(uint8_t** data, int* size)
56 | {
57 | static uint8_t onie_data[] = {
58 | 'T', 'l', 'v','I','n','f','o', 0,
59 | 0x1, 0x0, 0x0,
60 | 0x21, 0x8, 'O', 'N', 'L', 'S', 'I', 'M', 0, 0,
61 | 0x22, 0x3, 'O', 'N', 'L',
62 | 0xFE, 0x4, 0x2f, 0x52, 0x8f, 0xda,
63 | };
64 |
65 | if(onie_data[9] == 0 && onie_data[10] == 0) {
66 | int len = sizeof(onie_data);
67 | len -= 11;
68 | onie_data[9] = (len & 0xFF00) >> 8;
69 | onie_data[10] = (len & 0xFF);
70 | }
71 |
72 | *data = onie_data;
73 | return 0;
74 | }
75 |
76 | void
77 | onlp_sysi_onie_data_free(uint8_t* data)
78 | {
79 | /*
80 | * We returned a static array in onlp_sysi_onie_data_get()
81 | * so no free operation is required.
82 | */
83 | }
84 |
85 | void
86 | onlp_sysi_platform_manage(void)
87 | {
88 | }
89 |
90 | int
91 | onlp_sysi_oids_get(onlp_oid_t* table, int max)
92 | {
93 | memset(table, 0, max*sizeof(onlp_oid_t));
94 | return 0;
95 | }
96 |
--------------------------------------------------------------------------------
/modules/onlpsim/module/src/thermali.c:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | * Thermal Sensor Platform Implementation.
23 | *
24 | ***********************************************************/
25 | #include
26 | #include "onlpsim_log.h"
27 |
28 | int
29 | onlp_thermali_init(void)
30 | {
31 | return ONLP_STATUS_OK;
32 | }
33 |
--------------------------------------------------------------------------------
/modules/sff/Makefile:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 | include ../../init.mk
7 | MODULE := sff
8 | AUTOMODULE := sff
9 | include $(BUILDER)/definemodule.mk
10 |
--------------------------------------------------------------------------------
/modules/sff/README:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # sff README
4 | #
5 | ###############################################################################
6 |
7 |
--------------------------------------------------------------------------------
/modules/sff/module/auto/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # sff Autogeneration
4 | #
5 | ###############################################################################
6 | sff_AUTO_DEFS := module/auto/sff.yml
7 | sff_AUTO_DIRS := module/inc/sff module/src
8 | include $(BUILDER)/auto.mk
9 |
10 |
--------------------------------------------------------------------------------
/modules/sff/module/inc/sff/sff.x:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | /* <--auto.start.xmacro(ALL).define> */
9 | /* */
10 |
11 | /* */
12 | #ifdef SFF_ENUMERATION_ENTRY
13 | SFF_ENUMERATION_ENTRY(sff_media_type, "")
14 | SFF_ENUMERATION_ENTRY(sff_module_caps, "")
15 | SFF_ENUMERATION_ENTRY(sff_module_type, "")
16 | SFF_ENUMERATION_ENTRY(sff_sfp_type, "")
17 | #undef SFF_ENUMERATION_ENTRY
18 | #endif
19 | /* */
20 |
21 |
22 |
--------------------------------------------------------------------------------
/modules/sff/module/inc/sff/sff_db.h:
--------------------------------------------------------------------------------
1 | /************************************************************
2 | *
3 | *
4 | * Copyright 2014, 2015 Big Switch Networks, Inc.
5 | *
6 | * Licensed under the Eclipse Public License, Version 1.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.eclipse.org/legal/epl-v10.html
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | * either express or implied. See the License for the specific
16 | * language governing permissions and limitations under the
17 | * License.
18 | *
19 | *
20 | ************************************************************
21 | *
22 | *
23 | *
24 | ***********************************************************/
25 | #ifndef __SFF_DB_H__
26 | #define __SFF_DB_H__
27 |
28 | #include
29 | #include
30 | #include
31 |
32 | typedef struct {
33 | sff_eeprom_t se;
34 | } sff_db_entry_t;
35 |
36 | /**
37 | * @brief Get the database entry table.
38 | * @param entries Receives the table pointer.
39 | * @param count Receives the size of the table.
40 | */
41 | int sff_db_get(sff_db_entry_t** entries, int* count);
42 |
43 | /**
44 | * @brief Return any entry with the given module type.
45 | * @param se Receives the information struct.
46 | * @param type The type to retreive.
47 | */
48 | int sff_db_get_type(sff_eeprom_t* se, sff_module_type_t type);
49 |
50 |
51 | /**
52 | * @brief Output the given SFF information to a database entry.
53 | * @param info The source information.
54 | * @param pvs The output pvs.;
55 | * @note This is used mainly for generating new entries for the SFF db from a running system.
56 | */
57 | int sff_db_entry_struct(sff_eeprom_t* se, aim_pvs_t* pvs);
58 |
59 | #endif /* __SFF_DB_H__ */
60 |
61 |
--------------------------------------------------------------------------------
/modules/sff/module/inc/sff/sff_dox.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * sff Doxygen Header
4 | *
5 | *****************************************************************************/
6 | #ifndef __SFF_DOX_H__
7 | #define __SFF_DOX_H__
8 |
9 | /**
10 | * @defgroup sff sff - sff Description
11 | *
12 |
13 | The documentation overview for this module should go here.
14 |
15 | *
16 | * @{
17 | *
18 | * @defgroup sff-sff Public Interface
19 | * @defgroup sff-config Compile Time Configuration
20 | * @defgroup sff-porting Porting Macros
21 | *
22 | * @}
23 | *
24 | */
25 |
26 | #endif /* __SFF_DOX_H__ */
27 |
--------------------------------------------------------------------------------
/modules/sff/module/inc/sff/sff_porting.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * @file
4 | * @brief sff Porting Macros.
5 | *
6 | * @addtogroup sff-porting
7 | * @{
8 | *
9 | *****************************************************************************/
10 | #ifndef __SFF_PORTING_H__
11 | #define __SFF_PORTING_H__
12 |
13 |
14 | /* */
15 | #if SFF_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #endif
22 |
23 | #ifndef SFF_MEMSET
24 | #if defined(GLOBAL_MEMSET)
25 | #define SFF_MEMSET GLOBAL_MEMSET
26 | #elif SFF_CONFIG_PORTING_STDLIB == 1
27 | #define SFF_MEMSET memset
28 | #else
29 | #error The macro SFF_MEMSET is required but cannot be defined.
30 | #endif
31 | #endif
32 |
33 | #ifndef SFF_MEMCPY
34 | #if defined(GLOBAL_MEMCPY)
35 | #define SFF_MEMCPY GLOBAL_MEMCPY
36 | #elif SFF_CONFIG_PORTING_STDLIB == 1
37 | #define SFF_MEMCPY memcpy
38 | #else
39 | #error The macro SFF_MEMCPY is required but cannot be defined.
40 | #endif
41 | #endif
42 |
43 | #ifndef SFF_STRNCPY
44 | #if defined(GLOBAL_STRNCPY)
45 | #define SFF_STRNCPY GLOBAL_STRNCPY
46 | #elif SFF_CONFIG_PORTING_STDLIB == 1
47 | #define SFF_STRNCPY strncpy
48 | #else
49 | #error The macro SFF_STRNCPY is required but cannot be defined.
50 | #endif
51 | #endif
52 |
53 | #ifndef SFF_STRNCMP
54 | #if defined(GLOBAL_STRNCMP)
55 | #define SFF_STRNCMP GLOBAL_STRNCMP
56 | #elif SFF_CONFIG_PORTING_STDLIB == 1
57 | #define SFF_STRNCMP strncmp
58 | #else
59 | #error The macro SFF_STRNCMP is required but cannot be defined.
60 | #endif
61 | #endif
62 |
63 | #ifndef SFF_STRLEN
64 | #if defined(GLOBAL_STRLEN)
65 | #define SFF_STRLEN GLOBAL_STRLEN
66 | #elif SFF_CONFIG_PORTING_STDLIB == 1
67 | #define SFF_STRLEN strlen
68 | #else
69 | #error The macro SFF_STRLEN is required but cannot be defined.
70 | #endif
71 | #endif
72 |
73 | #ifndef SFF_SNPRINTF
74 | #if defined(GLOBAL_SNPRINTF)
75 | #define SFF_SNPRINTF GLOBAL_SNPRINTF
76 | #elif SFF_CONFIG_PORTING_STDLIB == 1
77 | #define SFF_SNPRINTF snprintf
78 | #else
79 | #error The macro SFF_SNPRINTF is required but cannot be defined.
80 | #endif
81 | #endif
82 |
83 | /* */
84 |
85 |
86 | #endif /* __SFF_PORTING_H__ */
87 | /* @} */
88 |
--------------------------------------------------------------------------------
/modules/sff/module/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 | THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
7 | sff_INCLUDES := -I $(THIS_DIR)inc
8 | sff_INTERNAL_INCLUDES := -I $(THIS_DIR)src
9 | sff_DEPENDMODULE_ENTRIES := init:sff
10 |
11 |
--------------------------------------------------------------------------------
/modules/sff/module/src/Makefile:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # Local source generation targets.
4 | #
5 | ###############################################################################
6 |
7 | ucli:
8 | @../../../../tools/uclihandlers.py sff_ucli.c
9 |
10 |
--------------------------------------------------------------------------------
/modules/sff/module/src/make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 |
7 | LIBRARY := sff
8 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
9 | include $(BUILDER)/lib.mk
10 |
--------------------------------------------------------------------------------
/modules/sff/module/src/sff_int.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | * sff Internal Header
4 | *
5 | *****************************************************************************/
6 | #ifndef __SFF_INT_H__
7 | #define __SFF_INT_H__
8 |
9 | #include
10 |
11 |
12 | #endif /* __SFF_INT_H__ */
13 |
--------------------------------------------------------------------------------
/modules/sff/module/src/sff_log.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | #include "sff_log.h"
9 | /*
10 | * sff log struct.
11 | */
12 | AIM_LOG_STRUCT_DEFINE(
13 | SFF_CONFIG_LOG_OPTIONS_DEFAULT,
14 | SFF_CONFIG_LOG_BITS_DEFAULT,
15 | NULL, /* Custom log map */
16 | SFF_CONFIG_LOG_CUSTOM_BITS_DEFAULT
17 | );
18 |
19 |
--------------------------------------------------------------------------------
/modules/sff/module/src/sff_log.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #ifndef __SFF_LOG_H__
7 | #define __SFF_LOG_H__
8 |
9 | #define AIM_LOG_MODULE_NAME sff
10 | #include
11 |
12 | #endif /* __SFF_LOG_H__ */
13 |
--------------------------------------------------------------------------------
/modules/sff/module/src/sff_module.c:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | *
3 | *
4 | *
5 | *****************************************************************************/
6 | #include
7 |
8 | #include "sff_log.h"
9 |
10 | static int
11 | datatypes_init__(void)
12 | {
13 | #define SFF_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL);
14 | #include
15 | return 0;
16 | }
17 |
18 | void __sff_module_init__(void)
19 | {
20 | AIM_LOG_STRUCT_REGISTER();
21 | datatypes_init__();
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/modules/sff/sff.mk:
--------------------------------------------------------------------------------
1 |
2 | ###############################################################################
3 | #
4 | # Inclusive Makefile for the sff module.
5 | #
6 | # Autogenerated 2016-05-17 13:22:27.383528
7 | #
8 | ###############################################################################
9 | sff_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
10 | include $(sff_BASEDIR)module/make.mk
11 | include $(sff_BASEDIR)module/auto/make.mk
12 | include $(sff_BASEDIR)module/src/make.mk
13 | include $(sff_BASEDIR)utest/_make.mk
14 |
15 |
--------------------------------------------------------------------------------
/modules/sff/utest/_make.mk:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | # sff Unit Test Makefile.
4 | #
5 | ###############################################################################
6 | UMODULE := sff
7 | UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
8 | include $(BUILDER)/utest.mk
9 |
--------------------------------------------------------------------------------
/targets/.gitignore:
--------------------------------------------------------------------------------
1 | dependmodules.x
2 | build/
3 | *_utest.mk
4 |
--------------------------------------------------------------------------------
/targets/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | MAKESUBDIRS:=1
26 | include ../init.mk
27 |
--------------------------------------------------------------------------------
/targets/mtool/.gitignore:
--------------------------------------------------------------------------------
1 | mtool.mk
2 |
--------------------------------------------------------------------------------
/targets/mtool/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | include ../../init.mk
26 |
27 | .DEFAULT_GOAL := mtool
28 |
29 | MODULE := mtool
30 | include $(BUILDER)/standardinit.mk
31 |
32 | LIBRARY := mtoolmain
33 | $(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
34 | include $(BUILDER)/lib.mk
35 |
36 | DEPENDMODULES := AIM onlplib IOF
37 | DEPENDMODULE_HEADERS := onlp
38 |
39 | include $(BUILDER)/dependmodules.mk
40 |
41 | BINARY := mtool
42 | $(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
43 | include $(BUILDER)/bin.mk
44 |
45 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
46 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
47 |
48 | GLOBAL_LINK_LIBS += -lpthread
49 |
50 | include $(BUILDER)/targets.mk
51 |
52 |
--------------------------------------------------------------------------------
/targets/platform-simulation/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | MAKESUBDIRS:=1
26 | include ../../init.mk
27 |
--------------------------------------------------------------------------------
/targets/platform-simulation/lib/.gitignore:
--------------------------------------------------------------------------------
1 | *.mk
2 |
--------------------------------------------------------------------------------
/targets/platform-simulation/lib/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | # Shared and static library builds for the
23 | # powerpc-as4600-54t
24 | #
25 | ############################################################
26 | include ../../../init.mk
27 |
28 | MODULE := libonlp-plaform-simulation
29 | include $(BUILDER)/standardinit.mk
30 |
31 | ifndef ONLPI_MODULE
32 | ONLPI_MODULE := onlpie
33 | endif
34 |
35 | DEPENDMODULES := AIM IOF $(ONLPI_MODULE) onlplib
36 | DEPENDMODULE_HEADERS := sff
37 |
38 |
39 | include $(BUILDER)/dependmodules.mk
40 |
41 | SHAREDLIB := libonlp-platform-simulation.so
42 | $(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
43 | include $(BUILDER)/so.mk
44 | .DEFAULT_GOAL := $(SHAREDLIB)
45 |
46 | GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc
47 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
48 | ifndef ONLPSIM_CONFIG_SFP_COUNT
49 | GLOBAL_CFLAGS += -DONLPSIM_CONFIG_SFP_COUNT=$(ONLPSIM_CONFIG_SFP_COUNT)
50 | endif
51 | GLOBAL_CFLAGS += -fPIC
52 | GLOBAL_LINK_LIBS += -lpthread
53 |
54 | include $(BUILDER)/targets.mk
55 |
56 |
--------------------------------------------------------------------------------
/targets/platform-simulation/onlpdump/.gitignore:
--------------------------------------------------------------------------------
1 | *.mk
2 |
--------------------------------------------------------------------------------
/targets/platform-simulation/onlpdump/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | include ../../../init.mk
26 |
27 | .DEFAULT_GOAL := onlpdump
28 | DEBUG := 1
29 |
30 | MODULE := onlpdump
31 | include $(BUILDER)/standardinit.mk
32 |
33 | ifndef ONLPI_MODULE
34 | ONLPI_MODULE := onlpie
35 | endif
36 |
37 | DEPENDMODULES := AIM onlp $(ONLPI_MODULE) onlplib onlp_platform_defaults IOF cjson cjson_util sff timer_wheel OS
38 |
39 | include $(BUILDER)/dependmodules.mk
40 |
41 | BINARY := onlpdump
42 | $(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
43 | include $(BUILDER)/bin.mk
44 |
45 | GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
46 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
47 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
48 | GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_TIMEOUT=1
49 | GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_PLATFORM_STATIC=1
50 | GLOBAL_CFLAGS += -DONLP_CONFIG_PLATFORM_STATIC=\"onlp-example-platform-driver\"
51 |
52 | ifdef ONLPSIM_CONFIG_SFP_COUNT
53 | GLOBAL_CFLAGS += -DONLPSIM_CONFIG_SFP_COUNT=$(ONLPSIM_CONFIG_SFP_COUNT)
54 | endif
55 |
56 | GLOBAL_LINK_LIBS += -lpthread -lm
57 |
58 | include $(BUILDER)/targets.mk
59 |
60 |
--------------------------------------------------------------------------------
/targets/sfftool/.gitignore:
--------------------------------------------------------------------------------
1 | sfftool.mk
2 |
--------------------------------------------------------------------------------
/targets/sfftool/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | include ../../init.mk
26 |
27 | .DEFAULT_GOAL := sfftool
28 | DEBUG := 1
29 |
30 | MODULE := sfftool
31 | include $(BUILDER)/standardinit.mk
32 |
33 | DEPENDMODULES := AIM sff BigList
34 |
35 | include $(BUILDER)/dependmodules.mk
36 |
37 | BINARY := sfftool
38 | $(BINARY)_LIBRARIES := $(LIBRARY_TARGETS)
39 | include $(BUILDER)/bin.mk
40 |
41 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
42 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
43 | GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=sff_tool
44 | GLOBAL_CFLAGS += -DSFF_CONFIG_INCLUDE_SFF_TOOL=1
45 | GLOBAL_LINK_LIBS += -lpthread -lrt
46 |
47 | include $(BUILDER)/targets.mk
48 |
49 |
--------------------------------------------------------------------------------
/targets/utests/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 | MAKESUBDIRS:=1
26 | include ../../init.mk
27 |
--------------------------------------------------------------------------------
/targets/utests/onlp/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../../init.mk
27 | MODULE := onlp_utest
28 | TEST_MODULE := onlp
29 | DEPENDMODULES := AIM onlplib onlp_platform_defaults onlpie IOF cjson cjson_util sff timer_wheel OS
30 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
31 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
32 | GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_PLATFORM_STATIC=1
33 | GLOBAL_CFLAGS += -DONLP_CONFIG_PLATFORM_STATIC=\"onlpie\"
34 | GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_PLATFORM_OVERRIDES=1
35 | include $(BUILDER)/build-unit-test.mk
36 | GLOBAL_LINK_LIBS += -lpthread -lm
37 |
--------------------------------------------------------------------------------
/targets/utests/onlp_platform_defaults/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../../init.mk
27 | MODULE := onlp_platform_defaults_utest
28 | TEST_MODULE := onlp_platform_defaults
29 | DEPENDMODULES := AIM onlp onlplib IOF sff cjson cjson_util timer_wheel OS
30 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
31 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
32 | include $(BUILDER)/build-unit-test.mk
33 |
--------------------------------------------------------------------------------
/targets/utests/onlpie/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../../init.mk
27 | MODULE := onlpie_utest
28 | TEST_MODULE := onlpie
29 | DEPENDMODULES := AIM IOF onlp onlplib onlp_platform_defaults sff cjson cjson_util timer_wheel OS
30 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
31 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
32 | include $(BUILDER)/build-unit-test.mk
33 |
--------------------------------------------------------------------------------
/targets/utests/onlplib/Makefile:
--------------------------------------------------------------------------------
1 | ############################################################
2 | #
3 | #
4 | # Copyright 2014, 2015 Big Switch Networks, Inc.
5 | #
6 | # Licensed under the Eclipse Public License, Version 1.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.eclipse.org/legal/epl-v10.html
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 | # either express or implied. See the License for the specific
16 | # language governing permissions and limitations under the
17 | # License.
18 | #
19 | #
20 | ############################################################
21 | #
22 | #
23 | #
24 | ############################################################
25 |
26 | include ../../../init.mk
27 | MODULE := onlplib_utest
28 | TEST_MODULE := onlplib
29 |
30 | DEPENDMODULES := AIM IOF
31 | DEPENDMODULE_HEADERS := onlp
32 |
33 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
34 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
35 | include $(BUILDER)/build-unit-test.mk
36 |
--------------------------------------------------------------------------------
/targets/utests/sff/Makefile:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | #
3 | #
4 | #
5 | ###############################################################################
6 |
7 | include ../../../init.mk
8 | MODULE := sff_utest
9 | TEST_MODULE := sff
10 | DEPENDMODULES := AIM BigList
11 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
12 | GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
13 | GLOBAL_CFLAGS += -DSFF_CONFIG_INCLUDE_EXT_CC_CHECK=1
14 | GLOBAL_CFLAGS += -DSFF_CONFIG_INCLUDE_DATABASE=1
15 | GLOBAL_LINK_LIBS += -lrt
16 | include $(BUILDER)/build-unit-test.mk
17 |
--------------------------------------------------------------------------------
/tools/infra.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | ################################################################
3 | #
4 | #
5 | # Copyright 2013, 2014, 2015 Big Switch Networks, Inc.
6 | #
7 | # Licensed under the Eclipse Public License, Version 1.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.eclipse.org/legal/epl-v10.html
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | # either express or implied. See the License for the specific
17 | # language governing permissions and limitations under the
18 | # License.
19 | #
20 | #
21 | ################################################################
22 | #
23 | # Resolve dependencies on the infra repository.
24 | #
25 | ################################################################
26 | import os
27 | import sys
28 |
29 | # The root of the repository
30 | ROOT = os.path.realpath("%s/.." % (os.path.dirname(__file__)))
31 |
32 | SUBMODULE_INFRA = os.getenv("SUBMODULE_INFRA")
33 | if SUBMODULE_INFRA is None:
34 | SUBMODULE_INFRA = "%s/submodules/infra" % ROOT
35 |
36 | if not os.path.exists("%s/builder/unix/tools" % SUBMODULE_INFRA):
37 | raise Exception("This script requires the infra repository.")
38 |
39 | sys.path.append("%s/builder/unix/tools" % SUBMODULE_INFRA)
40 |
41 | SUBMODULE_BIGCODE = os.getenv("SUBMODULE_BIGCODE")
42 | if SUBMODULE_BIGCODE is None:
43 | SUBMODULE_BIGCODE = "%s/submodules/bigcode" % ROOT
44 |
45 | if not os.path.exists("%s/tools" % SUBMODULE_BIGCODE):
46 | raise Exception("This script requires the bigcode repository.")
47 |
48 | sys.path.append("%s/tools" % SUBMODULE_BIGCODE)
49 |
--------------------------------------------------------------------------------
/tools/newmodule.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | ############################################################
3 | #
4 | #
5 | # Copyright 2014, 2015 Big Switch Networks, Inc.
6 | #
7 | # Licensed under the Eclipse Public License, Version 1.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.eclipse.org/legal/epl-v10.html
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
16 | # either express or implied. See the License for the specific
17 | # language governing permissions and limitations under the
18 | # License.
19 | #
20 | #
21 | ############################################################
22 | #
23 | # This script generates a new code module and unit test build
24 | # for this repository.
25 | #
26 | ################################################################
27 |
28 | import sys
29 | import os
30 |
31 | # The root of the repository
32 | ROOT = os.path.realpath("%s/.." % (os.path.dirname(__file__)))
33 |
34 | import infra
35 |
36 | from modulegen import *
37 |
38 | #
39 | # Import uCli support
40 | #
41 | from uclimod import *
42 |
43 | ################################################################################
44 | #
45 | # Instantiate the unit test for each new module in utests
46 | #
47 | ###############################################################################
48 |
49 | class GModuleUnitTestTargetMake(ModuleUnitTestTargetMake):
50 | def finalize(self):
51 | self.MODULE_DIRS = "$(ROOT)/modules"
52 | self.MODULE_UNIT_TEST_DIR = "%s/targets/utests/%s/%s" % (
53 | ROOT, self.MODULE_RELATIVE_PATH, self.MODULE_NAME)
54 |
55 |
56 |
57 |
58 | if __name__ == "__main__":
59 |
60 | ############################################################################
61 | #
62 | # Set the module base directory to bigcode-internal/modules
63 | #
64 | ############################################################################
65 | ModuleGenerator.modulesBaseDir = "%s/modules" % ROOT
66 |
67 | #
68 | # Make it happen.
69 | #
70 | ModuleGenerator.main(globals().copy())
71 |
72 | # Rebuild manifest
73 | os.system("make -C %s/modules manifest" % ROOT)
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------