├── .cproject ├── .gitignore ├── .project ├── .settings ├── language.settings.xml ├── org.eclipse.cdt.codan.core.prefs ├── org.eclipse.cdt.core.prefs ├── org.eclipse.cdt.ui.prefs └── org.eclipse.core.resources.prefs ├── LICENSE ├── README.md ├── README_rus.md ├── bin ├── 6565-0204-20043001-watermeter_zed.zigbee └── watermeter_zed_V2.0.04.bin ├── doc ├── box │ ├── box1.jpg │ ├── box2.jpg │ ├── box3.jpg │ ├── box4.jpg │ └── box_v2.jpg └── images │ ├── E180-Z5812SP.jpg │ ├── HA_all_preset_disabled.jpg │ ├── HA_device.jpg │ ├── HA_preset_disabled.jpg │ ├── board_bottom_v2.jpg │ ├── board_top.jpg │ ├── board_top_v2.jpg │ ├── board_v2.jpg │ ├── device_close_box.jpg │ ├── device_front.jpg │ ├── device_open_box.jpg │ ├── device_open_box2.jpg │ ├── device_v2_big.png │ ├── exposes.jpg │ ├── gidrolock_wsp1.jpg │ ├── gidrolock_wsp2.jpg │ ├── ota_check_update.jpg │ ├── ota_progress.jpg │ ├── ota_update.jpg │ ├── ota_update_abort.jpg │ ├── pin_header.jpg │ ├── ppk2-close_counter.jpg │ ├── ppk2-open_counter.jpg │ ├── ppk2-ota_update.jpg │ ├── ppk2-poll_rate_3_sec.jpg │ ├── ppk2-sleep_device.jpg │ ├── ppk2-start_and_work_6min.jpg │ ├── ppk2-start_device.jpg │ ├── schematic_watermeter_zed.jpg │ ├── schematic_watermeter_zed_v2.jpg │ ├── telink_pgm.jpg │ ├── telink_tlsr8258_dongle.jpg │ ├── watermeter_board_top.jpg │ ├── wl_sensor.jpg │ ├── z2m_bind1.jpg │ ├── z2m_bind2.jpg │ ├── z2m_device.jpg │ ├── z2m_onoffSwitchCfg.jpg │ ├── z2m_reporting.jpg │ └── zigbee.png ├── make ├── af.mk ├── apps.mk ├── aps.mk ├── bdb.mk ├── common.mk ├── div_mod.mk ├── gp.mk ├── mac.mk ├── ota.mk ├── platform.mk ├── platformS.mk ├── proj.mk ├── ss.mk ├── wwah.mk ├── zbhci.mk ├── zcl.mk └── zdo.mk ├── makefile ├── project.mk ├── src ├── app_battery.c ├── app_button.c ├── app_counter.c ├── app_dev_config.c ├── app_endpoint_cfg.c ├── app_leak.c ├── app_led.c ├── app_pm.c ├── app_reporting.c ├── app_utility.c ├── common │ ├── comm_cfg.h │ ├── factory_reset.c │ ├── factory_reset.h │ ├── firmwareEncryptChk.c │ ├── firmwareEncryptChk.h │ └── main.c ├── include │ ├── app_battery.h │ ├── app_button.h │ ├── app_cfg.h │ ├── app_counter.h │ ├── app_dev_config.h │ ├── app_endpoint_cfg.h │ ├── app_leak.h │ ├── app_led.h │ ├── app_pm.h │ ├── app_reporting.h │ ├── app_types.h │ ├── app_utility.h │ ├── board_8258_diy.h │ ├── board_8258_diy_zi.h │ ├── board_8258_dongle.h │ ├── se_custom_attr.h │ ├── stack_cfg.h │ ├── version_cfg.h │ └── watermeter.h ├── watermeter.c ├── zb_appCb.c ├── zcl │ ├── zcl_onoffSwitchCfg.c │ └── zcl_onoffSwitchCfg.h └── zcl_appCb.c ├── tl_zigbee_sdk ├── LICENSE.txt ├── apps │ ├── bootLoader │ │ ├── app_cfg.h │ │ ├── board_8258_dongle.h │ │ ├── board_8258_evk_v1p2.h │ │ ├── board_826x_dongle.h │ │ ├── board_826x_evk.h │ │ ├── board_8278_dongle.h │ │ ├── board_8278_evk.h │ │ ├── board_b91_dongle.h │ │ ├── board_b91_evk.h │ │ ├── board_b92_dongle.h │ │ ├── board_b92_evk.h │ │ ├── board_tl321x_dongle.h │ │ ├── board_tl321x_evk.h │ │ ├── board_tl721x_dongle.h │ │ ├── board_tl721x_evk.h │ │ ├── bootloader.c │ │ ├── bootloader.h │ │ ├── main.c │ │ └── version_cfg.h │ ├── common │ │ ├── comm_cfg.h │ │ ├── factory_reset.c │ │ ├── factory_reset.h │ │ ├── firmwareEncryptChk.c │ │ ├── firmwareEncryptChk.h │ │ ├── main.c │ │ └── module_test.c │ ├── sampleContactSensor │ │ ├── app_cfg.h │ │ ├── app_ui.c │ │ ├── app_ui.h │ │ ├── board_8258_dongle.h │ │ ├── board_8258_evk_v1p2.h │ │ ├── board_826x_dongle.h │ │ ├── board_826x_dongle_pa.h │ │ ├── board_826x_evk.h │ │ ├── board_8278_dongle.h │ │ ├── board_8278_evk.h │ │ ├── board_b91_dongle.h │ │ ├── board_b91_evk.h │ │ ├── board_b92_dongle.h │ │ ├── board_b92_evk.h │ │ ├── board_tl321x_dongle.h │ │ ├── board_tl321x_evk.h │ │ ├── board_tl721x_dongle.h │ │ ├── board_tl721x_evk.h │ │ ├── sampleSensor.c │ │ ├── sampleSensor.h │ │ ├── sampleSensorEpCfg.c │ │ ├── stack_cfg.h │ │ ├── version_cfg.h │ │ ├── zb_appCb.c │ │ └── zcl_sampleSensorCb.c │ ├── sampleGW │ │ ├── app_cfg.h │ │ ├── app_ui.c │ │ ├── app_ui.h │ │ ├── board_8258_dongle.h │ │ ├── board_8258_evk_v1p2.h │ │ ├── board_826x_dongle.h │ │ ├── board_826x_dongle_pa.h │ │ ├── board_826x_evk.h │ │ ├── board_8278_dongle.h │ │ ├── board_8278_evk.h │ │ ├── board_b91_dongle.h │ │ ├── board_b91_evk.h │ │ ├── board_b92_dongle.h │ │ ├── board_b92_evk.h │ │ ├── board_tl321x_dongle.h │ │ ├── board_tl321x_evk.h │ │ ├── board_tl721x_dongle.h │ │ ├── board_tl721x_evk.h │ │ ├── sampleGateway.c │ │ ├── sampleGateway.h │ │ ├── sampleGatewayEpCfg.c │ │ ├── stack_cfg.h │ │ ├── version_cfg.h │ │ ├── zb_afTestCb.c │ │ ├── zb_appCb.c │ │ └── zcl_sampleGatewayCb.c │ ├── sampleLight │ │ ├── app_cfg.h │ │ ├── app_ui.c │ │ ├── app_ui.h │ │ ├── board_8258_dongle.h │ │ ├── board_8258_evk_v1p2.h │ │ ├── board_826x_dongle.h │ │ ├── board_826x_evk.h │ │ ├── board_8278_dongle.h │ │ ├── board_8278_evk.h │ │ ├── board_b91_dongle.h │ │ ├── board_b91_evk.h │ │ ├── board_b92_dongle.h │ │ ├── board_b92_evk.h │ │ ├── board_tl321x_dongle.h │ │ ├── board_tl321x_evk.h │ │ ├── board_tl721x_dongle.h │ │ ├── board_tl721x_evk.h │ │ ├── sampleLight.c │ │ ├── sampleLight.h │ │ ├── sampleLightCtrl.c │ │ ├── sampleLightCtrl.h │ │ ├── sampleLightEpCfg.c │ │ ├── stack_cfg.h │ │ ├── version_cfg.h │ │ ├── zb_afTestCb.c │ │ ├── zb_appCb.c │ │ ├── zcl_colorCtrlCb.c │ │ ├── zcl_levelCb.c │ │ ├── zcl_onOffCb.c │ │ ├── zcl_sampleLightCb.c │ │ └── zcl_sceneCb.c │ └── sampleSwitch │ │ ├── app_cfg.h │ │ ├── app_ui.c │ │ ├── app_ui.h │ │ ├── board_8258_dongle.h │ │ ├── board_8258_evk_v1p2.h │ │ ├── board_826x_dongle.h │ │ ├── board_826x_dongle_pa.h │ │ ├── board_826x_evk.h │ │ ├── board_8278_dongle.h │ │ ├── board_8278_evk.h │ │ ├── board_b91_dongle.h │ │ ├── board_b91_evk.h │ │ ├── board_b92_dongle.h │ │ ├── board_b92_evk.h │ │ ├── board_tl321x_dongle.h │ │ ├── board_tl321x_evk.h │ │ ├── board_tl721x_dongle.h │ │ ├── board_tl721x_evk.h │ │ ├── sampleSwitch.c │ │ ├── sampleSwitch.h │ │ ├── sampleSwitchEpCfg.c │ │ ├── stack_cfg.h │ │ ├── version_cfg.h │ │ ├── zb_appCb.c │ │ └── zcl_sampleSwitchCb.c ├── build │ ├── iot_riscv_b91 │ │ ├── .cproject │ │ └── .project │ ├── tlsr_riscv │ │ ├── .cproject │ │ ├── .project │ │ └── .settings │ │ │ └── com.andestech.ide.cdt.managedbuilder.core.TargetModelUtils.prefs │ └── tlsr_tc32 │ │ ├── .cproject │ │ └── .project ├── platform │ ├── boot │ │ ├── 8258 │ │ │ ├── boot_8258.link │ │ │ └── cstartup_8258.S │ │ ├── 8278 │ │ │ ├── boot_8278.link │ │ │ └── cstartup_8278.S │ │ ├── 826x │ │ │ ├── boot_826x.link │ │ │ └── cstartup_826x.S │ │ ├── b91 │ │ │ ├── boot_b91.link │ │ │ └── cstartup_b91.S │ │ ├── b92 │ │ │ ├── boot_b92.link │ │ │ └── cstartup_b92.S │ │ ├── link_cfg.S │ │ ├── tl321x │ │ │ ├── boot_tl321x.link │ │ │ └── cstartup_tl321x.S │ │ └── tl721x │ │ │ ├── boot_tl721x.link │ │ │ └── cstartup_tl721x.S │ ├── chip_8258 │ │ ├── adc.c │ │ ├── adc.h │ │ ├── aes.h │ │ ├── analog.h │ │ ├── audio.h │ │ ├── bsp.h │ │ ├── clock.h │ │ ├── dfifo.h │ │ ├── dma.h │ │ ├── driver_8258.h │ │ ├── emi.h │ │ ├── flash.c │ │ ├── flash.h │ │ ├── flash │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_mid011460c8.c │ │ │ ├── flash_mid011460c8.h │ │ │ ├── flash_mid1060c8.c │ │ │ ├── flash_mid1060c8.h │ │ │ ├── flash_mid13325e.c │ │ │ ├── flash_mid13325e.h │ │ │ ├── flash_mid134051.c │ │ │ ├── flash_mid134051.h │ │ │ ├── flash_mid136085.c │ │ │ ├── flash_mid136085.h │ │ │ ├── flash_mid1360c8.c │ │ │ ├── flash_mid1360c8.h │ │ │ ├── flash_mid1360eb.c │ │ │ ├── flash_mid1360eb.h │ │ │ ├── flash_mid14325e.c │ │ │ ├── flash_mid14325e.h │ │ │ ├── flash_mid1460c8.c │ │ │ ├── flash_mid1460c8.h │ │ │ └── flash_type.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── irq.h │ │ ├── pga.h │ │ ├── pm.h │ │ ├── pwm.h │ │ ├── random.h │ │ ├── register.h │ │ ├── rf_drv.h │ │ ├── spi.h │ │ ├── spi_i.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ ├── usbhw_i.h │ │ └── watchdog.h │ ├── chip_826x │ │ ├── adc.h │ │ ├── aes.h │ │ ├── bsp.h │ │ ├── clock.h │ │ ├── driver_826x.h │ │ ├── flash.c │ │ ├── flash.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── irq.h │ │ ├── pm.h │ │ ├── pwm.h │ │ ├── register.h │ │ ├── rf_drv.h │ │ ├── spi.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ ├── usbhw_i.h │ │ └── watchdog.h │ ├── chip_8278 │ │ ├── adc.h │ │ ├── aes.h │ │ ├── analog.h │ │ ├── audio.h │ │ ├── bsp.h │ │ ├── clock.h │ │ ├── dfifo.h │ │ ├── dma.h │ │ ├── driver_8278.h │ │ ├── eccp_curve.h │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── emi.h │ │ ├── flash.c │ │ ├── flash.h │ │ ├── flash │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_mid11325e.c │ │ │ ├── flash_mid11325e.h │ │ │ ├── flash_mid1160c8.c │ │ │ ├── flash_mid1160c8.h │ │ │ ├── flash_mid13325e.c │ │ │ ├── flash_mid13325e.h │ │ │ ├── flash_mid1360c8.c │ │ │ ├── flash_mid1360c8.h │ │ │ ├── flash_mid14325e.c │ │ │ ├── flash_mid14325e.h │ │ │ ├── flash_mid146085.c │ │ │ ├── flash_mid146085.h │ │ │ ├── flash_mid1460c8.c │ │ │ ├── flash_mid1460c8.h │ │ │ ├── flash_mid1570cd.c │ │ │ ├── flash_mid1570cd.h │ │ │ └── flash_type.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── irq.h │ │ ├── pga.h │ │ ├── pke.h │ │ ├── pke_algorithm.h │ │ ├── pke_common.h │ │ ├── pm.h │ │ ├── pwm.h │ │ ├── random.h │ │ ├── register.h │ │ ├── rf_drv.h │ │ ├── spi.h │ │ ├── spi_i.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ ├── usbhw_i.h │ │ ├── watchdog.h │ │ └── x25519.h │ ├── chip_b91 │ │ ├── adc.h │ │ ├── aes.h │ │ ├── analog.h │ │ ├── audio.h │ │ ├── charger.h │ │ ├── clock.h │ │ ├── core.h │ │ ├── dma.h │ │ ├── driver.h │ │ ├── flash.h │ │ ├── flash │ │ │ ├── external_flash │ │ │ │ ├── flash_mid182085.c │ │ │ │ └── flash_mid182085.h │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_type.h │ │ │ └── internal_flash │ │ │ │ ├── flash_mid146085.c │ │ │ │ ├── flash_mid146085.h │ │ │ │ ├── flash_mid156085.c │ │ │ │ ├── flash_mid156085.h │ │ │ │ ├── flash_mid166085.c │ │ │ │ └── flash_mid166085.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── lib │ │ │ ├── include │ │ │ │ ├── aoa.h │ │ │ │ ├── axon │ │ │ │ │ ├── axon_api.h │ │ │ │ │ └── axon_dep.h │ │ │ │ ├── emi.h │ │ │ │ ├── emi_internal.h │ │ │ │ ├── pke │ │ │ │ │ ├── eccp_curve.h │ │ │ │ │ ├── ecdh.h │ │ │ │ │ ├── ecdsa.h │ │ │ │ │ ├── pke.h │ │ │ │ │ ├── pke_algorithm.h │ │ │ │ │ ├── pke_common.h │ │ │ │ │ └── x25519.h │ │ │ │ ├── plic.h │ │ │ │ ├── pm.h │ │ │ │ ├── rf.h │ │ │ │ ├── swire.h │ │ │ │ ├── sys.h │ │ │ │ └── trng.h │ │ │ └── libaxon_driver_lib.a │ │ ├── lpc.h │ │ ├── mdec.h │ │ ├── mspi.h │ │ ├── npe.h │ │ ├── plic_sw.h │ │ ├── plmt.h │ │ ├── pwm.h │ │ ├── reg_include │ │ │ ├── adc_reg.h │ │ │ ├── aes_reg.h │ │ │ ├── analog_reg.h │ │ │ ├── audio_reg.h │ │ │ ├── charger_reg.h │ │ │ ├── core_reg.h │ │ │ ├── dma_reg.h │ │ │ ├── gpio_reg.h │ │ │ ├── i2c_reg.h │ │ │ ├── mdec_reg.h │ │ │ ├── mspi_reg.h │ │ │ ├── npe_reg.h │ │ │ ├── pke_reg.h │ │ │ ├── plic_reg.h │ │ │ ├── plic_sw_reg.h │ │ │ ├── plmt_reg.h │ │ │ ├── pwm_reg.h │ │ │ ├── register.h │ │ │ ├── rf_reg.h │ │ │ ├── soc.h │ │ │ ├── spi_reg.h │ │ │ ├── stimer_reg.h │ │ │ ├── swire_reg.h │ │ │ ├── timer_reg.h │ │ │ ├── trng_reg.h │ │ │ ├── uart_reg.h │ │ │ └── usb_reg.h │ │ ├── s7816.h │ │ ├── spi.h │ │ ├── stimer.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ └── watchdog.h │ ├── chip_b92 │ │ ├── adc.h │ │ ├── aes.h │ │ ├── analog.h │ │ ├── audio.h │ │ ├── charger.h │ │ ├── charger_bin.h │ │ ├── clock.h │ │ ├── core.h │ │ ├── ctb.h │ │ ├── dma.h │ │ ├── driver.h │ │ ├── error_handler │ │ │ ├── error_handler.c │ │ │ └── error_handler.h │ │ ├── flash.h │ │ ├── flash │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_mid146085.c │ │ │ ├── flash_mid146085.h │ │ │ ├── flash_mid1460c8.c │ │ │ ├── flash_mid1460c8.h │ │ │ ├── flash_mid156085.c │ │ │ ├── flash_mid156085.h │ │ │ ├── flash_mid1560c8.c │ │ │ ├── flash_mid1560c8.h │ │ │ ├── flash_mid166085.c │ │ │ ├── flash_mid166085.h │ │ │ ├── flash_mid1660c8.c │ │ │ ├── flash_mid1660c8.h │ │ │ ├── flash_mid186085.c │ │ │ ├── flash_mid186085.h │ │ │ └── flash_type.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── lib │ │ │ └── include │ │ │ │ ├── aoa.h │ │ │ │ ├── emi.h │ │ │ │ ├── emi_internal.h │ │ │ │ ├── flash_base.h │ │ │ │ ├── hadm.h │ │ │ │ ├── hadm_drv.h │ │ │ │ ├── pke │ │ │ │ ├── eccp_curve.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── pke.h │ │ │ │ ├── pke_algorithm.h │ │ │ │ ├── pke_prime.h │ │ │ │ ├── pke_utility.h │ │ │ │ ├── rsa.h │ │ │ │ └── x25519.h │ │ │ │ ├── plic.h │ │ │ │ ├── pm.h │ │ │ │ ├── pmp.h │ │ │ │ ├── rf.h │ │ │ │ ├── swire.h │ │ │ │ ├── sys.h │ │ │ │ └── trng.h │ │ ├── lpc.h │ │ ├── mdec.h │ │ ├── mspi.h │ │ ├── plic_sw.h │ │ ├── plmt.h │ │ ├── pwm.h │ │ ├── qdec.h │ │ ├── reg_include │ │ │ ├── adc_reg.h │ │ │ ├── aes_reg.h │ │ │ ├── analog_reg.h │ │ │ ├── audio_reg.h │ │ │ ├── charger_reg.h │ │ │ ├── codec_0581_reg.h │ │ │ ├── core_reg.h │ │ │ ├── dma_reg.h │ │ │ ├── gpio_reg.h │ │ │ ├── i2c_reg.h │ │ │ ├── mdec_reg.h │ │ │ ├── mspi_reg.h │ │ │ ├── pke_reg.h │ │ │ ├── plic_reg.h │ │ │ ├── plic_sw_reg.h │ │ │ ├── plmt_reg.h │ │ │ ├── pwm_reg.h │ │ │ ├── qdec_reg.h │ │ │ ├── register.h │ │ │ ├── rf_reg.h │ │ │ ├── soc.h │ │ │ ├── spi_reg.h │ │ │ ├── stimer_reg.h │ │ │ ├── swire_reg.h │ │ │ ├── timer_reg.h │ │ │ ├── trng_reg.h │ │ │ ├── uart_reg.h │ │ │ └── usb_reg.h │ │ ├── s7816.h │ │ ├── spi.h │ │ ├── stimer.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ └── watchdog.h │ ├── chip_tl321x │ │ ├── adc.h │ │ ├── audio.h │ │ ├── dma.h │ │ ├── driver.h │ │ ├── error_handler │ │ │ ├── error_handler.c │ │ │ └── error_handler.h │ │ ├── flash.h │ │ ├── flash │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_mid136085.c │ │ │ ├── flash_mid136085.h │ │ │ ├── flash_mid146085.c │ │ │ ├── flash_mid146085.h │ │ │ ├── flash_mid156085.c │ │ │ ├── flash_mid156085.h │ │ │ ├── flash_mid166085.c │ │ │ ├── flash_mid166085.h │ │ │ └── flash_type.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── ir_learn.h │ │ ├── lib │ │ │ └── include │ │ │ │ ├── analog.h │ │ │ │ ├── clock.h │ │ │ │ ├── core.h │ │ │ │ ├── crypto_common │ │ │ │ ├── common_config.h │ │ │ │ ├── eccp_curve.h │ │ │ │ └── utility.h │ │ │ │ ├── efuse.h │ │ │ │ ├── emi.h │ │ │ │ ├── emi_internal.h │ │ │ │ ├── flash_base.h │ │ │ │ ├── hash │ │ │ │ ├── hash.h │ │ │ │ ├── hash_algorithm.h │ │ │ │ ├── hash_basic.h │ │ │ │ ├── hmac.h │ │ │ │ ├── hmac_md5.h │ │ │ │ ├── hmac_sha1.h │ │ │ │ ├── hmac_sha224.h │ │ │ │ ├── hmac_sha256.h │ │ │ │ ├── hmac_sha384.h │ │ │ │ ├── hmac_sha512.h │ │ │ │ ├── hmac_sha512_224.h │ │ │ │ ├── hmac_sha512_256.h │ │ │ │ ├── hmac_sm3.h │ │ │ │ ├── md5.h │ │ │ │ ├── pbkdf2.h │ │ │ │ ├── sha1.h │ │ │ │ ├── sha224.h │ │ │ │ ├── sha256.h │ │ │ │ ├── sha384.h │ │ │ │ ├── sha512.h │ │ │ │ ├── sha512_224.h │ │ │ │ ├── sha512_256.h │ │ │ │ └── sm3.h │ │ │ │ ├── mspi.h │ │ │ │ ├── pke │ │ │ │ ├── dh.h │ │ │ │ ├── eccp_curve.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── ecies.h │ │ │ │ ├── ed25519.h │ │ │ │ ├── jpake.h │ │ │ │ ├── pke.h │ │ │ │ ├── pke_algorithm.h │ │ │ │ ├── pke_common.h │ │ │ │ ├── pke_config.h │ │ │ │ ├── pke_portable.h │ │ │ │ ├── pke_prime.h │ │ │ │ ├── pke_utility.h │ │ │ │ ├── rsa.h │ │ │ │ ├── sm2.h │ │ │ │ ├── sm9.h │ │ │ │ └── x25519.h │ │ │ │ ├── plic.h │ │ │ │ ├── pm │ │ │ │ ├── pm.h │ │ │ │ └── pm_internal.h │ │ │ │ ├── rf │ │ │ │ ├── aoa.h │ │ │ │ ├── hadm.h │ │ │ │ ├── rf_ble.h │ │ │ │ ├── rf_common.h │ │ │ │ ├── rf_dma.h │ │ │ │ ├── rf_internal.h │ │ │ │ ├── rf_private.h │ │ │ │ └── rf_zigbee.h │ │ │ │ ├── ske │ │ │ │ ├── ske.h │ │ │ │ ├── ske_algorithm.h │ │ │ │ ├── ske_basic.h │ │ │ │ ├── ske_cbc.h │ │ │ │ ├── ske_ccm.h │ │ │ │ ├── ske_cfb.h │ │ │ │ ├── ske_ctr.h │ │ │ │ ├── ske_ecb.h │ │ │ │ ├── ske_gcm_gmac.h │ │ │ │ ├── ske_ofb.h │ │ │ │ └── ske_portable.h │ │ │ │ ├── stimer.h │ │ │ │ ├── swire.h │ │ │ │ ├── sys.h │ │ │ │ └── trng │ │ │ │ ├── trng.h │ │ │ │ ├── trng_algorithm.h │ │ │ │ ├── trng_basic.h │ │ │ │ ├── trng_config.h │ │ │ │ └── trng_portable.h │ │ ├── lpc.h │ │ ├── plic_sw.h │ │ ├── plmt.h │ │ ├── pwm.h │ │ ├── qdec.h │ │ ├── reg_include │ │ │ ├── adc_reg.h │ │ │ ├── analog_afe1v_reg.h │ │ │ ├── analog_afe3v_reg.h │ │ │ ├── analog_reg.h │ │ │ ├── audio_reg.h │ │ │ ├── core_reg.h │ │ │ ├── dma_reg.h │ │ │ ├── gpio_reg.h │ │ │ ├── hash_reg.h │ │ │ ├── i2c_reg.h │ │ │ ├── ir_learn_reg.h │ │ │ ├── mspi_reg.h │ │ │ ├── pke_reg.h │ │ │ ├── plic_reg.h │ │ │ ├── plic_sw_reg.h │ │ │ ├── plmt_reg.h │ │ │ ├── pwm_reg.h │ │ │ ├── qdec_reg.h │ │ │ ├── register.h │ │ │ ├── rf_reg.h │ │ │ ├── ske_reg.h │ │ │ ├── soc.h │ │ │ ├── spi_reg.h │ │ │ ├── stimer_reg.h │ │ │ ├── swire_reg.h │ │ │ ├── timer_reg.h │ │ │ ├── uart_reg.h │ │ │ └── usb_reg.h │ │ ├── s7816.h │ │ ├── spi.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ └── watchdog.h │ ├── chip_tl721x │ │ ├── adc.h │ │ ├── audio.h │ │ ├── dma.h │ │ ├── driver.h │ │ ├── error_handler │ │ │ ├── error_handler.c │ │ │ └── error_handler.h │ │ ├── flash.h │ │ ├── flash │ │ │ ├── flash_common.c │ │ │ ├── flash_common.h │ │ │ ├── flash_mid156085.c │ │ │ ├── flash_mid156085.h │ │ │ └── flash_type.h │ │ ├── gpio.h │ │ ├── gpio_default.h │ │ ├── i2c.h │ │ ├── ir_learn.h │ │ ├── lib │ │ │ └── include │ │ │ │ ├── analog.h │ │ │ │ ├── chacha20_poly1305 │ │ │ │ ├── chacha20_poly1305.h │ │ │ │ ├── chacha20_poly1305_algorithm.h │ │ │ │ ├── chacha20_poly1305_basic.h │ │ │ │ └── chacha20_poly1305_portable.h │ │ │ │ ├── clock.h │ │ │ │ ├── core.h │ │ │ │ ├── crypto_common │ │ │ │ ├── eccp_curve.h │ │ │ │ └── utility.h │ │ │ │ ├── emi.h │ │ │ │ ├── emi_internal.h │ │ │ │ ├── flash_base.h │ │ │ │ ├── hash │ │ │ │ ├── hash.h │ │ │ │ ├── hash_algorithm.h │ │ │ │ ├── hash_basic.h │ │ │ │ ├── hash_portable.h │ │ │ │ ├── hmac.h │ │ │ │ ├── hmac_md5.h │ │ │ │ ├── hmac_sha1.h │ │ │ │ ├── hmac_sha224.h │ │ │ │ ├── hmac_sha256.h │ │ │ │ ├── hmac_sha384.h │ │ │ │ ├── hmac_sha512.h │ │ │ │ ├── hmac_sha512_224.h │ │ │ │ ├── hmac_sha512_256.h │ │ │ │ ├── hmac_sm3.h │ │ │ │ ├── md5.h │ │ │ │ ├── pbkdf2.h │ │ │ │ ├── sha1.h │ │ │ │ ├── sha224.h │ │ │ │ ├── sha256.h │ │ │ │ ├── sha384.h │ │ │ │ ├── sha512.h │ │ │ │ ├── sha512_224.h │ │ │ │ ├── sha512_256.h │ │ │ │ └── sm3.h │ │ │ │ ├── mspi.h │ │ │ │ ├── otp.h │ │ │ │ ├── pke │ │ │ │ ├── eccp_curve.h │ │ │ │ ├── ecdh.h │ │ │ │ ├── ecdsa.h │ │ │ │ ├── pke.h │ │ │ │ ├── pke_algorithm.h │ │ │ │ ├── pke_portable.h │ │ │ │ ├── pke_prime.h │ │ │ │ └── rsa.h │ │ │ │ ├── plic.h │ │ │ │ ├── pm │ │ │ │ ├── pm.h │ │ │ │ └── pm_internal.h │ │ │ │ ├── rf │ │ │ │ ├── aoa.h │ │ │ │ ├── hadm.h │ │ │ │ ├── rf_ble.h │ │ │ │ ├── rf_common.h │ │ │ │ ├── rf_dma.h │ │ │ │ ├── rf_internal.h │ │ │ │ ├── rf_private.h │ │ │ │ └── rf_zigbee.h │ │ │ │ ├── ske │ │ │ │ ├── ske.h │ │ │ │ ├── ske_algorithm.h │ │ │ │ ├── ske_basic.h │ │ │ │ ├── ske_cbc.h │ │ │ │ ├── ske_ccm.h │ │ │ │ ├── ske_cfb.h │ │ │ │ ├── ske_ctr.h │ │ │ │ ├── ske_ecb.h │ │ │ │ ├── ske_gcm_gmac.h │ │ │ │ ├── ske_ofb.h │ │ │ │ └── ske_portable.h │ │ │ │ ├── stimer.h │ │ │ │ ├── swire.h │ │ │ │ ├── sys.h │ │ │ │ └── trng │ │ │ │ ├── trng.h │ │ │ │ ├── trng_algorithm.h │ │ │ │ └── trng_portable.h │ │ ├── lpc.h │ │ ├── plic_sw.h │ │ ├── plmt.h │ │ ├── pwm.h │ │ ├── qdec.h │ │ ├── reg_include │ │ │ ├── adc_reg.h │ │ │ ├── analog_afe1v_reg.h │ │ │ ├── analog_afe3v_reg.h │ │ │ ├── analog_reg.h │ │ │ ├── audio_reg.h │ │ │ ├── chacha20_poly1305_reg.h │ │ │ ├── core_reg.h │ │ │ ├── dma_reg.h │ │ │ ├── gpio_reg.h │ │ │ ├── hash_reg.h │ │ │ ├── i2c_reg.h │ │ │ ├── ir_learn_reg.h │ │ │ ├── mspi_reg.h │ │ │ ├── otp_reg.h │ │ │ ├── pke_reg.h │ │ │ ├── plic_reg.h │ │ │ ├── plic_sw_reg.h │ │ │ ├── plmt_reg.h │ │ │ ├── pwm_reg.h │ │ │ ├── qdec_reg.h │ │ │ ├── register.h │ │ │ ├── rf_reg.h │ │ │ ├── ske_reg.h │ │ │ ├── soc.h │ │ │ ├── spi_reg.h │ │ │ ├── stimer_reg.h │ │ │ ├── swire_reg.h │ │ │ ├── timer_reg.h │ │ │ ├── trng_reg.h │ │ │ ├── uart_reg.h │ │ │ └── usb_reg.h │ │ ├── s7816.h │ │ ├── spi.h │ │ ├── timer.h │ │ ├── uart.h │ │ ├── usbhw.h │ │ └── watchdog.h │ ├── lib │ │ ├── libdrivers_8258.a │ │ ├── libdrivers_826x.a │ │ ├── libdrivers_8278.a │ │ ├── libdrivers_b91.a │ │ ├── libdrivers_b92.a │ │ ├── libdrivers_tl321x.a │ │ └── libdrivers_tl721x.a │ ├── platform.h │ ├── riscv │ │ ├── firmware_encrypt.h │ │ └── libfirmware_encrypt.a │ ├── services │ │ ├── b85m │ │ │ └── irq_handler.c │ │ ├── b91 │ │ │ ├── irq_handler.c │ │ │ └── plic_isr.c │ │ ├── b92 │ │ │ ├── irq_handler.c │ │ │ └── plic_isr.c │ │ ├── tl321x │ │ │ ├── irq_handler.c │ │ │ └── plic_isr.c │ │ └── tl721x │ │ │ ├── irq_handler.c │ │ │ └── plic_isr.c │ └── tc32 │ │ ├── div_mod.S │ │ ├── firmware_encrypt.h │ │ ├── libfirmware_encrypt.a │ │ └── libsoft-fp.a ├── proj │ ├── common │ │ ├── assert.h │ │ ├── bit.h │ │ ├── compiler.h │ │ ├── list.c │ │ ├── list.h │ │ ├── macro_trick.h │ │ ├── mempool.c │ │ ├── mempool.h │ │ ├── static_assert.h │ │ ├── string.c │ │ ├── string.h │ │ ├── tlPrintf.c │ │ ├── tlPrintf.h │ │ ├── types.h │ │ ├── utility.c │ │ ├── utility.h │ │ └── utlist.h │ ├── drivers │ │ ├── drv_adc.c │ │ ├── drv_adc.h │ │ ├── drv_calibration.c │ │ ├── drv_calibration.h │ │ ├── drv_flash.c │ │ ├── drv_flash.h │ │ ├── drv_gpio.c │ │ ├── drv_gpio.h │ │ ├── drv_hw.c │ │ ├── drv_hw.h │ │ ├── drv_i2c.c │ │ ├── drv_i2c.h │ │ ├── drv_keyboard.c │ │ ├── drv_keyboard.h │ │ ├── drv_nv.c │ │ ├── drv_nv.h │ │ ├── drv_pm.c │ │ ├── drv_pm.h │ │ ├── drv_putchar.c │ │ ├── drv_putchar.h │ │ ├── drv_pwm.c │ │ ├── drv_pwm.h │ │ ├── drv_radio.h │ │ ├── drv_security.c │ │ ├── drv_security.h │ │ ├── drv_spi.c │ │ ├── drv_spi.h │ │ ├── drv_timer.c │ │ ├── drv_timer.h │ │ ├── drv_uart.c │ │ ├── drv_uart.h │ │ ├── drv_usb.h │ │ └── usb │ │ │ ├── app │ │ │ ├── usbcdc.c │ │ │ ├── usbcdc.h │ │ │ ├── usbkb.c │ │ │ ├── usbkb.h │ │ │ ├── usbkb_i.h │ │ │ ├── usbmouse.c │ │ │ ├── usbmouse.h │ │ │ ├── usbmouse_i.h │ │ │ ├── usbvendor.c │ │ │ ├── usbvendor.h │ │ │ └── usbvendor_i.h │ │ │ ├── usb.c │ │ │ ├── usb.h │ │ │ ├── usb_common.h │ │ │ ├── usbdesc.c │ │ │ ├── usbdesc.h │ │ │ └── usbstd │ │ │ ├── AudioClassCommon.h │ │ │ ├── CDCClassCommon.h │ │ │ ├── CDCClassDevice.h │ │ │ ├── HIDClassCommon.h │ │ │ ├── HIDClassDevice.h │ │ │ ├── HIDReportData.h │ │ │ ├── MassStorageClassCommon.h │ │ │ ├── PrinterClassCommon.h │ │ │ ├── StdDescriptors.h │ │ │ ├── StdRequestType.h │ │ │ ├── USBController.h │ │ │ └── usbstd.h │ ├── os │ │ ├── ev.c │ │ ├── ev.h │ │ ├── ev_buffer.c │ │ ├── ev_buffer.h │ │ ├── ev_poll.c │ │ ├── ev_poll.h │ │ ├── ev_queue.c │ │ ├── ev_queue.h │ │ ├── ev_rtc.c │ │ ├── ev_rtc.h │ │ ├── ev_timer.c │ │ └── ev_timer.h │ └── tl_common.h ├── tools │ ├── tl_check_fw.sh │ ├── tl_check_fw2.exe │ ├── tl_check_fw2.out │ └── tl_link_load.sh ├── zbhci │ ├── uart │ │ └── hci_uart.c │ ├── usbCDC │ │ └── zbhci_usb_cdc.c │ ├── usbHID │ │ └── zbhci_usb_hid.c │ ├── usbPrint │ │ └── hci_usbPrint.c │ ├── zbhci.c │ ├── zbhci.h │ ├── zbhciCmdProcess.c │ └── zbhci_zclHandler.c └── zigbee │ ├── af │ ├── zb_af.c │ └── zb_af.h │ ├── aps │ ├── aps_api.h │ └── aps_group.c │ ├── bdb │ ├── bdb.c │ └── includes │ │ └── bdb.h │ ├── common │ ├── includes │ │ ├── zb_buffer.h │ │ ├── zb_common.h │ │ ├── zb_config.h │ │ ├── zb_list.h │ │ ├── zb_task_queue.h │ │ └── zb_version.h │ ├── zb_config.c │ └── zb_version.c │ ├── gp │ ├── cGP_stub.h │ ├── dGP_stub.h │ ├── gp.c │ ├── gp.h │ ├── gpEpCfg.c │ ├── gp_base.h │ ├── gp_proxy.c │ ├── gp_proxy.h │ ├── gp_proxyTab.c │ ├── gp_sec.h │ ├── gp_sink.c │ ├── gp_sink.h │ ├── gp_sinkTab.c │ ├── gp_trans.c │ ├── gp_trans.h │ └── gp_transCfg.c │ ├── lib │ ├── riscv │ │ ├── libzb_coordinator.a │ │ ├── libzb_ed.a │ │ └── libzb_router.a │ ├── riscv_gcc12_v5 │ │ ├── libzb_coordinator.a │ │ ├── libzb_ed.a │ │ └── libzb_router.a │ ├── riscv_gcc12_v5f │ │ ├── libzb_coordinator.a │ │ ├── libzb_ed.a │ │ └── libzb_router.a │ └── tc32 │ │ ├── libzb_coordinator.a │ │ ├── libzb_ed.a │ │ └── libzb_router.a │ ├── mac │ ├── includes │ │ ├── mac_phy.h │ │ ├── mac_trx_api.h │ │ ├── tl_zb_mac.h │ │ └── tl_zb_mac_pib.h │ ├── mac_phy.c │ └── mac_pib.c │ ├── nwk │ └── includes │ │ ├── nwk.h │ │ ├── nwk_addr_map.h │ │ ├── nwk_ctx.h │ │ ├── nwk_neighbor.h │ │ └── nwk_nib.h │ ├── ota │ ├── ota.c │ ├── ota.h │ └── otaEpCfg.c │ ├── ss │ ├── security_service.h │ └── ss_nv.c │ ├── wwah │ ├── wwah.c │ ├── wwah.h │ └── wwahEpCfg.c │ ├── zbapi │ └── zb_api.h │ ├── zcl │ ├── closures │ │ ├── zcl_door_lock.c │ │ ├── zcl_door_lock.h │ │ ├── zcl_door_lock_attr.c │ │ ├── zcl_window_covering.c │ │ ├── zcl_window_covering.h │ │ └── zcl_window_covering_attr.c │ ├── commissioning │ │ ├── zcl_commissioning.c │ │ ├── zcl_commissioning.h │ │ └── zcl_commissioning_attr.c │ ├── general │ │ ├── zcl_alarm.c │ │ ├── zcl_alarm.h │ │ ├── zcl_alarm_attr.c │ │ ├── zcl_basic.c │ │ ├── zcl_basic.h │ │ ├── zcl_basic_attr.c │ │ ├── zcl_binary_input.c │ │ ├── zcl_binary_input.h │ │ ├── zcl_binary_input_attr.c │ │ ├── zcl_binary_output.c │ │ ├── zcl_binary_output.h │ │ ├── zcl_binary_output_attr.c │ │ ├── zcl_devTemperatureCfg.c │ │ ├── zcl_devTemperatureCfg.h │ │ ├── zcl_devTemperatureCfg_attr.c │ │ ├── zcl_diagnostics.c │ │ ├── zcl_diagnostics.h │ │ ├── zcl_diagnostics_attr.c │ │ ├── zcl_greenPower.c │ │ ├── zcl_greenPower.h │ │ ├── zcl_greenPower_attr.c │ │ ├── zcl_group.c │ │ ├── zcl_group.h │ │ ├── zcl_group_attr.c │ │ ├── zcl_identify.c │ │ ├── zcl_identify.h │ │ ├── zcl_identify_attr.c │ │ ├── zcl_level.c │ │ ├── zcl_level.h │ │ ├── zcl_level_attr.c │ │ ├── zcl_multistate_input.c │ │ ├── zcl_multistate_input.h │ │ ├── zcl_multistate_input_attr.c │ │ ├── zcl_multistate_output.c │ │ ├── zcl_multistate_output.h │ │ ├── zcl_multistate_output_attr.c │ │ ├── zcl_onoff.c │ │ ├── zcl_onoff.h │ │ ├── zcl_onoff_attr.c │ │ ├── zcl_pollCtrl.c │ │ ├── zcl_pollCtrl.h │ │ ├── zcl_pollCtrl_attr.c │ │ ├── zcl_powerCfg.c │ │ ├── zcl_powerCfg.h │ │ ├── zcl_powerCfg_attr.c │ │ ├── zcl_scene.c │ │ ├── zcl_scene.h │ │ ├── zcl_scene_attr.c │ │ ├── zcl_time.c │ │ ├── zcl_time.h │ │ └── zcl_time_attr.c │ ├── hvac │ │ ├── zcl_thermostat.c │ │ └── zcl_thermostat.h │ ├── light_color_control │ │ ├── zcl_light_colorCtrl.c │ │ ├── zcl_light_colorCtrl.h │ │ └── zcl_light_colorCtrl_attr.c │ ├── measument_sensing │ │ ├── zcl_electrical_measurement.c │ │ ├── zcl_electrical_measurement.h │ │ ├── zcl_electrical_measurement_attr.c │ │ ├── zcl_illuminance_measurement.c │ │ ├── zcl_illuminance_measurement.h │ │ ├── zcl_illuminance_measurement_attr.c │ │ ├── zcl_occupancy_sensing.c │ │ ├── zcl_occupancy_sensing.h │ │ ├── zcl_occupancy_sensing_attr.c │ │ ├── zcl_temperature_measurement.c │ │ ├── zcl_temperature_measurement.h │ │ └── zcl_temperature_measurement_attr.c │ ├── ota_upgrading │ │ ├── zcl_ota.c │ │ ├── zcl_ota.h │ │ └── zcl_ota_attr.c │ ├── security_safety │ │ ├── zcl_ias_ace.c │ │ ├── zcl_ias_ace.h │ │ ├── zcl_ias_wd.c │ │ ├── zcl_ias_wd.h │ │ ├── zcl_ias_wd_attr.c │ │ ├── zcl_ias_zone.c │ │ ├── zcl_ias_zone.h │ │ └── zcl_ias_zone_attr.c │ ├── smart_energy │ │ ├── zcl_metering.c │ │ ├── zcl_metering.h │ │ └── zcl_metering_attr.c │ ├── zcl.c │ ├── zcl.h │ ├── zcl_config.h │ ├── zcl_const.h │ ├── zcl_include.h │ ├── zcl_nv.c │ ├── zcl_nv.h │ ├── zcl_reporting.c │ ├── zcl_wwah │ │ ├── zcl_wwah.c │ │ ├── zcl_wwah.h │ │ └── zcl_wwah_attr.c │ └── zll_commissioning │ │ ├── zcl_touchlink_attr.h │ │ ├── zcl_toucklink_security.c │ │ ├── zcl_zllTouchLinkDiscovery.c │ │ ├── zcl_zllTouchLinkJoinOrStart.c │ │ ├── zcl_zll_commissioning.c │ │ ├── zcl_zll_commissioning.h │ │ └── zcl_zll_commissioning_internal.h │ └── zdo │ ├── zdo_api.h │ ├── zdp.c │ └── zdp.h ├── tools ├── TlsrComProg.py ├── TlsrPgm.py ├── floader.bin ├── make_ota.py ├── tl_check_fw.py ├── tl_check_fw.sh ├── tl_check_fw2.exe └── tl_link_load.sh └── zigbee2mqtt ├── configuration.yaml ├── convertor ├── watermeter.js └── watermeter_wleak.js └── ota └── local_ota_index.json /.gitignore: -------------------------------------------------------------------------------- 1 | out/ 2 | doc_local/ 3 | build/ 4 | 5 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | watermeter_zed 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | 26 | 27 | -------------------------------------------------------------------------------- /.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=_my 3 | formatter_settings_version=1 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/README_rus.md=UTF-8 3 | -------------------------------------------------------------------------------- /bin/6565-0204-20043001-watermeter_zed.zigbee: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/bin/6565-0204-20043001-watermeter_zed.zigbee -------------------------------------------------------------------------------- /bin/watermeter_zed_V2.0.04.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/bin/watermeter_zed_V2.0.04.bin -------------------------------------------------------------------------------- /doc/box/box1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/box/box1.jpg -------------------------------------------------------------------------------- /doc/box/box2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/box/box2.jpg -------------------------------------------------------------------------------- /doc/box/box3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/box/box3.jpg -------------------------------------------------------------------------------- /doc/box/box4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/box/box4.jpg -------------------------------------------------------------------------------- /doc/box/box_v2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/box/box_v2.jpg -------------------------------------------------------------------------------- /doc/images/E180-Z5812SP.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/E180-Z5812SP.jpg -------------------------------------------------------------------------------- /doc/images/HA_all_preset_disabled.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/HA_all_preset_disabled.jpg -------------------------------------------------------------------------------- /doc/images/HA_device.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/HA_device.jpg -------------------------------------------------------------------------------- /doc/images/HA_preset_disabled.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/HA_preset_disabled.jpg -------------------------------------------------------------------------------- /doc/images/board_bottom_v2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/board_bottom_v2.jpg -------------------------------------------------------------------------------- /doc/images/board_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/board_top.jpg -------------------------------------------------------------------------------- /doc/images/board_top_v2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/board_top_v2.jpg -------------------------------------------------------------------------------- /doc/images/board_v2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/board_v2.jpg -------------------------------------------------------------------------------- /doc/images/device_close_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/device_close_box.jpg -------------------------------------------------------------------------------- /doc/images/device_front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/device_front.jpg -------------------------------------------------------------------------------- /doc/images/device_open_box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/device_open_box.jpg -------------------------------------------------------------------------------- /doc/images/device_open_box2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/device_open_box2.jpg -------------------------------------------------------------------------------- /doc/images/device_v2_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/device_v2_big.png -------------------------------------------------------------------------------- /doc/images/exposes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/exposes.jpg -------------------------------------------------------------------------------- /doc/images/gidrolock_wsp1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/gidrolock_wsp1.jpg -------------------------------------------------------------------------------- /doc/images/gidrolock_wsp2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/gidrolock_wsp2.jpg -------------------------------------------------------------------------------- /doc/images/ota_check_update.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ota_check_update.jpg -------------------------------------------------------------------------------- /doc/images/ota_progress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ota_progress.jpg -------------------------------------------------------------------------------- /doc/images/ota_update.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ota_update.jpg -------------------------------------------------------------------------------- /doc/images/ota_update_abort.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ota_update_abort.jpg -------------------------------------------------------------------------------- /doc/images/pin_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/pin_header.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-close_counter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-close_counter.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-open_counter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-open_counter.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-ota_update.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-ota_update.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-poll_rate_3_sec.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-poll_rate_3_sec.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-sleep_device.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-sleep_device.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-start_and_work_6min.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-start_and_work_6min.jpg -------------------------------------------------------------------------------- /doc/images/ppk2-start_device.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/ppk2-start_device.jpg -------------------------------------------------------------------------------- /doc/images/schematic_watermeter_zed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/schematic_watermeter_zed.jpg -------------------------------------------------------------------------------- /doc/images/schematic_watermeter_zed_v2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/schematic_watermeter_zed_v2.jpg -------------------------------------------------------------------------------- /doc/images/telink_pgm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/telink_pgm.jpg -------------------------------------------------------------------------------- /doc/images/telink_tlsr8258_dongle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/telink_tlsr8258_dongle.jpg -------------------------------------------------------------------------------- /doc/images/watermeter_board_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/watermeter_board_top.jpg -------------------------------------------------------------------------------- /doc/images/wl_sensor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/wl_sensor.jpg -------------------------------------------------------------------------------- /doc/images/z2m_bind1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/z2m_bind1.jpg -------------------------------------------------------------------------------- /doc/images/z2m_bind2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/z2m_bind2.jpg -------------------------------------------------------------------------------- /doc/images/z2m_device.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/z2m_device.jpg -------------------------------------------------------------------------------- /doc/images/z2m_onoffSwitchCfg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/z2m_onoffSwitchCfg.jpg -------------------------------------------------------------------------------- /doc/images/z2m_reporting.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/z2m_reporting.jpg -------------------------------------------------------------------------------- /doc/images/zigbee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/doc/images/zigbee.png -------------------------------------------------------------------------------- /make/af.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zigbee/af 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/zigbee/af/zb_af.o 7 | 8 | 9 | # Each subdirectory must supply rules for building sources it contributes 10 | $(OUT_PATH)/zigbee/af/%.o: $(SDK_PATH)/zigbee/af/%.c 11 | @echo 'Building file: $<' 12 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 13 | 14 | 15 | -------------------------------------------------------------------------------- /make/apps.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /apps/common 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/apps/common/factory_reset.o \ 7 | $(OUT_PATH)/apps/common/firmwareEncryptChk.o \ 8 | $(OUT_PATH)/apps/common/main.o \ 9 | $(OUT_PATH)/apps/common/module_test.o 10 | 11 | 12 | # Each subdirectory must supply rules for building sources it contributes 13 | $(OUT_PATH)/apps/common/%.o: $(SDK_PATH)/apps/common/%.c 14 | @echo 'Building file: $<' 15 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 16 | 17 | 18 | -------------------------------------------------------------------------------- /make/aps.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zigbee/aps 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/zigbee/aps/aps_group.o 7 | 8 | # Each subdirectory must supply rules for building sources it contributes 9 | $(OUT_PATH)/zigbee/aps/%.o: $(SDK_PATH)/zigbee/aps/%.c 10 | @echo 'Building file: $<' 11 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 12 | 13 | 14 | -------------------------------------------------------------------------------- /make/bdb.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zigbee/bdb 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/zigbee/bdb/bdb.o 7 | 8 | 9 | # Each subdirectory must supply rules for building sources it contributes 10 | $(OUT_PATH)/zigbee/bdb/%.o: $(SDK_PATH)/zigbee/bdb/%.c 11 | @echo 'Building file: $<' 12 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 13 | 14 | 15 | -------------------------------------------------------------------------------- /make/common.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zigbee/common 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/zigbee/common/zb_config.o \ 7 | $(OUT_PATH)/zigbee/common/zb_version.o 8 | 9 | 10 | 11 | # Each subdirectory must supply rules for building sources it contributes 12 | $(OUT_PATH)/zigbee/common/%.o: $(SDK_PATH)/zigbee/common/%.c 13 | @echo 'Building file: $<' 14 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 15 | 16 | 17 | -------------------------------------------------------------------------------- /make/div_mod.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /platform/tc32 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/platform/tc32/div_mod.o 7 | 8 | 9 | # Each subdirectory must supply rules for building sources it contributes 10 | $(OUT_PATH)/platform/tc32/%.o: $(SDK_PATH)/platform/tc32/%.S 11 | @echo 'Building file: $<' 12 | @$(CC) $(BOOT_FLAG) $(INCLUDE_PATHS) -c -o"$@" "$<" 13 | 14 | -------------------------------------------------------------------------------- /make/gp.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | 3 | OUT_DIR += \ 4 | /zigbee/gp 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/zigbee/gp/gp.o \ 8 | $(OUT_PATH)/zigbee/gp/gpEpCfg.o \ 9 | $(OUT_PATH)/zigbee/gp/gp_proxy.o \ 10 | $(OUT_PATH)/zigbee/gp/gp_proxyTab.o \ 11 | $(OUT_PATH)/zigbee/gp/gp_sink.o \ 12 | $(OUT_PATH)/zigbee/gp/gp_sinkTab.o \ 13 | $(OUT_PATH)/zigbee/gp/gp_trans.o \ 14 | $(OUT_PATH)/zigbee/gp/gp_transCfg.o 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | $(OUT_PATH)/zigbee/gp/%.o: $(SDK_PATH)/zigbee/gp/%.c 18 | @echo 'Building file: $<' 19 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 20 | -------------------------------------------------------------------------------- /make/mac.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | 3 | OUT_DIR += \ 4 | /zigbee/mac \ 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/zigbee/mac/mac_phy.o \ 8 | $(OUT_PATH)/zigbee/mac/mac_pib.o 9 | 10 | # Each subdirectory must supply rules for building sources it contributes 11 | $(OUT_PATH)/zigbee/mac/%.o: $(SDK_PATH)/zigbee/mac/%.c 12 | @echo 'Building file: $<' 13 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 14 | -------------------------------------------------------------------------------- /make/ota.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | 3 | OUT_DIR += \ 4 | /zigbee/ota 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/zigbee/ota/ota.o \ 8 | $(OUT_PATH)/zigbee/ota/otaEpCfg.o 9 | 10 | #$(OUT_PATH)/zigbee/ota/otaCRC.o 11 | 12 | 13 | # Each subdirectory must supply rules for building sources it contributes 14 | $(OUT_PATH)/zigbee/ota/%.o: $(SDK_PATH)/zigbee/ota/%.c 15 | @echo 'Building file: $<' 16 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 17 | -------------------------------------------------------------------------------- /make/platform.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /platform/chip_8258 \ 4 | /platform/chip_8258/flash \ 5 | /platform/services 6 | 7 | 8 | OBJS += \ 9 | $(OUT_PATH)/platform/chip_8258/flash.o \ 10 | $(OUT_PATH)/platform/chip_8258/adc.o \ 11 | $(OUT_PATH)/platform/chip_8258/flash/flash_common.o \ 12 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid011460c8.o \ 13 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid1060c8.o \ 14 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid13325e.o \ 15 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid134051.o \ 16 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid136085.o \ 17 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid1360c8.o \ 18 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid1360eb.o \ 19 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid14325e.o \ 20 | $(OUT_PATH)/platform/chip_8258/flash/flash_mid1460c8.o \ 21 | $(OUT_PATH)/platform/services/b85m/irq_handler.o 22 | 23 | 24 | # Each subdirectory must supply rules for building sources it contributes 25 | $(OUT_PATH)/platform/%.o: $(SDK_PATH)/platform/%.c 26 | @echo 'Building file: $<' 27 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 28 | 29 | -------------------------------------------------------------------------------- /make/platformS.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /platform/boot \ 4 | /platform/boot/8258 \ 5 | /platform/boot/826x \ 6 | /platform/boot/8278 7 | 8 | OBJS += \ 9 | $(OUT_PATH)/platform/boot/link_cfg.o \ 10 | $(OUT_PATH)/platform/boot/8258/cstartup_8258.o \ 11 | $(OUT_PATH)/platform/boot/826x/cstartup_826x.o \ 12 | $(OUT_PATH)/platform/boot/8278/cstartup_8278.o 13 | 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | $(OUT_PATH)/platform/boot/%.o: $(SDK_PATH)/platform/boot/%.S 18 | @echo 'Building file: $<' 19 | @$(CC) $(BOOT_FLAG) $(INCLUDE_PATHS) -c -o"$@" "$<" 20 | 21 | -------------------------------------------------------------------------------- /make/proj.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /proj/common \ 4 | /proj/drivers \ 5 | /proj/drivers/usb \ 6 | /proj/drivers/usb/app \ 7 | /proj/os 8 | 9 | OBJS += \ 10 | $(OUT_PATH)/proj/common/list.o \ 11 | $(OUT_PATH)/proj/common/mempool.o \ 12 | $(OUT_PATH)/proj/common/string.o \ 13 | $(OUT_PATH)/proj/common/tlPrintf.o \ 14 | $(OUT_PATH)/proj/common/utility.o \ 15 | $(OUT_PATH)/proj/drivers/drv_adc.o \ 16 | $(OUT_PATH)/proj/drivers/drv_calibration.o \ 17 | $(OUT_PATH)/proj/drivers/drv_flash.o \ 18 | $(OUT_PATH)/proj/drivers/drv_gpio.o \ 19 | $(OUT_PATH)/proj/drivers/drv_hw.o \ 20 | $(OUT_PATH)/proj/drivers/drv_i2c.o \ 21 | $(OUT_PATH)/proj/drivers/drv_keyboard.o \ 22 | $(OUT_PATH)/proj/drivers/drv_nv.o \ 23 | $(OUT_PATH)/proj/drivers/drv_pm.o \ 24 | $(OUT_PATH)/proj/drivers/drv_putchar.o \ 25 | $(OUT_PATH)/proj/drivers/drv_pwm.o \ 26 | $(OUT_PATH)/proj/drivers/drv_security.o \ 27 | $(OUT_PATH)/proj/drivers/drv_spi.o \ 28 | $(OUT_PATH)/proj/drivers/drv_timer.o \ 29 | $(OUT_PATH)/proj/drivers/drv_uart.o \ 30 | $(OUT_PATH)/proj/drivers/usb/usb.o \ 31 | $(OUT_PATH)/proj/drivers/usb/usbdesc.o \ 32 | $(OUT_PATH)/proj/drivers/usb/app/usbcdc.o \ 33 | $(OUT_PATH)/proj/drivers/usb/app/usbkb.o \ 34 | $(OUT_PATH)/proj/drivers/usb/app/usbmouse.o \ 35 | $(OUT_PATH)/proj/drivers/usb/app/usbvendor.o \ 36 | $(OUT_PATH)/proj/os/ev.o \ 37 | $(OUT_PATH)/proj/os/ev_buffer.o \ 38 | $(OUT_PATH)/proj/os/ev_poll.o \ 39 | $(OUT_PATH)/proj/os/ev_queue.o \ 40 | $(OUT_PATH)/proj/os/ev_rtc.o \ 41 | $(OUT_PATH)/proj/os/ev_timer.o 42 | 43 | 44 | # Each subdirectory must supply rules for building sources it contributes 45 | $(OUT_PATH)/proj/%.o: $(SDK_PATH)/proj/%.c 46 | @echo 'Building file: $<' 47 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 48 | 49 | 50 | -------------------------------------------------------------------------------- /make/ss.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | 3 | OUT_DIR += \ 4 | /zigbee/ss 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/zigbee/ss/ss_nv.o 8 | 9 | # Each subdirectory must supply rules for building sources it contributes 10 | $(OUT_PATH)/zigbee/ss/%.o: $(SDK_PATH)/zigbee/ss/%.c 11 | @echo 'Building file: $<' 12 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 13 | 14 | -------------------------------------------------------------------------------- /make/wwah.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | 3 | OUT_DIR += \ 4 | /zigbee/wwah 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/zigbee/wwah/wwah.o \ 8 | $(OUT_PATH)/zigbee/wwah/wwahEpCfg.o 9 | 10 | 11 | # Each subdirectory must supply rules for building sources it contributes 12 | $(OUT_PATH)/zigbee/wwah/%.o: $(SDK_PATH)/zigbee/wwah/%.c 13 | @echo 'Building file: $<' 14 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 15 | 16 | -------------------------------------------------------------------------------- /make/zbhci.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zbhci \ 4 | /zbhci/usbPrint \ 5 | /zbhci/usbHID \ 6 | /zbhci/usbCDC \ 7 | /zbhci/uart 8 | 9 | OBJS += \ 10 | $(OUT_PATH)/zbhci/zbhci.o \ 11 | $(OUT_PATH)/zbhci/zbhciCmdProcess.o \ 12 | $(OUT_PATH)/zbhci/zbhci_zclHandler.o \ 13 | $(OUT_PATH)/zbhci/usbPrint/hci_usbPrint.o \ 14 | $(OUT_PATH)/zbhci/usbHID/zbhci_usb_hid.o \ 15 | $(OUT_PATH)/zbhci/usbCDC/zbhci_usb_cdc.o \ 16 | $(OUT_PATH)/zbhci/uart/hci_uart.o 17 | 18 | 19 | 20 | # Each subdirectory must supply rules for building sources it contributes 21 | $(OUT_PATH)/zbhci/%.o: $(SDK_PATH)/zbhci/%.c 22 | @echo 'Building file: $<' 23 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 24 | 25 | 26 | -------------------------------------------------------------------------------- /make/zdo.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /zigbee/zdo 4 | 5 | OBJS += \ 6 | $(OUT_PATH)/zigbee/zdo/zdp.o 7 | 8 | # Each subdirectory must supply rules for building sources it contributes 9 | $(OUT_PATH)/zigbee/zdo/%.o: $(SDK_PATH)/zigbee/zdo/%.c 10 | @echo 'Building file: $<' 11 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 12 | 13 | 14 | -------------------------------------------------------------------------------- /project.mk: -------------------------------------------------------------------------------- 1 | # Add inputs and outputs from these tool invocations to the build variables 2 | OUT_DIR += \ 3 | /$(SRC_PATH) \ 4 | /$(SRC_PATH)/common 5 | 6 | OBJS += \ 7 | $(OUT_PATH)/$(SRC_PATH)/common/main.o \ 8 | $(OUT_PATH)/$(SRC_PATH)/zcl/zcl_onoffSwitchCfg.o \ 9 | $(OUT_PATH)/$(SRC_PATH)/app_pm.o \ 10 | $(OUT_PATH)/$(SRC_PATH)/app_button.o \ 11 | $(OUT_PATH)/$(SRC_PATH)/app_led.o \ 12 | $(OUT_PATH)/$(SRC_PATH)/app_counter.o \ 13 | $(OUT_PATH)/$(SRC_PATH)/app_leak.o \ 14 | $(OUT_PATH)/$(SRC_PATH)/app_battery.o \ 15 | $(OUT_PATH)/$(SRC_PATH)/app_reporting.o \ 16 | $(OUT_PATH)/$(SRC_PATH)/app_dev_config.o \ 17 | $(OUT_PATH)/$(SRC_PATH)/app_endpoint_cfg.o \ 18 | $(OUT_PATH)/$(SRC_PATH)/app_utility.o \ 19 | $(OUT_PATH)/$(SRC_PATH)/watermeter.o \ 20 | $(OUT_PATH)/$(SRC_PATH)/zb_appCb.o \ 21 | $(OUT_PATH)/$(SRC_PATH)/zcl_appCb.o 22 | 23 | # Each subdirectory must supply rules for building sources it contributes 24 | $(OUT_PATH)/$(SRC_PATH)/%.o: $(SRC_PATH)/%.c 25 | @echo 'Building file: $<' 26 | @$(CC) $(GCC_FLAGS) $(INCLUDE_PATHS) -c -o"$@" "$<" 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/app_battery.c: -------------------------------------------------------------------------------- 1 | #include "tl_common.h" 2 | #include "zcl_include.h" 3 | 4 | #include "watermeter.h" 5 | 6 | 7 | // 2200..3100 mv - 0..100% 8 | static uint8_t get_battery_level(uint16_t battery_mv) { 9 | /* Zigbee 0% - 0x0, 50% - 0x64, 100% - 0xc8 */ 10 | uint16_t battery_level = 0; 11 | if (battery_mv > MIN_VBAT_MV) { 12 | battery_level = (battery_mv - MIN_VBAT_MV) / ((MAX_VBAT_MV - MIN_VBAT_MV) / 0xC8); 13 | if (battery_level > 0xC8) 14 | battery_level = 0xC8; 15 | } 16 | return battery_level; 17 | } 18 | 19 | int32_t batteryCb(void *arg) { 20 | 21 | uint16_t voltage_raw = drv_get_adc_data(); 22 | uint8_t voltage = (uint8_t)(voltage_raw/100); 23 | uint8_t level = get_battery_level(voltage_raw); 24 | 25 | #if UART_PRINTF_MODE && DEBUG_BATTERY 26 | printf("Voltage_raw: %d\r\n", voltage_raw); 27 | printf("Voltage: %d\r\n", voltage); 28 | printf("Level: %d\r\n", level); 29 | #endif 30 | 31 | zcl_setAttrVal(WATERMETER_ENDPOINT1, ZCL_CLUSTER_GEN_POWER_CFG, ZCL_ATTRID_BATTERY_VOLTAGE, &voltage); 32 | zcl_setAttrVal(WATERMETER_ENDPOINT1, ZCL_CLUSTER_GEN_POWER_CFG, ZCL_ATTRID_BATTERY_PERCENTAGE_REMAINING, &level); 33 | 34 | return 0; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/app_utility.c: -------------------------------------------------------------------------------- 1 | #include "tl_common.h" 2 | #include "zcl_include.h" 3 | 4 | #include "watermeter.h" 5 | 6 | 7 | int32_t poll_rateAppCb(void *arg) { 8 | 9 | uint32_t poll_rate = zb_getPollRate(); 10 | 11 | if (poll_rate == g_watermeterCtx.long_poll) { 12 | zb_setPollRate(g_watermeterCtx.short_poll); 13 | return TIMEOUT_30SEC; 14 | } 15 | 16 | zb_setPollRate(g_watermeterCtx.long_poll); 17 | 18 | return g_watermeterCtx.long_poll; 19 | } 20 | 21 | int32_t delayedMcuResetCb(void *arg) { 22 | 23 | //printf("mcu reset\r\n"); 24 | set_regDeepSleep(); 25 | zb_resetDevice(); 26 | return -1; 27 | } 28 | 29 | int32_t delayedFactoryResetCb(void *arg) { 30 | 31 | //printf("factory reset\r\n"); 32 | set_regDeepSleep(); 33 | zb_resetDevice2FN(); 34 | // TL_ZB_TIMER_SCHEDULE(delayedMcuResetCb, NULL, TIMEOUT_3SEC); 35 | // zb_factoryReset(); 36 | // //sleep_ms(500); 37 | // zb_resetDevice(); 38 | return -1; 39 | } 40 | 41 | int32_t delayedFullResetCb(void *arg) { 42 | 43 | //printf("full reset\r\n"); 44 | return -1; 45 | } 46 | -------------------------------------------------------------------------------- /src/common/factory_reset.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file factory_reset.h 3 | * 4 | * @brief This is the header file for factory_reset 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef FACTORY_RESET_H 27 | #define FACTORY_RESET_H 28 | 29 | void factroyRst_init(void); 30 | void factroyRst_handler(void); 31 | 32 | #endif /* FACTORY_RESET_H */ 33 | -------------------------------------------------------------------------------- /src/common/firmwareEncryptChk.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmwareEncryptChk.c 3 | * 4 | * @brief This is the source file for firmwareEncryptChk 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "tl_common.h" 27 | #if UID_ENABLE 28 | #include "firmware_encrypt.h" 29 | #endif 30 | #include "firmwareEncryptChk.h" 31 | 32 | 33 | /** 34 | * @brief Only support for 8258/8278/b91, if you want to this function, please contact to us. 35 | */ 36 | u8 firmwareCheckWithUID(void) 37 | { 38 | #if UID_ENABLE 39 | u32 flash_mid = 0; 40 | u8 flash_uid[16] = {0}; 41 | int flag = flash_read_mid_uid_with_check(&flash_mid, flash_uid); 42 | if(flag == 0){ 43 | return 1; 44 | } 45 | u8 ciphertext[16] = {0}; 46 | firmware_encrypt_based_on_uid(flash_uid, ciphertext); 47 | 48 | u8 code[16] = {0}; 49 | flash_read(CFG_FIRMWARE_ENCRYPTION, 16, code); 50 | 51 | if(memcmp(ciphertext, code, 16)){ 52 | return 1; 53 | } 54 | #endif 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /src/common/firmwareEncryptChk.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmwareEncryptChk.h 3 | * 4 | * @brief This is the header file for firmwareEncryptChk 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _FIRMWARE_ENCRYPT_CHECK_H_ 27 | #define _FIRMWARE_ENCRYPT_CHECK_H_ 28 | 29 | u8 firmwareCheckWithUID(void); 30 | 31 | #endif /* _FIRMWARE_ENCRYPT_CHECK_H_ */ 32 | -------------------------------------------------------------------------------- /src/include/app_battery.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_BATTERY_H_ 2 | #define SRC_INCLUDE_APP_BATTERY_H_ 3 | 4 | #define MAX_VBAT_MV 3100 /* 3100 mV - > battery = 100% */ 5 | #define MIN_VBAT_MV BATTERY_SAFETY_THRESHOLD /* 2200 mV - > battery = 0% */ 6 | #define BATTERY_TIMER_INTERVAL TIMEOUT_15MIN 7 | 8 | int32_t batteryCb(void *arg); 9 | 10 | #endif /* SRC_INCLUDE_APP_BATTERY_H_ */ 11 | -------------------------------------------------------------------------------- /src/include/app_button.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_BUTTON_H_ 2 | #define SRC_INCLUDE_APP_BUTTON_H_ 3 | 4 | typedef struct _button_t { 5 | uint8_t released :1; 6 | uint8_t pressed :1; 7 | uint8_t counter :6; 8 | uint8_t debounce; 9 | uint32_t pressed_time; 10 | uint32_t released_time; 11 | } button_t; 12 | 13 | void init_button(); 14 | void button_handler(); 15 | uint8_t button_idle(); 16 | 17 | #endif /* SRC_INCLUDE_APP_BUTTON_H_ */ 18 | -------------------------------------------------------------------------------- /src/include/app_counter.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_COUNTER_H_ 2 | #define SRC_INCLUDE_APP_COUNTER_H_ 3 | 4 | typedef struct _water_conter_t { 5 | uint8_t counter; 6 | uint8_t debounce; 7 | } water_counter_t; 8 | 9 | void init_counters(); 10 | uint8_t counters_handler(); 11 | uint32_t check_counter_overflow(uint32_t check_count); 12 | uint8_t counters_idle(); 13 | 14 | #endif /* SRC_INCLUDE_APP_COUNTER_H_ */ 15 | -------------------------------------------------------------------------------- /src/include/app_dev_config.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_DEV_CONFIG_H_ 2 | #define SRC_INCLUDE_APP_DEV_CONFIG_H_ 3 | 4 | /* must be no more than FLASH_PAGE_SIZE (256) bytes */ 5 | typedef struct __attribute__((packed)) _watermeter_config_t { 6 | uint32_t id; /* ID - ID_CONFIG */ 7 | uint8_t new_ota; /* new ota flag */ 8 | uint32_t top; /* 0x0 .. 0xFFFFFFFF */ 9 | uint32_t flash_addr_start; /* flash page address start */ 10 | uint32_t flash_addr_end; /* flash page address end */ 11 | uint32_t counter_hot_water; /* Last number of liters hot water */ 12 | uint32_t counter_cold_water; /* Last number of litres cold water */ 13 | uint8_t liters_per_pulse; /* liters per pulse */ 14 | uint16_t crc; 15 | } watermeter_config_t; 16 | 17 | extern watermeter_config_t watermeter_config; 18 | 19 | void init_config(uint8_t print); 20 | void write_config(); 21 | 22 | #endif /* SRC_INCLUDE_APP_DEV_CONFIG_H_ */ 23 | -------------------------------------------------------------------------------- /src/include/app_leak.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_LEAK_H_ 2 | #define SRC_INCLUDE_APP_LEAK_H_ 3 | 4 | void waterleak_handler(); 5 | uint8_t waterleak_idle(); 6 | void fillIASAddress(epInfo_t* pdstEpInfo); 7 | 8 | #endif /* SRC_INCLUDE_APP_LEAK_H_ */ 9 | -------------------------------------------------------------------------------- /src/include/app_led.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_LED_H_ 2 | #define SRC_INCLUDE_APP_LED_H_ 3 | 4 | #define LED_ON 1 5 | #define LED_OFF 0 6 | 7 | void light_blink_start(uint8_t times, uint16_t ledOnTime, uint16_t ledOffTime); 8 | void light_blink_stop(void); 9 | 10 | void light_init(void); 11 | void light_on(void); 12 | void light_off(void); 13 | 14 | void led_on(uint32_t pin); 15 | void led_off(uint32_t pin); 16 | 17 | #endif /* SRC_INCLUDE_APP_LED_H_ */ 18 | -------------------------------------------------------------------------------- /src/include/app_pm.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_PM_H_ 2 | #define SRC_INCLUDE_APP_PM_H_ 3 | 4 | #define CHK_DEEP_SLEEP DEEP_ANA_REG1 5 | 6 | #if PM_ENABLE 7 | 8 | void app_wakeupPinConfig(); 9 | void app_wakeupPinLevelChange(); 10 | void app_lowPowerEnter(); 11 | int32_t no_joinedCb(void *arg); 12 | 13 | #endif 14 | 15 | void set_regDeepSleep(); 16 | 17 | 18 | #endif /* SRC_INCLUDE_APP_PM_H_ */ 19 | -------------------------------------------------------------------------------- /src/include/app_reporting.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_REPORTING_H_ 2 | #define SRC_INCLUDE_APP_REPORTING_H_ 3 | 4 | typedef struct { 5 | ev_timer_event_t *timerReportMinEvt; 6 | ev_timer_event_t *timerReportMaxEvt; 7 | reportCfgInfo_t *pEntry; 8 | uint32_t time_posted; 9 | } app_reporting_t; 10 | 11 | extern app_reporting_t app_reporting[ZCL_REPORTING_TABLE_NUM]; 12 | 13 | void app_reporting_init(); 14 | void app_report_handler(void); 15 | int32_t stopReportCb(void *arg); 16 | int32_t forcedReportCb(void *arg); 17 | 18 | #endif /* SRC_INCLUDE_APP_REPORTING_H_ */ 19 | -------------------------------------------------------------------------------- /src/include/app_types.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_TYPES_H_ 2 | #define SRC_INCLUDE_APP_TYPES_H_ 3 | 4 | #include "types.h" 5 | 6 | typedef u8 uint8_t; 7 | typedef s8 int8_t; 8 | typedef u16 uint16_t; 9 | typedef s16 int16_t; 10 | typedef u32 uint32_t; 11 | typedef s32 int32_t; 12 | typedef u64 uint64_t; 13 | typedef s64 int64_t; 14 | 15 | #endif /* SRC_INCLUDE_APP_TYPES_H_ */ 16 | -------------------------------------------------------------------------------- /src/include/app_utility.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_APP_UTILITY_H_ 2 | #define SRC_INCLUDE_APP_UTILITY_H_ 3 | 4 | /* for clock_time_exceed() */ 5 | #define TIMEOUT_TICK_1SEC 1000*1000 /* timeout 1 sec */ 6 | #define TIMEOUT_TICK_5SEC 5*1000*1000 /* timeout 5 sec */ 7 | #define TIMEOUT_TICK_10SEC 10*1000*1000 /* timeout 10 sec */ 8 | #define TIMEOUT_TICK_15SEC 15*1000*1000 /* timeout 15 sec */ 9 | #define TIMEOUT_TICK_30SEC 30*1000*1000 /* timeout 30 sec */ 10 | 11 | /* for TL_ZB_TIMER_SCHEDULE() */ 12 | #define TIMEOUT_1SEC 1 * 1000 /* timeout 1 sec */ 13 | #define TIMEOUT_2SEC 2 * 1000 /* timeout 2 sec */ 14 | #define TIMEOUT_3SEC 3 * 1000 /* timeout 3 sec */ 15 | #define TIMEOUT_4SEC 4 * 1000 /* timeout 4 sec */ 16 | #define TIMEOUT_5SEC 5 * 1000 /* timeout 5 sec */ 17 | #define TIMEOUT_10SEC 10 * 1000 /* timeout 10 sec */ 18 | #define TIMEOUT_15SEC 15 * 1000 /* timeout 15 sec */ 19 | #define TIMEOUT_30SEC 30 * 1000 /* timeout 30 sec */ 20 | #define TIMEOUT_1MIN 60 * 1000 /* timeout 1 min */ 21 | #define TIMEOUT_2MIN 120 * 1000 /* timeout 2 min */ 22 | #define TIMEOUT_5MIN 300 * 1000 /* timeout 5 min */ 23 | #define TIMEOUT_10MIN 600 * 1000 /* timeout 10 min */ 24 | #define TIMEOUT_15MIN 900 * 1000 /* timeout 15 min */ 25 | #define TIMEOUT_30MIN 1800 * 1000 /* timeout 30 min */ 26 | 27 | int32_t poll_rateAppCb(void *arg); 28 | 29 | int32_t delayedMcuResetCb(void *arg); 30 | int32_t delayedFactoryResetCb(void *arg); 31 | int32_t delayedFullResetCb(void *arg); 32 | 33 | 34 | #endif /* SRC_INCLUDE_APP_UTILITY_H_ */ 35 | -------------------------------------------------------------------------------- /src/include/se_custom_attr.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_INCLUDE_SE_CUSTOM_ATTR_H_ 2 | #define SRC_INCLUDE_SE_CUSTOM_ATTR_H_ 3 | 4 | #if ZCL_METERING_SUPPORT 5 | 6 | #define ZCL_ATTRID_CUSTOM_HOT_WATER_PRESET 0xF000 7 | #define ZCL_ATTRID_CUSTOM_COLD_WATER_PRESET 0xF001 8 | #define ZCL_ATTRID_CUSTOM_WATER_STEP_PRESET 0xF002 9 | 10 | #endif /* ZCL_METERING_SUPPORT */ 11 | 12 | #endif /* SRC_INCLUDE_SE_CUSTOM_ATTR_H_ */ 13 | -------------------------------------------------------------------------------- /src/zcl/zcl_onoffSwitchCfg.h: -------------------------------------------------------------------------------- 1 | #define ZCL_ATTRID_SWITCH_TYPE 0x0000 2 | #define ZCL_ATTRID_SWITCH_ACTION 0x0010 3 | 4 | #define ZCL_SWITCH_TYPE_TOGGLE 0x00 5 | #define ZCL_SWITCH_TYPE_MOMENTARY 0x01 6 | #define ZCL_SWITCH_TYPE_MULTIFUNCTION 0x02 7 | 8 | #define ZCL_SWITCH_ACTION_ON_OFF 0x00 9 | #define ZCL_SWITCH_ACTION_OFF_ON 0x01 10 | #define ZCL_SWITCH_ACTION_TOGGLE 0x02 11 | 12 | status_t zcl_onOffSwitchCfg_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb); 13 | nv_sts_t zcl_onOffCfgAttr_save(void); 14 | nv_sts_t zcl_onOffCfgAttr_restore(void); 15 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/bootLoader/bootloader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file bootloader.h 3 | * 4 | * @brief This is the header file for bootloader 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _BOOTLOADER_H_ 27 | #define _BOOTLOADER_H_ 28 | 29 | 30 | void bootloader_init(bool isBoot); 31 | void bootloader_loop(void); 32 | 33 | #endif /* _BOOTLOADER_H_ */ 34 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/bootLoader/main.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file main.c 3 | * 4 | * @brief This is the source file for main 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "tl_common.h" 27 | #include "bootloader.h" 28 | 29 | 30 | int main(void){ 31 | startup_state_e state = drv_platform_init(); 32 | 33 | u8 isRetention = (state == SYSTEM_DEEP_RETENTION) ? 1 : 0; 34 | u8 isBoot = (state == SYSTEM_BOOT) ? 1 : 0; 35 | 36 | if(!isRetention){ 37 | ev_buf_init(); 38 | ev_timer_init(); 39 | } 40 | 41 | bootloader_init(isBoot); 42 | 43 | #if VOLTAGE_DETECT_ENABLE 44 | u32 tick = clock_time(); 45 | #endif 46 | 47 | while(1){ 48 | #if VOLTAGE_DETECT_ENABLE 49 | if(clock_time_exceed(tick, 200 * 1000)){ 50 | voltage_detect(0); 51 | tick = clock_time(); 52 | } 53 | #endif 54 | 55 | #if defined(MCU_CORE_B92) 56 | drv_vbusWatchdogClose(); 57 | #endif 58 | 59 | ev_main(); 60 | 61 | bootloader_loop(); 62 | } 63 | 64 | return 0; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/common/factory_reset.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file factory_reset.h 3 | * 4 | * @brief This is the header file for factory_reset 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef FACTORY_RESET_H 27 | #define FACTORY_RESET_H 28 | 29 | void factoryRst_init(void); 30 | void factoryRst_handler(void); 31 | 32 | #endif /* FACTORY_RESET_H */ 33 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/common/firmwareEncryptChk.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmwareEncryptChk.c 3 | * 4 | * @brief This is the source file for firmwareEncryptChk 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "tl_common.h" 27 | #if UID_ENABLE 28 | #include "firmware_encrypt.h" 29 | #endif 30 | #include "firmwareEncryptChk.h" 31 | 32 | 33 | /** 34 | * @brief Only support for 8258/8278/b91, if you want to this function, please contact to us. 35 | */ 36 | u8 firmwareCheckWithUID(void) 37 | { 38 | #if UID_ENABLE 39 | u32 flash_mid = 0; 40 | u8 flash_uid[16] = {0}; 41 | int flag = flash_read_mid_uid_with_check(&flash_mid, flash_uid); 42 | if(flag == 0){ 43 | return 1; 44 | } 45 | u8 ciphertext[16] = {0}; 46 | firmware_encrypt_based_on_uid(flash_uid, ciphertext); 47 | 48 | u8 code[16] = {0}; 49 | flash_read(CFG_FIRMWARE_ENCRYPTION, 16, code); 50 | 51 | if(memcmp(ciphertext, code, 16)){ 52 | return 1; 53 | } 54 | #endif 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/common/firmwareEncryptChk.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmwareEncryptChk.h 3 | * 4 | * @brief This is the header file for firmwareEncryptChk 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _FIRMWARE_ENCRYPT_CHECK_H_ 27 | #define _FIRMWARE_ENCRYPT_CHECK_H_ 28 | 29 | u8 firmwareCheckWithUID(void); 30 | 31 | #endif /* _FIRMWARE_ENCRYPT_CHECK_H_ */ 32 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/sampleContactSensor/app_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file app_ui.h 3 | * 4 | * @brief This is the header file for app_ui 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _APP_UI_H_ 27 | #define _APP_UI_H_ 28 | 29 | /********************************************************************** 30 | * CONSTANT 31 | */ 32 | #define LED_ON 1 33 | #define LED_OFF 0 34 | 35 | 36 | /********************************************************************** 37 | * TYPEDEFS 38 | */ 39 | enum{ 40 | APP_STATE_NORMAL, 41 | APP_FACTORY_NEW_SET_CHECK, 42 | APP_FACTORY_NEW_DOING 43 | }; 44 | 45 | 46 | /********************************************************************** 47 | * FUNCTIONS 48 | */ 49 | void light_blink_start(u8 times, u16 ledOnTime, u16 ledOffTime); 50 | void light_blink_stop(void); 51 | 52 | void light_init(void); 53 | void light_on(void); 54 | void light_off(void); 55 | 56 | void led_on(u32 pin); 57 | void led_off(u32 pin); 58 | 59 | void app_key_handler(void); 60 | 61 | #endif /* _APP_UI_H_ */ 62 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/sampleGW/app_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file app_ui.h 3 | * 4 | * @brief This is the header file for app_ui 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _APP_UI_H_ 27 | #define _APP_UI_H_ 28 | 29 | 30 | /********************************************************************** 31 | * CONSTANT 32 | */ 33 | #define LED_ON 1 34 | #define LED_OFF 0 35 | 36 | 37 | /********************************************************************** 38 | * TYPEDEFS 39 | */ 40 | enum{ 41 | APP_STATE_NORMAL, 42 | APP_FACTORY_NEW_SET_CHECK 43 | }; 44 | 45 | 46 | /********************************************************************** 47 | * FUNCTIONS 48 | */ 49 | void light_blink_start(u8 times, u16 ledOnTime, u16 ledOffTime); 50 | void light_blink_stop(void); 51 | 52 | void light_init(void); 53 | void light_on(void); 54 | void light_off(void); 55 | 56 | void led_on(u32 pin); 57 | void led_off(u32 pin); 58 | 59 | void app_key_handler(void); 60 | 61 | #endif /* _APP_UI_H_ */ 62 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/sampleLight/app_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file app_ui.h 3 | * 4 | * @brief This is the header file for app_ui 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _APP_UI_H_ 27 | #define _APP_UI_H_ 28 | 29 | /********************************************************************** 30 | * CONSTANT 31 | */ 32 | #define LED_ON 1 33 | #define LED_OFF 0 34 | 35 | 36 | /********************************************************************** 37 | * TYPEDEFS 38 | */ 39 | enum{ 40 | APP_STATE_NORMAL, 41 | APP_FACTORY_NEW_SET_CHECK, 42 | APP_FACTORY_NEW_DOING, 43 | }; 44 | 45 | 46 | /********************************************************************** 47 | * FUNCTIONS 48 | */ 49 | void led_init(void); 50 | void led_on(u32 pin); 51 | void led_off(u32 pin); 52 | void localPermitJoinState(void); 53 | void app_key_handler(void); 54 | 55 | #endif /* _APP_UI_H_ */ 56 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/sampleLight/sampleLightCtrl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file sampleLightCtrl.h 3 | * 4 | * @brief This is the header file for sampleLightCtrl 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _SAMPLE_LIGHT_CTRL_H_ 27 | #define _SAMPLE_LIGHT_CTRL_H_ 28 | 29 | 30 | /********************************************************************** 31 | * TYPEDEFS 32 | */ 33 | typedef enum 34 | { 35 | LIGHT_STA_ON_OFF, 36 | LIGHT_STA_LEVEL, 37 | LIGHT_STA_COLOR, 38 | }lightSta_e; 39 | 40 | /********************************************************************** 41 | * FUNCTIONS 42 | */ 43 | void light_init(void); 44 | void light_adjust(void); 45 | void light_refresh(lightSta_e); 46 | void light_applyUpdate(u8 *curLevel, u16 *curLevel256, s32 *stepLevel256, u16 *remainingTime, u8 minLevel, u8 maxLevel, bool wrap); 47 | void light_applyUpdate_16(u16 *curLevel, u32 *curLevel256, s32 *stepLevel256, u16 *remainingTime, u16 minLevel, u16 maxLevel, bool wrap); 48 | 49 | void light_blink_start(u8 times, u16 ledOnTime, u16 ledOffTime); 50 | void light_blink_stop(void); 51 | 52 | #endif /* _SAMPLE_LIGHT_CTRL_H_ */ 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/apps/sampleSwitch/app_ui.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file app_ui.h 3 | * 4 | * @brief This is the header file for app_ui 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef _APP_UI_H_ 27 | #define _APP_UI_H_ 28 | 29 | /********************************************************************** 30 | * CONSTANT 31 | */ 32 | #define LED_ON 1 33 | #define LED_OFF 0 34 | 35 | 36 | /********************************************************************** 37 | * TYPEDEFS 38 | */ 39 | enum{ 40 | APP_STATE_NORMAL, 41 | APP_FACTORY_NEW_SET_CHECK, 42 | APP_FACTORY_NEW_DOING 43 | }; 44 | 45 | 46 | /********************************************************************** 47 | * FUNCTIONS 48 | */ 49 | void light_blink_start(u8 times, u16 ledOnTime, u16 ledOffTime); 50 | void light_blink_stop(void); 51 | 52 | void light_init(void); 53 | void light_on(void); 54 | void light_off(void); 55 | 56 | void led_on(u32 pin); 57 | void led_off(u32 pin); 58 | 59 | void app_key_handler(void); 60 | 61 | #endif /* _APP_UI_H_ */ 62 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/build/tlsr_riscv/.settings/com.andestech.ide.cdt.managedbuilder.core.TargetModelUtils.prefs: -------------------------------------------------------------------------------- 1 | autoBuildEnable=false 2 | connectType=ICE 3 | connectTypeOptionData=2 4 | eclipse.preferences.version=1 5 | iceman.misc.args= 6 | iceman.misc.args.map={2\=} 7 | name=ADP-AE350-D25F-EAGLE-0106 8 | sid.misc.args= 9 | target.project.build.selection=false 10 | target.project.clean.selection=false 11 | targetURI=rse\://LOCALHOST/~target/ADP-AE350-D25F-EAGLE-0106 12 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/boot/link_cfg.S: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file link_cfg.S 3 | * 4 | * @brief This is the boot file for link_cfg 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "version_cfg.h" 27 | 28 | LINK_CFG: 29 | .equ __BOOT_LOADER_IMAGE, IS_BOOT_LOADER_IMAGE 30 | .equ __FW_RAMCODE_SIZE_MAX, RESV_FOR_APP_RAM_CODE_SIZE 31 | .equ __FW_OFFSET, IMAGE_OFFSET 32 | 33 | .global __BOOT_LOADER_IMAGE 34 | .global __FW_OFFSET 35 | .global __FW_RAMCODE_SIZE_MAX 36 | LINK_CFG_END: 37 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_8258/driver_8258.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file driver_8258.h 3 | * 4 | * @brief This is the header file for B85 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "bsp.h" 29 | #include "register.h" 30 | #include "analog.h" 31 | #include "aes.h" 32 | #include "clock.h" 33 | #include "timer.h" 34 | #include "dfifo.h" 35 | #include "irq.h" 36 | #include "watchdog.h" 37 | #include "dma.h" 38 | #include "gpio.h" 39 | #include "adc.h" 40 | #include "random.h" 41 | #include "audio.h" 42 | #include "pwm.h" 43 | #include "i2c.h" 44 | #include "spi.h" 45 | #include "uart.h" 46 | #include "usbhw.h" 47 | #include "flash.h" 48 | #include "rf_drv.h" 49 | #include "emi.h" 50 | #include "pm.h" 51 | #include "flash/flash_type.h" 52 | #include "flash/flash_common.h" 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_8258/random.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file random.h 3 | * 4 | * @brief This is the header file for B85 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | 29 | /** 30 | * @brief This function performs to initials random generator post. 31 | * @param[in] none. 32 | * @return none. 33 | */ 34 | void random_generator_init(void); 35 | 36 | /** 37 | * @brief This function performs to get one random number 38 | * @param[in] none. 39 | * @return the value of one random number. 40 | */ 41 | unsigned int rand(void); 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_826x/aes.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file aes.h 3 | * 4 | * @brief This is the header file for B86 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | int aes_encrypt(unsigned char *key, unsigned char *data, unsigned char *result); 29 | int aes_decrypt(unsigned char *key, unsigned char *data, unsigned char *result); 30 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_826x/driver_826x.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file driver_826x.h 3 | * 4 | * @brief This is the header file for B86 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "register.h" 29 | #include "bsp.h" 30 | #include "clock.h" 31 | #include "timer.h" 32 | #include "irq.h" 33 | #include "watchdog.h" 34 | #include "pm.h" 35 | #include "rf_drv.h" 36 | #include "adc.h" 37 | #include "gpio.h" 38 | #include "pwm.h" 39 | #include "aes.h" 40 | #include "uart.h" 41 | #include "usbhw.h" 42 | #include "flash.h" 43 | #include "i2c.h" 44 | #include "spi.h" 45 | 46 | 47 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_826x/watchdog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file watchdog.h 3 | * 4 | * @brief This is the header file for B86 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "register.h" 29 | 30 | // watchdog use timer 2 31 | static inline void wd_set_interval_ms(unsigned int interval_ms) 32 | { 33 | reg_tmr2_tick = 0; //reset tick register 34 | reg_tmr_ctrl |= MASK_VAL(FLD_TMR_WD_CAPT, (interval_ms * tickPerUs * 1000 >> WATCHDOG_TIMEOUT_COEFF)); 35 | } 36 | 37 | static inline void wd_start(void) 38 | { 39 | SET_FLD(reg_tmr_ctrl, FLD_TMR_WD_EN); 40 | } 41 | 42 | static inline void wd_stop(void) 43 | { 44 | CLR_FLD(reg_tmr_ctrl, FLD_TMR_WD_EN); 45 | } 46 | 47 | static inline void wd_clear(void) 48 | { 49 | SET_FLD(reg_tmr_ctrl, FLD_CLR_WD); 50 | } 51 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_8278/driver_8278.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file driver_8278.h 3 | * 4 | * @brief This is the header file for B87 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | 29 | #include "bsp.h" 30 | #include "register.h" 31 | #include "analog.h" 32 | #include "clock.h" 33 | #include "timer.h" 34 | #include "irq.h" 35 | #include "dfifo.h" 36 | #include "watchdog.h" 37 | #include "dma.h" 38 | #include "aes.h" 39 | #include "gpio.h" 40 | #include "adc.h" 41 | #include "random.h" 42 | #include "pwm.h" 43 | #include "audio.h" 44 | #include "flash.h" 45 | #include "i2c.h" 46 | #include "spi.h" 47 | #include "uart.h" 48 | #include "usbhw.h" 49 | #include "rf_drv.h" 50 | #include "emi.h" 51 | #include "pm.h" 52 | #include "pke_algorithm.h" 53 | #include "flash/flash_type.h" 54 | #include "flash/flash_common.h" 55 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_8278/pke_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_algorithm.h 3 | * 4 | * @brief This is the header file for B87 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | #pragma once 26 | 27 | #include "pke_common.h" 28 | #include "eccp_curve.h" 29 | #include "ecdh.h" 30 | #include "ecdsa.h" 31 | #include "x25519.h" 32 | 33 | 34 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_8278/random.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file random.h 3 | * 4 | * @brief This is the header file for B87 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | 29 | /** 30 | * @brief This function performs to get one random number. 31 | * TRNG Base address is 0x4400,read 4bytes one time to judge whether generator success. 32 | * and get 8bytes later to return the random value in order to sure the value is right. 33 | * @param[in] none. 34 | * @return the value of one random number. 35 | */ 36 | void random_generator_init(void); 37 | 38 | /** 39 | * @brief This function performs to get one random number 40 | * @param[in] none. 41 | * @return the value of one random number. 42 | */ 43 | unsigned int rand(void); 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/lib/include/aoa.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file aoa.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2022 8 | * 9 | * @par Copyright (c) 2022, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef AOA_H_ 25 | #define AOA_H_ 26 | 27 | typedef enum{ 28 | BYTE_NUM_2P5 = 0, 29 | BYTE_NUM_4 = 1, 30 | }TypeDefByteNum; 31 | 32 | /** 33 | * @brief This function servers to find the average of a set of numbers 34 | * @param[in] data - the data. 35 | * @param[in] bytenum - the type of data. 36 | * @return abs. 37 | */ 38 | unsigned int abs_value(unsigned int data, TypeDefByteNum bytenum); 39 | 40 | /** 41 | * @brief This function is used to convert 20bit to 8bit data 42 | * @param[in] *data_src - the ddr of data. 43 | * @param[in] *data_has_amplitude - the data with amplitude. 44 | * @param[in] *data_no_amplitude - the data without amplitude. 45 | * @return none. 46 | */ 47 | void frond_end(unsigned char *data_src, unsigned char *data_has_amplitude, unsigned char *data_no_amplitude); 48 | 49 | #endif /* DRIVERS_LIB_INCLUDE_AOA_H_ */ 50 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/lib/include/pke/pke_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_algorithm.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #pragma once 25 | 26 | #include "pke_common.h" 27 | #include "eccp_curve.h" 28 | #include "ecdh.h" 29 | #include "ecdsa.h" 30 | #include "x25519.h" 31 | 32 | 33 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/lib/libaxon_driver_lib.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/chip_b91/lib/libaxon_driver_lib.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/npe.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file npe.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef NPE_H_ 25 | #define NPE_H_ 26 | #include "reg_include/npe_reg.h" 27 | 28 | void npe_set_reg(void); 29 | void npe_set_config(unsigned int desc_pointer ); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/aes_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file aes_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef _AES_REG_H_ 25 | #define _AES_REG_H_ 26 | 27 | #include "soc.h" 28 | 29 | 30 | #define reg_embase_addr REG_ADDR32(0x140b04) 31 | 32 | #define reg_aes_irq_mask REG_ADDR32(0x16000c) 33 | 34 | #define reg_aes_irq_status REG_ADDR32(0x160010) 35 | 36 | #define reg_aes_clr_irq_status REG_ADDR32(0x160018) 37 | /** 38 | * @brief Define AES IRQ 39 | */ 40 | typedef enum{ 41 | FLD_CRYPT_IRQ = BIT(7), 42 | }aes_irq_e; 43 | 44 | 45 | #define reg_aes_mode REG_ADDR32(0x1600b0) 46 | enum{ 47 | FLD_AES_START = BIT(0), 48 | FLD_AES_MODE = BIT(1), /**< 0-cipher 1-decipher */ 49 | }; 50 | 51 | #define reg_aes_key(v) REG_ADDR32(0x1600b4+(v*4)) // v = 0 1 2 3 52 | 53 | #define reg_aes_ptr REG_ADDR32(0x1600c4) //only the lower 16 bits are used. 54 | 55 | #endif /* _AES_REG_H_ */ 56 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/charger_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file charger_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2022 8 | * 9 | * @par Copyright (c) 2022, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef CHARGER_REG_H_ 25 | #define CHARGER_REG_H_ 26 | 27 | /* 28 | * analog:0x19 29 | */ 30 | #define reg_charger_vchg 0x19 31 | enum{ 32 | VCHG_TRIM =BIT_RNG(4,7), 33 | }; 34 | /* 35 | * analog:0x1c 36 | */ 37 | #define reg_charger_mode 0x1c 38 | enum{ 39 | AUTO_MANUAL_SEL = BIT(7), 40 | MANUAL_MODE = BIT_RNG(4,6), 41 | }; 42 | /* 43 | * analog:0x1a 44 | */ 45 | #define reg_charger_ichg 0x1a 46 | enum{ 47 | ICHG_TRIM =BIT_RNG(0,3), 48 | }; 49 | /* 50 | * analog:0x22 51 | */ 52 | #define reg_charger_status 0x22 53 | enum{ 54 | CHG_USB_ON_OFF = BIT(6), 55 | }; 56 | 57 | #endif /* DRIVERS_REG_INCLUDE_CHARGER_REG_H_ */ 58 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/mdec_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file mdec_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #pragma once 25 | 26 | #include "soc.h" 27 | 28 | #define mdec_rst_addr 0x53 29 | typedef enum{ 30 | FLD_SELE_PA0 = BIT(0), 31 | FLD_SELE_PB7 = BIT(1), 32 | FLD_SELE_PC4 = BIT(2), 33 | FLD_SELE_PD0 = BIT(3), 34 | FLD_SELE_PE0 = BIT(4), 35 | }mdec_pin_e; 36 | typedef enum{ 37 | FLD_CLS_MDEC = BIT_RNG(0,4), 38 | FLD_RSVD = BIT_RNG(5,6), 39 | FLD_MDEC_RST = BIT(7), 40 | }mdec_set_e; 41 | 42 | #define mdec_ctrl 0x54 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/plic_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef INTERRUPT_REG_H 25 | #define INTERRUPT_REG_H 26 | #include "soc.h" 27 | 28 | 29 | /******************************* interrupt registers: ******************************/ 30 | #define reg_irq_feature (*(volatile unsigned long*)(0 + (0xe4000000))) 31 | 32 | #define reg_irq_pending(i) (*(volatile unsigned long*)(0 + (0xe4001000+((i>31) ? 4 : 0)))) 33 | 34 | #define reg_irq_src0 (*(volatile unsigned long*)(0 + (0xe4002000))) 35 | #define reg_irq_src1 (*(volatile unsigned long*)(0 + (0xe4002004))) 36 | 37 | #define reg_irq_src(i) (*(volatile unsigned long*)(0 + (0xe4002000+((i>31) ? 4 : 0) ))) 38 | 39 | #define reg_irq_threshold (*(volatile unsigned long*)(0 + (0xe4200000))) 40 | #define reg_irq_done (*(volatile unsigned long*)(0 + (0xe4200004))) 41 | 42 | #define reg_irq_src_priority(i) (*(volatile unsigned long*)(0 + 0xe4000000+((i)<<2))) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/plic_sw_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_sw_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLIC_SW_REG_H_ 25 | #define __PLIC_SW_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* plic_sw registers: ******************************/ 29 | #define reg_irq_sw_pending (*(volatile unsigned long *)(0xe6401000)) 30 | enum 31 | { 32 | FLD_PLIC_SW_SRC = BIT(1), 33 | }; 34 | 35 | #define reg_irq_sw_src (*(volatile unsigned long *)(0xe6402000)) 36 | 37 | #define reg_irq_sw_done (*(volatile unsigned long *)(0xe6600004)) 38 | enum 39 | { 40 | FLD_PLIC_SW_ID = BIT(0), 41 | }; 42 | 43 | 44 | #endif /* end of __PLIC_SW_REG_H_ */ 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/plmt_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plmt_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLMT_REG_H_ 25 | #define __PLMT_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* mtime registers: ******************************/ 29 | 30 | /** 31 | * @brief The compiler supports the long long (64bit) type, but since the CPU is 32bit, it is operated separately in assembly, so need to pay attention to synchronization when reading this register 32 | * 33 | */ 34 | #define reg_mtime (*(volatile unsigned long long*)(0xe6000000)) 35 | #define reg_mtime_low (*(volatile unsigned long*)(0xe6000000)) 36 | #define reg_mtime_high (*(volatile unsigned long*)(0xe6000004)) 37 | 38 | #define reg_mtimecmp (*(volatile unsigned long long*)(0xe6000008)) 39 | #define reg_mtimecmp_low (*(volatile unsigned long*)(0xe6000008)) 40 | #define reg_mtimecmp_high (*(volatile unsigned long*)(0xe600000c)) 41 | 42 | #endif /* end of __PLMT_REG_H_ */ 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/register.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file register.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef REGISTER_H 25 | #define REGISTER_H 26 | 27 | #include "gpio_reg.h" 28 | #include "soc.h" 29 | #include "analog_reg.h" 30 | #include "audio_reg.h" 31 | #include "timer_reg.h" 32 | #include "dma_reg.h" 33 | #include "usb_reg.h" 34 | #include "pwm_reg.h" 35 | #include "spi_reg.h" 36 | #include "i2c_reg.h" 37 | #include "mspi_reg.h" 38 | #include "rf_reg.h" 39 | #include "trng_reg.h" 40 | #include "npe_reg.h" 41 | #include "pke_reg.h" 42 | #include "plic_reg.h" 43 | #include "uart_reg.h" 44 | #include "stimer_reg.h" 45 | #include "aes_reg.h" 46 | #include "adc_reg.h" 47 | #include "mdec_reg.h" 48 | #include "swire_reg.h" 49 | #include "charger_reg.h" 50 | #include "plic_sw_reg.h" 51 | #include "plmt_reg.h" 52 | #endif 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b91/reg_include/trng_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file trng_reg.h 3 | * 4 | * @brief This is the header file for B91 5 | * 6 | * @author Driver Group 7 | * @date 2019 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef TRNG_REG_H_ 25 | #define TRNG_REG_H_ 26 | 27 | /******************************* trng registers: 101800 ******************************/ 28 | #define REG_TRNG_BASE 0x101800 29 | 30 | 31 | #define reg_trng_cr0 REG_ADDR8(REG_TRNG_BASE) 32 | enum{ 33 | FLD_TRNG_CR0_RBGEN = BIT(0), 34 | FLD_TRNG_CR0_ROSEN0 = BIT(1), 35 | FLD_TRNG_CR0_ROSEN1 = BIT(2), 36 | FLD_TRNG_CR0_ROSEN2 = BIT(3), 37 | FLD_TRNG_CR0_ROSEN3 = BIT(4), 38 | }; 39 | 40 | #define reg_trng_rtcr REG_ADDR32(REG_TRNG_BASE+0x04) 41 | enum{ 42 | FLD_TRNG_RTCR_MSEL = BIT(0), 43 | }; 44 | 45 | #define reg_rbg_sr REG_ADDR8(REG_TRNG_BASE+0x08) 46 | enum{ 47 | FLD_RBG_SR_DRDY = BIT(0), 48 | }; 49 | 50 | #define reg_rbg_dr REG_ADDR32(REG_TRNG_BASE+0x0c) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/charger.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file charger.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2022 8 | * 9 | * @par Copyright (c) 2022, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #pragma once 25 | 26 | #include "reg_include/charger_reg.h" 27 | #include "compiler.h" 28 | #include "analog.h" 29 | 30 | 31 | /** 32 | * @brief open charger 1p0v. 33 | * @return none. 34 | */ 35 | static inline void charger_open(void) 36 | { 37 | analog_write_reg8(0x22, analog_read_reg8(0x22) | 0x08); //<3> pm_chg_en_1p0v 1:open charge 0:close charge 38 | } 39 | 40 | /** 41 | * @brief close charger 1p0v. 42 | * @return none. 43 | */ 44 | static inline void charger_close(void) 45 | { 46 | analog_write_reg8(0x22, analog_read_reg8(0x22) & 0xf7); //<3> pm_chg_en_1p0v 1:open charge 0:close charge 47 | } 48 | 49 | /** 50 | * @brief This function serves the initialization of charger module charging function. 51 | * @return none 52 | */ 53 | void charger_init(void); 54 | 55 | 56 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/lib/include/aoa.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file aoa.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2023, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef AOA_H_ 25 | #define AOA_H_ 26 | 27 | typedef enum{ 28 | BYTE_NUM_2P5 = 0, 29 | BYTE_NUM_4 = 1, 30 | }TypeDefByteNum; 31 | 32 | /** 33 | * @brief This function servers to find the average of a set of numbers 34 | * @param[in] data - the data. 35 | * @param[in] bytenum - the type of data. 36 | * @return abs. 37 | */ 38 | unsigned int abs_value(unsigned int data, TypeDefByteNum bytenum); 39 | 40 | /** 41 | * @brief This function is used to convert 20bit to 8bit data 42 | * @param[in] *data_src - the ddr of data. 43 | * @param[in] *data_has_amplitude - the data with amplitude. 44 | * @param[in] *data_no_amplitude - the data without amplitude. 45 | * @return none. 46 | */ 47 | void frond_end(unsigned char *data_src, unsigned char *data_has_amplitude, unsigned char *data_no_amplitude); 48 | 49 | void rf_hadm_frond_end(unsigned char *data_src, int *data_has_amplitude,unsigned int len); 50 | 51 | #endif /* DRIVERS_LIB_INCLUDE_AOA_H_ */ 52 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/lib/include/pke/pke_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_algorithm.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2020 8 | * 9 | * @par Copyright (c) 2020, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #include "pke_utility.h" 25 | #include "eccp_curve.h" 26 | #include "ecdh.h" 27 | #include "ecdsa.h" 28 | #include "pke_prime.h" 29 | #include "rsa.h" 30 | #include "x25519.h" 31 | 32 | 33 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/lib/include/rf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/chip_b92/lib/include/rf.h -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/mdec_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file mdec_reg.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2020 8 | * 9 | * @par Copyright (c) 2020, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #pragma once 25 | 26 | #include "soc.h" 27 | 28 | #define mdec_rst_addr 0x53 29 | typedef enum{ 30 | FLD_SELE_PA0 = BIT(0), 31 | FLD_SELE_PB7 = BIT(1), 32 | FLD_SELE_PC4 = BIT(2), 33 | FLD_SELE_PD0 = BIT(3), 34 | FLD_SELE_PE0 = BIT(4), 35 | }mdec_pin_e; 36 | typedef enum{ 37 | FLD_CLS_MDEC = BIT_RNG(0,4), 38 | FLD_RSVD = BIT_RNG(5,6), 39 | FLD_MDEC_RST = BIT(7), 40 | }mdec_set_e; 41 | 42 | #define mdec_ctrl 0x54 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/plic_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_reg.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2020 8 | * 9 | * @par Copyright (c) 2020, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef INTERRUPT_REG_H 25 | #define INTERRUPT_REG_H 26 | #include "soc.h" 27 | 28 | 29 | /******************************* interrupt registers: ******************************/ 30 | #define reg_irq_feature (*(volatile unsigned long*)(0 + (0xe4000000))) 31 | 32 | #define reg_irq_pending(i) (*(volatile unsigned long*)(0 + (0xe4001000+((i>31) ? 4 : 0)))) 33 | 34 | #define reg_irq_src0 (*(volatile unsigned long*)(0 + (0xe4002000))) 35 | #define reg_irq_src1 (*(volatile unsigned long*)(0 + (0xe4002004))) 36 | 37 | #define reg_irq_src(i) (*(volatile unsigned long*)(0 + (0xe4002000+((i>31) ? 4 : 0) ))) 38 | 39 | #define reg_irq_threshold (*(volatile unsigned long*)(0 + (0xe4200000))) 40 | #define reg_irq_done (*(volatile unsigned long*)(0 + (0xe4200004))) 41 | 42 | #define reg_irq_src_priority(i) (*(volatile unsigned long*)(0 + 0xe4000000+((i)<<2))) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/plic_sw_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_sw_reg.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLIC_SW_REG_H_ 25 | #define __PLIC_SW_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* plic_sw registers: ******************************/ 29 | #define reg_irq_sw_pending (*(volatile unsigned long *)(0xe6401000)) 30 | enum 31 | { 32 | FLD_PLIC_SW_SRC = BIT(1), 33 | }; 34 | 35 | #define reg_irq_sw_src (*(volatile unsigned long *)(0xe6402000)) 36 | 37 | #define reg_irq_sw_done (*(volatile unsigned long *)(0xe6600004)) 38 | enum 39 | { 40 | FLD_PLIC_SW_ID = BIT(0), 41 | }; 42 | 43 | 44 | #endif /* end of __PLIC_SW_REG_H_ */ 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/plmt_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plmt_reg.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2019, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLMT_REG_H_ 25 | #define __PLMT_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* mtime registers: ******************************/ 29 | 30 | /** 31 | * @brief The compiler supports the long long (64bit) type, but since the CPU is 32bit, it is operated separately in assembly, so need to pay attention to synchronization when reading this register 32 | * 33 | */ 34 | #define reg_mtime (*(volatile unsigned long long*)(0xe6000000)) 35 | #define reg_mtime_low (*(volatile unsigned long*)(0xe6000000)) 36 | #define reg_mtime_high (*(volatile unsigned long*)(0xe6000004)) 37 | 38 | #define reg_mtimecmp (*(volatile unsigned long long*)(0xe6000008)) 39 | #define reg_mtimecmp_low (*(volatile unsigned long*)(0xe6000008)) 40 | #define reg_mtimecmp_high (*(volatile unsigned long*)(0xe600000c)) 41 | 42 | #endif /* end of __PLMT_REG_H_ */ 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/register.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file register.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2020 8 | * 9 | * @par Copyright (c) 2020, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef REGISTER_H 25 | #define REGISTER_H 26 | 27 | #include "gpio_reg.h" 28 | #include "soc.h" 29 | #include "analog_reg.h" 30 | #include "audio_reg.h" 31 | #include "timer_reg.h" 32 | #include "dma_reg.h" 33 | #include "usb_reg.h" 34 | #include "pwm_reg.h" 35 | #include "spi_reg.h" 36 | #include "i2c_reg.h" 37 | #include "mspi_reg.h" 38 | #include "rf_reg.h" 39 | #include "trng_reg.h" 40 | #include "pke_reg.h" 41 | #include "plic_reg.h" 42 | #include "uart_reg.h" 43 | #include "stimer_reg.h" 44 | #include "aes_reg.h" 45 | #include "adc_reg.h" 46 | #include "mdec_reg.h" 47 | #include "swire_reg.h" 48 | #include "qdec_reg.h" 49 | #include "charger_reg.h" 50 | #include "plic_sw_reg.h" 51 | #include "plmt_reg.h" 52 | #include "codec_0581_reg.h" 53 | #endif 54 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_b92/reg_include/trng_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file trng_reg.h 3 | * 4 | * @brief This is the header file for B92 5 | * 6 | * @author Driver Group 7 | * @date 2020 8 | * 9 | * @par Copyright (c) 2020, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef TRNG_REG_H_ 25 | #define TRNG_REG_H_ 26 | 27 | /******************************* trng registers: 101800 ******************************/ 28 | #define REG_TRNG_BASE 0x101800 29 | 30 | 31 | #define reg_trng_cr0 REG_ADDR8(REG_TRNG_BASE) 32 | enum{ 33 | FLD_TRNG_CR0_RBGEN = BIT(0), 34 | FLD_TRNG_CR0_ROSEN0 = BIT(1), 35 | FLD_TRNG_CR0_ROSEN1 = BIT(2), 36 | FLD_TRNG_CR0_ROSEN2 = BIT(3), 37 | FLD_TRNG_CR0_ROSEN3 = BIT(4), 38 | }; 39 | 40 | #define reg_trng_rtcr REG_ADDR32(REG_TRNG_BASE+0x04) 41 | enum{ 42 | FLD_TRNG_RTCR_MSEL = BIT(0), 43 | }; 44 | 45 | #define reg_rbg_sr REG_ADDR8(REG_TRNG_BASE+0x08) 46 | enum{ 47 | FLD_RBG_SR_DRDY = BIT(0), 48 | }; 49 | 50 | #define reg_rbg_dr REG_ADDR32(REG_TRNG_BASE+0x0c) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/lib/include/efuse.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file efuse.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef EFUSE_H_ 25 | #define EFUSE_H_ 26 | 27 | /** 28 | * @brief This function servers to get chip id from EFUSE. 29 | * @param[in] chip_id_buff - store chip id. Chip ID is 16 bytes. 30 | * @return DRV_API_SUCCESS: operation successful. 31 | * DRV_API_TIMEOUT: operation timeout. 32 | */ 33 | drv_api_status_e efuse_get_chip_id(unsigned char *chip_id_buff); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/lib/include/hash/hash_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file hash_algorithm.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef HASH_ALGORITHM_H 25 | #define HASH_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "hash.h" 29 | #include "hash_basic.h" 30 | #include "hmac.h" 31 | #include "hmac_md5.h" 32 | #include "hmac_sha1.h" 33 | #include "hmac_sha224.h" 34 | #include "hmac_sha256.h" 35 | #include "hmac_sha384.h" 36 | #include "hmac_sha512.h" 37 | #include "hmac_sha512_224.h" 38 | #include "hmac_sha512_256.h" 39 | #include "hmac_sm3.h" 40 | #include "md5.h" 41 | #include "pbkdf2.h" 42 | #include "sha1.h" 43 | #include "sha224.h" 44 | #include "sha256.h" 45 | #include "sha384.h" 46 | #include "sha512.h" 47 | #include "sha512_224.h" 48 | #include "sha512_256.h" 49 | #include "sm3.h" 50 | 51 | #endif -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/lib/include/pke/pke_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_algorithm.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef PKE_ALGORITHM_H 25 | #define PKE_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "lib/include/crypto_common/eccp_curve.h" 29 | #include "lib/include/pke/pke_portable.h" 30 | #include "ecdh.h" 31 | #include "ecdsa.h" 32 | #include "pke.h" 33 | #include "pke_prime.h" 34 | #include "rsa.h" 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/lib/include/ske/ske_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file ske_algorithm.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef SKE_ALGORITHM_H 25 | #define SKE_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "lib/include/ske/ske_portable.h" 29 | #include "ske.h" 30 | #include "ske_basic.h" 31 | #include "ske_cbc.h" 32 | #include "ske_ccm.h" 33 | #include "ske_cfb.h" 34 | #include "ske_ctr.h" 35 | #include "ske_ecb.h" 36 | #include "ske_gcm_gmac.h" 37 | #include "ske_ofb.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/lib/include/trng/trng_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file trng_algorithm.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef TRNG_ALGORITHM_H 25 | #define TRNG_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "trng_portable.h" 29 | #include "lib/include/trng/trng_basic.h" 30 | #include "lib/include/trng/trng.h" 31 | #include "lib/include/trng/trng_config.h" 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/hash_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file hash_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef HASH_REG_H 25 | #define HASH_REG_H 26 | #include "soc.h" 27 | 28 | #define HASH_BASE_ADDR (0x80102000) 29 | 30 | #define reg_hash_fifo (0x80100800 + 0x30) 31 | #define reg_hash_dma_en REG_ADDR8(0x100800 + 0x34) 32 | #define reg_hash_thres REG_ADDR8(0x100800 + 0x35) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/pke_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef PKE_REG_H 25 | #define PKE_REG_H 26 | 27 | #define PKE_BASE_ADDR (0x80110000) 28 | 29 | #endif 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/plic_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef INTERRUPT_REG_H 25 | #define INTERRUPT_REG_H 26 | #include "soc.h" 27 | 28 | 29 | /******************************* interrupt registers: plic base 0xc4000000 ******************************/ 30 | #define reg_irq_feature (*(volatile unsigned long*)(0 + (0xc4000000))) 31 | 32 | #define reg_irq_pending(i) (*(volatile unsigned long*)(0 + (0xc4001000+((i>31) ? 4 : 0)))) 33 | 34 | #define reg_irq_src0 (*(volatile unsigned long*)(0 + (0xc4002000))) 35 | #define reg_irq_src1 (*(volatile unsigned long*)(0 + (0xc4002004))) 36 | 37 | #define reg_irq_src(i) (*(volatile unsigned long*)(0 + (0xc4002000+((i>31) ? 4 : 0) ))) 38 | 39 | #define reg_irq_threshold (*(volatile unsigned long*)(0 + (0xc4200000))) 40 | #define reg_irq_done (*(volatile unsigned long*)(0 + (0xc4200004))) 41 | 42 | #define reg_irq_src_priority(i) (*(volatile unsigned long*)(0 + 0xc4000000+((i)<<2))) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/plic_sw_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_sw_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLIC_SW_REG_H_ 25 | #define __PLIC_SW_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* plic_sw registers: ******************************/ 29 | #define reg_irq_sw_pending (*(volatile unsigned long *)(0xc6401000)) 30 | enum 31 | { 32 | FLD_PLIC_SW_SRC = BIT(1), 33 | }; 34 | 35 | #define reg_irq_sw_src (*(volatile unsigned long *)(0xc6402000)) 36 | 37 | #define reg_irq_sw_done (*(volatile unsigned long *)(0xc6600004)) 38 | enum 39 | { 40 | FLD_PLIC_SW_ID = BIT(0), 41 | }; 42 | 43 | 44 | #endif /* end of __PLIC_SW_REG_H_ */ 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/plmt_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plmt_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLMT_REG_H_ 25 | #define __PLMT_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* mtime registers: ******************************/ 29 | 30 | /** 31 | * @brief The compiler supports the long long (64bit) type, but since the CPU is 32bit, it is operated separately in assembly, so need to pay attention to synchronization when reading this register 32 | * 33 | */ 34 | #define reg_mtime (*(volatile unsigned long long*)(0xc6000000)) 35 | #define reg_mtime_low (*(volatile unsigned long*)(0xc6000000)) 36 | #define reg_mtime_high (*(volatile unsigned long*)(0xc6000004)) 37 | 38 | #define reg_mtimecmp (*(volatile unsigned long long*)(0xc6000008)) 39 | #define reg_mtimecmp_low (*(volatile unsigned long*)(0xc6000008)) 40 | #define reg_mtimecmp_high (*(volatile unsigned long*)(0xc600000c)) 41 | 42 | #endif /* end of __PLMT_REG_H_ */ 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/register.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file register.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef REGISTER_H 25 | #define REGISTER_H 26 | 27 | #include "gpio_reg.h" 28 | #include "soc.h" 29 | #include "analog_reg.h" 30 | #include "audio_reg.h" 31 | #include "timer_reg.h" 32 | #include "dma_reg.h" 33 | #include "usb_reg.h" 34 | #include "pwm_reg.h" 35 | #include "spi_reg.h" 36 | #include "i2c_reg.h" 37 | #include "mspi_reg.h" 38 | #include "rf_reg.h" 39 | #include "pke_reg.h" 40 | #include "plic_reg.h" 41 | #include "plic_sw_reg.h" 42 | #include "plmt_reg.h" 43 | #include "uart_reg.h" 44 | #include "stimer_reg.h" 45 | #include "adc_reg.h" 46 | #include "swire_reg.h" 47 | #include "qdec_reg.h" 48 | #include "plic_sw_reg.h" 49 | #include "plmt_reg.h" 50 | #include "analog_afe3v_reg.h" 51 | #include "analog_afe1v_reg.h" 52 | #include "ir_learn_reg.h" 53 | #endif 54 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl321x/reg_include/ske_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file ske_reg.h 3 | * 4 | * @brief This is the header file for TL321X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef SKE_REG_H 25 | #define SKE_REG_H 26 | #include "soc.h" 27 | 28 | #define SKE_LP_BASE_ADDR (0x80104000) 29 | 30 | #define reg_ske_fifo (0x80100800 + 0x20) 31 | #define reg_ske_dma_en REG_ADDR8(0x100800 + 0x24) 32 | #define reg_ske_thres REG_ADDR8(0x100800 + 0x25) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/chacha20_poly1305/chacha20_poly1305_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file chacha20_poly1305_algorithm.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef CHACHA20_POLY1305_ALGORITHM_H 25 | #define CHACHA20_POLY1305_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "chacha20_poly1305.h" 29 | #include "chacha20_poly1305_basic.h" 30 | #include "lib/include/chacha20_poly1305/chacha20_poly1305_portable.h" 31 | 32 | #endif -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/hash/hash_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file hash_algorithm.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef HASH_ALGORITHM_H 25 | #define HASH_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "lib/include/hash/hash_portable.h" 29 | #include "hash.h" 30 | #include "hash_basic.h" 31 | #include "hmac.h" 32 | #include "hmac_md5.h" 33 | #include "hmac_sha1.h" 34 | #include "hmac_sha224.h" 35 | #include "hmac_sha256.h" 36 | #include "hmac_sha384.h" 37 | #include "hmac_sha512.h" 38 | #include "hmac_sha512_224.h" 39 | #include "hmac_sha512_256.h" 40 | #include "hmac_sm3.h" 41 | #include "md5.h" 42 | #include "pbkdf2.h" 43 | #include "sha1.h" 44 | #include "sha224.h" 45 | #include "sha256.h" 46 | #include "sha384.h" 47 | #include "sha512.h" 48 | #include "sha512_224.h" 49 | #include "sha512_256.h" 50 | #include "sm3.h" 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/pke/eccp_curve.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file eccp_curve.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #include "../../crypto_common/eccp_curve.h" 25 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/pke/pke_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_algorithm.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef PKE_ALGORITHM_H 25 | #define PKE_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "lib/include/crypto_common/eccp_curve.h" 29 | #include "lib/include/pke/pke_portable.h" 30 | #include "ecdh.h" 31 | #include "ecdsa.h" 32 | #include "pke.h" 33 | #include "pke_prime.h" 34 | #include "rsa.h" 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/ske/ske_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file ske_algorithm.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef SKE_ALGORITHM_H 25 | #define SKE_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "lib/include/ske/ske_portable.h" 29 | #include "ske.h" 30 | #include "ske_basic.h" 31 | #include "ske_cbc.h" 32 | #include "ske_ccm.h" 33 | #include "ske_cfb.h" 34 | #include "ske_ctr.h" 35 | #include "ske_ecb.h" 36 | #include "ske_gcm_gmac.h" 37 | #include "ske_ofb.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/lib/include/trng/trng_algorithm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file trng_algorithm.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef TRNG_ALGORITHM_H 25 | #define TRNG_ALGORITHM_H 26 | 27 | #include "lib/include/crypto_common/utility.h" 28 | #include "trng.h" 29 | #include "trng_portable.h" 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/chacha20_poly1305_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file chacha20_poly1305_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef CHACHA20_POLY1505_REG_H 25 | #define CHACHA20_POLY1505_REG_H 26 | #include "soc.h" 27 | 28 | #define CHACHA20_POLY1305_BASE_ADDR (0x80105000) 29 | 30 | #define reg_chacha20_fifo (0x80100800 + 0x10) 31 | #define reg_chacha20_dma_en REG_ADDR8(0x100800 + 0x14) 32 | #define reg_chacha20_thres REG_ADDR8(0x100800 + 0x15) 33 | 34 | #endif -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/hash_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file hash_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef HASH_REG_H 25 | #define HASH_REG_H 26 | #include "soc.h" 27 | 28 | #define HASH_BASE_ADDR (0x80102000) 29 | 30 | #define reg_hash_fifo (0x80100800 + 0x30) 31 | #define reg_hash_dma_en REG_ADDR8(0x100800 + 0x34) 32 | #define reg_hash_thres REG_ADDR8(0x100800 + 0x35) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/pke_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file pke_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef PKE_REG_H 25 | #define PKE_REG_H 26 | 27 | #define PKE_BASE_ADDR (0x80110000) 28 | 29 | #endif 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/plic_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef INTERRUPT_REG_H 25 | #define INTERRUPT_REG_H 26 | #include "soc.h" 27 | 28 | 29 | /******************************* interrupt registers: plic base 0xc4000000 ******************************/ 30 | #define reg_irq_feature (*(volatile unsigned long*)(0 + (0xc4000000))) 31 | 32 | #define reg_irq_pending(i) (*(volatile unsigned long*)(0 + (0xc4001000+((i>31) ? 4 : 0)))) 33 | 34 | #define reg_irq_src0 (*(volatile unsigned long*)(0 + (0xc4002000))) 35 | #define reg_irq_src1 (*(volatile unsigned long*)(0 + (0xc4002004))) 36 | 37 | #define reg_irq_src(i) (*(volatile unsigned long*)(0 + (0xc4002000+((i>31) ? 4 : 0) ))) 38 | 39 | #define reg_irq_threshold (*(volatile unsigned long*)(0 + (0xc4200000))) 40 | #define reg_irq_done (*(volatile unsigned long*)(0 + (0xc4200004))) 41 | 42 | #define reg_irq_src_priority(i) (*(volatile unsigned long*)(0 + 0xc4000000+((i)<<2))) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/plic_sw_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plic_sw_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLIC_SW_REG_H_ 25 | #define __PLIC_SW_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* plic_sw registers: ******************************/ 29 | #define reg_irq_sw_pending (*(volatile unsigned long *)(0xc6401000)) 30 | enum 31 | { 32 | FLD_PLIC_SW_SRC = BIT(1), 33 | }; 34 | 35 | #define reg_irq_sw_src (*(volatile unsigned long *)(0xc6402000)) 36 | 37 | #define reg_irq_sw_done (*(volatile unsigned long *)(0xc6600004)) 38 | enum 39 | { 40 | FLD_PLIC_SW_ID = BIT(0), 41 | }; 42 | 43 | 44 | #endif /* end of __PLIC_SW_REG_H_ */ 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/plmt_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file plmt_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef __PLMT_REG_H_ 25 | #define __PLMT_REG_H_ 26 | #include "soc.h" 27 | 28 | /******************************* mtime registers: ******************************/ 29 | 30 | /** 31 | * @brief The compiler supports the long long (64bit) type, but since the CPU is 32bit, it is operated separately in assembly, so need to pay attention to synchronization when reading this register 32 | * 33 | */ 34 | #define reg_mtime (*(volatile unsigned long long*)(0xc6000000)) 35 | #define reg_mtime_low (*(volatile unsigned long*)(0xc6000000)) 36 | #define reg_mtime_high (*(volatile unsigned long*)(0xc6000004)) 37 | 38 | #define reg_mtimecmp (*(volatile unsigned long long*)(0xc6000008)) 39 | #define reg_mtimecmp_low (*(volatile unsigned long*)(0xc6000008)) 40 | #define reg_mtimecmp_high (*(volatile unsigned long*)(0xc600000c)) 41 | 42 | #endif /* end of __PLMT_REG_H_ */ 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/register.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file register.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef REGISTER_H 25 | #define REGISTER_H 26 | 27 | #include "gpio_reg.h" 28 | #include "soc.h" 29 | #include "analog_reg.h" 30 | #include "audio_reg.h" 31 | #include "timer_reg.h" 32 | #include "dma_reg.h" 33 | #include "usb_reg.h" 34 | #include "pwm_reg.h" 35 | #include "spi_reg.h" 36 | #include "i2c_reg.h" 37 | #include "mspi_reg.h" 38 | #include "rf_reg.h" 39 | #include "trng_reg.h" 40 | #include "pke_reg.h" 41 | #include "plic_reg.h" 42 | #include "plic_sw_reg.h" 43 | #include "plmt_reg.h" 44 | #include "uart_reg.h" 45 | #include "stimer_reg.h" 46 | #include "adc_reg.h" 47 | #include "swire_reg.h" 48 | #include "qdec_reg.h" 49 | #include "plic_sw_reg.h" 50 | #include "plmt_reg.h" 51 | #include "otp_reg.h" 52 | #include "analog_afe3v_reg.h" 53 | #include "analog_afe1v_reg.h" 54 | #include "ir_learn_reg.h" 55 | #endif 56 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/chip_tl721x/reg_include/ske_reg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file ske_reg.h 3 | * 4 | * @brief This is the header file for TL721X 5 | * 6 | * @author Driver Group 7 | * @date 2024 8 | * 9 | * @par Copyright (c) 2024, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * 11 | * Licensed under the Apache License, Version 2.0 (the "License"); 12 | * you may not use this file except in compliance with the License. 13 | * You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, software 18 | * distributed under the License is distributed on an "AS IS" BASIS, 19 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | * See the License for the specific language governing permissions and 21 | * limitations under the License. 22 | * 23 | *******************************************************************************************************/ 24 | #ifndef SKE_REG_H 25 | #define SKE_REG_H 26 | #include "soc.h" 27 | 28 | #define SKE_LP_BASE_ADDR (0x80104000) 29 | 30 | #define reg_ske_fifo (0x80100800 + 0x20) 31 | #define reg_ske_dma_en REG_ADDR8(0x100800 + 0x24) 32 | #define reg_ske_thres REG_ADDR8(0x100800 + 0x25) 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_8258.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_8258.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_826x.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_826x.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_8278.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_8278.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_b91.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_b91.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_b92.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_b92.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_tl321x.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_tl321x.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/lib/libdrivers_tl721x.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/lib/libdrivers_tl721x.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/platform.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file platform.h 3 | * 4 | * @brief This is the header file for platform 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | 29 | #if defined (MCU_CORE_826x) 30 | #include "chip_826x/driver_826x.h" 31 | #include "chip_826x/gpio_default.h" 32 | #elif defined (MCU_CORE_8258) 33 | #include "chip_8258/driver_8258.h" 34 | #include "chip_8258/gpio_default.h" 35 | #elif defined (MCU_CORE_8278) 36 | #include "chip_8278/driver_8278.h" 37 | #include "chip_8278/gpio_default.h" 38 | #elif defined (MCU_CORE_B91) 39 | #include "chip_b91/driver.h" 40 | #include "chip_b91/gpio_default.h" 41 | #elif defined (MCU_CORE_B92) 42 | #include "chip_b92/driver.h" 43 | #include "chip_b92/gpio_default.h" 44 | #elif defined (MCU_CORE_TL721X) 45 | #include "chip_tl721x/driver.h" 46 | #include "chip_tl721x/gpio_default.h" 47 | #elif defined (MCU_CORE_TL321X) 48 | #include "chip_tl321x/driver.h" 49 | #include "chip_tl321x/gpio_default.h" 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/riscv/firmware_encrypt.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmware_encrypt.h 3 | * 4 | * @brief This is the header file of firmware_encrypt for b91m 5 | * 6 | * @author Driver Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef ENCRYPT_H_ 27 | #define ENCRYPT_H_ 28 | 29 | void firmware_encrypt_based_on_uid(unsigned char* uid,unsigned char* ciphertext); 30 | 31 | #endif /* ENCRYPT_H_ */ 32 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/riscv/libfirmware_encrypt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/riscv/libfirmware_encrypt.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/tc32/firmware_encrypt.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file firmware_encrypt.h 3 | * 4 | * @brief This is the header file of firmware_encrypt for b85m 5 | * 6 | * @author Driver Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef ENCRYPT_H_ 27 | #define ENCRYPT_H_ 28 | 29 | void firmware_encrypt_based_on_uid(unsigned char* uid,unsigned char* ciphertext); 30 | 31 | #endif /* ENCRYPT_H_ */ 32 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/tc32/libfirmware_encrypt.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/tc32/libfirmware_encrypt.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/platform/tc32/libsoft-fp.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/platform/tc32/libsoft-fp.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/common/list.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file list.h 3 | * 4 | * @brief This is the header file for list 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #define LIST_CONCAT2(a, b) a##b 29 | #define LIST_CONCAT(a, b) LIST_CONCAT2(a, b) 30 | 31 | #define LIST(name) \ 32 | static void *LIST_CONCAT(name, _list) = NULL; \ 33 | static list_t name = (list_t)&LIST_CONCAT(name, _list); 34 | 35 | 36 | typedef void ** list_t; 37 | 38 | void listInit(list_t list); 39 | void *listHead(list_t list); 40 | void *listTail(list_t list); 41 | void *listPop (list_t list); 42 | void listPush(list_t list, void *item); 43 | 44 | void *listChop(list_t list); 45 | 46 | void listAdd(list_t list, void *item); 47 | void listRemove(list_t list, void *item); 48 | 49 | int listLength(list_t list); 50 | 51 | void listCopy(list_t dest, list_t src); 52 | 53 | void listInsert(list_t list, void *prevItem, void *newItem); 54 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/common/mempool.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file mempool.h 3 | * 4 | * @brief This is the header file for mempool 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | 29 | typedef struct mem_block_t{ 30 | struct mem_block_t *next_block; 31 | char data[4]; // must 4 or 8 aligned, padding 32 | }mem_block_t; 33 | 34 | typedef struct mem_pool_t{ 35 | mem_block_t *free_list; 36 | }mem_pool_t; 37 | 38 | #define MEMPOOL_ALIGNMENT 4 39 | #define MEMPOOL_ITEMSIZE_2_BLOCKSIZE(s) ((s + (MEMPOOL_ALIGNMENT - 1)) & ~(MEMPOOL_ALIGNMENT-1)) 40 | 41 | #define MEMPOOL_DECLARE(pool_name, pool_mem, itemsize, itemcount) \ 42 | mem_pool_t pool_name; \ 43 | u8 pool_mem[MEMPOOL_ITEMSIZE_2_BLOCKSIZE(itemsize) * itemcount] _attribute_aligned_(4); 44 | 45 | mem_pool_t *mempool_init(mem_pool_t *pool, void *mem, int itemsize, int itemcount); 46 | void *mempool_alloc(mem_pool_t *pool); 47 | void mempool_free(mem_pool_t *pool, void *p); 48 | mem_block_t* mempool_header(char *pd); 49 | 50 | 51 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/drv_calibration.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file drv_calibration.h 3 | * 4 | * @brief This is the header file for drv_calibration 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | void drv_calibration(void); 29 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/drv_flash.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file drv_flash.h 3 | * 4 | * @brief This is the header file for drv_flash 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #if defined(MCU_CORE_826x) || defined(MCU_CORE_8258) || defined(MCU_CORE_8278) || defined(MCU_CORE_B91) || defined(MCU_CORE_B92) || defined(MCU_CORE_TL321X) 29 | typedef u8 (*drv_flash_lock)(u32 blockSize); 30 | typedef u8 (*drv_flash_unlock)(void); 31 | #elif defined(MCU_CORE_TL721X) 32 | typedef u8 (*drv_flash_lock)(mspi_slave_device_num_e num, u32 blockSize); 33 | typedef u8 (*drv_flash_unlock)(mspi_slave_device_num_e num); 34 | #endif 35 | 36 | typedef struct{ 37 | u32 mid; 38 | drv_flash_unlock unlock; 39 | drv_flash_lock lock; 40 | u32 blockSize; 41 | }drv_flash_opt_t; 42 | 43 | 44 | void flash_write(u32 addr, u32 len, u8 *buf); 45 | bool flash_writeWithCheck(u32 addr, u32 len, u8 *buf); 46 | void flash_read(u32 addr, u32 len, u8 *buf); 47 | void flash_erase(u32 addr); 48 | void flash_loadOpt(void); 49 | void flash_lock(void); 50 | void flash_unlock(void); 51 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/drv_pwm.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file drv_pwm.c 3 | * 4 | * @brief This is the source file for drv_pwm 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "../tl_common.h" 27 | 28 | void drv_pwm_init(void){ 29 | #if defined(MCU_CORE_826x) 30 | pwm_Init(0); 31 | #elif defined(MCU_CORE_B91) || defined(MCU_CORE_B92) || defined(MCU_CORE_TL721X) || defined(MCU_CORE_TL321X) 32 | pwm_set_clk(0); 33 | #endif 34 | } 35 | 36 | void drv_pwm_cfg(u8 pwmId, u16 cmp_tick, u16 cycle_tick){ 37 | #if defined(MCU_CORE_826x) 38 | pwm_Open(pwmId, NORMAL, 0, cmp_tick, cycle_tick, 0x2fff); 39 | #elif defined(MCU_CORE_8258) || defined(MCU_CORE_8278) 40 | pwm_set_mode(pwmId, PWM_NORMAL_MODE); 41 | pwm_set_phase(pwmId, 0); //no phase at pwm beginning 42 | pwm_set_cycle_and_duty(pwmId, cycle_tick, cmp_tick); 43 | #elif defined(MCU_CORE_B91) || defined(MCU_CORE_B92) || defined(MCU_CORE_TL721X) || defined(MCU_CORE_TL321X) 44 | pwm_set_tcmp(pwmId, cmp_tick); 45 | pwm_set_tmax(pwmId, cycle_tick); 46 | #endif 47 | } 48 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/drv_security.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file drv_security.c 3 | * 4 | * @brief This is the source file for drv_security 5 | * 6 | * @author Zigbee Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2023, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "../tl_common.h" 27 | 28 | void drv_aes_encrypt(u8 *key, u8 *plain, u8 *result) 29 | { 30 | #if defined(MCU_CORE_826x) || defined(MCU_CORE_8258) || defined(MCU_CORE_8278) || defined(MCU_CORE_B91) || defined(MCU_CORE_B92) 31 | aes_encrypt(key, plain, result); 32 | #elif defined(MCU_CORE_TL721X) || defined(MCU_CORE_TL321X) 33 | ske_lp_aes128_ecb_one_block(SKE_CRYPTO_ENCRYPT, (unsigned int *)key, (unsigned int *)plain, (unsigned int *)result); 34 | #endif 35 | } 36 | 37 | void drv_aes_decrypt(u8 *key, u8 *cipher, u8 *result) 38 | { 39 | #if defined(MCU_CORE_826x) || defined(MCU_CORE_8258) || defined(MCU_CORE_8278) || defined(MCU_CORE_B91) || defined(MCU_CORE_B92) 40 | aes_decrypt(key, cipher, result); 41 | #elif defined(MCU_CORE_TL721X) || defined(MCU_CORE_TL321X) 42 | ske_lp_aes128_ecb_one_block(SKE_CRYPTO_DECRYPT, (unsigned int *)key, (unsigned int *)cipher, (unsigned int *)result); 43 | #endif 44 | } 45 | 46 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/drv_security.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file drv_security.h 3 | * 4 | * @brief This is the header file for drv_security 5 | * 6 | * @author Zigbee Group 7 | * @date 2023 8 | * 9 | * @par Copyright (c) 2023, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | void drv_aes_encrypt(u8 *key, u8 *plain, u8 *result); 29 | void drv_aes_decrypt(u8 *key, u8 *cipher, u8 *result); 30 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/app/usbkb.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbkb.c 3 | * 4 | * @brief This is the source file for usbkb 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "usbkb.h" 27 | 28 | #if (MODULE_KEYBOARD_ENABLE) 29 | 30 | u8 usbkb_hid_report_normal(u8 ctrl_key, u8 *keycode){ 31 | if(usbhw_is_ep_busy(USB_EDP_KEYBOARD_IN)) 32 | return 0; 33 | 34 | reg_usb_ep_ptr(USB_EDP_KEYBOARD_IN) = 0; 35 | 36 | // please refer to keyboard_report_desc 37 | reg_usb_ep_dat(USB_EDP_KEYBOARD_IN) = ctrl_key; 38 | reg_usb_ep_dat(USB_EDP_KEYBOARD_IN) = 0;//resv 39 | foreach(i, KEYBOARD_REPORT_KEY_MAX){ 40 | reg_usb_ep_dat(USB_EDP_KEYBOARD_IN) = keycode[i]; 41 | } 42 | reg_usb_ep_ctrl(USB_EDP_KEYBOARD_IN) = FLD_EP_DAT_ACK; // ACK 43 | return 1; 44 | } 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/app/usbkb.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbkb.h 3 | * 4 | * @brief This is the header file for usbkb 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "usbkb_i.h" 29 | 30 | /* Enable C linkage for C++ Compilers: */ 31 | #if defined(__cplusplus) 32 | extern "C" { 33 | #endif 34 | 35 | #define KEYBOARD_REPORT_KEY_MAX 6 36 | 37 | 38 | u8 usbkb_hid_report_normal(u8 ctrl_key, u8 *keycode); 39 | 40 | 41 | /* Disable C linkage for C++ Compilers: */ 42 | #if defined(__cplusplus) 43 | } 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/app/usbmouse.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbmouse.c 3 | * 4 | * @brief This is the source file for usbmouse 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "usbmouse.h" 27 | 28 | #if (USB_MOUSE_ENABLE) 29 | 30 | u8 usbmouse_hid_report(u8 report_id, u8 *data, int cnt){ 31 | if(!reg_usb_host_conn){ 32 | reg_usb_ep_ctrl(USB_EDP_MOUSE) = 0; 33 | return 0; 34 | } 35 | 36 | if(usbhw_is_ep_busy(USB_EDP_MOUSE)) 37 | return 0; 38 | 39 | reg_usb_ep_ptr(USB_EDP_MOUSE) = 0; 40 | 41 | // please refer to usbmouse_i.h mouse_report_desc 42 | extern u8 usb_mouse_report_proto; 43 | 44 | if(!usb_mouse_report_proto){ 45 | reg_usb_ep_dat(USB_EDP_MOUSE) = data[0]; 46 | reg_usb_ep_dat(USB_EDP_MOUSE) = data[1]; 47 | reg_usb_ep_dat(USB_EDP_MOUSE) = data[2]; 48 | }else{ 49 | reg_usb_ep_dat(USB_EDP_MOUSE) = report_id; 50 | foreach(i, cnt){ 51 | reg_usb_ep_dat(USB_EDP_MOUSE) = data[i]; 52 | } 53 | } 54 | 55 | reg_usb_ep_ctrl(USB_EDP_MOUSE) = FLD_EP_DAT_ACK; // ACK 56 | 57 | return 1; 58 | } 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/app/usbmouse.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbmouse.h 3 | * 4 | * @brief This is the header file for usbmouse 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "usbmouse_i.h" 29 | 30 | /* Enable C linkage for C++ Compilers: */ 31 | #if defined(__cplusplus) 32 | extern "C" { 33 | #endif 34 | 35 | 36 | 37 | u8 usbmouse_hid_report(u8 report_id, u8 *data, int cnt); 38 | 39 | /* Disable C linkage for C++ Compilers: */ 40 | #if defined(__cplusplus) 41 | } 42 | #endif 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/app/usbvendor_i.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbvendor_i.h 3 | * 4 | * @brief This is the header file for usbvendor_i 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "../usbdesc.h" 29 | 30 | #if (USB_VENDOR_ENABLE) 31 | 32 | static const u8 vendor_report_desc[] = { 33 | HID_DESCRIPTOR_VENDOR(1, 4, 0, 1, 64), 34 | }; 35 | 36 | static inline u8 *usbvendor_get_report_desc(void){ 37 | return (u8*)(vendor_report_desc); 38 | } 39 | 40 | static inline u16 usbvendor_get_report_desc_size(void){ 41 | return (u16)(sizeof(vendor_report_desc)); 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/usb.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usb.h 3 | * 4 | * @brief This is the header file for usb 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | /* Enable C linkage for C++ Compilers: */ 29 | #if defined(__cplusplus) 30 | extern "C" { 31 | #endif 32 | 33 | enum { 34 | USB_TIME_BEFORE_ALLOW_SUSPEND = (3000*1000),// 3000 ms 35 | }; 36 | 37 | enum { 38 | USB_IRQ_SETUP_REQ = 0, 39 | USB_IRQ_DATA_REQ, 40 | }; 41 | 42 | // telink usb report ctrl command. used mixed with USB_AUD_PLAY_PAUSE... 43 | enum{ 44 | USB_REPORT_NO_EVENT = 0xf0, 45 | USB_REPORT_RELEASE = 0xff, 46 | }; 47 | 48 | /** 49 | * @brief This function initializes the USB interface 50 | * @param none 51 | * @return none 52 | */ 53 | void usb_init(void); 54 | 55 | /** 56 | * @brief This function handles the USB related irq. 57 | * @param none 58 | * @return none 59 | */ 60 | void usb_handle_irq(void); 61 | 62 | 63 | /* Disable C linkage for C++ Compilers: */ 64 | #if defined(__cplusplus) 65 | } 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/usb_common.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usb_common.h 3 | * 4 | * @brief This is the header file for usb_common 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | #include "usb.h" 29 | 30 | #include "app/usbcdc.h" 31 | #include "app/usbmouse.h" 32 | #include "app/usbkb.h" 33 | #include "app/usbvendor.h" 34 | #if (__PROJECT_TL_SNIFFER__) 35 | #include "app/usbsniffer.h" 36 | #endif 37 | 38 | 39 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/drivers/usb/usbstd/usbstd.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file usbstd.h 3 | * 4 | * @brief This is the header file for usbstd 5 | * 6 | * @author Driver & Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #pragma once 27 | 28 | /* Includes: */ 29 | #include "AudioClassCommon.h" 30 | #include "CDCClassCommon.h" 31 | #include "CDCClassDevice.h" 32 | #include "HIDClassCommon.h" 33 | #include "HIDClassDevice.h" 34 | #include "HIDReportData.h" 35 | #include "PrinterClassCommon.h" 36 | #include "StdRequestType.h" 37 | #include "StdDescriptors.h" 38 | #include "USBController.h" 39 | 40 | 41 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/proj/os/ev_rtc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file ev_rtc.h 3 | * 4 | * @brief This is the header file for ev_rtc 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | #pragma once 26 | 27 | typedef struct{ 28 | u16 year; 29 | u8 month; 30 | u8 day; 31 | u8 hour; 32 | u8 min; 33 | u8 sec; 34 | }utcTime_t; 35 | 36 | void ev_rtc_update(u32 updateTime); 37 | 38 | extern UTCTime ev_rtc_utc2Second(utcTime_t *time); 39 | extern void ev_rtc_secondsSet(UTCTime seconds); 40 | extern UTCTime ev_rtc_secondsGet(void); 41 | extern void ev_rtc_second2utc(utcTime_t *time, UTCTime utcSeconds); 42 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/tools/tl_check_fw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "*****************************************************" 3 | echo "this is post build!! current configure is :$1" 4 | if [[ $2 = tc32 ]]; then 5 | tc32-elf-objcopy -v -O binary $1.elf $1.bin 6 | ../../../tools/tl_check_fw2.exe $1.bin 7 | elif [[ $2 = riscv ]]; then 8 | riscv32-elf-objcopy -S -O binary $1.elf output/$1.bin 9 | ../../../tools/tl_check_fw2.exe output/$1.bin 10 | elif [[ $2 = iot_riscv ]]; then 11 | riscv32-elf-objcopy -S -O binary $1.elf $1.bin 12 | ../../../tools/tl_check_fw2.exe $1.bin 13 | fi 14 | echo "**************** end of post build ******************" 15 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/tools/tl_check_fw2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/tools/tl_check_fw2.exe -------------------------------------------------------------------------------- /tl_zigbee_sdk/tools/tl_check_fw2.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/tools/tl_check_fw2.out -------------------------------------------------------------------------------- /tl_zigbee_sdk/tools/tl_link_load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "*****************************************************" 3 | echo "this is post build!! current configure is :$1" 4 | rm -rf $2 5 | cp -f $1 $2 6 | echo "**************** end of post build ******************" 7 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/common/includes/zb_version.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zb_version.h 3 | * 4 | * @brief This is the header file for zb_version 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef ZB_VERSION_H 27 | #define ZB_VERSION_H 28 | 29 | #define SDK_VERSION_ID v3.7.1.2 30 | 31 | #define SDK_VERSION_(sdk_version) "$$$zb_sdk_"#sdk_version"$$$" 32 | #define SDK_VERSION(sdk_version) SDK_VERSION_(sdk_version) 33 | 34 | #endif /* ZB_VERSION_H */ 35 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/common/zb_version.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zb_version.c 3 | * 4 | * @brief This is the source file for zb_version 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #include "includes/zb_version.h" 27 | 28 | volatile __attribute__((section(".sdk_version"))) unsigned char sdk_version[] = {SDK_VERSION(SDK_VERSION_ID)}; 29 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/gp/gp_sec.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file gp_sec.h 3 | * 4 | * @brief This is the header file for gp_sec 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef GP_SEC_H 27 | #define GP_SEC_H 28 | 29 | 30 | u8 gpCcmStar(u8 appId, gpdId_t gpdId, 31 | u8 gpdfSecKey, u8 gpdfSecLevel, 32 | u8 endpoint, u32 secFrameCounter, 33 | u8 gpdAsduLen, u8 *gpdAsdu, 34 | bool autoComm, bool rxAfterTx, 35 | u32 mic, u8 *pKey); 36 | 37 | u8 gpdKeyWithTCLK(u8 appId, gpdId_t gpdId, 38 | u8 dataLen, u8 *pData, 39 | u32 frameCounter, u8 *mic, 40 | u8 *pKey, bool enOrDecrypt); 41 | 42 | #endif /* GP_SEC_H */ 43 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv/libzb_coordinator.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv/libzb_coordinator.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv/libzb_ed.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv/libzb_ed.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv/libzb_router.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv/libzb_router.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_coordinator.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_coordinator.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_ed.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_ed.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_router.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5/libzb_router.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_coordinator.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_coordinator.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_ed.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_ed.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_router.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/riscv_gcc12_v5f/libzb_router.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/tc32/libzb_coordinator.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/tc32/libzb_coordinator.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/tc32/libzb_ed.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/tc32/libzb_ed.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/lib/tc32/libzb_router.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tl_zigbee_sdk/zigbee/lib/tc32/libzb_router.a -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/zcl/general/zcl_diagnostics.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zcl_diagnostics.c 3 | * 4 | * @brief This is the source file for zcl_diagnostics 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | /********************************************************************** 27 | * INCLUDES 28 | */ 29 | #include "../zcl_include.h" 30 | 31 | 32 | #ifdef ZCL_DIAGNOSTICS 33 | /********************************************************************** 34 | * LOCAL CONSTANTS 35 | */ 36 | 37 | 38 | /********************************************************************** 39 | * LOCAL TYPES 40 | */ 41 | 42 | 43 | /********************************************************************** 44 | * LOCAL VARIABLES 45 | */ 46 | 47 | 48 | /********************************************************************** 49 | * LOCAL FUNCTIONS 50 | */ 51 | _CODE_ZCL_ status_t zcl_diagnostics_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb) 52 | { 53 | return zcl_registerCluster(endpoint, ZCL_CLUSTER_GEN_DIAGNOSTICS, manuCode, attrNum, attrTbl, NULL, cb); 54 | } 55 | 56 | #endif /* ZCL_DIAGNOSTICS */ 57 | 58 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/zcl/general/zcl_powerCfg.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zcl_powerCfg.c 3 | * 4 | * @brief This is the source file for zcl_powerCfg 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | /********************************************************************** 27 | * INCLUDES 28 | */ 29 | #include "../zcl_include.h" 30 | 31 | 32 | #ifdef ZCL_POWER_CFG 33 | /********************************************************************** 34 | * LOCAL CONSTANTS 35 | */ 36 | 37 | 38 | /********************************************************************** 39 | * LOCAL TYPES 40 | */ 41 | 42 | 43 | /********************************************************************** 44 | * LOCAL VARIABLES 45 | */ 46 | 47 | /********************************************************************** 48 | * LOCAL FUNCTIONS 49 | */ 50 | _CODE_ZCL_ status_t zcl_powerCfg_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb) 51 | { 52 | return zcl_registerCluster(endpoint, ZCL_CLUSTER_GEN_POWER_CFG, manuCode, attrNum, attrTbl, NULL, cb); 53 | } 54 | 55 | #endif /* ZCL_POWER_CFG */ 56 | 57 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/zcl/general/zcl_time.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zcl_time.h 3 | * 4 | * @brief This is the header file for zcl_time 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef ZCL_TIME_H 27 | #define ZCL_TIME_H 28 | 29 | 30 | 31 | 32 | #define ZCL_ATTRID_TIME 0x0000 33 | #define ZCL_ATTRID_TIME_STATUS 0x0001 34 | #define ZCL_ATTRID_TIMEZONE 0x0002 35 | #define ZCL_ATTRID_DST_START 0x0003 36 | #define ZCL_ATTRID_DST_END 0x0004 37 | #define ZCL_ATTRID_DST_SHIFT 0x0005 38 | #define ZCL_ATTRID_STANDARD_TIME 0x0006 39 | #define ZCL_ATTRID_LOCAL_TIME 0x0007 40 | #define ZCL_ATTRID_LAST_SET_TIME 0x0008 41 | #define ZCL_ATTRID_VALID_UNTIL_TIME 0x0009 42 | 43 | 44 | 45 | 46 | status_t zcl_time_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb); 47 | 48 | 49 | 50 | 51 | #endif /* ZCL_TIME_H */ 52 | -------------------------------------------------------------------------------- /tl_zigbee_sdk/zigbee/zcl/measument_sensing/zcl_illuminance_measurement.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************************** 2 | * @file zcl_illuminance_measurement.h 3 | * 4 | * @brief This is the header file for zcl_illuminance_measurement 5 | * 6 | * @author Zigbee Group 7 | * @date 2021 8 | * 9 | * @par Copyright (c) 2021, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 10 | * All rights reserved. 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | *******************************************************************************************************/ 25 | 26 | #ifndef ZCL_ILLUMINANCE_MEASUREMENT_H 27 | #define ZCL_ILLUMINANCE_MEASUREMENT_H 28 | 29 | 30 | 31 | /********************************************************************* 32 | * CONSTANTS 33 | */ 34 | 35 | 36 | /* Attribute ID */ 37 | #define ZCL_ATTRID_MEASURED_VALUE 0x0000 38 | #define ZCL_ATTRID_MIN_MEASURED_VALUE 0x0001 39 | #define ZCL_ATTRID_MAX_MEASURED_VALUE 0x0002 40 | #define ZCL_ATTRID_TOLERANCE 0x0003 41 | #define ZCL_ATTRID_LIGHT_SENSOR_TYPE 0x0004 42 | 43 | 44 | 45 | 46 | status_t zcl_illuminanceMeasure_register(u8 endpoint, u16 manuCode, u8 attrNum, const zclAttrInfo_t attrTbl[], cluster_forAppCb_t cb); 47 | 48 | 49 | #endif /* ZCL_ILLUMINANCE_MEASUREMENT_H */ 50 | -------------------------------------------------------------------------------- /tools/floader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tools/floader.bin -------------------------------------------------------------------------------- /tools/tl_check_fw.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | import binascii 3 | import sys 4 | # https://github.com/pvvx/ATC_MiThermometer/issues/186#issuecomment-1030410603 5 | with open(sys.argv[1], 'rb') as f: 6 | firmware = bytearray(f.read(-1)) 7 | 8 | if firmware[6:8] != b'\x5d\x02': 9 | # Ensure FW size is multiple of 16 10 | padding = 16 - len(firmware) % 16 11 | if padding < 16: 12 | firmware += b'\xFF' * padding 13 | # Fix FW length 14 | firmware[0x18:0x1c] = (len(firmware)+4).to_bytes(4, byteorder='little') 15 | # Add magic constant 16 | firmware[6:8] = b'\x5d\x02' 17 | # Add CRC 18 | crc = binascii.crc32(firmware) ^ 0xffffffff 19 | firmware += crc.to_bytes(4, byteorder='little') 20 | # Write the new firwmare back to the file 21 | with open(sys.argv[1], 'wb') as f: 22 | f.write(firmware) 23 | print(f"Firmware patched!") 24 | else: 25 | print(f"Firmware already patched!") -------------------------------------------------------------------------------- /tools/tl_check_fw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "*****************************************************" 3 | echo "this is post build!! current configure is :$1" 4 | if [[ $2 = tc32 ]]; then 5 | tc32-elf-objcopy -v -O binary $1.elf $1.bin 6 | ./tools/tl_check_fw2.exe $1.bin 7 | elif [[ $2 = riscv ]]; then 8 | riscv32-elf-objcopy -S -O binary $1.elf output/$1.bin 9 | ../../../tools/tl_check_fw2.exe output/$1.bin 10 | fi 11 | echo "**************** end of post build ******************" 12 | -------------------------------------------------------------------------------- /tools/tl_check_fw2.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slacky1965/watermeter_zed/12432b26f478e4b972c07ea3990d21005dbe8f52/tools/tl_check_fw2.exe -------------------------------------------------------------------------------- /tools/tl_link_load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "*****************************************************" 3 | echo "this is post build!! current configure is :$1" 4 | rm -rf $2 5 | cp -f $1 $2 6 | echo "**************** end of post build ******************" 7 | -------------------------------------------------------------------------------- /zigbee2mqtt/configuration.yaml: -------------------------------------------------------------------------------- 1 | external_converters: 2 | - watermeter.js 3 | ota: 4 | zigbee_ota_override_index_location: local_ota_index.json 5 | -------------------------------------------------------------------------------- /zigbee2mqtt/ota/local_ota_index.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "images/watermeter_zed.zigbee", 4 | "force": true 5 | } 6 | ] 7 | 8 | --------------------------------------------------------------------------------