ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Files at this revision

API Documentation at this revision

Comitter:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Parent:
46:183cfc59d4e4
Child:
48:c7ee67edcf1d
Commit message:
?

Changed in this revision

DuerOS-Light-SDK-v1.1.0/demo/device_controller.cpp Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/device_controller.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/duer_app.cpp Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/duer_app.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/events.cpp Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/events.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/factory_test.cpp Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/factory_test.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/main.cpp Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/demo/mbed_app.json Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/boards/TARGET_RDA/package_scanner.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/boards/TARGET_RDA/rda_ota_updater.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/duer-os.ar Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mp3common.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mp3dec.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mpadecobjfixpt.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/statname.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/real/assembly.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/real/coder.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ff.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ff_int_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ffint.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/rda_log.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/rda_mp4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_bits.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_callbacks.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_config_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_echo.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_header.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_jitter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_preprocess.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_resampler.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_stereo.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/_kiss_fft_guts.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/arch.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_arm4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_sse.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fftwrap.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filterbank.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_arm4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_sse.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_arm4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_arm5e.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_debug.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_generic.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/kiss_fft.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/kiss_fftr.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lpc.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lpc_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lsp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lsp_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_arm4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_sse.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/math_approx.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/misc.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/misc_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/modes.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/nb_celp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/pseudofloat.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/quant_lsp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/quant_lsp_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/sb_celp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/smallft.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/stack_alloc.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vbr.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vorbis_psy.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_arm4.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_bfin.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_sse.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/wavfmt/wavfmt.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/VS1053/baidu_media_adapter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/VS1053/vs10xx.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/baidu_rda58xx_base.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx_dbg.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx_int_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/mbed_config.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/mbed_lib.json Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/baidu-speedx/baidu_speex.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/heap-monitor/heap_monitor.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_http_client.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_http_client_c.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_mbed_soc_wrapper.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_adapter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_memory_adapter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_network_adapter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_network_socket.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_configuration.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_handler.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_message.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_object.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_scheduler.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_util_list.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca_mbedtls_config.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_coap.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_coap_ep.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_conf.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_debug.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_hashcode.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_internal.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_mbedtrace.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_memory.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_mutex.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_nsdl_adapter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_random.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_timestamp.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_trans_encrypted.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_trans_wrapper.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_transport.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_util_network.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/ns_list.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/ns_types.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/threading_alt.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_coap_downloader.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_decompresser.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_downloader.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_error.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_http_downloader.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_log.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_manager.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_reporter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/new_firmware_image_unpack_tool.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/IOtaUpdater.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/cJSON.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/datacollector.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/decompress.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/fs.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/pack_include.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/package_api.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/verification.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/crc32.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/deflate.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inffast.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inffixed.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inflate.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inftrees.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/trees.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zconf.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zlib.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zutil.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/coap_client.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/package_info.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/shared_buffer.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/url.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-base/baidu_media_base.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-base/baidu_media_type.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_data_manager.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_file_storer.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_manager.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_buffer.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_m4a.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_type.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/mutex/baidu_iot_mutex.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_recorder.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_recorder_manager.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_speex_encoder.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_measure_time.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_measure_time_list.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_status_reporter.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_time_calculate.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_time_calculate_list.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/duer_log.h Show annotated file Show diff for this revision Revisions of this file
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/vs10xx/baidu_vs10xx_base.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/device_controller.cpp	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,141 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+/**
+ * File: device_controller.cpp
+ * Desc: Demo for control device.
+ */
+#include "device_controller.h"
+#include "baidu_ca_scheduler.h"
+#include "baidu_media_manager.h"
+#include "duer_log.h"
+
+namespace duer {
+
+#if defined(TEST_BOARD)
+
+static bca_status_t media_stop(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr) {
+    bca_handler handler = (bca_handler)ctx;
+    DUER_LOGV("media_stop");
+
+    if (handler && msg) {
+        duer::MediaManager::instance().stop();
+        duer::Scheduler::instance().response(msg, BCA_MSG_RSP_CHANGED, NULL);
+    }
+
+    return BCA_NO_ERR;
+}
+
+static bca_status_t set_volume(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr) {
+    bca_handler handler = (bca_handler)ctx;
+    static int volume = 10;
+    int msg_code = BCA_MSG_RSP_CHANGED;
+    const int LEN = 3;
+    char str_volume[LEN] = {0};
+    DUER_LOGV("set_volume");
+
+    if (handler && msg) {
+        if (msg->msg_code == BCA_MSG_REQ_GET) {
+            DUER_LOGI("volume get: %d", volume);
+            snprintf(str_volume, LEN, "%d", volume);
+        } else if (msg->msg_code == BCA_MSG_REQ_PUT) {
+            if (msg->payload && msg->payload_len > 0 && msg->payload_len < LEN) {
+                snprintf(str_volume, LEN, "%s", (char*)msg->payload);
+                DUER_LOGI("volume set: %s", str_volume);
+                int vol = atoi(str_volume);
+
+                if (vol > 16 || vol < 0) {
+                    msg_code = BCA_MSG_RSP_FORBIDDEN;
+                } else {
+                    if (volume == vol) {
+                        msg_code = BCA_MSG_RSP_VALID;
+                    } else {
+                        duer::MediaManager::instance().set_volume(vol);
+                        volume = vol;
+                    }
+                }
+            } else {
+                msg_code = BCA_MSG_RSP_FORBIDDEN;
+                str_volume[0] = 0;
+                DUER_LOGI("volume set invalid");
+            }
+        }
+
+        Scheduler::instance().response(msg, msg_code, str_volume);
+    }
+
+    return BCA_NO_ERR;
+}
+
+static bca_status_t shutdown(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr) {
+    bca_handler handler = (bca_handler)ctx;
+    DUER_LOGV("shutdown");
+
+    if (handler && msg) {
+        duer::Scheduler::instance().response(msg, BCA_MSG_RSP_CHANGED, NULL);
+        duer::Scheduler::instance().stop();
+    }
+
+    return BCA_NO_ERR;
+}
+
+static bca_status_t set_mode(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr) {
+    bca_handler handler = (bca_handler)ctx;
+    static const int LEN = 10;
+    static char mode[LEN] = {0};
+    int msg_code = BCA_MSG_RSP_CHANGED;
+    DUER_LOGV("set_mode");
+
+    if (handler && msg) {
+        if (msg->msg_code == BCA_MSG_REQ_GET) {
+            DUER_LOGI("mode get: %s", mode);
+        } else if (msg->msg_code == BCA_MSG_REQ_PUT) {
+            if (msg->payload && msg->payload_len > 0) {
+                snprintf(mode, LEN, "%s", (char*)msg->payload);
+                DUER_LOGI("mode set: %s", mode);
+            } else {
+                msg_code = BCA_MSG_RSP_FORBIDDEN;
+                mode[0] = 0;
+                DUER_LOGI("mode set invalid");
+            }
+        }
+
+        Scheduler::instance().response(msg, msg_code, mode);
+    }
+
+    return BCA_NO_ERR;
+}
+
+static bca_status_t get_power(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr) {
+    bca_handler handler = (bca_handler)ctx;
+    static double power = 1.0;
+    DUER_LOGV("get_power");
+
+    if (handler && msg) {
+        char str_power[4];
+        snprintf(str_power, 4, "%lf", power);
+        DUER_LOGI("power: %s", str_power);
+        Scheduler::instance().response(msg, BCA_MSG_RSP_CHANGED, str_power);
+
+        if (power > 0.5) {
+            power -= 0.01;
+        }
+    }
+
+    return BCA_NO_ERR;
+}
+
+#endif
+
+void device_controller_init(void) {
+#if defined(TEST_BOARD)
+    bca_res_t res[] = {
+        {BCA_RES_MODE_DYNAMIC, BCA_RES_OP_PUT, "stop", media_stop},
+        {BCA_RES_MODE_DYNAMIC, BCA_RES_OP_PUT | BCA_RES_OP_GET, "volume", set_volume},
+        {BCA_RES_MODE_DYNAMIC, BCA_RES_OP_PUT, "shutdown", shutdown},
+        {BCA_RES_MODE_DYNAMIC, BCA_RES_OP_PUT | BCA_RES_OP_GET, "mode", set_mode},
+        {BCA_RES_MODE_DYNAMIC, BCA_RES_OP_GET, "power", get_power},
+    };
+    Scheduler::instance().add_controll_points(res, sizeof(res) / sizeof(res[0]));
+#endif
+}
+
+} // namespace duer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/device_controller.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,15 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+
+#ifndef BAIDU_IOT_TINYDU_DEMO_DEVICE_CONTROLLER_H
+#define BAIDU_IOT_TINYDU_DEMO_DEVICE_CONTROLLER_H
+
+namespace duer {
+
+/*
+ * Initialize the device controller.
+ */
+extern void device_controller_init(void);
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_DEMO_DEVICE_CONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/duer_app.cpp	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,268 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+/**
+ * File: duer_app.cpp
+ * Desc: Demo for how to start Duer OS.
+ */
+
+#include "duer_app.h"
+#include "baidu_ca_scheduler.h"
+#include "baidu_media_manager.h"
+#include "duer_log.h"
+#include "device_controller.h"
+#include "events.h"
+#if defined(TARGET_UNO_91H)
+#include "gpadckey.h"
+#endif
+// #include "baidu_json.h"
+
+namespace duer {
+
+#if defined(TARGET_UNO_91H)
+#define LED_RED LED1
+#define LED_GREEN LED2
+#define LED_BLUE LED3
+
+static GpadcKey s_button(KEY_A0);
+static GpadcKey s_pause_button(KEY_A1);
+#else
+#define DUER_APP_RECORDER_BUTTON  SW2
+static mbed::InterruptIn s_button = mbed::InterruptIn(DUER_APP_RECORDER_BUTTON);
+#endif
+
+static const char BAIDU_DEV_CONNECT_SUCCESS_PROMPT_FILE[] = "/sd/cloud_connected.mp3";
+static const char BAIDU_DEV_DISCONNECTED_PROMPT_FILE[] = "/sd/cloud_disconnected.mp3";
+
+static const unsigned int RECONN_DELAY_MIN = 2000;
+static const unsigned int RECONN_DELAY_MAX = 32001;
+
+class SchedulerEventListener : public Scheduler::IOnEvent {
+public:
+    SchedulerEventListener(DuerApp* app) :
+            _app(app) {
+        Scheduler::instance().set_on_event_listener(this);
+    }
+
+    virtual ~SchedulerEventListener() {
+    }
+
+    virtual int on_start() {
+        DUER_LOGI("SchedulerEventListener::on_start");
+
+        MEMORY_STATISTICS("Scheduler::on_start");
+
+        device_controller_init();
+
+        event_set_handler(EVT_KEY_REC_PRESS, _app, &DuerApp::talk_start);
+        event_set_handler(EVT_KEY_REC_RELEASE, _app, &DuerApp::talk_stop);
+        event_set_handler(EVT_KEY_PAUSE, _app, &DuerApp::pause_play);
+
+        _app->set_color(DuerApp::CYAN);
+
+        MediaManager::instance().play_local(BAIDU_DEV_CONNECT_SUCCESS_PROMPT_FILE);
+
+        return 0;
+    }
+
+    virtual int on_stop() {
+        _app->set_color(DuerApp::PURPLE);
+
+        MediaManager::instance().stop();
+        _app->talk_stop();
+
+        event_set_handler(EVT_KEY_REC_PRESS, NULL);
+        event_set_handler(EVT_KEY_REC_RELEASE, NULL);
+        event_set_handler(EVT_KEY_PAUSE, NULL);
+
+        MEMORY_STATISTICS("Scheduler::on_stop");
+
+        DUER_LOGI("SchedulerEventListener::on_stop");
+
+        _app->restart();
+
+        return 0;
+    }
+
+    virtual int on_action(const char* action) {
+        DUER_LOGI("SchedulerEventListener::on_action: %s", action);
+        _app->set_color(DuerApp::BLUE);
+        MediaManager::instance().play_url((char*)action);
+        return 0;
+    }
+
+    virtual int on_data(const char* data) {
+        DUER_LOGV("SchedulerEventListener::on_data: %s", data);
+        // baidu_json* value = baidu_json_Parse(data);
+        // baidu_json* payload = baidu_json_GetObjectItem(value, "payload");
+
+        // if (payload != NULL) {
+        //     baidu_json* audio_item_id = baidu_json_GetObjectItem(payload, "audio_item_id");
+
+        //     if (audio_item_id != NULL) {
+        //         DUER_LOGI("track id: %s", audio_item_id->valuestring);
+        //     }
+        // }
+        // baidu_json_Delete(value);
+
+        return 0;
+    }
+
+private:
+    DuerApp* _app;
+};
+
+class RecorderListener : public Recorder::IListener {
+public:
+    RecorderListener(DuerApp* app) :
+        _app(app),
+        _start_send_data(false) {
+    }
+
+    virtual ~RecorderListener() {
+    }
+
+    virtual int on_start() {
+        _app->set_color(DuerApp::RED);
+        DUER_LOGI("RecorderObserver::on_start");
+        MEMORY_STATISTICS("Recorder::on_start");
+        return 0;
+    }
+
+    virtual int on_resume() {
+        return 0;
+    }
+
+    virtual int on_data(const void* data, size_t size) {
+        if (!_start_send_data) {
+            _start_send_data = true;
+        }
+
+        DUER_LOGV("RecorderObserver::on_data: data = %p, size = %d", data, size);
+        Scheduler::instance().send_content(data, size, false);
+        return 0;
+    }
+
+    virtual int on_pause() {
+        return 0;
+    }
+
+    virtual int on_stop() {
+        if (_start_send_data) {
+            Scheduler::instance().send_content(NULL, 0, false);
+            _start_send_data = false;
+        }
+
+        MEMORY_STATISTICS("Recorder::on_stop");
+        DUER_LOGI("RecorderObserver::on_stop");
+        _app->set_color(DuerApp::GREEN);
+        return 0;
+    }
+
+private:
+    DuerApp* _app;
+    bool _start_send_data;
+};
+
+DuerApp::DuerApp()
+    : _recorder_listener(new RecorderListener(this))
+    , _on_event(new SchedulerEventListener(this))
+#if !defined(TARGET_UNO_91H)
+    , _indicate(LED_BLUE, LED_GREEN, LED_RED)
+#endif
+    , _timer(this, &DuerApp::start, osTimerOnce)
+    , _delay(RECONN_DELAY_MIN)
+#if defined(TEST_BOARD)
+    , _send_ticker(this, &DuerApp::send_timestamp, osTimerPeriodic)
+#endif
+{
+    _recorder.set_listener(_recorder_listener);
+
+#if !defined(TARGET_UNO_91H)
+    _indicate = OFF;
+#endif
+}
+
+DuerApp::~DuerApp() {
+    delete _recorder_listener;
+    delete _on_event;
+}
+
+void DuerApp::start() {
+    Scheduler::instance().start();
+
+    s_button.fall(this, &DuerApp::button_fall_handle);
+    s_button.rise(this, &DuerApp::button_rise_handle);
+#if defined(TARGET_UNO_91H)
+    s_pause_button.fall(this, &DuerApp::pause_button_fall_handle);
+#endif
+}
+
+void DuerApp::stop() {
+    s_button.fall(NULL);
+    s_button.rise(NULL);
+#if defined(TARGET_UNO_91H)
+    s_pause_button.fall(NULL);
+#endif
+    Scheduler::instance().stop();
+}
+
+void DuerApp::restart() {
+    if (_delay < RECONN_DELAY_MAX) {
+        _timer.start(_delay);
+        _delay <<= 1;
+    } else {
+        MediaManager::instance().play_local(BAIDU_DEV_DISCONNECTED_PROMPT_FILE);
+    }
+}
+
+void DuerApp::talk_start() {
+    MediaManager::instance().stop();
+    Scheduler::instance().clear_content();
+    _recorder.start();
+}
+
+void DuerApp::talk_stop() {
+    _recorder.stop();
+}
+
+void DuerApp::set_color(Color c) {
+#if !defined(TARGET_UNO_91H)
+    _indicate = c;
+#endif
+
+    if (c == CYAN) {
+        _delay = RECONN_DELAY_MIN;
+#if defined(TEST_BOARD)
+        _send_ticker.start(60 * 1000);//update interval to 1min
+#endif
+    } else if (c == PURPLE) {
+#if defined(TEST_BOARD)
+        _send_ticker.stop();
+#endif
+    }
+}
+
+void DuerApp::button_fall_handle() {
+    event_trigger(EVT_KEY_REC_PRESS);
+}
+
+void DuerApp::button_rise_handle() {
+    event_trigger(EVT_KEY_REC_RELEASE);
+}
+
+void DuerApp::pause_button_fall_handle() {
+    event_trigger(EVT_KEY_PAUSE);
+}
+
+void DuerApp::pause_play() {
+    MediaManager::instance().pause_or_resume();
+}
+
+#if defined(TEST_BOARD)
+void DuerApp::send_timestamp() {
+    Object data;
+    data.putInt("time", us_ticker_read());
+    Scheduler::instance().report(data);
+}
+#endif
+
+} // namespace duer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/duer_app.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,74 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+
+#ifndef BAIDU_IOT_TINYDU_DEMO_DUER_APP_H
+#define BAIDU_IOT_TINYDU_DEMO_DUER_APP_H
+
+#include "baidu_recorder_manager.h"
+#include "baidu_ca_scheduler.h"
+
+namespace duer {
+
+class DuerApp {
+public:
+    enum Color {
+        WHITE,
+        YELLOW,
+        PURPLE,
+        RED,
+        CYAN,
+        GREEN,
+        BLUE,
+        OFF
+    };
+
+    DuerApp();
+
+    ~DuerApp();
+
+    void start();
+
+    void stop();
+
+    void talk_start();
+
+    void talk_stop();
+
+    void set_color(Color c);
+
+    void restart();
+
+    int get_topic_id() const;
+
+    void pause_play();
+
+private:
+    void button_fall_handle();
+
+    void button_rise_handle();
+
+    void pause_button_fall_handle();
+
+#if defined(TEST_BOARD)
+    void send_timestamp();
+#endif
+
+    RecorderManager      _recorder;
+    Recorder::IListener* _recorder_listener;
+
+    duer::Scheduler::IOnEvent* _on_event;
+
+#if !defined(TARGET_UNO_91H)
+    mbed::BusOut                    _indicate;
+#endif
+
+    rtos::RtosTimer                 _timer;
+    unsigned int                    _delay;
+
+#if defined(TEST_BOARD)
+    rtos::RtosTimer                 _send_ticker;
+#endif
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_DEMO_DUER_APP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/events.cpp	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+#include "events.h"
+#include "mbed.h"
+#include "mbed_stats.h"
+
+namespace duer {
+
+#ifdef MBED_HEAP_STATS_ENABLED
+void memory_statistics(const char* tag) {
+    if (tag == NULL) {
+        tag = "main";
+    }
+
+    mbed_stats_heap_t current;
+    mbed_stats_heap_get(&current);
+    printf("[%s] !!!MEMORY!!! current_size: %d, max_size: %d, total_size: %d, alloc_cnt: %d, "
+        "alloc_fail_cnt: %d\n", tag, current.current_size, current.max_size, current.total_size,
+        current.alloc_cnt, current.alloc_fail_cnt);
+}
+#endif
+
+static rtos::Queue<int, 5> g_message_q;
+static event_handle_func   g_events_handler[EVT_TOTAL];
+
+void event_set_handler(uint32_t evt_id, event_handle_func handler) {
+    if (evt_id < EVT_TOTAL) {
+        g_events_handler[evt_id] = handler;
+    }
+}
+
+void event_trigger(uint32_t evt_id) {
+    g_message_q.put((int*)evt_id);
+}
+
+static void event_loop_run() {
+    osEvent evt;
+
+    do {
+        evt = g_message_q.get();
+
+        if (evt.status != osEventMessage) {
+            continue;
+        }
+
+        uint32_t evt_id = evt.value.v;
+
+        if (evt_id < EVT_TOTAL) {
+            g_events_handler[evt_id]();
+        }
+    } while (true);
+}
+
+void event_loop() {
+#ifdef __BAIDU_EVENT_SINGLE_TASK__
+    Thread th(osPriorityHigh);
+    th.start(event_loop_run);
+    Thread::wait(osWaitForever);
+#else
+    event_loop_run();
+#endif
+}
+
+} // namespace duer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/events.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,39 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+
+#ifndef BAIDU_IOT_TINYDU_DEMO_EVENTS_H
+#define BAIDU_IOT_TINYDU_DEMO_EVENTS_H
+
+#include <mbed.h>
+
+namespace duer {
+
+enum Events {
+    EVT_KEY_REC_PRESS,
+    EVT_KEY_REC_RELEASE,
+    EVT_KEY_PAUSE,
+    EVT_TOTAL
+};
+
+#ifdef MBED_HEAP_STATS_ENABLED
+extern void memory_statistics(const char* tag);
+#define MEMORY_STATISTICS(...)      memory_statistics(__VA_ARGS__)
+#else
+#define MEMORY_STATISTICS(...)
+#endif
+
+typedef mbed::Callback<void ()> event_handle_func;
+
+void event_set_handler(uint32_t evt_id, event_handle_func handler);
+
+template<typename T, typename M>
+void event_set_handler(uint32_t evt_id, T* obj, M method) {
+    event_set_handler(evt_id, event_handle_func(obj, method));
+}
+
+void event_trigger(uint32_t evt_id);
+
+void event_loop();
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_DEMO_EVENTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/factory_test.cpp	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,463 @@
+#if defined(TARGET_UNO_91H)
+#include "mbed.h"
+#include "rtos.h"
+#include "console.h"
+#include "WiFiStackInterface.h"
+#include "rda_wdt_api.h"
+#include "rda_ccfg_api.h"
+#include "cmsis_os.h"
+#include "rda_wdt_api.h"
+#include "Rda58xx.h"
+
+static char* version = "**********RDA Software Version sta_V2.0_124**********";
+static int op_mode = 0;//initial ~ 0 factory test ~ 1 function ~ 2
+static char conn_flag = 0;
+static WiFiStackInterface wifi;
+extern unsigned char rda_mac_addr[6];
+extern rda58xx _rda58xx;
+
+int do_conn_state(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+#if 1
+    const char* ssid;
+    ssid = wifi.get_ssid();
+
+    if (ssid[0]) {
+        printf("CONNECTED! ssid:%s RSSI:%d db ip:%s\r\n", wifi.get_ssid(), wifi.get_rssi(),
+               wifi.get_ip_address());
+    } else {
+        printf("NOT CONNECTED!\r\n");
+    }
+
+#else
+
+    if (wifi.bss.SSID[0]) {
+        printf("CONNECTED! ssid:%s RSSI:%d db\r\n", wifi.bss.SSID, wifi.bss.SSID);
+    } else {
+        printf("NOT CONNECTED!\r\n");
+    }
+
+#endif
+    return 0;
+}
+
+int do_get_mac(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    char mac[6];
+    mbed_mac_address(mac);
+    printf("MAC address: %02x:%02x:%02x:%02x:%02x:%02x\r\n",
+           mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+
+    return 0;
+}
+
+int do_set_mac(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    char* mdata, mac[6], i;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 2) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    if (strlen(argv[1]) != 12) {
+        printf("Error MAC address len\r\n");
+        return -2;
+    }
+
+    mdata = argv[1];
+
+    for (i = 0; i < 12; i++) {
+        if (mdata[i] >= 0x41 && mdata[i] <= 0x46) { // switch 'A' to 'a'
+            mdata[i] += 0x20;
+        }
+
+        if (mdata[i] >= 0x61 && mdata[i] <= 0x66) { //switch "ab" to 0xab
+            mac[i] = mdata[i] - 0x57;
+        }
+
+        if (mdata[i] >= 0x30 && mdata[i] <= 0x39) {
+            mac[i] = mdata[i] - 0x30;
+        }
+
+        if (i % 2 == 1) {
+            mac[i / 2] = mac[i - 1] << 4 | mac[i];
+        }
+    }
+
+    if (!mac_is_valid(mac)) {
+        printf("MAC is ZERO\r\n");
+        return 0;
+    }
+
+    memcpy(rda_mac_addr, mac, 6);
+    rda5981_flash_write_mac_addr(rda_mac_addr);
+    return 0;
+}
+
+int do_get_ver(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    printf("Software Version: %s\r\n", version);
+    return 0;
+}
+
+int do_get_ver_5856(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    char ver[32] = {0};
+    rda58xx_at_status ret;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    printf("do_get_ver_5856\r\n");
+
+    while (!_rda58xx.isPowerOn()) {
+        Thread::wait(100);
+    }
+
+    ret = _rda58xx.getChipVersion(ver);
+
+    if (VACK == ret) {
+        printf("5856 Software Version: %s\r\n", ver);
+        return 0;
+    } else {
+        printf("5856 Software Version: Fail!\r\n");
+        return -1;
+    }
+}
+
+int do_factory_test_5856(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    rda58xx_at_status ret;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    printf("do_factory_test_5856\r\n");
+    ret = _rda58xx.factoryTest(FT_ENABLE);
+
+    if (VACK == ret) {
+        printf("5856 Factory Test: Succeed\r\n");
+        return 0;
+    } else {
+        printf("5856 Factory Test: Fail\r\n");
+        return -1;
+    }
+}
+
+
+int do_write_usedata(cmd_tbl_t* cmd, int argc, char* argv[]) {
+
+    int len, ret, tmp_len = 0;
+    unsigned char* buf;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 2) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    len = atoi(argv[1]);
+    buf = (unsigned char*)malloc(len);
+    memset(buf, 0, len);
+
+    do {
+        unsigned int size;
+        size = console_fifo_get(buf + tmp_len, len - tmp_len);
+        tmp_len += size;
+    } while (tmp_len < len);
+
+    ret = rda5981_flash_write_3rdparter_data(buf, len);
+
+    if (ret < 0) {
+        printf("write flash error, error %d\r\n", ret);
+    } else {
+        printf("Data write complete\r\n");
+    }
+
+    free(buf);
+    return 0;
+}
+
+int do_read_usedata(cmd_tbl_t* cmd, int argc, char* argv[]) {
+
+    int len = 0, ret = -1;
+    unsigned char* buf;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc != 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    len  = rda5981_flash_read_3rdparter_data_length();
+
+    if (len < 0) {
+        printf("No user data in flah\r\n");
+        return -1;
+    }
+
+    buf = (unsigned char*)malloc(len + 1);
+    memset(buf, 0, len + 1);
+
+    ret = rda5981_flash_read_3rdparter_data(buf, len);
+
+    if (ret < 0) {
+        printf("read flash error, error %d\r\n", ret);
+    } else {
+        printf("Data read complete, len:%d\r\n", ret);
+    }
+
+    buf[len] = 0;
+    console_puts((char*)buf);
+    printf("\n");
+    free(buf);
+    return 0;
+}
+
+int do_reset(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    printf("SOFTWARE RESET!!!!\r\n");
+    rda_wdt_softreset();
+    return 0;
+
+}
+
+int do_conn(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    char* ssid_t, *pw_t;
+    const char* ip_addr;
+    char ssid[20];
+    char pw[20];
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (conn_flag == 1) {
+        printf("error! Has been connected!");
+        return -1;
+    }
+
+    printf("OK, start connect\r\n");
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    memset(ssid, 0, sizeof(ssid));
+    memset(pw, 0, sizeof(pw));
+
+    if (argc > 1) {
+        memcpy(ssid, argv[1], strlen(argv[1]));
+    }
+
+    if (argc > 2) {
+        memcpy(pw, argv[2], strlen(argv[2]));
+    }
+
+    if (strlen(ssid) != 0) {
+        ssid_t = ssid;
+    } else {
+        ssid_t = NULL;
+    }
+
+    if (strlen(pw) != 0) {
+        pw_t = pw;
+    } else {
+        pw_t = NULL;
+    }
+
+    printf("ssid %s pw %s\r\n", ssid_t, pw_t);
+
+    wifi.connect(ssid_t, pw_t, NSAPI_SECURITY_NONE);
+
+    while (!wifi.get_ip_address());
+
+    ip_addr = wifi.get_ip_address();
+
+    if (ip_addr) {
+        printf("Client IP Address is %s\r\n", ip_addr);
+    } else {
+        printf("No Client IP Address\r\n");
+    }
+
+    conn_flag = 1;
+    //rda5981_flash_write_smartconfig_data();
+    return 0;
+}
+
+int do_disconn(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 1) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    if (conn_flag == 0) {
+        printf("Not connectted!\r\n");
+        return 0;
+    }
+
+    wifi.disconnect();
+
+    while (wifi.get_ip_address() != NULL) {
+        Thread::wait(20);
+    }
+
+    conn_flag = 0;
+    //printf("OK, Disconnect successful\r\n");
+    return 0;
+}
+
+int do_set_baud(cmd_tbl_t* cmd, int argc, char* argv[]) {
+    unsigned int baudrate;
+
+    if (op_mode != 1) {
+        return 0;
+    }
+
+    if (argc < 2) {
+        show_cmd_usage(cmd);
+        return -1;
+    }
+
+    printf("OK, do set baud\r\n");
+    baudrate = atoi(argv[1]);
+    console_set_baudrate(baudrate);
+
+    return 0;
+}
+
+void add_cmd() {
+    int i;
+    cmd_tbl_t cmd_list[] = {
+        {
+            "reset",      1,   do_reset,
+            "reset        - Software Reset\n"
+        },
+        {
+            "conn",       3,   do_conn,
+            "conn         - start connect\n"
+        },
+        {
+            "setbaud",    2,   do_set_baud,
+            "setbaud      - set serial baudrate\n"
+        },
+        {
+            "connstate",  1,   do_conn_state,
+            "connstate    - get conn state\n"
+        },
+        {
+            "setmac",     2,   do_set_mac,
+            "setmac       - set mac address\n"
+        },
+        {
+            "getmac",     1,   do_get_mac,
+            "getmac       - get mac address\n"
+        },
+        {
+            "getver",     1,   do_get_ver,
+            "getver       - get version\n"
+        },
+        {
+            "getver5856", 1,   do_get_ver_5856,
+            "getver5856   - get 5856 version\n"
+        },
+        {
+            "ftest5856",  1,   do_factory_test_5856,
+            "ftest5856    - 5856 factory test\n"
+        },
+        {
+            "disconn",    1,   do_disconn,
+            "disconn      - start disconnect\n"
+        },
+        {
+            "wuserdata",  2,   do_write_usedata,
+            "wusedate     - write user data\n"
+        },
+        {
+            "ruserdata",  1,   do_read_usedata,
+            "ruserdate     - read user data\n"
+        },
+    };
+    i = sizeof(cmd_list) / sizeof(cmd_tbl_t);
+
+    while (i--) {
+        if (0 != console_cmd_add(&cmd_list[i])) {
+            printf("Add cmd failed\r\n");
+        }
+    }
+}
+
+int factory_test() {
+    unsigned int flag = (*((volatile unsigned int*)(0x40001024UL)));
+
+    //printf("flag = %x\r\n", flag);
+    if ((flag & (0x01UL << 29)) == 0) {
+        return 0;
+    }
+
+    op_mode = 1;
+    console_init();
+    add_cmd();
+
+    while (1);
+
+    //return 0;
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/factory_test.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,8 @@
+#if defined(TARGET_UNO_91H)
+#ifndef _FACTORY_TEST_H_
+#define _FACTORY_TEST_H_
+
+extern int factory_test();
+
+#endif // _FACTORY_TEST_H_
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/main.cpp	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,122 @@
+// Copyright (2016) Baidu Inc. All rights reserved.
+/**
+ * File: main.cpp
+ * Desc: Sample code for startup DuerOS
+ */
+
+#include "mbed.h"
+#include "baidu_media_manager.h"
+#include "duer_app.h"
+#include "events.h"
+#include "duer_log.h"
+#if defined(TARGET_UNO_91H)
+#include "SDMMCFileSystem.h"
+#include "WiFiStackInterface.h"
+#include "factory_test.h"
+#include "gpadckey.h"
+#ifdef RDA_SMART_CONFIG
+#include "rda5981_smartconfig.h"
+#endif // RDA_SMART_CONFIG
+#elif defined(TARGET_K64F)
+#include "SDFileSystem.h"
+#include "EthernetInterface.h"
+#else
+#error "Not supported"
+#endif // TARGET_UNO_91H
+
+#if defined(TARGET_UNO_91H)
+
+// TODO: Configure your AP
+#ifndef CUSTOM_SSID
+#define CUSTOM_SSID         ("TP-LINK_69DA")
+#endif // CUSTOM_SSID
+
+#ifndef CUSTOM_PASSWD
+#define CUSTOM_PASSWD       ("qwertyuiop")
+#endif // CUSTOM_PASSWD
+
+GpadcKey key_up(KEY_A3);
+GpadcKey key_down(KEY_A4);
+
+// Initialize SD card
+SDMMCFileSystem g_sd(GPIO_PIN9, GPIO_PIN0, GPIO_PIN3, GPIO_PIN7, GPIO_PIN12, GPIO_PIN13, "sd");
+
+static WiFiStackInterface s_net_stack;
+#else
+SDFileSystem g_sd = SDFileSystem(D11, D12, D13, D10, "sd");
+static EthernetInterface s_net_stack;
+#endif // TARGET_UNO_91H
+
+static unsigned char s_volume = 8;
+
+void* baidu_get_netstack_instance(void) {
+    return (void*)&s_net_stack;
+}
+
+void voice_up() {
+    if (s_volume < 15) {
+        duer::MediaManager::instance().set_volume(++s_volume);
+    }
+}
+
+void voice_down() {
+    if (s_volume > 0) {
+        duer::MediaManager::instance().set_volume(--s_volume);
+    }
+}
+
+// main() runs in its own thread in the OS
+int main() {
+#if defined(TARGET_UNO_91H)
+    // Initialize RDA FLASH
+    const unsigned int RDA_FLASH_SIZE     = 0x400000;   // Flash Size
+    const unsigned int RDA_SYS_DATA_ADDR  = 0x18204000; // System Data Area, fixed size 4KB
+    const unsigned int RDA_USER_DATA_ADDR = 0x18205000; // User Data Area start address
+    const unsigned int RDA_USER_DATA_LENG = 0x3000;     // User Data Area Length
+
+    rda5981_set_flash_size(RDA_FLASH_SIZE);
+    rda5981_set_user_data_addr(RDA_SYS_DATA_ADDR, RDA_USER_DATA_ADDR, RDA_USER_DATA_LENG);
+
+    // Test added by RDA
+    factory_test();
+#endif
+
+    DUER_LOGI("\nEntry Tinydu Main>>>>\n");
+
+    duer::MediaManager::instance().initialize();
+
+#if defined(TARGET_UNO_91H)
+    key_up.fall(&voice_up);
+    key_down.fall(&voice_down);
+#endif
+
+    // Brings up the network interface
+#ifdef RDA_SMART_CONFIG
+    typedef void (*dummy_func)();
+    mbed::GpadcKey key_erase = mbed::GpadcKey(KEY_A2);
+    key_erase.fall((dummy_func)rda5981_flash_erase_smartconfig_data);
+
+    if (s_net_stack.connect(NULL, NULL, NSAPI_SECURITY_NONE) == 0) {
+#elif defined(TARGET_UNO_91H)
+    if (s_net_stack.connect(CUSTOM_SSID, CUSTOM_PASSWD, NSAPI_SECURITY_NONE) == 0) {
+#else
+    if (s_net_stack.connect() == 0) {
+#endif // RDA_SMART_CONFIG
+        const char* ip = s_net_stack.get_ip_address();
+        const char* mac = s_net_stack.get_mac_address();
+        DUER_LOGI("IP address is: %s", ip ? ip : "No IP");
+        DUER_LOGI("MAC address is: %s", mac ? mac : "No MAC");
+    } else {
+        DUER_LOGE("Network initial failed....");
+        Thread::wait(osWaitForever);
+    }
+
+    duer::SocketAdapter::set_network_interface(&s_net_stack);
+
+    duer::MediaManager::instance().set_volume(s_volume);
+
+    duer::DuerApp app;
+    app.start();
+
+    duer::event_loop();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/demo/mbed_app.json	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,11 @@
+{
+    "target_overrides": {
+        "UNO_91H": {
+            "target.features_add": ["LWIP", "SDCARD", "GPADCKEY", "CONSOLE"],
+	    "target.macros_add": ["BD_FEATURE_NET_STACK_USING_WIFI", "BD_FEATURE_HTTPCLIENT_USING_WIFI"]
+        },
+        "k64f": {
+            "target.features_add": ["LWIP"]
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/boards/TARGET_RDA/package_scanner.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,15 @@
+#pragma once
+#include "package_info.h"
+
+class PackageScanner
+{
+public:
+    PackageScanner();
+    ~PackageScanner();
+    int scan();
+    int getOSInfo(os_info_t& info);
+    int getAppInfo(app_info_t*& info);
+private:
+	  os_info_t os_info;
+    app_info_t *apps; //app info kept in an array which ends with null pointer
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/boards/TARGET_RDA/rda_ota_updater.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,33 @@
+/*
+ * ota_updater.h
+ *
+ *  Created on: 2017-2-28
+ *      Author: duanlian01
+ */
+
+#ifndef RDA_OTA_UPDATER_H_
+#define RDA_OTA_UPDATER_H_
+#include "IOtaUpdater.h"
+#define OTA_IMAGE_BAD_SIZE  1
+#define OTA_UPDATE_CRC_FAIL 2
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct rda_ota_update_context{
+	    void *address;
+	    struct module_info info;
+};
+int rda_notify_data_begin();
+int rda_notify_meta_data(void *cxt, struct package_meta_data *meta);
+int rda_notify_module_data(void *cxt, unsigned int offset, unsigned char *data, unsigned int size);
+int rda_notify_data_end();
+
+void rda_ota_restart();
+
+int rda_ota_update_image_begin();
+int rda_ota_update_image();
+int rda_ota_update_image_end();
+#ifdef __cplusplus
+}
+#endif
+#endif /* RDA_OTA_UPDATER_H_ */
Binary file DuerOS-Light-SDK-v1.1.0/duer-os-light/duer-os.ar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mp3common.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,123 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+/**************************************************************************************
+ * Fixed-point MP3 decoder
+ * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
+ * June 2003
+ *
+ * mp3common.h - implementation-independent API's, datatypes, and definitions
+ **************************************************************************************/
+
+#ifndef _MP3COMMON_H
+#define _MP3COMMON_H
+
+#include "mp3dec.h"
+#include "statname.h"	/* do name-mangling for static linking */
+
+#define MAX_SCFBD		4		/* max scalefactor bands per channel */
+#define NGRANS_MPEG1	2
+#define NGRANS_MPEG2	1
+
+/* 11-bit syncword if MPEG 2.5 extensions are enabled */
+#define	SYNCWORDH		0xff
+#define	SYNCWORDL		0xe0
+
+/* 12-bit syncword if MPEG 1,2 only are supported 
+ * #define	SYNCWORDH		0xff
+ * #define	SYNCWORDL		0xf0
+ */
+
+typedef struct _MP3DecInfo {
+	/* pointers to platform-specific data structures */
+	void *FrameHeaderPS;
+	void *SideInfoPS;
+	void *ScaleFactorInfoPS;
+	void *HuffmanInfoPS;
+	void *DequantInfoPS;
+	void *IMDCTInfoPS;
+	void *SubbandInfoPS;
+
+	/* buffer which must be large enough to hold largest possible main_data section */
+	unsigned char mainBuf[MAINBUF_SIZE];
+
+	/* special info for "free" bitrate files */
+	int freeBitrateFlag;
+	int freeBitrateSlots;
+
+	/* user-accessible info */
+	int bitrate;
+	int nChans;
+	int samprate;
+	int nGrans;				/* granules per frame */
+	int nGranSamps;			/* samples per granule */
+	int nSlots;
+	int layer;
+	MPEGVersion version;
+
+	int mainDataBegin;
+	int mainDataBytes;
+
+	int part23Length[MAX_NGRAN][MAX_NCHAN];
+
+} MP3DecInfo;
+
+typedef struct _SFBandTable {
+	short l[23];
+	short s[14];
+} SFBandTable;
+
+/* decoder functions which must be implemented for each platform */
+MP3DecInfo *AllocateBuffers(void);
+void FreeBuffers(MP3DecInfo *mp3DecInfo);
+int CheckPadBit(MP3DecInfo *mp3DecInfo);
+int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, unsigned char *buf);
+int UnpackSideInfo(MP3DecInfo *mp3DecInfo, unsigned char *buf);
+int DecodeHuffman(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch);
+int Dequantize(MP3DecInfo *mp3DecInfo, int gr);
+int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch);
+int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch);
+int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf);
+
+/* mp3tabs.c - global ROM tables */
+extern const int samplerateTab[3][3];
+extern const short bitrateTab[3][3][15];
+extern const short samplesPerFrameTab[3][3];
+extern const short bitsPerSlotTab[3];
+extern const short sideBytesTab[3][2];
+extern const short slotTab[3][3][15];
+extern const SFBandTable sfBandTable[3][3];
+
+#endif	/* _MP3COMMON_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mp3dec.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,135 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+/**************************************************************************************
+ * Fixed-point MP3 decoder
+ * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
+ * June 2003
+ *
+ * mp3dec.h - public C API for MP3 decoder
+ **************************************************************************************/
+
+#ifndef _MP3DEC_H
+#define _MP3DEC_H
+
+#define RDA5991H
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+#
+#elif defined(_WIN32) && defined(_WIN32_WCE) && defined(ARM)
+#
+#elif defined(_WIN32) && defined(WINCE_EMULATOR)
+#
+#elif defined(ARM_ADS)
+#
+#elif defined(_SYMBIAN) && defined(__WINS__)	/* Symbian emulator for Ix86 */
+#
+#elif defined(__GNUC__) && defined(ARM)
+#
+#elif defined(__GNUC__) && defined(__i386__)
+#
+#elif defined(_OPENWAVE_SIMULATOR) || defined(_OPENWAVE_ARMULATOR)
+#
+#elif defined(RDA5991H)
+#else
+#error No platform defined. See valid options in mp3dec.h
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* determining MAINBUF_SIZE:
+ *   max mainDataBegin = (2^9 - 1) bytes (since 9-bit offset) = 511
+ *   max nSlots (concatenated with mainDataBegin bytes from before) = 1440 - 9 - 4 + 1 = 1428
+ *   511 + 1428 = 1939, round up to 1940 (4-byte align)
+ */
+#define MAINBUF_SIZE	1940
+
+#define MAX_NGRAN		2		/* max granules */
+#define MAX_NCHAN		2		/* max channels */
+#define MAX_NSAMP		576		/* max samples per channel, per granule */
+
+/* map to 0,1,2 to make table indexing easier */
+typedef enum {
+	MPEG1 =  0,
+	MPEG2 =  1,
+	MPEG25 = 2
+} MPEGVersion;
+
+typedef void *HMP3Decoder;
+
+enum {
+	ERR_MP3_NONE =                  0,
+	ERR_MP3_INDATA_UNDERFLOW =     -1,
+	ERR_MP3_MAINDATA_UNDERFLOW =   -2,
+	ERR_MP3_FREE_BITRATE_SYNC =    -3,
+	ERR_MP3_OUT_OF_MEMORY =	       -4,
+	ERR_MP3_NULL_POINTER =         -5,
+	ERR_MP3_INVALID_FRAMEHEADER =  -6,
+	ERR_MP3_INVALID_SIDEINFO =     -7,
+	ERR_MP3_INVALID_SCALEFACT =    -8,
+	ERR_MP3_INVALID_HUFFCODES =    -9,
+	ERR_MP3_INVALID_DEQUANTIZE =   -10,
+	ERR_MP3_INVALID_IMDCT =        -11,
+	ERR_MP3_INVALID_SUBBAND =      -12,
+
+	ERR_UNKNOWN =                  -9999
+};
+
+typedef struct _MP3FrameInfo {
+	int bitrate;
+	int nChans;
+	int samprate;
+	int bitsPerSample;
+	int outputSamps;
+	int layer;
+	int version;
+} MP3FrameInfo;
+
+/* public API */
+HMP3Decoder MP3InitDecoder(void);
+void MP3FreeDecoder(HMP3Decoder hMP3Decoder);
+int MP3Decode(HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize);
+
+void MP3GetLastFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo);
+int MP3GetNextFrameInfo(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo, unsigned char *buf);
+int MP3FindSyncWord(unsigned char *buf, int nBytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _MP3DEC_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mpadecobjfixpt.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+#ifndef _MPADECOBJFIXPT_H_
+#define _MPADECOBJFIXPT_H_
+
+#include "mp3dec.h"		/* public C API for new MP3 decoder */
+
+class CMpaDecObj
+{
+public:
+    CMpaDecObj();
+    ~CMpaDecObj();
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Function:    Init_n
+    // Purpose:     Initialize the mp3 decoder.
+    // Parameters:  pSync       a pointer to a syncword
+    //              ulSize      the size of the buffer pSync points to
+    //              bUseSize    this tells the decoder to use the input frame
+    //                          size on the decode instead of calculating
+    //                          the frame size.  This is necessary when
+    //                          our formatted mp3 data (main_data_begin always
+    //                          equal to 0).
+    //
+    // Returns:     returns 1 on success, 0 on failure
+    ///////////////////////////////////////////////////////////////////////////
+    int     Init_n(unsigned char *pSync,
+                   unsigned long ulSize,
+                   unsigned char bUseSize=0);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Function:    DecodeFrame_v
+    // Purpose:     Decodes one mp3 frame
+    // Parameters:  pSource     pointer to an mp3 frame (at a syncword)
+    //              pulSize     size of the buffer pSource points to.  It will
+    //                          contain the number of mp3 bytes decoded upon
+    //                          return.
+    //              pPCM        pointer to a buffer to decode into
+    //              pulPCMSize  size of the PCM buffer.  It will contain the
+    //                          number of PCM bytes prodced upon return.
+    ///////////////////////////////////////////////////////////////////////////
+    void    DecodeFrame_v(unsigned char *pSource,
+              	          unsigned long *pulSize,
+                   	      unsigned char *pPCM,
+                       	  unsigned long *pulPCMSize);
+
+	// overloaded new version that returns error code in errCode
+    void    DecodeFrame_v(unsigned char *pSource,
+              	          unsigned long *pulSize,
+                   	      unsigned char *pPCM,
+                       	  unsigned long *pulPCMSize, 
+						  int *errCode);
+
+    void    GetPCMInfo_v(unsigned long &ulSampRate,
+                         int &nChannels,
+                         int &nBitsPerSample);
+
+	// return number of samples per frame, PER CHANNEL (renderer multiplies this result by nChannels)
+    int     GetSamplesPerFrame_n();
+
+    void    SetTrustPackets(unsigned char bTrust) { m_bTrustPackets = bTrust; }
+
+private:
+	void *              m_pDec;		// generic void ptr
+
+	void *				m_pDecL1;	// not implemented (could use old Xing mpadecl1.cpp)
+	void *				m_pDecL2;	// not implemented (could use old Xing mpadecl2.cpp)
+	HMP3Decoder			m_pDecL3;
+
+	MP3FrameInfo		m_lastMP3FrameInfo;
+	unsigned char		m_bUseFrameSize;
+        unsigned char           m_bTrustPackets;
+};
+
+#endif	/* _MPADECOBJFIXPT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/statname.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,88 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+/**************************************************************************************
+ * Fixed-point MP3 decoder
+ * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
+ * June 2003
+ *
+ * statname.h - name mangling macros for static linking
+ **************************************************************************************/
+
+#ifndef _STATNAME_H
+#define _STATNAME_H
+
+/* define STAT_PREFIX to a unique name for static linking 
+ * all the C functions and global variables will be mangled by the preprocessor
+ *   e.g. void FFT(int *fftbuf) becomes void cook_FFT(int *fftbuf)
+ */
+#define STAT_PREFIX		xmp3
+
+#define STATCC1(x,y,z)	STATCC2(x,y,z)
+#define STATCC2(x,y,z)	x##y##z  
+
+#ifdef STAT_PREFIX
+#define STATNAME(func)	STATCC1(STAT_PREFIX, _, func)
+#else
+#define STATNAME(func)	func
+#endif
+
+/* these symbols are common to all implementations */
+#define	CheckPadBit			STATNAME(CheckPadBit)
+#define	UnpackFrameHeader	STATNAME(UnpackFrameHeader)
+#define	UnpackSideInfo		STATNAME(UnpackSideInfo)
+#define	AllocateBuffers		STATNAME(AllocateBuffers)
+#define	FreeBuffers			STATNAME(FreeBuffers)
+#define	DecodeHuffman		STATNAME(DecodeHuffman)
+#define	Dequantize			STATNAME(Dequantize)
+#define	IMDCT				STATNAME(IMDCT)
+#define	UnpackScaleFactors	STATNAME(UnpackScaleFactors)
+#define	Subband				STATNAME(Subband)
+
+#define	samplerateTab		STATNAME(samplerateTab)
+#define	bitrateTab			STATNAME(bitrateTab)
+#define	samplesPerFrameTab	STATNAME(samplesPerFrameTab)
+#define	bitsPerSlotTab		STATNAME(bitsPerSlotTab)
+#define	sideBytesTab		STATNAME(sideBytesTab)
+#define	slotTab				STATNAME(slotTab)
+#define	sfBandTable			STATNAME(sfBandTable)
+
+/* in your implementation's top-level include file (e.g. real\coder.h) you should
+ *   add new #define sym STATNAME(sym) lines for all the
+ *   additional global functions or variables which your
+ *   implementation uses
+ */
+
+#endif /* _STATNAME_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/real/assembly.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,174 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+/**************************************************************************************
+ * Fixed-point MP3 decoder
+ * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
+ * June 2003
+ *
+ * assembly.h - assembly language functions and prototypes for supported platforms
+ *
+ * - inline rountines with access to 64-bit multiply results 
+ * - x86 (_WIN32) and ARM (ARM_ADS, _WIN32_WCE) versions included
+ * - some inline functions are mix of asm and C for speed
+ * - some functions are in native asm files, so only the prototype is given here
+ *
+ * MULSHIFT32(x, y)    signed multiply of two 32-bit integers (x and y), returns top 32 bits of 64-bit result
+ * FASTABS(x)          branchless absolute value of signed integer x
+ * CLZ(x)              count leading zeros in x
+ * MADD64(sum, x, y)   (Windows only) sum [64-bit] += x [32-bit] * y [32-bit]
+ * SHL64(sum, x, y)    (Windows only) 64-bit left shift using __int64
+ * SAR64(sum, x, y)    (Windows only) 64-bit right shift using __int64
+ */
+
+#ifndef _ASSEMBLY_H
+#define _ASSEMBLY_H
+
+#include <stdint.h> 
+
+#define RDA5991H
+
+#if defined(RDA5991H)
+
+#if defined(__ICCARM__)
+#define __inline __INLINE
+#endif
+
+#if 1
+static __inline int FASTABS(int x)
+{
+  return((x > 0) ? x : -(x));
+}
+#endif
+
+#if 0
+static __inline int CLZ(int x)
+{
+  return __CLZ(x);
+}
+#endif
+
+#if 0
+static __inline int CLZ(int x)
+{
+	int numZeros;
+
+	if (!x)
+		return (sizeof(int) * 8);
+
+	numZeros = 0;
+	while (!(x & 0x80000000)) {
+		numZeros++;
+		x <<= 1;
+	} 
+
+	return numZeros;
+}
+#endif
+
+#if 1
+static __inline int CLZ(int x)
+{
+	int numZeros;
+		
+	if (!x)
+		return (sizeof(int) * 8);
+	
+	__asm{
+		CLZ numZeros, x
+	}
+
+	return numZeros;
+}
+#endif
+
+#if 1
+static __inline int64_t SAR64(int64_t x, int n)
+{
+  return (x >> n);
+}
+#endif
+
+#if 1
+static __inline int MULSHIFT32(int x, int y)
+{
+  int64_t tmp;
+
+  tmp = ((int64_t)x * (int64_t)y);
+  return (tmp>>32);
+}
+#endif
+
+#if 0
+static int __inline MULSHIFT32(int x, int y)
+{
+	int tmp;
+	
+	__asm{
+		SMULL tmp, y, x, y
+	}
+
+	return y;
+}
+#endif
+
+#if 1
+static __inline int64_t MADD64(int64_t sum64, int x, int y)
+{
+  return (sum64 + (int64_t)x * (int64_t)y);
+}
+#endif
+
+#if 0
+static __inline int64_t MADD64(int64_t sum64, int x, int y)
+{
+	unsigned int sum64Lo = ((unsigned int *)&sum64)[0];
+	int sum64Hi = ((int *)&sum64)[1];
+	
+	__asm{
+		SMLAL sum64Lo, sum64Hi, x, y
+	}
+
+	sum64 = (((int64_t) sum64Hi) << 32) | sum64Lo;
+	
+	return sum64;
+}
+#endif
+
+#else
+#error No assembly defined. See valid options in assembly.h
+#endif /** RDA5991H */
+
+#endif /* _ASSEMBLY_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/real/coder.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,303 @@
+/* ***** BEGIN LICENSE BLOCK ***** 
+ * Version: RCSL 1.0/RPSL 1.0 
+ *  
+ * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
+ *      
+ * The contents of this file, and the files included with this file, are 
+ * subject to the current version of the RealNetworks Public Source License 
+ * Version 1.0 (the "RPSL") available at 
+ * http://www.helixcommunity.org/content/rpsl unless you have licensed 
+ * the file under the RealNetworks Community Source License Version 1.0 
+ * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
+ * in which case the RCSL will apply. You may also obtain the license terms 
+ * directly from RealNetworks.  You may not use this file except in 
+ * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
+ * applicable to this file, the RCSL.  Please see the applicable RPSL or 
+ * RCSL for the rights, obligations and limitations governing use of the 
+ * contents of the file.  
+ *  
+ * This file is part of the Helix DNA Technology. RealNetworks is the 
+ * developer of the Original Code and owns the copyrights in the portions 
+ * it created. 
+ *  
+ * This file, and the files included with this file, is distributed and made 
+ * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
+ * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
+ * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
+ * 
+ * Technology Compatibility Kit Test Suite(s) Location: 
+ *    http://www.helixcommunity.org/content/tck 
+ * 
+ * Contributor(s): 
+ *  
+ * ***** END LICENSE BLOCK ***** */ 
+
+/**************************************************************************************
+ * Fixed-point MP3 decoder
+ * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
+ * June 2003
+ *
+ * coder.h - private, implementation-specific header file
+ **************************************************************************************/
+
+#ifndef _CODER_H
+#define _CODER_H
+
+#include "mp3common.h"
+
+#if defined(_WIN32) && defined(_M_IX86) && (defined (_DEBUG) || defined (REL_ENABLE_ASSERTS))
+#define ASSERT(x) if (!(x)) __asm int 3;
+#else
+#define ASSERT(x) /* do nothing */
+#endif
+
+#ifndef MAX
+#define MAX(a,b)	((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b)	((a) < (b) ? (a) : (b))
+#endif
+
+/* clip to range [-2^n, 2^n - 1] */
+#define CLIP_2N(y, n) { \
+	int sign = (y) >> 31;  \
+	if (sign != (y) >> (n))  { \
+		(y) = sign ^ ((1 << (n)) - 1); \
+	} \
+}
+
+#define SIBYTES_MPEG1_MONO		17
+#define SIBYTES_MPEG1_STEREO	32
+#define SIBYTES_MPEG2_MONO		 9
+#define SIBYTES_MPEG2_STEREO	17
+
+/* number of fraction bits for pow43Tab (see comments there) */
+#define POW43_FRACBITS_LOW		22
+#define POW43_FRACBITS_HIGH		12
+
+#define DQ_FRACBITS_OUT			25	/* number of fraction bits in output of dequant */
+#define	IMDCT_SCALE				2	/* additional scaling (by sqrt(2)) for fast IMDCT36 */
+
+#define	HUFF_PAIRTABS			32
+#define BLOCK_SIZE				18
+#define	NBANDS					32
+#define MAX_REORDER_SAMPS		((192-126)*3)		/* largest critical band for short blocks (see sfBandTable) */
+#define VBUF_LENGTH				(17 * 2 * NBANDS)	/* for double-sized vbuf FIFO */
+
+/* additional external symbols to name-mangle for static linking */
+#define	SetBitstreamPointer	STATNAME(SetBitstreamPointer)
+#define	GetBits				STATNAME(GetBits)
+#define	CalcBitsUsed		STATNAME(CalcBitsUsed)
+#define	DequantChannel		STATNAME(DequantChannel)
+#define	MidSideProc			STATNAME(MidSideProc)
+#define	IntensityProcMPEG1	STATNAME(IntensityProcMPEG1)
+#define	IntensityProcMPEG2	STATNAME(IntensityProcMPEG2)
+#define PolyphaseMono		STATNAME(PolyphaseMono)
+#define PolyphaseStereo		STATNAME(PolyphaseStereo)
+#define FDCT32				STATNAME(FDCT32)
+
+#define	ISFMpeg1			STATNAME(ISFMpeg1)
+#define	ISFMpeg2			STATNAME(ISFMpeg2)
+#define	ISFIIP				STATNAME(ISFIIP)
+#define uniqueIDTab			STATNAME(uniqueIDTab)
+#define	coef32				STATNAME(coef32)
+#define	polyCoef			STATNAME(polyCoef)
+#define	csa					STATNAME(csa)
+#define	imdctWin			STATNAME(imdctWin)
+
+#define	huffTable			STATNAME(huffTable)
+#define	huffTabOffset		STATNAME(huffTabOffset)
+#define	huffTabLookup		STATNAME(huffTabLookup)
+#define	quadTable			STATNAME(quadTable)
+#define	quadTabOffset		STATNAME(quadTabOffset)
+#define	quadTabMaxBits		STATNAME(quadTabMaxBits)
+
+/* map these to the corresponding 2-bit values in the frame header */
+typedef enum {
+	Stereo = 0x00,	/* two independent channels, but L and R frames might have different # of bits */
+	Joint = 0x01,	/* coupled channels - layer III: mix of M-S and intensity, Layers I/II: intensity and direct coding only */
+	Dual = 0x02,	/* two independent channels, L and R always have exactly 1/2 the total bitrate */
+	Mono = 0x03		/* one channel */
+} StereoMode;
+
+typedef struct _BitStreamInfo {
+	unsigned char *bytePtr;
+	unsigned int iCache;
+	int cachedBits;
+	int nBytes;
+} BitStreamInfo;
+
+typedef struct _FrameHeader {
+    MPEGVersion ver;	/* version ID */
+    int layer;			/* layer index (1, 2, or 3) */
+    int crc;			/* CRC flag: 0 = disabled, 1 = enabled */
+    int brIdx;			/* bitrate index (0 - 15) */
+    int srIdx;			/* sample rate index (0 - 2) */
+    int paddingBit;		/* padding flag: 0 = no padding, 1 = single pad byte */
+    int privateBit;		/* unused */
+    StereoMode sMode;	/* mono/stereo mode */
+    int modeExt;		/* used to decipher joint stereo mode */
+    int copyFlag;		/* copyright flag: 0 = no, 1 = yes */
+    int origFlag;		/* original flag: 0 = copy, 1 = original */
+    int emphasis;		/* deemphasis mode */
+    int CRCWord;		/* CRC word (16 bits, 0 if crc not enabled) */
+
+	const SFBandTable *sfBand;
+} FrameHeader;
+
+typedef struct _SideInfoSub {
+    int part23Length;		/* number of bits in main data */ 
+    int nBigvals;			/* 2x this = first set of Huffman cw's (maximum amplitude can be > 1) */
+    int globalGain;			/* overall gain for dequantizer */
+    int sfCompress;			/* unpacked to figure out number of bits in scale factors */
+    int winSwitchFlag;		/* window switching flag */
+    int blockType;			/* block type */
+    int mixedBlock;			/* 0 = regular block (all short or long), 1 = mixed block */
+    int tableSelect[3];		/* index of Huffman tables for the big values regions */
+    int subBlockGain[3];	/* subblock gain offset, relative to global gain */
+    int region0Count;		/* 1+region0Count = num scale factor bands in first region of bigvals */
+    int region1Count;		/* 1+region1Count = num scale factor bands in second region of bigvals */
+    int preFlag;			/* for optional high frequency boost */
+    int sfactScale;			/* scaling of the scalefactors */
+    int count1TableSelect;	/* index of Huffman table for quad codewords */
+} SideInfoSub;
+
+typedef struct _SideInfo {
+	int mainDataBegin;
+	int privateBits;
+	int scfsi[MAX_NCHAN][MAX_SCFBD];				/* 4 scalefactor bands per channel */
+	
+	SideInfoSub	sis[MAX_NGRAN][MAX_NCHAN];
+} SideInfo;
+
+typedef struct {
+    int cbType;		/* pure long = 0, pure short = 1, mixed = 2 */
+    int cbEndS[3];	/* number nonzero short cb's, per subbblock */
+	int cbEndSMax;	/* max of cbEndS[] */
+    int cbEndL;		/* number nonzero long cb's  */
+} CriticalBandInfo;
+
+typedef struct _DequantInfo {
+	int workBuf[MAX_REORDER_SAMPS];		/* workbuf for reordering short blocks */
+	CriticalBandInfo cbi[MAX_NCHAN];	/* filled in dequantizer, used in joint stereo reconstruction */
+} DequantInfo;
+
+typedef struct _HuffmanInfo {
+	int huffDecBuf[MAX_NCHAN][MAX_NSAMP];		/* used both for decoded Huffman values and dequantized coefficients */
+	int nonZeroBound[MAX_NCHAN];				/* number of coeffs in huffDecBuf[ch] which can be > 0 */
+	int gb[MAX_NCHAN];							/* minimum number of guard bits in huffDecBuf[ch] */
+} HuffmanInfo;
+
+typedef enum _HuffTabType {
+	noBits,
+	oneShot,
+	loopNoLinbits,
+	loopLinbits,
+	quadA,
+	quadB,
+	invalidTab
+} HuffTabType;
+
+typedef struct _HuffTabLookup {
+	int	linBits;
+	HuffTabType tabType;
+} HuffTabLookup;
+
+typedef struct _IMDCTInfo {
+	int outBuf[MAX_NCHAN][BLOCK_SIZE][NBANDS];	/* output of IMDCT */	
+	int overBuf[MAX_NCHAN][MAX_NSAMP / 2];		/* overlap-add buffer (by symmetry, only need 1/2 size) */
+	int numPrevIMDCT[MAX_NCHAN];				/* how many IMDCT's calculated in this channel on prev. granule */
+	int prevType[MAX_NCHAN];
+	int prevWinSwitch[MAX_NCHAN];
+	int gb[MAX_NCHAN];
+} IMDCTInfo;
+
+typedef struct _BlockCount {
+	int nBlocksLong;
+	int nBlocksTotal;
+	int nBlocksPrev; 
+	int prevType;
+	int prevWinSwitch;
+	int currWinSwitch;
+	int gbIn;
+	int gbOut;
+} BlockCount;
+
+/* max bits in scalefactors = 5, so use char's to save space */
+typedef struct _ScaleFactorInfoSub {
+	char l[23];            /* [band] */
+	char s[13][3];         /* [band][window] */
+} ScaleFactorInfoSub;  
+
+/* used in MPEG 2, 2.5 intensity (joint) stereo only */
+typedef struct _ScaleFactorJS {
+	int intensityScale;		
+	int	slen[4];
+	int	nr[4];
+} ScaleFactorJS;
+
+typedef struct _ScaleFactorInfo {
+	ScaleFactorInfoSub sfis[MAX_NGRAN][MAX_NCHAN];
+	ScaleFactorJS sfjs;
+} ScaleFactorInfo;
+
+/* NOTE - could get by with smaller vbuf if memory is more important than speed
+ *  (in Subband, instead of replicating each block in FDCT32 you would do a memmove on the
+ *   last 15 blocks to shift them down one, a hardware style FIFO)
+ */ 
+typedef struct _SubbandInfo {
+	int vbuf[MAX_NCHAN * VBUF_LENGTH];		/* vbuf for fast DCT-based synthesis PQMF - double size for speed (no modulo indexing) */
+	int vindex;								/* internal index for tracking position in vbuf */
+} SubbandInfo;
+
+/* bitstream.c */
+void SetBitstreamPointer(BitStreamInfo *bsi, int nBytes, unsigned char *buf);
+unsigned int GetBits(BitStreamInfo *bsi, int nBits);
+int CalcBitsUsed(BitStreamInfo *bsi, unsigned char *startBuf, int startOffset);
+
+/* dequant.c, dqchan.c, stproc.c */
+int DequantChannel(int *sampleBuf, int *workBuf, int *nonZeroBound, FrameHeader *fh, SideInfoSub *sis, 
+					ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi);
+void MidSideProc(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, int mOut[2]);
+void IntensityProcMPEG1(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, 
+						CriticalBandInfo *cbi, int midSideFlag, int mixFlag, int mOut[2]);
+void IntensityProcMPEG2(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, 
+						CriticalBandInfo *cbi, ScaleFactorJS *sfjs, int midSideFlag, int mixFlag, int mOut[2]);
+
+/* dct32.c */
+void FDCT32(int *x, int *d, int offset, int oddBlock, int gb);
+
+/* hufftabs.c */
+extern const HuffTabLookup huffTabLookup[HUFF_PAIRTABS];
+extern const int huffTabOffset[HUFF_PAIRTABS];
+extern const unsigned short huffTable[];
+extern const unsigned char quadTable[64+16];
+extern const int quadTabOffset[2];
+extern const int quadTabMaxBits[2];
+
+/* polyphase.c (or asmpoly.s)
+ * some platforms require a C++ compile of all source files,
+ * so if we're compiling C as C++ and using native assembly
+ * for these functions we need to prevent C++ name mangling.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+void PolyphaseMono(short *pcm, int *vbuf, const int *coefBase);
+void PolyphaseStereo(short *pcm, int *vbuf, const int *coefBase);
+#ifdef __cplusplus
+}
+#endif
+
+/* trigtabs.c */
+extern const int imdctWin[4][36];
+extern const int ISFMpeg1[2][7];
+extern const int ISFMpeg2[2][2][16];
+extern const int ISFIIP[2][2];
+extern const int csa[8][2];
+extern const int coef32[31];
+extern const int polyCoef[264];
+
+#endif	/* _CODER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ff.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,149 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
+**  
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+** 
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software 
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** The "appropriate copyright message" mentioned in section 2c of the GPLv2
+** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4ff.h,v 1.27 2009/01/29 00:41:08 menno Exp $
+**/
+
+#ifndef MP4FF_H
+#define MP4FF_H
+
+#include "mp4ffint.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#define HAVE_STDINT_H
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include "mp4ff_int_types.h"
+#endif
+
+#if 0
+/* file callback structure */
+typedef struct
+{
+    uint32_t (*read)(void *user_data, void *buffer, uint32_t length);
+    uint32_t (*write)(void *udata, void *buffer, uint32_t length);
+    uint32_t (*seek)(void *user_data, uint64_t position);
+	uint32_t (*truncate)(void *user_data);
+    void *user_data;
+} mp4ff_callback_t;
+
+/* mp4 main file structure */
+typedef void* mp4ff_t;
+#endif
+
+/* API */
+
+mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
+mp4ff_t *mp4ff_open_read_metaonly(mp4ff_callback_t *f);
+void mp4ff_close(mp4ff_t *f);
+int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
+int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
+
+int32_t mp4ff_read_sample(mp4ff_t *f, const int track, const int sample,
+                          unsigned char **audio_buffer,  unsigned int *bytes);
+
+int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position);
+
+int32_t rda_mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
+                          uint8_t **audio_buffer,  uint32_t *bytes);//add by bolv
+int32_t rda_mp4ff_read_sample_adts(mp4ff_t *f, const int32_t track, const int32_t sample,
+                          uint8_t **audio_buffer,  uint32_t *bytes);//add by bolv
+int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer);//returns 0 on error, number of bytes read on success, use mp4ff_read_sample_getsize() to check buffer size needed
+int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample);//returns 0 on error, buffer size needed for mp4ff_read_sample_v2() on success
+int32_t rda_mp4ff_fill_stsz_table(mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv
+int32_t rda_mp4ff_refill_stsz_table(mp4ff_t *f, const int32_t track, const int32_t sample, const int32_t numSamples);//add by bolv
+int32_t rda_mp4ff_get_sample_position_and_size(mp4ff_t *f, const int32_t track, const int32_t sample, int32_t *offset, int32_t *size);//add by bolv
+
+int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int track,
+                             unsigned char** ppBuf, unsigned int* pBufSize);
+int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track);
+int32_t mp4ff_total_tracks(const mp4ff_t *f);
+int32_t rda_mp4ff_get_aac_track(const mp4ff_t *f);//add by bolv
+int32_t mp4ff_num_samples(const mp4ff_t *f, const int track);
+int32_t mp4ff_time_scale(const mp4ff_t *f, const int track);
+
+uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track);
+uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track);
+int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown
+int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track); //returns (-1) if unknown
+uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track);
+uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track);
+uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track);
+
+
+/* metadata */
+int mp4ff_meta_get_num_items(const mp4ff_t *f);
+int mp4ff_meta_get_by_index(const mp4ff_t *f, unsigned int index,
+                            char **item, char **value);
+int mp4ff_meta_get_title(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_artist(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_writer(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_album(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_date(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_tool(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_comment(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_genre(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_track(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_totaltracks(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_totaldiscs(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
+int mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
+#ifdef USE_TAGGING
+
+/* metadata tag structure */
+typedef struct
+{
+    char *item;
+    char *value;
+} mp4ff_tag_t;
+
+/* metadata list structure */
+typedef struct
+{
+    mp4ff_tag_t *tags;
+    uint32_t count;
+} mp4ff_metadata_t;
+
+int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ff_int_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,27 @@
+#ifndef _MP4FF_INT_TYPES_H_
+#define _MP4FF_INT_TYPES_H_
+
+#if defined (_WIN32)
+
+#ifdef __MINGW32__
+#include <stdlib.h>
+#endif /* #ifdef __MINGW32__ */
+
+typedef signed char int8_t;
+typedef unsigned char uint8_t;
+typedef signed short int16_t;
+typedef unsigned short uint16_t;
+typedef signed long int32_t;
+typedef unsigned long uint32_t;
+
+typedef signed __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+
+#else
+
+#include <stdint.h>
+
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/mp4ffint.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,369 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
+**  
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+** 
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software 
+** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** The "appropriate copyright message" mentioned in section 2c of the GPLv2
+** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4ffint.h,v 1.26 2009/01/25 20:14:34 menno Exp $
+**/
+
+#ifndef MP4FF_INTERNAL_H
+#define MP4FF_INTERNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "mp4ff_int_types.h"
+#include <stdlib.h>
+
+//#define MAX_TRACKS 1024
+#define MAX_TRACKS 128  //modify by bolv
+#define TRACK_UNKNOWN 0
+#define TRACK_AUDIO   1
+#define TRACK_VIDEO   2
+#define TRACK_SYSTEM  3
+
+
+#define SUBATOMIC 128
+
+/* atoms without subatoms */
+#define ATOM_FTYP 129
+#define ATOM_MDAT 130
+#define ATOM_MVHD 131
+#define ATOM_TKHD 132
+#define ATOM_TREF 133
+#define ATOM_MDHD 134
+#define ATOM_VMHD 135
+#define ATOM_SMHD 136
+#define ATOM_HMHD 137
+#define ATOM_STSD 138
+#define ATOM_STTS 139
+#define ATOM_STSZ 140
+#define ATOM_STZ2 141
+#define ATOM_STCO 142
+#define ATOM_STSC 143
+#define ATOM_MP4A 144
+#define ATOM_MP4V 145
+#define ATOM_MP4S 146
+#define ATOM_ESDS 147
+#define ATOM_META 148 /* iTunes Metadata box */
+#define ATOM_NAME 149 /* iTunes Metadata name box */
+#define ATOM_DATA 150 /* iTunes Metadata data box */
+#define ATOM_CTTS 151
+#define ATOM_FRMA 152
+#define ATOM_IVIV 153
+#define ATOM_PRIV 154
+#define ATOM_USER 155
+#define ATOM_KEY  156
+
+#define ATOM_ALBUM_ARTIST	157
+#define ATOM_CONTENTGROUP   158
+#define ATOM_LYRICS         159
+#define ATOM_DESCRIPTION    160
+#define ATOM_NETWORK        161
+#define ATOM_SHOW           162
+#define ATOM_EPISODENAME    163
+#define ATOM_SORTTITLE      164
+#define ATOM_SORTALBUM      165
+#define ATOM_SORTARTIST     166
+#define ATOM_SORTALBUMARTIST    167
+#define ATOM_SORTWRITER     168
+#define ATOM_SORTSHOW       169
+#define ATOM_SEASON         170
+#define ATOM_EPISODE        171
+#define ATOM_PODCAST        172
+
+#define ATOM_UNKNOWN 255
+#define ATOM_FREE ATOM_UNKNOWN
+#define ATOM_SKIP ATOM_UNKNOWN
+
+/* atoms with subatoms */
+#define ATOM_MOOV 1
+#define ATOM_TRAK 2
+#define ATOM_EDTS 3
+#define ATOM_MDIA 4
+#define ATOM_MINF 5
+#define ATOM_STBL 6
+#define ATOM_UDTA 7
+#define ATOM_ILST 8 /* iTunes Metadata list */
+#define ATOM_TITLE 9
+#define ATOM_ARTIST 10
+#define ATOM_WRITER 11
+#define ATOM_ALBUM 12
+#define ATOM_DATE 13
+#define ATOM_TOOL 14
+#define ATOM_COMMENT 15
+#define ATOM_GENRE1 16
+#define ATOM_TRACK 17
+#define ATOM_DISC 18
+#define ATOM_COMPILATION 19
+#define ATOM_GENRE2 20
+#define ATOM_TEMPO 21
+#define ATOM_COVER 22
+#define ATOM_DRMS 23
+#define ATOM_SINF 24
+#define ATOM_SCHI 25
+
+#ifdef HAVE_CONFIG_H
+#include "../../config.h"   
+#endif
+
+#if !(defined(_WIN32) || defined(_WIN32_WCE))
+#define stricmp strcasecmp
+#else
+#define stricmp _stricmp
+#define strdup _strdup
+#endif
+
+/* file callback structure */
+typedef struct
+{
+    uint32_t (*read)(void *user_data, void *buffer, uint32_t length);
+    uint32_t (*write)(void *udata, void *buffer, uint32_t length);
+    uint32_t (*seek)(void *user_data, uint64_t position);
+    uint32_t (*truncate)(void *user_data);
+    void *user_data;
+} mp4ff_callback_t;
+
+
+/* metadata tag structure */
+typedef struct
+{
+    char *item;
+    char *value;
+} mp4ff_tag_t;
+
+/* metadata list structure */
+typedef struct
+{
+    mp4ff_tag_t *tags;
+    uint32_t count;
+} mp4ff_metadata_t;
+
+
+typedef struct
+{
+    int32_t type;
+    int32_t channelCount;
+    int32_t sampleSize;
+    uint16_t sampleRate;
+    int32_t audioType;
+
+    /* stsd */
+    int32_t stsd_entry_count;
+
+    /* stsz */
+    int32_t stsz_sample_size;
+    int32_t stsz_sample_count;
+    int32_t *stsz_table;
+	/*  add by bolv  */
+	int32_t stsz_table_offset;//the offset of the start of stsz_table into the file
+	/*  add by bolv  */
+
+    /* stts */
+    int32_t stts_entry_count;
+    int32_t *stts_sample_count;
+    int32_t *stts_sample_delta;
+
+    /* stsc */
+    int32_t stsc_entry_count;
+    int32_t *stsc_first_chunk;
+    int32_t *stsc_samples_per_chunk;
+    int32_t *stsc_sample_desc_index;
+
+    /* stco */
+    int32_t stco_entry_count;
+    int32_t *stco_chunk_offset;
+	/*  add by bolv  */
+	int32_t stco_current_chunk;  //Current chunk ID,the minimum is 1
+	int32_t stco_current_chunk_first_sample;
+	int32_t stco_current_chunk_samples;
+	int32_t stco_current_chunk_offset;
+	/*  add by bolv  */
+
+    /* ctts */
+    int32_t ctts_entry_count;
+    int32_t *ctts_sample_count;
+    int32_t *ctts_sample_offset;
+
+    /* esde */
+    uint8_t *decoderConfig;
+    int32_t decoderConfigLen;
+
+    uint32_t maxBitrate;
+    uint32_t avgBitrate;
+
+    uint32_t timeScale;
+    uint64_t duration;
+
+} mp4ff_track_t;
+
+/* mp4 main file structure */
+typedef struct
+{
+    /* stream to read from */
+    mp4ff_callback_t *stream;
+    int64_t current_position;
+	int64_t last_position;//add by bolv
+
+    int32_t moov_read;
+    uint64_t moov_offset;
+    uint64_t moov_size;
+    uint8_t last_atom;
+    uint64_t file_size;
+
+    /* mvhd */
+    int32_t time_scale;
+    int32_t duration;
+
+    /* incremental track index while reading the file */
+    int32_t total_tracks;
+
+    /* track data */
+    mp4ff_track_t *track[MAX_TRACKS];
+
+    /* metadata */
+    mp4ff_metadata_t tags;
+} mp4ff_t;
+
+
+
+
+/* mp4util.c */
+int32_t mp4ff_read_data(mp4ff_t *f, int8_t *data, uint32_t size);
+int32_t mp4ff_write_data(mp4ff_t *f, int8_t *data, uint32_t size);
+uint64_t mp4ff_read_int64(mp4ff_t *f);
+uint32_t mp4ff_read_int32(mp4ff_t *f);
+uint32_t mp4ff_read_int24(mp4ff_t *f);
+uint16_t mp4ff_read_int16(mp4ff_t *f);
+uint8_t mp4ff_read_char(mp4ff_t *f);
+int32_t mp4ff_write_int32(mp4ff_t *f,const uint32_t data);
+uint32_t mp4ff_read_mp4_descr_length(mp4ff_t *f);
+int64_t mp4ff_position(const mp4ff_t *f);
+int32_t mp4ff_set_position(mp4ff_t *f, const int64_t position);
+int32_t mp4ff_truncate(mp4ff_t * f);
+char * mp4ff_read_string(mp4ff_t * f,uint32_t length);
+
+/* mp4atom.c */
+static int32_t mp4ff_atom_get_size(const int8_t *data);
+static int32_t mp4ff_atom_compare(const int8_t a1, const int8_t b1, const int8_t c1, const int8_t d1,
+                                  const int8_t a2, const int8_t b2, const int8_t c2, const int8_t d2);
+static uint8_t mp4ff_atom_name_to_type(const int8_t a, const int8_t b, const int8_t c, const int8_t d);
+uint64_t mp4ff_atom_read_header(mp4ff_t *f, uint8_t *atom_type, uint8_t *header_size);
+static int32_t mp4ff_read_stsz(mp4ff_t *f);
+static int32_t rda_mp4ff_read_stsz(mp4ff_t *f);//add by bolv
+static int32_t mp4ff_read_esds(mp4ff_t *f);
+static int32_t mp4ff_read_mp4a(mp4ff_t *f);
+static int32_t mp4ff_read_stsd(mp4ff_t *f);
+static int32_t mp4ff_read_stsc(mp4ff_t *f);
+static int32_t mp4ff_read_stco(mp4ff_t *f);
+static int32_t mp4ff_read_stts(mp4ff_t *f);
+#ifdef USE_TAGGING
+static int32_t mp4ff_read_meta(mp4ff_t *f, const uint64_t size);
+#endif
+int32_t mp4ff_atom_read(mp4ff_t *f, const int32_t size, const uint8_t atom_type);
+
+/* mp4sample.c */
+static int32_t mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample,
+                                     int32_t *chunk_sample, int32_t *chunk);
+int32_t rda_mp4ff_chunk_of_sample(const mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv
+
+static int32_t mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk);
+int32_t rda_mp4ff_chunk_to_offset(const mp4ff_t *f, const int32_t track, const int32_t chunk);//add by bolv
+static int32_t mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track,
+                                       const int32_t chunk_sample, const int32_t sample);
+static int32_t rda_mp4ff_sample_range_size(const mp4ff_t *f, const int32_t track,
+                                       const int32_t chunk_sample, const int32_t sample);//add by bolv
+static int32_t mp4ff_sample_to_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t rda_mp4ff_audio_frame_size(const mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv
+int32_t mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t rda_mp4ff_set_sample_position(mp4ff_t *f, const int32_t track, const int32_t sample);//add by bolv
+int32_t rda_mp4ff_get_sample_position_and_size(mp4ff_t *f, const int32_t track, const int32_t sample, int32_t *offset, int32_t *size);//add by bolv
+
+#ifdef USE_TAGGING
+/* mp4meta.c */
+static int32_t mp4ff_tag_add_field(mp4ff_metadata_t *tags, const char *item, const char *value);
+static int32_t mp4ff_tag_set_field(mp4ff_metadata_t *tags, const char *item, const char *value);
+static int32_t mp4ff_set_metadata_name(mp4ff_t *f, const uint8_t atom_type, char **name);
+static int32_t mp4ff_parse_tag(mp4ff_t *f, const uint8_t parent_atom_type, const int32_t size);
+static int32_t mp4ff_meta_find_by_name(const mp4ff_t *f, const char *item, char **value);
+int32_t mp4ff_parse_metadata(mp4ff_t *f, const int32_t size);
+int32_t mp4ff_tag_delete(mp4ff_metadata_t *tags);
+int32_t mp4ff_meta_get_num_items(const mp4ff_t *f);
+int32_t mp4ff_meta_get_by_index(const mp4ff_t *f, uint32_t index,
+                            char **item, char **value);
+int32_t mp4ff_meta_get_title(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_artist(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_writer(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_album(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_date(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_tool(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_comment(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_genre(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_track(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_disc(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_compilation(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_tempo(const mp4ff_t *f, char **value);
+int32_t mp4ff_meta_get_coverart(const mp4ff_t *f, char **value);
+#endif
+
+/* mp4ff.c */
+mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f);
+#ifdef USE_TAGGING
+mp4ff_t *mp4ff_open_edit(mp4ff_callback_t *f);
+#endif
+void mp4ff_close(mp4ff_t *ff);
+//void mp4ff_track_add(mp4ff_t *f);
+int32_t parse_sub_atoms(mp4ff_t *f, const uint64_t total_size,int meta_only);
+int32_t parse_atoms(mp4ff_t *f,int meta_only);
+
+int32_t mp4ff_get_sample_duration(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int64_t mp4ff_get_sample_position(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_get_sample_offset(const mp4ff_t *f, const int32_t track, const int32_t sample);
+int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip);
+
+int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
+                          uint8_t **audio_buffer,  uint32_t *bytes);
+int32_t rda_mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
+                          uint8_t **audio_buffer,  uint32_t *bytes);//add by bolv
+int32_t rda_mp4ff_read_sample_adts(mp4ff_t *f, const int32_t track, const int32_t sample,
+                          uint8_t **audio_buffer,  uint32_t *bytes);//add by bolv
+int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track,
+                                 uint8_t** ppBuf, uint32_t* pBufSize);
+int32_t mp4ff_total_tracks(const mp4ff_t *f);
+int32_t rda_mp4ff_get_aac_track(const mp4ff_t *f);//add by bolv
+int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track);
+int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track);
+
+uint32_t mp4ff_meta_genre_to_index(const char * genrestr);//returns 1-based index, 0 if not found
+const char * mp4ff_meta_index_to_genre(uint32_t idx);//returns pointer to static string
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/rda_log.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,20 @@
+#ifndef RDA_LOG_H
+#define RDA_LOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdio.h>
+
+#ifdef M4A_DEBUG
+#define M4ALOG(fmt, ...)   printf(fmt, ##__VA_ARGS__)
+#else
+#define M4ALOG(fmt, ...)
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp4ff/rda_mp4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,230 @@
+#ifndef RDA_MP4_H
+#define RDA_MP4_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "mp4ff_int_types.h"
+#include <stdlib.h>
+#include "rda_log.h"
+
+#define INLINE 			__inline
+//#define NULL            ((void *) 0)
+
+#define SBR_DEC
+//#define PS_DEC
+
+#define MAIN       1
+#define LC         2
+#define SSR        3
+#define LTP        4
+#define HE_AAC     5
+#define LD        23
+#define ER_LC     17
+#define ER_LTP    19
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* header types */
+#define RAW        0
+#define ADIF       1
+#define ADTS       2
+#define LATM       3
+
+/* SBR signalling */
+#define NO_SBR           0
+#define SBR_UPSAMPLED    1
+#define SBR_DOWNSAMPLED  2
+#define NO_SBR_UPSAMPLED 3
+
+/* First object type that has ER */
+#define ER_OBJECT_START 17
+
+typedef struct _bitfile
+{
+    /* bit input */
+    uint32_t bufa;
+    uint32_t bufb;
+    uint32_t bits_left;
+    uint32_t buffer_size; /* size of the buffer in bytes */
+    uint32_t bytes_left;
+    uint8_t error;
+    uint32_t *tail;
+    uint32_t *start;
+    const void *buffer;
+} bitfile;
+
+typedef struct mp4AudioSpecificConfig
+{
+    /* Audio Specific Info */
+    unsigned char objectTypeIndex;
+    unsigned char samplingFrequencyIndex;
+    unsigned long samplingFrequency;
+    unsigned char channelsConfiguration;
+
+    /* GA Specific Info */
+    unsigned char frameLengthFlag;
+    unsigned char dependsOnCoreCoder;
+    unsigned short coreCoderDelay;
+    unsigned char extensionFlag;
+    unsigned char aacSectionDataResilienceFlag;
+    unsigned char aacScalefactorDataResilienceFlag;
+    unsigned char aacSpectralDataResilienceFlag;
+    unsigned char epConfig;
+
+    char sbr_present_flag;
+    char ps_present_flag;
+    char forceUpSampling;
+    char downSampledSBR;
+} mp4AudioSpecificConfig;
+
+/* circumvent memory alignment errors on ARM */
+static INLINE uint32_t getdword(void *mem)
+{
+    uint32_t tmp;
+#ifndef ARCH_IS_BIG_ENDIAN
+    ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
+    ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+    ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+    ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+#else
+    ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+    ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+    ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
+    ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
+#endif
+
+    return tmp;
+}
+
+/* reads only n bytes from the stream instead of the standard 4 */
+static /*INLINE*/ uint32_t getdword_n(void *mem, int n)
+{
+    uint32_t tmp = 0;
+#ifndef ARCH_IS_BIG_ENDIAN
+    switch (n)
+    {
+    case 3:
+        ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+    case 2:
+        ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+    case 1:
+        ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+    default:
+        break;
+    }
+#else
+    switch (n)
+    {
+    case 3:
+        ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
+    case 2:
+        ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+    case 1:
+        ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+    default:
+        break;
+    }
+#endif
+
+    return tmp;
+}
+
+static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
+{
+    if (bits <= ld->bits_left)
+    {
+        //return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
+        return (ld->bufa << (32 - ld->bits_left)) >> (32 - bits);
+    }
+
+    bits -= ld->bits_left;
+    //return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
+    return ((ld->bufa & ((1<<ld->bits_left)-1)) << bits) | (ld->bufb >> (32 - bits));
+}
+
+static /*INLINE*/ void faad_flushbits_ex(bitfile *ld, uint32_t bits)
+{
+    uint32_t tmp;
+
+    ld->bufa = ld->bufb;
+    if (ld->bytes_left >= 4)
+    {
+        tmp = getdword(ld->tail);
+        ld->bytes_left -= 4;
+    } else {
+        tmp = getdword_n(ld->tail, ld->bytes_left);
+        ld->bytes_left = 0;
+    }
+    ld->bufb = tmp;
+    ld->tail++;
+    ld->bits_left += (32 - bits);
+}
+
+static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
+{
+    /* do nothing if error */
+    if (ld->error != 0)
+        return;
+
+    if (bits < ld->bits_left)
+    {
+        ld->bits_left -= bits;
+    } else {
+        faad_flushbits_ex(ld, bits);
+    }
+}
+
+/* return next n bits (right adjusted) */
+static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n)
+{
+    uint32_t ret;
+
+    if (n == 0)
+        return 0;
+
+    ret = faad_showbits(ld, n);
+    faad_flushbits(ld, n);
+
+    return ret;
+}
+
+static INLINE uint8_t faad_get1bit(bitfile *ld)
+{
+    uint8_t r;
+
+    if (ld->bits_left > 0)
+    {
+        ld->bits_left--;
+        r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
+        return r;
+    }
+
+    /* bits_left == 0 */
+#if 0
+    r = (uint8_t)(ld->bufb >> 31);
+    faad_flushbits_ex(ld, 1);
+#else
+    r = (uint8_t)faad_getbits(ld, 1);
+#endif
+    return r;
+}
+
+void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size);
+uint8_t faad_byte_align(bitfile *ld);
+void faad_endbits(bitfile *ld);
+uint32_t faad_get_processed_bits(bitfile *ld);
+uint32_t get_sample_rate(const uint8_t sr_index);
+int8_t rda_GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC);
+int8_t rda_AudioSpecificConfigFromBitfile(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, uint32_t buffer_size, uint8_t short_form);
+int8_t rda_AudioSpecificConfig2(uint8_t *pBuffer, uint32_t buffer_size, mp4AudioSpecificConfig *mp4ASC, uint8_t short_form);
+int32_t rda_MakeAdtsHeader(unsigned char *data, int size, mp4AudioSpecificConfig *mp4ASC);
+uint32_t read_callback(void *user_data, void *buffer, uint32_t length);
+uint32_t seek_callback(void *user_data, uint64_t position);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,429 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin*/
+/**
+  @file speex.h
+  @brief Describes the different modes of the codec
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef SPEEX_H
+#define SPEEX_H
+/** @defgroup Codec Speex encoder and decoder
+ *  This is the Speex codec itself.
+ *  @{
+ */
+
+#include "speex/speex_bits.h"
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Values allowed for *ctl() requests */
+
+/** Set enhancement on/off (decoder only) */
+#define SPEEX_SET_ENH 0
+/** Get enhancement state (decoder only) */
+#define SPEEX_GET_ENH 1
+
+/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
+/** Obtain frame size used by encoder/decoder */
+#define SPEEX_GET_FRAME_SIZE 3
+
+/** Set quality value */
+#define SPEEX_SET_QUALITY 4
+/** Get current quality setting */
+/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
+
+/** Set sub-mode to use */
+#define SPEEX_SET_MODE 6
+/** Get current sub-mode in use */
+#define SPEEX_GET_MODE 7
+
+/** Set low-band sub-mode to use (wideband only)*/
+#define SPEEX_SET_LOW_MODE 8
+/** Get current low-band mode in use (wideband only)*/
+#define SPEEX_GET_LOW_MODE 9
+
+/** Set high-band sub-mode to use (wideband only)*/
+#define SPEEX_SET_HIGH_MODE 10
+/** Get current high-band mode in use (wideband only)*/
+#define SPEEX_GET_HIGH_MODE 11
+
+/** Set VBR on (1) or off (0) */
+#define SPEEX_SET_VBR 12
+/** Get VBR status (1 for on, 0 for off) */
+#define SPEEX_GET_VBR 13
+
+/** Set quality value for VBR encoding (0-10) */
+#define SPEEX_SET_VBR_QUALITY 14
+/** Get current quality value for VBR encoding (0-10) */
+#define SPEEX_GET_VBR_QUALITY 15
+
+/** Set complexity of the encoder (0-10) */
+#define SPEEX_SET_COMPLEXITY 16
+/** Get current complexity of the encoder (0-10) */
+#define SPEEX_GET_COMPLEXITY 17
+
+/** Set bit-rate used by the encoder (or lower) */
+#define SPEEX_SET_BITRATE 18
+/** Get current bit-rate used by the encoder or decoder */
+#define SPEEX_GET_BITRATE 19
+
+/** Define a handler function for in-band Speex request*/
+#define SPEEX_SET_HANDLER 20
+
+/** Define a handler function for in-band user-defined request*/
+#define SPEEX_SET_USER_HANDLER 22
+
+/** Set sampling rate used in bit-rate computation */
+#define SPEEX_SET_SAMPLING_RATE 24
+/** Get sampling rate used in bit-rate computation */
+#define SPEEX_GET_SAMPLING_RATE 25
+
+/** Reset the encoder/decoder memories to zero*/
+#define SPEEX_RESET_STATE 26
+
+/** Get VBR info (mostly used internally) */
+#define SPEEX_GET_RELATIVE_QUALITY 29
+
+/** Set VAD status (1 for on, 0 for off) */
+#define SPEEX_SET_VAD 30
+
+/** Get VAD status (1 for on, 0 for off) */
+#define SPEEX_GET_VAD 31
+
+/** Set Average Bit-Rate (ABR) to n bits per seconds */
+#define SPEEX_SET_ABR 32
+/** Get Average Bit-Rate (ABR) setting (in bps) */
+#define SPEEX_GET_ABR 33
+
+/** Set DTX status (1 for on, 0 for off) */
+#define SPEEX_SET_DTX 34
+/** Get DTX status (1 for on, 0 for off) */
+#define SPEEX_GET_DTX 35
+
+/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */
+#define SPEEX_SET_SUBMODE_ENCODING 36
+/** Get submode encoding in each frame */
+#define SPEEX_GET_SUBMODE_ENCODING 37
+
+/*#define SPEEX_SET_LOOKAHEAD 38*/
+/** Returns the lookahead used by Speex */
+#define SPEEX_GET_LOOKAHEAD 39
+
+/** Sets tuning for packet-loss concealment (expected loss rate) */
+#define SPEEX_SET_PLC_TUNING 40
+/** Gets tuning for PLC */
+#define SPEEX_GET_PLC_TUNING 41
+
+/** Sets the max bit-rate allowed in VBR mode */
+#define SPEEX_SET_VBR_MAX_BITRATE 42
+/** Gets the max bit-rate allowed in VBR mode */
+#define SPEEX_GET_VBR_MAX_BITRATE 43
+
+/** Turn on/off input/output high-pass filtering */
+#define SPEEX_SET_HIGHPASS 44
+/** Get status of input/output high-pass filtering */
+#define SPEEX_GET_HIGHPASS 45
+
+/** Get "activity level" of the last decoded frame, i.e.
+    now much damage we cause if we remove the frame */
+#define SPEEX_GET_ACTIVITY 47
+
+
+/* Preserving compatibility:*/
+/** Equivalent to SPEEX_SET_ENH */
+#define SPEEX_SET_PF 0
+/** Equivalent to SPEEX_GET_ENH */
+#define SPEEX_GET_PF 1
+
+
+
+
+/* Values allowed for mode queries */
+/** Query the frame size of a mode */
+#define SPEEX_MODE_FRAME_SIZE 0
+
+/** Query the size of an encoded frame for a particular sub-mode */
+#define SPEEX_SUBMODE_BITS_PER_FRAME 1
+
+
+
+/** Get major Speex version */
+#define SPEEX_LIB_GET_MAJOR_VERSION 1
+/** Get minor Speex version */
+#define SPEEX_LIB_GET_MINOR_VERSION 3
+/** Get micro Speex version */
+#define SPEEX_LIB_GET_MICRO_VERSION 5
+/** Get extra Speex version */
+#define SPEEX_LIB_GET_EXTRA_VERSION 7
+/** Get Speex version string */
+#define SPEEX_LIB_GET_VERSION_STRING 9
+
+/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
+#define SPEEX_LIB_GET_ALLOC_FUNC 11
+#define SPEEX_LIB_SET_FREE_FUNC 12
+#define SPEEX_LIB_GET_FREE_FUNC 13
+
+#define SPEEX_LIB_SET_WARNING_FUNC 14
+#define SPEEX_LIB_GET_WARNING_FUNC 15
+#define SPEEX_LIB_SET_ERROR_FUNC 16
+#define SPEEX_LIB_GET_ERROR_FUNC 17
+*/
+
+/** Number of defined modes in Speex */
+#define SPEEX_NB_MODES 3
+
+/** modeID for the defined narrowband mode */
+#define SPEEX_MODEID_NB 0
+
+/** modeID for the defined wideband mode */
+#define SPEEX_MODEID_WB 1
+
+/** modeID for the defined ultra-wideband mode */
+#define SPEEX_MODEID_UWB 2
+
+#ifdef EPIC_48K
+/** modeID for the Epic 48K mode */
+#define SPEEX_MODEID_NB_48K 1000
+#endif
+
+struct SpeexMode;
+
+
+/* Prototypes for mode function pointers */
+
+/** Encoder state initialization function */
+typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
+
+/** Encoder state destruction function */
+typedef void (*encoder_destroy_func)(void *st);
+
+/** Main encoding function */
+typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
+
+/** Function for controlling the encoder options */
+typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
+
+/** Decoder state initialization function */
+typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
+
+/** Decoder state destruction function */
+typedef void (*decoder_destroy_func)(void *st);
+
+/** Main decoding function */
+typedef int  (*decode_func)(void *state, SpeexBits *bits, void *out);
+
+/** Function for controlling the decoder options */
+typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
+
+
+/** Query function for a mode */
+typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
+
+/** Struct defining a Speex mode */ 
+typedef struct SpeexMode {
+   /** Pointer to the low-level mode data */
+   const void *mode;
+
+   /** Pointer to the mode query function */
+   mode_query_func query;
+   
+   /** The name of the mode (you should not rely on this to identify the mode)*/
+   const char *modeName;
+
+   /**ID of the mode*/
+   int modeID;
+
+   /**Version number of the bitstream (incremented every time we break
+    bitstream compatibility*/
+   int bitstream_version;
+
+   /** Pointer to encoder initialization function */
+   encoder_init_func enc_init;
+
+   /** Pointer to encoder destruction function */
+   encoder_destroy_func enc_destroy;
+
+   /** Pointer to frame encoding function */
+   encode_func enc;
+
+   /** Pointer to decoder initialization function */
+   decoder_init_func dec_init;
+
+   /** Pointer to decoder destruction function */
+   decoder_destroy_func dec_destroy;
+
+   /** Pointer to frame decoding function */
+   decode_func dec;
+
+   /** ioctl-like requests for encoder */
+   encoder_ctl_func enc_ctl;
+
+   /** ioctl-like requests for decoder */
+   decoder_ctl_func dec_ctl;
+
+} SpeexMode;
+
+/**
+ * Returns a handle to a newly created Speex encoder state structure. For now, 
+ * the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes 
+ * may be added. Note that for now if you have more than one channels to 
+ * encode, you need one state per channel.
+ *
+ * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) 
+ * @return A newly created encoder state or NULL if state allocation fails
+ */
+void *speex_encoder_init(const SpeexMode *mode);
+
+/** Frees all resources associated to an existing Speex encoder state. 
+ * @param state Encoder state to be destroyed */
+void speex_encoder_destroy(void *state);
+
+/** Uses an existing encoder state to encode one frame of speech pointed to by
+    "in". The encoded bit-stream is saved in "bits".
+ @param state Encoder state
+ @param in Frame that will be encoded with a +-2^15 range. This data MAY be 
+        overwritten by the encoder and should be considered uninitialised 
+        after the call.
+ @param bits Bit-stream where the data will be written
+ @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
+ */
+int speex_encode(void *state, float *in, SpeexBits *bits);
+
+/** Uses an existing encoder state to encode one frame of speech pointed to by
+    "in". The encoded bit-stream is saved in "bits".
+ @param state Encoder state
+ @param in Frame that will be encoded with a +-2^15 range
+ @param bits Bit-stream where the data will be written
+ @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
+ */
+int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
+
+/** Used like the ioctl function to control the encoder parameters
+ *
+ * @param state Encoder state
+ * @param request ioctl-type request (one of the SPEEX_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
+ */
+int speex_encoder_ctl(void *state, int request, void *ptr);
+
+
+/** Returns a handle to a newly created decoder state structure. For now, 
+ * the mode argument can be &nb_mode or &wb_mode . In the future, more modes
+ * may be added.  Note that for now if you have more than one channels to
+ * decode, you need one state per channel.
+ *
+ * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
+ * @return A newly created decoder state or NULL if state allocation fails
+ */ 
+void *speex_decoder_init(const SpeexMode *mode);
+
+/** Frees all resources associated to an existing decoder state.
+ *
+ * @param state State to be destroyed
+ */
+void speex_decoder_destroy(void *state);
+
+/** Uses an existing decoder state to decode one frame of speech from
+ * bit-stream bits. The output speech is saved written to out.
+ *
+ * @param state Decoder state
+ * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
+ * @param out Where to write the decoded frame
+ * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
+ */
+int speex_decode(void *state, SpeexBits *bits, float *out);
+
+/** Uses an existing decoder state to decode one frame of speech from
+ * bit-stream bits. The output speech is saved written to out.
+ *
+ * @param state Decoder state
+ * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
+ * @param out Where to write the decoded frame
+ * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
+ */
+int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
+
+/** Used like the ioctl function to control the encoder parameters
+ *
+ * @param state Decoder state
+ * @param request ioctl-type request (one of the SPEEX_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
+ */
+int speex_decoder_ctl(void *state, int request, void *ptr);
+
+
+/** Query function for mode information
+ *
+ * @param mode Speex mode
+ * @param request ioctl-type request (one of the SPEEX_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
+ */
+int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
+
+/** Functions for controlling the behavior of libspeex
+ * @param request ioctl-type request (one of the SPEEX_LIB_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
+ */
+int speex_lib_ctl(int request, void *ptr);
+
+/** Default narrowband mode */
+extern const SpeexMode speex_nb_mode;
+
+/** Default wideband mode */
+extern const SpeexMode speex_wb_mode;
+
+/** Default "ultra-wideband" mode */
+extern const SpeexMode speex_uwb_mode;
+
+#ifdef EPIC_48K
+/** 4.8 kbps narrowband mode */
+extern const SpeexMode speex_nb_48k_mode;
+#endif
+
+/** List of all modes available */
+extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
+
+/** Obtain one of the modes available */
+const SpeexMode * speex_lib_get_mode (int mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_bits.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,174 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file speex_bits.h
+   @brief Handles bit packing/unpacking
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef BITS_H
+#define BITS_H
+/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
+ *  This is the structure that holds the bit-stream when encoding or decoding
+ * with Speex. It allows some manipulations as well.
+ *  @{
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Bit-packing data structure representing (part of) a bit-stream. */
+typedef struct SpeexBits {
+   char *chars;   /**< "raw" data */
+   int   nbBits;  /**< Total number of bits stored in the stream*/
+   int   charPtr; /**< Position of the byte "cursor" */
+   int   bitPtr;  /**< Position of the bit "cursor" within the current char */
+   int   owner;   /**< Does the struct "own" the "raw" buffer (member "chars") */
+   int   overflow;/**< Set to one if we try to read past the valid data */
+   int   buf_size;/**< Allocated size for buffer */
+   int   reserved1; /**< Reserved for future use */
+   void *reserved2; /**< Reserved for future use */
+} SpeexBits;
+
+/** Initializes and allocates resources for a SpeexBits struct */
+void speex_bits_init(SpeexBits *bits);
+
+/** Initializes SpeexBits struct using a pre-allocated buffer*/
+void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
+
+/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
+void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
+
+/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
+void speex_bits_destroy(SpeexBits *bits);
+
+/** Resets bits to initial value (just after initialization, erasing content)*/
+void speex_bits_reset(SpeexBits *bits);
+
+/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
+void speex_bits_rewind(SpeexBits *bits);
+
+/** Initializes the bit-stream from the data in an area of memory */
+void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
+
+/** Append bytes to the bit-stream
+ * 
+ * @param bits Bit-stream to operate on
+ * @param bytes pointer to the bytes what will be appended
+ * @param len Number of bytes of append
+ */
+void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
+
+/** Write the content of a bit-stream to an area of memory
+ * 
+ * @param bits Bit-stream to operate on
+ * @param bytes Memory location where to write the bits
+ * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
+ * @return Number of bytes written to the "bytes" buffer
+*/
+int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
+
+/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
+int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
+
+/** Append bits to the bit-stream
+ * @param bits Bit-stream to operate on
+ * @param data Value to append as integer
+ * @param nbBits number of bits to consider in "data"
+ */
+void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
+
+/** Interpret the next bits in the bit-stream as a signed integer
+ *
+ * @param bits Bit-stream to operate on
+ * @param nbBits Number of bits to interpret
+ * @return A signed integer represented by the bits read
+ */
+int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
+
+/** Interpret the next bits in the bit-stream as an unsigned integer
+ *
+ * @param bits Bit-stream to operate on
+ * @param nbBits Number of bits to interpret
+ * @return An unsigned integer represented by the bits read
+ */
+unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
+
+/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
+ *
+ * @param bits Bit-stream to operate on
+ * @return Number of bytes in the stream
+ */
+int speex_bits_nbytes(SpeexBits *bits);
+
+/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position 
+ * 
+ * @param bits Bit-stream to operate on
+ * @param nbBits Number of bits to look for
+ * @return Value of the bits peeked, interpreted as unsigned
+ */
+unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
+
+/** Get the value of the next bit in the stream, without modifying the
+ * "cursor" position 
+ * 
+ * @param bits Bit-stream to operate on
+ * @return Value of the bit peeked (one bit only)
+ */
+int speex_bits_peek(SpeexBits *bits);
+
+/** Advances the position of the "bit cursor" in the stream 
+ *
+ * @param bits Bit-stream to operate on
+ * @param n Number of bits to advance
+ */
+void speex_bits_advance(SpeexBits *bits, int n);
+
+/** Returns the number of bits remaining to be read in a stream
+ *
+ * @param bits Bit-stream to operate on
+ * @return Number of bits that can still be read from the stream
+ */
+int speex_bits_remaining(SpeexBits *bits);
+
+/** Insert a terminator so that the data can be sent as a packet while auto-detecting 
+ * the number of frames in each packet 
+ *
+ * @param bits Bit-stream to operate on
+ */
+void speex_bits_insert_terminator(SpeexBits *bits);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* @} */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_callbacks.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,134 @@
+/* Copyright (C) 2002 Jean-Marc Valin*/
+/**
+  @file speex_callbacks.h
+  @brief Describes callback handling and in-band signalling
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef SPEEX_CALLBACKS_H
+#define SPEEX_CALLBACKS_H
+/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
+ *  @{
+ */
+
+#include "speex.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Total number of callbacks */
+#define SPEEX_MAX_CALLBACKS 16
+
+/* Describes all the in-band requests */
+
+/*These are 1-bit requests*/
+/** Request for perceptual enhancement (1 for on, 0 for off) */
+#define SPEEX_INBAND_ENH_REQUEST         0
+/** Reserved */
+#define SPEEX_INBAND_RESERVED1           1
+
+/*These are 4-bit requests*/
+/** Request for a mode change */
+#define SPEEX_INBAND_MODE_REQUEST        2
+/** Request for a low mode change */
+#define SPEEX_INBAND_LOW_MODE_REQUEST    3
+/** Request for a high mode change */
+#define SPEEX_INBAND_HIGH_MODE_REQUEST   4
+/** Request for VBR (1 on, 0 off) */
+#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
+/** Request to be sent acknowledge */
+#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
+/** Request for VBR (1 for on, 0 for off) */
+#define SPEEX_INBAND_VBR_REQUEST         7
+
+/*These are 8-bit requests*/
+/** Send a character in-band */
+#define SPEEX_INBAND_CHAR                8
+/** Intensity stereo information */
+#define SPEEX_INBAND_STEREO              9
+
+/*These are 16-bit requests*/
+/** Transmit max bit-rate allowed */
+#define SPEEX_INBAND_MAX_BITRATE         10
+
+/*These are 32-bit requests*/
+/** Acknowledge packet reception */
+#define SPEEX_INBAND_ACKNOWLEDGE         12
+
+/** Callback function type */
+typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
+
+/** Callback information */
+typedef struct SpeexCallback {
+   int callback_id;             /**< ID associated to the callback */
+   speex_callback_func func;    /**< Callback handler function */
+   void *data;                  /**< Data that will be sent to the handler */
+   void *reserved1;             /**< Reserved for future use */
+   int   reserved2;             /**< Reserved for future use */
+} SpeexCallback;
+
+/** Handle in-band request */
+int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
+
+/** Standard handler for mode request (change mode, no questions asked) */
+int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
+
+/** Standard handler for high mode request (change high mode, no questions asked) */
+int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
+
+/** Standard handler for in-band characters (write to stderr) */
+int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
+
+/** Default handler for user-defined requests: in this case, just ignore */
+int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
+
+
+
+/** Standard handler for low mode request (change low mode, no questions asked) */
+int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
+
+/** Standard handler for VBR request (Set VBR, no questions asked) */
+int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
+
+/** Standard handler for enhancer request (Turn ehnancer on/off, no questions asked) */
+int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
+
+/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
+int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_config_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,10 @@
+#ifndef _SPEEX_CONFIG_TYPES_H
+#define _SPEEX_CONFIG_TYPES_H
+
+typedef signed short spx_int16_t;
+typedef unsigned short spx_uint16_t;
+typedef signed int spx_int32_t;
+typedef unsigned int spx_uint32_t;
+
+#endif /* _SPEEX_CONFIG_TYPES_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_echo.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,123 @@
+/* Copyright (C) Jean-Marc Valin */
+/**
+   @file speex_echo.h
+   @brief Echo cancellation
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SPEEX_ECHO_H
+#define SPEEX_ECHO_H
+/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
+ *  This is the acoustic echo canceller module.
+ *  @{
+ */
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Obtain frame size used by the AEC */
+#define SPEEX_ECHO_GET_FRAME_SIZE 3
+
+/** Set sampling rate */
+#define SPEEX_ECHO_SET_SAMPLING_RATE 24
+/** Get sampling rate */
+#define SPEEX_ECHO_GET_SAMPLING_RATE 25
+
+/** Internal echo canceller state. Should never be accessed directly. */
+struct SpeexEchoState_;
+
+/** @class SpeexEchoState
+ * This holds the state of the echo canceller. You need one per channel. 
+*/
+
+/** Internal echo canceller state. Should never be accessed directly. */
+typedef struct SpeexEchoState_ SpeexEchoState;
+
+/** Creates a new echo canceller state
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
+ * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
+ * @return Newly-created echo canceller state
+ */
+SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
+
+/** Destroys an echo canceller state 
+ * @param st Echo canceller state
+*/
+void speex_echo_state_destroy(SpeexEchoState *st);
+
+/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
+ * to playback ni this form)
+ *
+ * @param st Echo canceller state
+ * @param rec signal from the microphone (near end + far end echo)
+ * @param play Signal played to the speaker (received from far end)
+ * @param out Returns near-end signal with echo removed
+ */
+void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
+
+/** Performs echo cancellation a frame (deprecated) */
+void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
+
+/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
+ * to account for the delay introduced by most soundcards (but it could be off!)
+ * @param st Echo canceller state
+ * @param rec signal from the microphone (near end + far end echo)
+ * @param out Returns near-end signal with echo removed
+*/
+void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
+
+/** Let the echo canceller know that a frame was just queued to the soundcard
+ * @param st Echo canceller state
+ * @param play Signal played to the speaker (received from far end)
+*/
+void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
+
+/** Reset the echo canceller to its original state 
+ * @param st Echo canceller state
+ */
+void speex_echo_state_reset(SpeexEchoState *st);
+
+/** Used like the ioctl function to control the echo canceller parameters
+ *
+ * @param st Echo canceller state
+ * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+ */
+int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+/** @}*/
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_header.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,91 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file speex_header.h
+   @brief Describes the Speex header
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+#ifndef SPEEX_HEADER_H
+#define SPEEX_HEADER_H
+/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
+ *  This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
+ *  @{
+ */
+
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct SpeexMode;
+
+/** Length of the Speex header identifier */
+#define SPEEX_HEADER_STRING_LENGTH 8
+
+/** Maximum number of characters for encoding the Speex version number in the header */
+#define SPEEX_HEADER_VERSION_LENGTH 20
+
+/** Speex header info for file-based formats */
+typedef struct SpeexHeader {
+   char speex_string[SPEEX_HEADER_STRING_LENGTH];   /**< Identifies a Speex bit-stream, always set to "Speex   " */
+   char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */ 
+   spx_int32_t speex_version_id;       /**< Version for Speex (for checking compatibility) */
+   spx_int32_t header_size;            /**< Total size of the header ( sizeof(SpeexHeader) ) */
+   spx_int32_t rate;                   /**< Sampling rate used */
+   spx_int32_t mode;                   /**< Mode used (0 for narrowband, 1 for wideband) */
+   spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
+   spx_int32_t nb_channels;            /**< Number of channels encoded */
+   spx_int32_t bitrate;                /**< Bit-rate used */
+   spx_int32_t frame_size;             /**< Size of frames */
+   spx_int32_t vbr;                    /**< 1 for a VBR encoding, 0 otherwise */
+   spx_int32_t frames_per_packet;      /**< Number of frames stored per Ogg packet */
+   spx_int32_t extra_headers;          /**< Number of additional headers after the comments */
+   spx_int32_t reserved1;              /**< Reserved for future use, must be zero */
+   spx_int32_t reserved2;              /**< Reserved for future use, must be zero */
+} SpeexHeader;
+
+/** Initializes a SpeexHeader using basic information */
+void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
+
+/** Creates the header packet from the header itself (mostly involves endianness conversion) */
+char *speex_header_to_packet(SpeexHeader *header, int *size);
+
+/** Creates a SpeexHeader from a packet */
+SpeexHeader *speex_packet_to_header(char *packet, int size);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_jitter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,192 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file speex_jitter.h
+   @brief Adaptive jitter buffer for Speex
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef SPEEX_JITTER_H
+#define SPEEX_JITTER_H
+/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer
+ *  This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
+ * to maintain good quality and low latency.
+ *  @{
+ */
+
+#include "speex.h"
+#include "speex_bits.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Generic adaptive jitter buffer state */
+struct JitterBuffer_;
+
+/** Generic adaptive jitter buffer state */
+typedef struct JitterBuffer_ JitterBuffer;
+
+/** Definition of an incoming packet */
+typedef struct _JitterBufferPacket JitterBufferPacket;
+
+/** Definition of an incoming packet */
+struct _JitterBufferPacket {
+   char        *data;       /**< Data bytes contained in the packet */
+   spx_uint32_t len;        /**< Length of the packet in bytes */
+   spx_uint32_t timestamp;  /**< Timestamp for the packet */
+   spx_uint32_t span;       /**< Time covered by the packet (same units as timestamp) */
+};
+
+/** Packet has been retrieved */
+#define JITTER_BUFFER_OK 0
+/** Packet is missing */
+#define JITTER_BUFFER_MISSING 1
+/** Packet is incomplete (does not cover the entive tick */
+#define JITTER_BUFFER_INCOMPLETE 2
+/** There was an error in the jitter buffer */
+#define JITTER_BUFFER_INTERNAL_ERROR -1
+/** Invalid argument */
+#define JITTER_BUFFER_BAD_ARGUMENT -2
+
+
+/** Set minimum amount of extra buffering required (margin) */
+#define JITTER_BUFFER_SET_MARGIN 0
+/** Get minimum amount of extra buffering required (margin) */
+#define JITTER_BUFFER_GET_MARGIN 1
+/* JITTER_BUFFER_SET_AVALIABLE_COUNT wouldn't make sense */
+/** Get the amount of avaliable packets currently buffered */
+#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
+
+#define JITTER_BUFFER_ADJUST_INTERPOLATE -1
+#define JITTER_BUFFER_ADJUST_OK 0
+#define JITTER_BUFFER_ADJUST_DROP 1
+
+/** Initialises jitter buffer 
+ * 
+ * @param tick Number of samples per "tick", i.e. the time period of the elements that will be retrieved
+ * @return Newly created jitter buffer state
+ */
+JitterBuffer *jitter_buffer_init(int tick);
+
+/** Restores jitter buffer to its original state 
+ * 
+ * @param jitter Jitter buffer state
+ */
+void jitter_buffer_reset(JitterBuffer *jitter);
+
+/** Destroys jitter buffer 
+ * 
+ * @param jitter Jitter buffer state
+ */
+void jitter_buffer_destroy(JitterBuffer *jitter);
+
+/** Put one packet into the jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+ * @param packet Incoming packet
+*/
+void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
+
+/** Get one packet from the jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+ * @param packet Returned packet
+ * @param current_timestamp Timestamp for the returned packet 
+*/
+int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
+
+/** Get pointer timestamp of jitter buffer
+ * 
+ * @param jitter Jitter buffer state
+*/
+int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
+
+/** Advance by one tick
+ * 
+ * @param jitter Jitter buffer state
+*/
+void jitter_buffer_tick(JitterBuffer *jitter);
+
+/** Used like the ioctl function to control the jitter buffer parameters
+ * 
+ * @param jitter Jitter buffer state
+ * @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+*/
+int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
+
+int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
+
+/* @} */
+
+/** @defgroup SpeexJitter SpeexJitter: Adaptive jitter buffer specifically for Speex
+ *  This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
+ * to maintain good quality and low latency. This is a simplified version that works only
+ * with Speex, but is much easier to use.
+ *  @{
+*/
+
+/** Speex jitter-buffer state. Never use it directly! */
+typedef struct SpeexJitter {
+   SpeexBits current_packet;         /**< Current Speex packet */
+   int valid_bits;                   /**< True if Speex bits are valid */
+   JitterBuffer *packets;            /**< Generic jitter buffer state */
+   void *dec;                        /**< Pointer to Speex decoder */
+   spx_int32_t frame_size;           /**< Frame size of Speex decoder */
+} SpeexJitter;
+
+/** Initialise jitter buffer 
+ * 
+ * @param jitter State of the Speex jitter buffer
+ * @param decoder Speex decoder to call
+ * @param sampling_rate Sampling rate used by the decoder
+*/
+void speex_jitter_init(SpeexJitter *jitter, void *decoder, int sampling_rate);
+
+/** Destroy jitter buffer */
+void speex_jitter_destroy(SpeexJitter *jitter);
+
+/** Put one packet into the jitter buffer */
+void speex_jitter_put(SpeexJitter *jitter, char *packet, int len, int timestamp);
+
+/** Get one packet from the jitter buffer */
+void speex_jitter_get(SpeexJitter *jitter, spx_int16_t *out, int *start_offset);
+
+/** Get pointer timestamp of jitter buffer */
+int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* @} */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_preprocess.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,186 @@
+/* Copyright (C) 2003 Epic Games
+   Written by Jean-Marc Valin */
+/**
+ *  @file speex_preprocess.h
+ *  @brief Speex preprocessor. The preprocess can do noise suppression, 
+ * residual echo suppression (after using the echo canceller), automatic
+ * gain control (AGC) and voice activity detection (VAD).
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SPEEX_PREPROCESS_H
+#define SPEEX_PREPROCESS_H
+/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
+ *  This is the Speex preprocessor. The preprocess can do noise suppression, 
+ * residual echo suppression (after using the echo canceller), automatic
+ * gain control (AGC) and voice activity detection (VAD).
+ *  @{
+ */
+
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+   
+/** State of the preprocessor (one per channel). Should never be accessed directly. */
+struct SpeexPreprocessState_;
+
+/** State of the preprocessor (one per channel). Should never be accessed directly. */
+typedef struct SpeexPreprocessState_ SpeexPreprocessState;
+
+
+/** Creates a new preprocessing state. You MUST create one state per channel processed.
+ * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be
+ * the same value as that used for the echo canceller for residual echo cancellation to work.
+ * @param sampling_rate Sampling rate used for the input.
+ * @return Newly created preprocessor state
+*/
+SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
+
+/** Destroys a preprocessor state 
+ * @param st Preprocessor state to destroy
+*/
+void speex_preprocess_state_destroy(SpeexPreprocessState *st);
+
+/** Preprocess a frame 
+ * @param st Preprocessor state
+ * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
+ * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
+*/
+int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x);
+
+/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/
+int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
+
+/** Update preprocessor state, but do not compute the output
+ * @param st Preprocessor state
+ * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init().
+*/
+void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
+
+/** Used like the ioctl function to control the preprocessor parameters 
+ * @param st Preprocessor state
+ * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
+ * @param ptr Data exchanged to-from function
+ * @return 0 if no error, -1 if request in unknown
+*/
+int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
+
+
+
+/** Set preprocessor denoiser state */
+#define SPEEX_PREPROCESS_SET_DENOISE 0
+/** Get preprocessor denoiser state */
+#define SPEEX_PREPROCESS_GET_DENOISE 1
+
+/** Set preprocessor Automatic Gain Control state */
+#define SPEEX_PREPROCESS_SET_AGC 2
+/** Get preprocessor Automatic Gain Control state */
+#define SPEEX_PREPROCESS_GET_AGC 3
+
+/** Set preprocessor Voice Activity Detection state */
+#define SPEEX_PREPROCESS_SET_VAD 4
+/** Get preprocessor Voice Activity Detection state */
+#define SPEEX_PREPROCESS_GET_VAD 5
+
+/** Set preprocessor Automatic Gain Control level */
+#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
+/** Get preprocessor Automatic Gain Control level */
+#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
+
+/** Set preprocessor dereverb state */
+#define SPEEX_PREPROCESS_SET_DEREVERB 8
+/** Get preprocessor dereverb state */
+#define SPEEX_PREPROCESS_GET_DEREVERB 9
+
+/** Set preprocessor dereverb level */
+#define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10
+/** Get preprocessor dereverb level */
+#define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11
+
+/** Set preprocessor dereverb decay */
+#define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12
+/** Get preprocessor dereverb decay */
+#define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
+
+/** Set probability required for the VAD to go from silence to voice */
+#define SPEEX_PREPROCESS_SET_PROB_START 14
+/** Get probability required for the VAD to go from silence to voice */
+#define SPEEX_PREPROCESS_GET_PROB_START 15
+
+/** Set probability required for the VAD to stay in the voice state (integer percent) */
+#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
+/** Get probability required for the VAD to stay in the voice state (integer percent) */
+#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
+
+/** Set maximum attenuation of the noise in dB (negative number) */
+#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18
+/** Get maximum attenuation of the noise in dB (negative number) */
+#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19
+
+/** Set maximum attenuation of the residual echo in dB (negative number) */
+#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20
+/** Get maximum attenuation of the residual echo in dB (negative number) */
+#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21
+
+/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */
+#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22
+/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */
+#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23
+
+/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */
+#define SPEEX_PREPROCESS_SET_ECHO_STATE 24
+/** Get the corresponding echo canceller state */
+#define SPEEX_PREPROCESS_GET_ECHO_STATE 25
+
+/** Set maximal gain increase in dB/second (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26
+
+/** Get maximal gain increase in dB/second (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27
+
+/** Set maximal gain decrease in dB/second (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28
+
+/** Get maximal gain decrease in dB/second (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29
+
+/** Set maximal gain in dB (int32) */
+#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
+
+/** Get maximal gain in dB (int32) */
+#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @}*/
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_resampler.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,328 @@
+/* Copyright (C) 2007 Jean-Marc Valin
+      
+   File: speex_resampler.h
+   Resampling code
+      
+   The design goals of this code are:
+      - Very fast algorithm
+      - Low memory requirement
+      - Good *perceptual* quality (and not best SNR)
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+#ifndef SPEEX_RESAMPLER_H
+#define SPEEX_RESAMPLER_H
+
+#ifdef OUTSIDE_SPEEX
+
+/********* WARNING: MENTAL SANITY ENDS HERE *************/
+
+/* If the resampler is defined outside of Speex, we change the symbol names so that 
+   there won't be any clash if linking with Speex later on. */
+
+/* #define RANDOM_PREFIX your software name here */
+#ifndef RANDOM_PREFIX
+#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
+#endif
+
+#define CAT_PREFIX2(a,b) a ## b
+#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
+      
+#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
+#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
+#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
+#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
+#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
+#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
+#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
+#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
+#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
+#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
+#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
+#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
+#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
+#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
+#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
+#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
+#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
+#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
+#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
+#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
+
+#define spx_int16_t short
+#define spx_int32_t int
+#define spx_uint16_t unsigned short
+#define spx_uint32_t unsigned int
+      
+#else /* OUTSIDE_SPEEX */
+
+#include "speex/speex_types.h"
+
+#endif /* OUTSIDE_SPEEX */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SPEEX_RESAMPLER_QUALITY_MAX 10
+#define SPEEX_RESAMPLER_QUALITY_MIN 0
+#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
+#define SPEEX_RESAMPLER_QUALITY_VOIP 3
+#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
+
+enum {
+   RESAMPLER_ERR_SUCCESS         = 0,
+   RESAMPLER_ERR_ALLOC_FAILED    = 1,
+   RESAMPLER_ERR_BAD_STATE       = 2,
+   RESAMPLER_ERR_INVALID_ARG     = 3,
+   RESAMPLER_ERR_PTR_OVERLAP     = 4,
+   
+   RESAMPLER_ERR_MAX_ERROR
+};
+
+struct SpeexResamplerState_;
+typedef struct SpeexResamplerState_ SpeexResamplerState;
+
+/** Create a new resampler with integer input and output rates.
+ * @param nb_channels Number of channels to be processed
+ * @param in_rate Input sampling rate (integer number of Hz).
+ * @param out_rate Output sampling rate (integer number of Hz).
+ * @param quality Resampling quality between 0 and 10, where 0 has poor quality
+ * and 10 has very high quality.
+ * @return Newly created resampler state
+ * @retval NULL Error: not enough memory
+ */
+SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, 
+                                          spx_uint32_t in_rate, 
+                                          spx_uint32_t out_rate, 
+                                          int quality,
+                                          int *err);
+
+/** Create a new resampler with fractional input/output rates. The sampling 
+ * rate ratio is an arbitrary rational number with both the numerator and 
+ * denominator being 32-bit integers.
+ * @param nb_channels Number of channels to be processed
+ * @param ratio_num Numerator of the sampling rate ratio
+ * @param ratio_den Denominator of the sampling rate ratio
+ * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
+ * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
+ * @param quality Resampling quality between 0 and 10, where 0 has poor quality
+ * and 10 has very high quality.
+ * @return Newly created resampler state
+ * @retval NULL Error: not enough memory
+ */
+SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, 
+                                               spx_uint32_t ratio_num, 
+                                               spx_uint32_t ratio_den, 
+                                               spx_uint32_t in_rate, 
+                                               spx_uint32_t out_rate, 
+                                               int quality,
+                                               int *err);
+
+/** Destroy a resampler state.
+ * @param st Resampler state
+ */
+void speex_resampler_destroy(SpeexResamplerState *st);
+
+/** Resample a float array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param channel_index Index of the channel to process for the multi-channel 
+ * base (0 otherwise)
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the 
+ * number of samples processed
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written
+ */
+int speex_resampler_process_float(SpeexResamplerState *st, 
+                                   spx_uint32_t channel_index, 
+                                   const float *in, 
+                                   spx_uint32_t *in_len, 
+                                   float *out, 
+                                   spx_uint32_t *out_len);
+
+/** Resample an int array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param channel_index Index of the channel to process for the multi-channel 
+ * base (0 otherwise)
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written
+ */
+int speex_resampler_process_int(SpeexResamplerState *st, 
+                                 spx_uint32_t channel_index, 
+                                 const spx_int16_t *in, 
+                                 spx_uint32_t *in_len, 
+                                 spx_int16_t *out, 
+                                 spx_uint32_t *out_len);
+
+/** Resample an interleaved float array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed. This is all per-channel.
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written.
+ * This is all per-channel.
+ */
+int speex_resampler_process_interleaved_float(SpeexResamplerState *st, 
+                                               const float *in, 
+                                               spx_uint32_t *in_len, 
+                                               float *out, 
+                                               spx_uint32_t *out_len);
+
+/** Resample an interleaved int array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number
+ * of samples processed. This is all per-channel.
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written.
+ * This is all per-channel.
+ */
+int speex_resampler_process_interleaved_int(SpeexResamplerState *st, 
+                                             const spx_int16_t *in, 
+                                             spx_uint32_t *in_len, 
+                                             spx_int16_t *out, 
+                                             spx_uint32_t *out_len);
+
+/** Set (change) the input/output sampling rates (integer value).
+ * @param st Resampler state
+ * @param in_rate Input sampling rate (integer number of Hz).
+ * @param out_rate Output sampling rate (integer number of Hz).
+ */
+int speex_resampler_set_rate(SpeexResamplerState *st, 
+                              spx_uint32_t in_rate, 
+                              spx_uint32_t out_rate);
+
+/** Get the current input/output sampling rates (integer value).
+ * @param st Resampler state
+ * @param in_rate Input sampling rate (integer number of Hz) copied.
+ * @param out_rate Output sampling rate (integer number of Hz) copied.
+ */
+void speex_resampler_get_rate(SpeexResamplerState *st, 
+                              spx_uint32_t *in_rate, 
+                              spx_uint32_t *out_rate);
+
+/** Set (change) the input/output sampling rates and resampling ratio 
+ * (fractional values in Hz supported).
+ * @param st Resampler state
+ * @param ratio_num Numerator of the sampling rate ratio
+ * @param ratio_den Denominator of the sampling rate ratio
+ * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
+ * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
+ */
+int speex_resampler_set_rate_frac(SpeexResamplerState *st, 
+                                   spx_uint32_t ratio_num, 
+                                   spx_uint32_t ratio_den, 
+                                   spx_uint32_t in_rate, 
+                                   spx_uint32_t out_rate);
+
+/** Get the current resampling ratio. This will be reduced to the least
+ * common denominator.
+ * @param st Resampler state
+ * @param ratio_num Numerator of the sampling rate ratio copied
+ * @param ratio_den Denominator of the sampling rate ratio copied
+ */
+void speex_resampler_get_ratio(SpeexResamplerState *st, 
+                               spx_uint32_t *ratio_num, 
+                               spx_uint32_t *ratio_den);
+
+/** Set (change) the conversion quality.
+ * @param st Resampler state
+ * @param quality Resampling quality between 0 and 10, where 0 has poor 
+ * quality and 10 has very high quality.
+ */
+int speex_resampler_set_quality(SpeexResamplerState *st, 
+                                 int quality);
+
+/** Get the conversion quality.
+ * @param st Resampler state
+ * @param quality Resampling quality between 0 and 10, where 0 has poor 
+ * quality and 10 has very high quality.
+ */
+void speex_resampler_get_quality(SpeexResamplerState *st, 
+                                 int *quality);
+
+/** Set (change) the input stride.
+ * @param st Resampler state
+ * @param stride Input stride
+ */
+void speex_resampler_set_input_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t stride);
+
+/** Get the input stride.
+ * @param st Resampler state
+ * @param stride Input stride copied
+ */
+void speex_resampler_get_input_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t *stride);
+
+/** Set (change) the output stride.
+ * @param st Resampler state
+ * @param stride Output stride
+ */
+void speex_resampler_set_output_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t stride);
+
+/** Get the output stride.
+ * @param st Resampler state copied
+ * @param stride Output stride
+ */
+void speex_resampler_get_output_stride(SpeexResamplerState *st, 
+                                      spx_uint32_t *stride);
+
+/** Make sure that the first samples to go out of the resamplers don't have 
+ * leading zeros. This is only useful before starting to use a newly created 
+ * resampler. It is recommended to use that when resampling an audio file, as
+ * it will generate a file with the same length. For real-time processing,
+ * it is probably easier not to use this call (so that the output duration
+ * is the same for the first frame).
+ * @param st Resampler state
+ */
+int speex_resampler_skip_zeros(SpeexResamplerState *st);
+
+/** Reset a resampler so a new (unrelated) stream can be processed.
+ * @param st Resampler state
+ */
+int speex_resampler_reset_mem(SpeexResamplerState *st);
+
+/** Returns the English meaning for an error code
+ * @param err Error code
+ * @return English string
+ */
+const char *speex_resampler_strerror(int err);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_stereo.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,82 @@
+/* Copyright (C) 2002 Jean-Marc Valin*/
+/**
+   @file speex_stereo.h
+   @brief Describes the handling for intensity stereo
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef STEREO_H
+#define STEREO_H
+/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
+ *  This describes the Speex intensity stereo encoding/decoding
+ *  @{
+ */
+
+#include "speex/speex_types.h"
+#include "speex/speex_bits.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** State used for decoding (intensity) stereo information */
+typedef struct SpeexStereoState {
+   float balance;      /**< Left/right balance info */
+   float e_ratio;      /**< Ratio of energies: E(left+right)/[E(left)+E(right)]  */
+   float smooth_left;  /**< Smoothed left channel gain */
+   float smooth_right; /**< Smoothed right channel gain */
+   float reserved1;    /**< Reserved for future use */
+   float reserved2;    /**< Reserved for future use */
+} SpeexStereoState;
+
+/** Initialization value for a stereo state */
+#define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0}
+
+/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
+void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
+
+/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
+void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
+
+/** Transforms a mono frame into a stereo frame using intensity stereo info */
+void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
+
+/** Transforms a mono frame into a stereo frame using intensity stereo info */
+void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo);
+
+/** Callback handler for intensity stereo info */
+int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/include/speex/speex_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,126 @@
+/* speex_types.h taken from libogg */
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: #ifdef jail to whip a few platforms into the UNIX ideal.
+ last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
+
+ ********************************************************************/
+/**
+   @file speex_types.h
+   @brief Speex types
+*/
+#ifndef _SPEEX_TYPES_H
+#define _SPEEX_TYPES_H
+
+#if defined(_WIN32) 
+
+#  if defined(__CYGWIN__)
+#    include <_G_config.h>
+     typedef _G_int32_t spx_int32_t;
+     typedef _G_uint32_t spx_uint32_t;
+     typedef _G_int16_t spx_int16_t;
+     typedef _G_uint16_t spx_uint16_t;
+#  elif defined(__MINGW32__)
+     typedef short spx_int16_t;                                                                             
+     typedef unsigned short spx_uint16_t;                                                                   
+     typedef int spx_int32_t;                                                                               
+     typedef unsigned int spx_uint32_t;                                                                     
+#  elif defined(__MWERKS__)
+     typedef int spx_int32_t;
+     typedef unsigned int spx_uint32_t;
+     typedef short spx_int16_t;
+     typedef unsigned short spx_uint16_t;
+#  else
+     /* MSVC/Borland */
+     typedef __int32 spx_int32_t;
+     typedef unsigned __int32 spx_uint32_t;
+     typedef __int16 spx_int16_t;
+     typedef unsigned __int16 spx_uint16_t;
+#  endif
+
+#elif defined(__MACOS__)
+
+#  include <sys/types.h>
+   typedef SInt16 spx_int16_t;
+   typedef UInt16 spx_uint16_t;
+   typedef SInt32 spx_int32_t;
+   typedef UInt32 spx_uint32_t;
+
+#elif defined(__MACOSX__) /* MacOS X Framework build */
+
+#  include <sys/types.h>
+   typedef int16_t spx_int16_t;
+   typedef u_int16_t spx_uint16_t;
+   typedef int32_t spx_int32_t;
+   typedef u_int32_t spx_uint32_t;
+
+#elif defined(__BEOS__)
+
+   /* Be */
+#  include <inttypes.h>
+   typedef int16_t spx_int16_t;
+   typedef u_int16_t spx_uint16_t;
+   typedef int32_t spx_int32_t;
+   typedef u_int32_t spx_uint32_t;
+
+#elif defined (__EMX__)
+
+   /* OS/2 GCC */
+   typedef short spx_int16_t;
+   typedef unsigned short spx_uint16_t;
+   typedef int spx_int32_t;
+   typedef unsigned int spx_uint32_t;
+
+#elif defined (DJGPP)
+
+   /* DJGPP */
+   typedef short spx_int16_t;
+   typedef int spx_int32_t;
+   typedef unsigned int spx_uint32_t;
+
+#elif defined(R5900)
+
+   /* PS2 EE */
+   typedef int spx_int32_t;
+   typedef unsigned spx_uint32_t;
+   typedef short spx_int16_t;
+
+#elif defined(__SYMBIAN32__)
+
+   /* Symbian GCC */
+   typedef signed short spx_int16_t;
+   typedef unsigned short spx_uint16_t;
+   typedef signed int spx_int32_t;
+   typedef unsigned int spx_uint32_t;
+
+#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
+
+   typedef short spx_int16_t;
+   typedef unsigned short spx_uint16_t;
+   typedef long spx_int32_t;
+   typedef unsigned long spx_uint32_t;
+
+#elif defined(CONFIG_TI_C6X)
+
+   typedef short spx_int16_t;
+   typedef unsigned short spx_uint16_t;
+   typedef int spx_int32_t;
+   typedef unsigned int spx_uint32_t;
+
+#else
+
+#  include <speex/speex_config_types.h>
+
+#endif
+
+#endif  /* _SPEEX_TYPES_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/_kiss_fft_guts.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,160 @@
+/*
+Copyright (c) 2003-2004, Mark Borgerding
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define MIN(a,b) ((a)<(b) ? (a):(b))
+#define MAX(a,b) ((a)>(b) ? (a):(b))
+
+/* kiss_fft.h
+   defines kiss_fft_scalar as either short or a float type
+   and defines
+   typedef struct { kiss_fft_scalar r; kiss_fft_scalar i; }kiss_fft_cpx; */
+#include "kiss_fft.h"
+#include "math_approx.h"
+
+#define MAXFACTORS 32
+/* e.g. an fft of length 128 has 4 factors 
+ as far as kissfft is concerned
+ 4*4*4*2
+ */
+
+struct kiss_fft_state{
+    int nfft;
+    int inverse;
+    int factors[2*MAXFACTORS];
+    kiss_fft_cpx twiddles[1];
+};
+
+/*
+  Explanation of macros dealing with complex math:
+
+   C_MUL(m,a,b)         : m = a*b
+   C_FIXDIV( c , div )  : if a fixed point impl., c /= div. noop otherwise
+   C_SUB( res, a,b)     : res = a - b
+   C_SUBFROM( res , a)  : res -= a
+   C_ADDTO( res , a)    : res += a
+ * */
+#ifdef FIXED_POINT
+#include "misc.h"
+# define FRACBITS 15
+# define SAMPPROD spx_int32_t 
+#define SAMP_MAX 32767
+
+#define SAMP_MIN -SAMP_MAX
+
+#if defined(CHECK_OVERFLOW)
+#  define CHECK_OVERFLOW_OP(a,op,b)  \
+	if ( (SAMPPROD)(a) op (SAMPPROD)(b) > SAMP_MAX || (SAMPPROD)(a) op (SAMPPROD)(b) < SAMP_MIN ) { \
+		fprintf(stderr,"WARNING:overflow @ " __FILE__ "(%d): (%d " #op" %d) = %ld\n",__LINE__,(a),(b),(SAMPPROD)(a) op (SAMPPROD)(b) );  }
+#endif
+
+
+#   define smul(a,b) ( (SAMPPROD)(a)*(b) )
+#   define sround( x )  (kiss_fft_scalar)( ( (x) + (1<<(FRACBITS-1)) ) >> FRACBITS )
+
+#   define S_MUL(a,b) sround( smul(a,b) )
+
+#   define C_MUL(m,a,b) \
+      do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \
+          (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0)
+
+#   define C_MUL4(m,a,b) \
+               do{ (m).r = PSHR32( smul((a).r,(b).r) - smul((a).i,(b).i),17 ); \
+               (m).i = PSHR32( smul((a).r,(b).i) + smul((a).i,(b).r),17 ); }while(0)
+
+#   define DIVSCALAR(x,k) \
+	(x) = sround( smul(  x, SAMP_MAX/k ) )
+
+#   define C_FIXDIV(c,div) \
+	do {    DIVSCALAR( (c).r , div);  \
+		DIVSCALAR( (c).i  , div); }while (0)
+
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r =  sround( smul( (c).r , s ) ) ;\
+        (c).i =  sround( smul( (c).i , s ) ) ; }while(0)
+
+#else  /* not FIXED_POINT*/
+
+#   define S_MUL(a,b) ( (a)*(b) )
+#define C_MUL(m,a,b) \
+    do{ (m).r = (a).r*(b).r - (a).i*(b).i;\
+        (m).i = (a).r*(b).i + (a).i*(b).r; }while(0)
+
+#define C_MUL4(m,a,b) C_MUL(m,a,b)
+
+#   define C_FIXDIV(c,div) /* NOOP */
+#   define C_MULBYSCALAR( c, s ) \
+    do{ (c).r *= (s);\
+        (c).i *= (s); }while(0)
+#endif
+
+#ifndef CHECK_OVERFLOW_OP
+#  define CHECK_OVERFLOW_OP(a,op,b) /* noop */
+#endif
+
+#define  C_ADD( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,+,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,+,(b).i)\
+	    (res).r=(a).r+(b).r;  (res).i=(a).i+(b).i; \
+    }while(0)
+#define  C_SUB( res, a,b)\
+    do { \
+	    CHECK_OVERFLOW_OP((a).r,-,(b).r)\
+	    CHECK_OVERFLOW_OP((a).i,-,(b).i)\
+	    (res).r=(a).r-(b).r;  (res).i=(a).i-(b).i; \
+    }while(0)
+#define C_ADDTO( res , a)\
+    do { \
+	    CHECK_OVERFLOW_OP((res).r,+,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,+,(a).i)\
+	    (res).r += (a).r;  (res).i += (a).i;\
+    }while(0)
+
+#define C_SUBFROM( res , a)\
+    do {\
+	    CHECK_OVERFLOW_OP((res).r,-,(a).r)\
+	    CHECK_OVERFLOW_OP((res).i,-,(a).i)\
+	    (res).r -= (a).r;  (res).i -= (a).i; \
+    }while(0)
+
+
+#ifdef FIXED_POINT
+#  define KISS_FFT_COS(phase)  floor(MIN(32767,MAX(-32767,.5+32768 * cos (phase))))
+#  define KISS_FFT_SIN(phase)  floor(MIN(32767,MAX(-32767,.5+32768 * sin (phase))))
+#  define HALF_OF(x) ((x)>>1)
+#elif defined(USE_SIMD)
+#  define KISS_FFT_COS(phase) _mm_set1_ps( cos(phase) )
+#  define KISS_FFT_SIN(phase) _mm_set1_ps( sin(phase) )
+#  define HALF_OF(x) ((x)*_mm_set1_ps(.5))
+#else
+#  define KISS_FFT_COS(phase) (kiss_fft_scalar) cos(phase)
+#  define KISS_FFT_SIN(phase) (kiss_fft_scalar) sin(phase)
+#  define HALF_OF(x) ((x)*.5)
+#endif
+
+#define  kf_cexp(x,phase) \
+	do{ \
+		(x)->r = KISS_FFT_COS(phase);\
+		(x)->i = KISS_FFT_SIN(phase);\
+	}while(0)
+#define  kf_cexp2(x,phase) \
+               do{ \
+               (x)->r = spx_cos_norm((phase));\
+               (x)->i = spx_cos_norm((phase)-32768);\
+}while(0)
+
+
+/* a debugging function */
+#define pcpx(c)\
+    fprintf(stderr,"%g + %gi\n",(double)((c)->r),(double)((c)->i) )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/arch.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,197 @@
+/* Copyright (C) 2003 Jean-Marc Valin */
+/**
+   @file arch.h
+   @brief Various architecture definitions Speex
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef ARCH_H
+#define ARCH_H
+
+#ifndef OUTSIDE_SPEEX
+#include "speex/speex_types.h"
+#endif
+
+#define ABS(x) ((x) < 0 ? (-(x)) : (x))      /**< Absolute integer value. */
+#define ABS16(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 16-bit value.  */
+#define MIN16(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
+#define MAX16(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
+#define ABS32(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 32-bit value.  */
+#define MIN32(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
+#define MAX32(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
+
+#ifdef FIXED_POINT
+
+typedef spx_int16_t spx_word16_t;
+typedef spx_int32_t   spx_word32_t;
+typedef spx_word32_t spx_mem_t;
+typedef spx_word16_t spx_coef_t;
+typedef spx_word16_t spx_lsp_t;
+typedef spx_word32_t spx_sig_t;
+
+#define Q15ONE 32767
+
+#define LPC_SCALING  8192
+#define SIG_SCALING  16384
+#define LSP_SCALING  8192.
+#define GAMMA_SCALING 32768.
+#define GAIN_SCALING 64
+#define GAIN_SCALING_1 0.015625
+
+#define LPC_SHIFT    13
+#define LSP_SHIFT    13
+#define SIG_SHIFT    14
+
+#define VERY_SMALL 0
+#define VERY_LARGE32 ((spx_word32_t)2147483647)
+#define VERY_LARGE16 ((spx_word16_t)32767)
+#define Q15_ONE ((spx_word16_t)32767)
+
+
+#ifdef FIXED_DEBUG
+#include "fixed_debug.h"
+#else
+
+#include "fixed_generic.h"
+
+#ifdef ARM5E_ASM
+#include "fixed_arm5e.h"
+#elif defined (ARM4_ASM)
+#include "fixed_arm4.h"
+#elif defined (ARM5E_ASM)
+#include "fixed_arm5e.h"
+#elif defined (BFIN_ASM)
+#include "fixed_bfin.h"
+#endif
+
+#endif
+
+
+#else
+
+typedef float spx_mem_t;
+typedef float spx_coef_t;
+typedef float spx_lsp_t;
+typedef float spx_sig_t;
+typedef float spx_word16_t;
+typedef float spx_word32_t;
+
+#define Q15ONE 1.0f
+#define LPC_SCALING  1.f
+#define SIG_SCALING  1.f
+#define LSP_SCALING  1.f
+#define GAMMA_SCALING 1.f
+#define GAIN_SCALING 1.f
+#define GAIN_SCALING_1 1.f
+
+#define LPC_SHIFT    0
+#define LSP_SHIFT    0
+#define SIG_SHIFT    0
+
+#define VERY_SMALL 1e-15f
+#define VERY_LARGE32 1e15f
+#define VERY_LARGE16 1e15f
+#define Q15_ONE ((spx_word16_t)1.f)
+
+#define QCONST16(x,bits) (x)
+#define QCONST32(x,bits) (x)
+
+#define NEG16(x) (-(x))
+#define NEG32(x) (-(x))
+#define EXTRACT16(x) (x)
+#define EXTEND32(x) (x)
+#define SHR16(a,shift) (a)
+#define SHL16(a,shift) (a)
+#define SHR32(a,shift) (a)
+#define SHL32(a,shift) (a)
+#define PSHR16(a,shift) (a)
+#define PSHR32(a,shift) (a)
+#define VSHR32(a,shift) (a)
+#define SATURATE16(x,a) (x)
+#define SATURATE32(x,a) (x)
+
+#define PSHR(a,shift)       (a)
+#define SHR(a,shift)       (a)
+#define SHL(a,shift)       (a)
+#define SATURATE(x,a) (x)
+
+#define ADD16(a,b) ((a)+(b))
+#define SUB16(a,b) ((a)-(b))
+#define ADD32(a,b) ((a)+(b))
+#define SUB32(a,b) ((a)-(b))
+#define MULT16_16_16(a,b)     ((a)*(b))
+#define MULT16_16(a,b)     ((spx_word32_t)(a)*(spx_word32_t)(b))
+#define MAC16_16(c,a,b)     ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
+
+#define MULT16_32_Q11(a,b)     ((a)*(b))
+#define MULT16_32_Q13(a,b)     ((a)*(b))
+#define MULT16_32_Q14(a,b)     ((a)*(b))
+#define MULT16_32_Q15(a,b)     ((a)*(b))
+#define MULT16_32_P15(a,b)     ((a)*(b))
+
+#define MAC16_32_Q11(c,a,b)     ((c)+(a)*(b))
+#define MAC16_32_Q15(c,a,b)     ((c)+(a)*(b))
+
+#define MAC16_16_Q11(c,a,b)     ((c)+(a)*(b))
+#define MAC16_16_Q13(c,a,b)     ((c)+(a)*(b))
+#define MAC16_16_P13(c,a,b)     ((c)+(a)*(b))
+#define MULT16_16_Q11_32(a,b)     ((a)*(b))
+#define MULT16_16_Q13(a,b)     ((a)*(b))
+#define MULT16_16_Q14(a,b)     ((a)*(b))
+#define MULT16_16_Q15(a,b)     ((a)*(b))
+#define MULT16_16_P15(a,b)     ((a)*(b))
+#define MULT16_16_P13(a,b)     ((a)*(b))
+#define MULT16_16_P14(a,b)     ((a)*(b))
+
+#define DIV32_16(a,b)     (((spx_word32_t)(a))/(spx_word16_t)(b))
+#define PDIV32_16(a,b)     (((spx_word32_t)(a))/(spx_word16_t)(b))
+#define DIV32(a,b)     (((spx_word32_t)(a))/(spx_word32_t)(b))
+#define PDIV32(a,b)     (((spx_word32_t)(a))/(spx_word32_t)(b))
+
+
+#endif
+
+
+#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
+
+/* 2 on TI C5x DSP */
+#define BYTES_PER_CHAR 2 
+#define BITS_PER_CHAR 16
+#define LOG2_BITS_PER_CHAR 4
+
+#else 
+
+#define BYTES_PER_CHAR 1
+#define BITS_PER_CHAR 8
+#define LOG2_BITS_PER_CHAR 3
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,103 @@
+/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
+/**
+   @file cb_search.h
+   @brief Overlapped codebook search
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CB_SEARCH_H
+#define CB_SEARCH_H
+
+#include <speex/speex_bits.h>
+#include "misc.h"
+
+/** Split codebook parameters. */
+typedef struct split_cb_params {
+   int     subvect_size;
+   int     nb_subvect;
+   const signed char  *shape_cb;
+   int     shape_bits;
+   int     have_sign;
+} split_cb_params;
+
+
+void split_cb_search_shape_sign(
+spx_word16_t target[],             /* target vector */
+spx_coef_t ak[],                /* LPCs for this subframe */
+spx_coef_t awk1[],              /* Weighted LPCs for this subframe */
+spx_coef_t awk2[],              /* Weighted LPCs for this subframe */
+const void *par,                /* Codebook/search parameters */
+int   p,                        /* number of LPC coeffs */
+int   nsf,                      /* number of samples in subframe */
+spx_sig_t *exc,
+spx_word16_t *r,
+SpeexBits *bits,
+char *stack,
+int   complexity,
+int   update_target
+);
+
+void split_cb_shape_sign_unquant(
+spx_sig_t *exc,
+const void *par,                /* non-overlapping codebook */
+int   nsf,                      /* number of samples in subframe */
+SpeexBits *bits,
+char *stack,
+spx_int32_t *seed
+);
+
+
+void noise_codebook_quant(
+spx_word16_t target[],             /* target vector */
+spx_coef_t ak[],                /* LPCs for this subframe */
+spx_coef_t awk1[],              /* Weighted LPCs for this subframe */
+spx_coef_t awk2[],              /* Weighted LPCs for this subframe */
+const void *par,                /* Codebook/search parameters */
+int   p,                        /* number of LPC coeffs */
+int   nsf,                      /* number of samples in subframe */
+spx_sig_t *exc,
+spx_word16_t *r,
+SpeexBits *bits,
+char *stack,
+int   complexity,
+int   update_target
+);
+
+
+void noise_codebook_unquant(
+spx_sig_t *exc,
+const void *par,                /* non-overlapping codebook */
+int   nsf,                      /* number of samples in subframe */
+SpeexBits *bits,
+char *stack,
+spx_int32_t *seed
+);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_arm4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,137 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file cb_search_arm4.h
+   @brief Fixed codebook functions (ARM4 version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/* This optimization is temporaly disabled until it is fixed to account for the fact 
+   that "r" is now a 16-bit array */
+#if 0
+#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
+static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
+{
+   int i, j, k;
+  //const signed char *shape;
+   for (i=0;i<shape_cb_size;i+=4)
+   {
+
+      //shape = shape_cb;
+      E[0]=0;
+      E[1]=0;
+      E[2]=0;
+      E[3]=0;
+
+      /* Compute codeword response using convolution with impulse response */
+      for(j=0;j<subvect_size;j++)
+      {
+#if 1
+          spx_word16_t *res;
+          res = resp+j;
+          spx_word32_t resj0,resj1,resj2,resj3;
+          spx_word32_t dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
+          __asm__ __volatile__ (
+                "mov %0, #0 \n\t"
+                "mov %1, #0 \n\t"
+                "mov %2, #0 \n\t"
+                "mov %3, #0 \n\t"
+                ".weighted%=: \n\t"
+                "ldrsb %8, [%6] \n\t"
+                "ldr %10, [%5], #-4 \n\t"
+                "mov %9, %6 \n\t"
+                "ldrsb %11, [%9, %7]! \n\t"
+                "mla %0, %10, %8, %0 \n\t"
+                "ldrsb %8, [%9, %7]! \n\t"
+                "mla %1, %10, %11, %1 \n\t"
+                "ldrsb %11, [%9, %7]! \n\t"
+                "mla %2, %10, %8, %2 \n\t"
+                "subs %4, %4, #1 \n\t"
+                "mla %3, %10, %11, %3 \n\t"
+                "add %6, %6, #1 \n\t"
+                "bne .weighted%= \n\t"
+            : "=r" (resj0), "=r" (resj1), "=r" (resj2), "=r" (resj3),
+          "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
+          "=r" (dead5), "=r" (dead6), "=r" (dead7), "=r" (dead8)
+            : "4" (j+1), "5" (r+j), "6" (shape_cb), "7" (subvect_size)
+            : "cc", "memory");
+#else
+          spx_word16_t *res;
+          res = resp+j;
+          spx_word32_t resj0=0;
+          spx_word32_t resj1=0;
+          spx_word32_t resj2=0;
+          spx_word32_t resj3=0;
+          for (k=0;k<=j;k++)
+          {
+             const signed char *shape=shape_cb+k;
+             resj0 = MAC16_16(resj0,*shape,r[j-k]);
+             shape += subvect_size;
+             resj1 = MAC16_16(resj1,*shape,r[j-k]);
+             shape += subvect_size;
+             resj2 = MAC16_16(resj2,*shape,r[j-k]);
+             shape += subvect_size;
+             resj3 = MAC16_16(resj3,*shape,r[j-k]);
+             shape += subvect_size;
+          }
+#endif
+
+#ifdef FIXED_POINT
+          resj0 = SHR(resj0, 11);
+          resj1 = SHR(resj1, 11);
+          resj2 = SHR(resj2, 11);
+          resj3 = SHR(resj3, 11);
+#else
+          resj0 *= 0.03125;
+          resj1 *= 0.03125;
+          resj2 *= 0.03125;
+          resj3 *= 0.03125;
+#endif
+
+          /* Compute codeword energy */
+          E[0]=ADD32(E[0],MULT16_16(resj0,resj0));
+          E[1]=ADD32(E[1],MULT16_16(resj1,resj1));
+          E[2]=ADD32(E[2],MULT16_16(resj2,resj2));
+          E[3]=ADD32(E[3],MULT16_16(resj3,resj3));
+          *res = resj0;
+          res += subvect_size;
+          *res = resj1;
+          res += subvect_size;
+          *res = resj2;
+          res += subvect_size;
+          *res = resj3;
+          res += subvect_size;
+      }
+      resp += subvect_size<<2;
+      shape_cb += subvect_size<<2;
+      E+=4;
+   }
+
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,112 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @author Jean-Marc Valin 
+   @file cb_search_bfin.h
+   @brief Fixed codebook functions (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK 
+void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
+{
+   int i;
+   for (i=0;i<shape_cb_size;i++)
+   {
+      __asm__ __volatile__ (
+         "P0 = %0;\n\t"
+         "LC0 = P0;\n\t"
+         "P1 = %1;\n\t"
+         "P2 = %2;\n\t"
+         "P3 = %3;\n\t"
+         "P0 = 1;\n\t"
+         "L0 = 0;\n\t"
+         "L1 = 0;\n\t"
+         "R2 = 0;\n\t"
+         "A1 = 0;\n\t"
+         "LOOP outter%= LC0;\n\t"
+         "LOOP_BEGIN outter%=;\n\t"
+            "A0 = 0;\n\t"
+            "P4 = P1;\n\t"
+            "I1 = P2;\n\t"
+            "R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
+            "LOOP inner%= LC1 = P0;\n\t"
+            "LOOP_BEGIN inner%=;\n\t"
+               "A0 += R0.L*R1.L (IS) || R0 = B[P4++] (X) || R1.L = W[I1--];\n\t"
+            "LOOP_END inner%=;\n\t"
+            "R0 = A0;\n\t"
+            "R0 >>>= 13;\n\t"
+            "A1 += R0.L*R0.L (IS);\n\t"
+            "W[P3++] = R0;\n\t"
+            "P0 += 1;\n\t"
+            "P2 += 2;\n\t"
+         "LOOP_END outter%=;\n\t"
+         "P4 = %4;\n\t"
+         "R1 = A1;\n\t"
+         "[P4] = R1;\n\t"
+         :
+      : "m" (subvect_size), "m" (shape_cb), "m" (r), "m" (resp), "m" (E)
+      : "A0", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "I0", "I1", "L0", 
+        "L1", "A0", "A1", "memory"
+#if !(__GNUC__ == 3)
+         , "LC0", "LC1" /* gcc 3.4 doesn't know about LC registers */
+#endif
+      );
+      shape_cb += subvect_size;
+      resp += subvect_size;
+      E++;
+   }
+}
+
+#define OVERRIDE_TARGET_UPDATE
+static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
+{
+   if (!len)
+      return;
+   __asm__ __volatile__
+         (
+         "I0 = %0;\n\t"
+         "I1 = %1;\n\t"
+         "L0 = 0;\n\t"
+         "L1 = 0;\n\t"
+         "R2 = 4096;\n\t"
+         "LOOP tupdate%= LC0 = %3;\n\t"
+         "LOOP_BEGIN tupdate%=;\n\t"
+            "R0.L = W[I0] || R1.L = W[I1++];\n\t"
+            "R1 = (A1 = R1.L*%2.L) (IS);\n\t"
+            "R1 = R1 + R2;\n\t"
+            "R1 >>>= 13;\n\t"
+            "R0.L = R0.L - R1.L;\n\t"
+            "W[I0++] = R0.L;\n\t"
+         "LOOP_END tupdate%=;\n\t"
+   :
+   : "a" (t), "a" (r), "d" (g), "a" (len)
+   : "R0", "R1", "R2", "A1", "I0", "I1", "L0", "L1"
+         );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/cb_search_sse.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,84 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file cb_search_sse.h
+   @brief Fixed codebook functions (SSE version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <xmmintrin.h>
+
+static inline void _spx_mm_getr_ps (__m128 U, float *__Z, float *__Y, float *__X, float *__W)
+{
+  union {
+    float __a[4];
+    __m128 __v;
+  } __u;
+  
+  __u.__v = U;
+
+  *__Z = __u.__a[0];
+  *__Y = __u.__a[1];
+  *__X = __u.__a[2];
+  *__W = __u.__a[3];
+
+}
+
+#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
+static void compute_weighted_codebook(const signed char *shape_cb, const spx_sig_t *_r, float *resp, __m128 *resp2, __m128 *E, int shape_cb_size, int subvect_size, char *stack)
+{
+   int i, j, k;
+   __m128 resj, EE;
+   VARDECL(__m128 *r);
+   VARDECL(__m128 *shape);
+   ALLOC(r, subvect_size, __m128);
+   ALLOC(shape, subvect_size, __m128);
+   for(j=0;j<subvect_size;j++)
+      r[j] = _mm_load_ps1(_r+j);
+   for (i=0;i<shape_cb_size;i+=4)
+   {
+      float *_res = resp+i*subvect_size;
+      const signed char *_shape = shape_cb+i*subvect_size;
+      EE = _mm_setzero_ps();
+      for(j=0;j<subvect_size;j++)
+      {
+         shape[j] = _mm_setr_ps(0.03125*_shape[j], 0.03125*_shape[subvect_size+j], 0.03125*_shape[2*subvect_size+j], 0.03125*_shape[3*subvect_size+j]);
+      }
+      for(j=0;j<subvect_size;j++)
+      {
+         resj = _mm_setzero_ps();
+         for (k=0;k<=j;k++)
+            resj = _mm_add_ps(resj, _mm_mul_ps(shape[k],r[j-k]));
+         _spx_mm_getr_ps(resj, _res+j, _res+subvect_size+j, _res+2*subvect_size+j, _res+3*subvect_size+j);
+         *resp2++ = resj;
+         EE = _mm_add_ps(EE, _mm_mul_ps(resj, resj));
+      }
+      E[i>>2] = EE;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fftwrap.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,58 @@
+/* Copyright (C) 2005 Jean-Marc Valin 
+   File: fftwrap.h
+
+   Wrapper for various FFTs 
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef FFTWRAP_H
+#define FFTWRAP_H
+
+#include "misc.h"
+
+/** Compute tables for an FFT */
+void *spx_fft_init(int size);
+
+/** Destroy tables for an FFT */
+void spx_fft_destroy(void *table);
+
+/** Forward (real to half-complex) transform */
+void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out);
+
+/** Backward (half-complex to real) transform */
+void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out);
+
+/** Forward (real to half-complex) transform of float data */
+void spx_fft_float(void *table, float *in, float *out);
+
+/** Backward (half-complex to real) transform of float data */
+void spx_ifft_float(void *table, float *in, float *out);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filterbank.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,66 @@
+/* Copyright (C) 2006 Jean-Marc Valin */
+/**
+   @file filterbank.h
+   @brief Converting between psd and filterbank
+ */
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+   3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FILTERBANK_H
+#define FILTERBANK_H
+
+#include "misc.h"
+
+typedef struct {
+   int *bank_left;
+   int *bank_right;
+   spx_word16_t *filter_left;
+   spx_word16_t *filter_right;
+#ifndef FIXED_POINT
+   float *scaling;
+#endif
+   int nb_banks;
+   int len;
+} FilterBank;
+
+
+FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type);
+
+void filterbank_destroy(FilterBank *bank);
+
+void filterbank_compute_bank32(FilterBank *bank, spx_word32_t *ps, spx_word32_t *mel);
+
+void filterbank_compute_psd16(FilterBank *bank, spx_word16_t *mel, spx_word16_t *psd);
+
+#ifndef FIXED_POINT
+void filterbank_compute_bank(FilterBank *bank, float *psd, float *mel);
+void filterbank_compute_psd(FilterBank *bank, float *mel, float *psd);
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,90 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file filters.h
+   @brief Various analysis/synthesis filters
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FILTERS_H
+#define FILTERS_H
+
+#include "misc.h"
+
+spx_word16_t compute_rms(const spx_sig_t *x, int len);
+spx_word16_t compute_rms16(const spx_word16_t *x, int len);
+void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len);
+void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len);
+
+#ifdef FIXED_POINT
+
+int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len);
+
+#endif
+
+
+#define HIGHPASS_NARROWBAND 0
+#define HIGHPASS_WIDEBAND 2
+#define HIGHPASS_INPUT 0
+#define HIGHPASS_OUTPUT 1
+#define HIGHPASS_IRS 4
+
+void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem);
+
+
+void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
+void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word32_t *mem1, spx_word32_t *mem2, char *stack);
+
+void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
+void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
+void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
+
+/* Apply bandwidth expansion on LPC coef */
+void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order);
+void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len);
+
+
+void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
+void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
+
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
+
+void multicomb(
+spx_word16_t *exc,          /*decoded excitation*/
+spx_word16_t *new_exc,      /*enhanced excitation*/
+spx_coef_t *ak,           /*LPC filter coefs*/
+int p,               /*LPC order*/
+int nsf,             /*sub-frame size*/
+int pitch,           /*pitch period*/
+int max_pitch,   /*pitch gain (3-tap)*/
+spx_word16_t  comb_gain,    /*gain of comb filter*/
+char *stack
+);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_arm4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,96 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file filters_arm4.h
+   @brief Various analysis/synthesis filters (ARM4 version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_NORMALIZE16
+int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
+{
+   spx_sig_t max_val=1;
+   int sig_shift;
+   int dead1, dead2, dead3, dead4, dead5, dead6;
+
+   __asm__ __volatile__ (
+         "\tmov %1, #1 \n"
+         "\tmov %3, #0 \n"
+
+         ".normalize16loop1%=: \n"
+
+         "\tldr %4, [%0], #4 \n"
+         "\tcmps %4, %1 \n"
+         "\tmovgt %1, %4 \n"
+         "\tcmps %4, %3 \n"
+         "\tmovlt %3, %4 \n"
+
+         "\tsubs %2, %2, #1 \n"
+         "\tbne .normalize16loop1%=\n"
+
+         "\trsb %3, %3, #0 \n"
+         "\tcmp %1, %3 \n"
+         "\tmovlt %1, %3 \n"
+   : "=r" (dead1), "=r" (max_val), "=r" (dead3), "=r" (dead4),
+   "=r" (dead5), "=r" (dead6)
+   : "0" (x), "2" (len)
+   : "cc");
+
+   sig_shift=0;
+   while (max_val>max_scale)
+   {
+      sig_shift++;
+      max_val >>= 1;
+   }
+   
+   __asm__ __volatile__ (
+         ".normalize16loop%=: \n"
+
+         "\tldr %4, [%0], #4 \n"
+         "\tldr %5, [%0], #4 \n"
+         "\tmov %4, %4, asr %3 \n"
+         "\tstrh %4, [%1], #2 \n"
+         "\tldr %4, [%0], #4 \n"
+         "\tmov %5, %5, asr %3 \n"
+         "\tstrh %5, [%1], #2 \n"
+         "\tldr %5, [%0], #4 \n"
+         "\tmov %4, %4, asr %3 \n"
+         "\tstrh %4, [%1], #2 \n"
+         "\tsubs %2, %2, #1 \n"
+         "\tmov %5, %5, asr %3 \n"
+         "\tstrh %5, [%1], #2 \n"
+
+         "\tbge .normalize16loop%=\n"
+   : "=r" (dead1), "=r" (dead2), "=r" (dead3), "=r" (dead4),
+   "=r" (dead5), "=r" (dead6)
+   : "0" (x), "1" (y), "2" (len>>2), "3" (sig_shift)
+   : "cc", "memory");
+   return sig_shift;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,515 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @file filters_bfin.h
+   @brief Various analysis/synthesis filters (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_NORMALIZE16
+int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
+{
+   spx_sig_t max_val=1;
+   int sig_shift;
+   __asm__ 
+   (
+   "%0 = 0;\n\t"
+   "I0 = %1;\n\t"
+   "L0 = 0;\n\t"
+   "R1 = [I0++];\n\t"
+   "LOOP norm_max%= LC0 = %2;\n\t"
+   "LOOP_BEGIN norm_max%=;\n\t"
+      "R2 = ABS R1 || R1 = [I0++];\n\t"
+      "%0 = MAX(%0, R2);\n\t"
+   "LOOP_END norm_max%=;\n\t"
+   : "=&d" (max_val)
+   : "a" (x), "a" (len)
+   : "R1", "R2"
+   );
+
+   sig_shift=0;
+   while (max_val>max_scale)
+   {
+      sig_shift++;
+      max_val >>= 1;
+   }
+
+   __asm__ __volatile__ 
+   (
+   "I0 = %0;\n\t"
+   "L0 = 0;\n\t"
+   "P1 = %1;\n\t"
+   "R0 = [I0++];\n\t"
+   "LOOP norm_shift%= LC0 = %3;\n\t"
+   "LOOP_BEGIN norm_shift%=;\n\t"
+      "R1 = ASHIFT R0 by %2.L || R0 = [I0++];\n\t"
+      "W[P1++] = R1;\n\t"
+   "LOOP_END norm_shift%=;\n\t"
+   "R1 = ASHIFT R0 by %2.L;\n\t"
+   "W[P1++] = R1;\n\t"
+   : : "a" (x), "a" (y), "d" (-sig_shift), "a" (len-1)
+   : "I0", "L0", "P1", "R0", "R1", "memory"
+   );
+   return sig_shift;
+}
+
+
+
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+   VARDECL(spx_word32_t *xy2);
+   VARDECL(spx_word32_t *numden_a);
+   spx_word32_t *xy;
+   spx_word16_t *numden;
+   int i;
+
+   ALLOC(xy2, (N+1), spx_word32_t);
+   ALLOC(numden_a, (2*ord+2), spx_word32_t);
+   xy = xy2+1;  
+   numden = (spx_word16_t*) numden_a;
+
+   for (i=0;i<ord;i++)
+   {
+      numden[2*i] = num[i];
+      numden[2*i+1] = den[i];
+   }
+   __asm__ __volatile__
+   (
+   /* Register setup */
+   "R0 = %5;\n\t"      /*ord */
+   
+   "P0 = %3;\n\t"
+   "I0 = P0;\n\t"
+   "B0 = P0;\n\t" /* numden */
+   "L0 = 0;\n\t"
+      
+   "P2 = %0;\n\t" /* Fused xy */
+   "I2 = P2;\n\t"
+   "L2 = 0;\n\t"
+   
+   "P4 = %6;\n\t" /* mem */
+   "P0 = %1;\n\t" /* _x */
+   "P1 = %2;\n\t" /* _y */
+   
+   /* First sample */
+   "R1 = [P4++];\n\t"
+   "R1 <<= 3;\n\t" /* shift mem */
+   "R1.L = R1 (RND);\n\t"
+   "R2 = W[P0++];\n\t" /* load x[0] */
+   "R1.L = R1.L + R2.L;\n\t"
+   "W[P1++] = R1;\n\t" /* store y[0] */
+   "R2 = PACK(R1.L, R2.L);\n\t" /* pack x16 and y16 */
+   "[P2] = R2;\n\t"
+               
+   /* Samples 1 to ord-1 (using memory) */
+   "R0 += -1;\n\t"
+   "R3 = 0;\n\t"
+   "LC0 = R0;\n\t"
+   "LOOP filter_start%= LC0;\n\t"
+   "LOOP_BEGIN filter_start%=;\n\t"
+      "R3 += 1;\n\t"
+      "LC1 = R3;\n\t"
+      
+      "R1 = [P4++];\n\t"
+      "A1 = R1;\n\t"
+      "A0 = 0;\n\t"
+      "I0 = B0;\n\t"
+      "I2 = P2;\n\t"
+      "P2 += 4;\n\t"
+      "R4 = [I0++] || R5 = [I2--];\n\t"
+      "LOOP filter_start_inner%= LC1;\n\t"
+      "LOOP_BEGIN filter_start_inner%=;\n\t"
+         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+      "LOOP_END filter_start_inner%=;\n\t"
+      "A0 += A1;\n\t"
+      "R4 = A0;\n\t"
+      "R4 <<= 3;\n\t" /* shift mem */
+      "R4.L = R4 (RND);\n\t"
+      "R2 = W[P0++];\n\t" /* load x */
+      "R4.L = R4.L + R2.L;\n\t"
+      "W[P1++] = R4;\n\t" /* store y */
+      //"R4 <<= 2;\n\t"
+      //"R2 <<= 2;\n\t"
+      "R2 = PACK(R4.L, R2.L);\n\t" /* pack x16 and y16 */
+      "[P2] = R2;\n\t"
+
+   "LOOP_END filter_start%=;\n\t"
+
+   /* Samples ord to N*/   
+   "R0 = %5;\n\t"
+   "R0 <<= 1;\n\t"
+   "I0 = B0;\n\t" /* numden */
+   "R0 <<= 1;\n\t"   
+   "L0 = R0;\n\t"
+   
+   "R0 = %5;\n\t" /* org */
+   "R2 = %4;\n\t" /* N */
+   "R2 = R2 - R0;\n\t"
+   "R4 = [I0++];\n\t" /* numden */
+   "LC0 = R2;\n\t"
+   "P3 = R0;\n\t"
+   "R0 <<= 2;\n\t"
+   "R0 += 8;\n\t"
+   "I2 = P2;\n\t"
+   "M0 = R0;\n\t"
+   "A1 = A0 = 0;\n\t"
+   "R5 = [I2--];\n\t" /* load xy */
+   "LOOP filter_mid%= LC0;\n\t"
+   "LOOP_BEGIN filter_mid%=;\n\t"
+      "LOOP filter_mid_inner%= LC1=P3;\n\t"
+      "LOOP_BEGIN filter_mid_inner%=;\n\t"
+         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+      "LOOP_END filter_mid_inner%=;\n\t"
+      "R0 = (A0 += A1) || I2 += M0;\n\t"
+      "R0 = R0 << 3 || R5 = W[P0++];\n\t" /* load x */
+      "R0.L = R0 (RND);\n\t"
+      "R0.L = R0.L + R5.L;\n\t"
+      "R5 = PACK(R0.L, R5.L) || W[P1++] = R0;\n\t" /* shift y | store y */
+      "A1 = A0 = 0 || [I2--] = R5\n\t"
+      "LOOP_END filter_mid%=;\n\t"
+   "I2 += 4;\n\t"
+   "P2 = I2;\n\t"
+   /* Update memory */
+   "P4 = %6;\n\t"
+   "R0 = %5;\n\t"
+   "LC0 = R0;\n\t"
+   "P0 = B0;\n\t"
+   "A1 = A0 = 0;\n\t"
+   "LOOP mem_update%= LC0;\n\t"
+   "LOOP_BEGIN mem_update%=;\n\t"
+      "I2 = P2;\n\t"
+      "I0 = P0;\n\t"
+      "P0 += 4;\n\t"
+      "R0 = LC0;\n\t"
+      "LC1 = R0;\n\t"
+      "R5 = [I2--] || R4 = [I0++];\n\t"
+      "LOOP mem_accum%= LC1;\n\t"
+      "LOOP_BEGIN mem_accum%=;\n\t"
+         "A1 -= R4.H*R5.H, A0 += R4.L*R5.L (IS) || R4 = [I0++] || R5 = [I2--];\n\t"
+      "LOOP_END mem_accum%=;\n\t"
+      "R0 = (A0 += A1);\n\t"
+      "A1 = A0 = 0 || [P4++] = R0;\n\t"
+   "LOOP_END mem_update%=;\n\t"
+   "L0 = 0;\n\t"
+   : : "m" (xy), "m" (_x), "m" (_y), "m" (numden), "m" (N), "m" (ord), "m" (mem)
+   : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B0", "I0", "I2", "L0", "L2", "M0", "memory"
+   );
+
+}
+
+
+
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const spx_word16_t *_x, const spx_coef_t *den, spx_word16_t *_y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+   VARDECL(spx_word16_t *y);
+   spx_word16_t *yy;
+
+   ALLOC(y, (N+2), spx_word16_t);
+   yy = y+2;
+
+   __asm__ __volatile__
+   (
+   /* Register setup */
+   "R0 = %5;\n\t"      /*ord */
+   
+   "P1 = %3;\n\t"
+   "I1 = P1;\n\t"
+   "B1 = P1;\n\t"
+   "L1 = 0;\n\t"
+   
+   "P3 = %0;\n\t"
+   "I3 = P3;\n\t"
+   "L3 = 0;\n\t"
+   
+   "P4 = %6;\n\t"
+   "P0 = %1;\n\t"
+   "P1 = %2;\n\t"
+   
+   /* First sample */
+   "R1 = [P4++];\n\t"
+   "R1 = R1 << 3 (S);\n\t"
+   "R1.L = R1 (RND);\n\t"
+   "R2 = W[P0++];\n\t"
+   "R1 = R1 + R2;\n\t"
+   "W[P1++] = R1;\n\t"
+   "W[P3] = R1;\n\t"
+
+   /* Samples 1 to ord-1 (using memory) */
+   "R0 += -1;\n\t"
+   "R3 = 0;\n\t"
+   "LC0 = R0;\n\t"
+   "LOOP filter_start%= LC0;\n\t"
+   "LOOP_BEGIN filter_start%=;\n\t"
+      "R3 += 1;\n\t"
+      "LC1 = R3;\n\t"
+      
+      "R1 = [P4++];\n\t"
+      "A1 = R1;\n\t"
+      "I1 = B1;\n\t"
+      "I3 = P3;\n\t"
+      "P3 += 2;\n\t"
+      "LOOP filter_start_inner%= LC1;\n\t"
+      "LOOP_BEGIN filter_start_inner%=;\n\t"
+         "R4.L = W[I1++];\n\t"
+         "R5.L = W[I3--];\n\t"
+         "A1 -= R4.L*R5.L (IS);\n\t"
+      "LOOP_END filter_start_inner%=;\n\t"
+   
+      "R1 = A1;\n\t"
+      "R1 <<= 3;\n\t"
+      "R1.L = R1 (RND);\n\t"
+      "R2 = W[P0++];\n\t"
+      "R1 = R1 + R2;\n\t"
+      "W[P1++] = R1;\n\t"
+      "W[P3] = R1;\n\t"
+   "LOOP_END filter_start%=;\n\t"
+
+   /* Samples ord to N*/   
+   "R0 = %5;\n\t"
+   "R0 <<= 1;\n\t"
+   "I1 = B1;\n\t"
+   "L1 = R0;\n\t"
+   
+   "R0 = %5;\n\t"
+   "R2 = %4;\n\t"
+   "R2 = R2 - R0;\n\t"
+   "R4.L = W[I1++];\n\t"
+   "LC0 = R2;\n\t"
+   "LOOP filter_mid%= LC0;\n\t"
+   "LOOP_BEGIN filter_mid%=;\n\t"
+      "LC1 = R0;\n\t"
+      "A1 = 0;\n\t"
+      "I3 = P3;\n\t"
+      "P3 += 2;\n\t"
+      "R5.L = W[I3--];\n\t"
+      "LOOP filter_mid_inner%= LC1;\n\t"
+      "LOOP_BEGIN filter_mid_inner%=;\n\t"
+         "A1 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
+      "LOOP_END filter_mid_inner%=;\n\t"
+      "R1 = A1;\n\t"
+      "R1 = R1 << 3 || R2 = W[P0++];\n\t"
+      "R1.L = R1 (RND);\n\t"
+      "R1 = R1 + R2;\n\t"
+      "W[P1++] = R1;\n\t"
+      "W[P3] = R1;\n\t"
+   "LOOP_END filter_mid%=;\n\t"
+     
+   /* Update memory */
+   "P4 = %6;\n\t"
+   "R0 = %5;\n\t"
+   "LC0 = R0;\n\t"
+   "P1 = B1;\n\t"
+   "LOOP mem_update%= LC0;\n\t"
+   "LOOP_BEGIN mem_update%=;\n\t"
+      "A0 = 0;\n\t"
+      "I3 = P3;\n\t"
+      "I1 = P1;\n\t"
+      "P1 += 2;\n\t"
+      "R0 = LC0;\n\t"
+      "LC1=R0;\n\t"
+      "R5.L = W[I3--] || R4.L = W[I1++];\n\t"
+      "LOOP mem_accum%= LC1;\n\t"
+      "LOOP_BEGIN mem_accum%=;\n\t"
+         "A0 -= R4.L*R5.L (IS) || R4.L = W[I1++] || R5.L = W[I3--];\n\t"
+      "LOOP_END mem_accum%=;\n\t"
+      "R0 = A0;\n\t"
+      "[P4++] = R0;\n\t"
+   "LOOP_END mem_update%=;\n\t"
+   "L1 = 0;\n\t"
+   : : "m" (yy), "m" (_x), "m" (_y), "m" (den), "m" (N), "m" (ord), "m" (mem)
+   : "A0", "A1", "R0", "R1", "R2", "R3", "R4", "R5", "P0", "P1", "P2", "P3", "P4", "B1", "I1", "I3", "L1", "L3", "memory"
+   );
+
+}
+
+
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
+{
+   int i;
+   spx_coef_t den2[12];
+   spx_coef_t *den;
+   den = (spx_coef_t*)((((int)den2)+4)&0xfffffffc);
+   for (i=0;i<10;i++)
+      den[i] = 0;
+   filter_mem16(x, num, den, y, N, ord, mem, stack);
+}
+
+
+#define OVERRIDE_COMPUTE_IMPULSE_RESPONSE
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
+{
+   int i;
+   VARDECL(spx_word16_t *ytmp);
+   ALLOC(ytmp, N, spx_word16_t);
+   spx_word16_t *ytmp2 = ytmp;
+   y[0] = LPC_SCALING;
+   for (i=0;i<ord;i++)
+      y[i+1] = awk1[i];
+   i++;
+   for (;i<N;i++)
+      y[i] = 0;
+
+   N-=1;
+   __asm__ __volatile__
+   (
+         "I0 = %0;\n\t"
+         "I1 = %1;\n\t"
+         "L0 = 0;\n\t"
+         "L1 = 0;\n\t"
+         "L2 = 0;\n\t"
+         "L3 = 0;\n\t"
+         "R0 = 1;\n\t"
+         "R0 <<= 13;\n\t"
+         "W[I0] = R0.L;\n\t"
+         "R0 <<= 1;\n\t"
+         "W[I1] = R0.L;\n\t"
+         "R0 = %5;\n\t"
+         "LC0 = R0;\n\t"
+         "R2 = 0;\n\t"
+         "LOOP samples%= LC0;\n\t"
+         "LOOP_BEGIN samples%=;\n\t"
+            "R2 += 1;\n\t"
+            "R2 = MIN(R2, %4);\n\t"
+            "I0 = %0;\n\t"
+            "I1 = %1;\n\t"
+            "I2 = %2;\n\t"
+            "I3 = %3;\n\t"
+            "%0 += 2;\n\t"
+            "%1 += 2;\n\t"
+            "A1 = A0 = 0;\n\t"
+            "R0.L = W[I0--] || R1.L = W[I2++];\n\t"
+            "LC1 = R2;\n\t"
+            "LOOP filter%= LC1;\n\t"
+            "LOOP_BEGIN filter%=;\n\t"
+               "A0 -= R0.L*R1.L (IS) || R0.L = W[I1--] || R1.L = W[I3++];\n\t"
+               "A1 -= R0.L*R1.L (IS) || R0.L = W[I0--] || R1.L = W[I2++];\n\t"
+            "LOOP_END filter%=;\n\t"
+            "R0 = A0, R1 = A1;\n\t"
+            "R3 = W[%1] (X);\n\t"
+            "R3 <<= 13;\n\t"
+            "R0 = R0 + R3;\n\t"
+            "R3 = R0 >>> 13;\n\t"
+            "W[%0] = R3.L;\n\t"
+            "R0 <<= 1;\n\t"
+            "R1 = R1 + R0;\n\t"
+            "R1 >>>= 13;\n\t"
+            "W[%1] = R1.L;\n\t"
+         "LOOP_END samples%=;\n\t"
+   : "=a" (ytmp2), "=a" (y)
+   : "a" (awk2), "a" (ak), "d" (ord), "m" (N), "0" (ytmp2), "1" (y)
+   : "A0", "A1", "R0", "R1", "R2", "R3", "I0", "I1", "I2", "I3", "L0", "L1", "L2", "L3", "A0", "A1"
+   );
+}
+
+
+
+#if 0 /* Equivalent C function for filter_mem2 and compute_impulse_response */
+#define min(a,b) ((a)<(b) ? (a):(b))
+
+void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
+{
+   int i,j;
+   VARDECL(spx_word16_t *ytmp);
+   ALLOC(ytmp, N, spx_word16_t);
+   
+   y[0] = LPC_SCALING;
+   for (i=0;i<ord;i++)
+      y[i+1] = awk1[i];
+   i++;
+   for (;i<N;i++)
+      y[i] = 0;
+
+   for (i=0;i<N;i++)
+   {
+      spx_word32_t yi = SHL32(EXTEND32(y[i]),LPC_SHIFT);
+      spx_word32_t yi2 = 0;
+      for (j=0;j<min(i,ord);j++)
+      {
+         yi = MAC16_16(yi, awk2[j], -ytmp[i-j-1]);
+         yi2 = MAC16_16(yi2, ak[j], -y[i-j-1]);
+      }
+      ytmp[i] = EXTRACT16(SHR32(yi,LPC_SHIFT));
+      yi2 = ADD32(yi2,SHL32(yi,1));
+      y[i] = EXTRACT16(SHR32(yi2,LPC_SHIFT));
+   }
+
+}
+
+
+void filter_mem2(const spx_sig_t *_x, const spx_coef_t *num, const spx_coef_t *den, spx_sig_t *_y, int N, int ord, spx_mem_t *mem)
+{
+   int i,j;
+   spx_word16_t xi,yi,nyi;
+   spx_word16_t x[N],y[N];
+   spx_word16_t *xx, *yy;
+   xx = x;
+   yy = y;
+   for (i=0;i<N;i++)
+   {
+      x[i] = EXTRACT16(SHR32(_x[i],SIG_SHIFT));
+   }
+   
+   for (i=0;i<ord;i++)
+   {
+      spx_word32_t yi = mem[i];
+      for (j=0;j<i;j++)
+      {
+         yi = MAC16_16(yi, num[j], x[i-j-1]);
+         yi = MAC16_16(yi, den[j], -y[i-j-1]);
+      }
+      _y[i] = ADD32(_x[i],SHL32(yi,1));
+      y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
+   }
+   for (i=ord;i<N;i++)
+   {
+      spx_word32_t yi = 0;
+      for (j=0;j<ord;j++)
+      {
+         yi = MAC16_16(yi, num[j], x[i-j-1]);
+         yi = MAC16_16(yi, den[j], -y[i-j-1]);
+      }
+      _y[i] = ADD32(_x[i],SHL32(yi,1));
+      y[i] = EXTRACT16(SHR32(_y[i],SIG_SHIFT));
+   }
+
+   for (i=0;i<ord;i++)
+   {
+      spx_mem_t m = 0;
+      for (j=0;j<ord-i;j++)
+      {
+         m = MAC16_16(m, x[N-1-j], num[j+i]);
+         m = MAC16_16(m, -y[N-1-j], den[j+i]);
+      }
+      mem[i] = m;
+   }
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/filters_sse.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,336 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file filters_sse.h
+   @brief Various analysis/synthesis filters (SSE version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <xmmintrin.h>
+
+void filter_mem16_10(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[3], den[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
+   den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
+      mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+void filter_mem16_8(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[2], den[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+
+#define OVERRIDE_FILTER_MEM16
+void filter_mem16(const float *x, const float *_num, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      filter_mem16_10(x, _num, _den, y, N, ord, _mem);
+   else if (ord==8)
+      filter_mem16_8(x, _num, _den, y, N, ord, _mem);
+}
+
+
+
+void iir_mem16_10(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 den[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   den[2] = _mm_setr_ps(_den[8], _den[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_sub_ps(mem[2], _mm_mul_ps(yy, den[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+
+void iir_mem16_8(const float *x, const float *_den, float *y, int N, int ord, float *_mem)
+{
+   __m128 den[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      den[i] = _mm_loadu_ps(_den+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_sub_ps(mem[0], _mm_mul_ps(yy, den[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_sub_ps(mem[1], _mm_mul_ps(yy, den[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+#define OVERRIDE_IIR_MEM16
+void iir_mem16(const float *x, const float *_den, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      iir_mem16_10(x, _den, y, N, ord, _mem);
+   else if (ord==8)
+      iir_mem16_8(x, _den, y, N, ord, _mem);
+}
+
+
+void fir_mem16_10(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[3], mem[3];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+   }
+   mem[2] = _mm_setr_ps(_mem[8], _mem[9], 0, 0);
+   num[2] = _mm_setr_ps(_num[8], _num[9], 0, 0);
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+
+      mem[1] = _mm_move_ss(mem[1], mem[2]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+
+      mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0xfd);
+
+      mem[2] = _mm_add_ps(mem[2], _mm_mul_ps(xx, num[2]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+   _mm_store_ss(_mem+8, mem[2]);
+   mem[2] = _mm_shuffle_ps(mem[2], mem[2], 0x55);
+   _mm_store_ss(_mem+9, mem[2]);
+}
+
+void fir_mem16_8(const float *x, const float *_num, float *y, int N, int ord, float *_mem)
+{
+   __m128 num[2], mem[2];
+
+   int i;
+
+   /* Copy numerator, denominator and memory to aligned xmm */
+   for (i=0;i<2;i++)
+   {
+      mem[i] = _mm_loadu_ps(_mem+4*i);
+      num[i] = _mm_loadu_ps(_num+4*i);
+   }
+   
+   for (i=0;i<N;i++)
+   {
+      __m128 xx;
+      __m128 yy;
+      /* Compute next filter result */
+      xx = _mm_load_ps1(x+i);
+      yy = _mm_add_ss(xx, mem[0]);
+      _mm_store_ss(y+i, yy);
+      yy = _mm_shuffle_ps(yy, yy, 0);
+      
+      /* Update memory */
+      mem[0] = _mm_move_ss(mem[0], mem[1]);
+      mem[0] = _mm_shuffle_ps(mem[0], mem[0], 0x39);
+
+      mem[0] = _mm_add_ps(mem[0], _mm_mul_ps(xx, num[0]));
+
+      mem[1] = _mm_sub_ss(mem[1], mem[1]);
+      mem[1] = _mm_shuffle_ps(mem[1], mem[1], 0x39);
+
+      mem[1] = _mm_add_ps(mem[1], _mm_mul_ps(xx, num[1]));
+   }
+   /* Put memory back in its place */
+   _mm_storeu_ps(_mem, mem[0]);
+   _mm_storeu_ps(_mem+4, mem[1]);
+}
+
+#define OVERRIDE_FIR_MEM16
+void fir_mem16(const float *x, const float *_num, float *y, int N, int ord, float *_mem, char *stack)
+{
+   if(ord==10)
+      fir_mem16_10(x, _num, y, N, ord, _mem);
+   else if (ord==8)
+      fir_mem16_8(x, _num, y, N, ord, _mem);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_arm4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,148 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file fixed_arm4.h
+   @brief ARM4 fixed-point operations
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FIXED_ARM4_H
+#define FIXED_ARM4_H
+
+#undef MULT16_32_Q14
+static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) {
+  int res;
+  int dummy;
+  asm (
+        "smull  %0,%1,%2,%3 \n\t"
+        "mov %0, %0, lsr #14 \n\t"
+        "add %0, %0, %1, lsl #18 \n\t"
+   : "=&r"(res), "=&r" (dummy)
+   : "r"(y),"r"((int)x));
+  return(res);
+}
+
+#undef MULT16_32_Q15
+static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
+  int res;
+  int dummy;
+  asm (
+        "smull  %0,%1,%2,%3 \n\t"
+        "mov %0, %0, lsr #15 \n\t"
+        "add %0, %0, %1, lsl #17 \n\t"
+   : "=&r"(res), "=&r" (dummy)
+   : "r"(y),"r"((int)x));
+  return(res);
+}
+
+#undef DIV32_16
+static inline short DIV32_16(int a, int b)
+{
+   int res=0;
+   int dead1, dead2, dead3, dead4, dead5;
+   __asm__ __volatile__ (
+         "\teor %5, %0, %1\n"
+         "\tmovs %4, %0\n"
+         "\trsbmi %0, %0, #0 \n"
+         "\tmovs %4, %1\n"
+         "\trsbmi %1, %1, #0 \n"
+         "\tmov %4, #1\n"
+
+         "\tsubs %3, %0, %1, asl #14 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #14 \n"
+
+         "\tsubs %3, %0, %1, asl #13 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #13 \n"
+
+         "\tsubs %3, %0, %1, asl #12 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #12 \n"
+
+         "\tsubs %3, %0, %1, asl #11 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #11 \n"
+
+         "\tsubs %3, %0, %1, asl #10 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #10 \n"
+
+         "\tsubs %3, %0, %1, asl #9 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #9 \n"
+
+         "\tsubs %3, %0, %1, asl #8 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #8 \n"
+
+         "\tsubs %3, %0, %1, asl #7 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #7 \n"
+
+         "\tsubs %3, %0, %1, asl #6 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #6 \n"
+         
+         "\tsubs %3, %0, %1, asl #5 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #5 \n"
+
+         "\tsubs %3, %0, %1, asl #4 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #4 \n"
+
+         "\tsubs %3, %0, %1, asl #3 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #3 \n"
+
+         "\tsubs %3, %0, %1, asl #2 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #2 \n"
+
+         "\tsubs %3, %0, %1, asl #1 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4, asl #1 \n"
+
+         "\tsubs %3, %0, %1 \n"
+         "\tmovpl %0, %3 \n"
+         "\torrpl %2, %2, %4 \n"
+
+         "\tmovs %5, %5, lsr #31 \n"
+         "\trsbne %2, %2, #0 \n"
+   : "=r" (dead1), "=r" (dead2), "=r" (res),
+   "=r" (dead3), "=r" (dead4), "=r" (dead5)
+   : "0" (a), "1" (b), "2" (res)
+   : "cc"
+                        );
+   return res;
+}
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_arm5e.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,178 @@
+/* Copyright (C) 2003 Jean-Marc Valin */
+/**
+   @file fixed_arm5e.h
+   @brief ARM-tuned fixed-point operations
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FIXED_ARM5E_H
+#define FIXED_ARM5E_H
+
+#undef MULT16_16
+static inline spx_word32_t MULT16_16(spx_word16_t x, spx_word16_t y) {
+  int res;
+  asm ("smulbb  %0,%1,%2;\n"
+              : "=&r"(res)
+              : "%r"(x),"r"(y));
+  return(res);
+}
+
+#undef MAC16_16
+static inline spx_word32_t MAC16_16(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
+  int res;
+  asm ("smlabb  %0,%1,%2,%3;\n"
+              : "=&r"(res)
+               : "%r"(x),"r"(y),"r"(a));
+  return(res);
+}
+
+#undef MULT16_32_Q15
+static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) {
+  int res;
+  asm ("smulwb  %0,%1,%2;\n"
+              : "=&r"(res)
+               : "%r"(y<<1),"r"(x));
+  return(res);
+}
+
+#undef MAC16_32_Q15
+static inline spx_word32_t MAC16_32_Q15(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
+  int res;
+  asm ("smlawb  %0,%1,%2,%3;\n"
+              : "=&r"(res)
+               : "%r"(y<<1),"r"(x),"r"(a));
+  return(res);
+}
+
+#undef MULT16_32_Q11
+static inline spx_word32_t MULT16_32_Q11(spx_word16_t x, spx_word32_t y) {
+  int res;
+  asm ("smulwb  %0,%1,%2;\n"
+              : "=&r"(res)
+               : "%r"(y<<5),"r"(x));
+  return(res);
+}
+
+#undef MAC16_32_Q11
+static inline spx_word32_t MAC16_32_Q11(spx_word32_t a, spx_word16_t x, spx_word32_t y) {
+  int res;
+  asm ("smlawb  %0,%1,%2,%3;\n"
+              : "=&r"(res)
+               : "%r"(y<<5),"r"(x),"r"(a));
+  return(res);
+}
+
+#undef DIV32_16
+static inline short DIV32_16(int a, int b)
+{
+   int res=0;
+   int dead1, dead2, dead3, dead4, dead5;
+   __asm__ __volatile__ (
+         "\teor %5, %0, %1\n"
+         "\tmovs %4, %0\n"
+         "\trsbmi %0, %0, #0 \n"
+         "\tmovs %4, %1\n"
+         "\trsbmi %1, %1, #0 \n"
+         "\tmov %4, #1\n"
+
+         "\tsubs %3, %0, %1, asl #14 \n"
+         "\torrpl %2, %2, %4, asl #14 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #13 \n"
+         "\torrpl %2, %2, %4, asl #13 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #12 \n"
+         "\torrpl %2, %2, %4, asl #12 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #11 \n"
+         "\torrpl %2, %2, %4, asl #11 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #10 \n"
+         "\torrpl %2, %2, %4, asl #10 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #9 \n"
+         "\torrpl %2, %2, %4, asl #9 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #8 \n"
+         "\torrpl %2, %2, %4, asl #8 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #7 \n"
+         "\torrpl %2, %2, %4, asl #7 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #6 \n"
+         "\torrpl %2, %2, %4, asl #6 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #5 \n"
+         "\torrpl %2, %2, %4, asl #5 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #4 \n"
+         "\torrpl %2, %2, %4, asl #4 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #3 \n"
+         "\torrpl %2, %2, %4, asl #3 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #2 \n"
+         "\torrpl %2, %2, %4, asl #2 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1, asl #1 \n"
+         "\torrpl %2, %2, %4, asl #1 \n"
+         "\tmovpl %0, %3 \n"
+
+         "\tsubs %3, %0, %1 \n"
+         "\torrpl %2, %2, %4 \n"
+         "\tmovpl %0, %3 \n"
+         
+         "\tmovs %5, %5, lsr #31 \n"
+         "\trsbne %2, %2, #0 \n"
+   : "=r" (dead1), "=r" (dead2), "=r" (res),
+   "=r" (dead3), "=r" (dead4), "=r" (dead5)
+   : "0" (a), "1" (b), "2" (res)
+   : "memory", "cc"
+                        );
+   return res;
+}
+
+
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,173 @@
+/* Copyright (C) 2005 Analog Devices
+   Author: Jean-Marc Valin */
+/**
+   @file fixed_bfin.h
+   @brief Blackfin fixed-point operations
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FIXED_BFIN_H
+#define FIXED_BFIN_H
+
+#undef PDIV32_16
+static inline spx_word16_t PDIV32_16(spx_word32_t a, spx_word16_t b)
+{
+   spx_word32_t res, bb;
+   bb = b;
+   a += b>>1;
+   __asm__  (
+         "P0 = 15;\n\t"
+         "R0 = %1;\n\t"
+         "R1 = %2;\n\t"
+         //"R0 = R0 + R1;\n\t"
+         "R0 <<= 1;\n\t"
+         "DIVS (R0, R1);\n\t"
+         "LOOP divide%= LC0 = P0;\n\t"
+         "LOOP_BEGIN divide%=;\n\t"
+            "DIVQ (R0, R1);\n\t"
+         "LOOP_END divide%=;\n\t"
+         "R0 = R0.L;\n\t"
+         "%0 = R0;\n\t"
+   : "=m" (res)
+   : "m" (a), "m" (bb)
+   : "P0", "R0", "R1", "cc");
+   return res;
+}
+
+#undef DIV32_16
+static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b)
+{
+   spx_word32_t res, bb;
+   bb = b;
+   /* Make the roundinf consistent with the C version 
+      (do we need to do that?)*/
+   if (a<0) 
+      a += (b-1);
+   __asm__  (
+         "P0 = 15;\n\t"
+         "R0 = %1;\n\t"
+         "R1 = %2;\n\t"
+         "R0 <<= 1;\n\t"
+         "DIVS (R0, R1);\n\t"
+         "LOOP divide%= LC0 = P0;\n\t"
+         "LOOP_BEGIN divide%=;\n\t"
+            "DIVQ (R0, R1);\n\t"
+         "LOOP_END divide%=;\n\t"
+         "R0 = R0.L;\n\t"
+         "%0 = R0;\n\t"
+   : "=m" (res)
+   : "m" (a), "m" (bb)
+   : "P0", "R0", "R1", "cc");
+   return res;
+}
+
+#undef MAX16
+static inline spx_word16_t MAX16(spx_word16_t a, spx_word16_t b)
+{
+   spx_word32_t res;
+   __asm__  (
+         "%1 = %1.L (X);\n\t"
+         "%2 = %2.L (X);\n\t"
+         "%0 = MAX(%1,%2);"
+   : "=d" (res)
+   : "%d" (a), "d" (b)
+   );
+   return res;
+}
+
+#undef MULT16_32_Q15
+static inline spx_word32_t MULT16_32_Q15(spx_word16_t a, spx_word32_t b)
+{
+   spx_word32_t res;
+   __asm__
+   (
+         "A1 = %2.L*%1.L (M);\n\t"
+         "A1 = A1 >>> 15;\n\t"
+         "%0 = (A1 += %2.L*%1.H) ;\n\t"
+   : "=&W" (res), "=&d" (b)
+   : "d" (a), "1" (b)
+   : "A1"
+   );
+   return res;
+}
+
+#undef MAC16_32_Q15
+static inline spx_word32_t MAC16_32_Q15(spx_word32_t c, spx_word16_t a, spx_word32_t b)
+{
+   spx_word32_t res;
+   __asm__
+         (
+         "A1 = %2.L*%1.L (M);\n\t"
+         "A1 = A1 >>> 15;\n\t"
+         "%0 = (A1 += %2.L*%1.H);\n\t"
+         "%0 = %0 + %4;\n\t"
+   : "=&W" (res), "=&d" (b)
+   : "d" (a), "1" (b), "d" (c)
+   : "A1"
+         );
+   return res;
+}
+
+#undef MULT16_32_Q14
+static inline spx_word32_t MULT16_32_Q14(spx_word16_t a, spx_word32_t b)
+{
+   spx_word32_t res;
+   __asm__
+         (
+         "%2 <<= 1;\n\t"
+         "A1 = %1.L*%2.L (M);\n\t"
+         "A1 = A1 >>> 15;\n\t"
+         "%0 = (A1 += %1.L*%2.H);\n\t"
+   : "=W" (res), "=d" (a), "=d" (b)
+   : "1" (a), "2" (b)
+   : "A1"
+         );
+   return res;
+}
+
+#undef MAC16_32_Q14
+static inline spx_word32_t MAC16_32_Q14(spx_word32_t c, spx_word16_t a, spx_word32_t b)
+{
+   spx_word32_t res;
+   __asm__
+         (
+         "%1 <<= 1;\n\t"
+         "A1 = %2.L*%1.L (M);\n\t"
+         "A1 = A1 >>> 15;\n\t"
+         "%0 = (A1 += %2.L*%1.H);\n\t"
+         "%0 = %0 + %4;\n\t"
+   : "=&W" (res), "=&d" (b)
+   : "d" (a), "1" (b), "d" (c)
+   : "A1"
+         );
+   return res;
+}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_debug.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,487 @@
+/* Copyright (C) 2003 Jean-Marc Valin */
+/**
+   @file fixed_debug.h
+   @brief Fixed-point operations with debugging
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FIXED_DEBUG_H
+#define FIXED_DEBUG_H
+
+#include <stdio.h>
+
+extern long long spx_mips;
+#define MIPS_INC spx_mips++,
+
+#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
+#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
+
+
+#define VERIFY_SHORT(x) ((x)<=32767&&(x)>=-32768)
+#define VERIFY_INT(x) ((x)<=2147483647LL&&(x)>=-2147483648LL)
+
+static inline short NEG16(int x)
+{
+   int res;
+   if (!VERIFY_SHORT(x))
+   {
+      fprintf (stderr, "NEG16: input is not short: %d\n", (int)x);
+   }
+   res = -x;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "NEG16: output is not short: %d\n", (int)res);
+   spx_mips++;
+   return res;
+}
+static inline int NEG32(long long x)
+{
+   long long res;
+   if (!VERIFY_INT(x))
+   {
+      fprintf (stderr, "NEG16: input is not int: %d\n", (int)x);
+   }
+   res = -x;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "NEG16: output is not int: %d\n", (int)res);
+   spx_mips++;
+   return res;
+}
+
+#define EXTRACT16(x) _EXTRACT16(x, __FILE__, __LINE__)
+static inline short _EXTRACT16(int x, char *file, int line)
+{
+   int res;
+   if (!VERIFY_SHORT(x))
+   {
+      fprintf (stderr, "EXTRACT16: input is not short: %d in %s: line %d\n", x, file, line);
+   }
+   res = x;
+   spx_mips++;
+   return res;
+}
+
+#define EXTEND32(x) _EXTEND32(x, __FILE__, __LINE__)
+static inline int _EXTEND32(int x, char *file, int line)
+{
+   int res;
+   if (!VERIFY_SHORT(x))
+   {
+      fprintf (stderr, "EXTEND32: input is not short: %d in %s: line %d\n", x, file, line);
+   }
+   res = x;
+   spx_mips++;
+   return res;
+}
+
+#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
+static inline short _SHR16(int a, int shift, char *file, int line) 
+{
+   int res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
+   {
+      fprintf (stderr, "SHR16: inputs are not short: %d >> %d in %s: line %d\n", a, shift, file, line);
+   }
+   res = a>>shift;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "SHR16: output is not short: %d in %s: line %d\n", res, file, line);
+   spx_mips++;
+   return res;
+}
+#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
+static inline short _SHL16(int a, int shift, char *file, int line) 
+{
+   int res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
+   {
+      fprintf (stderr, "SHL16: inputs are not short: %d %d in %s: line %d\n", a, shift, file, line);
+   }
+   res = a<<shift;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "SHL16: output is not short: %d in %s: line %d\n", res, file, line);
+   spx_mips++;
+   return res;
+}
+
+static inline int SHR32(long long a, int shift) 
+{
+   long long  res;
+   if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
+   {
+      fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
+   }
+   res = a>>shift;
+   if (!VERIFY_INT(res))
+   {
+      fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
+   }
+   spx_mips++;
+   return res;
+}
+static inline int SHL32(long long a, int shift) 
+{
+   long long  res;
+   if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
+   {
+      fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
+   }
+   res = a<<shift;
+   if (!VERIFY_INT(res))
+   {
+      fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
+   }
+   spx_mips++;
+   return res;
+}
+
+#define PSHR16(a,shift) (SHR16(ADD16((a),((1<<((shift))>>1))),shift))
+#define PSHR32(a,shift) (SHR32(ADD32((a),((1<<((shift))>>1))),shift))
+#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
+
+#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
+#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
+
+//#define SHR(a,shift) ((a) >> (shift))
+//#define SHL(a,shift) ((a) << (shift))
+
+#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
+static inline short _ADD16(int a, int b, char *file, int line) 
+{
+   int res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "ADD16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
+   }
+   res = a+b;
+   if (!VERIFY_SHORT(res))
+   {
+      fprintf (stderr, "ADD16: output is not short: %d+%d=%d in %s: line %d\n", a,b,res, file, line);
+   }
+   spx_mips++;
+   return res;
+}
+
+#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
+static inline short _SUB16(int a, int b, char *file, int line) 
+{
+   int res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "SUB16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
+   }
+   res = a-b;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "SUB16: output is not short: %d in %s: line %d\n", res, file, line);
+   spx_mips++;
+   return res;
+}
+
+#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
+static inline int _ADD32(long long a, long long b, char *file, int line) 
+{
+   long long res;
+   if (!VERIFY_INT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
+   }
+   res = a+b;
+   if (!VERIFY_INT(res))
+   {
+      fprintf (stderr, "ADD32: output is not int: %d in %s: line %d\n", (int)res, file, line);
+   }
+   spx_mips++;
+   return res;
+}
+
+static inline int SUB32(long long a, long long b) 
+{
+   long long res;
+   if (!VERIFY_INT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "SUB32: inputs are not int: %d %d\n", (int)a, (int)b);
+   }
+   res = a-b;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "SUB32: output is not int: %d\n", (int)res);
+   spx_mips++;
+   return res;
+}
+
+#define ADD64(a,b) (MIPS_INC(a)+(b))
+
+/* result fits in 16 bits */
+static inline short MULT16_16_16(int a, int b) 
+{
+   int res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_16: inputs are not short: %d %d\n", a, b);
+   }
+   res = a*b;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_16: output is not short: %d\n", res);
+   spx_mips++;
+   return res;
+}
+
+#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
+static inline int _MULT16_16(int a, int b, char *file, int line) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
+   }
+   res = ((long long)a)*b;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line);
+   spx_mips++;
+   return res;
+}
+
+#define MAC16_16(c,a,b)     (spx_mips--,ADD32((c),MULT16_16((a),(b))))
+#define MAC16_16_Q11(c,a,b)     (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),11)))))
+#define MAC16_16_Q13(c,a,b)     (EXTRACT16(ADD16((c),EXTRACT16(SHR32(MULT16_16((a),(b)),13)))))
+#define MAC16_16_P13(c,a,b)     (EXTRACT16(ADD32((c),SHR32(ADD32(4096,MULT16_16((a),(b))),13))))
+
+
+#define MULT16_32_QX(a, b, Q) _MULT16_32_QX(a, b, Q, __FILE__, __LINE__)
+static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
+   }
+   if (ABS32(b)>=(1<<(15+Q)))
+      fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);      
+   res = (((long long)a)*(long long)b) >> Q;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
+   spx_mips+=5;
+   return res;
+}
+
+static inline int MULT16_32_PX(int a, long long b, int Q)
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
+   }
+   if (ABS32(b)>=(1<<(15+Q)))
+      fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);      
+   res = ((((long long)a)*(long long)b) + ((1<<Q)>>1))>> Q;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
+   spx_mips+=5;
+   return res;
+}
+
+
+#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11)
+#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b)))
+#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12)
+#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13)
+#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14)
+#define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15)
+#define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15)
+#define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b)))
+
+static inline int SATURATE(int a, int b)
+{
+   if (a>b)
+      a=b;
+   if (a<-b)
+      a = -b;
+   return a;
+}
+
+static inline int MULT16_16_Q11_32(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_Q11: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res >>= 11;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_16_Q11: output is not short: %d*%d=%d\n", (int)a, (int)b, (int)res);
+   spx_mips+=3;
+   return res;
+}
+static inline short MULT16_16_Q13(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_Q13: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res >>= 13;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_Q13: output is not short: %d*%d=%d\n", a, b, (int)res);
+   spx_mips+=3;
+   return res;
+}
+static inline short MULT16_16_Q14(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_Q14: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res >>= 14;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_Q14: output is not short: %d\n", (int)res);
+   spx_mips+=3;
+   return res;
+}
+static inline short MULT16_16_Q15(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_Q15: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res >>= 15;
+   if (!VERIFY_SHORT(res))
+   {
+      fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res);
+   }
+   spx_mips+=3;
+   return res;
+}
+
+static inline short MULT16_16_P13(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_P13: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res += 4096;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_16_P13: overflow: %d*%d=%d\n", a, b, (int)res);
+   res >>= 13;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_P13: output is not short: %d*%d=%d\n", a, b, (int)res);
+   spx_mips+=4;
+   return res;
+}
+static inline short MULT16_16_P14(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_P14: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res += 8192;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_16_P14: overflow: %d*%d=%d\n", a, b, (int)res);
+   res >>= 14;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_P14: output is not short: %d*%d=%d\n", a, b, (int)res);
+   spx_mips+=4;
+   return res;
+}
+static inline short MULT16_16_P15(int a, int b) 
+{
+   long long res;
+   if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "MULT16_16_P15: inputs are not short: %d %d\n", a, b);
+   }
+   res = ((long long)a)*b;
+   res += 16384;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "MULT16_16_P15: overflow: %d*%d=%d\n", a, b, (int)res);
+   res >>= 15;
+   if (!VERIFY_SHORT(res))
+      fprintf (stderr, "MULT16_16_P15: output is not short: %d*%d=%d\n", a, b, (int)res);
+   spx_mips+=4;
+   return res;
+}
+
+#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
+
+static inline int _DIV32_16(long long a, long long b, char *file, int line) 
+{
+   long long res;
+   if (b==0)
+   {
+      fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
+      return 0;
+   }
+   if (!VERIFY_INT(a) || !VERIFY_SHORT(b))
+   {
+      fprintf (stderr, "DIV32_16: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
+   }
+   res = a/b;
+   if (!VERIFY_SHORT(res))
+   {
+      fprintf (stderr, "DIV32_16: output is not short: %d / %d = %d in %s: line %d\n", (int)a,(int)b,(int)res, file, line);
+      if (res>32767)
+         res = 32767;
+      if (res<-32768)
+         res = -32768;
+   }
+   spx_mips+=20;
+   return res;
+}
+
+#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
+static inline int _DIV32(long long a, long long b, char *file, int line) 
+{
+   long long res;
+   if (b==0)
+   {
+      fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
+      return 0;
+   }
+
+   if (!VERIFY_INT(a) || !VERIFY_INT(b))
+   {
+      fprintf (stderr, "DIV32: inputs are not int/short: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
+   }
+   res = a/b;
+   if (!VERIFY_INT(res))
+      fprintf (stderr, "DIV32: output is not int: %d in %s: line %d\n", (int)res, file, line);
+   spx_mips+=36;
+   return res;
+}
+#define PDIV32(a,b) DIV32(ADD32((a),(b)>>1),b)
+#define PDIV32_16(a,b) DIV32_16(ADD32((a),(b)>>1),b)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/fixed_generic.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,106 @@
+/* Copyright (C) 2003 Jean-Marc Valin */
+/**
+   @file fixed_generic.h
+   @brief Generic fixed-point operations
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef FIXED_GENERIC_H
+#define FIXED_GENERIC_H
+
+#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
+#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
+
+#define NEG16(x) (-(x))
+#define NEG32(x) (-(x))
+#define EXTRACT16(x) ((spx_word16_t)(x))
+#define EXTEND32(x) ((spx_word32_t)(x))
+#define SHR16(a,shift) ((a) >> (shift))
+#define SHL16(a,shift) ((a) << (shift))
+#define SHR32(a,shift) ((a) >> (shift))
+#define SHL32(a,shift) ((a) << (shift))
+#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
+#define PSHR32(a,shift) (SHR32((a)+((1<<((shift))>>1)),shift))
+#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
+#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
+#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
+
+#define SHR(a,shift) ((a) >> (shift))
+#define SHL(a,shift) ((spx_word32_t)(a) << (shift))
+#define PSHR(a,shift) (SHR((a)+((1<<((shift))>>1)),shift))
+#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
+
+
+#define ADD16(a,b) ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))
+#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b))
+#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b))
+#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b))
+
+
+/* result fits in 16 bits */
+#define MULT16_16_16(a,b)     ((((spx_word16_t)(a))*((spx_word16_t)(b))))
+
+/* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */
+#define MULT16_16(a,b)     (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))
+
+#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
+#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
+#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
+#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
+
+#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
+#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
+
+#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
+#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
+#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
+
+
+#define MAC16_16_Q11(c,a,b)     (ADD32((c),SHR(MULT16_16((a),(b)),11)))
+#define MAC16_16_Q13(c,a,b)     (ADD32((c),SHR(MULT16_16((a),(b)),13)))
+#define MAC16_16_P13(c,a,b)     (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
+
+#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
+#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
+#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
+#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
+
+#define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13))
+#define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14))
+#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
+
+#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
+
+#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
+#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
+#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b)))
+#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/kiss_fft.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,108 @@
+#ifndef KISS_FFT_H
+#define KISS_FFT_H
+
+#include <stdlib.h>
+#include <math.h>
+#include "misc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ ATTENTION!
+ If you would like a :
+ -- a utility that will handle the caching of fft objects
+ -- real-only (no imaginary time component ) FFT
+ -- a multi-dimensional FFT
+ -- a command-line utility to perform ffts
+ -- a command-line utility to perform fast-convolution filtering
+
+ Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
+  in the tools/ directory.
+*/
+
+#ifdef USE_SIMD
+# include <xmmintrin.h>
+# define kiss_fft_scalar __m128
+#define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
+#else	
+#define KISS_FFT_MALLOC speex_alloc
+#endif	
+
+
+#ifdef FIXED_POINT
+#include "misc.h"	
+#  define kiss_fft_scalar spx_int16_t
+#else
+# ifndef kiss_fft_scalar
+/*  default is float */
+#   define kiss_fft_scalar float
+# endif
+#endif
+
+typedef struct {
+    kiss_fft_scalar r;
+    kiss_fft_scalar i;
+}kiss_fft_cpx;
+
+typedef struct kiss_fft_state* kiss_fft_cfg;
+
+/* 
+ *  kiss_fft_alloc
+ *  
+ *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
+ *
+ *  typical usage:      kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
+ *
+ *  The return value from fft_alloc is a cfg buffer used internally
+ *  by the fft routine or NULL.
+ *
+ *  If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
+ *  The returned value should be free()d when done to avoid memory leaks.
+ *  
+ *  The state can be placed in a user supplied buffer 'mem':
+ *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
+ *      then the function places the cfg in mem and the size used in *lenmem
+ *      and returns mem.
+ *  
+ *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
+ *      then the function returns NULL and places the minimum cfg 
+ *      buffer size in *lenmem.
+ * */
+
+kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
+
+/*
+ * kiss_fft(cfg,in_out_buf)
+ *
+ * Perform an FFT on a complex input buffer.
+ * for a forward FFT,
+ * fin should be  f[0] , f[1] , ... ,f[nfft-1]
+ * fout will be   F[0] , F[1] , ... ,F[nfft-1]
+ * Note that each element is complex and can be accessed like
+    f[k].r and f[k].i
+ * */
+void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
+
+/*
+ A more generic version of the above function. It reads its input from every Nth sample.
+ * */
+void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
+
+/* If kiss_fft_alloc allocated a buffer, it is one contiguous 
+   buffer and can be simply free()d when no longer needed*/
+#define kiss_fft_free speex_free
+
+/*
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
+ your compiler output to call this before you exit.
+*/
+void kiss_fft_cleanup(void);
+	
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/kiss_fftr.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,51 @@
+#ifndef KISS_FTR_H
+#define KISS_FTR_H
+
+#include "kiss_fft.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+/* 
+ 
+ Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
+
+ 
+ 
+ */
+
+typedef struct kiss_fftr_state *kiss_fftr_cfg;
+
+
+kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenmem);
+/*
+ nfft must be even
+
+ If you don't care to allocate space, use mem = lenmem = NULL 
+*/
+
+
+void kiss_fftr(kiss_fftr_cfg cfg,const kiss_fft_scalar *timedata,kiss_fft_cpx *freqdata);
+/*
+ input timedata has nfft scalar points
+ output freqdata has nfft/2+1 complex points
+*/
+
+void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar *freqdata);
+
+void kiss_fftri(kiss_fftr_cfg cfg,const kiss_fft_cpx *freqdata,kiss_fft_scalar *timedata);
+
+void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata, kiss_fft_scalar *timedata);
+
+/*
+ input freqdata has  nfft/2+1 complex points
+ output timedata has nfft scalar points
+*/
+
+#define kiss_fftr_free speex_free
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lpc.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,53 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file lpc.h
+   @brief Functions for LPC (Linear Prediction Coefficients) analysis
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef LPC_H
+#define LPC_H
+
+#include "misc.h"
+
+void _spx_autocorr(
+              const spx_word16_t * x,   /*  in: [0...n-1] samples x   */
+              spx_word16_t *ac,   /* out: [0...lag-1] ac values */
+              int lag, int   n);
+
+spx_word32_t                      /* returns minimum mean square error    */
+_spx_lpc(
+    spx_coef_t       * lpc, /*      [0...p-1] LPC coefficients      */
+    const spx_word16_t * ac,  /*  in: [0...p] autocorrelation values  */
+    int p
+    );
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lpc_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,131 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @file lpc_bfin.h
+   @author Jean-Marc Valin 
+   @brief Functions for LPC (Linear Prediction Coefficients) analysis (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_SPEEX_AUTOCORR
+void _spx_autocorr(
+const spx_word16_t *x,   /*  in: [0...n-1] samples x   */
+spx_word16_t       *ac,  /* out: [0...lag-1] ac values */
+int          lag, 
+int          n
+                  )
+{
+   spx_word32_t d;
+   const spx_word16_t *xs;
+   int i, j;
+   spx_word32_t ac0=1;
+   spx_word32_t ac32[11], *ac32top;
+   int shift, ac_shift;
+   ac32top = ac32+lag-1;
+   int lag_1, N_lag;
+   int nshift;
+   lag_1 = lag-1;
+   N_lag = n-lag_1;
+   for (j=0;j<n;j++)
+      ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8));
+   ac0 = ADD32(ac0,n);
+   shift = 8;
+   while (shift && ac0<0x40000000)
+   {
+      shift--;
+      ac0 <<= 1;
+   }
+   ac_shift = 18;
+   while (ac_shift && ac0<0x40000000)
+   {
+      ac_shift--;
+      ac0 <<= 1;
+   }
+   
+   xs = x+lag-1;
+   nshift = -shift;
+   __asm__ __volatile__ 
+   (
+         "P2 = %0;\n\t"
+         "I0 = P2;\n\t" /* x in I0 */
+         "B0 = P2;\n\t" /* x in B0 */
+         "R0 = %3;\n\t" /* len in R0 */
+         "P3 = %3;\n\t" /* len in R0 */
+         "P4 = %4;\n\t" /* nb_pitch in R0 */
+         "R1 = R0 << 1;\n\t" /* number of bytes in x */
+         "L0 = R1;\n\t"
+         "P0 = %1;\n\t"
+         "P1 = %2;\n\t"
+         "B1 = P1;\n\t"
+         "R4 = %5;\n\t"
+         "L1 = 0;\n\t" /*Disable looping on I1*/
+
+         "r0 = [I0++];\n\t"
+         "R2 = 0;R3=0;"
+         "LOOP pitch%= LC0 = P4 >> 1;\n\t"
+         "LOOP_BEGIN pitch%=;\n\t"
+            "I1 = P0;\n\t"
+            "A1 = A0 = 0;\n\t"
+            "R1 = [I1++];\n\t"
+            "LOOP inner_prod%= LC1 = P3 >> 1;\n\t"
+            "LOOP_BEGIN inner_prod%=;\n\t"
+               "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
+               "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t"
+            "LOOP_END inner_prod%=;\n\t"
+            "A0 = ASHIFT A0 by R4.L;\n\t"
+            "A1 = ASHIFT A1 by R4.L;\n\t"
+   
+            "R2 = A0, R3 = A1;\n\t"
+            "[P1--] = R2;\n\t"
+            "[P1--] = R3;\n\t"
+            "P0 += 4;\n\t"
+         "LOOP_END pitch%=;\n\t"
+   : : "m" (xs), "m" (x), "m" (ac32top), "m" (N_lag), "m" (lag_1), "m" (nshift)
+   : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "R4", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
+   );
+   d=0;
+   for (j=0;j<n;j++)
+   {
+      d = ADD32(d,SHR32(MULT16_16(x[j],x[j]), shift));
+   }
+   ac32[0] = d;
+   
+   for (i=0;i<lag;i++)
+   {
+      d=0;
+      for (j=i;j<lag_1;j++)
+      {
+         d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
+      }
+      if (i)
+         ac32[i] += d;
+      ac[i] = SHR32(ac32[i], ac_shift);
+   }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lsp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------------*\
+Original Copyright
+	FILE........: AK2LSPD.H
+	TYPE........: Turbo C header file
+	COMPANY.....: Voicetronix
+	AUTHOR......: James Whitehall
+	DATE CREATED: 21/11/95
+
+Modified by Jean-Marc Valin
+
+    This file contains functions for converting Linear Prediction
+    Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
+    LSP coefficients are not in radians format but in the x domain of the
+    unit circle.
+
+\*---------------------------------------------------------------------------*/
+/**
+   @file lsp.h
+   @brief Line Spectral Pair (LSP) functions.
+*/
+/* Speex License:
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __AK2LSPD__
+#define __AK2LSPD__
+
+#include "misc.h"
+
+int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack);
+void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack);
+
+/*Added by JMV*/
+void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin);
+
+void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes);
+
+#endif	/* __AK2LSPD__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/lsp_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,89 @@
+/* Copyright (C) 2006 David Rowe */
+/**
+   @file lsp_bfin.h
+   @author David Rowe
+   @brief LSP routines optimised for the Blackfin
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_CHEB_POLY_EVA
+#ifdef OVERRIDE_CHEB_POLY_EVA
+static inline spx_word32_t cheb_poly_eva(
+  spx_word16_t *coef, /* P or Q coefs in Q13 format               */
+  spx_word16_t     x, /* cos of freq (-1.0 to 1.0) in Q14 format  */
+  int              m, /* LPC order/2                              */
+  char         *stack
+)
+{
+    spx_word32_t sum;
+
+   __asm__ __volatile__
+     (
+      "P0 = %2;\n\t"           /* P0: coef[m], coef[m-1],..., coef[0] */
+      "R4 = 8192;\n\t"         /* R4: rounding constant               */
+      "R2 = %1;\n\t"           /* R2: x  */
+
+      "R5 = -16383;\n\t"
+      "R2 = MAX(R2,R5);\n\t"
+      "R5 = 16383;\n\t"
+      "R2 = MIN(R2,R5);\n\t"
+
+      "R3 = W[P0--] (X);\n\t"  /* R3: sum */
+      "R5 = W[P0--] (X);\n\t"
+      "R5 = R5.L * R2.L (IS);\n\t"
+      "R5 = R5 + R4;\n\t"
+      "R5 >>>= 14;\n\t"
+      "R3 = R3 + R5;\n\t" 
+      
+      "R0 = R2;\n\t"           /* R0: b0 */
+      "R1 = 16384;\n\t"        /* R1: b1 */
+      "LOOP cpe%= LC0 = %3;\n\t"
+      "LOOP_BEGIN cpe%=;\n\t"
+        "P1 = R0;\n\t" 
+        "R0 = R2.L * R0.L (IS) || R5 = W[P0--] (X);\n\t"
+        "R0 >>>= 13;\n\t"
+        "R0 = R0 - R1;\n\t"
+        "R1 = P1;\n\t"
+        "R5 = R5.L * R0.L (IS);\n\t"
+        "R5 = R5 + R4;\n\t"
+        "R5 >>>= 14;\n\t"
+        "R3 = R3 + R5;\n\t"
+      "LOOP_END cpe%=;\n\t"
+      "%0 = R3;\n\t"
+      : "=&d" (sum)
+      : "a" (x), "a" (&coef[m]), "a" (m-1)
+      : "R0", "R1", "R3", "R2", "R4", "R5", "P0", "P1"
+      );
+    return sum;
+}
+#endif
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,141 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file ltp.h
+   @brief Long-Term Prediction functions
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <speex/speex_bits.h>
+#include "misc.h"
+
+/** LTP parameters. */
+typedef struct {
+   const signed char *gain_cdbk;
+   int     gain_bits;
+   int     pitch_bits;
+} ltp_params;
+
+#ifdef FIXED_POINT
+#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -SHR16(g[0],1)) + (g[2]>0 ? g[2] : -SHR16(g[2],1)))
+#else
+#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -.5*g[0]) + (g[2]>0 ? g[2] : -.5*g[2]))
+#endif
+
+spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len);
+void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack);
+
+void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack);
+
+
+/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
+int pitch_search_3tap(
+spx_word16_t target[],                 /* Target vector */
+spx_word16_t *sw,
+spx_coef_t ak[],                     /* LPCs for this subframe */
+spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
+spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
+spx_sig_t exc[],                    /* Overlapping codebook */
+const void *par,
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
+int   p,                        /* Number of LPC coeffs */
+int   nsf,                      /* Number of samples in subframe */
+SpeexBits *bits,
+char *stack,
+spx_word16_t *exc2,
+spx_word16_t *r,
+int   complexity,
+int   cdbk_offset,
+int plc_tuning,
+spx_word32_t *cumul_gain
+);
+
+/*Unquantize adaptive codebook and update pitch contribution*/
+void pitch_unquant_3tap(
+spx_word16_t exc[],             /* Input excitation */
+spx_word32_t exc_out[],         /* Output excitation */
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
+const void *par,
+int   nsf,                      /* Number of samples in subframe */
+int *pitch_val,
+spx_word16_t *gain_val,
+SpeexBits *bits,
+char *stack,
+int lost,
+int subframe_offset,
+spx_word16_t last_pitch_gain,
+int cdbk_offset
+);
+
+/** Forced pitch delay and gain */
+int forced_pitch_quant(
+spx_word16_t target[],                 /* Target vector */
+spx_word16_t *sw,
+spx_coef_t ak[],                     /* LPCs for this subframe */
+spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
+spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
+spx_sig_t exc[],                    /* Excitation */
+const void *par,
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
+int   p,                        /* Number of LPC coeffs */
+int   nsf,                      /* Number of samples in subframe */
+SpeexBits *bits,
+char *stack,
+spx_word16_t *exc2,
+spx_word16_t *r,
+int complexity,
+int cdbk_offset,
+int plc_tuning,
+spx_word32_t *cumul_gain
+);
+
+/** Unquantize forced pitch delay and gain */
+void forced_pitch_unquant(
+spx_word16_t exc[],             /* Input excitation */
+spx_word32_t exc_out[],         /* Output excitation */
+int   start,                    /* Smallest pitch value allowed */
+int   end,                      /* Largest pitch value allowed */
+spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
+const void *par,
+int   nsf,                      /* Number of samples in subframe */
+int *pitch_val,
+spx_word16_t *gain_val,
+SpeexBits *bits,
+char *stack,
+int lost,
+int subframe_offset,
+spx_word16_t last_pitch_gain,
+int cdbk_offset
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_arm4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,187 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file ltp_arm4.h
+   @brief Long-Term Prediction functions (ARM4 version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_INNER_PROD
+spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
+{
+   spx_word32_t sum1=0,sum2=0;
+   spx_word16_t *deadx, *deady;
+   int deadlen, dead1, dead2, dead3, dead4, dead5, dead6;
+   __asm__ __volatile__ (
+         "\tldrsh %5, [%0], #2 \n"
+         "\tldrsh %6, [%1], #2 \n"
+         ".inner_prod_loop%=:\n"
+         "\tsub %7, %7, %7\n"
+         "\tsub %10, %10, %10\n"
+
+         "\tldrsh %8, [%0], #2 \n"
+         "\tldrsh %9, [%1], #2 \n"
+         "\tmla %7, %5, %6, %7\n"
+         "\tldrsh %5, [%0], #2 \n"
+         "\tldrsh %6, [%1], #2 \n"
+         "\tmla %10, %8, %9, %10\n"
+         "\tldrsh %8, [%0], #2 \n"
+         "\tldrsh %9, [%1], #2 \n"
+         "\tmla %7, %5, %6, %7\n"
+         "\tldrsh %5, [%0], #2 \n"
+         "\tldrsh %6, [%1], #2 \n"
+         "\tmla %10, %8, %9, %10\n"
+
+         "\tldrsh %8, [%0], #2 \n"
+         "\tldrsh %9, [%1], #2 \n"
+         "\tmla %7, %5, %6, %7\n"
+         "\tldrsh %5, [%0], #2 \n"
+         "\tldrsh %6, [%1], #2 \n"
+         "\tmla %10, %8, %9, %10\n"
+         "\tldrsh %8, [%0], #2 \n"
+         "\tldrsh %9, [%1], #2 \n"
+         "\tmla %7, %5, %6, %7\n"
+         "\tldrsh %5, [%0], #2 \n"
+         "\tldrsh %6, [%1], #2 \n"
+         "\tmla %10, %8, %9, %10\n"
+
+         "\tsubs %4, %4, #1\n"
+         "\tadd %2, %2, %7, asr #5\n"
+         "\tadd %3, %3, %10, asr #5\n"
+         "\tbne .inner_prod_loop%=\n"
+   : "=r" (deadx), "=r" (deady), "+r" (sum1),  "+r" (sum2),
+     "=r" (deadlen), "=r" (dead1), "=r" (dead2), "=r" (dead3),
+     "=r" (dead4), "=r" (dead5), "=r" (dead6)
+   : "0" (x), "1" (y), "4" (len>>3)
+   : "cc"
+                        );
+   return (sum1+sum2)>>1;
+}
+
+#define OVERRIDE_PITCH_XCORR
+void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
+{
+   int i,j;
+   for (i=0;i<nb_pitch;i+=4)
+   {
+      /* Compute correlation*/
+      //corr[nb_pitch-1-i]=inner_prod(x, _y+i, len);
+      spx_word32_t sum1=0;
+      spx_word32_t sum2=0;
+      spx_word32_t sum3=0;
+      spx_word32_t sum4=0;
+      const spx_word16_t *y = _y+i;
+      const spx_word16_t *x = _x;
+      spx_word32_t y0, y1, y2, y3;
+      y0=*y++;
+      y1=*y++;
+      y2=*y++;
+      y3=*y++;
+      for (j=0;j<len;j+=4)
+      {
+         spx_word32_t part1, part2, part3, part4, x0;
+         spx_word32_t dead1;
+         __asm__ __volatile__ (
+#ifdef SHORTCUTS
+               "\tldrsh %10, [%8], #4 \n"
+               "\tmul %4, %10, %0 \n"
+               "\tldrsh %15, [%8], #4 \n"
+               "\tmul %5, %10, %1 \n"
+               "\tldrsh %0, [%9], #2 \n"
+               "\tmul %6, %10, %2 \n"
+               "\tldrsh %1, [%9], #2 \n"
+               "\tmul %7, %10, %3 \n"
+               
+               
+               "\tmla %4, %15, %2, %4 \n"
+               "\tldrsh %2, [%9], #2 \n"
+               "\tmla %5, %15, %3, %5 \n"
+               "\tldrsh %3, [%9], #2 \n"
+               "\tmla %6, %15, %0, %6 \n"
+               "\tmla %7, %15, %1, %7 \n"
+
+#else
+               "\tldrsh %10, [%8], #2 \n"
+               "\tmul %4, %10, %0 \n"
+               "\tmul %5, %10, %1 \n"
+               "\tmul %6, %10, %2 \n"
+               "\tmul %7, %10, %3 \n"
+
+               "\tldrsh %10, [%8], #2 \n"
+               "\tldrsh %0, [%9], #2 \n"
+               "\tmla %4, %10, %1, %4 \n"
+               "\tmla %5, %10, %2, %5 \n"
+               "\tmla %6, %10, %3, %6 \n"
+               "\tmla %7, %10, %0, %7 \n"
+
+               "\tldrsh %10, [%8], #2 \n"
+               "\tldrsh %1, [%9], #2 \n"
+               "\tmla %4, %10, %2, %4 \n"
+               "\tmla %5, %10, %3, %5 \n"
+               "\tmla %6, %10, %0, %6 \n"
+               "\tmla %7, %10, %1, %7 \n"
+
+               "\tldrsh %10, [%8], #2 \n"
+               "\tldrsh %2, [%9], #2 \n"
+               "\tmla %4, %10, %3, %4 \n"
+               "\tmla %5, %10, %0, %5 \n"
+               "\tmla %6, %10, %1, %6 \n"
+               "\tmla %7, %10, %2, %7 \n"
+
+               "\tldrsh %3, [%9], #2 \n"
+#endif
+
+               "\tldr %10, %11 \n"
+               "\tldr %15, %12 \n"
+               "\tadd %4, %10, %4, asr #6 \n"
+               "\tstr %4, %11 \n"
+               "\tldr %10, %13 \n"
+               "\tadd %5, %15, %5, asr #6 \n"
+               "\tstr %5, %12 \n"
+               "\tldr %15, %14 \n"
+               "\tadd %6, %10, %6, asr #6 \n"
+               "\tadd %7, %15, %7, asr #6 \n"
+               "\tstr %6, %13 \n"
+               "\tstr %7, %14 \n"
+
+            : "+r" (y0), "+r" (y1), "+r" (y2), "+r" (y3),
+         "=r" (part1),  "=r" (part2),  "=r" (part3),  "=r" (part4),
+              "+r" (x), "+r" (y), "=r" (x0), "+m" (sum1),
+              "+m" (sum2), "+m" (sum3), "+m" (sum4), "=r" (dead1)
+            :
+            : "cc", "memory"
+                              );
+      }
+      corr[nb_pitch-1-i]=sum1;
+      corr[nb_pitch-2-i]=sum2;
+      corr[nb_pitch-3-i]=sum3;
+      corr[nb_pitch-4-i]=sum4;
+   }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,419 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @file ltp_bfin.h
+   @author Jean-Marc Valin
+   @brief Long-Term Prediction functions (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_INNER_PROD
+spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
+{
+   spx_word32_t sum=0;
+   __asm__ __volatile__ (
+      "P0 = %3;\n\t"
+      "P1 = %1;\n\t"
+      "P2 = %2;\n\t"
+      "I0 = P1;\n\t"
+      "I1 = P2;\n\t"
+      "L0 = 0;\n\t"
+      "L1 = 0;\n\t"
+      "A0 = 0;\n\t"
+      "R0.L = W[I0++] || R1.L = W[I1++];\n\t"
+      "LOOP inner%= LC0 = P0;\n\t"
+      "LOOP_BEGIN inner%=;\n\t"
+         "A0 += R0.L*R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t"
+      "LOOP_END inner%=;\n\t"
+      "A0 += R0.L*R1.L (IS);\n\t"
+      "A0 = A0 >>> 6;\n\t"
+      "R0 = A0;\n\t"
+      "%0 = R0;\n\t"
+   : "=m" (sum)
+   : "m" (x), "m" (y), "d" (len-1)
+   : "P0", "P1", "P2", "R0", "R1", "A0", "I0", "I1", "L0", "L1", "R3"
+   );
+   return sum;
+}
+
+#define OVERRIDE_PITCH_XCORR
+void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
+{
+   corr += nb_pitch - 1;
+   __asm__ __volatile__ (
+      "P2 = %0;\n\t"
+      "I0 = P2;\n\t" /* x in I0 */
+      "B0 = P2;\n\t" /* x in B0 */
+      "R0 = %3;\n\t" /* len in R0 */
+      "P3 = %3;\n\t"
+      "P3 += -2;\n\t" /* len in R0 */
+      "P4 = %4;\n\t" /* nb_pitch in R0 */
+      "R1 = R0 << 1;\n\t" /* number of bytes in x */
+      "L0 = R1;\n\t"
+      "P0 = %1;\n\t"
+
+      "P1 = %2;\n\t"
+      "B1 = P1;\n\t"
+      "L1 = 0;\n\t" /*Disable looping on I1*/
+
+      "r0 = [I0++];\n\t"
+      "LOOP pitch%= LC0 = P4 >> 1;\n\t"
+      "LOOP_BEGIN pitch%=;\n\t"
+         "I1 = P0;\n\t"
+         "A1 = A0 = 0;\n\t"
+         "R1 = [I1++];\n\t"
+         "LOOP inner_prod%= LC1 = P3 >> 1;\n\t"
+         "LOOP_BEGIN inner_prod%=;\n\t"
+            "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
+            "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R1.H = W[I1++] || R0 = [I0++];\n\t"
+         "LOOP_END inner_prod%=;\n\t"
+         "A1 += R0.L*R1.H, A0 += R0.L*R1.L (IS) || R1.L = W[I1++];\n\t"
+         "A1 += R0.H*R1.L, A0 += R0.H*R1.H (IS) || R0 = [I0++];\n\t"
+         "A0 = A0 >>> 6;\n\t"
+         "A1 = A1 >>> 6;\n\t"
+         "R2 = A0, R3 = A1;\n\t"
+         "[P1--] = r2;\n\t"
+         "[P1--] = r3;\n\t"
+         "P0 += 4;\n\t"
+      "LOOP_END pitch%=;\n\t"
+      "L0 = 0;\n\t"
+   : : "m" (_x), "m" (_y), "m" (corr), "m" (len), "m" (nb_pitch)
+   : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2", "R3", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
+   );
+}
+
+#define OVERRIDE_COMPUTE_PITCH_ERROR
+static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control)
+{
+   spx_word32_t sum;
+   __asm__ __volatile__
+         (
+         "A0 = 0;\n\t"
+         
+         "R0 = W[%1++];\n\t"
+         "R1.L = %2.L*%5.L (IS);\n\t"
+         "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %3.L*%5.L (IS);\n\t"
+         "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %4.L*%5.L (IS);\n\t"
+         "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %2.L*%3.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+
+         "R1.L = %4.L*%3.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %4.L*%2.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %2.L*%2.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+
+         "R1.L = %3.L*%3.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t"
+         
+         "R1.L = %4.L*%4.L (IS);\n\t"
+         "A0 -= R1.L*R0.L (IS);\n\t"
+         
+         "%0 = A0;\n\t"
+   : "=&D" (sum), "=a" (C)
+   : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C)
+   : "R0", "R1", "R2", "A0"
+         );
+   return sum;
+}
+
+#define OVERRIDE_OPEN_LOOP_NBEST_PITCH
+#ifdef OVERRIDE_OPEN_LOOP_NBEST_PITCH
+void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack)
+{
+   int i,j,k;
+   VARDECL(spx_word32_t *best_score);
+   VARDECL(spx_word32_t *best_ener);
+   spx_word32_t e0;
+   VARDECL(spx_word32_t *corr);
+   VARDECL(spx_word32_t *energy);
+
+   ALLOC(best_score, N, spx_word32_t);
+   ALLOC(best_ener, N, spx_word32_t);
+   ALLOC(corr, end-start+1, spx_word32_t);
+   ALLOC(energy, end-start+2, spx_word32_t);
+
+   for (i=0;i<N;i++)
+   {
+        best_score[i]=-1;
+        best_ener[i]=0;
+        pitch[i]=start;
+   }
+
+   energy[0]=inner_prod(sw-start, sw-start, len);
+   e0=inner_prod(sw, sw, len);
+
+   /* energy update -------------------------------------*/
+
+      __asm__ __volatile__
+      (
+"        P0 = %0;\n\t"
+"        I1 = %1;\n\t"
+"        L1 = 0;\n\t"
+"        I2 = %2;\n\t"
+"        L2 = 0;\n\t"
+"        R2 = [P0++];\n\t"
+"        R3 = 0;\n\t"
+"        LSETUP (eu1, eu2) LC1 = %3;\n\t"
+"eu1:      R1.L = W [I1--] || R0.L = W [I2--] ;\n\t"
+"          R1 = R1.L * R1.L (IS);\n\t"
+"          R0 = R0.L * R0.L (IS);\n\t"
+"          R1 >>>= 6;\n\t"
+"          R1 = R1 + R2;\n\t"
+"          R0 >>>= 6;\n\t"
+"          R1 = R1 - R0;\n\t"
+"          R2 = MAX(R1,R3);\n\t"
+"eu2:      [P0++] = R2;\n\t"
+       : : "d" (energy), "d" (&sw[-start-1]), "d" (&sw[-start+len-1]),
+           "a" (end-start)  
+       : "P0", "I1", "I2", "R0", "R1", "R2", "R3"
+#if (__GNUC__ == 4)
+         , "LC1"
+#endif
+       );
+
+   pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
+
+   /* FIXME: Fixed-point and floating-point code should be merged */
+   {
+      VARDECL(spx_word16_t *corr16);
+      VARDECL(spx_word16_t *ener16);
+      ALLOC(corr16, end-start+1, spx_word16_t);
+      ALLOC(ener16, end-start+1, spx_word16_t);
+      /* Normalize to 180 so we can square it and it still fits in 16 bits */
+      normalize16(corr, corr16, 180, end-start+1);
+      normalize16(energy, ener16, 180, end-start+1);
+
+      if (N == 1) {
+	/* optimised asm to handle N==1 case */
+      __asm__ __volatile__
+      (
+"        I0 = %1;\n\t"                     /* I0: corr16[]    */
+"        L0 = 0;\n\t"
+"        I1 = %2;\n\t"                     /* I1: energy      */
+"        L1 = 0;\n\t"
+"        R2 = -1;\n\t"                     /* R2: best score  */
+"        R3 = 0;\n\t"                      /* R3: best energy */
+"        P0 = %4;\n\t"                     /* P0: best pitch  */
+"        P1 = %4;\n\t"                     /* P1: counter     */
+"        LSETUP (sl1, sl2) LC1 = %3;\n\t"
+"sl1:      R0.L = W [I0++] || R1.L = W [I1++];\n\t"         
+"          R0 = R0.L * R0.L (IS);\n\t"
+"          R1   += 1;\n\t"
+"          R4   = R0.L * R3.L;\n\t"
+"          R5   = R2.L * R1.L;\n\t"
+"          cc   = R5 < R4;\n\t"
+"          if cc R2 = R0;\n\t"
+"          if cc R3 = R1;\n\t"
+"          if cc P0 = P1;\n\t"
+"sl2:      P1 += 1;\n\t"
+"        %0 = P0;\n\t"
+       : "=&d" (pitch[0])
+       : "a" (corr16), "a" (ener16), "a" (end+1-start), "d" (start) 
+       : "P0", "P1", "I0", "I1", "R0", "R1", "R2", "R3", "R4", "R5"
+#if (__GNUC__ == 4)
+         , "LC1"
+#endif
+       );
+
+      }
+      else {
+	for (i=start;i<=end;i++)
+	  {
+	    spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
+	    /* Instead of dividing the tmp by the energy, we multiply on the other side */
+	    if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
+	      {
+		/* We can safely put it last and then check */
+		best_score[N-1]=tmp;
+		best_ener[N-1]=ener16[i-start]+1;
+		pitch[N-1]=i;
+		/* Check if it comes in front of others */
+		for (j=0;j<N-1;j++)
+		  {
+		    if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
+		      {
+			for (k=N-1;k>j;k--)
+			  {
+			    best_score[k]=best_score[k-1];
+			    best_ener[k]=best_ener[k-1];
+			    pitch[k]=pitch[k-1];
+			  }
+			best_score[j]=tmp;
+			best_ener[j]=ener16[i-start]+1;
+			pitch[j]=i;
+			break;
+		      }
+		  }
+	      }
+	  }
+      }
+   }
+
+   /* Compute open-loop gain */
+   if (gain)
+   {
+       for (j=0;j<N;j++)
+       {
+          spx_word16_t g;
+          i=pitch[j];
+          g = DIV32(corr[i-start], 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(energy[i-start])),6));
+          /* FIXME: g = max(g,corr/energy) */
+                   if (g<0)
+                   g = 0;
+             gain[j]=g;
+       }
+   }
+}
+#endif
+
+#define OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
+#ifdef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
+static int pitch_gain_search_3tap_vq(
+  const signed char *gain_cdbk,
+  int                gain_cdbk_size,
+  spx_word16_t      *C16,
+  spx_word16_t       max_gain
+)
+{
+  const signed char *ptr=gain_cdbk;
+  int                best_cdbk=0;
+  spx_word32_t       best_sum=-VERY_LARGE32;
+  spx_word32_t       sum=0;
+  spx_word16_t       g[3];
+  spx_word16_t       pitch_control=64;
+  spx_word16_t       gain_sum;
+  int                i;
+
+      /* fast asm version of VQ codebook search */
+
+      __asm__ __volatile__
+      (
+
+"        P0 = %2;\n\t"                     /* P0: ptr to gain_cdbk */
+"        L1 = 0;\n\t"                      /* no circ addr for L1  */
+"        %0 = 0;\n\t"                      /* %0: best_sum         */
+"        %1 = 0;\n\t"                      /* %1: best_cbdk        */
+"        P1 = 0;\n\t"                      /* P1: loop counter     */
+
+"        LSETUP (pgs1, pgs2) LC1 = %4;\n\t"
+"pgs1:     R2  = B [P0++] (X);\n\t"        /* R2: g[0]             */
+"          R3  = B [P0++] (X);\n\t"        /* R3: g[1]             */
+"          R4  = B [P0++] (X);\n\t"        /* R4: g[2]             */
+"          R2 += 32;\n\t"
+"          R3 += 32;\n\t"
+"          R4 += 32;\n\t"
+"          R4.H = 64;\n\t"                 /* R4.H: pitch_control    */
+
+"          R0  = B [P0++] (X);\n\t"              
+"          B0  = R0;\n\t"                  /* BO: gain_sum         */
+          
+           /* compute_pitch_error() -------------------------------*/
+
+"          I1 = %3;\n\t"                   /* I1: ptr to C         */
+"          A0 = 0;\n\t"
+         
+"          R0.L = W[I1++];\n\t"
+"          R1.L = R2.L*R4.H (IS);\n\t"
+"          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R3.L*R4.H (IS);\n\t"
+"          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R4.L*R4.H (IS);\n\t"
+"          A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R2.L*R3.L (IS);\n\t"
+"          A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+
+"          R1.L = R4.L*R3.L (IS);\n\t"
+"          A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R4.L*R2.L (IS);\n\t"
+"          A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R2.L*R2.L (IS);\n\t"
+"          A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+
+"          R1.L = R3.L*R3.L (IS);\n\t"
+"          A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t"
+         
+"          R1.L = R4.L*R4.L (IS);\n\t"
+"          R0 = (A0 -= R1.L*R0.L) (IS);\n\t"
+
+/*
+    Re-arrange the if-then to code efficiently on the Blackfin:
+
+      if (sum>best_sum && gain_sum<=max_gain)   ------ (1)
+
+      if (sum>best_sum && !(gain_sum>max_gain)) ------ (2)
+
+      if (max_gain<=gain_sum) {                 ------ (3)
+      sum = -VERY_LARGE32;
+      }
+      if (best_sum<=sum)
+
+    The blackin cc instructions are all of the form:
+
+      cc = x < y (or cc = x <= y)
+*/
+"          R1 = B0\n\t"
+"          R2 = %5\n\t"
+"          R3 = %6\n\t"
+"          cc = R2 <= R1;\n\t" 
+"          if cc R0 = R3;\n\t"
+"          cc = %0 <= R0;\n\t"
+"          if cc %0 = R0;\n\t"
+"          if cc %1 = P1;\n\t"
+
+"pgs2:     P1 += 1;\n\t"
+   
+       : "=&d" (best_sum), "=&d" (best_cdbk) 
+       : "a" (gain_cdbk), "a" (C16), "a" (gain_cdbk_size), "a" (max_gain),
+         "b" (-VERY_LARGE32)
+       : "R0", "R1", "R2", "R3", "R4", "P0", 
+         "P1", "I1", "L1", "A0", "B0"
+#if (__GNUC__ == 4)
+         , "LC1"
+#endif
+       );
+
+  return best_cdbk;
+}
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/ltp_sse.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,92 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file ltp_sse.h
+   @brief Long-Term Prediction functions (SSE version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <xmmintrin.h>
+
+#define OVERRIDE_INNER_PROD
+float inner_prod(const float *a, const float *b, int len)
+{
+   int i;
+   float ret;
+   __m128 sum = _mm_setzero_ps();
+   for (i=0;i<(len>>2);i+=2)
+   {
+      sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+0), _mm_loadu_ps(b+0)));
+      sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+4), _mm_loadu_ps(b+4)));
+      a += 8;
+      b += 8;
+   }
+   sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
+   sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
+   _mm_store_ss(&ret, sum);
+   return ret;
+}
+
+#define OVERRIDE_PITCH_XCORR
+void pitch_xcorr(const float *_x, const float *_y, float *corr, int len, int nb_pitch, char *stack)
+{
+   int i, offset;
+   VARDECL(__m128 *x);
+   VARDECL(__m128 *y);
+   int N, L;
+   N = len>>2;
+   L = nb_pitch>>2;
+   ALLOC(x, N, __m128);
+   ALLOC(y, N+L, __m128);
+   for (i=0;i<N;i++)
+      x[i] = _mm_loadu_ps(_x+(i<<2));
+   for (offset=0;offset<4;offset++)
+   {
+      for (i=0;i<N+L;i++)
+         y[i] = _mm_loadu_ps(_y+(i<<2)+offset);
+      for (i=0;i<L;i++)
+      {
+         int j;
+         __m128 sum, *xx, *yy;
+         sum = _mm_setzero_ps();
+         yy = y+i;
+         xx = x;
+         for (j=0;j<N;j+=2)
+         {
+            sum = _mm_add_ps(sum, _mm_mul_ps(xx[0], yy[0]));
+            sum = _mm_add_ps(sum, _mm_mul_ps(xx[1], yy[1]));
+            xx += 2;
+            yy += 2;
+         }
+         sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
+         sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
+         _mm_store_ss(corr+nb_pitch-1-(i<<2)-offset, sum);
+      }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/math_approx.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file math_approx.h
+   @brief Various math approximation functions for Speex
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MATH_APPROX_H
+#define MATH_APPROX_H
+
+#include "misc.h"
+
+spx_word16_t spx_cos(spx_word16_t x);
+spx_int16_t spx_ilog2(spx_uint32_t x);
+spx_int16_t spx_ilog4(spx_uint32_t x);
+#ifdef FIXED_POINT
+spx_word16_t spx_sqrt(spx_word32_t x);
+spx_word16_t spx_acos(spx_word16_t x);
+spx_word32_t spx_exp(spx_word16_t x);
+spx_word16_t spx_cos_norm(spx_word32_t x);
+
+/* Input in Q15, output in Q14 */
+spx_word16_t spx_atan(spx_word32_t x);
+
+#else
+
+#define spx_sqrt sqrt
+#define spx_acos acos
+#define spx_exp exp
+#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
+#define spx_atan atan
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/misc.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,130 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file misc.h
+   @brief Various compatibility routines for Speex
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef MISC_H
+#define MISC_H
+
+#ifndef SPEEX_VERSION
+#define SPEEX_MAJOR_VERSION 1         /**< Major Speex version. */
+#define SPEEX_MINOR_VERSION 1         /**< Minor Speex version. */
+#define SPEEX_MICRO_VERSION 14        /**< Micro Speex version. */
+#define SPEEX_EXTRA_VERSION ""        /**< Extra Speex version. */
+#define SPEEX_VERSION "speex-1.2beta2"  /**< Speex version string. */
+#endif
+
+/* A couple test to catch stupid option combinations */
+#ifdef FIXED_POINT
+
+#ifdef _USE_SSE
+#error SSE is only for floating-point
+#endif
+#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
+#error Make up your mind. What CPU do you have?
+#endif
+#ifdef VORBIS_PSYCHO
+#error Vorbis-psy model currently not implemented in fixed-point
+#endif
+
+#else
+
+#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
+#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
+#endif
+#ifdef FIXED_POINT_DEBUG
+#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
+#endif
+
+
+#endif
+
+#include "arch.h"
+
+#ifndef RELEASE
+/** Print a named vector to stdout */
+void print_vec(float *vec, int len, char *name);
+#endif
+
+/** Convert little endian */
+static inline spx_int32_t le_int(spx_int32_t i)
+{
+#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) )
+   spx_uint32_t ui, ret;
+   ui = i;
+   ret =  ui>>24;
+   ret |= (ui>>8)&0x0000ff00;
+   ret |= (ui<<8)&0x00ff0000;
+   ret |= (ui<<24);
+   return ret;
+#else
+   return i;
+#endif
+}
+
+/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
+void *speex_alloc (int size);
+
+/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
+void *speex_alloc_scratch (int size);
+
+/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
+void *speex_realloc (void *ptr, int size);
+
+/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
+void speex_free (void *ptr);
+
+/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
+void speex_free_scratch (void *ptr);
+
+/** Speex wrapper for mem_move */
+void *speex_move (void *dest, void *src, int n);
+
+/** Abort with an error message to stderr (internal Speex error) */
+void speex_error(const char *str);
+
+/** Print warning message to stderr (programming error) */
+void speex_warning(const char *str);
+
+/** Print warning message with integer argument to stderr */
+void speex_warning_int(const char *str, int val);
+
+/** Print notification message to stderr */
+void speex_notify(const char *str);
+
+/** Generate a random number */
+spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed);
+
+/** Speex wrapper for putc */
+void _speex_putc(int ch, void *file);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/misc_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,54 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @file misc_bfin.h
+   @author Jean-Marc Valin 
+   @brief Various compatibility routines for Speex (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_SPEEX_MOVE
+void *speex_move (void *dest, void *src, int n)
+{
+   __asm__ __volatile__
+         (
+         "L0 = 0;\n\t"
+         "I0 = %0;\n\t"
+         "R0 = [I0++];\n\t"
+         "LOOP move%= LC0 = %2;\n\t"
+         "LOOP_BEGIN move%=;\n\t"
+            "[%1++] = R0 || R0 = [I0++];\n\t"
+         "LOOP_END move%=;\n\t"
+         "[%1++] = R0;\n\t"
+   : "=a" (src), "=a" (dest)
+   : "a" ((n>>2)-1), "0" (src), "1" (dest)
+   : "R0", "I0", "L0", "memory"
+         );
+   return dest;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/modes.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,166 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin */
+/**
+   @file modes.h
+   @brief Describes the different modes of the codec
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef MODES_H
+#define MODES_H
+
+#include <speex/speex.h>
+#include <speex/speex_bits.h>
+#include "misc.h"
+
+#define NB_SUBMODES 16
+#define NB_SUBMODE_BITS 4
+
+#define SB_SUBMODES 8
+#define SB_SUBMODE_BITS 3
+
+/* Used internally, NOT TO BE USED in applications */
+/** Used internally*/
+#define SPEEX_GET_PI_GAIN 100
+/** Used internally*/
+#define SPEEX_GET_EXC     101
+/** Used internally*/
+#define SPEEX_GET_INNOV   102
+/** Used internally*/
+#define SPEEX_GET_DTX_STATUS   103
+/** Used internally*/
+#define SPEEX_SET_INNOVATION_SAVE   104
+/** Used internally*/
+#define SPEEX_SET_WIDEBAND   105
+
+/** Used internally*/
+#define SPEEX_GET_STACK   106
+
+
+/** Quantizes LSPs */
+typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *);
+
+/** Decodes quantized LSPs */
+typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *);
+
+
+/** Long-term predictor quantization */
+typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *, 
+                              spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, 
+                              int, int, SpeexBits*, char *, spx_word16_t *, spx_word16_t *, int, int, int, spx_word32_t *);
+
+/** Long-term un-quantize */
+typedef void (*ltp_unquant_func)(spx_word16_t *, spx_word32_t *, int, int, spx_word16_t, const void *, int, int *,
+                                 spx_word16_t *, SpeexBits*, char*, int, int, spx_word16_t, int);
+
+
+/** Innovation quantization function */
+typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, 
+                                      spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int);
+
+/** Innovation unquantization function */
+typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_int32_t *);
+
+/** Description of a Speex sub-mode (wither narrowband or wideband */
+typedef struct SpeexSubmode {
+   int     lbr_pitch;          /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/
+   int     forced_pitch_gain;  /**< Use the same (forced) pitch gain for all sub-frames */
+   int     have_subframe_gain; /**< Number of bits to use as sub-frame innovation gain */
+   int     double_codebook;    /**< Apply innovation quantization twice for higher quality (and higher bit-rate)*/
+   /*LSP functions*/
+   lsp_quant_func    lsp_quant; /**< LSP quantization function */
+   lsp_unquant_func  lsp_unquant; /**< LSP unquantization function */
+
+   /*Lont-term predictor functions*/
+   ltp_quant_func    ltp_quant; /**< Long-term predictor (pitch) quantizer */
+   ltp_unquant_func  ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */
+   const void       *ltp_params; /**< Pitch parameters (options) */
+
+   /*Quantization of innovation*/
+   innovation_quant_func innovation_quant; /**< Innovation quantization */
+   innovation_unquant_func innovation_unquant; /**< Innovation un-quantization */
+   const void             *innovation_params; /**< Innovation quantization parameters*/
+
+   spx_word16_t      comb_gain;  /**< Gain of enhancer comb filter */
+
+   int               bits_per_frame; /**< Number of bits per frame after encoding*/
+} SpeexSubmode;
+
+/** Struct defining the encoding/decoding mode*/
+typedef struct SpeexNBMode {
+   int     frameSize;      /**< Size of frames used for encoding */
+   int     subframeSize;   /**< Size of sub-frames used for encoding */
+   int     lpcSize;        /**< Order of LPC filter */
+   int     pitchStart;     /**< Smallest pitch value allowed */
+   int     pitchEnd;       /**< Largest pitch value allowed */
+
+   spx_word16_t gamma1;    /**< Perceptual filter parameter #1 */
+   spx_word16_t gamma2;    /**< Perceptual filter parameter #2 */
+   float   lag_factor;     /**< Lag-windowing parameter */
+   spx_word16_t   lpc_floor;      /**< Noise floor for LPC analysis */
+
+#ifdef EPIC_48K
+   int     lbr48k;         /**< 1 for the special 4.8 kbps mode */
+#endif
+
+   const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
+   int     defaultSubmode; /**< Default sub-mode to use when encoding */
+   int     quality_map[11]; /**< Mode corresponding to each quality setting */
+} SpeexNBMode;
+
+
+/** Struct defining the encoding/decoding mode for SB-CELP (wideband) */
+typedef struct SpeexSBMode {
+   const SpeexMode *nb_mode;    /**< Embedded narrowband mode */
+   int     frameSize;     /**< Size of frames used for encoding */
+   int     subframeSize;  /**< Size of sub-frames used for encoding */
+   int     lpcSize;       /**< Order of LPC filter */
+   int     bufSize;       /**< Signal buffer size in encoder */
+   spx_word16_t gamma1;   /**< Perceptual filter parameter #1 */
+   spx_word16_t gamma2;   /**< Perceptual filter parameter #1 */
+   float   lag_factor;    /**< Lag-windowing parameter */
+   spx_word16_t   lpc_floor;     /**< Noise floor for LPC analysis */
+   spx_word16_t   folding_gain;
+
+   const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
+   int     defaultSubmode; /**< Default sub-mode to use when encoding */
+   int     low_quality_map[11]; /**< Mode corresponding to each quality setting */
+   int     quality_map[11]; /**< Mode corresponding to each quality setting */
+   const float (*vbr_thresh)[11];
+   int     nb_modes;
+} SpeexSBMode;
+
+int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits);
+int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out);
+
+int nb_mode_query(const void *mode, int request, void *ptr);
+int wb_mode_query(const void *mode, int request, void *ptr);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/nb_celp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,209 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin */
+/**
+    @file nb_celp.h
+    @brief Narrowband CELP encoder/decoder
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef NB_CELP_H
+#define NB_CELP_H
+
+#include "modes.h"
+#include <speex/speex_bits.h>
+#include <speex/speex_callbacks.h>
+#include "vbr.h"
+#include "filters.h"
+
+#ifdef VORBIS_PSYCHO
+#include "vorbis_psy.h"
+#endif
+
+/**Structure representing the full state of the narrowband encoder*/
+typedef struct EncState {
+   const SpeexMode *mode;        /**< Mode corresponding to the state */
+   int    first;                 /**< Is this the first frame? */
+   int    frameSize;             /**< Size of frames */
+   int    subframeSize;          /**< Size of sub-frames */
+   int    nbSubframes;           /**< Number of sub-frames */
+   int    windowSize;            /**< Analysis (LPC) window length */
+   int    lpcSize;               /**< LPC order */
+   int    min_pitch;             /**< Minimum pitch value allowed */
+   int    max_pitch;             /**< Maximum pitch value allowed */
+
+   spx_word32_t cumul_gain;      /**< Product of previously used pitch gains (Q10) */
+   int    bounded_pitch;         /**< Next frame should not rely on previous frames for pitch */
+   int    ol_pitch;              /**< Open-loop pitch */
+   int    ol_voiced;             /**< Open-loop voiced/non-voiced decision */
+   int   *pitch;
+
+#ifdef EPIC_48K
+   int    lbr_48k;
+#endif
+
+#ifdef VORBIS_PSYCHO
+   VorbisPsy *psy;
+   float *psy_window;
+   float *curve;
+   float *old_curve;
+#endif
+
+   spx_word16_t  gamma1;         /**< Perceptual filter: A(z/gamma1) */
+   spx_word16_t  gamma2;         /**< Perceptual filter: A(z/gamma2) */
+   float  lag_factor;            /**< Lag windowing Gaussian width */
+   spx_word16_t  lpc_floor;      /**< Noise floor multiplier for A[0] in LPC analysis*/
+   char  *stack;                 /**< Pseudo-stack allocation for temporary memory */
+   spx_word16_t *winBuf;         /**< Input buffer (original signal) */
+   spx_word16_t *excBuf;         /**< Excitation buffer */
+   spx_word16_t *exc;            /**< Start of excitation frame */
+   spx_word16_t *swBuf;          /**< Weighted signal buffer */
+   spx_word16_t *sw;             /**< Start of weighted signal frame */
+   const spx_word16_t *window;   /**< Temporary (Hanning) window */
+   spx_word16_t *lagWindow;      /**< Window applied to auto-correlation */
+   spx_lsp_t *old_lsp;           /**< LSPs for previous frame */
+   spx_lsp_t *old_qlsp;          /**< Quantized LSPs for previous frame */
+   spx_mem_t *mem_sp;            /**< Filter memory for signal synthesis */
+   spx_mem_t *mem_sw;            /**< Filter memory for perceptually-weighted signal */
+   spx_mem_t *mem_sw_whole;      /**< Filter memory for perceptually-weighted signal (whole frame)*/
+   spx_mem_t *mem_exc;           /**< Filter memory for excitation (whole frame) */
+   spx_mem_t *mem_exc2;          /**< Filter memory for excitation (whole frame) */
+   spx_mem_t mem_hp[2];          /**< High-pass filter memory */
+   spx_word32_t *pi_gain;        /**< Gain of LPC filter at theta=pi (fe/2) */
+   spx_word16_t *innov_rms_save; /**< If non-NULL, innovation RMS is copied here */
+         
+   VBRState *vbr;                /**< State of the VBR data */
+   float  vbr_quality;           /**< Quality setting for VBR encoding */
+   float  relative_quality;      /**< Relative quality that will be needed by VBR */
+   spx_int32_t vbr_enabled;      /**< 1 for enabling VBR, 0 otherwise */
+   spx_int32_t vbr_max;          /**< Max bit-rate allowed in VBR mode */
+   int    vad_enabled;           /**< 1 for enabling VAD, 0 otherwise */
+   int    dtx_enabled;           /**< 1 for enabling DTX, 0 otherwise */
+   int    dtx_count;             /**< Number of consecutive DTX frames */
+   spx_int32_t abr_enabled;      /**< ABR setting (in bps), 0 if off */
+   float  abr_drift;
+   float  abr_drift2;
+   float  abr_count;
+   int    complexity;            /**< Complexity setting (0-10 from least complex to most complex) */
+   spx_int32_t sampling_rate;
+   int    plc_tuning;
+   int    encode_submode;
+   const SpeexSubmode * const *submodes; /**< Sub-mode data */
+   int    submodeID;             /**< Activated sub-mode */
+   int    submodeSelect;         /**< Mode chosen by the user (may differ from submodeID if VAD is on) */
+   int    isWideband;            /**< Is this used as part of the embedded wideband codec */
+   int    highpass_enabled;        /**< Is the input filter enabled */
+} EncState;
+
+/**Structure representing the full state of the narrowband decoder*/
+typedef struct DecState {
+   const SpeexMode *mode;       /**< Mode corresponding to the state */
+   int    first;                /**< Is this the first frame? */
+   int    count_lost;           /**< Was the last frame lost? */
+   int    frameSize;            /**< Size of frames */
+   int    subframeSize;         /**< Size of sub-frames */
+   int    nbSubframes;          /**< Number of sub-frames */
+   int    lpcSize;              /**< LPC order */
+   int    min_pitch;            /**< Minimum pitch value allowed */
+   int    max_pitch;            /**< Maximum pitch value allowed */
+   spx_int32_t sampling_rate;
+
+#ifdef EPIC_48K
+   int    lbr_48k;
+#endif
+
+   spx_word16_t  last_ol_gain;  /**< Open-loop gain for previous frame */
+
+   char  *stack;                /**< Pseudo-stack allocation for temporary memory */
+   spx_word16_t *excBuf;        /**< Excitation buffer */
+   spx_word16_t *exc;           /**< Start of excitation frame */
+   spx_lsp_t *old_qlsp;         /**< Quantized LSPs for previous frame */
+   spx_coef_t *interp_qlpc;     /**< Interpolated quantized LPCs */
+   spx_mem_t *mem_sp;           /**< Filter memory for synthesis signal */
+   spx_mem_t mem_hp[2];         /**< High-pass filter memory */
+   spx_word32_t *pi_gain;       /**< Gain of LPC filter at theta=pi (fe/2) */
+   spx_word16_t *innov_save;    /** If non-NULL, innovation is copied here */
+   
+   spx_word16_t level;
+   spx_word16_t max_level;
+   spx_word16_t min_level;
+   
+   /* This is used in packet loss concealment */
+   int    last_pitch;           /**< Pitch of last correctly decoded frame */
+   spx_word16_t  last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
+   spx_word16_t  pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */
+   int    pitch_gain_buf_idx;   /**< Tail of the buffer */
+   spx_int32_t seed;            /** Seed used for random number generation */
+   
+   int    encode_submode;
+   const SpeexSubmode * const *submodes; /**< Sub-mode data */
+   int    submodeID;            /**< Activated sub-mode */
+   int    lpc_enh_enabled;      /**< 1 when LPC enhancer is on, 0 otherwise */
+   SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
+
+   SpeexCallback user_callback;
+
+   /*Vocoder data*/
+   spx_word16_t  voc_m1;
+   spx_word32_t  voc_m2;
+   float  voc_mean;
+   int    voc_offset;
+
+   int    dtx_enabled;
+   int    isWideband;            /**< Is this used as part of the embedded wideband codec */
+   int    highpass_enabled;        /**< Is the input filter enabled */
+} DecState;
+
+/** Initializes encoder state*/
+void *nb_encoder_init(const SpeexMode *m);
+
+/** De-allocates encoder state resources*/
+void nb_encoder_destroy(void *state);
+
+/** Encodes one frame*/
+int nb_encode(void *state, void *in, SpeexBits *bits);
+
+
+/** Initializes decoder state*/
+void *nb_decoder_init(const SpeexMode *m);
+
+/** De-allocates decoder state resources*/
+void nb_decoder_destroy(void *state);
+
+/** Decodes one frame*/
+int nb_decode(void *state, SpeexBits *bits, void *out);
+
+/** ioctl-like function for controlling a narrowband encoder */
+int nb_encoder_ctl(void *state, int request, void *ptr);
+
+/** ioctl-like function for controlling a narrowband decoder */
+int nb_decoder_ctl(void *state, int request, void *ptr);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/pseudofloat.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,378 @@
+/* Copyright (C) 2005 Jean-Marc Valin */
+/**
+   @file pseudofloat.h
+   @brief Pseudo-floating point
+ * This header file provides a lightweight floating point type for
+ * use on fixed-point platforms when a large dynamic range is 
+ * required. The new type is not compatible with the 32-bit IEEE format,
+ * it is not even remotely as accurate as 32-bit floats, and is not
+ * even guaranteed to produce even remotely correct results for code
+ * other than Speex. It makes all kinds of shortcuts that are acceptable
+ * for Speex, but may not be acceptable for your application. You're
+ * quite welcome to reuse this code and improve it, but don't assume
+ * it works out of the box. Most likely, it doesn't.
+ */
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef PSEUDOFLOAT_H
+#define PSEUDOFLOAT_H
+
+#include "misc.h"
+#include "math_approx.h"
+#include <math.h>
+
+#ifdef FIXED_POINT
+
+typedef struct {
+   spx_int16_t m;
+   spx_int16_t e;
+} spx_float_t;
+
+static const spx_float_t FLOAT_ZERO = {0,0};
+static const spx_float_t FLOAT_ONE = {16384,-14};
+static const spx_float_t FLOAT_HALF = {16384,-15};
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+static inline spx_float_t PSEUDOFLOAT(spx_int32_t x)
+{
+   int e=0;
+   int sign=0;
+   if (x<0)
+   {
+      sign = 1;
+      x = -x;
+   }
+   if (x==0)
+   {
+      spx_float_t r = {0,0};
+      return r;
+   }
+   e = spx_ilog2(ABS32(x))-14;
+   x = VSHR32(x, e);
+   if (sign)
+   {
+      spx_float_t r;
+      r.m = -x;
+      r.e = e;
+      return r;
+   }
+   else      
+   {
+      spx_float_t r;
+      r.m = x;
+      r.e = e;
+      return r;
+   }
+}
+
+
+static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b)
+{
+   spx_float_t r;
+   if (a.m==0)
+      return b;
+   else if (b.m==0)
+      return a;
+   if ((a).e > (b).e) 
+   {
+      r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1));
+      r.e = (a).e+1;
+   }
+   else 
+   {
+      r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1));
+      r.e = (b).e+1;
+   }
+   if (r.m>0)
+   {
+      if (r.m<16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   } else {
+      if (r.m>-16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   }
+   /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
+   return r;
+}
+
+static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b)
+{
+   spx_float_t r;
+   if (a.m==0)
+      return b;
+   else if (b.m==0)
+      return a;
+   if ((a).e > (b).e)
+   {
+      r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1));
+      r.e = (a).e+1;
+   }
+   else 
+   {
+      r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1);
+      r.e = (b).e+1;
+   }
+   if (r.m>0)
+   {
+      if (r.m<16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   } else {
+      if (r.m>-16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   }
+   /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
+   return r;
+}
+
+static inline int FLOAT_LT(spx_float_t a, spx_float_t b)
+{
+   if (a.m==0)
+      return b.m>0;
+   else if (b.m==0)
+      return a.m<0;   
+   if ((a).e > (b).e)
+      return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
+   else 
+      return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1));
+
+}
+
+static inline int FLOAT_GT(spx_float_t a, spx_float_t b)
+{
+   return FLOAT_LT(b,a);
+}
+
+static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b)
+{
+   spx_float_t r;
+   r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
+   r.e = (a).e+(b).e+15;
+   if (r.m>0)
+   {
+      if (r.m<16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   } else {
+      if (r.m>-16384)
+      {
+         r.m<<=1;
+         r.e-=1;
+      }
+   }
+   /*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
+   return r;   
+}
+
+static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
+{
+   spx_float_t r;
+   r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
+   r.e = (a).e+(b).e+15;
+   return r;   
+}
+
+
+static inline spx_float_t FLOAT_SHL(spx_float_t a, int b)
+{
+   spx_float_t r;
+   r.m = a.m;
+   r.e = a.e+b;
+   return r;
+}
+
+static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a)
+{
+   if (a.e<0)
+      return EXTRACT16((EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e);
+   else
+      return a.m<<a.e;
+}
+
+static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a)
+{
+   if (a.e<0)
+      return (EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e;
+   else
+      return EXTEND32(a.m)<<a.e;
+}
+
+static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
+{
+   return VSHR32(MULT16_32_Q15(a.m, b),-a.e-15);
+}
+
+static inline spx_float_t FLOAT_MUL32U(spx_word32_t a, spx_word32_t b)
+{
+   int e1, e2;
+   spx_float_t r;
+   if (a==0 || b==0)
+   {
+      return FLOAT_ZERO;
+   }
+   e1 = spx_ilog2(ABS32(a));
+   a = VSHR32(a, e1-14);
+   e2 = spx_ilog2(ABS32(b));
+   b = VSHR32(b, e2-14);
+   r.m = MULT16_16_Q15(a,b);
+   r.e = e1+e2-13;
+   return r;
+}
+
+/* Do NOT attempt to divide by a negative number */
+static inline spx_float_t FLOAT_DIV32_FLOAT(spx_word32_t a, spx_float_t b)
+{
+   int e=0;
+   spx_float_t r;
+   if (a==0)
+   {
+      return FLOAT_ZERO;
+   }
+   e = spx_ilog2(ABS32(a))-spx_ilog2(b.m-1)-15;
+   a = VSHR32(a, e);
+   if (ABS32(a)>=SHL32(EXTEND32(b.m-1),15))
+   {
+      a >>= 1;
+      e++;
+   }
+   r.m = DIV32_16(a,b.m);
+   r.e = e-b.e;
+   return r;
+}
+
+
+/* Do NOT attempt to divide by a negative number */
+static inline spx_float_t FLOAT_DIV32(spx_word32_t a, spx_word32_t b)
+{
+   int e0=0,e=0;
+   spx_float_t r;
+   if (a==0)
+   {
+      return FLOAT_ZERO;
+   }
+   if (b>32767)
+   {
+      e0 = spx_ilog2(b)-14;
+      b = VSHR32(b, e0);
+      e0 = -e0;
+   }
+   e = spx_ilog2(ABS32(a))-spx_ilog2(b-1)-15;
+   a = VSHR32(a, e);
+   if (ABS32(a)>=SHL32(EXTEND32(b-1),15))
+   {
+      a >>= 1;
+      e++;
+   }
+   e += e0;
+   r.m = DIV32_16(a,b);
+   r.e = e;
+   return r;
+}
+
+/* Do NOT attempt to divide by a negative number */
+static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b)
+{
+   int e=0;
+   spx_int32_t num;
+   spx_float_t r;
+   if (b.m<=0)
+   {
+      speex_warning_int("Attempted to divide by", b.m);
+      return FLOAT_ONE;
+   }
+   num = a.m;
+   a.m = ABS16(a.m);
+   while (a.m >= b.m)
+   {
+      e++;
+      a.m >>= 1;
+   }
+   num = num << (15-e);
+   r.m = DIV32_16(num,b.m);
+   r.e = a.e-b.e-15+e;
+   return r;
+}
+
+static inline spx_float_t FLOAT_SQRT(spx_float_t a)
+{
+   spx_float_t r;
+   spx_int32_t m;
+   m = SHL32(EXTEND32(a.m), 14);
+   r.e = a.e - 14;
+   if (r.e & 1)
+   {
+      r.e -= 1;
+      m <<= 1;
+   }
+   r.e >>= 1;
+   r.m = spx_sqrt(m);
+   return r;
+}
+
+#else
+
+#define spx_float_t float
+#define FLOAT_ZERO 0.f
+#define FLOAT_ONE 1.f
+#define FLOAT_HALF 0.5f
+#define PSEUDOFLOAT(x) (x)
+#define FLOAT_MULT(a,b) ((a)*(b))
+#define FLOAT_AMULT(a,b) ((a)*(b))
+#define FLOAT_MUL32(a,b) ((a)*(b))
+#define FLOAT_DIV32(a,b) ((a)/(b))
+#define FLOAT_EXTRACT16(a) (a)
+#define FLOAT_EXTRACT32(a) (a)
+#define FLOAT_ADD(a,b) ((a)+(b))
+#define FLOAT_SUB(a,b) ((a)-(b))
+#define REALFLOAT(x) (x)
+#define FLOAT_DIV32_FLOAT(a,b) ((a)/(b))
+#define FLOAT_MUL32U(a,b) ((a)*(b))
+#define FLOAT_SHL(a,b) (a)
+#define FLOAT_LT(a,b) ((a)<(b))
+#define FLOAT_GT(a,b) ((a)>(b))
+#define FLOAT_DIVU(a,b) ((a)/(b))
+#define FLOAT_SQRT(a) (spx_sqrt(a))
+
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/quant_lsp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,83 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file quant_lsp.h
+   @brief LSP vector quantization
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef QUANT_LSP_H
+#define QUANT_LSP_H
+
+#include <speex/speex_bits.h>
+#include "misc.h"
+
+#define MAX_LSP_SIZE 20
+
+#define NB_CDBK_SIZE 64
+#define NB_CDBK_SIZE_LOW1 64
+#define NB_CDBK_SIZE_LOW2 64
+#define NB_CDBK_SIZE_HIGH1 64
+#define NB_CDBK_SIZE_HIGH2 64
+
+/*Narrowband codebooks*/
+extern const signed char cdbk_nb[];
+extern const signed char cdbk_nb_low1[];
+extern const signed char cdbk_nb_low2[];
+extern const signed char cdbk_nb_high1[];
+extern const signed char cdbk_nb_high2[];
+
+/* Quantizes narrowband LSPs with 30 bits */
+void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
+
+/* Decodes quantized narrowband LSPs */
+void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits);
+
+/* Quantizes low bit-rate narrowband LSPs with 18 bits */
+void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
+
+/* Decodes quantized low bit-rate narrowband LSPs */
+void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits);
+
+/* Quantizes high-band LSPs with 12 bits */
+void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
+
+/* Decodes high-band LSPs */
+void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
+
+#ifdef EPIC_48K
+/* Quantizes narrowband LSPs with 14 bits */
+void lsp_quant_48k(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
+
+/* Decodes quantized narrowband LSPs (14 bits) */
+void lsp_unquant_48k(spx_lsp_t *lsp, int order, SpeexBits *bits);
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/quant_lsp_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,165 @@
+/* Copyright (C) 2006 David Rowe */
+/**
+   @file quant_lsp_bfin.h
+   @author David Rowe
+   @brief Various compatibility routines for Speex (Blackfin version)
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_LSP_QUANT
+#ifdef OVERRIDE_LSP_QUANT
+
+/*
+  Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
+  well tell you all the magic resgister constraints used below
+  for gcc in-line asm.
+*/
+
+static int lsp_quant(
+  spx_word16_t      *x, 
+  const signed char *cdbk, 
+  int                nbVec, 
+  int                nbDim
+)
+{
+   int          j;
+   spx_word32_t best_dist=1<<30;
+   int          best_id=0;
+
+   __asm__ __volatile__
+     (
+"	%0 = 1 (X);\n\t"                       /* %0: best_dist */    
+"	%0 <<= 30;\n\t"     
+"	%1 = 0 (X);\n\t"                       /* %1: best_i         */
+"       P2 = %3\n\t"                           /* P2: ptr to cdbk    */
+"       R5 = 0;\n\t"                           /* R5: best cb entry  */
+
+"       R0 = %5;\n\t"                          /* set up circ addr   */
+"       R0 <<= 1;\n\t"
+"       L0 = R0;\n\t"                          
+"       I0 = %2;\n\t"                          /* %2: &x[0]          */
+"       B0 = %2;\n\t"                          
+
+"       R2.L = W [I0++];\n\t"
+"	LSETUP (lq1, lq2) LC0 = %4;\n\t"
+"lq1:	  R3 = 0;\n\t"                         /* R3: dist           */
+"	  LSETUP (lq3, lq4) LC1 = %5;\n\t"
+"lq3:       R1 = B [P2++] (X);\n\t"            
+"	    R1 <<= 5;\n\t"
+"	    R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t"
+"	    R0 = R0.L*R0.L;\n\t"
+"lq4:	    R3 = R3 + R0;\n\t"
+
+"	  cc =R3<%0;\n\t"
+"	  if cc %0=R3;\n\t"
+"	  if cc %1=R5;\n\t"
+"lq2:     R5 += 1;\n\t"
+"         L0 = 0;\n\t"
+   : "=&d" (best_dist), "=&d" (best_id)
+   : "a" (x), "b" (cdbk), "a" (nbVec), "a" (nbDim)
+   : "I0", "P2", "R0", "R1", "R2", "R3", "R5", "L0", "B0", "A0"
+   );
+
+   for (j=0;j<nbDim;j++) {
+      x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
+   }
+   return best_id;
+}
+#endif
+
+#define OVERRIDE_LSP_WEIGHT_QUANT
+#ifdef OVERRIDE_LSP_WEIGHT_QUANT
+
+/*
+  Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
+  well tell you all the magic resgister constraints used below
+  for gcc in-line asm.
+*/
+
+static int lsp_weight_quant(
+  spx_word16_t      *x, 
+  spx_word16_t      *weight, 
+  const signed char *cdbk, 
+  int                nbVec, 
+  int                nbDim
+)
+{
+   int          j;
+   spx_word32_t best_dist=1<<30;
+   int          best_id=0;
+
+   __asm__ __volatile__
+     (
+"	%0 = 1 (X);\n\t"                       /* %0: best_dist */    
+"	%0 <<= 30;\n\t"     
+"	%1 = 0 (X);\n\t"                       /* %1: best_i         */
+"       P2 = %4\n\t"                           /* P2: ptr to cdbk    */
+"       R5 = 0;\n\t"                           /* R5: best cb entry  */
+
+"       R0 = %6;\n\t"                          /* set up circ addr   */
+"       R0 <<= 1;\n\t"
+"       L0 = R0;\n\t"                          
+"       L1 = R0;\n\t"
+"       I0 = %2;\n\t"                          /* %2: &x[0]          */
+"	I1 = %3;\n\t"                          /* %3: &weight[0]     */
+"       B0 = %2;\n\t"                          
+"	B1 = %3;\n\t"                          
+
+"	LSETUP (lwq1, lwq2) LC0 = %5;\n\t"
+"lwq1:	  R3 = 0 (X);\n\t"                     /* R3: dist           */
+"	  LSETUP (lwq3, lwq4) LC1 = %6;\n\t"
+"lwq3:	    R0.L = W [I0++] || R2.L = W [I1++];\n\t"
+"           R1 = B [P2++] (X);\n\t"            
+"	    R1 <<= 5;\n\t"
+"	    R0.L = R0.L - R1.L;\n\t"
+"           R0 = R0.L*R0.L;\n\t"
+"	    A1 = R2.L*R0.L (M,IS);\n\t"
+"	    A1 = A1 >>> 16;\n\t"
+"	    R1 = (A1 += R2.L*R0.H) (IS);\n\t"
+"lwq4:	    R3 = R3 + R1;\n\t"
+
+"	  cc =R3<%0;\n\t"
+"	  if cc %0=R3;\n\t"
+"	  if cc %1=R5;\n\t"
+"lwq2:    R5 += 1;\n\t"
+"         L0 = 0;\n\t"
+"         L1 = 0;\n\t"
+   : "=&d" (best_dist), "=&d" (best_id)
+   : "a" (x), "a" (weight), "b" (cdbk), "a" (nbVec), "a" (nbDim)
+   : "I0", "I1", "P2", "R0", "R1", "R2", "R3", "R5", "A1",
+     "L0", "L1", "B0", "B1"
+   );
+
+   for (j=0;j<nbDim;j++) {
+      x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
+   }
+   return best_id;
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/sb_celp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,155 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin */
+/**
+   @file sb_celp.h
+   @brief Sub-band CELP mode used for wideband encoding
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef SB_CELP_H
+#define SB_CELP_H
+
+#include "modes.h"
+#include <speex/speex_bits.h>
+#include "nb_celp.h"
+
+/**Structure representing the full state of the sub-band encoder*/
+typedef struct SBEncState {
+   const SpeexMode *mode;         /**< Pointer to the mode (containing for vtable info) */
+   void *st_low;                  /**< State of the low-band (narrowband) encoder */
+   int    full_frame_size;        /**< Length of full-band frames*/
+   int    frame_size;             /**< Length of high-band frames*/
+   int    subframeSize;           /**< Length of high-band sub-frames*/
+   int    nbSubframes;            /**< Number of high-band sub-frames*/
+   int    windowSize;             /**< Length of high-band LPC window*/
+   int    lpcSize;                /**< Order of high-band LPC analysis */
+   int    bufSize;                /**< Buffer size */
+   int    first;                  /**< First frame? */
+   float  lag_factor;             /**< Lag-windowing control parameter */
+   spx_word16_t  lpc_floor;       /**< Controls LPC analysis noise floor */
+   spx_word16_t  gamma1;          /**< Perceptual weighting coef 1 */
+   spx_word16_t  gamma2;          /**< Perceptual weighting coef 2 */
+
+   char  *stack;                  /**< Temporary allocation stack */
+   spx_word16_t *high;               /**< High-band signal (buffer) */
+   spx_word16_t *h0_mem, *h1_mem;
+
+   const spx_word16_t *window;    /**< LPC analysis window */
+   spx_word16_t *lagWindow;       /**< Auto-correlation window */
+   spx_lsp_t *old_lsp;            /**< LSPs of previous frame */
+   spx_lsp_t *old_qlsp;           /**< Quantized LSPs of previous frame */
+   spx_coef_t *interp_qlpc;       /**< Interpolated quantized LPCs for current sub-frame */
+
+   spx_mem_t *mem_sp;             /**< Synthesis signal memory */
+   spx_mem_t *mem_sp2;
+   spx_mem_t *mem_sw;             /**< Perceptual signal memory */
+   spx_word32_t *pi_gain;
+   spx_word16_t *exc_rms;
+   spx_word16_t *innov_rms_save;         /**< If non-NULL, innovation is copied here */
+
+   float  vbr_quality;            /**< Quality setting for VBR encoding */
+   int    vbr_enabled;            /**< 1 for enabling VBR, 0 otherwise */
+   spx_int32_t vbr_max;           /**< Max bit-rate allowed in VBR mode (total) */
+   spx_int32_t vbr_max_high;      /**< Max bit-rate allowed in VBR mode for the high-band */
+   spx_int32_t abr_enabled;       /**< ABR setting (in bps), 0 if off */
+   float  abr_drift;
+   float  abr_drift2;
+   float  abr_count;
+   int    vad_enabled;            /**< 1 for enabling VAD, 0 otherwise */
+   float  relative_quality;
+
+   int    encode_submode;
+   const SpeexSubmode * const *submodes;
+   int    submodeID;
+   int    submodeSelect;
+   int    complexity;
+   spx_int32_t sampling_rate;
+
+} SBEncState;
+
+
+/**Structure representing the full state of the sub-band decoder*/
+typedef struct SBDecState {
+   const SpeexMode *mode;            /**< Pointer to the mode (containing for vtable info) */
+   void *st_low;               /**< State of the low-band (narrowband) encoder */
+   int    full_frame_size;
+   int    frame_size;
+   int    subframeSize;
+   int    nbSubframes;
+   int    lpcSize;
+   int    first;
+   spx_int32_t sampling_rate;
+   int    lpc_enh_enabled;
+
+   char  *stack;
+   spx_word32_t *g0_mem, *g1_mem;
+
+   spx_word16_t *excBuf;
+   spx_lsp_t *old_qlsp;
+   spx_coef_t *interp_qlpc;
+
+   spx_mem_t *mem_sp;
+   spx_word32_t *pi_gain;
+   spx_word16_t *exc_rms;
+   spx_word16_t *innov_save;      /** If non-NULL, innovation is copied here */
+   
+   spx_word16_t last_ener;
+   spx_int32_t seed;
+
+   int    encode_submode;
+   const SpeexSubmode * const *submodes;
+   int    submodeID;
+} SBDecState;
+
+
+/**Initializes encoder state*/
+void *sb_encoder_init(const SpeexMode *m);
+
+/**De-allocates encoder state resources*/
+void sb_encoder_destroy(void *state);
+
+/**Encodes one frame*/
+int sb_encode(void *state, void *in, SpeexBits *bits);
+
+
+/**Initializes decoder state*/
+void *sb_decoder_init(const SpeexMode *m);
+
+/**De-allocates decoder state resources*/
+void sb_decoder_destroy(void *state);
+
+/**Decodes one frame*/
+int sb_decode(void *state, SpeexBits *bits, void *out);
+
+int sb_encoder_ctl(void *state, int request, void *ptr);
+
+int sb_decoder_ctl(void *state, int request, void *ptr);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/smallft.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,46 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001             *
+ * by the XIPHOPHORUS Company http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+ function: fft transform
+ last mod: $Id: smallft.h,v 1.3 2003/09/16 18:35:45 jm Exp $
+
+ ********************************************************************/
+/**
+   @file smallft.h
+   @brief Discrete Rotational Fourier Transform (DRFT)
+*/
+
+#ifndef _V_SMFT_H_
+#define _V_SMFT_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Discrete Rotational Fourier Transform lookup */
+struct drft_lookup{
+  int n;
+  float *trigcache;
+  int *splitcache;
+};
+
+extern void spx_drft_forward(struct drft_lookup *l,float *data);
+extern void spx_drft_backward(struct drft_lookup *l,float *data);
+extern void spx_drft_init(struct drft_lookup *l,int n);
+extern void spx_drft_clear(struct drft_lookup *l);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/stack_alloc.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,133 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file stack_alloc.h
+   @brief Temporary memory allocation on stack
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef STACK_ALLOC_H
+#define STACK_ALLOC_H
+
+#ifdef USE_ALLOCA
+#ifdef WIN32
+#include <malloc.h>
+#else
+#include <alloca.h>
+#endif
+#endif
+
+/**
+ * @def ALIGN(stack, size)
+ *
+ * Aligns the stack to a 'size' boundary
+ *
+ * @param stack Stack
+ * @param size  New size boundary
+ */
+
+/**
+ * @def PUSH(stack, size, type)
+ *
+ * Allocates 'size' elements of type 'type' on the stack
+ *
+ * @param stack Stack
+ * @param size  Number of elements
+ * @param type  Type of element
+ */
+
+/**
+ * @def PUSHS(stack, type)
+ *
+ * Allocates a struct stack 
+ *
+ * @param stack Stack
+ * @param type  Struct type
+ */
+
+/**
+ * @def VARDECL(var)
+ *
+ * Declare variable on stack
+ *
+ * @param var Variable to declare
+ */
+
+/**
+ * @def ALLOC(var, size, type)
+ *
+ * Allocate 'size' elements of 'type' on stack
+ *
+ * @param var  Name of variable to allocate
+ * @param size Number of elements
+ * @param type Type of element
+ */
+
+#ifdef BAIDU_SPEEX_ENCODE_STACK_MONITOR
+extern char *g_p_spx_enc_stk_top;
+#endif
+
+#ifdef ENABLE_VALGRIND
+
+#include <valgrind/memcheck.h>
+
+#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+
+#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
+
+#define PUSHS(stack, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(long)),VALGRIND_MAKE_WRITABLE(stack, (sizeof(type))),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
+
+#else
+
+#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
+
+#ifdef BAIDU_SPEEX_ENCODE_STACK_MONITOR
+#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)), (g_p_spx_enc_stk_top = (stack > g_p_spx_enc_stk_top) ? (stack):g_p_spx_enc_stk_top), (type*)((stack)-((size)*sizeof(type))))
+#else
+#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
+#endif
+
+
+#define PUSHS(stack, type) (ALIGN((stack),sizeof(long)),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
+
+#endif
+
+#if defined(VAR_ARRAYS)
+#define VARDECL(var) 
+#define ALLOC(var, size, type) type var[size]
+#elif defined(USE_ALLOCA)
+#define VARDECL(var) var
+#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
+#else
+#define VARDECL(var) var
+#define ALLOC(var, size, type) var = PUSH(stack, size, type)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vbr.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,70 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file vbr.h
+   @brief Variable Bit-Rate (VBR) related routines
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+#ifndef VBR_H
+#define VBR_H
+
+#include "misc.h"
+
+#define VBR_MEMORY_SIZE 5
+
+extern const float vbr_nb_thresh[9][11];
+extern const float vbr_hb_thresh[5][11];
+extern const float vbr_uhb_thresh[2][11];
+
+/** VBR state. */
+typedef struct VBRState {
+   float energy_alpha;
+   float average_energy;
+   float last_energy;
+   float last_log_energy[VBR_MEMORY_SIZE];
+   float accum_sum;
+   float last_pitch_coef;
+   float soft_pitch;
+   float last_quality;
+   float noise_level;
+   float noise_accum;
+   float noise_accum_count;
+   int   consec_noise;
+} VBRState;
+
+void vbr_init(VBRState *vbr);
+
+float vbr_analysis(VBRState *vbr, spx_word16_t *sig, int len, int pitch, float pitch_coef);
+
+void vbr_destroy(VBRState *vbr);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vorbis_psy.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,97 @@
+/* Copyright (C) 2005 Jean-Marc Valin, CSIRO, Christopher Montgomery
+   File: vorbis_psy.h
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef VORBIS_PSY_H
+#define VORBIS_PSY_H
+
+#ifdef VORBIS_PSYCHO
+
+#include "smallft.h"
+#define P_BANDS 17      /* 62Hz to 16kHz */
+#define NOISE_COMPAND_LEVELS 40
+
+
+#define todB(x)   ((x)==0?-400.f:log((x)*(x))*4.34294480f)
+#define fromdB(x) (exp((x)*.11512925f))  
+
+/* The bark scale equations are approximations, since the original
+   table was somewhat hand rolled.  The below are chosen to have the
+   best possible fit to the rolled tables, thus their somewhat odd
+   appearance (these are more accurate and over a longer range than
+   the oft-quoted bark equations found in the texts I have).  The
+   approximations are valid from 0 - 30kHz (nyquist) or so.
+
+   all f in Hz, z in Bark */
+
+#define toBARK(n)   (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
+#define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
+
+/* Frequency to octave.  We arbitrarily declare 63.5 Hz to be octave
+   0.0 */
+
+#define toOC(n)     (log(n)*1.442695f-5.965784f)
+#define fromOC(o)   (exp(((o)+5.965784f)*.693147f))
+
+
+typedef struct {
+
+  float noisewindowlo;
+  float noisewindowhi;
+  int   noisewindowlomin;
+  int   noisewindowhimin;
+  int   noisewindowfixed;
+  float noiseoff[P_BANDS];
+  float noisecompand[NOISE_COMPAND_LEVELS];
+
+} VorbisPsyInfo;
+
+
+
+typedef struct {
+  int n;
+  int rate;
+  struct drft_lookup lookup;
+  VorbisPsyInfo *vi;
+
+  float *window;
+  float *noiseoffset;
+  long  *bark;
+
+} VorbisPsy;
+
+
+VorbisPsy *vorbis_psy_init(int rate, int size);
+void vorbis_psy_destroy(VorbisPsy *psy);
+void compute_curve(VorbisPsy *psy, float *audio, float *curve);
+void curve_to_lpc(VorbisPsy *psy, float *curve, float *awk1, float *awk2, int ord);
+
+#endif
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,55 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+   @file vq.h
+   @brief Vector quantization
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef VQ_H
+#define VQ_H
+
+#include "misc.h"
+
+int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries);
+int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries);
+
+int vq_index(float *in, const float *codebook, int len, int entries);
+#ifdef _USE_SSE
+#include <xmmintrin.h>
+void vq_nbest(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
+
+void vq_nbest_sign(spx_word16_t *in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
+#else
+void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
+
+void vq_nbest_sign(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack);
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_arm4.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,115 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file vq_arm4.h
+   @brief ARM4-optimized vq routine
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_VQ_NBEST
+void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
+{
+   int i,j;
+   for (i=0;i<entries;i+=4)
+   {
+#if 1
+      spx_word32_t dist1, dist2, dist3, dist4;
+      int dead1, dead2, dead3, dead4, dead5, dead6, dead7, dead8;
+      __asm__ __volatile__ (
+            "mov %0, #0 \n\t"
+            "mov %1, #0 \n\t"
+            "mov %2, #0 \n\t"
+            "mov %3, #0 \n\t"
+            "mov %10, %4 \n\t"
+            "add %4, %4, %4\n\t"
+            ".vqloop%=:\n\t"
+            "ldrsh %7, [%5], #2 \n\t"
+            "ldrsh %8, [%6] \n\t"
+            "mov %9, %6 \n\t"
+            "mla %0, %7, %8, %0 \n\t"
+            "ldrsh %8, [%9, %4]! \n\t"
+            "mla %1, %7, %8, %1 \n\t"
+            "ldrsh %8, [%9, %4]!\n\t"
+            "mla %2, %7, %8, %2 \n\t"
+            "ldrsh %8, [%9, %4]! \n\t"
+            "mla %3, %7, %8, %3 \n\t"
+            "subs %10, %10, #1 \n\t"
+            "add %6, %6, #2 \n\t"
+            "bne .vqloop%="
+         : "=r" (dist1), "=r" (dist2), "=r" (dist3), "=r" (dist4),
+      "=r" (dead1), "=r" (dead2), "=r" (codebook), "=r" (dead4),
+      "=r" (dead5), "=r" (dead6), "=r" (dead7)
+         : "4" (len), "5" (in), "6" (codebook)
+         : "cc");
+#else
+dist1=dist2=dist3=dist4=0;
+   /*   spx_word32_t dist1=0;
+      spx_word32_t dist2=0;
+      spx_word32_t dist3=0;
+      spx_word32_t dist4=0;*/
+      for (j=0;j<2;j++)
+      {
+         const spx_word16_t *code = codebook;
+         dist1 = MAC16_16(dist1,in[j],*code);
+         code += len;
+         dist2 = MAC16_16(dist2,in[j],*code);
+         code += len;
+         dist3 = MAC16_16(dist3,in[j],*code);
+         code += len;
+         dist4 = MAC16_16(dist4,in[j],*code);
+         codebook++;
+      }
+#endif
+      dist1=SUB32(SHR(*E++,1),dist1);
+      if (dist1<*best_dist || i==0)
+      {
+         *best_dist=dist1;
+         *nbest=i;
+      }
+      dist2=SUB32(SHR(*E++,1),dist2);
+      if (dist2<*best_dist)
+      {
+         *best_dist=dist2;
+         *nbest=i+1;
+      }
+      dist3=SUB32(SHR(*E++,1),dist3);
+      if (dist3<*best_dist)
+      {
+         *best_dist=dist3;
+         *nbest=i+2;
+      }
+      dist4=SUB32(SHR(*E++,1),dist4);
+      if (dist4<*best_dist)
+      {
+         *best_dist=dist4;
+         *nbest=i+3;
+      }
+      codebook += 3*len;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_bfin.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,107 @@
+/* Copyright (C) 2005 Analog Devices */
+/**
+   @file vq_bfin.h
+   @author Jean-Marc Valin 
+   @brief Blackfin-optimized vq routine
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_VQ_NBEST
+void vq_nbest(spx_word16_t *in, const spx_word16_t *codebook, int len, int entries, spx_word32_t *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
+{
+   if (N==1)
+   {
+      best_dist[0] = 2147483647;
+      {
+         spx_word32_t dist;
+         __asm__ __volatile__
+               (
+            "LC0 = %8;\n\t"
+            "R2 = 0;\n\t"
+            "I0 = %6;\n\t"
+            "B0 = %6;\n\t"
+            "L0 = %9;\n\t"
+            "LOOP entries_loop%= LC0;\n\t"
+            "LOOP_BEGIN entries_loop%=;\n\t"
+               "%0 = [%4++];\n\t"
+               "%0 >>= 1;\n\t"
+               "A0 = %0;\n\t"
+               "R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
+               "LOOP vq_loop%= LC1 = %5;\n\t"
+               "LOOP_BEGIN vq_loop%=;\n\t"
+                  "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%7] || R1.L = W[I0++];\n\t"
+               "LOOP_END vq_loop%=;\n\t"
+               "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
+               "cc = %0 < %2;\n\t"
+               "if cc %2 = %0;\n\t"
+               "if cc %3 = R2;\n\t"
+               "R2 += 1;\n\t"
+            "LOOP_END entries_loop%=;\n\t"
+            : "=&D" (dist), "=&a" (codebook), "=&d" (best_dist[0]), "=&d" (nbest[0]), "=&a" (E)
+            : "a" (len-1), "a" (in), "a" (2), "d" (entries), "d" (len<<1), "1" (codebook), "4" (E), "2" (best_dist[0]), "3" (nbest[0])
+            : "R0", "R1", "R2", "I0", "L0", "B0", "A0", "cc", "memory"
+               );
+      }
+   } else {
+   int i,k,used;
+   used = 0;
+   for (i=0;i<entries;i++)
+   {
+      spx_word32_t dist;
+      __asm__
+            (
+            "%0 >>= 1;\n\t"
+            "A0 = %0;\n\t"
+            "I0 = %3;\n\t"
+            "L0 = 0;\n\t"
+            "R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
+            "LOOP vq_loop%= LC0 = %2;\n\t"
+            "LOOP_BEGIN vq_loop%=;\n\t"
+               "%0 = (A0 -= R0.L*R1.L) (IS) || R0.L = W[%1++%4] || R1.L = W[I0++];\n\t"
+            "LOOP_END vq_loop%=;\n\t"
+            "%0 = (A0 -= R0.L*R1.L) (IS);\n\t"
+         : "=D" (dist), "=a" (codebook)
+         : "a" (len-1), "a" (in), "a" (2), "1" (codebook), "0" (E[i])
+         : "R0", "R1", "I0", "L0", "A0"
+            );
+      if (i<N || dist<best_dist[N-1])
+      {
+         for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
+         {
+            best_dist[k]=best_dist[k-1];
+            nbest[k] = nbest[k-1];
+         }
+         best_dist[k]=dist;
+         nbest[k]=i;
+         used++;
+      }
+   }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/libspeex/vq_sse.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,120 @@
+/* Copyright (C) 2004 Jean-Marc Valin */
+/**
+   @file vq_sse.h
+   @brief SSE-optimized vq routine
+*/
+/*
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   
+   - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+   
+   - Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+   
+   - Neither the name of the Xiph.org Foundation nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#define OVERRIDE_VQ_NBEST
+void vq_nbest(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
+{
+   int i,j,k,used;
+   VARDECL(float *dist);
+   VARDECL(__m128 *in);
+   __m128 half;
+   used = 0;
+   ALLOC(dist, entries, float);
+   half = _mm_set_ps1(.5f);
+   ALLOC(in, len, __m128);
+   for (i=0;i<len;i++)
+      in[i] = _mm_set_ps1(_in[i]);
+   for (i=0;i<entries>>2;i++)
+   {
+      __m128 d = _mm_mul_ps(E[i], half);
+      for (j=0;j<len;j++)
+         d = _mm_sub_ps(d, _mm_mul_ps(in[j], *codebook++));
+      _mm_storeu_ps(dist+4*i, d);
+   }
+   for (i=0;i<entries;i++)
+   {
+      if (i<N || dist[i]<best_dist[N-1])
+      {
+         for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--)
+         {
+            best_dist[k]=best_dist[k-1];
+            nbest[k] = nbest[k-1];
+         }
+         best_dist[k]=dist[i];
+         nbest[k]=i;
+         used++;
+      }
+   }
+}
+
+
+
+
+#define OVERRIDE_VQ_NBEST_SIGN
+void vq_nbest_sign(spx_word16_t *_in, const __m128 *codebook, int len, int entries, __m128 *E, int N, int *nbest, spx_word32_t *best_dist, char *stack)
+{
+   int i,j,k,used;
+   VARDECL(float *dist);
+   VARDECL(__m128 *in);
+   __m128 half;
+   used = 0;
+   ALLOC(dist, entries, float);
+   half = _mm_set_ps1(.5f);
+   ALLOC(in, len, __m128);
+   for (i=0;i<len;i++)
+      in[i] = _mm_set_ps1(_in[i]);
+   for (i=0;i<entries>>2;i++)
+   {
+      __m128 d = _mm_setzero_ps();
+      for (j=0;j<len;j++)
+         d = _mm_add_ps(d, _mm_mul_ps(in[j], *codebook++));
+      _mm_storeu_ps(dist+4*i, d);
+   }
+   for (i=0;i<entries;i++)
+   {
+      int sign;
+      if (dist[i]>0)
+      {
+         sign=0;
+         dist[i]=-dist[i];
+      } else
+      {
+         sign=1;
+      }
+      dist[i] += .5f*((float*)E)[i];
+      if (i<N || dist[i]<best_dist[N-1])
+      {
+         for (k=N-1; (k >= 1) && (k > used || dist[i] < best_dist[k-1]); k--)
+         {
+            best_dist[k]=best_dist[k-1];
+            nbest[k] = nbest[k-1];
+         }
+         best_dist[k]=dist[i];
+         nbest[k]=i;
+         used++;
+         if (sign)
+            nbest[k]+=entries;
+      }
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/speex/wavfmt/wavfmt.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,83 @@
+#ifndef WAVFMT_H
+#define WAVFMT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+    char               chunkID[4];
+    long               chunkSize;
+} ChunkHeader;
+
+
+#define RiffID "RIFF"  /* chunk ID for RIFF Chunk */
+#define RIFF_FORMAT  "WAVE" 
+
+typedef struct {
+    char               chunkID[4]; //'RIFF'
+    long               chunkSize;
+    char               RiffFmt[4];   //'WAVE' 
+} RiffChunk;
+
+
+
+#define WAVE_FORMAT_PCM             0X01
+#define WAVE_CHANNEL_MONO         1
+#define WAVE_CHANNEL_STEREO      2
+
+
+
+#define OFFSET_FMT_CHK   sizeof(RiffChunk)
+#define FormatID "fmt "    /* chunkID for Format Chunk. NOTE: There is a space at the end of this ID. */
+
+typedef struct {
+    char               chunkID[4];
+    long               chunkSize;
+    short              wFormatTag;
+    unsigned short wChannels;
+    unsigned long  dwSamplesPerSec;
+    unsigned long  dwAvgBytesPerSec;
+    unsigned short wBlockAlign;
+    unsigned short wBitsPerSample;
+    /* Note: there may be additional fields here, depending upon wFormatTag. */
+    
+} FormatChunk;
+
+
+#define OFFSET_DATA_CHK   (OFFSET_FMT_CHK + sizeof(FormatChunk))
+#define DataID "data"  /* chunk ID for data Chunk */
+
+typedef struct {
+    char               chunkID[4];
+    long               chunkSize;
+
+    unsigned char  waveformData[];
+} DataChunk;
+
+
+#define ListID "list"  /* chunk ID for list Chunk */
+
+typedef struct {
+    char               chunkID[4];      /* 'list' */
+    long               chunkSize;   /* includes the Type ID below */
+    char               typeID[];     /* 'adtl' */
+} ListHeader;
+
+
+#define WAVE_HEADER_SIZE (OFFSET_DATA_CHK + sizeof(DataChunk))
+
+
+int wavfmt_remove_header(FILE *pFile);
+int wavfmt_add_riff_chunk(FILE *pFile, long size);
+int wavfmt_add_fmt_chunk(FILE *pFile, unsigned short wChannels, unsigned long  dwSamplesPerSec, unsigned long  dwAvgBytesPerSec, unsigned short wBitsPerSample);
+int wavfmt_add_data_chunk_header(FILE *pFile, long size);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/VS1053/baidu_media_adapter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,22 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: MediaAdapter for Rda58xx
+
+#ifndef BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_VS1053_BAIDU_MEDIA_ADAPTER_H
+#define BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_VS1053_BAIDU_MEDIA_ADAPTER_H
+
+#include "baidu_rda58xx_base.h"
+
+namespace duer {
+
+class MediaAdapter : public Rda58xxBase {
+public:
+    MediaAdapter() :
+        Rda58xxBase(PB_2, PB_1, PB_8) {
+    }
+};
+
+} // namespace duer
+
+#endif // BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_VS1053_BAIDU_MEDIA_ADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/VS1053/vs10xx.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,777 @@
+/** file vs10xx.h
+ * Headers for interfacing with the mp3 player chip.
+ * Interfacing the New Way, not handling BSYNC -> not compatible with VS1001.
+ */
+
+#ifndef VS10XX_H
+#define VS10XX_H
+
+#include "mbed.h"
+
+/** VS10xx SCI Write Command byte is 0x02 */
+#define VS_WRITE_COMMAND 0x02
+/** VS10xx SCI Read Command byte is 0x03 */
+#define VS_READ_COMMAND  0x03
+
+#define SPI_MODE	0x0   /**< VS10xx register */
+#define SPI_STATUS	0x1   /**< VS10xx register */
+#define SPI_BASS	0x2   /**< VS10xx register */
+#define SPI_CLOCKF	0x3   /**< VS10xx register */
+#define SPI_DECODE_TIME	0x4   /**< VS10xx register */
+#define SPI_AUDATA	0x5   /**< VS10xx register */
+#define SPI_WRAM	0x6   /**< VS10xx register */
+#define SPI_WRAMADDR	0x7   /**< VS10xx register */
+#define SPI_HDAT0	0x8   /**< VS10xx register */
+#define SPI_HDAT1	0x9   /**< VS10xx register */
+#define SPI_AIADDR	0xa   /**< VS10xx register */
+#define SPI_VOL		0xb   /**< VS10xx register */
+#define SPI_AICTRL0	0xc   /**< VS10xx register */
+#define SPI_AICTRL1	0xd   /**< VS10xx register */
+#define SPI_AICTRL2	0xe   /**< VS10xx register */
+#define SPI_AICTRL3	0xf   /**< VS10xx register */
+
+#define SM_DIFF           (1<< 0)
+#define SM_LAYER12        (1<< 1) /* VS1063, VS1053, VS1033, VS1011 */
+#define SM_RECORD_PATH    (1<< 1) /* VS1103 */
+#define SM_RESET          (1<< 2)
+#define SM_CANCEL         (1<< 3) /* VS1063, VS1053 */
+#define SM_OUTOFWAV       (1<< 3) /* VS1033, VS1003, VS1011 */
+#define SM_OUTOFMIDI      (1<< 3) /* VS1103 */
+#define SM_EARSPEAKER_LO  (1<< 4) /* VS1053, VS1033 */
+#define SM_PDOWN          (1<< 4) /* VS1003, VS1103 */
+#define SM_TESTS          (1<< 5)
+#define SM_STREAM         (1<< 6) /* VS1053, VS1033, VS1003, VS1011 */
+#define SM_ICONF          (1<< 6) /* VS1103 */
+#define SM_EARSPEAKER_HI  (1<< 7) /* VS1053, VS1033 */
+#define SM_DACT           (1<< 8)
+#define SM_SDIORD         (1<< 9)
+#define SM_SDISHARE       (1<<10)
+#define SM_SDINEW         (1<<11)
+#define SM_ENCODE         (1<<12) /* VS1063 */
+#define SM_ADPCM          (1<<12) /* VS1053, VS1033, VS1003 */
+#define SM_EARSPEAKER1103 (1<<12) /* VS1103 */
+#define SM_ADPCM_HP       (1<<13) /* VS1033, VS1003 */
+#define SM_LINE1          (1<<14) /* VS1063, VS1053 */
+#define SM_LINE_IN        (1<<14) /* VS1033, VS1003, VS1103 */
+#define SM_CLK_RANGE      (1<<15) /* VS1063, VS1053, VS1033 */
+#define SM_ADPCM_1103     (1<<15) /* VS1103 */
+
+class vs10xx
+{
+public:
+    vs10xx(PinName MOSI, PinName MISO, PinName SCLK, PinName XCS, 
+           PinName XDCS,PinName DREQ, PinName XRESET);
+    void writeRegister(unsigned char addressbyte, unsigned int value);
+    unsigned int readRegister(unsigned char addressbyte); /** Read the 16-bit value of a VS10xx register */
+    void writeData(unsigned char *databuf, unsigned char = 32); //write 32 bytes to vs1053
+   	void writeDataU32(unsigned int *databuf, unsigned char n); //write n * 32 bits to vs1053
+   	void writeDataU8(unsigned char *databuf, unsigned char n); //write n * 8 bits to vs1053
+    void reset(void); //reset for vs10xx
+    void softReset(void); /* Soft Reset of VS10xx (Between songs) */
+    void setFreq(int freq);
+    void setVolume(unsigned char vol);
+    void loadPlugin(const unsigned short *plugin,int length);
+private:
+    //SPI _spi;
+    DigitalOut  _XCS;
+    DigitalOut  _XDCS;  
+    DigitalIn   _DREQ;
+    DigitalOut  _XRESET;
+      
+};
+
+
+const unsigned short recPlugin[40] = { /* Compressed plugin for recording*/
+  0x0007, 0x0001, 0x8010, 0x0006, 0x001c, 0x3e12, 0xb817, 0x3e14, /*    0 */
+  0xf812, 0x3e01, 0xb811, 0x0007, 0x9717, 0x0020, 0xffd2, 0x0030, /*    8 */
+  0x11d1, 0x3111, 0x8024, 0x3704, 0xc024, 0x3b81, 0x8024, 0x3101, /*   10 */
+  0x8024, 0x3b81, 0x8024, 0x3f04, 0xc024, 0x2808, 0x4800, 0x36f1, /*   18 */
+  0x9811, 0x0007, 0x0001, 0x8028, 0x0006, 0x0002, 0x2a00, 0x040e,
+};
+   
+//VS1053B: Patches with FLAC decoder 1.1 (2009-06-23) 
+const unsigned short flacPlugin[5433] = 
+{ 
+   0x0007, 0x0001, 0x8300, 0x0006, 0x0202, 0xb080, 0x0024, 0x0007, /*    0 */ 
+   0x9257, 0x3f00, 0x0024, 0x0030, 0x0297, 0x3f00, 0x0024, 0x0006, /*    8 */ 
+   0x0017, 0x3f10, 0x0024, 0x3f00, 0x0024, 0x0000, 0xf8d7, 0xf400, /*   10 */ 
+   0x55c0, 0x0000, 0x0817, 0xf400, 0x57c0, 0x0000, 0x004d, 0x000a, /*   18 */ 
+   0x708f, 0x0000, 0xc44e, 0x280f, 0xe100, 0x0006, 0x2016, 0x0000, /*   20 */ 
+   0x028d, 0x0014, 0x1b01, 0x2800, 0xc795, 0x0015, 0x59c0, 0x0000, /*   28 */ 
+   0xfa0d, 0x0039, 0x324f, 0x0000, 0xd40e, 0x2920, 0x41c0, 0x0000, /*   30 */ 
+   0x0024, 0x000a, 0x708f, 0x0000, 0xc44e, 0x280a, 0xcac0, 0x0000, /*   38 */ 
+   0x028d, 0x6fc2, 0x0024, 0x0019, 0x9301, 0x2800, 0xcbd5, 0x0018, /*   40 */ 
+   0x50c0, 0x000c, 0x0981, 0x0000, 0x18c2, 0x290c, 0x4840, 0x3613, /*   48 */ 
+   0x0024, 0x290c, 0x4840, 0x4086, 0x184c, 0x6234, 0x0024, 0x0000, /*   50 */ 
+   0x0024, 0x2800, 0xcb55, 0x0030, 0x0317, 0x3f00, 0x0024, 0x280a, /*   58 */ 
+   0x71c0, 0x002c, 0x9d40, 0x6fc2, 0x0024, 0x0000, 0x0024, 0x2800, /*   60 */ 
+   0xcb55, 0x0000, 0x0024, 0x2800, 0x9c40, 0x000a, 0xcac8, 0x3613, /*   68 */ 
+   0x0024, 0x3e10, 0xb803, 0x3e14, 0x3811, 0x3e11, 0x3805, 0x3e00, /*   70 */ 
+   0x3801, 0x0007, 0xc390, 0x0006, 0xa011, 0x3010, 0x0444, 0x3050, /*   78 */ 
+   0x4405, 0x6458, 0x0302, 0xff94, 0x4081, 0x0003, 0xffc5, 0x48b6, /*   80 */ 
+   0x0024, 0xff82, 0x0024, 0x42b2, 0x0042, 0xb458, 0x0003, 0x4cd6, /*   88 */ 
+   0x9801, 0xf248, 0x1bc0, 0xb58a, 0x0024, 0x6de6, 0x1804, 0x0006, /*   90 */ 
+   0x0010, 0x3810, 0x9bc5, 0x3800, 0xc024, 0x36f4, 0x1811, 0x36f0, /*   98 */ 
+   0x9803, 0x283e, 0x2d80, 0x0fff, 0xffc3, 0x003e, 0x2d4f, 0x2800, /*   a0 */ 
+   0xe580, 0x0000, 0xcd4e, 0x3413, 0x0024, 0x2800, 0xd605, 0xf400, /*   a8 */ 
+   0x4510, 0x2800, 0xd9c0, 0x6894, 0x13cc, 0x3000, 0x184c, 0x6090, /*   b0 */ 
+   0x93cc, 0x38b0, 0x3812, 0x3004, 0x4024, 0x0000, 0x0910, 0x3183, /*   b8 */ 
+   0x0024, 0x3100, 0x4024, 0x6016, 0x0024, 0x000c, 0x8012, 0x2800, /*   c0 */ 
+   0xd911, 0xb884, 0x104c, 0x6894, 0x3002, 0x2939, 0xb0c0, 0x3e10, /*   c8 */ 
+   0x93cc, 0x4084, 0x9bd2, 0x4282, 0x0024, 0x0000, 0x0041, 0x2800, /*   d0 */ 
+   0xdbc5, 0x6212, 0x0024, 0x0000, 0x0040, 0x2800, 0xe0c5, 0x000c, /*   d8 */ 
+   0x8390, 0x2a00, 0xe440, 0x34c3, 0x0024, 0x3444, 0x0024, 0x3073, /*   e0 */ 
+   0x0024, 0x3053, 0x0024, 0x3000, 0x0024, 0x6092, 0x098c, 0x0000, /*   e8 */ 
+   0x0241, 0x2800, 0xe445, 0x32a0, 0x0024, 0x6012, 0x0024, 0x0000, /*   f0 */ 
+   0x0024, 0x2800, 0xe455, 0x0000, 0x0024, 0x3613, 0x0024, 0x3001, /*   f8 */ 
+   0x3844, 0x2920, 0x0580, 0x3009, 0x3852, 0xc090, 0x9bd2, 0x2800, /*  100 */ 
+   0xe440, 0x3800, 0x1bc4, 0x000c, 0x4113, 0xb880, 0x2380, 0x3304, /*  108 */ 
+   0x4024, 0x3800, 0x05cc, 0xcc92, 0x05cc, 0x3910, 0x0024, 0x3910, /*  110 */ 
+   0x4024, 0x000c, 0x8110, 0x3910, 0x0024, 0x39f0, 0x4024, 0x3810, /*  118 */ 
+   0x0024, 0x38d0, 0x4024, 0x3810, 0x0024, 0x38f0, 0x4024, 0x34c3, /*  120 */ 
+   0x0024, 0x3444, 0x0024, 0x3073, 0x0024, 0x3063, 0x0024, 0x3000, /*  128 */ 
+   0x0024, 0x4080, 0x0024, 0x0000, 0x0024, 0x2839, 0x53d5, 0x4284, /*  130 */ 
+   0x0024, 0x3613, 0x0024, 0x2800, 0xe785, 0x6898, 0xb804, 0x0000, /*  138 */ 
+   0x0084, 0x293b, 0x1cc0, 0x3613, 0x0024, 0x000c, 0x8117, 0x3711, /*  140 */ 
+   0x0024, 0x37d1, 0x4024, 0x4e8a, 0x0024, 0x0000, 0x0015, 0x2800, /*  148 */ 
+   0xea45, 0xce9a, 0x0024, 0x3f11, 0x0024, 0x3f01, 0x4024, 0x000c, /*  150 */ 
+   0x8197, 0x408a, 0x9bc4, 0x3f15, 0x4024, 0x2800, 0xec85, 0x4284, /*  158 */ 
+   0x3c15, 0x6590, 0x0024, 0x0000, 0x0024, 0x2839, 0x53d5, 0x4284, /*  160 */ 
+   0x0024, 0x0000, 0x0024, 0x2800, 0xd4d8, 0x458a, 0x0024, 0x2a39, /*  168 */ 
+   0x53c0, 0x3009, 0x3851, 0x3e14, 0xf812, 0x3e12, 0xb817, 0x0006, /*  170 */ 
+   0xa057, 0x3e11, 0x9fd3, 0x0023, 0xffd2, 0x3e01, 0x0024, 0x0006, /*  178 */ 
+   0x0011, 0x3111, 0x0024, 0x6498, 0x07c6, 0x868c, 0x2444, 0x3901, /*  180 */ 
+   0x8e06, 0x0030, 0x0551, 0x3911, 0x8e06, 0x3961, 0x9c44, 0xf400, /*  188 */ 
+   0x44c6, 0xd46c, 0x1bc4, 0x36f1, 0xbc13, 0x2800, 0xf815, 0x36f2, /*  190 */ 
+   0x9817, 0x002b, 0xffd2, 0x3383, 0x188c, 0x3e01, 0x8c06, 0x0006, /*  198 */ 
+   0xa097, 0x468c, 0xbc17, 0xf400, 0x4197, 0x2800, 0xf504, 0x3713, /*  1a0 */ 
+   0x0024, 0x2800, 0xf545, 0x37e3, 0x0024, 0x3009, 0x2c17, 0x3383, /*  1a8 */ 
+   0x0024, 0x3009, 0x0c06, 0x468c, 0x4197, 0x0006, 0xa052, 0x2800, /*  1b0 */ 
+   0xf744, 0x3713, 0x2813, 0x2800, 0xf785, 0x37e3, 0x0024, 0x3009, /*  1b8 */ 
+   0x2c17, 0x36f1, 0x8024, 0x36f2, 0x9817, 0x36f4, 0xd812, 0x2100, /*  1c0 */ 
+   0x0000, 0x3904, 0x5bd1, 0x2a00, 0xed8e, 0x3e11, 0x7804, 0x0030, /*  1c8 */ 
+   0x0257, 0x3701, 0x0024, 0x0013, 0x4d05, 0xd45b, 0xe0e1, 0x0007, /*  1d0 */ 
+   0xc795, 0x2800, 0xff95, 0x0fff, 0xff45, 0x3511, 0x184c, 0x4488, /*  1d8 */ 
+   0xb808, 0x0006, 0x8a97, 0x2800, 0xff45, 0x3009, 0x1c40, 0x3511, /*  1e0 */ 
+   0x1fc1, 0x0000, 0x0020, 0xac52, 0x1405, 0x6ce2, 0x0024, 0x0000, /*  1e8 */ 
+   0x0024, 0x2800, 0xff41, 0x68c2, 0x0024, 0x291a, 0x8a40, 0x3e10, /*  1f0 */ 
+   0x0024, 0x2921, 0xca80, 0x3e00, 0x4024, 0x36f3, 0x0024, 0x3009, /*  1f8 */ 
+   0x1bc8, 0x36f0, 0x1801, 0x2808, 0x9300, 0x3601, 0x5804, 0x0007, /*  200 */ 
+   0x0001, 0x802e, 0x0006, 0x0002, 0x2800, 0xf900, 0x0007, 0x0001, /*  208 */ 
+   0x8050, 0x0006, 0x0028, 0x3e12, 0x3800, 0x2911, 0xf140, 0x3e10, /*  210 */ 
+   0x8024, 0xf400, 0x4595, 0x3593, 0x0024, 0x35f3, 0x0024, 0x3500, /*  218 */ 
+   0x0024, 0x0021, 0x6d82, 0xd024, 0x44c0, 0x0006, 0xa402, 0x2800, /*  220 */ 
+   0x1815, 0xd024, 0x0024, 0x0000, 0x0000, 0x2800, 0x1815, 0x000b, /*  228 */ 
+   0x6d57, 0x3009, 0x3c00, 0x36f0, 0x8024, 0x36f2, 0x1800, 0x2000, /*  230 */ 
+   0x0000, 0x0000, 0x0024, 0x0007, 0x0001, 0x8030, 0x0006, 0x0002, /*  238 */ 
+   0x2800, 0x1400, 0x0007, 0x0001, 0x8064, 0x0006, 0x001c, 0x3e12, /*  240 */ 
+   0xb817, 0x3e14, 0xf812, 0x3e01, 0xb811, 0x0007, 0x9717, 0x0020, /*  248 */ 
+   0xffd2, 0x0030, 0x11d1, 0x3111, 0x8024, 0x3704, 0xc024, 0x3b81, /*  250 */ 
+   0x8024, 0x3101, 0x8024, 0x3b81, 0x8024, 0x3f04, 0xc024, 0x2808, /*  258 */ 
+   0x4800, 0x36f1, 0x9811, 0x0007, 0x0001, 0x8028, 0x0006, 0x0002, /*  260 */ 
+   0x2a00, 0x190e, 0x0007, 0x0001, 0x8072, 0x0006, 0x0052, 0x3613, /*  268 */ 
+   0x0024, 0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3635, /*  270 */ 
+   0x0024, 0x0000, 0x800a, 0x3e10, 0x7802, 0x3e14, 0x0024, 0x2900, /*  278 */ 
+   0xb680, 0x0000, 0x0201, 0x0000, 0x0601, 0x3413, 0x184c, 0x2902, /*  280 */ 
+   0x4700, 0x3cf0, 0x0024, 0x3413, 0x184c, 0x3400, 0x3040, 0x3009, /*  288 */ 
+   0x33c1, 0x0000, 0x1fc1, 0xb010, 0x0024, 0x6014, 0x9040, 0x0006, /*  290 */ 
+   0x0bd0, 0x2800, 0x2355, 0x0000, 0x0024, 0x34e3, 0x1bcc, 0x6890, /*  298 */ 
+   0x0024, 0x2800, 0x2500, 0xb880, 0x2000, 0x3e10, 0x1381, 0x2902, /*  2a0 */ 
+   0x8640, 0x3e00, 0x4024, 0x003f, 0xfe41, 0x36e3, 0x104c, 0x34f0, /*  2a8 */ 
+   0x0024, 0xa010, 0x0024, 0x36f4, 0x0024, 0x36f0, 0x5802, 0x3405, /*  2b0 */ 
+   0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, /*  2b8 */ 
+   0x9817, 0x0007, 0x0001, 0x809b, 0x0006, 0x004a, 0x3613, 0x0024, /*  2c0 */ 
+   0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, 0x0024, /*  2c8 */ 
+   0x0000, 0x800a, 0x3e10, 0xb804, 0x3e01, 0x534c, 0xbe8a, 0x10c0, /*  2d0 */ 
+   0x4080, 0x0024, 0x0000, 0x0024, 0x2800, 0x2e45, 0x0000, 0x0024, /*  2d8 */ 
+   0x2902, 0x4700, 0x4082, 0x184c, 0x4c8a, 0x134c, 0x0000, 0x0001, /*  2e0 */ 
+   0x6890, 0x10c2, 0x4294, 0x0024, 0xac22, 0x0024, 0xbec2, 0x0024, /*  2e8 */ 
+   0x0000, 0x0024, 0x2800, 0x2e45, 0x0000, 0x0024, 0x6890, 0x134c, /*  2f0 */ 
+   0xb882, 0x10c2, 0xac22, 0x0024, 0x4c92, 0x0024, 0xdc92, 0x0024, /*  2f8 */ 
+   0xceca, 0x0024, 0x4e82, 0x1bc5, 0x36f0, 0x9804, 0x3405, 0x9014, /*  300 */ 
+   0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, 0x9817, /*  308 */ 
+   0x0007, 0x0001, 0x80c0, 0x0006, 0x00e4, 0x3613, 0x0024, 0x3e12, /*  310 */ 
+   0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3645, 0x0024, 0x0000, /*  318 */ 
+   0x800a, 0x3e10, 0x3801, 0x3e10, 0xb803, 0x3e11, 0x3805, 0x3e11, /*  320 */ 
+   0xb807, 0x3e14, 0x104c, 0x2900, 0xb680, 0x0000, 0x0081, 0x4080, /*  328 */ 
+   0x3040, 0x0000, 0x0101, 0x2800, 0x3585, 0x0000, 0x0024, 0x4090, /*  330 */ 
+   0x138c, 0x0006, 0x0c10, 0x2800, 0x4995, 0x0000, 0x0024, 0x3423, /*  338 */ 
+   0x0024, 0x2900, 0xb680, 0x3613, 0x0024, 0xb880, 0x3000, 0x2800, /*  340 */ 
+   0x4740, 0x3009, 0x3380, 0x2900, 0xb680, 0x4122, 0x10cc, 0x3cf0, /*  348 */ 
+   0x0024, 0x3001, 0x0024, 0x3400, 0x0024, 0x6800, 0x0024, 0xa408, /*  350 */ 
+   0x9040, 0x4080, 0x0024, 0x0000, 0x07c1, 0x2800, 0x3b15, 0x6894, /*  358 */ 
+   0x1380, 0x6894, 0x130c, 0x3460, 0x0024, 0x6408, 0x4481, 0x4102, /*  360 */ 
+   0x1380, 0xf400, 0x4052, 0x0000, 0x07c1, 0x34f0, 0xc024, 0x6234, /*  368 */ 
+   0x0024, 0x6824, 0x0024, 0xa122, 0x0024, 0x6014, 0x0024, 0x0000, /*  370 */ 
+   0x0141, 0x2800, 0x4215, 0x0000, 0x0024, 0x2900, 0xb680, 0x3613, /*  378 */ 
+   0x0024, 0x2800, 0x4080, 0xb88a, 0x4002, 0x2900, 0x26c0, 0x3e00, /*  380 */ 
+   0x8024, 0x4c8e, 0xa801, 0x0000, 0x0201, 0x3a10, 0x1bcc, 0x3000, /*  388 */ 
+   0x0024, 0xb010, 0x0024, 0x0000, 0x0024, 0x2800, 0x4615, 0x659a, /*  390 */ 
+   0x0024, 0x6540, 0x184c, 0x0030, 0x0010, 0x2800, 0x3e08, 0x0000, /*  398 */ 
+   0x0024, 0x2800, 0x4600, 0x36f3, 0x0024, 0x2800, 0x44c0, 0xb88a, /*  3a0 */ 
+   0x0024, 0x2902, 0x0e80, 0x34d0, 0x4024, 0x4c8f, 0xa0a1, 0x0000, /*  3a8 */ 
+   0x0201, 0x3000, 0x084c, 0xb010, 0x0024, 0x0000, 0x0024, 0x2800, /*  3b0 */ 
+   0x4615, 0x659a, 0x0024, 0x6540, 0x10cc, 0x0030, 0x0010, 0x2800, /*  3b8 */ 
+   0x4288, 0x0000, 0x0024, 0x34d3, 0x0024, 0x3423, 0x0024, 0xf400, /*  3c0 */ 
+   0x4510, 0x3009, 0x1380, 0x6090, 0x0024, 0x3009, 0x2000, 0x6892, /*  3c8 */ 
+   0x108c, 0x34f0, 0x9000, 0xa122, 0x984c, 0x6016, 0x13c1, 0x0000, /*  3d0 */ 
+   0x0102, 0x2800, 0x36c8, 0x0006, 0x0d10, 0x2800, 0x4a00, 0x3009, /*  3d8 */ 
+   0x1bcc, 0x6890, 0x0024, 0x3800, 0x0024, 0x36f4, 0x0024, 0x36f1, /*  3e0 */ 
+   0x9807, 0x36f1, 0x1805, 0x36f0, 0x9803, 0x36f0, 0x1801, 0x3405, /*  3e8 */ 
+   0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, /*  3f0 */ 
+   0x9817, 0x0007, 0x0001, 0x8132, 0x0006, 0x0048, 0x3613, 0x0024, /*  3f8 */ 
+   0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, 0x0024, /*  400 */ 
+   0x0000, 0x800a, 0x3e10, 0x3801, 0x3e10, 0xb804, 0x3e11, 0xb807, /*  408 */ 
+   0x3e14, 0x3811, 0x3e04, 0x934c, 0x3430, 0x0024, 0x4080, 0x0024, /*  410 */ 
+   0x0000, 0x0206, 0x2800, 0x5305, 0x0006, 0x0d11, 0x3101, 0x130c, /*  418 */ 
+   0xff0c, 0x1102, 0x6408, 0x0024, 0x4204, 0x0024, 0xb882, 0x4092, /*  420 */ 
+   0x1006, 0x0e02, 0x48be, 0x0024, 0x4264, 0x0024, 0x2901, 0xfa00, /*  428 */ 
+   0xf400, 0x4090, 0x36f4, 0x8024, 0x36f4, 0x1811, 0x36f1, 0x9807, /*  430 */ 
+   0x36f0, 0x9804, 0x36f0, 0x1801, 0x3405, 0x9014, 0x36f3, 0x0024, /*  438 */ 
+   0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, 0x9817, 0x0007, 0x0001, /*  440 */ 
+   0x1802, 0x0006, 0x0002, 0x0194, 0x01af, 0x0006, 0x8006, 0x01f6, /*  448 */ 
+   0x0006, 0x0025, 0x01cb, 0x01cb, 0x01cb, 0x01cb, 0x01cb, 0x0581, /*  450 */ 
+   0x0565, 0x0569, 0x056d, 0x0571, 0x0575, 0x0579, 0x057d, 0x05b3, /*  458 */ 
+   0x05b7, 0x05ba, 0x05ba, 0x05ba, 0x05ba, 0x05c2, 0x05d6, 0x06a5, /*  460 */ 
+   0x060e, 0x0613, 0x0619, 0x061f, 0x0624, 0x0629, 0x062e, 0x0633, /*  468 */ 
+   0x0638, 0x063d, 0x0642, 0x0647, 0x0661, 0x0681, 0x06a1, 0x0007, /*  470 */ 
+   0x0001, 0x8156, 0x0006, 0x0236, 0x3613, 0x0024, 0x3e12, 0xb817, /*  478 */ 
+   0x3e12, 0x3815, 0x3e05, 0xb814, 0x3675, 0x0024, 0x3633, 0x0024, /*  480 */ 
+   0x0000, 0x800a, 0x3e10, 0x3801, 0x0000, 0x0181, 0x3e10, 0xb803, /*  488 */ 
+   0x3e11, 0x3806, 0x3e11, 0xf810, 0x3e14, 0x7812, 0x3e13, 0xf80e, /*  490 */ 
+   0x2902, 0x1840, 0x3e03, 0x4024, 0x2900, 0xb680, 0x4088, 0x184c, /*  498 */ 
+   0x3413, 0x184c, 0x2900, 0xb680, 0x6892, 0x33c0, 0x3423, 0x0024, /*  4a0 */ 
+   0x4080, 0x3040, 0x0000, 0x0000, 0x2800, 0x60c5, 0x0000, 0x0024, /*  4a8 */ 
+   0x6890, 0x0024, 0x2902, 0x1840, 0x3cd0, 0x0024, 0x4080, 0x0024, /*  4b0 */ 
+   0x0000, 0x0024, 0x2800, 0x6115, 0x0000, 0x0024, 0x3433, 0x0024, /*  4b8 */ 
+   0xf400, 0x4510, 0x34d0, 0x0024, 0x6090, 0x0024, 0x2902, 0x1840, /*  4c0 */ 
+   0x3800, 0x0024, 0x4080, 0x10cc, 0xf400, 0x4510, 0x2800, 0x5e85, /*  4c8 */ 
+   0x34d0, 0x0024, 0x2800, 0x6100, 0x0000, 0x0024, 0x3cd0, 0x0024, /*  4d0 */ 
+   0x3433, 0x0024, 0x34a0, 0x0024, 0xf400, 0x4510, 0x3430, 0x4024, /*  4d8 */ 
+   0x6100, 0x0024, 0x0000, 0x0341, 0x3840, 0x0024, 0x3000, 0x0024, /*  4e0 */ 
+   0x6012, 0x0024, 0x0006, 0x0081, 0x2800, 0x7d81, 0x4012, 0x0024, /*  4e8 */ 
+   0xf400, 0x4057, 0x3702, 0x0024, 0x2000, 0x0000, 0x0000, 0x0024, /*  4f0 */ 
+   0x34d3, 0x184c, 0x3430, 0x8024, 0x2900, 0x26c0, 0x3e00, 0x8024, /*  4f8 */ 
+   0x36f3, 0x11cc, 0xb888, 0x104c, 0x3c10, 0x0024, 0x3c90, 0x4024, /*  500 */ 
+   0x2800, 0x69c0, 0x34e3, 0x0024, 0x4f82, 0x128c, 0x3400, 0x4024, /*  508 */ 
+   0x4142, 0x0024, 0xf400, 0x4050, 0x3800, 0x0024, 0x3440, 0x4024, /*  510 */ 
+   0x4142, 0x0024, 0x6498, 0x4050, 0x3009, 0x2007, 0x0006, 0x0d10, /*  518 */ 
+   0x3000, 0x11cc, 0x6402, 0x104c, 0x3411, 0x8024, 0x2800, 0x6788, /*  520 */ 
+   0x3491, 0xc024, 0x2800, 0x9940, 0x34e3, 0x0024, 0x2800, 0x70c0, /*  528 */ 
+   0xb888, 0x0024, 0x2900, 0x26c0, 0x3e00, 0x8024, 0x4c8e, 0x130c, /*  530 */ 
+   0x3400, 0x5bcc, 0x4142, 0x0024, 0xf400, 0x4050, 0x3800, 0x0024, /*  538 */ 
+   0x3440, 0x4024, 0x4142, 0x0024, 0xf400, 0x4050, 0x0000, 0x0201, /*  540 */ 
+   0x3009, 0x2007, 0x0030, 0x0010, 0x3000, 0x0024, 0xb010, 0x0024, /*  548 */ 
+   0x0000, 0x0024, 0x2800, 0x9955, 0x6498, 0x0024, 0x0006, 0x0d10, /*  550 */ 
+   0x3000, 0x134c, 0x6402, 0x10c2, 0x0000, 0x0024, 0x2800, 0x6c48, /*  558 */ 
+   0x3009, 0x184c, 0x2800, 0x9940, 0x3009, 0x1bcc, 0x0000, 0x0201, /*  560 */ 
+   0xb888, 0x104c, 0x3430, 0x184c, 0x6010, 0x0024, 0x6402, 0x3000, /*  568 */ 
+   0x0000, 0x0201, 0x2800, 0x7958, 0x0030, 0x0010, 0x4090, 0x124c, /*  570 */ 
+   0x2400, 0x7840, 0x0000, 0x0024, 0x3430, 0x8024, 0x2900, 0x26c0, /*  578 */ 
+   0x3e00, 0x8024, 0x4c8e, 0x130c, 0x3400, 0x4024, 0x4142, 0x0024, /*  580 */ 
+   0xf400, 0x4050, 0x3800, 0x0024, 0x3410, 0x4024, 0x4142, 0x0024, /*  588 */ 
+   0x6498, 0x4050, 0x3009, 0x2007, 0x0030, 0x0010, 0x0000, 0x0201, /*  590 */ 
+   0x3473, 0x0024, 0x3490, 0x0024, 0x3e00, 0x13cc, 0x2900, 0x3000, /*  598 */ 
+   0x3444, 0x8024, 0x3000, 0x1bcc, 0xb010, 0x0024, 0x0000, 0x0024, /*  5a0 */ 
+   0x2800, 0x9955, 0x0000, 0x0024, 0x34c3, 0x184c, 0x3470, 0x0024, /*  5a8 */ 
+   0x3e10, 0x104c, 0x34c0, 0x4024, 0x2900, 0x4c80, 0x3e00, 0x4024, /*  5b0 */ 
+   0x2800, 0x9940, 0x36e3, 0x0024, 0x0000, 0x0801, 0x3413, 0x0024, /*  5b8 */ 
+   0x34f0, 0x0024, 0x6012, 0x0024, 0x0000, 0x07c1, 0x2800, 0x9888, /*  5c0 */ 
+   0x0000, 0x0024, 0x6010, 0x114c, 0xb888, 0x32c0, 0x6402, 0x0024, /*  5c8 */ 
+   0x0000, 0x0101, 0x2800, 0x8518, 0x0000, 0x0024, 0x4090, 0x134c, /*  5d0 */ 
+   0x2400, 0x8440, 0x3009, 0x184c, 0x3430, 0x8024, 0x2900, 0x26c0, /*  5d8 */ 
+   0x3e00, 0x8024, 0x4c8e, 0x130c, 0x3400, 0x4024, 0x4142, 0x0024, /*  5e0 */ 
+   0xf400, 0x4050, 0x3800, 0x0024, 0x3410, 0x4024, 0x4142, 0x0024, /*  5e8 */ 
+   0x6498, 0x4050, 0x3009, 0x2007, 0x0000, 0x0101, 0x3433, 0x1bcc, /*  5f0 */ 
+   0x2900, 0xb680, 0x3613, 0x0024, 0x0000, 0x0141, 0x6090, 0x118c, /*  5f8 */ 
+   0x2900, 0xb680, 0x3ca0, 0x184c, 0x3473, 0x184c, 0xb888, 0x3380, /*  600 */ 
+   0x3400, 0x0024, 0x6402, 0x0024, 0x0000, 0x0201, 0x2800, 0x8bd8, /*  608 */ 
+   0x0000, 0x0024, 0x4090, 0x104c, 0x2400, 0x8b00, 0x0000, 0x0024, /*  610 */ 
+   0x34a0, 0x8024, 0x2900, 0x26c0, 0x3e00, 0x8024, 0x0006, 0x0002, /*  618 */ 
+   0x4244, 0x118c, 0x4244, 0x0024, 0x6498, 0x4095, 0x3009, 0x3440, /*  620 */ 
+   0x3009, 0x37c1, 0x0000, 0x0201, 0x34f3, 0x0024, 0x0030, 0x0010, /*  628 */ 
+   0x3490, 0x0024, 0x3e00, 0x138c, 0x2900, 0x3000, 0x3444, 0x8024, /*  630 */ 
+   0x3000, 0x1bcc, 0xb010, 0x0024, 0x0000, 0x0024, 0x2800, 0x9955, /*  638 */ 
+   0x4112, 0x0024, 0x3463, 0x0024, 0x34a0, 0x0024, 0x6012, 0x0024, /*  640 */ 
+   0x0006, 0x0cd1, 0x2800, 0x9519, 0x0000, 0x0024, 0x3100, 0x11cc, /*  648 */ 
+   0x3490, 0x4024, 0x4010, 0x0024, 0x0000, 0x0a01, 0x6012, 0x0024, /*  650 */ 
+   0x0006, 0x0d11, 0x2800, 0x9518, 0x0000, 0x0024, 0x3613, 0x114c, /*  658 */ 
+   0x3101, 0x3804, 0x3490, 0x8024, 0x6428, 0x138c, 0x3470, 0x8024, /*  660 */ 
+   0x3423, 0x0024, 0x3420, 0xc024, 0x4234, 0x1241, 0x4380, 0x4092, /*  668 */ 
+   0x2901, 0xfa00, 0x0006, 0x0010, 0x2800, 0x9940, 0x3009, 0x1bcc, /*  670 */ 
+   0x0006, 0x0d11, 0x3613, 0x114c, 0x3101, 0x3804, 0x3490, 0x8024, /*  678 */ 
+   0x6428, 0x138c, 0x3470, 0x8024, 0x3423, 0x0024, 0x3420, 0xc024, /*  680 */ 
+   0x4234, 0x1241, 0x4380, 0x4092, 0x2902, 0x03c0, 0x0006, 0x0010, /*  688 */ 
+   0x2800, 0x9940, 0x3009, 0x1bcc, 0x0006, 0x0c10, 0x6890, 0x0024, /*  690 */ 
+   0x3800, 0x0024, 0x36f3, 0x4024, 0x36f3, 0xd80e, 0x36f4, 0x5812, /*  698 */ 
+   0x36f1, 0xd810, 0x36f1, 0x1806, 0x36f0, 0x9803, 0x36f0, 0x1801, /*  6a0 */ 
+   0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, /*  6a8 */ 
+   0x36f2, 0x9817, 0x0007, 0x0001, 0x8401, 0x0006, 0x016e, 0x3613, /*  6b0 */ 
+   0x0024, 0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, /*  6b8 */ 
+   0x0024, 0x0000, 0x800a, 0x3e10, 0x7802, 0x3e10, 0xf804, 0x0000, /*  6c0 */ 
+   0x3fc3, 0x3e11, 0x7806, 0x3e11, 0xf810, 0xbc82, 0x12cc, 0x3404, /*  6c8 */ 
+   0x0024, 0x3023, 0x0024, 0x3810, 0x0024, 0x38f0, 0x4024, 0x3454, /*  6d0 */ 
+   0x0024, 0x3810, 0x0024, 0x38f0, 0x4024, 0x2900, 0xb680, 0x0000, /*  6d8 */ 
+   0x0201, 0x0006, 0x8081, 0x4088, 0x134c, 0x3400, 0x8024, 0xd204, /*  6e0 */ 
+   0x0024, 0xb234, 0x0024, 0x4122, 0x0024, 0xf400, 0x4055, 0x3500, /*  6e8 */ 
+   0x0024, 0x3c30, 0x0024, 0x0000, 0x2000, 0xb400, 0x0024, 0x0000, /*  6f0 */ 
+   0x3001, 0x2801, 0x0ad5, 0x0000, 0x3800, 0x0000, 0x0041, 0xfe42, /*  6f8 */ 
+   0x12cc, 0x48b2, 0x1090, 0x3810, 0x0024, 0x38f0, 0x4024, 0x2801, /*  700 */ 
+   0x2bc0, 0x3430, 0x0024, 0xb400, 0x0024, 0x6012, 0x0024, 0x0000, /*  708 */ 
+   0x3801, 0x2801, 0x0e15, 0x0000, 0x3c00, 0x0000, 0x07c0, 0x0000, /*  710 */ 
+   0x0041, 0xb400, 0x12cc, 0xfe02, 0x1150, 0x48b2, 0x0024, 0x689a, /*  718 */ 
+   0x2040, 0x2801, 0x2a40, 0x38f0, 0x4024, 0xb400, 0x0024, 0x6012, /*  720 */ 
+   0x0024, 0x0000, 0x3c01, 0x2801, 0x1195, 0x0000, 0x3e00, 0x0000, /*  728 */ 
+   0x03c0, 0x0000, 0x0085, 0x4592, 0x12cc, 0xb400, 0x1150, 0xfe02, /*  730 */ 
+   0x0024, 0x48b2, 0x0024, 0x3810, 0x0024, 0x2801, 0x2a40, 0x38f0, /*  738 */ 
+   0x4024, 0xb400, 0x0024, 0x6012, 0x0024, 0x0000, 0x3e01, 0x2801, /*  740 */ 
+   0x1515, 0x0000, 0x3f00, 0x0000, 0x01c0, 0xf20a, 0x12cc, 0xb400, /*  748 */ 
+   0x1150, 0xf252, 0x0024, 0xfe02, 0x0024, 0x48b2, 0x0024, 0x3810, /*  750 */ 
+   0x0024, 0x2801, 0x2a40, 0x38f0, 0x4024, 0xb400, 0x130c, 0x6012, /*  758 */ 
+   0x0024, 0x0000, 0x3f01, 0x2801, 0x1895, 0x4390, 0x0024, 0x0000, /*  760 */ 
+   0x0041, 0x0000, 0x0105, 0x4590, 0x13cc, 0xb400, 0x1150, 0xfe02, /*  768 */ 
+   0x0024, 0x48b2, 0x0024, 0x3810, 0x0024, 0x2801, 0x2a40, 0x38f0, /*  770 */ 
+   0x4024, 0xb400, 0x0024, 0x6012, 0x1100, 0x0000, 0x01c1, 0x2801, /*  778 */ 
+   0x1c15, 0x0000, 0x0024, 0x0000, 0x0041, 0x0000, 0x0145, 0x6890, /*  780 */ 
+   0x12cc, 0xb400, 0x1150, 0xfe02, 0x0024, 0x48b2, 0x0024, 0x3810, /*  788 */ 
+   0x0024, 0x2801, 0x2a40, 0x38f0, 0x4024, 0x6012, 0x0024, 0x0000, /*  790 */ 
+   0x3f81, 0x2801, 0x1e95, 0xb430, 0x0024, 0x6012, 0x0024, 0x0000, /*  798 */ 
+   0x0024, 0x2801, 0x1e95, 0x0000, 0x0024, 0x2801, 0x2a40, 0x0000, /*  7a0 */ 
+   0x0185, 0x2801, 0x2bc0, 0xc890, 0x0024, 0x0000, 0x3fc3, 0x0000, /*  7a8 */ 
+   0x0201, 0x2900, 0xb680, 0x3613, 0x0024, 0x0006, 0x8081, 0x4088, /*  7b0 */ 
+   0x134c, 0x3400, 0x8024, 0xd204, 0x0024, 0xb234, 0x0024, 0x4122, /*  7b8 */ 
+   0x0024, 0xf400, 0x4055, 0x0000, 0x2001, 0x3500, 0x0024, 0x3c30, /*  7c0 */ 
+   0x0024, 0x0000, 0x3000, 0xb400, 0x0024, 0x6012, 0x0024, 0x0000, /*  7c8 */ 
+   0x0182, 0x2801, 0x2485, 0x0000, 0x0024, 0x2801, 0x2bc0, 0xc890, /*  7d0 */ 
+   0x0024, 0x459a, 0x12cc, 0x3404, 0x0024, 0x3023, 0x0024, 0x3010, /*  7d8 */ 
+   0x0024, 0x30d0, 0x4024, 0xac22, 0x0046, 0x003f, 0xf982, 0x3011, /*  7e0 */ 
+   0xc024, 0x0000, 0x0023, 0xaf2e, 0x0024, 0x0000, 0x0182, 0xccf2, /*  7e8 */ 
+   0x0024, 0x0000, 0x0fc6, 0x0000, 0x0047, 0xb46c, 0x2040, 0xfe6e, /*  7f0 */ 
+   0x23c1, 0x3454, 0x0024, 0x3010, 0x0024, 0x30f0, 0x4024, 0xac22, /*  7f8 */ 
+   0x0024, 0xccb2, 0x0024, 0x3810, 0x0024, 0x38f0, 0x4024, 0x458a, /*  800 */ 
+   0x0024, 0x0000, 0x0201, 0x2801, 0x1f95, 0x0000, 0x3fc3, 0x34d3, /*  808 */ 
+   0x0024, 0x3430, 0x0024, 0x36f1, 0xd810, 0x36f1, 0x5806, 0x36f0, /*  810 */ 
+   0xd804, 0x36f0, 0x5802, 0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, /*  818 */ 
+   0x1815, 0x2000, 0x0000, 0x36f2, 0x9817, 0x0007, 0x0001, 0x84b8, /*  820 */ 
+   0x0006, 0x0660, 0x3613, 0x0024, 0x3e12, 0xb817, 0x0000, 0x0417, /*  828 */ 
+   0x3e12, 0x3815, 0x3e05, 0xb814, 0x3685, 0x0024, 0x0000, 0x800a, /*  830 */ 
+   0x3e10, 0x3801, 0x3e10, 0xb803, 0x3e11, 0x3805, 0x3e11, 0xb807, /*  838 */ 
+   0x3e14, 0x3811, 0x3e14, 0xb813, 0x3e13, 0xf80e, 0x3e03, 0x4024, /*  840 */ 
+   0x2902, 0x7980, 0x0000, 0x0381, 0x000f, 0xff81, 0x6012, 0x0024, /*  848 */ 
+   0x0000, 0x0201, 0x2801, 0x3445, 0x0000, 0x0024, 0x3613, 0x0024, /*  850 */ 
+   0x2900, 0xb680, 0x0001, 0xf6c8, 0x0006, 0x8a10, 0xb880, 0x184c, /*  858 */ 
+   0x2902, 0x57c0, 0x3e00, 0x11cc, 0x3473, 0x0024, 0x3c90, 0x0024, /*  860 */ 
+   0x3493, 0x0024, 0x2900, 0xb680, 0x0000, 0x0401, 0x3473, 0x184c, /*  868 */ 
+   0x3423, 0x0024, 0x3c50, 0x0000, 0x4080, 0x0024, 0x0006, 0x8081, /*  870 */ 
+   0x2801, 0x3ac5, 0x003f, 0xfe04, 0x34b3, 0x0024, 0x3490, 0x8024, /*  878 */ 
+   0xa244, 0x138c, 0x2902, 0x52c0, 0xb880, 0x0024, 0x4082, 0x184c, /*  880 */ 
+   0x0006, 0x8081, 0x2902, 0x57c0, 0x3e00, 0x11cc, 0x3473, 0x0024, /*  888 */ 
+   0x0006, 0x0c51, 0x34b0, 0x8024, 0x3400, 0xc024, 0xa346, 0x0024, /*  890 */ 
+   0xd234, 0x0024, 0x0000, 0x3fc3, 0xb234, 0x0024, 0x4122, 0x1142, /*  898 */ 
+   0xf400, 0x4055, 0x0006, 0x8081, 0x3500, 0x0024, 0xd024, 0x3000, /*  8a0 */ 
+   0xb234, 0x0024, 0x4122, 0x0024, 0xf400, 0x4055, 0x0000, 0x0041, /*  8a8 */ 
+   0x3500, 0x0024, 0x3cb0, 0x0024, 0x3490, 0x0024, 0xf100, 0x13cc, /*  8b0 */ 
+   0xf100, 0x0024, 0xfe02, 0x0024, 0x48b2, 0x0024, 0x3c10, 0x0024, /*  8b8 */ 
+   0x6892, 0x31c1, 0x34a0, 0x0024, 0xf100, 0x0024, 0xb010, 0x0024, /*  8c0 */ 
+   0x3c60, 0x0024, 0x34b0, 0x0024, 0xb010, 0x0024, 0x0000, 0x0201, /*  8c8 */ 
+   0x2900, 0xb680, 0x3cc0, 0x0024, 0x0006, 0x8081, 0x3473, 0x184c, /*  8d0 */ 
+   0x3423, 0x0024, 0x3c50, 0x0024, 0x34b0, 0x8024, 0x3450, 0xc024, /*  8d8 */ 
+   0xd234, 0x0024, 0x0000, 0x3fc3, 0xb234, 0x0024, 0x4122, 0x0024, /*  8e0 */ 
+   0xf400, 0x4055, 0x003f, 0xff01, 0x3500, 0x0024, 0x3cb0, 0x0024, /*  8e8 */ 
+   0x34c0, 0x0024, 0xa010, 0x0024, 0x0000, 0x03c1, 0x3c40, 0x0024, /*  8f0 */ 
+   0x34d0, 0x0024, 0xb010, 0x0024, 0x0000, 0x0201, 0x2900, 0xb680, /*  8f8 */ 
+   0x3ca0, 0x0024, 0x0006, 0x8081, 0x3473, 0x0024, 0x3423, 0x0024, /*  900 */ 
+   0x3c50, 0x0024, 0x34b0, 0x8024, 0x3450, 0xc024, 0xd234, 0x0024, /*  908 */ 
+   0x0000, 0x3fc3, 0xb234, 0x0024, 0x4122, 0x0024, 0xf400, 0x4055, /*  910 */ 
+   0x003f, 0xff01, 0x3500, 0x0024, 0x3cb0, 0x0024, 0x3400, 0x0024, /*  918 */ 
+   0xa010, 0x0024, 0x0000, 0x01c1, 0x3900, 0x0024, 0x34e0, 0x0024, /*  920 */ 
+   0xf100, 0x0024, 0xb010, 0x0024, 0x6892, 0x3080, 0x34f0, 0x0024, /*  928 */ 
+   0xb010, 0x0024, 0x3cb0, 0x0024, 0x3450, 0x0024, 0x3490, 0x4024, /*  930 */ 
+   0xc010, 0x93cc, 0x0000, 0x0181, 0x2801, 0x5185, 0x3100, 0x0024, /*  938 */ 
+   0x6890, 0x07cc, 0x2801, 0xf6c0, 0x3900, 0x0024, 0x6012, 0x0024, /*  940 */ 
+   0x0000, 0x0201, 0x2801, 0x5318, 0x0000, 0x0024, 0x2801, 0x5600, /*  948 */ 
+   0x6090, 0x044c, 0x6012, 0x0024, 0x0000, 0x0281, 0x2801, 0x5548, /*  950 */ 
+   0x6012, 0x0024, 0x0000, 0x0080, 0x2801, 0x5559, 0x0000, 0x0024, /*  958 */ 
+   0x2801, 0x5600, 0x3113, 0x0024, 0x6890, 0x07cc, 0x2801, 0xf6c0, /*  960 */ 
+   0x3900, 0x0024, 0x0000, 0x0201, 0x3900, 0x11cc, 0x3490, 0x0024, /*  968 */ 
+   0x6012, 0x0024, 0x0006, 0x03c1, 0x2801, 0x6041, 0x4012, 0x0024, /*  970 */ 
+   0xf400, 0x4057, 0x3702, 0x0024, 0x2000, 0x0000, 0x0000, 0x0024, /*  978 */ 
+   0x2801, 0x6040, 0x0000, 0x0024, 0x0000, 0x0200, 0x0006, 0x0cd0, /*  980 */ 
+   0x2801, 0x6040, 0x3800, 0x0024, 0x0000, 0x0300, 0x0006, 0x0cd0, /*  988 */ 
+   0x2801, 0x6040, 0x3800, 0x0024, 0x0006, 0x0c10, 0x6890, 0x0024, /*  990 */ 
+   0x2801, 0xf6c0, 0x3800, 0x0024, 0x0000, 0x0400, 0x0006, 0x0cd0, /*  998 */ 
+   0x2801, 0x6040, 0x3800, 0x0024, 0x0000, 0x0500, 0x0006, 0x0cd0, /*  9a0 */ 
+   0x2801, 0x6040, 0x3800, 0x0024, 0x0000, 0x0600, 0x0006, 0x0cd0, /*  9a8 */ 
+   0x2801, 0x6040, 0x3800, 0x0024, 0x0006, 0x0c10, 0x6890, 0x0024, /*  9b0 */ 
+   0x2801, 0xf6c0, 0x3800, 0x0024, 0x0000, 0x0281, 0x3443, 0x184c, /*  9b8 */ 
+   0x34c0, 0x0024, 0x4080, 0x0024, 0xf400, 0x4500, 0x2801, 0x6605, /*  9c0 */ 
+   0x4010, 0x91cc, 0x3e10, 0x11cc, 0x0000, 0x01c0, 0x3e10, 0x0024, /*  9c8 */ 
+   0x3490, 0x0024, 0x2901, 0x0040, 0x3e00, 0x124c, 0x36d3, 0x11cc, /*  9d0 */ 
+   0x3473, 0x0024, 0x4080, 0x3240, 0x3493, 0x0024, 0x2801, 0x6a18, /*  9d8 */ 
+   0x0000, 0x0024, 0x0006, 0x0bd0, 0x6890, 0x0024, 0x2801, 0xf6c0, /*  9e0 */ 
+   0x3800, 0x0024, 0x3e10, 0x11cc, 0x0000, 0x0180, 0x3e10, 0x0024, /*  9e8 */ 
+   0x3490, 0x0024, 0x2901, 0x0040, 0x3e00, 0x124c, 0x36d3, 0x11cc, /*  9f0 */ 
+   0x3473, 0x0024, 0x4080, 0x3240, 0x3493, 0x0024, 0x2801, 0x6a18, /*  9f8 */ 
+   0x0000, 0x0024, 0x0006, 0x0bd0, 0x6890, 0x0024, 0x2801, 0xf6c0, /*  a00 */ 
+   0x3800, 0x0024, 0x0000, 0x0201, 0x3453, 0x0024, 0x34b0, 0x0024, /*  a08 */ 
+   0x6012, 0x0024, 0x0006, 0x05c1, 0x2801, 0x7c81, 0x4012, 0x0024, /*  a10 */ 
+   0xf400, 0x4057, 0x3702, 0x0024, 0x2000, 0x0000, 0x0000, 0x0024, /*  a18 */ 
+   0x0006, 0x0c10, 0x6890, 0x0024, 0x2801, 0xf6c0, 0x3800, 0x0024, /*  a20 */ 
+   0x0000, 0x3000, 0x2801, 0x7e40, 0x0006, 0x0d10, 0x0000, 0x9000, /*  a28 */ 
+   0x0006, 0x0d10, 0x3453, 0x0024, 0x34b0, 0x4024, 0x4192, 0x0024, /*  a30 */ 
+   0x4192, 0x0024, 0x2801, 0x7e40, 0xa010, 0x0024, 0x0000, 0x0201, /*  a38 */ 
+   0x0006, 0x0d10, 0x2900, 0xb680, 0x3613, 0x0024, 0x0006, 0x8081, /*  a40 */ 
+   0x3473, 0x0024, 0x3423, 0x0024, 0x3c50, 0x0024, 0x34b0, 0x8024, /*  a48 */ 
+   0x3450, 0xc024, 0xd234, 0x0024, 0x0000, 0x3fc3, 0xb234, 0x0024, /*  a50 */ 
+   0x4122, 0x0024, 0xf400, 0x4055, 0x3500, 0x0024, 0x3cb0, 0x0024, /*  a58 */ 
+   0x3490, 0x0024, 0x2801, 0x7e40, 0x6090, 0x138c, 0x003f, 0xfe04, /*  a60 */ 
+   0x0000, 0x0401, 0x0006, 0x0d10, 0x2900, 0xb680, 0x3613, 0x0024, /*  a68 */ 
+   0x0006, 0x8081, 0x3473, 0x0024, 0x3423, 0x0024, 0x3c50, 0x0024, /*  a70 */ 
+   0x34b0, 0x8024, 0x3400, 0xc024, 0xa346, 0x0024, 0xd234, 0x0024, /*  a78 */ 
+   0x0000, 0x3fc3, 0xb234, 0x0024, 0x4122, 0x1142, 0xf400, 0x4055, /*  a80 */ 
+   0x0006, 0x8081, 0x3500, 0x0024, 0xd024, 0x3000, 0xb234, 0x0024, /*  a88 */ 
+   0x4122, 0x0024, 0xf400, 0x4055, 0x3500, 0x0024, 0x3cb0, 0x0024, /*  a90 */ 
+   0x3490, 0x0024, 0x2801, 0x7e40, 0x6090, 0x138c, 0x0000, 0x4000, /*  a98 */ 
+   0x0000, 0x0202, 0x0006, 0x0d10, 0x3453, 0x0024, 0x34b0, 0x4024, /*  aa0 */ 
+   0x6122, 0x0024, 0xa010, 0x0024, 0x0004, 0x8001, 0x3800, 0x118c, /*  aa8 */ 
+   0x0006, 0x0d10, 0x3000, 0x0024, 0x6012, 0x1280, 0x0000, 0x0401, /*  ab0 */ 
+   0x2801, 0x8109, 0x0000, 0x0024, 0x6890, 0x82cc, 0x2801, 0xf6c0, /*  ab8 */ 
+   0x3800, 0x0024, 0x6012, 0x0024, 0x0006, 0x07c1, 0x2801, 0xa941, /*  ac0 */ 
+   0x4012, 0x0024, 0xf400, 0x4057, 0x3702, 0x0024, 0x2000, 0x0000, /*  ac8 */ 
+   0x0000, 0x0024, 0x2801, 0xa940, 0x0000, 0x0024, 0x0016, 0x2200, /*  ad0 */ 
+   0x0006, 0x0d50, 0x6892, 0x2040, 0x2801, 0xa940, 0x38f0, 0x4024, /*  ad8 */ 
+   0x002c, 0x4400, 0x0000, 0x0081, 0x0006, 0x0d50, 0x3810, 0x0024, /*  ae0 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x003b, 0x8000, 0x0000, 0x0081, /*  ae8 */ 
+   0x0006, 0x0d50, 0x3810, 0x0024, 0x2801, 0xa940, 0x38f0, 0x4024, /*  af0 */ 
+   0x0007, 0xd000, 0x0006, 0x0d50, 0xb882, 0x2040, 0x2801, 0xa940, /*  af8 */ 
+   0x38f0, 0x4024, 0x000f, 0xa000, 0x0006, 0x0d50, 0xb882, 0x2040, /*  b00 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x0015, 0x8880, 0x0006, 0x0d50, /*  b08 */ 
+   0xb882, 0x2040, 0x2801, 0xa940, 0x38f0, 0x4024, 0x0017, 0x7000, /*  b10 */ 
+   0x0006, 0x0d50, 0xb882, 0x2040, 0x2801, 0xa940, 0x38f0, 0x4024, /*  b18 */ 
+   0x001f, 0x4000, 0x0006, 0x0d50, 0xb882, 0x2040, 0x2801, 0xa940, /*  b20 */ 
+   0x38f0, 0x4024, 0x002b, 0x1100, 0x0006, 0x0d50, 0xb882, 0x2040, /*  b28 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x002e, 0xe000, 0x0006, 0x0d50, /*  b30 */ 
+   0xb882, 0x2040, 0x2801, 0xa940, 0x38f0, 0x4024, 0x001d, 0xc000, /*  b38 */ 
+   0x0006, 0x0d50, 0x6892, 0x2040, 0x2801, 0xa940, 0x38f0, 0x4024, /*  b40 */ 
+   0x0006, 0x0d50, 0x0000, 0x0201, 0x0000, 0xfa04, 0x2900, 0xb680, /*  b48 */ 
+   0x3613, 0x0024, 0x0006, 0x8081, 0xb88a, 0x11cc, 0x3423, 0x0024, /*  b50 */ 
+   0x3c50, 0x0024, 0x34b0, 0x8024, 0x3450, 0xc024, 0xd234, 0x0024, /*  b58 */ 
+   0x0000, 0x3fc3, 0xb234, 0x0024, 0x4122, 0x0024, 0xf400, 0x4055, /*  b60 */ 
+   0x3500, 0x0024, 0x3cb0, 0x0024, 0x3490, 0x0024, 0xfe50, 0x4005, /*  b68 */ 
+   0x48b2, 0x938c, 0xfeca, 0x0024, 0x40b2, 0x0024, 0x3810, 0x0024, /*  b70 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x003f, 0xfe04, 0x0000, 0x0401, /*  b78 */ 
+   0x0006, 0x0d50, 0x2900, 0xb680, 0x3613, 0x0024, 0x0006, 0x8081, /*  b80 */ 
+   0x3473, 0x0024, 0x3423, 0x0024, 0x3c50, 0x0024, 0x34b0, 0x8024, /*  b88 */ 
+   0x3400, 0xc024, 0xa346, 0x0024, 0xd234, 0x0024, 0x0000, 0x3fc3, /*  b90 */ 
+   0xb234, 0x0024, 0x4122, 0x1142, 0xf400, 0x4055, 0x0006, 0x8081, /*  b98 */ 
+   0x3500, 0x0024, 0xd024, 0x3000, 0xb234, 0x0024, 0x4122, 0x0024, /*  ba0 */ 
+   0xf400, 0x4055, 0x0000, 0x0041, 0x3500, 0x0024, 0x3cb0, 0x0024, /*  ba8 */ 
+   0x3490, 0x0024, 0xfe02, 0x938c, 0x48b2, 0x0024, 0x3810, 0x0024, /*  bb0 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x003f, 0xfe04, 0x0000, 0x0401, /*  bb8 */ 
+   0x0006, 0x0d50, 0x2900, 0xb680, 0x3613, 0x0024, 0x0006, 0x8081, /*  bc0 */ 
+   0x3473, 0x0024, 0x3423, 0x0024, 0x3c50, 0x0024, 0x34b0, 0x8024, /*  bc8 */ 
+   0x3400, 0xc024, 0xa346, 0x0024, 0xd234, 0x0024, 0x0000, 0x3fc3, /*  bd0 */ 
+   0xb234, 0x0024, 0x4122, 0x1142, 0xf400, 0x4055, 0x0006, 0x8081, /*  bd8 */ 
+   0x3500, 0x0024, 0xd024, 0x3000, 0xb234, 0x0024, 0x4122, 0x0024, /*  be0 */ 
+   0xf400, 0x4055, 0x3500, 0x0024, 0x3cb0, 0x0024, 0x0000, 0x0280, /*  be8 */ 
+   0x3490, 0x4024, 0xfe02, 0x938c, 0x48b2, 0x0024, 0x3810, 0x0024, /*  bf0 */ 
+   0x2801, 0xa940, 0x38f0, 0x4024, 0x0006, 0x0bd0, 0x6890, 0x0024, /*  bf8 */ 
+   0x2801, 0xf6c0, 0x3800, 0x0024, 0x0000, 0x0201, 0x2900, 0xb680, /*  c00 */ 
+   0x3613, 0x11cc, 0x3423, 0x0024, 0x3c50, 0x0024, 0x3490, 0x4024, /*  c08 */ 
+   0x6014, 0x124c, 0x0000, 0x0081, 0x2801, 0xacc5, 0x0006, 0x0c90, /*  c10 */ 
+   0x0006, 0x0bd0, 0x6890, 0x0024, 0x2801, 0xf6c0, 0x3800, 0x0024, /*  c18 */ 
+   0x3000, 0x0024, 0x6012, 0x0024, 0x0000, 0x0241, 0x2801, 0xaec9, /*  c20 */ 
+   0x0000, 0x0024, 0x6890, 0x034c, 0x2801, 0xf6c0, 0x3800, 0x0024, /*  c28 */ 
+   0x0006, 0x0cd0, 0x30e1, 0x184c, 0x3000, 0x0024, 0x6012, 0x0024, /*  c30 */ 
+   0x0008, 0x0001, 0x2801, 0xb0d5, 0x0000, 0x0024, 0x6498, 0x0024, /*  c38 */ 
+   0x3e10, 0x4024, 0x0000, 0x0081, 0x2900, 0x5580, 0x3e01, 0x0024, /*  c40 */ 
+   0x36e3, 0x004c, 0x3000, 0x0024, 0x6012, 0x0024, 0x000b, 0x8011, /*  c48 */ 
+   0x2801, 0xbc95, 0x0006, 0x0cd2, 0x0000, 0x0201, 0x0004, 0x0010, /*  c50 */ 
+   0x2915, 0x8300, 0x0001, 0x0000, 0x000b, 0x8011, 0x0005, 0x0010, /*  c58 */ 
+   0x291f, 0xc6c0, 0x0001, 0x0000, 0x0006, 0x0cd0, 0x30e1, 0x0024, /*  c60 */ 
+   0x3000, 0x0024, 0x6012, 0x0024, 0x0000, 0x0281, 0x2801, 0xb805, /*  c68 */ 
+   0x6012, 0x0024, 0x000b, 0x8001, 0x2801, 0xb895, 0x3613, 0x0024, /*  c70 */ 
+   0x36f3, 0x0024, 0x000b, 0x8001, 0x6498, 0x184c, 0x0006, 0x0cd2, /*  c78 */ 
+   0x0003, 0x8000, 0x3e10, 0x4024, 0x2900, 0x5580, 0x3e01, 0x0024, /*  c80 */ 
+   0x36f3, 0x0024, 0x3009, 0x3844, 0x3e10, 0x0024, 0x0000, 0x0400, /*  c88 */ 
+   0x3000, 0x8024, 0x0008, 0x0010, 0x3e00, 0x8024, 0x3201, 0x0024, /*  c90 */ 
+   0x6408, 0x4051, 0x2902, 0x2700, 0x0001, 0xbf48, 0x0000, 0x0400, /*  c98 */ 
+   0x0000, 0x0011, 0x3613, 0x008c, 0x30d0, 0x7844, 0x3e10, 0x4024, /*  ca0 */ 
+   0x3000, 0x8024, 0x0008, 0x0010, 0x3e00, 0x8024, 0x3201, 0x0024, /*  ca8 */ 
+   0x2902, 0x2700, 0x6408, 0x0024, 0x0006, 0x8a10, 0x0000, 0x01c1, /*  cb0 */ 
+   0x36e3, 0x0000, 0xb010, 0x9bc4, 0x0000, 0x0024, 0x2801, 0xc305, /*  cb8 */ 
+   0x6192, 0x0024, 0x2900, 0xb680, 0x6102, 0x184c, 0x4088, 0x0024, /*  cc0 */ 
+   0x0000, 0x0024, 0x2801, 0xc305, 0x0000, 0x0024, 0x6890, 0x0b4c, /*  cc8 */ 
+   0x3a00, 0x0024, 0x3009, 0x0000, 0x4080, 0x0024, 0x0000, 0x0024, /*  cd0 */ 
+   0x2902, 0x5b45, 0x0001, 0xc808, 0x0006, 0x9f92, 0x0000, 0x4003, /*  cd8 */ 
+   0x3009, 0x0811, 0x3100, 0x8024, 0xffa6, 0x0024, 0x48b6, 0x0024, /*  ce0 */ 
+   0x2902, 0x5b40, 0x4384, 0x0024, 0x2902, 0x52c0, 0x3613, 0x0024, /*  ce8 */ 
+   0x4082, 0x184c, 0x2902, 0x57c0, 0x3e00, 0x0024, 0x2902, 0x5b40, /*  cf0 */ 
+   0x36f3, 0x0024, 0x0000, 0x0401, 0x3473, 0x184c, 0x3423, 0x0024, /*  cf8 */ 
+   0x2900, 0xb680, 0x3c50, 0x0024, 0x3c90, 0x0024, 0x290b, 0x1400, /*  d00 */ 
+   0x3493, 0x0024, 0x4080, 0x0024, 0x0000, 0x0024, 0x2801, 0xf355, /*  d08 */ 
+   0x0000, 0x0024, 0x3473, 0x0024, 0x3423, 0x0024, 0x3450, 0x0024, /*  d10 */ 
+   0x3490, 0x4024, 0x6014, 0x134c, 0x0006, 0x0bd1, 0x2801, 0xcdc5, /*  d18 */ 
+   0x34c0, 0x0024, 0x6890, 0x0024, 0x2801, 0xf6c0, 0x3900, 0x0024, /*  d20 */ 
+   0x4080, 0x4512, 0x0006, 0x0d11, 0x2801, 0xd245, 0x0000, 0xfa02, /*  d28 */ 
+   0xf400, 0x4511, 0x0000, 0xfa02, 0x0006, 0x0d52, 0x3210, 0x05cc, /*  d30 */ 
+   0x32f0, 0x44cc, 0x3111, 0x8024, 0x31f1, 0xc024, 0xfef4, 0x4087, /*  d38 */ 
+   0x48b6, 0x0024, 0xfeee, 0x0024, 0x2914, 0xa580, 0x42b6, 0x0024, /*  d40 */ 
+   0x2801, 0xd5c0, 0x0007, 0x89d0, 0x3111, 0x89cc, 0x3110, 0x08cc, /*  d48 */ 
+   0x3211, 0x0024, 0x32f1, 0x4024, 0xfedc, 0x4185, 0x48be, 0x07c1, /*  d50 */ 
+   0xfeca, 0x0024, 0x46be, 0x0024, 0xfef4, 0x4087, 0x48b6, 0x0024, /*  d58 */ 
+   0xfeee, 0x0024, 0x2914, 0xa580, 0x42b6, 0x0024, 0x0007, 0x89d0, /*  d60 */ 
+   0x0006, 0x0d51, 0x3810, 0x184c, 0x38f0, 0x4024, 0x3110, 0x8024, /*  d68 */ 
+   0x428a, 0x0703, 0x2908, 0xbe80, 0x3101, 0x0024, 0xf400, 0x4512, /*  d70 */ 
+   0x0000, 0x03d3, 0x3123, 0x0a0c, 0x3100, 0x0024, 0x000b, 0x8011, /*  d78 */ 
+   0x3a00, 0x0024, 0x2801, 0xf140, 0x0008, 0x0012, 0x0000, 0x03d5, /*  d80 */ 
+   0x3483, 0x0024, 0x1fff, 0xfc55, 0x3480, 0x0024, 0x6402, 0x0024, /*  d88 */ 
+   0x0006, 0x0c90, 0x2801, 0xdbc9, 0x0000, 0x0024, 0xf400, 0x4004, /*  d90 */ 
+   0x3000, 0x0024, 0x4090, 0x0024, 0xf400, 0x4480, 0x2801, 0xe195, /*  d98 */ 
+   0x000b, 0x8001, 0x0000, 0x0005, 0x6540, 0x0024, 0x0000, 0x0024, /*  da0 */ 
+   0x2801, 0xecd8, 0x4490, 0x0024, 0x2401, 0xe0c0, 0x0000, 0x0024, /*  da8 */ 
+   0x0006, 0x0dc1, 0x4554, 0x0800, 0x4122, 0x0024, 0x659a, 0x4055, /*  db0 */ 
+   0x0006, 0x0e01, 0x4122, 0x3400, 0xf400, 0x4055, 0x3210, 0x0024, /*  db8 */ 
+   0x3d00, 0x0024, 0x2801, 0xecc0, 0x0000, 0x0024, 0x6014, 0x0024, /*  dc0 */ 
+   0x0001, 0x0000, 0x2801, 0xe915, 0x0000, 0x0005, 0x0008, 0x0012, /*  dc8 */ 
+   0x0008, 0x0010, 0x0003, 0x8001, 0x0006, 0x0d13, 0x3613, 0x0024, /*  dd0 */ 
+   0x3009, 0x3811, 0x2902, 0x9740, 0x0004, 0x0011, 0x0008, 0x0010, /*  dd8 */ 
+   0x0001, 0x0000, 0x291f, 0xc6c0, 0x0005, 0x0011, 0x000f, 0x0011, /*  de0 */ 
+   0x0008, 0x0010, 0x33d0, 0x184c, 0x6010, 0xb844, 0x3e10, 0x0024, /*  de8 */ 
+   0x0000, 0x0400, 0x3320, 0x4024, 0x3e00, 0x4024, 0x3301, 0x0024, /*  df0 */ 
+   0x2902, 0x2700, 0x6408, 0x0024, 0x36e3, 0x0024, 0x3009, 0x1bc4, /*  df8 */ 
+   0x3009, 0x1bd1, 0x6540, 0x0024, 0x0000, 0x0024, 0x2801, 0xecd8, /*  e00 */ 
+   0x4490, 0x0024, 0x2401, 0xec80, 0x0000, 0x0024, 0x0006, 0x0dc1, /*  e08 */ 
+   0x4554, 0x0840, 0x4122, 0x0024, 0x659a, 0x4055, 0x0006, 0x0e01, /*  e10 */ 
+   0x4122, 0x3400, 0xf400, 0x4055, 0x3110, 0x0024, 0x3d00, 0x0024, /*  e18 */ 
+   0xf400, 0x4510, 0x0030, 0x0013, 0x3073, 0x184c, 0x3073, 0x0024, /*  e20 */ 
+   0x3013, 0x0024, 0x3000, 0x4024, 0x6140, 0x0024, 0x0000, 0x0201, /*  e28 */ 
+   0x3800, 0x0024, 0x0006, 0x0dc0, 0x3e11, 0x0024, 0x290c, 0x7300, /*  e30 */ 
+   0x3e10, 0x0024, 0x3300, 0x1b8c, 0xb010, 0x0024, 0x0000, 0x0024, /*  e38 */ 
+   0x2801, 0xf355, 0x0000, 0x0024, 0x0000, 0x03d5, 0x3483, 0x0024, /*  e40 */ 
+   0x1fff, 0xfc55, 0x3480, 0x0024, 0x4080, 0x0024, 0x0000, 0x0804, /*  e48 */ 
+   0x2801, 0xd995, 0x0000, 0x0024, 0x0006, 0x8012, 0x0006, 0x8010, /*  e50 */ 
+   0x0006, 0x0d51, 0x3010, 0x984c, 0x30f0, 0xc024, 0x0000, 0x0021, /*  e58 */ 
+   0xf2d6, 0x07c6, 0x290a, 0xf5c0, 0x4682, 0x0400, 0x6894, 0x0840, /*  e60 */ 
+   0xb886, 0x0bc1, 0xbcd6, 0x0024, 0x3a10, 0x8024, 0x3af0, 0xc024, /*  e68 */ 
+   0x36f3, 0x4024, 0x36f3, 0xd80e, 0x36f4, 0x9813, 0x36f4, 0x1811, /*  e70 */ 
+   0x36f1, 0x9807, 0x36f1, 0x1805, 0x36f0, 0x9803, 0x36f0, 0x1801, /*  e78 */ 
+   0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, /*  e80 */ 
+   0x36f2, 0x9817, 0x0007, 0x0001, 0x8271, 0x0006, 0x00d2, 0x3613, /*  e88 */ 
+   0x0024, 0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, /*  e90 */ 
+   0x0024, 0x0000, 0x800a, 0x3e10, 0x3801, 0x0019, 0x9300, 0x3e14, /*  e98 */ 
+   0x3811, 0x0030, 0x0250, 0x3e04, 0xb813, 0x2900, 0xbdc0, 0x3800, /*  ea0 */ 
+   0x0024, 0x2902, 0x6cc0, 0x0000, 0x0200, 0xb882, 0x0024, 0x2914, /*  ea8 */ 
+   0xbec0, 0x0006, 0x0bd0, 0x0000, 0x1540, 0x0007, 0x8190, 0x2900, /*  eb0 */ 
+   0x1c80, 0x3800, 0x0024, 0x4080, 0x0024, 0x0006, 0x0bd1, 0x2800, /*  eb8 */ 
+   0xa815, 0x0000, 0x0024, 0x3100, 0x0024, 0x4080, 0x0024, 0x0030, /*  ec0 */ 
+   0x0010, 0x2800, 0xa815, 0x0000, 0x0201, 0x3000, 0x0024, 0xb010, /*  ec8 */ 
+   0x0024, 0x0000, 0x0024, 0x2800, 0xa815, 0x0000, 0x0024, 0x2900, /*  ed0 */ 
+   0x1c80, 0x0000, 0x0024, 0x4080, 0x0024, 0x0006, 0x0bd0, 0x2800, /*  ed8 */ 
+   0xa815, 0x0000, 0x0024, 0x3000, 0x0024, 0x4080, 0x0024, 0x0000, /*  ee0 */ 
+   0x0201, 0x2800, 0xa405, 0x0030, 0x0010, 0x0030, 0x0010, 0x0000, /*  ee8 */ 
+   0x0201, 0x3000, 0x0024, 0xb010, 0x0024, 0x0000, 0x0024, 0x2902, /*  ef0 */ 
+   0x5255, 0x0000, 0xb0c8, 0x0006, 0x0bd1, 0x3100, 0x0024, 0x4080, /*  ef8 */ 
+   0x0024, 0x0000, 0x0024, 0x2800, 0xaf05, 0x0000, 0x0024, 0x0007, /*  f00 */ 
+   0x8a52, 0x3200, 0x0024, 0x4080, 0x0024, 0x0000, 0x0024, 0x2800, /*  f08 */ 
+   0xaf09, 0x0000, 0x0024, 0xf292, 0x0800, 0x6012, 0x0024, 0x0000, /*  f10 */ 
+   0x0000, 0x2800, 0xaec5, 0x0000, 0x0024, 0x3200, 0x0024, 0x4090, /*  f18 */ 
+   0x0024, 0xb880, 0x2800, 0x3900, 0x0024, 0x3100, 0x0024, 0x4080, /*  f20 */ 
+   0x0024, 0x0000, 0x0024, 0x2901, 0x2e05, 0x0000, 0xa808, 0x2902, /*  f28 */ 
+   0x5240, 0x0000, 0x0024, 0x0000, 0x0010, 0x0006, 0x9f51, 0x0006, /*  f30 */ 
+   0x9f92, 0x0030, 0x0493, 0x0000, 0x0201, 0x6890, 0xa410, 0x3b00, /*  f38 */ 
+   0x2810, 0x0006, 0x8a10, 0x3009, 0x0000, 0x6012, 0x0024, 0x0006, /*  f40 */ 
+   0x9fd0, 0x2800, 0xb448, 0xb880, 0x0024, 0x6890, 0x0024, 0x3009, /*  f48 */ 
+   0x2000, 0x36f4, 0x9813, 0x36f4, 0x1811, 0x36f0, 0x1801, 0x3405, /*  f50 */ 
+   0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, /*  f58 */ 
+   0x9817, 0x0007, 0x0001, 0x5840, 0x0006, 0x0001, 0x0001, 0x0006, /*  f60 */ 
+   0x8007, 0x0000, 0x0006, 0x0018, 0x0002, 0x0000, 0xffff, 0xffff, /*  f68 */ 
+   0x0000, 0x0000, 0x0000, 0x0000, 0x0003, 0x0000, 0xfffd, 0xffff, /*  f70 */ 
+   0x0001, 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0xfffa, 0xffff, /*  f78 */ 
+   0x0004, 0x0000, 0xffff, 0xffff, 0x0007, 0x0001, 0x87e8, 0x0006, /*  f80 */ 
+   0x004e, 0x3613, 0x0024, 0x3e12, 0xb815, 0x0000, 0x800a, 0x3e14, /*  f88 */ 
+   0x7813, 0x3e10, 0xb803, 0x3e11, 0x3805, 0x3e11, 0xb807, 0x3e13, /*  f90 */ 
+   0xf80e, 0x6812, 0x0024, 0x3e03, 0x7810, 0x0fff, 0xffd3, 0x0000, /*  f98 */ 
+   0x0091, 0xbd86, 0x9850, 0x3e10, 0x3804, 0x3e00, 0x7812, 0xbe8a, /*  fa0 */ 
+   0x8bcc, 0x409e, 0x8086, 0x2401, 0xff07, 0xfe49, 0x2821, 0x526a, /*  fa8 */ 
+   0x8801, 0x5c87, 0x280e, 0x4eba, 0x9812, 0x4286, 0x40e1, 0xb284, /*  fb0 */ 
+   0x1bc1, 0x4de6, 0x0024, 0xad17, 0x2627, 0x4fde, 0x9804, 0x4498, /*  fb8 */ 
+   0x1bc0, 0x0000, 0x0024, 0x2801, 0xfd15, 0x3a11, 0xa807, 0x36f3, /*  fc0 */ 
+   0x4024, 0x36f3, 0xd80e, 0x36f1, 0x9807, 0x36f1, 0x1805, 0x36f0, /*  fc8 */ 
+   0x9803, 0x36f4, 0x5813, 0x2000, 0x0000, 0x36f2, 0x9815, 0x0007, /*  fd0 */ 
+   0x0001, 0x880f, 0x0006, 0x0056, 0x3613, 0x0024, 0x3e12, 0xb815, /*  fd8 */ 
+   0x0000, 0x800a, 0x3e10, 0xb803, 0x3e11, 0x3805, 0x3e11, 0xb807, /*  fe0 */ 
+   0x3e13, 0xf80e, 0x6812, 0x0024, 0x3e03, 0x7810, 0x3009, 0x1850, /*  fe8 */ 
+   0x3e10, 0x3804, 0x3e10, 0x7812, 0x32f3, 0x0024, 0xbd86, 0x0024, /*  ff0 */ 
+   0x4091, 0xe2e3, 0x3009, 0x0046, 0x2402, 0x0a80, 0x3009, 0x0047, /*  ff8 */ 
+   0x32f0, 0x0801, 0xfe1f, 0x6465, 0x5e8a, 0x0024, 0x44ba, 0x0024, /* 1000 */ 
+   0xfee2, 0x0024, 0x5d8a, 0x1800, 0x4482, 0x4160, 0x48ba, 0x8046, /* 1008 */ 
+   0x4dc6, 0x1822, 0x4de6, 0x8047, 0x36f3, 0x0024, 0x36f0, 0x5812, /* 1010 */ 
+   0xad17, 0x2627, 0x4fde, 0x9804, 0x4498, 0x1bc0, 0x0000, 0x0024, /* 1018 */ 
+   0x2802, 0x0615, 0x3a11, 0xa807, 0x36f3, 0x4024, 0x36f3, 0xd80e, /* 1020 */ 
+   0x36f1, 0x9807, 0x36f1, 0x1805, 0x36f0, 0x9803, 0x2000, 0x0000, /* 1028 */ 
+   0x36f2, 0x9815, 0x0007, 0x0001, 0x883a, 0x0006, 0x004e, 0x3613, /* 1030 */ 
+   0x0024, 0x3e10, 0xb810, 0x3e11, 0x3805, 0x3e02, 0x0024, 0x0030, /* 1038 */ 
+   0x0010, 0xce9a, 0x0002, 0x0000, 0x0200, 0x2902, 0x1840, 0xb024, /* 1040 */ 
+   0x0024, 0xc020, 0x0024, 0x0000, 0x0200, 0x2802, 0x1045, 0x6e9a, /* 1048 */ 
+   0x0002, 0x4182, 0x0024, 0x0000, 0x0400, 0x2802, 0x1685, 0xae1a, /* 1050 */ 
+   0x0024, 0x6104, 0x984c, 0x0000, 0x0024, 0x2900, 0xb689, 0x0002, /* 1058 */ 
+   0x1648, 0x3613, 0x0024, 0x6103, 0xe4e5, 0x2900, 0xb680, 0x408a, /* 1060 */ 
+   0x184c, 0x2900, 0xb680, 0x408a, 0x4141, 0x3601, 0x0024, 0x4582, /* 1068 */ 
+   0x9bc5, 0x2802, 0x1680, 0xceca, 0x0024, 0xc408, 0x0024, 0xf2e2, /* 1070 */ 
+   0x1bc8, 0x36f1, 0x1805, 0x2000, 0x0011, 0x36f0, 0x9810, 0x68c2, /* 1078 */ 
+   0x0024, 0x2000, 0x0000, 0x4c92, 0x0024, 0x0007, 0x0001, 0x8861, /* 1080 */ 
+   0x0006, 0x0076, 0x0006, 0x8a17, 0x3613, 0x1c00, 0x6093, 0xe1e3, /* 1088 */ 
+   0x0000, 0x03c3, 0x0006, 0x9f95, 0xb132, 0x9415, 0x3500, 0xfc01, /* 1090 */ 
+   0x2802, 0x2655, 0xa306, 0x0024, 0x0007, 0x0097, 0x003f, 0xc001, /* 1098 */ 
+   0x3500, 0x184c, 0xb011, 0xe4e5, 0xb182, 0x1c04, 0xd400, 0x184c, /* 10a0 */ 
+   0x0000, 0x0205, 0xac52, 0x3802, 0x0006, 0xc082, 0x4212, 0x0024, /* 10a8 */ 
+   0xf400, 0x4057, 0xb182, 0x1c04, 0xd400, 0x0024, 0xac52, 0x1404, /* 10b0 */ 
+   0xd142, 0x0024, 0x0000, 0x3fc4, 0xb142, 0x0024, 0x4122, 0x1bc2, /* 10b8 */ 
+   0xf400, 0x4057, 0x3700, 0x4024, 0xd101, 0x6465, 0x0007, 0x0097, /* 10c0 */ 
+   0x3f00, 0x3814, 0x0025, 0xffd4, 0x0006, 0x8017, 0x3710, 0x160c, /* 10c8 */ 
+   0x0006, 0x9f94, 0x37f0, 0x73d5, 0x6c92, 0x3808, 0x3f10, 0x0024, /* 10d0 */ 
+   0x3ff0, 0x4024, 0x3009, 0x1040, 0x3009, 0x13c1, 0x6010, 0x0024, /* 10d8 */ 
+   0x0000, 0x0024, 0x2902, 0x7645, 0x0002, 0x2248, 0x2802, 0x2494, /* 10e0 */ 
+   0x0006, 0x0001, 0x4010, 0x0024, 0x0005, 0xf601, 0x6010, 0x0024, /* 10e8 */ 
+   0x0000, 0x0040, 0x2802, 0x2614, 0x0030, 0x0497, 0x3f00, 0x0024, /* 10f0 */ 
+   0x36f2, 0x1814, 0x4330, 0x9803, 0x2000, 0x0000, 0x8880, 0x1bc1, /* 10f8 */ 
+   0x0007, 0x0001, 0x889c, 0x0006, 0x00a4, 0x3613, 0x0024, 0x3e22, /* 1100 */ 
+   0xb806, 0x3e05, 0xb814, 0x3615, 0x0024, 0x0000, 0x800a, 0x3e10, /* 1108 */ 
+   0x3801, 0x3e10, 0xb803, 0x3e11, 0x7807, 0x6848, 0x930c, 0x3411, /* 1110 */ 
+   0x780d, 0x459a, 0x10c0, 0x0000, 0x0201, 0x6012, 0x384e, 0x0000, /* 1118 */ 
+   0x0241, 0x2802, 0x2d95, 0x6012, 0xb80f, 0x2402, 0x2cc5, 0x0000, /* 1120 */ 
+   0x0024, 0x3000, 0x0001, 0x3101, 0x8407, 0x6cfe, 0x0024, 0xac42, /* 1128 */ 
+   0x0024, 0xaf4e, 0x2040, 0x3911, 0x8024, 0x2802, 0x3940, 0x0000, /* 1130 */ 
+   0x0024, 0x0000, 0x0281, 0x2802, 0x30d5, 0x6012, 0x4455, 0x2402, /* 1138 */ 
+   0x3005, 0x0000, 0x0024, 0x3000, 0x0001, 0x3101, 0x8407, 0x4cf2, /* 1140 */ 
+   0x0024, 0xac42, 0x0024, 0xaf4e, 0x2040, 0x3911, 0x8024, 0x2802, /* 1148 */ 
+   0x3940, 0x0000, 0x0024, 0x0000, 0x0024, 0x2802, 0x3515, 0x4080, /* 1150 */ 
+   0x0024, 0x3110, 0x0401, 0xf20f, 0x0203, 0x2402, 0x3445, 0x8dd6, /* 1158 */ 
+   0x0024, 0x4dce, 0x0024, 0xf1fe, 0x0024, 0xaf4e, 0x0024, 0x6dc6, /* 1160 */ 
+   0x2046, 0xf1df, 0x0203, 0xaf4f, 0x1011, 0xf20e, 0x07cc, 0x8dd6, /* 1168 */ 
+   0x2486, 0x2802, 0x3940, 0x0000, 0x0024, 0x0000, 0x0024, 0x2802, /* 1170 */ 
+   0x3795, 0x0000, 0x0024, 0x0fff, 0xffd1, 0x2402, 0x36c5, 0x3010, /* 1178 */ 
+   0x0001, 0xac4f, 0x0801, 0x3821, 0x8024, 0x2802, 0x3940, 0x0000, /* 1180 */ 
+   0x0024, 0x0fff, 0xffd1, 0x2402, 0x3905, 0x3010, 0x0001, 0x3501, /* 1188 */ 
+   0x9407, 0xac47, 0x0801, 0xaf4e, 0x2082, 0x3d11, 0x8024, 0x36f3, /* 1190 */ 
+   0xc024, 0x36f3, 0x980d, 0x36f1, 0x5807, 0x36f0, 0x9803, 0x36f0, /* 1198 */ 
+   0x1801, 0x3405, 0x9014, 0x36e3, 0x0024, 0x2000, 0x0000, 0x36f2, /* 11a0 */ 
+   0x9806, 0x0007, 0x0001, 0x88ee, 0x0006, 0x005c, 0x0006, 0x9f97, /* 11a8 */ 
+   0x3e00, 0x5c15, 0x0007, 0x0097, 0x003f, 0xc001, 0x3500, 0x3840, /* 11b0 */ 
+   0xb011, 0xe4e5, 0xb182, 0x1c04, 0xd400, 0x184c, 0x0000, 0x0205, /* 11b8 */ 
+   0xac52, 0x3802, 0x0006, 0xc082, 0x4212, 0x0024, 0xb182, 0x4057, /* 11c0 */ 
+   0x3701, 0x0024, 0xd400, 0x0024, 0xac52, 0x1404, 0xd142, 0x0024, /* 11c8 */ 
+   0x0000, 0x3fc4, 0xb142, 0x0024, 0x4122, 0x1bc2, 0xf400, 0x4057, /* 11d0 */ 
+   0x3700, 0x4024, 0xd101, 0x6465, 0x0007, 0x0097, 0x3f00, 0x3814, /* 11d8 */ 
+   0x0025, 0xffd4, 0x0006, 0x8017, 0x3710, 0x160c, 0x0006, 0x9f94, /* 11e0 */ 
+   0x37f0, 0x73d5, 0x6c92, 0x0024, 0x3f10, 0x1040, 0x3ff0, 0x53c1, /* 11e8 */ 
+   0x6010, 0x0024, 0x0000, 0x0024, 0x2802, 0x4514, 0x0006, 0x0001, /* 11f0 */ 
+   0x4010, 0x0024, 0x0005, 0xf601, 0x6010, 0x9bd4, 0x0000, 0x0040, /* 11f8 */ 
+   0x2802, 0x4694, 0x0030, 0x0497, 0x3f00, 0x0024, 0x2000, 0x0000, /* 1200 */ 
+   0x36f0, 0x5800, 0x0007, 0x0001, 0x82da, 0x0006, 0x003a, 0x3e10, /* 1208 */ 
+   0xb812, 0x3e11, 0xb810, 0x3e12, 0x0024, 0x0006, 0x9f92, 0x0025, /* 1210 */ 
+   0xffd0, 0x3e04, 0x4bd1, 0x3181, 0xf847, 0xb68c, 0x4440, 0x3009, /* 1218 */ 
+   0x0802, 0x6024, 0x3806, 0x0006, 0x8a10, 0x2902, 0x7645, 0x0000, /* 1220 */ 
+   0xb888, 0x0000, 0x0800, 0x6101, 0x1602, 0xaf2e, 0x0024, 0x4214, /* 1228 */ 
+   0x1be3, 0xaf0e, 0x1811, 0x0fff, 0xfc00, 0xb200, 0x9bc7, 0x0000, /* 1230 */ 
+   0x03c0, 0x2800, 0xbcc5, 0xb204, 0xa002, 0x2902, 0x3b80, 0x3613, /* 1238 */ 
+   0x2002, 0x4680, 0x1bc8, 0x36f1, 0x9810, 0x2000, 0x0000, 0x36f0, /* 1240 */ 
+   0x9812, 0x0007, 0x0001, 0x891c, 0x0006, 0x0022, 0x0000, 0x0400, /* 1248 */ 
+   0x6102, 0x0024, 0x3e11, 0x3805, 0x2802, 0x4a09, 0x3e02, 0x0024, /* 1250 */ 
+   0x2900, 0xb680, 0x408a, 0x188c, 0x2900, 0xb680, 0x408a, 0x4141, /* 1258 */ 
+   0x4582, 0x1bc8, 0x2000, 0x0000, 0x36f1, 0x1805, 0x2900, 0xb680, /* 1260 */ 
+   0x4102, 0x184c, 0xb182, 0x1bc8, 0x2000, 0x0000, 0x36f1, 0x1805, /* 1268 */ 
+   0x0007, 0x0001, 0x892d, 0x0006, 0x0036, 0x2a02, 0x4b8e, 0x3e12, /* 1270 */ 
+   0xb817, 0x3e10, 0x3802, 0x0006, 0x9f97, 0x3009, 0x1fc2, 0x3e04, /* 1278 */ 
+   0x5c00, 0x6020, 0xb810, 0x0030, 0x0451, 0x2802, 0x4e14, 0x0006, /* 1280 */ 
+   0x0002, 0x4020, 0x0024, 0x0005, 0xfb02, 0x6024, 0x0024, 0x0025, /* 1288 */ 
+   0xffd0, 0x2802, 0x5051, 0x3100, 0x1c11, 0xb284, 0x0024, 0x0030, /* 1290 */ 
+   0x0490, 0x3800, 0x8024, 0x0025, 0xffd0, 0x3980, 0x1810, 0x36f4, /* 1298 */ 
+   0x7c11, 0x36f0, 0x1802, 0x0030, 0x0717, 0x3602, 0x8024, 0x2100, /* 12a0 */ 
+   0x0000, 0x3f05, 0xdbd7, 0x0007, 0x0001, 0x82f7, 0x0006, 0x0012, /* 12a8 */ 
+   0x0002, 0x4b57, 0x3613, 0x0024, 0x3e00, 0x3801, 0xf400, 0x55c0, /* 12b0 */ 
+   0x0000, 0x0897, 0xf400, 0x57c0, 0x0000, 0x0024, 0x2000, 0x0000, /* 12b8 */ 
+   0x36f0, 0x1801, 0x0007, 0x0001, 0x8948, 0x0006, 0x0006, 0x2a08, /* 12c0 */ 
+   0x1b8e, 0x2800, 0xbe00, 0x0002, 0x5217, 0x0007, 0x0001, 0x894b, /* 12c8 */ 
+   0x0006, 0x0028, 0x3e22, 0xb815, 0x3e05, 0xb814, 0x3615, 0x0024, /* 12d0 */ 
+   0x0000, 0x800a, 0x4283, 0xe1e3, 0x003f, 0xfe03, 0xa034, 0x0024, /* 12d8 */ 
+   0x0000, 0x3fc3, 0xd214, 0x0024, 0x0000, 0x0201, 0xb234, 0x0024, /* 12e0 */ 
+   0x0006, 0xc083, 0x4326, 0x0024, 0xa010, 0x40d5, 0x3500, 0x5803, /* 12e8 */ 
+   0xd010, 0x1bc1, 0x3405, 0x9014, 0x36e3, 0x0024, 0x2000, 0x0000, /* 12f0 */ 
+   0x36f2, 0x9815, 0x0007, 0x0001, 0x895f, 0x0006, 0x001c, 0x3613, /* 12f8 */ 
+   0x0024, 0x3e22, 0xb815, 0x3e05, 0xb814, 0x3615, 0x0024, 0x3e00, /* 1300 */ 
+   0x3810, 0x0007, 0x0090, 0x34d3, 0x0024, 0x3430, 0x0024, 0x3800, /* 1308 */ 
+   0x1810, 0x36f0, 0x0024, 0x3405, 0x9014, 0x36e3, 0x0024, 0x2000, /* 1310 */ 
+   0x0000, 0x36f2, 0x9815, 0x0007, 0x0001, 0x896d, 0x0006, 0x0018, /* 1318 */ 
+   0x3613, 0x0024, 0x3e22, 0xb815, 0x3e05, 0xb814, 0x3615, 0x0024, /* 1320 */ 
+   0x3e04, 0x0024, 0x0007, 0x0090, 0x3000, 0x0024, 0x36f4, 0x0024, /* 1328 */ 
+   0x3405, 0x9014, 0x36e3, 0x0024, 0x2000, 0x0000, 0x36f2, 0x9815, /* 1330 */ 
+   0x0007, 0x0001, 0x8979, 0x0006, 0x0074, 0x3613, 0x0024, 0x3e22, /* 1338 */ 
+   0xb815, 0x3e05, 0xb814, 0x3615, 0x0024, 0x0000, 0x800a, 0x3e10, /* 1340 */ 
+   0x3801, 0x3e10, 0xb803, 0xb884, 0xb805, 0x3e11, 0x0024, 0x3e11, /* 1348 */ 
+   0xb80d, 0x2802, 0x6940, 0x3e03, 0xf80e, 0xf400, 0x4083, 0x2402, /* 1350 */ 
+   0x66ce, 0xf400, 0x4105, 0x0000, 0x0206, 0xa562, 0x0024, 0x455a, /* 1358 */ 
+   0x0024, 0x0020, 0x0006, 0xd312, 0x0024, 0xb16c, 0x0024, 0x0020, /* 1360 */ 
+   0x0006, 0x2802, 0x6545, 0xd342, 0x0024, 0x0000, 0x01c6, 0xd342, /* 1368 */ 
+   0x0024, 0xd56a, 0x0024, 0x0020, 0x0006, 0x4448, 0x0024, 0xb16c, /* 1370 */ 
+   0x0024, 0x0020, 0x0146, 0x2802, 0x66c5, 0x0000, 0x0024, 0xd468, /* 1378 */ 
+   0x0024, 0x4336, 0x0024, 0x0000, 0x3fc1, 0x0006, 0x8086, 0x462c, /* 1380 */ 
+   0x0024, 0xb512, 0x4195, 0x3d00, 0x4024, 0x0006, 0xc081, 0x4122, /* 1388 */ 
+   0x0024, 0x6294, 0x4055, 0x3d01, 0x0024, 0x0000, 0x4000, 0x6200, /* 1390 */ 
+   0x0024, 0x0000, 0x03ce, 0x2802, 0x6151, 0xb888, 0x0024, 0x36f3, /* 1398 */ 
+   0xd80e, 0x36f1, 0x980d, 0x36f1, 0x1805, 0x36f0, 0x9803, 0x36f0, /* 13a0 */ 
+   0x1801, 0x3405, 0x9014, 0x36e3, 0x0024, 0x2000, 0x0000, 0x36f2, /* 13a8 */ 
+   0x9815, 0x0007, 0x0001, 0x89b3, 0x0006, 0x004c, 0x3613, 0x0024, /* 13b0 */ 
+   0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3615, 0x0024, /* 13b8 */ 
+   0x0000, 0x800a, 0x3e10, 0x3801, 0x3e10, 0xb810, 0x0006, 0x8a10, /* 13c0 */ 
+   0xb880, 0x3811, 0x0006, 0x9fd1, 0x3009, 0x2000, 0x3009, 0x0400, /* 13c8 */ 
+   0x4080, 0x0024, 0x0006, 0x8011, 0x2802, 0x7185, 0xbc82, 0x0024, /* 13d0 */ 
+   0x0000, 0x0200, 0xbc82, 0xa000, 0x3910, 0x0024, 0x2902, 0x5e40, /* 13d8 */ 
+   0x39f0, 0x4024, 0x0006, 0x9f90, 0x0006, 0x9f51, 0x3009, 0x0000, /* 13e0 */ 
+   0x3009, 0x0401, 0x6014, 0x0024, 0x0000, 0x0024, 0x2902, 0x7645, /* 13e8 */ 
+   0x0002, 0x7248, 0x36f4, 0x4024, 0x36f0, 0x9810, 0x36f0, 0x1801, /* 13f0 */ 
+   0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, /* 13f8 */ 
+   0x36f2, 0x9817, 0x0007, 0x0001, 0x89d9, 0x0006, 0x001a, 0x3613, /* 1400 */ 
+   0x0024, 0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x290a, /* 1408 */ 
+   0xd900, 0x3605, 0x0024, 0x2910, 0x0180, 0x3613, 0x0024, 0x3405, /* 1410 */ 
+   0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, /* 1418 */ 
+   0x9817, 0x0007, 0x0001, 0x89e6, 0x0006, 0x0066, 0x3613, 0x0024, /* 1420 */ 
+   0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, 0xb814, 0x3625, 0x0024, /* 1428 */ 
+   0x0000, 0x800a, 0x3e10, 0xb803, 0x0001, 0x0002, 0x3e11, 0x3805, /* 1430 */ 
+   0x3e11, 0xb807, 0x3e14, 0x3811, 0x0006, 0x9f90, 0x3e04, 0xb813, /* 1438 */ 
+   0x3413, 0x0000, 0x6090, 0x0024, 0x6026, 0x33c0, 0x0000, 0x0024, /* 1440 */ 
+   0x2802, 0x7f15, 0x0000, 0x0024, 0x0000, 0x0011, 0x3413, 0x0024, /* 1448 */ 
+   0x3cf4, 0x4024, 0x0006, 0x9f50, 0x3413, 0x0002, 0x34f0, 0x0024, /* 1450 */ 
+   0x6026, 0x0024, 0x0000, 0x0024, 0x2902, 0x7645, 0x0002, 0x7f08, /* 1458 */ 
+   0x0006, 0x9f92, 0x0006, 0x8a13, 0x3413, 0x0811, 0xb58b, 0x1630, /* 1460 */ 
+   0x468e, 0x13d1, 0xb68c, 0x0404, 0xcfee, 0x9813, 0x0000, 0x0804, /* 1468 */ 
+   0xaf0e, 0x1bd2, 0x4f86, 0x9811, 0x0000, 0x0021, 0x6418, 0x1bd0, /* 1470 */ 
+   0x6848, 0x9807, 0xad46, 0x1bc6, 0x4280, 0x9805, 0x36f1, 0x0024, /* 1478 */ 
+   0x36f0, 0x9803, 0x3405, 0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, /* 1480 */ 
+   0x2000, 0x0000, 0x36f2, 0x9817, 0x0007, 0x0001, 0x8a19, 0x0006, /* 1488 */ 
+   0x0088, 0x3613, 0x0024, 0x3e12, 0xb817, 0x3e12, 0x3815, 0x3e05, /* 1490 */ 
+   0xb814, 0x3615, 0x0024, 0x0000, 0x800a, 0x3e10, 0x3801, 0x3e10, /* 1498 */ 
+   0xb803, 0x3e11, 0x3805, 0x3e14, 0x3811, 0x2802, 0x91c0, 0x3e04, /* 14a0 */ 
+   0xb813, 0x0006, 0x9f90, 0x0001, 0x0001, 0x3009, 0x0000, 0x6090, /* 14a8 */ 
+   0x0024, 0x6014, 0xa000, 0x0001, 0x0001, 0x2802, 0x8c11, 0x0000, /* 14b0 */ 
+   0x0024, 0x3009, 0x0000, 0x6012, 0x0024, 0x3009, 0x2001, 0x0006, /* 14b8 */ 
+   0x9f90, 0x0006, 0x9f51, 0x3009, 0x0000, 0x3009, 0x0401, 0x6014, /* 14c0 */ 
+   0x0024, 0x0000, 0x0024, 0x2902, 0x7645, 0x0002, 0x8c08, 0x0000, /* 14c8 */ 
+   0x0080, 0x0030, 0x0013, 0xb882, 0x130c, 0xf400, 0x4512, 0x3210, /* 14d0 */ 
+   0x910c, 0x32f0, 0xc024, 0x6dc2, 0x0024, 0x3a10, 0x0024, 0x3af0, /* 14d8 */ 
+   0x4024, 0x0000, 0x0201, 0x3300, 0x0024, 0xb010, 0x0024, 0x0000, /* 14e0 */ 
+   0x0024, 0x2802, 0x94d5, 0x0000, 0x0024, 0x6894, 0x130c, 0xb886, /* 14e8 */ 
+   0x1040, 0x3430, 0x4024, 0x6dca, 0x0024, 0x0000, 0x0024, 0x2802, /* 14f0 */ 
+   0x8951, 0xbcd2, 0x0024, 0x0000, 0x0201, 0x2802, 0x94c5, 0x0000, /* 14f8 */ 
+   0x0024, 0x2900, 0xb680, 0x3613, 0x0024, 0x36f4, 0x9813, 0x36f4, /* 1500 */ 
+   0x1811, 0x36f1, 0x1805, 0x36f0, 0x9803, 0x36f0, 0x1801, 0x3405, /* 1508 */ 
+   0x9014, 0x36f3, 0x0024, 0x36f2, 0x1815, 0x2000, 0x0000, 0x36f2, /* 1510 */ 
+   0x9817, 0x0007, 0x0001, 0x8a5d, 0x0006, 0x0018, 0x4080, 0x184c, /* 1518 */ 
+   0x3e13, 0x780f, 0x2802, 0x9945, 0x4090, 0xb80e, 0x2402, 0x98c0, /* 1520 */ 
+   0x3e04, 0x0440, 0x3810, 0x0440, 0x3604, 0x0024, 0x3009, 0x1bce, /* 1528 */ 
+   0x3603, 0x5bcf, 0x2000, 0x0000, 0x0000, 0x0024, 0x000a, 0x0001, /* 1530 */ 
+   0x0300 
+ }; 
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/baidu_rda58xx_base.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,38 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Implement MediaBase for Rda58xx
+
+#ifndef BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_RDA58XX_BAIDU_RDA58XX_BASE_H
+#define BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_RDA58XX_BAIDU_RDA58XX_BASE_H
+
+#include "baidu_media_base.h"
+
+namespace duer {
+
+class Rda58xxBase : public MediaBase {
+public:
+    Rda58xxBase(PinName tx, PinName rx, PinName hreset);
+
+protected:
+    virtual int on_start_play(MediaType type);
+
+    virtual int on_write(const void* data, size_t size);
+
+    virtual int on_voice(unsigned char vol);
+
+    virtual int on_pause_play();
+
+    virtual int on_stop_play();
+
+    virtual int on_start_record();
+
+    virtual size_t on_read(void* data, size_t size);
+
+    virtual int on_stop_record();
+
+};
+
+} // namespace duer
+
+#endif // BAIDU_EXTERNAL_TARGETS_EXT_TARGET_UNO_91H_RDA58XX_BAIDU_RDA58XX_BASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,167 @@
+/** file rda58xx.h
+ * Headers for interfacing with the codec chip.
+ */
+
+#ifndef RDA58XX_H
+#define RDA58XX_H
+
+#include "mbed.h"
+#include "rda58xx_int_types.h"
+// #include "rda58xx_dbg.h"
+
+typedef enum {
+    MCI_TYPE_NONE=-1,
+    MCI_TYPE_GSM_FR,              /* 0  */
+    MCI_TYPE_GSM_HR,              /* 1  */
+    MCI_TYPE_GSM_EFR,             /* 2  */
+    MCI_TYPE_AMR,                 /* 3  */
+    MCI_TYPE_AMR_WB,              /* 4  */
+    MCI_TYPE_DAF,                 /* 5  */
+    MCI_TYPE_AAC,                 /* 6  */
+    MCI_TYPE_PCM_8K,              /* 7  */
+    MCI_TYPE_PCM_16K,             /* 8  */
+    MCI_TYPE_G711_ALAW,           /* 9  */
+    MCI_TYPE_G711_ULAW,           /* 10 */
+    MCI_TYPE_DVI_ADPCM,           /* 11 */
+    MCI_TYPE_VR,                  /* 12 */
+    MCI_TYPE_WAV,                 /* 13 */
+    MCI_TYPE_WAV_ALAW,            /* 14 */
+    MCI_TYPE_WAV_ULAW,            /* 15 */
+    MCI_TYPE_WAV_DVI_ADPCM,       /* 16 */
+    MCI_TYPE_SMF,                 /* 17 */
+    MCI_TYPE_IMELODY,             /* 18 */
+    MCI_TYPE_SMF_SND,             /* 19 */
+    MCI_TYPE_MMF,                 /* 20 */
+    MCI_TYPE_AU,                  /* 21 */
+    MCI_TYPE_AIFF,                /* 22 */
+    MCI_TYPE_M4A,                 /* 23 */
+    MCI_TYPE_3GP,                 /* 24 */
+    MCI_TYPE_MP4,                 /* 25 */
+    MCI_TYPE_JPG,                 /* 26 */
+    MCI_TYPE_GIF,                 /* 27 */
+    MCI_TYPE_MJPG,                /* 28 */
+    MCI_TYPE_WMA,                 /* 29 */
+    MCI_TYPE_MIDI,                /* 30 */
+    MCI_TYPE_RM,                  /* 31 */
+    //MCI_TYPE_AVSTRM,              /* 32 */
+    MCI_TYPE_SBC,                 /* 32 */
+    MCI_TYPE_SCO,                 /* 33 */
+    MCI_TYPE_TONE,                /* 34 */
+    MCI_TYPE_USB,                 /* 35 */
+    MCI_TYPE_LINEIN,              /* 36 */
+    MCI_NO_OF_TYPE
+} mci_type_enum;
+
+typedef enum {
+    UNREADY = -1,
+    STOP = 0,
+    PLAY,
+    PAUSE,
+    RECORDING,
+    STOP_RECORDING,
+    MODE_SWITCHING
+} rda58xx_status;
+
+typedef enum {
+    EMPTY = 0,
+    FULL
+} rda58xx_buffer_status;
+
+typedef enum {
+    WITHOUT_ENDING = 0,
+    WITH_ENDING
+} rda58xx_stop_type;
+
+typedef enum {
+    NACK = 0, //No ACK
+    IACK,     //Invalid ACK
+    VACK      //Valid ACK
+} rda58xx_at_status;
+
+typedef enum {
+    FT_DISABLE = 0,
+    FT_ENABLE
+} rda58xx_ft_test;
+
+typedef enum {
+    UART_MODE = 0,
+    BT_MODE
+} rda58xx_mode;
+
+typedef struct {
+    uint8_t *buffer;
+    uint8_t bufferSize;
+    rda58xx_status status;
+    int value;
+} rda58xx_parameter;
+
+class rda58xx
+{
+public:
+    rda58xx(PinName TX, PinName RX, PinName HRESET);
+    ~rda58xx(void);
+    void hardReset(void);
+    rda58xx_at_status bufferReq(mci_type_enum ftype, uint16_t size, uint16_t threshold);
+    rda58xx_at_status stopPlay(void);
+    rda58xx_at_status stopPlay(rda58xx_stop_type stype);
+    rda58xx_at_status pause(void);
+    rda58xx_at_status resume(void);
+    rda58xx_at_status startRecord(mci_type_enum ftype, uint16_t size);
+    rda58xx_at_status stopRecord(void);
+    rda58xx_at_status setMicGain(uint8_t gain);
+    rda58xx_at_status volAdd(void);
+    rda58xx_at_status volSub(void);
+    rda58xx_at_status volSet(uint8_t vol);
+    rda58xx_at_status sendRawData(uint8_t *databuf, uint16_t n);
+    void setBaudrate(int32_t baud);
+    void setStatus(rda58xx_status status);
+    rda58xx_status getStatus(void);
+    void clearBufferStatus(void);
+    rda58xx_buffer_status getBufferStatus(void);
+    uint8_t *getBufferAddr(void);
+    void setBufferSize(uint32_t size);
+    uint32_t getBufferSize(void);
+    rda58xx_at_status factoryTest(rda58xx_ft_test mode);
+    rda58xx_at_status getCodecStatus(rda58xx_status *status);
+    rda58xx_at_status getChipVersion(char *version);
+    rda58xx_at_status getBtRssi(int8_t *RSSI);
+    rda58xx_at_status setMode(rda58xx_mode mode);
+    rda58xx_mode getMode(void);
+    rda58xx_at_status setBtBrMode(void);
+    rda58xx_at_status setBtLeMode(void);
+    rda58xx_at_status lesWifiScs(void);
+    rda58xx_at_status getApSsid(char *SSID);
+    rda58xx_at_status getApPwd(char *PWD);
+    bool isReady(void);
+    bool isPowerOn(void);
+    int32_t (*atHandler) (int32_t status);
+    int32_t setAtHandler(int32_t (*handler)(int32_t status));
+    void rx_handler(void);
+    void tx_handler(void);
+private:
+    RawSerial  _serial;
+    int32_t    _baud;
+    Semaphore  _rxsem;
+    Semaphore  _bufsem;
+    volatile bool _bufflag;
+    DigitalOut _HRESET;
+    volatile rda58xx_mode _mode;
+    volatile rda58xx_status _status;
+    volatile rda58xx_buffer_status _rx_buffer_status;
+    uint32_t _rx_buffer_size;
+    uint32_t _tx_buffer_size;
+    uint32_t _rx_idx;
+    uint32_t _tx_idx;
+    uint8_t *_rx_buffer;
+    uint8_t *_tx_buffer;
+    rda58xx_parameter _parameter;
+    volatile bool _with_parameter;
+    volatile rda58xx_at_status _at_status;
+    volatile bool _ready;
+    volatile bool _power_on;
+    uint32_t _ats;
+    uint32_t _atr;
+};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx_dbg.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,22 @@
+#ifndef RDA58XX_DBG_H
+#define RDA58XX_DBG_H
+
+enum {
+    D_ERROR_LEVEL = 0,
+    D_WARNING_LEVEL = 1,
+    D_NOTICE_LEVEL = 2,
+    D_INFO_LEVEL = 3,
+    D_DEBUG_LEVEL = 4,
+    D_TRACE_LEVEL = 5,
+};
+
+#define codec_dbg_level D_DEBUG_LEVEL
+
+#define CODEC_LOG(level, fmt, ...)  do {\
+        int dbg_level = D_##level##_LEVEL;\
+        if((dbg_level <= codec_dbg_level)){\
+            printf(fmt, ##__VA_ARGS__);\
+        }\
+    } while (0)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/external/targets_ext/TARGET_UNO_91H/rda58xx/rda58xx_int_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,14 @@
+#ifndef RDA58XX_INT_TYPES_H
+#define RDA58XX_INT_TYPES_H
+
+typedef unsigned char       uint8_t;
+typedef unsigned short      uint16_t;
+typedef unsigned int        uint32_t;
+typedef unsigned long long  uint64_t;
+typedef signed char         int8_t;
+typedef signed short        int16_t;
+typedef signed int          int32_t;
+typedef signed long long    int64_t;
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/mbed_config.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,25 @@
+// Automatically generated configuration file.
+// DO NOT EDIT, content will be overwritten.
+
+#ifndef __MBED_CONFIG_DATA__
+#define __MBED_CONFIG_DATA__
+
+// Configuration parameters
+#define MBED_CONF_LWIP_TCP_SERVER_MAX                        4      // set by library:lwip
+#define MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE 6144   // set by library:nanostack-hal
+#define MBED_CONF_LWIP_UDP_SOCKET_MAX                        4      // set by library:lwip
+#define MBED_CONF_CORE_STDIO_BAUD_RATE                       921600 // set by library:core[UNO_91H]
+#define MBED_CONF_NSAPI_PRESENT                              1      // set by library:nsapi
+#define MBED_CONF_LWIP_ADDR_TIMEOUT                          5      // set by library:lwip
+#define MBED_CONF_LWIP_IP_VER_PREF                           4      // set by library:lwip
+#define MBED_CONF_LWIP_IPV4_ENABLED                          1      // set by library:lwip
+#define MBED_CONF_LWIP_TCP_SOCKET_MAX                        4      // set by library:lwip
+#define MBED_CONF_RTOS_PRESENT                               1      // set by library:rtos
+#define MBED_CONF_CORE_STDIO_CONVERT_NEWLINES                1      // set by library:core[UNO_91H]
+#define MBED_CONF_LWIP_SOCKET_MAX                            4      // set by library:lwip
+#define MBED_CONF_LWIP_IPV6_ENABLED                          0      // set by library:lwip
+#define MBED_CONF_NANOSTACK_HAL_NVM_CFSTORE                  0      // set by library:nanostack-hal
+// Macros
+#define UNITY_INCLUDE_CONFIG_H                                      // defined by library:utest
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/mbed_lib.json	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,10 @@
+{
+    "name": "dueros",
+    "macros": ["SPEEX_SAMPLE_RATE=16000"],
+    "target_overrides": {
+        "*": {
+            "target.macros_add": ["Z_SOLO", "MBEDTLS_CONFIG_FILE=\"baidu_ca_mbedtls_config.h\"", "MBED_CONF_MBED_CLIENT_SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE=1024", "MBED_CLIENT_C_VERSION=20900"],
+            "target.features_add": ["LWIP", "COMMON_PAL"]
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/baidu-speedx/baidu_speex.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,38 @@
+#ifndef BAIDU_SPEEX_H
+#define BAIDU_SPEEX_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+TYPE:
+typedef void (*bdspx_output_hdlr_t)(char *p_spx_buf, int n_bytes, int b_flush)
+
+DESC:
+callback to output speex data 
+
+PARAM:
+@param[in] p_spx_buf: speex buffer to output
+@param[in] n_bytes: speex buffer length 
+@param[in] b_flush: to flush all speex data to output
+*/
+typedef void (*bdspx_output_hdlr_t)(void *ctx, char *p_spx_buf, int n_bytes, int b_flush);
+
+int bdspx_speex_init(int n_sample_rate, void **buf);
+int bdspx_speex_encode(char *p_pcm_buff, int *p_len, int n_end, bdspx_output_hdlr_t output_hdlr, void *ctx, void *buf);
+void bdspx_speex_destroy(void *buf);
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/heap-monitor/heap_monitor.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,50 @@
+#ifndef _HEAP_MONITOR_H_
+#define _HEAP_MONITOR_H_
+
+#ifdef HEAP_MONITOR
+#define MALLOC(size, module) malloc_t(size, module)
+#define REALLOC(ptr, size, module) realloc_t(ptr, size, module)
+#define CALLOC(nmemb, size, module) calloc_t(nmemb, size, module)
+#define FREE(ptr) free_t(ptr)
+#define NEW(module) new (module)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum module {
+	OS          = 0,
+	APP         = 1,
+	OTA         = 2,
+	CA          = 3,
+	HTTP        = 4,
+	MEDIA       = 5,
+	RECORDER    = 6,
+    SPEEX_LIB   = 7,
+	MAX_MODULE  = 8,
+};
+
+extern void init_heap_info(void);
+extern void show_heap_info(void);
+extern void *malloc_t(size_t size, enum module module);
+extern void *calloc_t(size_t nmemb, size_t size, enum module module);
+extern void *realloc_t(void *ptr, size_t size, enum module module);
+extern void free_t(void *ptr);
+
+#ifdef __cplusplus
+}
+
+void * operator new(std::size_t size, int module);
+void * operator new[](std::size_t size, int module);
+
+#endif
+
+#else
+#define MALLOC(size, module) malloc(size)
+#define REALLOC(ptr, size, module) realloc(ptr, size)
+#define CALLOC(nmemb, size, module) calloc(nmemb, size)
+#define FREE(ptr) free(ptr)
+#define NEW(module) new
+#endif  // HEAP_MONITOR
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_http_client.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,50 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Pan Haijun, Gang Chen(chengang12@baidu.com)
+//
+// This header file define the HttpClient class, it's used to establish http connection.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
+
+#include "baidu_http_client_c.h"
+
+namespace duer {
+
+class HttpClient {
+public:
+    HttpClient();
+    ~HttpClient();
+    /*
+     *  register data output handler callback to handle data block
+     *  @param[in] data output handler callback to be registered
+     *  @param[in] p_usr_ctx for data output handler callback to be registered
+     *  @return   none
+     */
+    void register_data_handler(data_out_handler_cb data_hdlr_cb, void* p_usr_ctx);
+    /*
+     *  register callback for stop notify & reset stop notify
+     *  @param[in] chk_stp_cb: to notify httpclient to stop
+     *  @param[in] rst_stp_cb: to reset stop notify flag
+     *  @return   none
+     */
+    void register_notify_call_back(check_stop_notify_cb_t chk_stp_cb,
+                                   reset_stop_notify_cb_t rst_stp_cb);
+    /*
+     *  create http connection and get data by the url
+     *  @param[in] url: to get http client_c's url
+     *  @return   e_http_result
+     */
+    e_http_result get(const char* url);
+    /*
+     *  register callback to get url which is used by http to get data
+     *  @param[in] the callback to be registered
+     *  @return   none
+     */
+    void register_call_back_to_get_url(get_url_cb_t cb);
+private:
+    http_client_c* _p_client_inst;
+};
+
+}//duer
+#endif//BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_http_client_c.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,166 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Pan Haijun, Gang Chen(chengang12@baidu.com)
+//
+// This header file provide http client related data structures and APIs.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_C_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_C_H
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+//http client results
+typedef enum http_result {
+    HTTP_OK = 0,        // Success
+    HTTP_PROCESSING,    // Processing
+    HTTP_PARSE,         // url Parse error
+    HTTP_DNS,           // Could not resolve name
+    HTTP_PRTCL,         // Protocol error
+    HTTP_NOTFOUND,      // HTTP 404 Error
+    HTTP_REFUSED,       // HTTP 403 Error
+    HTTP_ERROR,         // HTTP xxx error
+    HTTP_TIMEOUT,       // Connection timeout
+    HTTP_CONN,          // Connection error
+    HTTP_CLOSED,        // Connection was closed by remote host
+    HTTP_NOT_SUPPORT,   // not supported feature
+    HTTP_REDIRECTTION,  //take a redirection when http header contains 'Location'
+    HTTP_FAILED = -1,
+} e_http_result;
+
+typedef enum http_meth {
+    HTTP_GET,
+    HTTP_POST,
+    HTTP_PUT,
+    HTTP_DELETE,
+    HTTP_HEAD
+} e_http_meth;
+
+typedef struct http_client_socket_ops {
+    int  n_handle;
+    int  (*init)(void* socket_args);
+    int  (*open)(int socket_handle);
+    int  (*connect)(int socket_handle, const char* host, const int port);
+    void (*set_blocking)(int socket_handle, int blocking);
+    void (*set_timeout)(int socket_handle, int timeout);
+    int  (*recv)(int socket_handle, void* data, unsigned size);
+    int  (*send)(int socket_handle, const void* data, unsigned size);
+    int  (*close)(int socket_handle);
+    void (*destroy)(int socket_handle);
+} socket_ops;
+
+//to tell data output callback user that if the current data block is first block or last block
+typedef enum data_pos {
+    DATA_FIRST  = 0x1,
+    DATA_MID    = 0x2,
+    DATA_LAST   = 0x4
+} e_data_pos;
+
+/**
+ *
+ * DESC:
+ * the callback to handler the media data download by http
+ *
+ * PARAM:
+ * @param[in] p_user_ctx: usr ctx registed by user
+ * @param[in] pos:  to identify if it is data stream's start, or middle , or end of data stream
+ * @param[in] buf:   buffer stored media data
+ * @param[in] len:   data length in 'buf'
+ * @param[in] type: data type to identify media or others
+ *
+ * @RETURN: negative number when failed
+ */
+typedef int (*data_out_handler_cb)(void* p_user_ctx, e_data_pos pos,
+                                   const char* buf, size_t len, const char* type);
+/**
+ * DESC:
+ * callback to check whether need to stop getting data
+ *
+ * PARAM: none
+ *
+ * @RETURN
+ * 1: to stop; 0: no stop
+ */
+typedef int (*check_stop_notify_cb_t)();
+
+/**
+ * DESC:
+ * callback to reset MDM stop flag
+ *
+ * PARAM: none
+ * RETURN: none
+ */
+typedef void (*reset_stop_notify_cb_t)();
+/**
+ * DESC:
+ * sometimes other module need to know which url is used to download data.
+ * this callback is used to get the url
+ *
+ * PARAM:
+ * @param[in] url: the url used by http to download data
+ *
+ * RETURN: none
+ */
+typedef void (*get_url_cb_t)(const char *url);
+
+#define HC_CONTENT_TYPE_LEN_MAX 32 // the max length of "content type" section
+
+typedef struct http_client_c {
+    const char**           pps_custom_headers;
+    size_t                 sz_headers_count;
+    int                    n_http_response_code; // http response code
+    socket_ops             ops;                  // socket operations
+    data_out_handler_cb    data_hdlr_cb;         // callback for output data
+    void*                  p_data_hdlr_ctx;      // users args for data_hdlr_cb
+    int                    n_http_content_len;   // http content length
+    char                   p_http_content_type[HC_CONTENT_TYPE_LEN_MAX]; // http content type
+    char*                  p_location;           // http header "Location"
+    //a callback to check that stopping http client getting data or not
+    check_stop_notify_cb_t check_stop_notify_cb;
+    reset_stop_notify_cb_t reset_stop_notify_cb; // reset stop notify flag
+    get_url_cb_t           get_url_cb;           // get the url which is used by http to get data
+    int                    n_is_chunked;
+    size_t                 sz_chunk_size;
+    char*                  p_chunk_buf;
+} http_client_c;
+
+typedef struct _http_client_statistic_s {
+    size_t download_data_size;
+    size_t upload_data_size;
+    int    error_count;
+    int    last_error_code;
+    size_t recv_packet_longest_time;
+} http_client_statistic_t;
+
+int http_client_init(http_client_c* p_client);
+void http_client_destroy(http_client_c* p_client);
+int http_client_init_socket_ops(http_client_c* p_client, socket_ops* p_ops, void* socket_args);
+void http_client_reg_data_hdlr_cb(http_client_c* p_client, data_out_handler_cb data_hdlr_cb,
+                                  void* p_usr_ctx);
+void http_client_reg_cb_to_get_url(http_client_c* p_client, get_url_cb_t cb);
+void http_client_set_cust_headers(http_client_c* p_client, const char** headers, size_t pairs);
+e_http_result http_client_get(http_client_c* p_client, const char* url);
+int http_client_get_resp_code(http_client_c* p_client);
+void http_client_reg_stop_notify_cb(http_client_c* p_client, check_stop_notify_cb_t chk_stp_cb,
+                                    reset_stop_notify_cb_t rst_stp_cb);
+/**
+ * FUNC:
+ * int get_http_statistic(http_client_c *p_client, socket_ops *p_ops, void *socket_args)
+ *
+ * DESC:
+ * used to get statistic info of http module
+ *
+ * PARAM:
+ * @param[out] statistic_result: buffer to accept the statistic info
+ *
+ */
+void get_http_statistic(http_client_statistic_t* statistic_result);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_HTTP_CLIENT_C_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/http-client/baidu_mbed_soc_wrapper.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,27 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Pan Haijun, Gang Chen(chengang12@baidu.com)
+//
+// This header file provide the wrapper of the socket APIs for http module.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_MBED_SOC_WRAPPER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_MBED_SOC_WRAPPER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+int mbed_socket_init(void* socket_args);
+int mbed_socket_open(int socket_handle);
+int mbed_socket_connect(int socket_handle, const char* host, const int port);
+void mbed_socket_set_blocking(int socket_handle, int blocking);
+void mbed_socket_set_timeout(int socket_handle, int timeout);
+int mbed_socket_recv(int socket_handle, void* data, unsigned size);
+int mbed_socket_send(int socket_handle, const void* data, unsigned size);
+int mbed_socket_close(int socket_handle);
+void mbed_socket_destroy(int socket_handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif//BAIDU_IOT_TINYDU_IOT_OS_SRC_HTTP_CLIENT_BAIDU_MBED_SOC_WRAPPER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_adapter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,23 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: ca adapter initialize function
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_ADAPTER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_ADAPTER_H
+
+#include "baidu_ca.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void baidu_ca_initialize();
+
+int baidu_ca_is_initialized();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_ADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_memory_adapter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,25 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: memory function adapter
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_MEMORY_ADAPTER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_MEMORY_ADAPTER_H
+
+#include "baidu_ca.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* bca_memory_alloc(bca_context ctx, bca_size_t size);
+
+void* bca_memory_realloc(bca_context ctx, void* ptr, bca_size_t size);
+
+void bca_memory_free(bca_context ctx, void* ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_MEMORY_ADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_network_adapter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,37 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: socket function adapter
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_ADAPTER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_ADAPTER_H
+
+#include "baidu_ca.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+bca_socket_t bca_soc_create(bca_context ctx);
+
+bca_status_t bca_soc_connect(bca_socket_t ctx, const bca_addr_t* addr);
+
+bca_status_t bca_soc_send(bca_socket_t ctx,
+                          const void* data,
+                          bca_size_t size,
+                          const bca_addr_t* addr);
+
+bca_status_t bca_soc_recv(bca_socket_t ctx,
+                          void* data,
+                          bca_size_t size,
+                          bca_addr_t* addr);
+
+bca_status_t bca_soc_close(bca_socket_t ctx);
+
+bca_status_t bca_soc_destroy(bca_socket_t ctx);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_ADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-adapter/baidu_ca_network_socket.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,57 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: SocketAdapter
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_SOCKET_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_SOCKET_H
+
+#include "mbed.h"
+#include "baidu_ca.h"
+
+namespace duer {
+
+class SocketAdapter {
+public:
+
+    typedef mbed::Callback<void (const bca_addr_t*)> Callback;
+
+    SocketAdapter();
+
+    virtual ~SocketAdapter();
+
+    int connect(const bca_addr_t* addr);
+
+    int send(const void* data, size_t size);
+
+    int recv(void* data, size_t size);
+
+    int close();
+
+    void attach(Callback callback);
+
+    template <typename T, typename M>
+    void attach(T* obj, M method) {
+        attach(Callback(obj, method));
+    }
+
+    static void set_network_interface(NetworkInterface* ifc);
+
+    static NetworkInterface* get_network_interface();
+
+    // the unit of speed is k/s
+    static void bca_coap_get_statistic(float* upload_speed, float* download_speed);
+private:
+
+    void on_read();
+
+    Socket*    _socket;
+    bca_addr_t _addr;
+    Callback   _callback;
+
+    static NetworkInterface* _s_interface;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_ADAPTER_BAIDU_CA_NETWORK_SOCKET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_configuration.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,32 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Configuration
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_CONFIGURATION_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_CONFIGURATION_H
+
+#include "baidu_ca_types.h"
+
+namespace duer {
+
+class Configuration {
+public:
+
+    Configuration();
+
+    virtual ~Configuration();
+
+    virtual const void* get_data() const;
+
+    virtual bca_size_t get_size() const;
+
+private:
+
+    const void*     _data;
+    bca_size_t      _size;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_CONFIGURATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_handler.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,50 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Handler
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_HANDLER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_HANDLER_H
+
+#include "rtos.h"
+#include "baidu_ca_message.h"
+
+namespace duer {
+
+class Handler {
+public:
+    class OnMessageListener {
+    public:
+
+        virtual bool on_message(Message& message) = 0;
+
+        virtual ~OnMessageListener() {}
+
+    };
+
+    Handler();
+
+    virtual ~Handler();
+
+    void send_message(int what, void* object);
+
+    void send_message(const Message& message);
+
+    void set_on_message_listener(OnMessageListener* listener);
+
+protected:
+
+    virtual void handle_message(Message& message);
+
+private:
+
+    void loop();
+
+    rtos::Thread                _thread;
+    rtos::Queue<Message, 20>    _queue;
+    OnMessageListener*          _listener;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_HANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_message.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,29 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Message
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_MESSAGE_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_MESSAGE_H
+
+#include <cstddef>
+
+namespace duer {
+
+class Message {
+public:
+    Message(int what, void* object);
+
+    Message(const Message& message);
+
+    int get_what() const;
+
+    void* get_object() const;
+private:
+    int     _what;
+    void*   _object;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_MESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_object.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Object
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_OBJECT_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_OBJECT_H
+
+#include <stddef.h>
+
+struct baidu_json;
+
+namespace duer {
+
+class Object {
+public:
+
+    Object();
+
+    ~Object();
+
+    void reset();
+
+    void putInt(const char* key, int value);
+
+    void putDouble(const char* key, double value);
+
+    void putString(const char* key, const char* value);
+
+    // Note: the life time of value should be longer or equal this
+    void putObject(const char* key, const Object& value);
+
+    void putIntArray(const char* key, int value[], size_t length);
+
+    void putDoubleArray(const char* key, double value[], size_t length);
+
+    void putStringArray(const char* key, const char* value[], size_t length);
+
+    void putObjectArray(const char* key, Object value[], size_t length);
+
+    // the owner of object will be transfered to this.
+    // there should no other Object control the life of object
+    void receiveObject(const char* key, baidu_json* object);
+
+    // give up the ownership of _data, and reset _data to a new one
+    baidu_json* releaseObject();
+
+    const char* toString();
+
+private:
+
+    Object(const Object& other);
+
+    Object& operator =(const Object& other);
+
+    baidu_json*     _data;
+    char*           _string;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_OBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_ca_scheduler.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,176 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Scheduler
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_SCHEDULER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_SCHEDULER_H
+
+#include "rtos.h"
+#include "baidu_ca.h"
+#include "baidu_ca_handler.h"
+#include "baidu_ca_network_socket.h"
+#include "baidu_util_list.h"
+#include "baidu_ca_object.h"
+
+namespace duer {
+
+class Scheduler : public Handler::OnMessageListener {
+public:
+
+    /**
+     * @brief Scheduler 的事件回调接口
+     */
+    class IOnEvent {
+    public:
+        /**
+         * @brief Scheduler 在启动时的回调函数接口
+         */
+        virtual int on_start() = 0;
+        /**
+         * @brief Scheduler 在停止时的回调函数接口
+         */
+        virtual int on_stop() = 0;
+        /**
+         * @brief Scheduler 在有数据通信时的回调函数接口
+         */
+        virtual int on_action(const char* action) = 0;
+
+    };
+    /**
+     * @brief 获取 Scheduler 的唯一单例引用
+     */
+    static Scheduler& instance();
+    /**
+     * @brief 注册 Scheduler 的事件回调接口
+     * @param[in] listener 事件回调接口
+     * @return 0
+     */
+    int set_on_event_listener(IOnEvent* listener);
+    /**
+     * @brief 添加控制点
+     * @param[in] list_res 待注册的控制点数组
+     * @param[in] list_res_size 控制点数组长度
+     * @return 0
+     */
+    int add_controll_points(const bca_res_t list_res[], bca_size_t list_res_size);
+    /**
+     * @brief 启动 Scheduler
+     * @return 0
+     */
+    int start();
+    /**
+     * @brief 停止 Scheduler
+     * @return 0
+     */
+    int stop();
+    /**
+     * @brief 上报数据 json格式
+     * @param[in] data 具体的数据内容
+     * @return 0
+     */
+    int report(const Object& data);
+    /**
+     * @brief 上报数据 json格式
+     * @param[in] data 数据内容
+     * @param[in] size 数据长度
+     * @return 0
+     */
+    int report(const void* data, size_t size);
+    /**
+     * @brief 回复对端的请求
+     * @param[in] req 请求
+     * @param[in] msg_code 回复的code
+     * @param[in] payload 回复的内容
+     * @return 0
+     */
+    int response(const bca_msg_t* req, int msg_code, const char* payload);
+    /**
+     * @brief 上报语音数据
+     * @param[in] data 语音数据
+     * @param[in] size 语音数据长度
+     * @param[in] eof  是否最后一个数据包
+     * @return 0
+     */
+    int send_content(const void* data, size_t size, bool eof);
+    /**
+     * @brief 清除待处理传输数据
+     * @return 0
+     */
+    int clear_content();
+    /**
+     * @brief handler回调接口
+     * @param[in] message 需要处理的消息
+     * @return true
+     */
+    virtual bool on_message(Message& message);
+
+private:
+
+    Scheduler();
+
+    virtual ~Scheduler();
+
+    void data_available(const bca_addr_t* addr);
+
+    int start_handle();
+
+    int stop_handle();
+
+    int report_handle(Message& message);
+
+    int data_available_handle(Message& message);
+
+    void keep_alive_handle();
+
+    void timer_callback();
+
+    int report_list_clear();
+
+    int on_start(int status);
+
+    int on_stop();
+
+    int on_action(const char* action);
+
+    static bca_status_t play_uri(bca_context ctx, bca_msg_t* msg, bca_addr_t* addr);
+
+    static bca_status_t update_package(bca_context ctx,
+                                       bca_msg_t* msg,
+                                       bca_addr_t* addr);
+
+    static bca_status_t output_result(bca_context ctx,
+                                      bca_msg_t* msg,
+                                      bca_addr_t* addr);
+
+    IOnEvent*           _on_event_listener;
+
+    Handler             _event_handler;
+
+    bca_handler         _handler;
+
+    int                 _state;
+
+    rtos::Mutex         _mutex;
+
+    rtos::RtosTimer     _timer;
+
+    unsigned int        _start_timeout;
+
+    duer::SocketAdapter::Callback  _on_read_callback;
+
+    bu_list_t           _send_list;
+
+    mbed::Timer         _stop_timer;
+
+    unsigned int        _stop_timeout;
+
+    int                 _topic_id;
+    bool                _enable_ota;
+
+    static Scheduler    _s_scheduler;
+};
+
+} // namespace duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_CA_SCHEDULER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca-scheduler/baidu_util_list.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,39 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: baidu_util_list
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_UTIL_LIST_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_UTIL_LIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void* bu_list_t;
+
+typedef enum {
+    BU_NO_ERR,
+    BU_ERR_UNEXPECTED = -10000,
+    BU_ERR_INVALID_PARAMETER,
+    BU_ERR_MEMORY_OVERLOW,
+    BU_ERR_NODE_EXISTS,
+} bu_errors_t;
+
+bu_list_t baidu_util_list_create(void);
+
+int baidu_util_list_append(bu_list_t list, void* data);
+
+int baidu_util_list_is_empty(bu_list_t list);
+
+void* baidu_util_list_get(bu_list_t list, int index);
+
+void* baidu_util_list_remove(bu_list_t list, int index);
+
+int baidu_util_list_destroy(bu_list_t list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SCHEDULER_BAIDU_UTIL_LIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,416 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Desc: Provide the API for external applications.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_H
+
+#include "baidu_ca_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The message codes.
+ */
+typedef enum {
+
+    // Request message code
+    BCA_MSG_REQ_GET                             = 1,
+    BCA_MSG_REQ_POST                            = 2,
+    BCA_MSG_REQ_PUT                             = 3,
+    BCA_MSG_REQ_DELETE                          = 4,
+
+    // Response message code
+    BCA_MSG_RSP_CREATED                         = 65,   // 2.01
+    BCA_MSG_RSP_DELETED                         = 66,   // 2.02
+    BCA_MSG_RSP_VALID                           = 67,   // 2.03
+    BCA_MSG_RSP_CHANGED                         = 68,   // 2.04
+    BCA_MSG_RSP_CONTENT                         = 69,   // 2.05
+    BCA_MSG_RSP_CONTINUE                        = 95,   // 2.31
+    BCA_MSG_RSP_BAD_REQUEST                     = 128,  // 4.00
+    BCA_MSG_RSP_UNAUTHORIZED                    = 129,  // 4.01
+    BCA_MSG_RSP_BAD_OPTION                      = 130,  // 4.02
+    BCA_MSG_RSP_FORBIDDEN                       = 131,  // 4.03
+    BCA_MSG_RSP_NOT_FOUND                       = 132,  // 4.04
+    BCA_MSG_RSP_METHOD_NOT_ALLOWED              = 133,  // 4.05
+    BCA_MSG_RSP_NOT_ACCEPTABLE                  = 134,  // 4.06
+    BCA_MSG_RSP_REQUEST_ENTITY_INCOMPLETE       = 136,  // 4.08
+    BCA_MSG_RSP_PRECONDITION_FAILED             = 140,  // 4.12
+    BCA_MSG_RSP_REQUEST_ENTITY_TOO_LARGE        = 141,  // 4.13
+    BCA_MSG_RSP_UNSUPPORTED_CONTENT_FORMAT      = 143,  // 4.15
+    BCA_MSG_RSP_INTERNAL_SERVER_ERROR           = 160,  // 5.00
+    BCA_MSG_RSP_NOT_IMPLEMENTED                 = 161,  // 5.01
+    BCA_MSG_RSP_BAD_GATEWAY                     = 162,  // 5.02
+    BCA_MSG_RSP_SERVICE_UNAVAILABLE             = 163,  // 5.03
+    BCA_MSG_RSP_GATEWAY_TIMEOUT                 = 164,  // 5.04
+    BCA_MSG_RSP_PROXYING_NOT_SUPPORTED          = 165,  // 5.05
+
+} bca_msg_code_e;
+
+/**
+ * CoAP Message type, used in CoAP Header
+ */
+typedef enum {
+    BCA_MSG_TYPE_CONFIRMABLE       = 0x00, // Reliable Request messages
+    BCA_MSG_TYPE_NON_CONFIRMABLE   = 0x10, // Non-reliable Request and Response messages
+    BCA_MSG_TYPE_ACKNOWLEDGEMENT   = 0x20, // Response to a Confirmable Request
+    BCA_MSG_TYPE_RESET             = 0x30  // Answer a Bad Request
+} bca_msg_type_e;
+
+/*
+ * The resource operation permission
+ */
+typedef enum {
+    BCA_RES_OP_GET      = 0x01,     // Get operation allowed
+    BCA_RES_OP_PUT      = 0x02,     // Put operation allowed
+    BCA_RES_OP_POST     = 0x04,     // Post operation allowed
+    BCA_RES_OP_DELETE   = 0x08      // Delete operation allowed
+} bca_resource_operation_e;
+
+/*
+ * The resource mode
+ */
+typedef enum {
+    BCA_RES_MODE_STATIC,            // Static resources have some value that doesn't change
+    BCA_RES_MODE_DYNAMIC,           // Dynamic resources are handled in application
+} bca_resource_mode_e;
+
+enum _baidu_ca_protocol_enum {
+    BCA_PROTO_TCP,
+    BCA_PROTO_UDP
+};
+
+/*
+ * The message definition
+ */
+typedef struct _bca_message_s {
+    bca_u16_t token_len;
+
+    bca_u8_t  msg_type;
+    bca_u8_t  msg_code;
+    bca_u16_t msg_id;
+
+    bca_u16_t path_len;
+    bca_u16_t query_len;
+    bca_u16_t payload_len;
+
+    bca_u8_t* token;
+    bca_u8_t* path;
+    bca_u8_t* query;
+    bca_u8_t* payload;
+} bca_msg_t;
+
+/*
+ * Adapt the memory management functions.
+ */
+typedef void* (*bca_malloc_f)(bca_context context, bca_size_t size);
+
+typedef void* (*bca_realloc_f)(bca_context context, void*, bca_size_t size);
+
+typedef void (*bca_free_f)(bca_context context, void* p);
+
+/*
+ * The network address structure
+ */
+typedef struct _bca_address_s {
+    bca_u8_t    type;       // the socket type
+    bca_u16_t   port;       // the host port
+    void*       host;       // the host address
+    bca_size_t  host_size;  // the host address length
+} bca_addr_t;
+
+/*
+ * The network transfer data callbacks.
+ * See the detail in @{link baidu_ca_transport_init}
+ */
+typedef void* bca_socket_t;
+
+typedef bca_socket_t (*bca_soc_create_f)(bca_context ctx);
+
+typedef bca_status_t (*bca_soc_connect_f)(bca_socket_t sock,
+                                          const bca_addr_t* addr);
+
+typedef bca_status_t (*bca_soc_send_f)(bca_socket_t sock,
+                                       const void* data,
+                                       bca_size_t size,
+                                       const bca_addr_t* addr);
+
+typedef bca_status_t (*bca_soc_recv_f)(bca_socket_t sock,
+                                       void* data,
+                                       bca_size_t size,
+                                       bca_addr_t* addr);
+
+typedef bca_status_t (*bca_soc_recv_timeout_f)(bca_socket_t sock,
+                                               void* data,
+                                               bca_size_t size,
+                                               bca_u32_t timeout,
+                                               bca_addr_t* addr);
+
+typedef bca_status_t (*bca_soc_close_f)(bca_socket_t sock);
+
+typedef bca_status_t (*bca_soc_destroy_f)(bca_socket_t sock);
+
+/*
+ * The mutex callbacks
+ */
+
+typedef void* bca_mutex_t;
+typedef bca_mutex_t (*bca_mutex_create_f)();
+typedef bca_status_t (*bca_mutex_lock_f)(bca_mutex_t mtx);
+typedef bca_status_t (*bca_mutex_unlock_f)(bca_mutex_t mtx);
+typedef bca_status_t (*bca_mutex_destroy_f)(bca_mutex_t mtx);
+
+/*
+ * The timestamp callbacks
+ */
+
+// Return the timestamp by milliseconds
+typedef bca_u32_t (*bca_timestamp_f)();
+
+/*
+ * The random callbacks
+ */
+
+// Return the random number
+typedef bca_s32_t (*bca_random_f)();
+
+/*
+ * The handler
+ */
+typedef void* bca_handler;
+
+/*
+ * The status notification to user.
+ */
+
+typedef bca_status_t (*bca_notify_f)(bca_context ctx,
+                                     bca_msg_t* msg,
+                                     bca_addr_t* addr);
+
+/*
+ * The debug output
+ */
+typedef void (*bca_debug_f)(bca_context ctx,
+                            bca_u32_t level,
+                            const char* file,
+                            bca_u32_t line,
+                            const char* fmt);
+
+/*
+ * The resource for user
+ */
+typedef struct _bca_resource_s {
+    bca_u8_t    mode: 2;    // the resource mode, SEE in ${link bca_resource_mode_e}
+    bca_u8_t    allowed: 6; // operation permission, SEE in ${link bca_resource_operation_e}
+    char*       path;       // the resource path identify
+
+    union {
+        bca_notify_f   f_res;   // dynamic resource handle function, NULL if static
+        struct {
+            void*       data;   // static resource value data, NULL if dynamic
+            bca_size_t  size;   // static resource size
+        } s_res;
+    } res;
+} bca_res_t;
+
+/*
+ * Set the debug output
+ *
+ * @Param ctx, bca_context, the debug context for user
+ * @Param f_debug, bca_debug_f, the debug output function
+ */
+BCA_EXT void baidu_ca_debug_init(bca_context ctx, bca_debug_f f_debug);
+
+/*
+ * Set the memory management functions.
+ *
+ * @Param ctx, bca_context, in, the memory context for user
+ * @Param f_malloc, bca_malloc_f, the memory alloc function for user
+ * @Param f_realloc, bca_realloc_f, the memory realloc function for user,
+ * @Param f_free, bca_free_f, the memory free function for user
+ *
+ * If f_malloc or f_free set to NULL, we will use default libc instead all of it;
+ * If only f_realloc set to NULL, we will realized it by f_malloc and f_free.
+ */
+BCA_EXT void baidu_ca_memory_init(bca_context context,
+                                  bca_malloc_f f_malloc,
+                                  bca_realloc_f f_realloc,
+                                  bca_free_f f_free);
+
+/*
+ * Set network input/ouput function
+ *
+ * @Param f_create, in, the function create socket context
+ * @Param f_conn, in, the function connect socket to host
+ * @Param f_send, in, the function send message
+ * @Param f_recv, in, the function receive message
+ * @Param f_recv_timeout, in, the function receive message with timeout
+ * @Param f_close, in, the function close the socket
+ * @Param f_destroy, in, the function destroy the socket context
+ */
+BCA_EXT void baidu_ca_transport_init(bca_soc_create_f f_create,
+                                     bca_soc_connect_f f_conn,
+                                     bca_soc_send_f f_send,
+                                     bca_soc_recv_f f_recv,
+                                     bca_soc_recv_timeout_f f_recv_timeout,
+                                     bca_soc_close_f f_close,
+                                     bca_soc_destroy_f f_destroy);
+
+/*
+ * Initial the mutex callbacks for Baidu CA
+ *
+ * @Param f_create, in, the function create mutex context
+ * @Param f_lock, in, the function mutex lock
+ * @Param f_unlock, in, the function mutex unlock
+ * @Param f_destroy, in, the function destroy mutex context
+ */
+BCA_EXT void baidu_ca_mutex_init(bca_mutex_create_f f_create,
+                                 bca_mutex_lock_f f_lock,
+                                 bca_mutex_unlock_f f_unlock,
+                                 bca_mutex_destroy_f f_destroy);
+
+/*
+ * Initial the timestamp callbacks for Baidu CA
+ *
+ * @Param f_timestamp, in, the function obtain the timestamp
+ */
+BCA_EXT void baidu_ca_timestamp_init(bca_timestamp_f f_timestamp);
+
+/*
+ * Initial the random callbacks for Baidu CA
+ *
+ * @Param bca_random_f, in, the function random generator function
+ */
+BCA_EXT void baidu_ca_random_init(bca_random_f f_random);
+
+/*
+ * Acquire the handler
+ *
+ * @Param data, in, the configuration data
+ * @Param size, in, the data size
+ * @Param soc_ctx, in socket context
+ * @Return bca_handler, the global context handler
+ */
+BCA_EXT bca_handler baidu_ca_acquire(const void* data,
+                                     bca_size_t size,
+                                     bca_context soc_ctx);
+
+/*
+ * Acquire the resources for response
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param list_res, in, resource list
+ * @Param list_res_size, in resource list length
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_add_resources(bca_handler hdlr,
+                                            const bca_res_t list_res[],
+                                            bca_size_t list_res_size);
+
+/*
+ * Start run the Baidu CA, prepare the environment.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_start(bca_handler hdlr);
+
+/*
+ * Set the Reporter report response callback.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param f_response, in, the callback for notify user the report data response
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_report_set_response_callback(bca_handler hdlr,
+                                                           bca_notify_f f_response,
+                                                           bca_context context);
+
+/*
+ * Build the message body that will be reported.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param data, in, the message report data
+ * @Param size, in, the data size
+ * @Param confirmable, in, the report data QoS
+ * @Return bca_msg_t *, in, the generated message body,
+ *         it SHOULD be released by ${link baidu_ca_release_message}
+ */
+BCA_EXT bca_msg_t* baidu_ca_build_report_message(bca_handler hdlr,
+                                                 bca_bool confirmable);
+
+/*
+ * Build the message body that will be responsed to remote.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param msg, in, the message that remote requested
+ * @Param msg_code, out, the response message code
+ * @Return bca_msg_t *, in, the generated message body,
+ *         it SHOULD be released by ${link baidu_ca_release_message}
+ */
+BCA_EXT bca_msg_t* baidu_ca_build_response_message(bca_handler hdlr,
+                                                   const bca_msg_t* msg,
+                                                   bca_u8_t msg_code);
+
+/*
+ * Release the message that generated by baidu_ca_build_XXXX_message.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param msg, in, the message that remote requested
+ */
+BCA_EXT void baidu_ca_release_message(bca_handler hdlr, bca_msg_t* msg);
+
+/*
+ * Send the message
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param msg, in, the msg will be sent
+ * @Param addr, in, the remote addr
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_send_data(bca_handler hdlr,
+                                        const bca_msg_t* msg,
+                                        const bca_addr_t* addr);
+
+/*
+ * When the message data has ready to be received
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Param addr, in, the remote addr
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_data_available(bca_handler hdlr,
+                                             const bca_addr_t* addr);
+
+/*
+ * Execute the cached CoAP data, such as blockwise, resending...
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_exec(bca_handler hdlr);
+
+/*
+ * Stop the Baidu CA.
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_stop(bca_handler hdlr);
+
+/*
+ * Release the handler
+ *
+ * @Param hdlr, in, the handler will be operated
+ * @Return bca_status_t, in, the operation result
+ */
+BCA_EXT bca_status_t baidu_ca_release(bca_handler hdlr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca_mbedtls_config.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,103 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The configuration for mbedtls.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_MBEDTLS_CONFIG_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_MBEDTLS_CONFIG_H
+
+/************************************************************/
+/* System support */
+//#define MBEDTLS_HAVE_ASM
+//#define MBEDTLS_HAVE_TIME
+
+#if defined(TARGET_UNO_91H)
+#define MBEDTLS_AES_ENCRYPT_CBC_ALT
+#define MBEDTLS_AES_SETKEY_ENC_ALT
+#define MBEDTLS_AES_SETKEY_DEC_ALT
+#define MBEDTLS_AES_ENCRYPT_ALT
+#define MBEDTLS_AES_DECRYPT_ALT
+#define MBEDTLS_RSA_MONTMUL_ALT
+#define MBEDTLS_DRBG_ALT
+#endif /* TARGET_UNO_91H */
+
+
+/* mbed TLS feature support */
+#define MBEDTLS_CIPHER_MODE_CBC
+#define MBEDTLS_PKCS1_V15
+#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
+//#define MBEDTLS_SSL_PROTO_TLS1_1
+
+/* mbed TLS modules */
+#define MBEDTLS_AES_C
+#define MBEDTLS_ASN1_PARSE_C
+#define MBEDTLS_ASN1_WRITE_C
+#define MBEDTLS_BIGNUM_C
+#define MBEDTLS_CIPHER_C
+#define MBEDTLS_CTR_DRBG_C
+#define MBEDTLS_DES_C
+#define MBEDTLS_ENTROPY_C
+#define MBEDTLS_MD_C
+#define MBEDTLS_MD5_C
+//#define MBEDTLS_NET_C
+#define MBEDTLS_OID_C
+#define MBEDTLS_PK_C
+#define MBEDTLS_PK_PARSE_C
+#define MBEDTLS_RSA_C
+#define MBEDTLS_SHA1_C
+#define MBEDTLS_SHA256_C
+#define MBEDTLS_SSL_CLI_C
+#define MBEDTLS_SSL_SRV_C
+#define MBEDTLS_SSL_TLS_C
+#define MBEDTLS_X509_CRT_PARSE_C
+#define MBEDTLS_X509_USE_C
+
+/* For test certificates */
+#define MBEDTLS_BASE64_C
+#define MBEDTLS_CERTS_C
+#define MBEDTLS_PEM_PARSE_C
+
+/* For testing with compat.sh */
+//#define MBEDTLS_FS_IO
+
+/************************************************************/
+
+//#define MBEDTLS_TIMING_C
+#define MBEDTLS_CTR_DRBG_C
+
+#if 0
+
+#define MBEDTLS_PLATFORM_C
+#define MBEDTLS_PLATFORM_MEMORY
+
+#define MBEDTLS_PLATFORM_FREE_MACRO         BCA_FREE
+#define MBEDTLS_PLATFORM_CALLOC_MACRO       BCA_CALLOC
+
+#endif
+
+//#define MBEDTLS_THREADING_C
+//#define MBEDTLS_THREADING_ALT
+
+#if defined(BCA_MBEDTLS_DEBUG) && (BCA_MBEDTLS_DEBUG > 0)
+#define MBEDTLS_DEBUG_C
+#endif
+
+/************************************************************/
+
+#define MBEDTLS_SSL_PROTO_DTLS
+
+#define MBEDTLS_CCM_C
+
+#if defined(MBEDTLS_SSL_PROTO_DTLS)
+#define MBEDTLS_SSL_PROTO_TLS1_2
+#endif
+
+#define MBEDTLS_SSL_MAX_CONTENT_LEN         (1024)
+
+#define MBEDTLS_NO_PLATFORM_ENTROPY
+
+/************************************************************/
+
+#include "mbedtls/check_config.h"
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_MBEDTLS_CONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/include/baidu_ca_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The common type definitions.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_TYPES_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_TYPES_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef MBED_CLIENT_C_VERSION
+#define MBED_CLIENT_C_VERSION (30001) // 3.0.1
+#endif
+
+typedef void* bca_context;
+typedef int bca_status_t;
+typedef unsigned int bca_size_t;
+typedef unsigned int bca_u32_t;
+typedef unsigned short bca_u16_t;
+typedef unsigned char bca_u8_t;
+typedef signed int bca_s32_t;
+
+typedef char bca_bool;
+
+enum _baidu_ca_bool_e {
+    BCA_FALSE,
+    BCA_TRUE
+};
+
+// Declaration for local varaible & function.
+#define BCA_LOC         static
+// Definition for local varaible & function.
+#define BCA_LOC_IMPL    static
+
+// Declaration for internal varaible & function.
+#define BCA_INT         extern
+// Definition for internal varaible & function.
+#define BCA_INT_IMPL
+
+// Declaration for external varaible & function.
+#define BCA_EXT         extern
+// Definition for external varaible & function.
+#define BCA_EXT_IMPL
+
+/*
+ * The error codes.
+ */
+typedef enum {
+    BCA_NO_ERR,
+    BCA_ERR_INTERNAL                = -0x0001,
+    BCA_ERR_TRANS_INTERNAL_ERROR    = -0x0030,
+    BCA_ERR_TRANS_WOULD_BLOCK       = -0x0031,
+    BCA_ERR_TRANS_TIMEOUT           = -0x0032,
+    BCA_ERR_REG_FAIL                = -0x0033,
+
+    BCA_ERR_REPORT_FAILED           = -0x070000,
+    BCA_ERR_REPORT_FAILED_BEGIN     = BCA_ERR_REPORT_FAILED + 0x10000
+} bca_errcode_e;
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_INCLUDE_BAIDU_CA_TYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_coap.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,154 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The CoAP adapter.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_H
+
+#include "baidu_ca_coap_ep.h"
+
+typedef void* bca_coap_handler;
+
+typedef bca_status_t (*bca_coap_result_f)(bca_context ctx,
+                                          bca_coap_handler hdlr,
+                                          const bca_msg_t* msg,
+                                          const bca_addr_t* addr);
+
+#define BCA_COAP_MESSAGE_ID_INVALID     (0)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Acquire the coap handler.
+ *
+ * @Param f_result, in, the callback for user handling events
+ * @Param context, in, the user context for f_result callback
+ * @Param ctx_context, in, the user socket context
+ * @Return bca_coap_handler, the coap context
+ */
+BCA_INT bca_coap_handler bca_coap_acquire(bca_coap_result_f f_result,
+                                          bca_context context,
+                                          bca_context ctx_context);
+
+/*
+ * Connect to remote CoAP server
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param addr, in, the remote server address
+ * @Param data, in, the security suite data
+ * @Param size, in, the data size
+ * @Return bca_status_t, the connect status
+ */
+BCA_INT bca_status_t bca_coap_connect(bca_coap_handler hdlr,
+                                      const bca_addr_t* addr,
+                                      const void* data,
+                                      bca_size_t size);
+
+/*
+ * Disconnect from remote CoAP server
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Return bca_status_t, the connect status
+ */
+BCA_INT bca_status_t bca_coap_disconnect(bca_coap_handler hdlr);
+
+/*
+ * Add the resource for CoAP request from other endpoints
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param res, in, the resource information
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_resource_add(bca_coap_handler hdlr,
+                                           const bca_res_t* res);
+
+/*
+ * Remove the resource for CoAP request from other endpoints
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param path, in, the resource path
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_resource_remove(bca_coap_handler coap,
+                                              const char* path);
+
+/*
+ * Register endpoint by LWM2M
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param ep, in, the endpoint information
+ * @Return bca_status_t, if > 0, the result is the register message id, else is the error status
+ */
+BCA_INT bca_status_t bca_coap_register(bca_coap_handler coap,
+                                       const bca_coap_ep_t* ep);
+
+/*
+ * Unregister the endpoint by LWM2M
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Return bca_status_t, if > 0, the result is the unregister message id, else is the error status
+ */
+BCA_INT bca_status_t bca_coap_unregister(bca_coap_handler coap);
+
+/*
+ * Update registration by LWM2M
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param lifetime, in, the endpoint lifetime
+ * @Return bca_status_t, if > 0, the result is the update registration message id,
+ *                       else is the error status
+ */
+BCA_INT bca_status_t bca_coap_update_registration(bca_coap_handler coap,
+                                                  bca_u32_t lifetime);
+
+/*
+ * Send the CoAP message
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param msg, in, the CoAP message
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_send(bca_coap_handler coap, const bca_msg_t* msg);
+
+/*
+ * Receive the CoAP message
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_data_available(bca_coap_handler coap);
+
+/*
+ * Execute the cached CoAP data
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param timestamp, in, the timestamp for mark the message
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_exec(bca_coap_handler hdlr, bca_u32_t timestamp);
+
+/*
+ * Release the CoAP context
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Return bca_status_t, the result
+ */
+BCA_INT bca_status_t bca_coap_release(bca_coap_handler coap);
+
+/*
+ * Set read timeout
+ *
+ * @Param hdlr, in, the CoAP context
+ * @Param timeout, in, the timeout value by milliseconds
+ * @Return bca_bool, if match return BCA_TRUE, else return BCA_FALSE
+ */
+BCA_INT bca_status_t bca_coap_set_read_timeout(bca_coap_handler coap, bca_u32_t timeout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_coap_ep.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,54 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The CoAP endpoint definitions.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
+
+#include "baidu_ca_internal.h"
+
+#define LIFETIME_MAX_LEN    (10)
+
+/**
+ * Endpoint registration parameters
+ */
+typedef struct _baidu_ca_coap_endpoint_s {
+    char*          name_ptr;           // Endpoint name
+    bca_size_t     name_len;
+
+    char*          type_ptr;           // Endpoint type
+    bca_size_t     type_len;
+
+    char*          lifetime_ptr;       // Endpoint lifetime in seconds. eg. "1200" = 1200 seconds
+    bca_size_t     lifetime_len;
+
+    bca_addr_t*    address; // Endpoint address to be accessed by the server, optional, default NULL
+} bca_coap_ep_t, *bca_coap_ep_ptr;
+
+/*
+ * Create the endpoint.
+ *
+ * @Param hdlr, in, the global context for baidu ca
+ * @Param name, in, the endpoint name
+ * @Param type, in, the endpoint type
+ * @Param lifetime, in, the lifetime of the endpoint
+ * @Param addr, in, the endpoint address to be accessed by the server, optional, default NULL
+ * @Return bca_coap_ep_ptr, the endpoint context pointer
+ */
+BCA_INT bca_coap_ep_ptr bca_coap_ep_create(const char* name,
+                                           const char* type,
+                                           bca_u32_t lifetime,
+                                           const bca_addr_t* addr);
+
+
+/*
+ * Destroy the endpoint that created by ${link bca_coap_ep_create}.
+ *
+ * @Param hdlr, in, the global context for baidu ca
+ * @Param ptr, in, the endpoint context pointer
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_coap_ep_destroy(bca_coap_ep_ptr ptr);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_conf.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,56 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Baidu CA configuration.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_CONF_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_CONF_H
+
+#include "baidu_ca_types.h"
+
+typedef void* bca_conf_handler;
+
+/*
+ * Create the configuation from buffer
+ *
+ * @Param data, in, the configuation stream
+ * @Param size, in, the data size
+ * @Return bca_conf_handler, the handler for operating the configuation
+ */
+BCA_INT bca_conf_handler bca_conf_create(const void* data, bca_size_t size);
+
+/*
+ * Get the string from the configuration by the key
+ *
+ * @Param hdlr, in, the handler for configuation
+ * @Param key, in, the key of the item
+ * @Return const char *, the string value of the key
+ */
+BCA_INT const char* bca_conf_get_string(bca_conf_handler hdlr, const char* key);
+
+/*
+ * Get the unsigned short from the configuration by the key
+ *
+ * @Param hdlr, in, the handler for configuation
+ * @Param key, in, the key of the item
+ * @Return bca_u16_t, the unsigned short value of the key
+ */
+BCA_INT bca_u16_t bca_conf_get_ushort(bca_conf_handler hdlr, const char* key);
+
+/*
+ * Get the unsigned int from the configuration by the key
+ *
+ * @Param hdlr, in, the handler for configuation
+ * @Param key, in, the key of the item
+ * @Return bca_u32_t, the unsigned int value of the key
+ */
+BCA_INT bca_u32_t bca_conf_get_uint(bca_conf_handler hdlr, const char* key);
+
+/*
+ * Get the string from the configuration by the key
+ *
+ * @Param hdlr, in, the handler for configuation
+ */
+BCA_INT void bca_conf_destroy(bca_conf_handler hdlr);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_CONF_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_debug.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,83 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The APIs for debug the programs.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H
+
+#include "baidu_ca_types.h"
+//TODO this file don't need any more see duer_log.h
+/*
+ * debug function
+ *
+ * @Param level, in, void *, debug level
+ * @Param file, in, const char *, debug file
+ * @Param line, in, bca_u32_t, debug file line
+ * @Param msg, in, debug message
+ */
+//BCA_INT void bca_debug_print(bca_u32_t level, const char* file,
+//                             bca_u32_t line, const char* msg);
+
+/*
+ * debug function
+ *
+ * @Param level, in, void *, debug level
+ * @Param file, in, const char *, debug file
+ * @Param line, in, bca_u32_t, debug file line
+ * @Param fmt, in, debug message print format
+ */
+//BCA_INT void bca_debug(bca_u32_t level, const char* file,
+//                       bca_u32_t line, const char* fmt, ...);
+
+//#ifdef BCA_DEBUG_LEVEL
+//#define BCA_DEBUG_EXT(_l, _f, _li, ...) bca_debug(_l, _f, _li, __VA_ARGS__)
+//#else
+//#define BCA_DEBUG_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 5)
+//#define BCA_LOGV_EXT(_f, _l, ...)   BCA_DEBUG_EXT(5, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGV_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 4)
+//#define BCA_LOGD_EXT(_f, _l, ...)   BCA_DEBUG_EXT(4, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGD_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 3)
+//#define BCA_LOGI_EXT(_f, _l, ...)   BCA_DEBUG_EXT(3, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGI_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 2)
+//#define BCA_LOGW_EXT(_f, _l, ...)   BCA_DEBUG_EXT(2, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGW_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 1)
+//#define BCA_LOGE_EXT(_f, _l, ...)   BCA_DEBUG_EXT(1, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGE_EXT(...)
+//#endif
+//
+//#if defined(BCA_DEBUG_LEVEL) && (BCA_DEBUG_LEVEL >= 0)
+//#define BCA_LOGWTF_EXT(_f, _l, ...)   BCA_DEBUG_EXT(0, _f, _l, __VA_ARGS__)
+//#else
+//#define BCA_LOGWTF_EXT(...)
+//#endif
+//
+//#define BCA_DEBUG(_l, ...)      BCA_DEBUG_EXT(_l, __FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGV(...)           BCA_LOGV_EXT(__FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGD(...)           BCA_LOGD_EXT(__FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGI(...)           BCA_LOGI_EXT(__FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGW(...)           BCA_LOGW_EXT(__FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGE(...)           BCA_LOGE_EXT(__FILE__, __LINE__, __VA_ARGS__)
+//#define BCA_LOGWTF(...)         BCA_LOGWTF_EXT(__FILE__, __LINE__, __VA_ARGS__)
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_DEBUG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_hashcode.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,23 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The hashcode algorithm
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_HASHCODE_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_HASHCODE_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * Generate the hashcode by data
+ *
+ * @Param data, in, the data will be computed
+ * @Param size, in, the data size
+ * @Param seed, in, the hash seed
+ * @Return bca_u32_t, the hashcode value
+ */
+BCA_INT bca_u32_t bca_hashcode(const char* data,
+                               bca_size_t size,
+                               bca_u32_t seed);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_HASHCODE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_internal.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,18 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The internal common header.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_INTERNAL_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_INTERNAL_H
+
+#include "baidu_ca.h"
+#include "baidu_ca_memory.h"
+
+#define BCA_MEMCPY(...)     memcpy(__VA_ARGS__)
+#define BCA_MEMCMP(...)     memcmp(__VA_ARGS__)
+#define BCA_MEMSET(...)     memset(__VA_ARGS__)
+#define BCA_STRLEN(...)     strlen(__VA_ARGS__)
+#define BCA_SNPRINTF(...)   snprintf(__VA_ARGS__)
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_INTERNAL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_mbedtrace.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,21 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Adapter for mbed-trace.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MBEDTRACE_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MBEDTRACE_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * Enable the mbed trace
+ */
+BCA_INT void bca_mbed_trace_enable(void);
+
+/*
+ * Disable the mbed trace
+ */
+BCA_INT void bca_mbed_trace_disable(void);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MBEDTRACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_memory.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,85 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The APIs for memory management.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MEMORY_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MEMORY_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * malloc function
+ *
+ * @Param size, bca_size_t, the expected size of the memory
+ * @Return the alloced memory pointer
+ */
+BCA_INT void* bca_malloc(bca_size_t size);
+
+/*
+ * realloc function
+ *
+ * @Param ptr, void *, the old alloced memory
+ * @Param size, bca_size_t, the expected size of the memory
+ * @Return the new alloced memory pointer
+ */
+BCA_INT void* bca_realloc(void* ptr, bca_size_t size);
+
+/*
+ * free function
+ *
+ * @Param ptr, void *, the alloced memory
+ */
+BCA_INT void bca_free(void* ptr);
+
+/*
+ * malloc function
+ *
+ * @Param size, bca_size_t, the expected size of the memory
+ * @Param file, const char *, the file name when alloc the memory
+ * @Param line, bca_u32_t, the line number of the file when alloc the memory
+ * @Return the alloced memory pointer
+ */
+BCA_INT void* bca_malloc_ext(bca_size_t size, const char* file, bca_u32_t line);
+
+/*
+ * realloc function
+ *
+ * @Param ptr, void *, the old alloced memory
+ * @Param size, bca_size_t, the expected size of the memory
+ * @Param file, const char *, the file name when alloc the memory
+ * @Param line, bca_u32_t, the line number of the file when alloc the memory
+ * @Return the new alloced memory pointer
+ */
+BCA_INT void* bca_realloc_ext(void* ptr, bca_size_t size, const char* file,
+                              bca_u32_t line);
+
+/*
+ * free function
+ *
+ * @Param ptr, void *, the alloced memory
+ * @Param file, const char *, the file name when alloc the memory
+ * @Param line, bca_u32_t, the line number of the file when alloc the memory
+ */
+BCA_INT void bca_free_ext(void* ptr, const char* file, bca_u32_t line);
+
+#ifdef BCA_MEMORY_USAGE
+BCA_INT void bca_memdbg_usage();
+#define BCA_MEMDBG_USAGE(...)       bca_memdbg_usage()
+#else
+#define BCA_MEMDBG_USAGE(...)
+#endif
+
+#ifdef BCA_MEMORY_DEBUG
+#define BCA_MALLOC(_s)          bca_malloc_ext(_s, __FILE__, __LINE__)
+#define BCA_REALLOC(_p, _s)     bca_realloc_ext(_p, _s, __FILE__, __LINE__)
+#define BCA_FREE(_p)            bca_free_ext(_p, __FILE__, __LINE__)
+#else/*BCA_MEMORY_DEBUG*/
+#define BCA_MALLOC(_s)          bca_malloc(_s)
+#define BCA_REALLOC(_p, _s)     bca_realloc(_p, _s)
+#define BCA_FREE(_p)            bca_free(_p)
+#endif/*BCA_MEMORY_DEBUG*/
+
+#define BCA_CALLOC(_s, _n)      BCA_MALLOC((_s) * (_n))
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MEMORY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_mutex.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,40 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Wrapper for mutex
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MUTEX_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MUTEX_H
+
+#include "baidu_ca_types.h"
+#include "baidu_ca.h"
+
+/*
+ * Create mutex context
+ *
+ * @Return bca_mutex_t, the created mutex context
+ */
+BCA_INT bca_mutex_t bca_mutex_create(void);
+
+/*
+ * Mutex lock
+ *
+ * @Return bca_mutex_t, the mutex context
+ */
+BCA_INT bca_status_t bca_mutex_lock(bca_mutex_t mutex);
+
+/*
+ * Mutex unlock
+ *
+ * @Return bca_mutex_t, the mutex context
+ */
+BCA_INT bca_status_t bca_mutex_unlock(bca_mutex_t mutex);
+
+/*
+ * Destroy the mutex context
+ *
+ * @Return bca_mutex_t, the mutex context
+ */
+BCA_INT bca_status_t bca_mutex_destroy(bca_mutex_t mutex);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_MUTEX_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_nsdl_adapter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,52 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Adapter between nsdl and Baidu CA CoAP.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H
+
+#include "ns_types.h"
+#include "sn_nsdl.h"
+#include "sn_coap_header.h"
+#include "baidu_ca_internal.h"
+
+/*
+ * Set the nsdl address from ca
+ *
+ * @Param target, in, the target will be evaluated
+ * @Param source, the CA address
+ */
+BCA_INT void bca_nsdl_address_set(sn_nsdl_addr_s* target,
+                                  const bca_addr_t* source);
+
+/*
+ * Set the nsdl CoAP header from ca
+ *
+ * @Param target, in, the target will be evaluated
+ * @Param opt, in, the CoAP options
+ * @Param source, the CA message header
+ */
+BCA_INT void bca_nsdl_header_set(sn_coap_hdr_s* target,
+                                 sn_coap_options_list_s* opt,
+                                 const bca_msg_t* source);
+
+/*
+ * Set the CoAP address from nsdl
+ *
+ * @Param target, in, the target will be evaluated
+ * @Param source, the nsdl address
+ */
+BCA_INT void bca_coap_address_set(bca_addr_t* target,
+                                  const sn_nsdl_addr_s* source);
+
+/*
+ * Set the CoAP header from nsdl
+ *
+ * @Param target, in, the target will be evaluated
+ * @Param source, the nsdl message header
+ */
+BCA_INT void bca_coap_header_set(bca_msg_t* target,
+                                 const sn_coap_hdr_s* source);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_random.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,18 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The random APIs.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * Obtain the random number
+ *
+ * @Return bca_s32_t, the random number.
+ */
+BCA_INT bca_s32_t bca_random(void);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_timestamp.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,18 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The timestamp APIs.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TIMESTAMP_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TIMESTAMP_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * Obtain the system timestamp by milliseconds
+ *
+ * @Return bca_u32_t, the system timestamp by milliseconds
+ */
+BCA_INT bca_u32_t bca_timestamp(void);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TIMESTAMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_trans_encrypted.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,67 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Define the encrypted networks I/O.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H
+
+#include "baidu_ca_transport.h"
+
+/*
+ * Connect to the host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_encrypted_connect(bca_trans_ptr trans,
+                                                 const bca_addr_t* addr);
+
+/*
+ * Send data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, in, the data will be sent
+ * @Param size, in, the data size
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_encrypted_send(bca_trans_ptr trans,
+                                              const void* data,
+                                              bca_size_t size,
+                                              const bca_addr_t* addr);
+
+/*
+ * Set the timeout for receiving data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param timeout, in, the recv data timeout interval
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_encrypted_set_read_timeout(bca_trans_ptr trans,
+                                                          bca_u32_t timeout);
+
+/*
+ * Receive data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, out, the data will be read
+ * @Param size, in, the data size
+ * @Param addr, out, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_encrypted_recv(bca_trans_ptr trans,
+                                              void* data,
+                                              bca_size_t size,
+                                              bca_addr_t* addr);
+
+/*
+ * Disconnect from the remote host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_encrypted_close(bca_trans_ptr trans);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_trans_wrapper.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,89 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The wrapper for user's transport.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
+
+#include "baidu_ca_transport.h"
+
+/*
+ * Create the socket context.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_create(bca_trans_ptr trans);
+
+/*
+ * Connect to the host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_connect(bca_trans_ptr trans,
+                                               const bca_addr_t* addr);
+
+/*
+ * Send data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, in, the data will be sent
+ * @Param size, in, the data size
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_send(bca_trans_ptr trans,
+                                            const void* data,
+                                            bca_size_t size,
+                                            const bca_addr_t* addr);
+
+/*
+ * Receive data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, out, the data will be read
+ * @Param size, in, the data size
+ * @Param addr, out, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_recv(bca_trans_ptr trans,
+                                            void* data,
+                                            bca_size_t size,
+                                            bca_addr_t* addr);
+
+/*
+ * Receive data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, out, the data will be read
+ * @Param size, in, the data size
+ * @Param timeout, in, the receive timeout
+ * @Param addr, out, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_recv_timeout(bca_trans_ptr trans,
+                                                    void* data,
+                                                    bca_size_t size,
+                                                    bca_u32_t timeout,
+                                                    bca_addr_t* addr);
+
+/*
+ * Disconnect from the remote host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_close(bca_trans_ptr trans);
+
+/*
+ * Destroy the socket context.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_wrapper_destroy(bca_trans_ptr trans);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_transport.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,115 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Define the adapter for networks.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANSPORT_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANSPORT_H
+
+#include "baidu_ca_types.h"
+#include "baidu_ca.h"
+
+#define BCA_READ_FOREVER        ((bca_u32_t)-1)
+
+/*
+ * The handler operate transfer.
+ */
+typedef void* bca_trans_handler;
+
+typedef struct _bca_trans_s {
+    bca_socket_t ctx;
+    bca_context  secure;
+    bca_context  soc_context;
+    void*        cert;
+    bca_size_t   cert_len;
+    bca_u32_t    read_timeout;
+    bca_addr_t   addr;
+} bca_trans_t, *bca_trans_ptr;
+
+/*
+ * Acquire the handler.
+ *
+ * @Param hdlr, in, the global context for baidu ca
+ * @Param flag, in, the flag mark the transport properties, see in ${link bca_trans_flag_e}
+ * @Param ctx, in, the socket context for user
+ * @Return bca_trans_handler, the transport context
+ */
+BCA_INT bca_trans_handler bca_trans_acquire(bca_context ctx);
+
+/*
+ * Set the public key or certificate.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, in, the content of the public key or certificate
+ * @Param size, in, the size of the data
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_set_pk(bca_trans_handler hdlr,
+                                      const void* data,
+                                      bca_size_t size);
+
+/*
+ * Set the timeout for receiving data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param timeout, in, the recv data timeout interval
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_set_read_timeout(bca_trans_handler hdlr,
+                                                bca_u32_t timeout);
+
+/*
+ * Connect to the host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_connect(bca_trans_handler hdlr,
+                                       const bca_addr_t* addr);
+
+/*
+ * Send data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, in, the data will be sent
+ * @Param size, in, the data size
+ * @Param addr, in, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_send(bca_trans_handler hdlr,
+                                    const void* data,
+                                    bca_size_t size,
+                                    const bca_addr_t* addr);
+
+/*
+ * Receive data.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Param data, out, the data will be read
+ * @Param size, in, the data size
+ * @Param addr, out, the target address infomations
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_recv(bca_trans_handler hdlr,
+                                    void* data,
+                                    bca_size_t size,
+                                    bca_addr_t* addr);
+
+/*
+ * Disconnect from the remote host.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_close(bca_trans_handler hdlr);
+
+/*
+ * Release the handler.
+ *
+ * @Param hdlr, in, the context for the transport
+ * @Return bca_status_t, the operation result
+ */
+BCA_INT bca_status_t bca_trans_release(bca_trans_handler hdlr);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANSPORT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/baidu_ca_util_network.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,34 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Network util tools.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H
+
+#include "baidu_ca_types.h"
+
+/*
+ * Determine whether the system byte order is little endian
+ *
+ * @Return bca_ut_t, if big endian return 0, else return 1.
+ */
+BCA_INT bca_u8_t bca_is_little_endian(void);
+
+/*
+ * Convert the byte order from host to network for 16bit value
+ *
+ * @Param value, in, the host value
+ * @Param bca_u16_t, the network result
+ */
+BCA_INT bca_u16_t bca_htons(bca_u16_t value);
+
+/*
+ * Convert the byte order from host to network for 32bit value
+ *
+ * @Param value, in, the host value
+ * @Param bca_u32_t, the network result
+ */
+BCA_INT bca_u32_t bca_htonl(bca_u32_t value);
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_UTIL_NETWORK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/ns_list.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,736 @@
+/*
+ * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NS_LIST_H_
+#define NS_LIST_H_
+
+#include "ns_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** \file
+ * \brief Linked list support library
+ *
+ * The ns_list.h file provides a doubly-linked list/queue, providing O(1)
+ * performance for all insertion/removal operations, and access to either
+ * end of the list.
+ *
+ * Memory footprint is two pointers for the list head, and two pointers in each
+ * list entry. It is similar in concept to BSD's TAILQ.
+ *
+ * Although the API is symmetrical and O(1) in both directions, due to internal
+ * pointer design, it is *slightly* more efficient to insert at the end when
+ * used as a queue, and to iterate forwards rather than backwards.
+ *
+ * Example of an entry type that can be stored to this list.
+ * ~~~
+ *     typedef struct example_entry
+ *     {
+ *         uint8_t        *data;
+ *         uint32_t       data_count;
+ *         ns_list_link_t link;
+ *     }
+ *     example_entry_t;
+ *
+ *     static NS_LIST_HEAD(example_entry_t, link) my_list;
+ *     ns_list_init(&my_list);
+ * ~~~
+ * OR
+ * ~~~
+ *     NS_LIST_HEAD(example_entry_t, link) my_list = NS_LIST_INIT(my_list);
+ * ~~~
+ * OR
+ * ~~~
+ *     static NS_LIST_DEFINE(my_list, example_entry_t, link);
+ * ~~~
+ * OR
+ * ~~~
+ *     typedef NS_LIST_HEAD(example_entry_t, link) example_list_t;
+ *     example_list_t NS_LIST_NAME_INIT(my_list);
+ * ~~~
+ * NOTE: the link field SHALL NOT be accessed by the user.
+ *
+ * An entry can exist on multiple lists by having multiple link fields.
+ *
+ * All the list operations are implemented as macros, most of which are backed
+ * by optionally-inline functions. The macros do not evaluate any arguments more
+ * than once, unless documented.
+ *
+ * In macro documentation, `list_t` refers to a list type defined using
+ * NS_LIST_HEAD(), and `entry_t` to the entry type that was passed to it.
+ */
+
+/** \brief Underlying generic linked list head.
+ *
+ * Users should not use this type directly, but use the NS_LIST_HEAD() macro.
+ */
+typedef struct ns_list
+{
+	void *first_entry;		///< Pointer to first entry, or NULL if list is empty
+	void **last_nextptr;	///< Pointer to last entry's `next` pointer, or
+							///< to head's `first_entry` pointer if list is empty
+} ns_list_t;
+
+/** \brief Declare a list head type
+ *
+ * This union stores the real list head, and also encodes as compile-time type
+ * information the offset of the link pointer, and the type of the entry.
+ *
+ * Note that type information is compiler-dependent; this means
+ * ns_list_get_first() could return either `void *`, or a pointer to the actual
+ * entry type. So `ns_list_get_first()->data` is not a portable construct -
+ * always assign returned entry pointers to a properly typed pointer variable.
+ * This assignment will be then type-checked where the compiler supports it, and
+ * will dereference correctly on compilers that don't support this extension.
+ * ~~~
+ *     NS_LIST_HEAD(example_entry_t, link) my_list;
+ *
+ *     example_entry_t *entry = ns_list_get_first(&my_list);
+ *     do_something(entry->data);
+ * ~~~
+ * Each use of this macro generates a new anonymous union, so these two lists
+ * have different types:
+ * ~~~
+ *     NS_LIST_HEAD(example_entry_t, link) my_list1;
+ *     NS_LIST_HEAD(example_entry_t, link) my_list2;
+ * ~~~
+ * If you need to use a list type in multiple places, eg as a function
+ * parameter, use typedef:
+ * ~~~
+ *     typedef NS_LIST_HEAD(example_entry_t, link) example_list_t;
+ *
+ *     void example_function(example_list_t *);
+ * ~~~
+ */
+#define NS_LIST_HEAD(entry_type, field) \
+union \
+{ \
+    ns_list_t slist; \
+    NS_STATIC_ASSERT(offsetof(entry_type, field) <= UINT_FAST8_MAX, "link offset too large") \
+    char (*offset)[offsetof(entry_type, field)]; \
+	entry_type *type; \
+}
+
+/// \privatesection
+/** \brief Get offset of link field in entry.
+ * \return `(ns_list_offset_t)` The offset of the link field for entries on the specified list
+ */
+#define NS_LIST_OFFSET_(list) ((ns_list_offset_t) sizeof *(list)->offset)
+
+/** \brief Get the entry type.
+ * \def NS_LIST_TYPE_
+ *
+ * \return The type of entry on the specified list.
+ *
+ * Only available if the compiler provides a "typeof" operator.
+ */
+#if defined __cplusplus && __cplusplus >= 201103L
+#define NS_LIST_TYPE_(list) decltype(*(list)->type)
+#elif defined __GNUC__
+#define NS_LIST_TYPE_(list) __typeof__(*(list)->type)
+#endif
+
+/** \brief Check for compatible pointer types
+ *
+ * Although this can be done portably, the GCC custom version is provided to
+ * produce a clearer diagnostic, and it produces an error rather than a warning.
+ *
+ * The portable version will produce a diagnostic about a pointer mismatch on
+ * the == inside the sizeof operator. For example ARM/Norcroft C gives the error:
+ *
+ *     operand types are incompatible ("entry_t *" and "other_t *")
+ */
+#ifdef CPPCHECK
+#define NS_PTR_MATCH_(a, b, str) ((void) 0)
+#elif defined __GNUC__
+#define NS_PTR_MATCH_(a, b, str) __extension__ \
+	({ NS_STATIC_ASSERT(__builtin_types_compatible_p(__typeof__ (*(a)), __typeof__ (*(b))), \
+						str) })
+#else
+#define NS_PTR_MATCH_(a, b, str) ((void) sizeof ((a) == (b)))
+#endif
+
+/** \brief Internal macro to cast returned entry pointers to correct type.
+ *
+ * Not portable in C, alas. With GCC or C++11, the "get entry" macros return
+ * correctly-typed pointers. Otherwise, the macros return `void *`.
+ *
+ * The attempt at a portable version would work if the C `?:` operator wasn't
+ * broken - `x ? (t *) : (void *)` should really have type `(t *)` in C, but
+ * it has type `(void *)`, which only makes sense for C++. The `?:` is left in,
+ * in case some day it works. Some compilers may still warn if this is
+ * assigned to a different type.
+ */
+#ifdef NS_LIST_TYPE_
+#define NS_LIST_TYPECAST_(list, val) ((NS_LIST_TYPE_(list) *) (val))
+#else
+#define NS_LIST_TYPECAST_(list, val) (0 ? (list)->type : (val))
+#endif
+
+/** \brief Internal macro to check types of input entry pointer. */
+#define NS_LIST_TYPECHECK_(list, entry) \
+	(NS_PTR_MATCH_((list)->type, (entry), "incorrect entry type for list"), (entry))
+
+/** \brief Type used to pass link offset to underlying functions
+ *
+ * We could use size_t, but it would be unnecessarily large on 8-bit systems,
+ * where we can be (pretty) confident we won't have next pointers more than
+ * 256 bytes into a structure.
+ */
+typedef uint_fast8_t ns_list_offset_t;
+
+/// \publicsection
+/** \brief The type for the link member in the user's entry structure.
+ *
+ * Users should not access this member directly - just pass its name to the
+ * list head macros. The funny prev pointer simplifies common operations
+ * (eg insertion, removal), at the expense of complicating rare reverse iteration.
+ *
+ * NB - the list implementation relies on next being the first member.
+ */
+typedef struct ns_list_link
+{
+	void *next;		///< Pointer to next entry, or NULL if none
+	void **prev;	///< Pointer to previous entry's (or head's) next pointer
+} ns_list_link_t;
+
+/** \brief "Poison" value placed in unattached entries' link pointers.
+ * \internal What are good values for this? Platform dependent, maybe just NULL
+ */
+#define NS_LIST_POISON ((void *) 0xDEADBEEF)
+
+/** \brief Initialiser for an entry's link member
+ *
+ * This initialiser is not required by the library, but a user may want an
+ * initialiser to include in their own entry initialiser. See
+ * ns_list_link_init() for more discussion.
+ */
+#define NS_LIST_LINK_INIT(name) \
+	NS_FUNNY_INTPTR_OK \
+	{ NS_LIST_POISON, NS_LIST_POISON } \
+	NS_FUNNY_INTPTR_RESTORE
+
+/** \hideinitializer \brief Initialise an entry's list link
+ *
+ * This "initialises" an unattached entry's link by filling the fields with
+ * poison. This is optional, as unattached entries field pointers are not
+ * meaningful, and it is not valid to call ns_list_get_next or similar on
+ * an unattached entry.
+ *
+ * \param entry Pointer to an entry
+ * \param field The name of the link member to initialise
+ */
+#define ns_list_link_init(entry, field) ns_list_link_init_(&(entry)->field)
+
+/** \hideinitializer \brief Initialise a list
+ *
+ * Initialise a list head before use. A list head must be initialised using this
+ * function or one of the NS_LIST_INIT()-type macros before use. A zero-initialised
+ * list head is *not* valid.
+ *
+ * If used on a list containing existing entries, those entries will
+ * become detached. (They are not modified, but their links are now effectively
+ * undefined).
+ *
+ * \param list Pointer to a NS_LIST_HEAD() structure.
+ */
+#define ns_list_init(list) ns_list_init_(&(list)->slist)
+
+/** \brief Initialiser for an empty list
+ *
+ * Usage in an enclosing initialiser:
+ * ~~~
+ *      static my_type_including_list_t x = {
+ *          "Something",
+ *          23,
+ *          NS_LIST_INIT(x),
+ *      };
+ * ~~~
+ * NS_LIST_DEFINE() or NS_LIST_NAME_INIT() may provide a shorter alternative
+ * in simpler cases.
+ */
+#define NS_LIST_INIT(name) { { NULL, &(name).slist.first_entry } }
+
+/** \brief Name and initialiser for an empty list
+ *
+ * Usage:
+ * ~~~
+ *      list_t NS_LIST_NAME_INIT(foo);
+ * ~~~
+ * acts as
+ * ~~~
+ *      list_t foo = { empty list };
+ * ~~~
+ * Also useful with designated initialisers:
+ * ~~~
+ *      .NS_LIST_NAME_INIT(foo),
+ * ~~~
+ * acts as
+ * ~~~
+ *      .foo = { empty list },
+ * ~~~
+ */
+#define NS_LIST_NAME_INIT(name) name = NS_LIST_INIT(name)
+
+/** \brief Define a list, and initialise to empty.
+ *
+ * Usage:
+ * ~~~
+ *     static NS_LIST_DEFINE(my_list, entry_t, link);
+ * ~~~
+ * acts as
+ * ~~~
+ *     static list_type my_list = { empty list };
+ * ~~~
+ */
+#define NS_LIST_DEFINE(name, type, field) \
+	NS_LIST_HEAD(type, field) NS_LIST_NAME_INIT(name)
+
+/** \hideinitializer \brief Add an entry to the start of the linked list.
+ *
+ * ns_list_add_to_end() is *slightly* more efficient than ns_list_add_to_start().
+ *
+ * \param list  `(list_t *)`           Pointer to list.
+ * \param entry `(entry_t * restrict)` Pointer to new entry to add.
+ */
+#define ns_list_add_to_start(list, entry) \
+	ns_list_add_to_start_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, entry))
+
+/** \hideinitializer \brief Add an entry to the end of the linked list.
+ *
+ * \param list  `(list_t *)`           Pointer to list.
+ * \param entry `(entry_t * restrict)` Pointer to new entry to add.
+ */
+#define ns_list_add_to_end(list, entry) \
+	ns_list_add_to_end_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, entry))
+
+/** \hideinitializer \brief Add an entry before a specified entry.
+ *
+ * \param list   `(list_t *)`           Pointer to list.
+ * \param before `(entry_t *)`          Existing entry before which to place the new entry.
+ * \param entry  `(entry_t * restrict)` Pointer to new entry to add.
+ */
+#define ns_list_add_before(list, before, entry) \
+	ns_list_add_before_(NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, before), NS_LIST_TYPECHECK_(list, entry))
+
+/** \hideinitializer \brief Add an entry after a specified entry.
+ *
+ * ns_list_add_before() is *slightly* more efficient than ns_list_add_after().
+ *
+ * \param list  `(list_t *)`           Pointer to list.
+ * \param after `(entry_t *)`          Existing entry after which to place the new entry.
+ * \param entry `(entry_t * restrict)` Pointer to new entry to add.
+ */
+#define ns_list_add_after(list, after, entry) \
+	ns_list_add_after_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, after), NS_LIST_TYPECHECK_(list, entry))
+
+/** \brief Check if a list is empty.
+ *
+ * \param list `(const list_t *)` Pointer to list.
+ *
+ * \return     `(bool)`           true if the list is empty.
+ */
+#define ns_list_is_empty(list) ((bool) ((list)->slist.first_entry == NULL))
+
+/** \brief Get the first entry.
+ *
+ * \param list `(const list_t *)` Pointer to list.
+ *
+ * \return     `(entry_t *)`      Pointer to first entry.
+ * \return                        NULL if list is empty.
+ */
+#define ns_list_get_first(list) NS_LIST_TYPECAST_(list, (list)->slist.first_entry)
+
+/** \hideinitializer \brief Get the previous entry.
+ *
+ * \param list    `(const list_t *)`  Pointer to list.
+ * \param current `(const entry_t *)` Pointer to current entry.
+ *
+ * \return        `(entry_t *)`       Pointer to previous entry.
+ * \return                            NULL if current entry is first.
+ */
+#define ns_list_get_previous(list, current) \
+	NS_LIST_TYPECAST_(list, ns_list_get_previous_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, current)))
+
+/** \hideinitializer \brief Get the next entry.
+ *
+ * \param list    `(const list_t *)`  Pointer to list.
+ * \param current `(const entry_t *)` Pointer to current entry.
+ *
+ * \return        `(entry_t *)`       Pointer to next entry.
+ * \return                            NULL if current entry is last.
+ */
+#define ns_list_get_next(list, current) \
+	NS_LIST_TYPECAST_(list, ns_list_get_next_(NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, current)))
+
+/** \hideinitializer \brief Get the last entry.
+ *
+ * \param list `(const list_t *)` Pointer to list.
+ *
+ * \return     `(entry_t *)`      Pointer to last entry.
+ * \return                        NULL if list is empty.
+ */
+#define ns_list_get_last(list) \
+	NS_LIST_TYPECAST_(list, ns_list_get_last_(&(list)->slist, NS_LIST_OFFSET_(list)))
+
+/** \hideinitializer \brief Remove an entry.
+ *
+ * \param list  `(list_t *)`  Pointer to list.
+ * \param entry `(entry_t *)` Entry on list to be removed.
+ */
+#define ns_list_remove(list, entry) \
+	ns_list_remove_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, entry))
+
+/** \hideinitializer \brief Replace an entry.
+ *
+ * \param list        `(list_t *)`           Pointer to list.
+ * \param current     `(entry_t *)`          Existing entry on list to be replaced.
+ * \param replacement `(entry_t * restrict)` New entry to be the replacement.
+ */
+#define ns_list_replace(list, current, replacement) \
+	ns_list_replace_(&(list)->slist, NS_LIST_OFFSET_(list), NS_LIST_TYPECHECK_(list, current), NS_LIST_TYPECHECK_(list, replacement))
+
+/** \hideinitializer \brief Concatenate two lists.
+ *
+ * Attach the entries on the source list to the end of the destination
+ * list, leaving the source list empty.
+ *
+ * \param dst `(list_t *)` Pointer to destination list.
+ * \param src `(list_t *)` Pointer to source list.
+ *
+ */
+#define ns_list_concatenate(dst, src) \
+		(NS_PTR_MATCH_(dst, src, "concatenating different list types"), \
+		ns_list_concatenate_(&(dst)->slist, &(src)->slist, NS_LIST_OFFSET_(src)))
+
+/** \brief Iterate forwards over a list.
+ *
+ * Example:
+ * ~~~
+ *     ns_list_foreach(const my_entry_t, cur, &my_list)
+ *     {
+ *         printf("%s\n", cur->name);
+ *     }
+ * ~~~
+ * Deletion of the current entry is not permitted as its next is checked after
+ * running user code.
+ *
+ * The iteration pointer is declared inside the loop, using C99/C++, so it
+ * is not accessible after the loop.  This encourages good code style, and
+ * matches the semantics of C++11's "ranged for", which only provides the
+ * declaration form:
+ * ~~~
+ *     for (const my_entry_t cur : my_list)
+ * ~~~
+ * If you need to see the value of the iteration pointer after a `break`,
+ * you will need to assign it to a variable declared outside the loop before
+ * breaking:
+ * ~~~
+ *      my_entry_t *match = NULL;
+ *      ns_list_foreach(my_entry_t, cur, &my_list)
+ *      {
+ *          if (cur->id == id)
+ *          {
+ *              match = cur;
+ *              break;
+ *          }
+ *      }
+ * ~~~
+ *
+ * The user has to specify the entry type for the pointer definition, as type
+ * extraction from the list argument isn't portable. On the other hand, this
+ * also permits const qualifiers, as in the example above, and serves as
+ * documentation. The entry type will be checked against the list type where the
+ * compiler supports it.
+ *
+ * \param type                    Entry type `([const] entry_t)`.
+ * \param e                       Name for iteration pointer to be defined
+ *                                inside the loop.
+ * \param list `(const list_t *)` Pointer to list - evaluated multiple times.
+ */
+#define ns_list_foreach(type, e, list) \
+	for (type *e = ns_list_get_first(list); e; e = ns_list_get_next(list, e))
+
+/** \brief Iterate forwards over a list, where user may delete.
+ *
+ * As ns_list_foreach(), but deletion of current entry is permitted as its
+ * next pointer is recorded before running user code.
+ *
+ * Example:
+ * ~~~
+ *     ns_list_foreach_safe(my_entry_t, cur, &my_list)
+ *     {
+ *         ns_list_remove(cur);
+ *     }
+ * ~~~
+ * \param type               Entry type `(entry_t)`.
+ * \param e                  Name for iteration pointer to be defined
+ *                           inside the loop.
+ * \param list `(list_t *)`  Pointer to list - evaluated multiple times.
+ */
+#define ns_list_foreach_safe(type, e, list) \
+	for (type *e = ns_list_get_first(list), *_next; \
+		e && (_next = ns_list_get_next(list, e), true); e = _next)
+
+/** \brief Iterate backwards over a list.
+ *
+ * As ns_list_foreach(), but going backwards - see its documentation.
+ * Iterating forwards is *slightly* more efficient.
+ */
+#define ns_list_foreach_reverse(type, e, list) \
+	for (type *e = ns_list_get_last(list); e; e = ns_list_get_previous(list, e))
+
+/** \brief Iterate backwards over a list, where user may delete.
+ *
+ * As ns_list_foreach_safe(), but going backwards - see its documentation.
+ * Iterating forwards is *slightly* more efficient.
+ */
+#define ns_list_foreach_reverse_safe(type, e, list) \
+	for (type *e = ns_list_get_last(list), *_next; \
+		e && (_next = ns_list_get_previous(list, e), true); e = _next)
+
+/** \hideinitializer \brief Count entries on a list
+ *
+ * Unlike other operations, this is O(n). Note: if list might contain over
+ * 65535 entries, this function **must not** be used to get the entry count.
+ *
+ * \param list `(const list_t *)` Pointer to list.
+
+ * \return     `(uint_fast16_t)`  Number of entries that are stored in list.
+ */
+#define ns_list_count(list) ns_list_count_(&(list)->slist, NS_LIST_OFFSET_(list))
+
+/** \privatesection
+ *  Internal functions - designed to be accessed using corresponding macros above
+ */
+NS_INLINE void ns_list_init_(ns_list_t *list);
+NS_INLINE void ns_list_link_init_(ns_list_link_t *link);
+NS_INLINE void ns_list_add_to_start_(ns_list_t *list, ns_list_offset_t link_offset, void * restrict entry);
+NS_INLINE void ns_list_add_to_end_(ns_list_t *list, ns_list_offset_t link_offset, void * restrict entry);
+NS_INLINE void ns_list_add_before_(ns_list_offset_t link_offset, void *before, void * restrict entry);
+NS_INLINE void ns_list_add_after_(ns_list_t *list, ns_list_offset_t link_offset, void *after, void * restrict entry);
+NS_INLINE void *ns_list_get_next_(ns_list_offset_t link_offset, const void *current);
+NS_INLINE void *ns_list_get_previous_(const ns_list_t *list, ns_list_offset_t link_offset, const void *current);
+NS_INLINE void *ns_list_get_last_(const ns_list_t *list,  ns_list_offset_t offset);
+NS_INLINE void ns_list_remove_(ns_list_t *list, ns_list_offset_t link_offset, void *entry);
+NS_INLINE void ns_list_replace_(ns_list_t *list, ns_list_offset_t link_offset, void *current, void * restrict replacement);
+NS_INLINE void ns_list_concatenate_(ns_list_t *dst, ns_list_t *src, ns_list_offset_t offset);
+NS_INLINE uint_fast16_t ns_list_count_(const ns_list_t *list, ns_list_offset_t link_offset);
+
+/* Provide definitions, either for inlining, or for ns_list.c */
+#if defined NS_ALLOW_INLINING || defined NS_LIST_FN
+#ifndef NS_LIST_FN
+#define NS_LIST_FN NS_INLINE
+#endif
+
+/* Pointer to the link member in entry e */
+#define NS_LIST_LINK_(e, offset) ((ns_list_link_t *)((char *)(e) + offset))
+
+/* Lvalue of the next link pointer in entry e */
+#define NS_LIST_NEXT_(e, offset) (NS_LIST_LINK_(e, offset)->next)
+
+/* Lvalue of the prev link pointer in entry e */
+#define NS_LIST_PREV_(e, offset) (NS_LIST_LINK_(e, offset)->prev)
+
+/* Convert a pointer to a link member back to the entry;
+ * works for linkptr either being a ns_list_link_t pointer, or its next pointer,
+ * as the next pointer is first in the ns_list_link_t */
+#define NS_LIST_ENTRY_(linkptr, offset) ((void *)((char *)(linkptr) - offset))
+
+NS_LIST_FN void ns_list_init_(ns_list_t *list)
+{
+	list->first_entry = NULL;
+	list->last_nextptr = &list->first_entry;
+}
+
+NS_LIST_FN void ns_list_link_init_(ns_list_link_t *link)
+{
+	NS_FUNNY_INTPTR_OK
+	link->next = NS_LIST_POISON;
+	link->prev = NS_LIST_POISON;
+	NS_FUNNY_INTPTR_RESTORE
+}
+
+NS_LIST_FN void ns_list_add_to_start_(ns_list_t *list, ns_list_offset_t offset, void * restrict entry)
+{
+	void *next;
+
+	NS_LIST_PREV_(entry, offset) = &list->first_entry;
+	NS_LIST_NEXT_(entry, offset) = next = list->first_entry;
+
+	if (next)
+	{
+		NS_LIST_PREV_(next, offset) = &NS_LIST_NEXT_(entry, offset);
+	}
+	else
+	{
+		list->last_nextptr = &NS_LIST_NEXT_(entry, offset);
+	}
+
+	list->first_entry = entry;
+}
+
+NS_LIST_FN void ns_list_add_after_(ns_list_t *list, ns_list_offset_t offset, void *current, void * restrict entry)
+{
+	void *next;
+
+	NS_LIST_PREV_(entry, offset) = &NS_LIST_NEXT_(current, offset);
+	NS_LIST_NEXT_(entry, offset) = next = NS_LIST_NEXT_(current, offset);
+
+	if (next)
+	{
+		NS_LIST_PREV_(next, offset) = &NS_LIST_NEXT_(entry, offset);
+	}
+	else
+	{
+		list->last_nextptr = &NS_LIST_NEXT_(entry, offset);
+	}
+
+	NS_LIST_NEXT_(current, offset) = entry;
+}
+
+NS_LIST_FN void ns_list_add_before_(ns_list_offset_t offset, void *current, void * restrict entry)
+{
+	void **prev_nextptr;
+
+	NS_LIST_NEXT_(entry, offset) = current;
+	NS_LIST_PREV_(entry, offset) = prev_nextptr = NS_LIST_PREV_(current, offset);
+	*prev_nextptr = entry;
+	NS_LIST_PREV_(current, offset) = &NS_LIST_NEXT_(entry, offset);
+}
+
+NS_LIST_FN void ns_list_add_to_end_(ns_list_t *list, ns_list_offset_t offset, void * restrict entry)
+{
+	void **prev_nextptr;
+
+	NS_LIST_NEXT_(entry, offset) = NULL;
+	NS_LIST_PREV_(entry, offset) = prev_nextptr = list->last_nextptr;
+	*prev_nextptr = entry;
+	list->last_nextptr = &NS_LIST_NEXT_(entry, offset);
+}
+
+NS_LIST_FN void *ns_list_get_next_(ns_list_offset_t offset, const void *current)
+{
+	return NS_LIST_NEXT_(current, offset);
+}
+
+NS_LIST_FN void *ns_list_get_previous_(const ns_list_t *list, ns_list_offset_t offset, const void *current)
+{
+	if(current == list->first_entry)
+	{
+		return NULL;
+	}
+
+	// Tricky. We don't have a direct previous pointer, but a pointer to the
+	// pointer that points to us - ie &head->first_entry OR &{prev}->next.
+	// This makes life easier on insertion and removal, but this is where we
+	// pay the price.
+
+	// We have to check manually for being the first entry above, so we know it's
+	// a real link's next pointer. Then next is the first field of
+	// ns_list_link_t, so we can use the normal offset value.
+
+	return NS_LIST_ENTRY_(NS_LIST_PREV_(current, offset), offset);
+}
+
+NS_LIST_FN void *ns_list_get_last_(const ns_list_t *list, ns_list_offset_t offset)
+{
+	if(!list->first_entry)
+	{
+		return NULL;
+	}
+
+	// See comments in ns_list_get_previous_()
+	return NS_LIST_ENTRY_(list->last_nextptr, offset);
+}
+
+NS_LIST_FN void ns_list_remove_(ns_list_t *list, ns_list_offset_t offset, void *removed)
+{
+	void *next;
+	void **prev_nextptr;
+
+	next = NS_LIST_NEXT_(removed, offset);
+	prev_nextptr = NS_LIST_PREV_(removed, offset);
+	if (next)
+	{
+		NS_LIST_PREV_(next, offset) = prev_nextptr;
+	}
+	else
+	{
+		list->last_nextptr = prev_nextptr;
+	}
+	*prev_nextptr = next;
+
+	ns_list_link_init_(NS_LIST_LINK_(removed, offset));
+}
+
+NS_LIST_FN void ns_list_replace_(ns_list_t *list, ns_list_offset_t offset, void *current, void * restrict replacement)
+{
+	void *next;
+	void **prev_nextptr;
+
+	NS_LIST_PREV_(replacement, offset) = prev_nextptr = NS_LIST_PREV_(current, offset);
+	NS_LIST_NEXT_(replacement, offset) = next = NS_LIST_NEXT_(current, offset);
+
+	if (next)
+	{
+		NS_LIST_PREV_(next, offset) = &NS_LIST_NEXT_(replacement, offset);
+	}
+	else
+	{
+		list->last_nextptr = &NS_LIST_NEXT_(replacement, offset);
+	}
+	*prev_nextptr = replacement;
+
+	ns_list_link_init_(NS_LIST_LINK_(current, offset));
+}
+
+NS_LIST_FN void ns_list_concatenate_(ns_list_t *dst, ns_list_t *src, ns_list_offset_t offset)
+{
+	ns_list_link_t *src_first;
+
+	src_first = src->first_entry;
+	if (!src_first)
+		return;
+
+	*dst->last_nextptr = src_first;
+	NS_LIST_PREV_(src_first, offset) = dst->last_nextptr;
+	dst->last_nextptr = src->last_nextptr;
+
+	ns_list_init_(src);
+}
+
+NS_LIST_FN uint_fast16_t ns_list_count_(const ns_list_t *list, ns_list_offset_t offset)
+{
+	uint_fast16_t count = 0;
+
+	for (void *p = list->first_entry; p; p = NS_LIST_NEXT_(p, offset))
+	{
+		count++;
+	}
+
+	return count;
+}
+#endif /* defined NS_ALLOW_INLINING || defined NS_LIST_FN */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NS_LIST_H_ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/ns_types.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,390 @@
+/*
+ * Copyright (c) 2014-2015 ARM Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * ns_types.h - Basic compiler and type setup for Nanostack libraries.
+ */
+#ifndef NS_TYPES_H_
+#define NS_TYPES_H_
+
+/** \file
+ * \brief Basic compiler and type setup
+ *
+ * We currently assume C99 or later.
+ *
+ * C99 features being relied on:
+ *
+ *   - <inttypes.h> and <stdbool.h>
+ *   - inline (with C99 semantics, not C++ as per default GCC);
+ *   - designated initialisers;
+ *   - compound literals;
+ *   - restrict;
+ *   - [static N] in array parameters;
+ *   - declarations in for statements;
+ *   - mixing declarations and statements
+ *
+ * Compilers should be set to C99 or later mode when building Nanomesh source.
+ * For GCC this means "-std=gnu99" (C99 with usual GNU extensions).
+ *
+ * Also, a little extra care is required for public header files that could be
+ * included from C++, especially as C++ lacks some C99 features.
+ *
+ * (TODO: as this is exposed to API users, do we need a predefine to distinguish
+ * internal and external use, for finer control? Not yet, but maybe...)
+ */
+
+/* Make sure <stdint.h> defines its macros if C++ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
+#include <stddef.h>
+#include <inttypes.h> // includes <stdint.h>; debugf() users need PRIu32 etc
+#include <stdbool.h>
+
+#if defined __GNUC__ && defined __arm__
+/* arm-none-eabi-gcc 4.8-2014q3 has a problem in its <inttypes.h>:
+ * int_fast32_t is defined as int, but PRI<x>FAST32 are defined as "l<x>".
+ * Try to detect this situation and override it.
+ * Very hard to detect types in the preprocessor - this is best I could do.
+ * Expansion works by:
+ *   NS_TEST_Y(INT_FAST32_MAX) -> NS_TEST_X(2147483647) -> __NS2147483647 -> 1
+ * Nested macros are needed so we don't get __NSINT_FAST32_MAX.
+ */
+#define __NS2147483647	1
+#define __NS2147483647L	2
+#define NS_TEST_X(x) __NS##x
+#define NS_TEST_Y(x) NS_TEST_X(x)
+
+#if NS_TEST_Y(INT_FAST32_MAX) == __NS2147483647 && \
+	NS_TEST_Y(INT_LEAST32_MAX) == __NS2147483647L && \
+	NS_TEST_Y(INT32_MAX) == __NS2147483647L
+
+// Fast 32-bit types are int, others are long - this is the problem case in
+// arm-none-eabi-gcc.
+#undef PRIoFAST32
+#undef PRIuFAST32
+#undef PRIxFAST32
+#undef PRIXFAST32
+#undef PRIdFAST32
+#undef PRIiFAST32
+#define PRIoFAST32 "o"
+#define PRIuFAST32 "u"
+#define PRIxFAST32 "x"
+#define PRIXFAST32 "X"
+#define PRIdFAST32 "d"
+#define PRIiFAST32 "i"
+#endif
+#undef NS_TEST_X
+#undef NS_TEST_Y
+#undef __NS2147483647
+#undef __NS2147483647L
+#endif
+
+/*
+ * Create the optional <stdint.h> 24-bit types if they don't exist (worth trying
+ * to use them, as they could exist and be more efficient than 32-bit on 8-bit
+ * systems...)
+ */
+#ifndef UINT24_LEAST_MAX
+typedef uint_least32_t uint_least24_t;
+#define UINT_LEAST24_MAX UINT_LEAST32_MAX
+#define UINT24_C(x) UINT32_C(x)
+#define PRIoLEAST24 PRIoLEAST32
+#define PRIuLEAST24 PRIuLEAST32
+#define PRIxLEAST24 PRIxLEAST32
+#define PRIXLEAST24 PRIXLEAST32
+#endif
+
+#ifndef INT24_LEAST_MAX
+typedef int_least32_t int_least24_t;
+#define INT24_LEAST_MIN INT_LEAST32_MIN
+#define INT24_LEAST_MAX INT_LEAST32_MAX
+#define INT24_C(x) INT32_C(x)
+#define PRIdLEAST24 PRIdLEAST32
+#define PRIiLEAST24 PRIiLEAST32
+#endif
+
+#ifndef UINT24_FAST_MAX
+typedef uint_fast32_t uint_fast24_t;
+#define UINT_FAST24_MAX UINT_FAST32_MAX
+#define PRIoFAST24 PRIoFAST32
+#define PRIuFAST24 PRIuFAST32
+#define PRIxFAST24 PRIxFAST32
+#define PRIXFAST24 PRIXFAST32
+#endif
+
+#ifndef INT24_FAST_MAX
+typedef int_fast32_t int_fast24_t;
+#define INT_FAST24_MIN INT_FAST32_MIN
+#define INT_FAST24_MAX INT_FAST32_MAX
+#define PRIdFAST24 PRIdFAST32
+#define PRIiFAST24 PRIiFAST32
+#endif
+
+/* C11's "noreturn" macro, emulated if necessary */
+#ifndef noreturn
+#if defined  __cplusplus && __cplusplus >= 201103L
+// noreturn is a C++11 keyword
+#elif __STDC_VERSION__ >= 201112L
+#include <stdnoreturn.h>
+#elif defined __GNUC__
+#define noreturn /*__attribute__((__noreturn__))*/
+#elif defined __CC_ARM
+#define noreturn __declspec(noreturn)
+#elif defined __IAR_SYSTEMS_ICC__
+#define noreturn __noreturn
+#else
+#define noreturn
+#endif
+#endif
+
+/* C11's "alignas" macro, emulated for integer expressions if necessary */
+#ifndef __alignas_is_defined
+#if __STDC_VERSION__ >= 201112L || (defined __cplusplus && __cplusplus >= 201103L)
+#include <stdalign.h>
+#elif defined __GNUC__
+#define alignas(n) __attribute__((__aligned__(n)))
+#define __alignas_is_defined 1
+#elif defined __CC_ARM || defined __TASKING__
+#define alignas(n) __align(n)
+#define __alignas_is_defined 1
+#elif defined __IAR_SYSTEMS_ICC__
+/* Does this really just apply to the next variable? */
+#define alignas(n) __Alignas(data_alignment=n)
+#define __Alignas(x) _Pragma(#x)
+#define __alignas_is_defined 1
+#endif
+#endif
+
+/**
+ * Marker for functions or objects that may be unused, suppressing warnings.
+ * Place after the identifier:
+ * ~~~
+ *    static int X MAYBE_UNUSED = 3;
+ *    static int foo(void) MAYBE_UNUSED;
+ * ~~~
+ */
+#if defined __CC_ARM || defined __GNUC__
+#define MAYBE_UNUSED __attribute__((unused))
+#else
+#define MAYBE_UNUSED
+#endif
+
+/*
+ * C++ (even C++11) doesn't provide restrict: define away or provide
+ * alternative.
+ */
+#if defined(__cplusplus) && defined(__GNUC__)
+#define restrict __restrict
+#else
+#define restrict
+#endif /* __cplusplus */
+
+
+/**
+ * C++ doesn't allow "static" in function parameter types: ie
+ * ~~~
+ *    entry_t *find_entry(const uint8_t address[static 16])
+ * ~~~
+ * If a header file may be included from C++, use this __static define instead.
+ *
+ * (Syntax introduced in C99 - `uint8_t address[16]` in a prototype was always
+ * equivalent to `uint8_t *address`, but the C99 addition of static tells the
+ * compiler that address is never NULL, and always points to at least 16
+ * elements. This adds no new type-checking, but the information could aid
+ * compiler optimisation, and it can serve as documentation).
+ */
+#ifdef __cplusplus
+#define __static
+#else
+#define __static static
+#endif
+
+#ifdef __GNUC__
+#define NS_GCC_VERSION (__GNUC__ * 10000 \
+                   + __GNUC_MINOR__ * 100 \
+                   + __GNUC_PATCHLEVEL__)
+#endif
+
+/** \brief Compile-time assertion
+ *
+ * C11 provides _Static_assert, as does GCC even in C99 or C++ mode (and
+ * as a freestanding implementation, we can't rely on <assert.h> to get
+ * the static_assert macro).
+ * C++11 provides static_assert as a keyword.
+ *
+ * The assertion acts as a declaration that can be placed at file scope, in a
+ * code block (except after a label), or as a member of a struct/union. It
+ * produces a compiler error if "test" evaluates to 0.
+ *
+ * Note that this *includes* the required semicolon when defined, else it
+ * is totally empty, permitting use in structs. (If the user provided the `;`,
+ * it would leave an illegal stray `;` if unavailable).
+ */
+#if __STDC_VERSION__ >= 201112L
+#define NS_STATIC_ASSERT(test, str) _Static_assert(test, str);
+#elif defined  __cplusplus && __cplusplus >= 201103L
+#define NS_STATIC_ASSERT(test, str) static_assert(test, str);
+#elif defined __GNUC__ && NS_GCC_VERSION >= 40600
+//#define NS_STATIC_ASSERT(test, str) __extension__ _Static_assert(test, str);
+#define NS_STATIC_ASSERT(test, str)
+#else
+#define NS_STATIC_ASSERT(test, str)
+#endif
+
+#define static_assert _Static_assert
+
+/** \brief Pragma to suppress warnings about unusual pointer values.
+ *
+ * Useful if using "poison" values.
+ */
+#ifdef __IAR_SYSTEMS_ICC__
+#define NS_FUNNY_INTPTR_OK		_Pragma("diag_suppress=Pe1053")
+#define NS_FUNNY_INTPTR_RESTORE	_Pragma("diag_default=Pe1053")
+#else
+#define NS_FUNNY_INTPTR_OK
+#define NS_FUNNY_INTPTR_RESTORE
+#endif
+
+/** \brief Convert pointer to member to pointer to containing structure */
+#define NS_CONTAINER_OF(ptr, type, member) \
+	((type *) ((char *) (ptr) - offsetof(type, member)))
+
+/*
+ * Inlining could cause problems when mixing with C++; provide a mechanism to
+ * disable it. This could also be turned off for other reasons (although
+ * this can usually be done through a compiler flag, eg -O0 on gcc).
+ */
+#ifndef __cplusplus
+#define NS_ALLOW_INLINING
+#endif
+
+/* There is inlining problem in GCC version 4.1.x and we know it works in 4.6.3 */
+#if defined __GNUC__ && NS_GCC_VERSION < 40600
+#undef NS_ALLOW_INLINING
+#endif
+
+/** \brief Mark a potentially-inlineable function.
+ *
+ * We follow C99 semantics, which requires precisely one external definition.
+ * To also allow inlining to be totally bypassed under control of
+ * NS_ALLOW_INLINING, code can be structured as per the example of ns_list:
+ *
+ * foo.h
+ * -----
+ * ~~~
+ *    NS_INLINE int my_func(int);
+ *
+ *    #if defined NS_ALLOW_INLINING || defined FOO_FN
+ *    #ifndef FOO_FN
+ *    #define FOO_FN NS_INLINE
+ *    #endif
+ *    FOO_FN int my_func(int a)
+ *    {
+ *        definition;
+ *    }
+ *    #endif
+ * ~~~
+ * foo.c
+ * -----
+ * ~~~
+ *    #define FOO_FN extern
+ *    #include "foo.h"
+ * ~~~
+ * Which generates:
+ * ~~~
+ *                 NS_ALLOW_INLINING set          NS_ALLOW_INLINING unset
+ *                 =====================          =======================
+ *                 Include foo.h                  Include foo.h
+ *                 -------------                  -------------
+ *                 inline int my_func(int);       int my_func(int);
+ *
+ *                 // inline definition
+ *                 inline int my_func(int a)
+ *                 {
+ *                     definition;
+ *                 }
+ *
+ *                 Compile foo.c                  Compile foo.c
+ *                 -------------                  -------------
+ *    (from .h)    inline int my_func(int);       int my_func(int);
+ *
+ *                 // external definition
+ *                 // because of no "inline"      // normal external definition
+ *                 extern int my_func(int a)      extern int my_func(int a)
+ *                 {                              {
+ *                     definition;                    definition;
+ *                 }                              }
+ * ~~~
+ *
+ * Note that even with inline keywords, whether the compiler inlines or not is
+ * up to it. For example, gcc at "-O0" will not inline at all, and will always
+ * call the real functions in foo.o, just as if NS_ALLOW_INLINING was unset.
+ * At "-O2", gcc could potentially inline everything, meaning that foo.o is not
+ * referenced at all.
+ *
+ * Alternatively, you could use "static inline", which gives every caller its
+ * own internal definition. This is compatible with C++ inlining (which expects
+ * the linker to eliminate duplicates), but in C it's less efficient if the code
+ * ends up non-inlined, and it's harder to breakpoint. I don't recommend it
+ * except for the most trivial functions (which could then probably be macros).
+ */
+#ifdef NS_ALLOW_INLINING
+#define NS_INLINE inline
+#else
+#define NS_INLINE
+#endif
+
+#if defined __SDCC_mcs51 || defined __ICC8051__ || defined __C51__
+
+/* The 8051 environments: SDCC (historic), IAR (current), Keil (future?) */
+
+#define NS_LARGE			__xdata
+#define NS_LARGE_PTR		__xdata
+#ifdef __ICC8051__
+#define NS_REENTRANT
+#define NS_REENTRANT_PREFIX	__idata_reentrant
+#else
+#define NS_REENTRANT		__reentrant
+#define NS_REENTRANT_PREFIX
+#endif
+#define NS_NEAR_FUNC		__near_func
+
+#else
+
+/* "Normal" systems. Define it all away. */
+#define NS_LARGE
+#define NS_LARGE_PTR
+#define NS_REENTRANT
+#define NS_REENTRANT_PREFIX
+#define NS_NEAR_FUNC
+
+#endif
+
+/** \brief Scatter-gather descriptor
+ *
+ * Slightly optimised for small platforms - we assume we won't need any
+ * element bigger than 64K.
+ */
+typedef struct ns_iovec
+{
+	void *iov_base;
+	uint_fast16_t iov_len;
+} ns_iovec_t;
+#endif /* NS_TYPES_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ca/source/threading_alt.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,11 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: The configuration for mbedtls.
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_THREADING_ALT_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_THREADING_ALT_H
+
+typedef void* mbedtls_threading_mutex_t;
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_THREADING_ALT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_coap_downloader.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,17 @@
+#pragma once
+#include "baidu_iot_ota_downloader.h"
+#include "url.h"
+#include "coap_client.h"
+
+class OTACoapDownloader: public IOTADownloader
+{
+public:
+    OTACoapDownloader(URL *url, const char* cert=0);
+    virtual ~OTACoapDownloader();
+    virtual int connect();
+    virtual unsigned int get(data_available_cb cb, void* ctx);
+    virtual int disconnect();
+private:
+    URL *m_pUrl;
+    CoapsClient* m_pCoapsClient;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_decompresser.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,9 @@
+#pragma once
+
+class OTADecompresser
+{
+public:
+    OTADecompresser();
+    ~OTADecompresser();
+    unsigned int decompress(unsigned char buffer[], unsigned int size, unsigned char output[], unsigned int out_size);
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_downloader.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,16 @@
+#pragma once
+/**
+ * File: baidu_iot_ota_downloader.h
+ * Auth: Duan Lian(duanlian01@baidu.com)
+ * Date: 2016.12.21
+ * Desc: The OTA downloader interface
+ */
+typedef int (*data_available_cb)(unsigned char* data, unsigned int len, void* ctx);
+class IOTADownloader
+{
+public:
+	  virtual ~IOTADownloader(){};
+		virtual int connect()=0;
+	  virtual unsigned int get(data_available_cb cb, void* ctx)=0;
+    virtual int disconnect()=0;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_error.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,6 @@
+#pragma once
+
+enum error_code {
+    OTA_NO_ENOUGH_MEM = -1,
+    OTA_GET_DATA_FAILED = -2,
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_http_downloader.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,18 @@
+#pragma once
+#include "baidu_iot_ota_downloader.h"
+#include "url.h"
+#include "baidu_http_client.h"
+
+class OTAHttpDownloader: public IOTADownloader
+{
+public:
+	  OTAHttpDownloader(URL *url);
+    virtual ~OTAHttpDownloader();
+    virtual int connect();
+    virtual unsigned int get(data_available_cb cb, void* ctx);
+    virtual int disconnect();
+private:
+    static int data_available(void *ctx, e_data_pos pos, const char *buf, size_t len, const char *type);
+    duer::HttpClient *http_client;
+    char *m_pUrl;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_log.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,24 @@
+#pragma once
+#include <stdio.h>
+
+#define DEBUG_LEVEL_INF    3
+#define DEBUG_LEVEL_DBG    2
+#define DEBUG_LEVEL_WRN    1
+#define DEBUG_LEVEL_ERR    0
+#define OTA_DEBUG_LEVEL    DEBUG_LEVEL_ERR
+
+#define OTA_LOG(format, level, ...) do \
+                                    { \
+																		    if (OTA_DEBUG_LEVEL >= level) \
+																				{ \
+																					  printf("%s:%s: "format, __FILE__, __FUNCTION__, ##__VA_ARGS__); \
+																				} \
+																		}while(0);
+
+#define OTA_LOG_INFO(format, ...) OTA_LOG(format, DEBUG_LEVEL_INF, __VA_ARGS__)
+#define OTA_LOG_DBG(format, ...)  OTA_LOG(format, DEBUG_LEVEL_DBG, __VA_ARGS__)
+#define OTA_LOG_WARN(format, ...) OTA_LOG(format, DEBUG_LEVEL_WRN, __VA_ARGS__)
+#define OTA_LOG_ERR(format, ...)  OTA_LOG(format, DEBUG_LEVEL_ERR, __VA_ARGS__)
+
+#define OTA_FUNC_ENTER() OTA_LOG_INFO("enter %s:%s\n", __FILE__, __FUNCTION__)
+#define OTA_FUNC_LEAVE() OTA_LOG_INFO("leave %s:%s\n", __FILE__, __FUNCTION__)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_manager.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,63 @@
+/**
+ * File: baidu_iot_ota_manager.h
+ * Auth: Duan Lian(duanlian01@baidu.com)
+ * Date: 2016.12.21
+ * Desc: The OTA Manager
+ */
+#pragma once
+#include "rtos.h"
+#include "shared_buffer.h"
+#include "baidu_iot_ota_reporter.h"
+//#include "baidu_iot_ota_package_scanner.h"  //k64f
+#ifdef TARGET_UNO_91H
+#include "package_scanner.h"     //rda
+#endif
+#define OPTIONAL_UPDATE 0
+#define MANDATED_UPDATE  1
+
+
+struct OTAServerUpdateCommand
+{
+	  char transaction[65];
+	  char version[16];
+	  char old_version[16];
+	  char url[129];
+	  char signature[129];
+	  unsigned int size;
+};
+
+class OTAManager
+{
+public:
+    static OTAManager* instance();
+	  ~OTAManager();
+	  int checkUpdates(const char *command = 0);
+    int syncPackageInfo();
+
+    int getOSInfo(os_info_t& info);
+private:
+	  enum {SHARED_BUFFER_SIZE = 2048};
+		SharedBuffer m_SharedBuffer;
+    static OTAManager _manager;
+    bool           m_bIdle;
+		char          *m_pUpdateCommand;
+		OTAReporter   *m_pReporter;
+    rtos::Thread  *m_pThread;
+    rtos::Thread  *m_pRestart_thread;
+    rtos::Mutex    m_Lock;
+		rtos::Semaphore *m_pInstallComplete;
+		#ifdef TARGET_UNO_91H
+		PackageScanner m_Scanner;
+		#endif
+
+    OTAManager();
+		//check if updates are available and perform downloading
+    void run_downloader();
+		int contact_ota_server();
+		int parse_update_command(const char* str_command, OTAServerUpdateCommand &command);
+		//decrypt package and write data to storage
+    void run_installer();
+    int applyUpdates(const OTAServerUpdateCommand& command);
+		static int data_available(unsigned char* data, unsigned int len, void* ctx);
+        static void ota_resart();
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_reporter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,42 @@
+#pragma once
+#include "rtos.h"
+#include "package_info.h"
+#include "baidu_ca_object.h"
+
+class OTAReporter
+{
+public:
+    OTAReporter(const char *transaction_id);
+    ~OTAReporter();
+    enum {
+        OTA_STATE_IDLE=0,
+        OTA_STATE_DOWNLOADING,
+        OTA_STATE_DOWNLOADED,
+        OTA_STATE_INSTALLING,
+        OTA_STATE_INSTALLED
+    };
+    enum {
+        OTA_EVENT_BEGIN,
+        OTA_EVENT_CONNECT_FAIL,
+        OTA_EVENT_CONNECTION_LOST,
+        OTA_EVENT_TIMEOUT,
+        OTA_EVENT_DOWNLOADING,
+        OTA_EVENT_DOWNLOAD_COMPLETE,
+        OTA_EVENT_DOWNLOAD_FAIL,
+        OTA_EVENT_INSTALLING,
+        OTA_EVENT_IMAGE_INVALID,
+        OTA_EVENT_WRITE_ERROR,
+        OTA_EVENT_INSTALLED,
+        OTA_EVENT_DELETED,
+        OTA_EVENT_REJECT,
+    };
+    int report_state(int state, ...);
+    int report_event(int event, ...);
+    static int report_package_info(os_info_t& os);
+    static void ota_report_status(duer::Object& values);
+private:
+    static void get_packageInfo(duer::Object& obj);
+    char *m_szTransaction_id;
+    int m_current_event;
+    rtos::Mutex    m_Lock;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/new_firmware_image_unpack_tool.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,43 @@
+/*
+ * NewFirmwareImageUnpackTool.h
+ *
+ *  Created on: 2016-7-12
+ *      Author: duanlian01
+ */
+
+#ifndef NEWFIRMWAREIMAGEUNPACKTOOL_H_
+#define NEWFIRMWAREIMAGEUNPACKTOOL_H_
+#include "IOtaUpdater.h"
+
+class OTAReporter;
+
+class NewFirmwareImageUnpackTool {
+public:
+	NewFirmwareImageUnpackTool(unsigned int decompress_chunk_size, unsigned int resource_size, IOtaUpdater *updater, void *update_cxt, OTAReporter *reporter);
+	virtual ~NewFirmwareImageUnpackTool();
+	virtual int unpack_ota_package_begin();
+	virtual int unpack_ota_package(unsigned char* data, unsigned int len);
+  virtual int unpack_ota_package_end();
+
+  virtual int update_image_begin();
+	virtual int update_image();
+  virtual int update_image_end();
+
+private:
+	unsigned int resource_size;
+  unsigned int resource_offset;
+  double download_percent;
+	unsigned int chunk_size;
+	unsigned char *cache;
+	unsigned int  in_size;
+
+	void* verification_cxt;
+  void* decompress_ctx;
+
+  IOtaUpdater *updater;
+  void *update_cxt;
+
+  OTAReporter *m_pReporter;
+};
+
+#endif /* NEWFIRMWAREIMAGEUNPACKTOOL_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/IOtaUpdater.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,78 @@
+/*
+ * IOtaUpdater.h
+ *
+ *  Created on: 2016-7-15
+ *      Author: duanlian01
+ */
+
+#ifndef IOTAUPDATER_H_
+#define IOTAUPDATER_H_
+
+#define PACKAGE_NAME_LENGTH_MAX (15)
+#define PACKAGE_TYPE_OS      1
+#define PACKAGE_TYPE_APP     2
+#define PACKAGE_NO_UPDATE    0
+#define PACKAGE_UPDATE       1
+
+struct meta_data_basic_info{
+	char package_name[PACKAGE_NAME_LENGTH_MAX + 1];
+	unsigned char package_type;
+	unsigned char package_update;
+};
+
+
+#define MODULE_NAME_LENGTH_MAX (PACKAGE_NAME_LENGTH_MAX)
+#define MODULE_VERSION_LENGTH_MAX 15
+#define HARDWARE_VERSION_LENGTH_MAX 15
+#define MODULE_SIGNATURE_LENGTH     16
+#define MODULE_TYPE_BIN 1
+#define MODULE_NO_UPDATE 0
+#define MODULE_UPDATE 1
+
+struct module_info{
+	char module_name[MODULE_NAME_LENGTH_MAX + 1];
+	char module_version[MODULE_VERSION_LENGTH_MAX + 1];
+	char module_support_hw_version[HARDWARE_VERSION_LENGTH_MAX + 1];
+	unsigned char module_signature[MODULE_SIGNATURE_LENGTH];
+	unsigned int module_size;
+	unsigned char module_type;
+	unsigned char module_update;
+};
+
+#define PACKAGE_INSTALL_PATH_MAX  255
+struct meta_data_install_info{
+	char package_install_path[PACKAGE_INSTALL_PATH_MAX + 1];
+	unsigned int module_count;
+	struct module_info *module_list;
+};
+
+#define PACKAGE_VERSION_LENGTH MODULE_VERSION_LENGTH_MAX
+struct meta_data_update_info{
+	char package_version[PACKAGE_VERSION_LENGTH];
+};
+
+struct meta_data_extension{
+	unsigned int pair_count;
+	char **keys;
+	char **values;
+};
+
+struct package_meta_data{
+	struct meta_data_basic_info basic_info;
+    struct meta_data_install_info install_info;
+    struct meta_data_update_info update_info;
+    struct meta_data_extension extension_info;
+};
+
+struct IOtaUpdater
+{
+    int (*notify_data_begin)();
+	int (*notify_meta_data)(void *cxt, struct package_meta_data *meta);
+	int (*notify_module_data)(void *cxt, unsigned int offset, unsigned char *data, unsigned int size);
+	int (*notify_data_end)();
+	int (*update_img_begin)();
+	int (*update_img)();
+	int (*update_img_end)();
+};
+
+#endif /* IOTAUPDATER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/cJSON.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,149 @@
+/*
+  Copyright (c) 2009 Dave Gamble
+ 
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+ 
+  The above copyright notice and this permission notice shall be included in
+  all copies or substantial portions of the Software.
+ 
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+  THE SOFTWARE.
+*/
+
+#ifndef cJSON__h
+#define cJSON__h
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* cJSON Types: */
+#define cJSON_False 0
+#define cJSON_True 1
+#define cJSON_NULL 2
+#define cJSON_Number 3
+#define cJSON_String 4
+#define cJSON_Array 5
+#define cJSON_Object 6
+	
+#define cJSON_IsReference 256
+#define cJSON_StringIsConst 512
+
+/* The cJSON structure: */
+typedef struct cJSON {
+	struct cJSON *next,*prev;	/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
+	struct cJSON *child;		/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
+
+	int type;					/* The type of the item, as above. */
+
+	char *valuestring;			/* The item's string, if type==cJSON_String */
+	int valueint;				/* The item's number, if type==cJSON_Number */
+	double valuedouble;			/* The item's number, if type==cJSON_Number */
+
+	char *string;				/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
+} cJSON;
+
+typedef struct cJSON_Hooks {
+      void *(*malloc_fn)(size_t sz);
+      void (*free_fn)(void *ptr);
+} cJSON_Hooks;
+
+/* Supply malloc, realloc and free functions to cJSON */
+extern void cJSON_InitHooks(cJSON_Hooks* hooks);
+
+
+/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
+extern cJSON *cJSON_Parse(const char *value);
+/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
+extern char  *cJSON_Print(cJSON *item);
+/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
+extern char  *cJSON_PrintUnformatted(cJSON *item);
+/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
+extern char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt);
+/* Delete a cJSON entity and all subentities. */
+extern void   cJSON_Delete(cJSON *c);
+
+/* Returns the number of items in an array (or object). */
+extern int	  cJSON_GetArraySize(cJSON *array);
+/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
+extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
+/* Get item "string" from object. Case insensitive. */
+extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
+
+/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
+extern const char *cJSON_GetErrorPtr(void);
+	
+/* These calls create a cJSON item of the appropriate type. */
+extern cJSON *cJSON_CreateNull(void);
+extern cJSON *cJSON_CreateTrue(void);
+extern cJSON *cJSON_CreateFalse(void);
+extern cJSON *cJSON_CreateBool(int b);
+extern cJSON *cJSON_CreateNumber(double num);
+extern cJSON *cJSON_CreateString(const char *string);
+extern cJSON *cJSON_CreateArray(void);
+extern cJSON *cJSON_CreateObject(void);
+
+/* These utilities create an Array of count items. */
+extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
+extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
+extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
+extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
+
+/* Append item to the specified array/object. */
+extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
+extern void	cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
+extern void	cJSON_AddItemToObjectCS(cJSON *object,const char *string,cJSON *item);	/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object */
+/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
+extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
+extern void	cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
+
+/* Remove/Detatch items from Arrays/Objects. */
+extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
+extern void   cJSON_DeleteItemFromArray(cJSON *array,int which);
+extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
+extern void   cJSON_DeleteItemFromObject(cJSON *object,const char *string);
+	
+/* Update array items. */
+extern void cJSON_InsertItemInArray(cJSON *array,int which,cJSON *newitem);	/* Shifts pre-existing items to the right. */
+extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
+extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
+
+/* Duplicate a cJSON item */
+extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
+/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
+need to be released. With recurse!=0, it will duplicate any children connected to the item.
+The item->next and ->prev pointers are always zero on return from Duplicate. */
+
+/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
+extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
+
+extern void cJSON_Minify(char *json);
+
+/* Macros for creating things quickly. */
+#define cJSON_AddNullToObject(object,name)		cJSON_AddItemToObject(object, name, cJSON_CreateNull())
+#define cJSON_AddTrueToObject(object,name)		cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
+#define cJSON_AddFalseToObject(object,name)		cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
+#define cJSON_AddBoolToObject(object,name,b)	cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
+#define cJSON_AddNumberToObject(object,name,n)	cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
+#define cJSON_AddStringToObject(object,name,s)	cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
+
+/* When assigning an integer value, it needs to be propagated to valuedouble too. */
+#define cJSON_SetIntValue(object,val)			((object)?(object)->valueint=(object)->valuedouble=(val):(val))
+#define cJSON_SetNumberValue(object,val)		((object)?(object)->valueint=(object)->valuedouble=(val):(val))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/datacollector.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,96 @@
+
+#ifndef _MBED_PACK_DATAC_
+#define _MBED_PACK_DATAC_
+
+#include "pack_include.h"
+#include "cJSON.h"
+
+
+/**
+ *
+ * build meta.json data object
+ *
+ * \return ctx to collect package data
+ *
+ */
+void* mbed_build_pck_config_block(unsigned char* filename);
+
+
+/**
+ *
+ * destory meta.json data object
+ *
+ * \param ctx to collect package data
+ *
+ */
+void mbed_destroy_pck_config_block(meta_info_t* ctx);
+
+
+/**
+ * pre-build module, init for extract module from package
+ *
+ * \param meta_object meta.json object decompress from package
+ * \param module_info module info extracted from package by parse meta.json
+ * \param index index of module record in record
+ * \return 0 if success, or failed
+ */
+int mbed_prebuild_module(cJSON* meta_object, module_info_t* module_info, uint8_t index);
+
+/**
+ * post-build module, uninit for extract module from package
+ *
+ * \param module module info extracted from package by parse meta.json
+ */
+void mbed_postbuild_module(module_info_t* module);
+
+/**
+ * main operation of decompressing package
+ *
+ * \param package_bin original data of package
+ * \param package_bin_size original package size
+ * \return 0 if success, or failed
+ */
+//int mbed_decompress(decompress_info_t* decompress_info, unsigned char* package_bin, uint32_t package_bin_size);
+
+/**
+ * get module count by parse meta.json
+ *
+ * \param meta_object meta.json object
+ * \param type the type caller want to get
+ * \return if successful retrun module count, or return -1
+ */
+uint8_t mbed_get_module_num(cJSON* meta_object, module_type_t type);
+
+/**
+ * get module info from meta.json and modules array data
+ *
+ * \param meta_data meta.json data
+ * \param module_begin_offset, modules begin offset from package
+ * \param module_info used for store signle module info 
+ * \param index index of module in modules array
+ * \return 0 if success, or failed
+ */
+int mbed_get_module_info(cJSON* meta_object, uint32_t module_begin_offset, module_info_t* module_info, uint8_t index);
+
+/**
+ * get module info from meta.json and modules array data
+ *
+ * \param meta_data meta.json data
+ * \param name package name
+ *\ param name_len length of name
+ * \return 0 if success, or failed
+ */
+int mbed_get_pkg_name(cJSON* meta_object, unsigned char* name, uint8_t* name_len);
+
+/**
+ * get package type info from meta.json
+ *
+ * \param meta_data meta.json data
+ * \param type package type
+ * \return 0 if success, or failed
+ */
+int mbed_get_pkg_type(cJSON* meta_object, package_type_t* type);
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/decompress.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,74 @@
+
+#ifndef _MBED_PACK_DECRYPTION_
+#define _MBED_PACK_DECRYPTION_
+
+#include <stdint.h>
+#include "pack_include.h"
+#include "zliblite/zlib.h"
+#include "IOtaUpdater.h"
+
+typedef struct _decompress_context_ {
+	// internal_footprint
+	uint32_t stream_recieved_sz;	// current size of recieved stream
+	uint32_t stream_processed_sz;	// current size of processed stream
+
+	//cache meta data
+	unsigned int meta_size;
+	unsigned int meta_stored_size;
+	char *meta_data;
+
+	//module data write offset
+	unsigned int write_offset;
+	// zlib stream object
+	z_streamp strmp;
+
+} decompress_context_t;
+
+/**
+ *
+ * package decompress
+ *
+ * \return decompress context
+ */
+void* mbed_zlibstream_decompress_init();
+
+
+/**
+ *
+ * package decompress process
+ *
+ * \param ctx decompress context
+ * \param buffer data to decompress
+ * \param bufferSZ buffer size
+ * \param lFileHandle fs file index
+ *
+ * \return process state
+ */
+int mbed_zlibstream_decompress_process(void *verify_cxt, decompress_context_t* ctx, unsigned char* buffer, uint32_t bufferSZ,
+		struct IOtaUpdater *updater, void *update_cxt);
+
+
+/**
+ *
+ * package decompress uninit
+ *
+ * \param ctx decompress context
+ *
+ */
+void mbed_zlibstream_decompress_uninit(decompress_context_t* ctx);
+
+
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
+// for test
+//void mbed_decompress_test();
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/fs.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,153 @@
+
+
+#ifndef _MBED_FS_H_
+#define _MBED_FS_H_
+
+/*  sl_FsOpen options */
+/*  Open for Read */
+#define FS_MODE_OPEN_READ                                     0
+/*  Open for Write (in case file exist) */
+#define FS_MODE_OPEN_WRITE                                    1
+     
+
+/*****************************************************************************/
+/* Function prototypes                                                       */
+/*****************************************************************************/
+
+/*!
+    \brief open file for read or write from/to storage device
+    
+    \param[in]      pFileName                  File Name buffer pointer  
+    \param[in]      AccessModeAndMaxSize       Options: As described below
+    \param[in]      pToken                     Reserved for future use. Use NULL for this field
+    \param[out]     pFileHandle      Pointing on the file and used for read and write commands to the file     
+     
+     AccessModeAndMaxSize possible input                                                                        \n
+     FS_MODE_OPEN_READ                                        - Read a file                                                                  \n
+     FS_MODE_OPEN_WRITE                                       - Open for write for an existing file                                          \n
+     FS_MODE_OPEN_CREATE(maxSizeInBytes,accessModeFlags)      - Open for creating a new file. Max file size is defined in bytes.             \n
+                                                                For optimal FS size, use max size in 4K-512 bytes steps (e.g. 3584,7680,117760)  \n
+                                                                Several access modes bits can be combined together from SlFileOpenFlags_e enum
+
+    \return         On success, zero is returned. On error, an error code is returned    
+    
+    \sa             sl_FsRead sl_FsWrite sl_FsClose       
+    \note           belongs to \ref basic_api       
+    \warning        
+    \par            Example:
+    \code
+       char*           DeviceFileName = "MyFile.txt";
+       unsigned long   MaxSize = 63 * 1024; //62.5K is max file size
+       long            DeviceFileHandle = -1;
+       long            RetVal;        //negative retval is an error
+       unsigned long   Offset = 0;
+       unsigned char   InputBuffer[100];
+
+       // Create a file and write data. The file in this example is secured, without signature and with a fail safe commit
+       RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
+                                        FS_MODE_OPEN_CREATE(MaxSize , _FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST | _FS_FILE_OPEN_FLAG_COMMIT ),
+                                        NULL, &DeviceFileHandle);
+
+       Offset = 0;
+       //Preferred in secure file that the Offset and the length will be aligned to 16 bytes.
+       RetVal = sl_FsWrite( DeviceFileHandle, Offset, (unsigned char *)"HelloWorld", strlen("HelloWorld"));
+
+       RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
+
+       // open the same file for read, using the Token we got from the creation procedure above
+       RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
+                                        FS_MODE_OPEN_READ,
+                                        NULL, &DeviceFileHandle);
+
+       Offset = 0;
+       RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld"));
+
+       RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
+
+     \endcode
+*/
+int32_t sl_FsOpen(const uint8_t *pFileName,const uint32_t AccessModeAndMaxSize,uint32_t *pToken,int32_t *pFileHandle);
+
+/*!
+    \brief close file in storage device
+    
+    \param[in]      FileHdl                 Pointer to the file (assigned from sl_FsOpen) 
+    \param[in]      pCeritificateFileName   Reserved for future use. Use NULL.
+    \param[in]      pSignature              Reserved for future use. Use NULL.
+    \param[in]      SignatureLen            Reserved for future use. Use 0.
+                    
+
+    \return         On success, zero is returned.  On error, an error code is returned   
+    
+    \sa             sl_FsRead sl_FsWrite sl_FsOpen        
+    \note           Call the fs_Close  with signature = 'A' signature len = 1 for activating an abort action
+    \warning
+    \par            Example:
+    \code            
+    sl_FsClose(FileHandle,0,0,0);
+    \endcode
+*/
+int16_t sl_FsClose(const int32_t FileHdl,const uint8_t* pCeritificateFileName,const uint8_t* pSignature,const uint32_t SignatureLen);
+
+/*!
+    \brief Read block of data from a file in storage device
+    
+    \param[in]      FileHdl Pointer to the file (assigned from sl_FsOpen)    
+    \param[in]      Offset  Offset to specific read block
+    \param[out]     pData   Pointer for the received data
+    \param[in]      Len     Length of the received data
+     
+    \return         On success, returns the number of read bytes. On error, negative number is returned    
+    
+    \sa             sl_FsClose sl_FsWrite sl_FsOpen        
+    \note           belongs to \ref basic_api       
+    \warning     
+    \par            Example:
+    \code    
+    Status = sl_FsRead(FileHandle, 0, &readBuff[0], readSize);
+    \endcode
+*/
+int32_t sl_FsRead(const int32_t FileHdl, uint32_t Offset , uint8_t*  pData, uint32_t Len);
+
+/*!
+    \brief write block of data to a file in storage device
+    
+    \param[in]      FileHdl  Pointer to the file (assigned from sl_FsOpen)  
+    \param[in]      Offset   Offset to specific block to be written
+    \param[in]      pData    Pointer the transmitted data to the storage device
+    \param[in]      Len      Length of the transmitted data
+     
+    \return         On success, returns the number of written bytes.  On error, an error code is returned
+    
+    \sa                     
+    \note           belongs to \ref basic_api       
+    \warning     
+    \par            Example:
+    \code    
+    Status = sl_FsWrite(FileHandle, 0, &buff[0], readSize);
+    \endcode
+*/
+int32_t sl_FsWrite(const int32_t FileHdl, uint32_t Offset, uint8_t*  pData, uint32_t Len);
+
+/*!
+    \brief get info on a file
+    
+    \param[in]      pFileName    File name
+    \param[in]      Token        Reserved for future use. Use 0
+    \param[out]     pFsFileInfo Returns the File's Information: flags,file size, allocated size and Tokens 
+     
+    \return         On success, zero is returned.   On error, an error code is returned    
+    
+    \sa             sl_FsOpen        
+    \note           belongs to \ref basic_api       
+    \warning        
+    \par            Example:
+    \code    
+    Status = sl_FsGetInfo("FileName.html",0,&FsFileInfo);
+    \endcode
+*/
+
+
+
+#endif /*  __FS_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/pack_include.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,169 @@
+
+#ifndef _MBED_OTA_PACK_INCLUDE_
+#define _MBED_OTA_PACK_INCLUDE_
+#include <stdint.h>
+
+#define KEY_LEN	128
+
+#define _DEBUG_
+//#define _DEBUG_OUT_
+
+#ifndef _DEBUG_OUT_
+	#define MBEDPACK_DEBUG_PRINT bca_printf
+#else
+	#define MBEDPACK_DEBUG_PRINT	printf
+#endif
+
+///
+/// package header
+typedef struct _package_header {
+
+   ///
+   /// 'mbed' verify tag
+   unsigned char tag[4];
+
+   ///
+   /// package header size
+   uint32_t header_size;
+
+   ///
+   /// package signature size : 1024 bits
+   uint32_t package_sig_size;
+   ///
+   /// package signature : include meta.json and all modules
+   unsigned char package_sig[KEY_LEN];
+
+   ///
+   /// meta.json signature size : 1024 bits
+   uint32_t meta_sig_size;
+   ///
+   /// meta.json signature
+   unsigned char meta_sig[KEY_LEN];
+
+   ///
+   /// meta.json size : used for decompress meta.json from package body
+   uint32_t meta_size;
+
+   ///
+   /// package size before decompress
+   uint32_t ori_package_size;
+
+} package_header_t;
+
+///
+/// all modules included in mbed package is 'js' and mbed executable '.bin' file
+typedef enum _module_type {
+	ModuleTypeALL,
+	ModuleTypeJS,
+	ModuleTypeSO,
+	ModuleTypeBIN,
+	ModuleTypeJSON,
+	ModuleTypeIMG
+} module_type_t;
+
+
+typedef struct _file_type_pair {
+	char* string;
+	module_type_t type;
+} file_type;
+
+
+typedef enum _package_type {
+	PackageTypeApp,
+	PackageTypeOS,
+	PackageTypeProfile,
+	PackageTypeUnknown
+} package_type_t;
+/*
+typedef enum {
+	false = 0,
+	true
+} bool;*/
+
+/*
+///
+/// package body modules info excluding meta.json
+typedef struct _module_info {
+
+   ///
+   /// module name : xx.js / xx.bin
+   unsigned char* name;
+
+   ///
+   /// module type : js / bin
+   module_type_t type;
+
+   uint32_t  module_size;
+   uint8_t  update;
+   unsigned char* version;
+   unsigned char* hw_version;
+
+   ///
+   /// module data
+   unsigned char* data;
+} module_info_t;
+
+///
+/// decompress info : used for extract meta data and modules array data
+typedef struct _decompress_info {
+
+   ///
+   /// decompressed meta data size
+   uint32_t decompress_meta_data_size;
+   ///
+   /// decompressed meta data from package body
+   unsigned char* decompress_meta_data;
+
+   ///
+   /// decompressed modules array data size
+   uint32_t decompress_module_data_size;
+   ///
+   /// decompressed modules array data from package body
+   unsigned char* decompress_module_data;   
+} decompress_info_t;
+*/
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct _module_info {
+
+   ///
+   /// module name : xx.js / xx.bin
+   unsigned char* name;
+
+   ///
+   /// module type : js / bin
+   module_type_t type;
+
+   uint32_t  module_size;
+   uint8_t  update;
+   unsigned char* version;
+   unsigned char* hw_version;
+   uint32_t offset;  // offset from file begin
+
+} module_info_t;
+
+///
+/// meta info : used for extract meta data and modules array data
+typedef struct _meta_info {
+
+   ///
+   /// decompressed meta data size
+   uint32_t meta_data_size;
+
+   ///
+   /// decompressed module data offset
+   uint32_t module_data_offset;
+
+   ///
+   /// decompressed meta data
+   unsigned char* meta_data;
+
+   ///
+   /// json object
+   void* meta_object;
+} meta_info_t;
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/package_api.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,214 @@
+
+#ifndef _MBED_PACK_INCLUDE_
+#define _MBED_PACK_INCLUDE_
+
+#ifdef __cplusplus
+#define MBEDPACK_EXTERN extern "C"
+#else
+#define MBEDPACK_EXTERN extern
+#endif
+
+#include "pack_include.h"
+#include <stdint.h>
+
+///
+/// all modules type can included in package
+/*typedef enum _module_type {
+	ModuleTypeALL,
+	ModuleTypeJS,
+	ModuleTypeSO,
+	ModuleTypeBIN,
+	ModuleTypeJSON,
+	ModuleTypeIMG
+} module_type_t;
+*/
+///
+/// package type : a package can contain app, os or profile
+/*typedef enum _package_type {
+	PackageTypeApp,
+	PackageTypeOS,
+	PackageTypeProfile,
+	PackageTypeUnknown
+} package_type_t;
+*/
+/*
+typedef enum {
+	false = 0,
+	true
+} bool;*/
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * verification init
+ *
+ * \return verification context if success, or NULL
+ */
+MBEDPACK_EXTERN void* mbed_verification_init();
+
+/**
+ * verification update context
+ *
+ * \param ctx verification context
+ * \param buffer data to update context
+ * \param buffer_size data size
+ */
+MBEDPACK_EXTERN void mbed_verification_update_ctx(void* ctx, unsigned char* buffer, uint32_t buffer_size);
+
+/**
+ * verify
+ *
+ * \param ctx verification context
+ *
+ * \return 0 if success, or fail
+ */
+MBEDPACK_EXTERN int mbed_verification(void* ctx);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ *
+ * package decompress
+ *
+ * \return decompress context
+ */
+MBEDPACK_EXTERN void* mbed_decompress_init();
+
+
+/**
+ *
+ * package decompress process
+ *
+ * \param ctx decompress context
+ * \param buffer data to decompress
+ * \param bufferSZ buffer size
+ * \param lFileHandle fs file index
+ *
+ * \return process state
+ */
+MBEDPACK_EXTERN int mbed_decompress_process(void * verify_cxt, void* ctx, unsigned char* buffer, uint32_t bufferSZ, struct IOtaUpdater *updater, void *update_cxt);
+
+
+/**
+ *
+ * package decompress uninit
+ *
+ * \param ctx decompress context
+ *
+ */
+MBEDPACK_EXTERN void mbed_decompress_uninit(void* ctx);
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+/**
+ *
+ * package info collector init
+ *
+ * \return ctx collector context
+ *
+ */
+MBEDPACK_EXTERN void* mbed_data_collector_init(unsigned char* filename);
+
+
+/**
+ *
+ * package info collector uninit
+ *
+ * \param ctx collector context
+ *
+ */
+MBEDPACK_EXTERN void mbed_data_collector_uninit(void* ctx);
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * get a certain type module count
+
+ *
+ * \param ctx package context
+ * \param type module type of js , bin or all
+ * \return module count of a certain type if success, or 0
+ */
+MBEDPACK_EXTERN uint8_t pkg_get_module_count(void* ctx, module_type_t type);
+
+
+/**
+
+ * get module handle
+ *
+ * \param ctx package context
+ * \param type module type of js , bin or all
+
+ * \param index index of module
+ * \return module handle of a certain type if success, or 0
+ */
+MBEDPACK_EXTERN void* /*handle*/pkg_acquire_module(void* ctx, module_type_t type, int index);
+
+
+/**
+ * release module handle
+ *
+ * \param handle module handle to release
+ */
+MBEDPACK_EXTERN void pkg_release_module(void* handle);
+
+
+/**
+ * get module name
+ *
+ * \param handle module handle to operate module
+ * \return module name if success, or NULL
+ */
+MBEDPACK_EXTERN const char* pkg_get_module_name(void* handle);
+
+
+/**
+ * get module version : software version or hardware version
+ *
+ * \param handle module handle to operate module
+ * \param hardware_version version caller cared
+ * \return module version if success, or NULL
+ */
+MBEDPACK_EXTERN const char* pkg_get_module_version(void* handle, bool hardware_version);
+
+
+/**
+ * get module offset and size, user can read module data from fs
+ *
+ * \param handle module handle to operate module
+ * \param offset offset to the beginning of package
+ * \param size module size if success or 0
+ * \return 0 if success, or fail
+ */
+MBEDPACK_EXTERN int pkg_locate_module_data(void* handle, uint32_t* offset, uint32_t* size);
+
+/**
+ * get package name
+ *
+ * \param ctx package context
+ * \param name package name
+ * \param name_length length of name
+ * \return 0 if success, 1 means no enough length buffer and return length need, or failed
+ */
+MBEDPACK_EXTERN int pkg_get_pkg_name(void* ctx, unsigned char* name, uint8_t* name_length);
+
+/**
+ * get package type
+ *
+ * \param ctx package context
+ * \param type package type
+ * \return 0 if success, or fail
+ */
+MBEDPACK_EXTERN int pkg_get_pkg_type(void* ctx, package_type_t* type);
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/ota/inc/verification.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,73 @@
+
+#ifndef _MBEDPACK_VERIFICATION_H
+#define _MBEDPACK_VERIFICATION_H
+
+#include "mbedtls/rsa.h"
+#include "mbedtls/sha1.h"
+#include "pack_include.h"
+
+typedef struct _verification_context_ {
+	// internal footprint
+	uint32_t stream_recieved_sz;	// current size of recieved stream
+	uint32_t stream_processed_sz;	// current size of processed stream
+	uint32_t stream_sig_stored_sz;	// size of pck_header_sig_part
+	unsigned char* pck_header_sig_part;		// package header buffer to pck signature(include), for verify use
+
+	// sha1 context
+	mbedtls_sha1_context* ctx;
+
+} verification_context_t;
+
+/**
+ * init rsa context
+ *
+ * \param rsa_ctx point to an instance of mbedtls_rsa_context struct
+ * \return 0 if success, or failed
+ */
+int mbed_rsa_ca_pkcs1_init(mbedtls_rsa_context* rsa_ctx);
+
+/**
+ * uinit rsa context
+ *
+ * \param rsa_ctx point to an instance of mbedtls_rsa_context struct
+ */
+void mbed_rsa_ca_pkcs1_uninit(mbedtls_rsa_context* rsa_ctx);
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * verification init
+ *
+ * \return verification context if success, or NULL
+ */
+verification_context_t* mbed_hash_init();
+
+/**
+ * verification update key
+ *
+ * \param ctx verification context
+ * \param buffer data source to gen hash
+ * \param buffer_size
+ */
+void mbed_hash_update_key(verification_context_t* ctx, unsigned char* buffer, uint32_t buffer_size);
+
+/**
+ * verify key
+ *
+ * \param ctx verification context
+ * \param buffer data source to gen hash
+ * \param buffer_size
+ *
+ * \return 0 if success, or failed
+ */
+int mbed_rsa_ca_pkcs1_verify(mbedtls_rsa_context* rsa, verification_context_t* ctx);
+
+/**
+ * verification uninit
+ *
+ * \param ctx verification context
+ */
+void mbed_hash_uninit(verification_context_t* ctx);
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/crc32.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,441 @@
+/* crc32.h -- tables for rapid CRC calculation
+ * Generated automatically by crc32.c
+ */
+
+local const z_crc_t FAR crc_table[TBLS][256] =
+{
+  {
+    0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
+    0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
+    0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
+    0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
+    0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
+    0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
+    0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
+    0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
+    0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
+    0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
+    0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
+    0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
+    0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
+    0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
+    0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
+    0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
+    0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
+    0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
+    0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
+    0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
+    0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
+    0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
+    0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
+    0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
+    0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
+    0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
+    0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
+    0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
+    0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
+    0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
+    0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
+    0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
+    0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
+    0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
+    0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
+    0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
+    0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
+    0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
+    0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
+    0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
+    0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
+    0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
+    0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
+    0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
+    0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
+    0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
+    0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
+    0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
+    0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
+    0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
+    0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
+    0x2d02ef8dUL
+#ifdef BYFOUR
+  },
+  {
+    0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
+    0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
+    0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
+    0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
+    0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
+    0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
+    0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
+    0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
+    0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
+    0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
+    0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
+    0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
+    0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
+    0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
+    0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
+    0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
+    0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
+    0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
+    0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
+    0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
+    0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
+    0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
+    0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
+    0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
+    0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
+    0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
+    0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
+    0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
+    0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
+    0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
+    0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
+    0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
+    0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
+    0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
+    0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
+    0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
+    0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
+    0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
+    0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
+    0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
+    0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
+    0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
+    0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
+    0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
+    0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
+    0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
+    0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
+    0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
+    0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
+    0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
+    0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
+    0x9324fd72UL
+  },
+  {
+    0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
+    0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
+    0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
+    0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
+    0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
+    0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
+    0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
+    0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
+    0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
+    0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
+    0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
+    0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
+    0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
+    0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
+    0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
+    0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
+    0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
+    0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
+    0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
+    0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
+    0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
+    0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
+    0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
+    0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
+    0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
+    0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
+    0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
+    0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
+    0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
+    0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
+    0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
+    0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
+    0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
+    0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
+    0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
+    0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
+    0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
+    0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
+    0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
+    0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
+    0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
+    0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
+    0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
+    0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
+    0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
+    0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
+    0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
+    0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
+    0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
+    0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
+    0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
+    0xbe9834edUL
+  },
+  {
+    0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
+    0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
+    0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
+    0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
+    0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
+    0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
+    0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
+    0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
+    0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
+    0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
+    0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
+    0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
+    0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
+    0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
+    0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
+    0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
+    0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
+    0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
+    0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
+    0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
+    0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
+    0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
+    0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
+    0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
+    0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
+    0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
+    0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
+    0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
+    0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
+    0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
+    0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
+    0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
+    0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
+    0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
+    0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
+    0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
+    0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
+    0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
+    0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
+    0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
+    0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
+    0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
+    0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
+    0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
+    0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
+    0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
+    0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
+    0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
+    0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
+    0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
+    0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
+    0xde0506f1UL
+  },
+  {
+    0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
+    0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
+    0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
+    0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
+    0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
+    0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
+    0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
+    0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
+    0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
+    0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
+    0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
+    0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
+    0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
+    0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
+    0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
+    0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
+    0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
+    0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
+    0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
+    0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
+    0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
+    0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
+    0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
+    0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
+    0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
+    0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
+    0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
+    0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
+    0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
+    0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
+    0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
+    0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
+    0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
+    0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
+    0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
+    0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
+    0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
+    0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
+    0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
+    0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
+    0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
+    0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
+    0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
+    0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
+    0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
+    0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
+    0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
+    0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
+    0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
+    0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
+    0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
+    0x8def022dUL
+  },
+  {
+    0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
+    0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
+    0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
+    0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
+    0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
+    0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
+    0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
+    0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
+    0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
+    0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
+    0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
+    0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
+    0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
+    0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
+    0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
+    0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
+    0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
+    0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
+    0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
+    0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
+    0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
+    0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
+    0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
+    0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
+    0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
+    0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
+    0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
+    0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
+    0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
+    0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
+    0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
+    0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
+    0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
+    0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
+    0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
+    0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
+    0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
+    0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
+    0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
+    0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
+    0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
+    0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
+    0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
+    0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
+    0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
+    0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
+    0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
+    0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
+    0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
+    0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
+    0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
+    0x72fd2493UL
+  },
+  {
+    0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
+    0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
+    0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
+    0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
+    0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
+    0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
+    0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
+    0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
+    0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
+    0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
+    0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
+    0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
+    0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
+    0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
+    0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
+    0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
+    0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
+    0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
+    0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
+    0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
+    0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
+    0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
+    0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
+    0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
+    0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
+    0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
+    0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
+    0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
+    0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
+    0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
+    0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
+    0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
+    0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
+    0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
+    0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
+    0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
+    0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
+    0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
+    0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
+    0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
+    0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
+    0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
+    0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
+    0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
+    0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
+    0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
+    0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
+    0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
+    0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
+    0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
+    0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
+    0xed3498beUL
+  },
+  {
+    0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
+    0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
+    0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
+    0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
+    0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
+    0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
+    0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
+    0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
+    0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
+    0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
+    0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
+    0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
+    0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
+    0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
+    0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
+    0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
+    0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
+    0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
+    0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
+    0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
+    0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
+    0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
+    0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
+    0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
+    0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
+    0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
+    0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
+    0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
+    0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
+    0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
+    0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
+    0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
+    0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
+    0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
+    0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
+    0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
+    0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
+    0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
+    0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
+    0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
+    0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
+    0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
+    0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
+    0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
+    0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
+    0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
+    0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
+    0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
+    0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
+    0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
+    0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
+    0xf10605deUL
+#endif
+  }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/deflate.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,346 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-2012 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id$ */
+
+#ifndef DEFLATE_H
+#define DEFLATE_H
+
+#include "zutil.h"
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip encoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GZIP
+#endif
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS  256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES   30
+/* number of distance codes */
+
+#define BL_CODES  19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define Buf_size 16
+/* size of bit buffer in bi_buf */
+
+#define INIT_STATE    42
+#define EXTRA_STATE   69
+#define NAME_STATE    73
+#define COMMENT_STATE 91
+#define HCRC_STATE   103
+#define BUSY_STATE   113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+    union {
+        ush  freq;       /* frequency count */
+        ush  code;       /* bit string */
+    } fc;
+    union {
+        ush  dad;        /* father node in Huffman tree */
+        ush  len;        /* length of bit string */
+    } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad  dl.dad
+#define Len  dl.len
+
+typedef struct static_tree_desc_s  static_tree_desc;
+
+typedef struct tree_desc_s {
+    ct_data *dyn_tree;           /* the dynamic tree */
+    int     max_code;            /* largest code with non zero frequency */
+    static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+    z_streamp strm;      /* pointer back to this zlib stream */
+    int   status;        /* as the name implies */
+    Bytef *pending_buf;  /* output still pending */
+    ulg   pending_buf_size; /* size of pending_buf */
+    Bytef *pending_out;  /* next pending byte to output to the stream */
+    uInt   pending;      /* nb of bytes in the pending buffer */
+    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
+    gz_headerp  gzhead;  /* gzip header information to write */
+    uInt   gzindex;      /* where in extra, name, or comment */
+    Byte  method;        /* can only be DEFLATED */
+    int   last_flush;    /* value of flush param for previous deflate call */
+
+                /* used by deflate.c: */
+
+    uInt  w_size;        /* LZ77 window size (32K by default) */
+    uInt  w_bits;        /* log2(w_size)  (8..16) */
+    uInt  w_mask;        /* w_size - 1 */
+
+    Bytef *window;
+    /* Sliding window. Input bytes are read into the second half of the window,
+     * and move to the first half later to keep a dictionary of at least wSize
+     * bytes. With this organization, matches are limited to a distance of
+     * wSize-MAX_MATCH bytes, but this ensures that IO is always
+     * performed with a length multiple of the block size. Also, it limits
+     * the window size to 64K, which is quite useful on MSDOS.
+     * To do: use the user input buffer as sliding window.
+     */
+
+    ulg window_size;
+    /* Actual size of window: 2*wSize, except when the user input buffer
+     * is directly used as sliding window.
+     */
+
+    Posf *prev;
+    /* Link to older string with same hash index. To limit the size of this
+     * array to 64K, this link is maintained only for the last 32K strings.
+     * An index in this array is thus a window index modulo 32K.
+     */
+
+    Posf *head; /* Heads of the hash chains or NIL. */
+
+    uInt  ins_h;          /* hash index of string to be inserted */
+    uInt  hash_size;      /* number of elements in hash table */
+    uInt  hash_bits;      /* log2(hash_size) */
+    uInt  hash_mask;      /* hash_size-1 */
+
+    uInt  hash_shift;
+    /* Number of bits by which ins_h must be shifted at each input
+     * step. It must be such that after MIN_MATCH steps, the oldest
+     * byte no longer takes part in the hash key, that is:
+     *   hash_shift * MIN_MATCH >= hash_bits
+     */
+
+    long block_start;
+    /* Window position at the beginning of the current output block. Gets
+     * negative when the window is moved backwards.
+     */
+
+    uInt match_length;           /* length of best match */
+    IPos prev_match;             /* previous match */
+    int match_available;         /* set if previous match exists */
+    uInt strstart;               /* start of string to insert */
+    uInt match_start;            /* start of matching string */
+    uInt lookahead;              /* number of valid bytes ahead in window */
+
+    uInt prev_length;
+    /* Length of the best match at previous step. Matches not greater than this
+     * are discarded. This is used in the lazy match evaluation.
+     */
+
+    uInt max_chain_length;
+    /* To speed up deflation, hash chains are never searched beyond this
+     * length.  A higher limit improves compression ratio but degrades the
+     * speed.
+     */
+
+    uInt max_lazy_match;
+    /* Attempt to find a better match only when the current match is strictly
+     * smaller than this value. This mechanism is used only for compression
+     * levels >= 4.
+     */
+#   define max_insert_length  max_lazy_match
+    /* Insert new strings in the hash table only if the match length is not
+     * greater than this length. This saves time but degrades compression.
+     * max_insert_length is used only for compression levels <= 3.
+     */
+
+    int level;    /* compression level (1..9) */
+    int strategy; /* favor or force Huffman coding*/
+
+    uInt good_match;
+    /* Use a faster search when the previous match is longer than this */
+
+    int nice_match; /* Stop searching when current match exceeds this */
+
+                /* used by trees.c: */
+    /* Didn't use ct_data typedef below to suppress compiler warning */
+    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
+    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */
+
+    struct tree_desc_s l_desc;               /* desc. for literal tree */
+    struct tree_desc_s d_desc;               /* desc. for distance tree */
+    struct tree_desc_s bl_desc;              /* desc. for bit length tree */
+
+    ush bl_count[MAX_BITS+1];
+    /* number of codes at each bit length for an optimal tree */
+
+    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
+    int heap_len;               /* number of elements in the heap */
+    int heap_max;               /* element of largest frequency */
+    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+     * The same heap array is used to build all trees.
+     */
+
+    uch depth[2*L_CODES+1];
+    /* Depth of each subtree used as tie breaker for trees of equal frequency
+     */
+
+    uchf *l_buf;          /* buffer for literals or lengths */
+
+    uInt  lit_bufsize;
+    /* Size of match buffer for literals/lengths.  There are 4 reasons for
+     * limiting lit_bufsize to 64K:
+     *   - frequencies can be kept in 16 bit counters
+     *   - if compression is not successful for the first block, all input
+     *     data is still in the window so we can still emit a stored block even
+     *     when input comes from standard input.  (This can also be done for
+     *     all blocks if lit_bufsize is not greater than 32K.)
+     *   - if compression is not successful for a file smaller than 64K, we can
+     *     even emit a stored file instead of a stored block (saving 5 bytes).
+     *     This is applicable only for zip (not gzip or zlib).
+     *   - creating new Huffman trees less frequently may not provide fast
+     *     adaptation to changes in the input data statistics. (Take for
+     *     example a binary file with poorly compressible code followed by
+     *     a highly compressible string table.) Smaller buffer sizes give
+     *     fast adaptation but have of course the overhead of transmitting
+     *     trees more frequently.
+     *   - I can't count above 4
+     */
+
+    uInt last_lit;      /* running index in l_buf */
+
+    ushf *d_buf;
+    /* Buffer for distances. To simplify the code, d_buf and l_buf have
+     * the same number of elements. To use different lengths, an extra flag
+     * array would be necessary.
+     */
+
+    ulg opt_len;        /* bit length of current block with optimal trees */
+    ulg static_len;     /* bit length of current block with static trees */
+    uInt matches;       /* number of string matches in current block */
+    uInt insert;        /* bytes at end of window left to insert */
+
+#ifdef DEBUG
+    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+#endif
+
+    ush bi_buf;
+    /* Output buffer. bits are inserted starting at the bottom (least
+     * significant bits).
+     */
+    int bi_valid;
+    /* Number of valid bits in bi_buf.  All bits above the last valid bit
+     * are always zero.
+     */
+
+    ulg high_water;
+    /* High water mark offset in window for initialized bytes -- bytes above
+     * this are set to zero in order to avoid memory check warnings when
+     * longest match routines access bytes past the input.  This is then
+     * updated to the new high water mark.
+     */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+#define WIN_INIT MAX_MATCH
+/* Number of bytes after end of data in window to initialize in order to avoid
+   memory checker errors from longest match routines */
+
+        /* in trees.c */
+void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
+int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
+void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
+                        ulg stored_len, int last));
+void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
+void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
+void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
+                        ulg stored_len, int last));
+
+#define d_code(dist) \
+   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+  extern uch ZLIB_INTERNAL _length_code[];
+  extern uch ZLIB_INTERNAL _dist_code[];
+#else
+  extern const uch ZLIB_INTERNAL _length_code[];
+  extern const uch ZLIB_INTERNAL _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+  { uch cc = (c); \
+    s->d_buf[s->last_lit] = 0; \
+    s->l_buf[s->last_lit++] = cc; \
+    s->dyn_ltree[cc].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+   }
+# define _tr_tally_dist(s, distance, length, flush) \
+  { uch len = (length); \
+    ush dist = (distance); \
+    s->d_buf[s->last_lit] = dist; \
+    s->l_buf[s->last_lit++] = len; \
+    dist--; \
+    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+    s->dyn_dtree[d_code(dist)].Freq++; \
+    flush = (s->last_lit == s->lit_bufsize-1); \
+  }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+              flush = _tr_tally(s, distance, length)
+#endif
+
+#endif /* DEFLATE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inffast.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,11 @@
+/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-2003, 2010 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inffixed.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,94 @@
+    /* inffixed.h -- table for decoding fixed codes
+     * Generated automatically by makefixed().
+     */
+
+    /* WARNING: this file should *not* be used by applications.
+       It is part of the implementation of this library and is
+       subject to change. Applications should only use zlib.h.
+     */
+
+    static const code lenfix[512] = {
+        {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
+        {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
+        {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
+        {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
+        {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
+        {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
+        {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
+        {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
+        {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
+        {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
+        {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
+        {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
+        {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
+        {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
+        {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
+        {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
+        {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
+        {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
+        {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
+        {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
+        {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
+        {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
+        {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
+        {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
+        {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
+        {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
+        {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
+        {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
+        {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
+        {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
+        {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
+        {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
+        {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
+        {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
+        {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
+        {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
+        {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
+        {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
+        {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
+        {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
+        {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
+        {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
+        {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
+        {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
+        {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
+        {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
+        {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
+        {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
+        {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
+        {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
+        {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
+        {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
+        {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
+        {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
+        {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
+        {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
+        {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
+        {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
+        {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
+        {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
+        {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
+        {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
+        {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
+        {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
+        {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
+        {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
+        {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
+        {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
+        {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
+        {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
+        {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
+        {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
+        {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
+        {0,9,255}
+    };
+
+    static const code distfix[32] = {
+        {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
+        {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
+        {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
+        {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
+        {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
+        {22,5,193},{64,5,0}
+    };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inflate.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,122 @@
+/* inflate.h -- internal inflate state definition
+ * Copyright (C) 1995-2009 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* define NO_GZIP when compiling if you want to disable gzip header and
+   trailer decoding by inflate().  NO_GZIP would be used to avoid linking in
+   the crc code when it is not needed.  For shared libraries, gzip decoding
+   should be left enabled. */
+#ifndef NO_GZIP
+#  define GUNZIP
+#endif
+
+/* Possible inflate modes between inflate() calls */
+typedef enum {
+    HEAD,       /* i: waiting for magic header */
+    FLAGS,      /* i: waiting for method and flags (gzip) */
+    TIME,       /* i: waiting for modification time (gzip) */
+    OS,         /* i: waiting for extra flags and operating system (gzip) */
+    EXLEN,      /* i: waiting for extra length (gzip) */
+    EXTRA,      /* i: waiting for extra bytes (gzip) */
+    NAME,       /* i: waiting for end of file name (gzip) */
+    COMMENT,    /* i: waiting for end of comment (gzip) */
+    HCRC,       /* i: waiting for header crc (gzip) */
+    DICTID,     /* i: waiting for dictionary check value */
+    DICT,       /* waiting for inflateSetDictionary() call */
+        TYPE,       /* i: waiting for type bits, including last-flag bit */
+        TYPEDO,     /* i: same, but skip check to exit inflate on new block */
+        STORED,     /* i: waiting for stored size (length and complement) */
+        COPY_,      /* i/o: same as COPY below, but only first time in */
+        COPY,       /* i/o: waiting for input or output to copy stored block */
+        TABLE,      /* i: waiting for dynamic block table lengths */
+        LENLENS,    /* i: waiting for code length code lengths */
+        CODELENS,   /* i: waiting for length/lit and distance code lengths */
+            LEN_,       /* i: same as LEN below, but only first time in */
+            LEN,        /* i: waiting for length/lit/eob code */
+            LENEXT,     /* i: waiting for length extra bits */
+            DIST,       /* i: waiting for distance code */
+            DISTEXT,    /* i: waiting for distance extra bits */
+            MATCH,      /* o: waiting for output space to copy string */
+            LIT,        /* o: waiting for output space to write literal */
+    CHECK,      /* i: waiting for 32-bit check value */
+    LENGTH,     /* i: waiting for 32-bit length (gzip) */
+    DONE,       /* finished check, done -- remain here until reset */
+    BAD,        /* got a data error -- remain here until reset */
+    MEM,        /* got an inflate() memory error -- remain here until reset */
+    SYNC        /* looking for synchronization bytes to restart inflate() */
+} inflate_mode;
+
+/*
+    State transitions between above modes -
+
+    (most modes can go to BAD or MEM on error -- not shown for clarity)
+
+    Process header:
+        HEAD -> (gzip) or (zlib) or (raw)
+        (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
+                  HCRC -> TYPE
+        (zlib) -> DICTID or TYPE
+        DICTID -> DICT -> TYPE
+        (raw) -> TYPEDO
+    Read deflate blocks:
+            TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
+            STORED -> COPY_ -> COPY -> TYPE
+            TABLE -> LENLENS -> CODELENS -> LEN_
+            LEN_ -> LEN
+    Read deflate codes in fixed or dynamic block:
+                LEN -> LENEXT or LIT or TYPE
+                LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
+                LIT -> LEN
+    Process trailer:
+        CHECK -> LENGTH -> DONE
+ */
+
+/* state maintained between inflate() calls.  Approximately 10K bytes. */
+struct inflate_state {
+    inflate_mode mode;          /* current inflate mode */
+    int last;                   /* true if processing last block */
+    int wrap;                   /* bit 0 true for zlib, bit 1 true for gzip */
+    int havedict;               /* true if dictionary provided */
+    int flags;                  /* gzip header method and flags (0 if zlib) */
+    unsigned dmax;              /* zlib header max distance (INFLATE_STRICT) */
+    unsigned long check;        /* protected copy of check value */
+    unsigned long total;        /* protected copy of output count */
+    gz_headerp head;            /* where to save gzip header information */
+        /* sliding window */
+    unsigned wbits;             /* log base 2 of requested window size */
+    unsigned wsize;             /* window size or zero if not using window */
+    unsigned whave;             /* valid bytes in the window */
+    unsigned wnext;             /* window write index */
+    unsigned char FAR *window;  /* allocated sliding window, if needed */
+        /* bit accumulator */
+    unsigned long hold;         /* input bit accumulator */
+    unsigned bits;              /* number of bits in "in" */
+        /* for string and stored block copying */
+    unsigned length;            /* literal or length of data to copy */
+    unsigned offset;            /* distance back to copy string from */
+        /* for table and code decoding */
+    unsigned extra;             /* extra bits needed */
+        /* fixed and dynamic code tables */
+    code const FAR *lencode;    /* starting table for length/literal codes */
+    code const FAR *distcode;   /* starting table for distance codes */
+    unsigned lenbits;           /* index bits for lencode */
+    unsigned distbits;          /* index bits for distcode */
+        /* dynamic table building */
+    unsigned ncode;             /* number of code length code lengths */
+    unsigned nlen;              /* number of length code lengths */
+    unsigned ndist;             /* number of distance code lengths */
+    unsigned have;              /* number of code lengths in lens[] */
+    code FAR *next;             /* next available space in codes[] */
+    unsigned short lens[320];   /* temporary storage for code lengths */
+    unsigned short work[288];   /* work area for code table building */
+    code codes[ENOUGH];         /* space for code tables */
+    int sane;                   /* if false, allow invalid distance too far */
+    int back;                   /* bits back of last unprocessed length/lit */
+    unsigned was;               /* initial length of match */
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/inftrees.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-2005, 2010 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* Structure for decoding tables.  Each entry provides either the
+   information needed to do the operation requested by the code that
+   indexed that table entry, or it provides a pointer to another
+   table that indexes more bits of the code.  op indicates whether
+   the entry is a pointer to another table, a literal, a length or
+   distance, an end-of-block, or an invalid code.  For a table
+   pointer, the low four bits of op is the number of index bits of
+   that table.  For a length or distance, the low four bits of op
+   is the number of extra bits to get after the code.  bits is
+   the number of bits in this code or part of the code to drop off
+   of the bit buffer.  val is the actual byte to output in the case
+   of a literal, the base length or distance, or the offset from
+   the current table to the next table.  Each entry is four bytes. */
+typedef struct {
+    unsigned char op;           /* operation, extra bits, table bits */
+    unsigned char bits;         /* bits in this part of the code */
+    unsigned short val;         /* offset in table or code value */
+} code;
+
+/* op values as set by inflate_table():
+    00000000 - literal
+    0000tttt - table link, tttt != 0 is the number of table index bits
+    0001eeee - length or distance, eeee is the number of extra bits
+    01100000 - end of block
+    01000000 - invalid code
+ */
+
+/* Maximum size of the dynamic table.  The maximum number of code structures is
+   1444, which is the sum of 852 for literal/length codes and 592 for distance
+   codes.  These values were found by exhaustive searches using the program
+   examples/enough.c found in the zlib distribtution.  The arguments to that
+   program are the number of symbols, the initial root table size, and the
+   maximum bit length of a code.  "enough 286 9 15" for literal/length codes
+   returns returns 852, and "enough 30 6 15" for distance codes returns 592.
+   The initial root table size (9 or 6) is found in the fifth argument of the
+   inflate_table() calls in inflate.c and infback.c.  If the root table size is
+   changed, then these maximum sizes would be need to be recalculated and
+   updated. */
+#define ENOUGH_LENS 852
+#define ENOUGH_DISTS 592
+#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
+
+/* Type of code to build for inflate_table() */
+typedef enum {
+    CODES,
+    LENS,
+    DISTS
+} codetype;
+
+int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
+                             unsigned codes, code FAR * FAR *table,
+                             unsigned FAR *bits, unsigned short FAR *work));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/trees.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,128 @@
+/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{  8}}, {{140},{  8}}, {{ 76},{  8}}, {{204},{  8}}, {{ 44},{  8}},
+{{172},{  8}}, {{108},{  8}}, {{236},{  8}}, {{ 28},{  8}}, {{156},{  8}},
+{{ 92},{  8}}, {{220},{  8}}, {{ 60},{  8}}, {{188},{  8}}, {{124},{  8}},
+{{252},{  8}}, {{  2},{  8}}, {{130},{  8}}, {{ 66},{  8}}, {{194},{  8}},
+{{ 34},{  8}}, {{162},{  8}}, {{ 98},{  8}}, {{226},{  8}}, {{ 18},{  8}},
+{{146},{  8}}, {{ 82},{  8}}, {{210},{  8}}, {{ 50},{  8}}, {{178},{  8}},
+{{114},{  8}}, {{242},{  8}}, {{ 10},{  8}}, {{138},{  8}}, {{ 74},{  8}},
+{{202},{  8}}, {{ 42},{  8}}, {{170},{  8}}, {{106},{  8}}, {{234},{  8}},
+{{ 26},{  8}}, {{154},{  8}}, {{ 90},{  8}}, {{218},{  8}}, {{ 58},{  8}},
+{{186},{  8}}, {{122},{  8}}, {{250},{  8}}, {{  6},{  8}}, {{134},{  8}},
+{{ 70},{  8}}, {{198},{  8}}, {{ 38},{  8}}, {{166},{  8}}, {{102},{  8}},
+{{230},{  8}}, {{ 22},{  8}}, {{150},{  8}}, {{ 86},{  8}}, {{214},{  8}},
+{{ 54},{  8}}, {{182},{  8}}, {{118},{  8}}, {{246},{  8}}, {{ 14},{  8}},
+{{142},{  8}}, {{ 78},{  8}}, {{206},{  8}}, {{ 46},{  8}}, {{174},{  8}},
+{{110},{  8}}, {{238},{  8}}, {{ 30},{  8}}, {{158},{  8}}, {{ 94},{  8}},
+{{222},{  8}}, {{ 62},{  8}}, {{190},{  8}}, {{126},{  8}}, {{254},{  8}},
+{{  1},{  8}}, {{129},{  8}}, {{ 65},{  8}}, {{193},{  8}}, {{ 33},{  8}},
+{{161},{  8}}, {{ 97},{  8}}, {{225},{  8}}, {{ 17},{  8}}, {{145},{  8}},
+{{ 81},{  8}}, {{209},{  8}}, {{ 49},{  8}}, {{177},{  8}}, {{113},{  8}},
+{{241},{  8}}, {{  9},{  8}}, {{137},{  8}}, {{ 73},{  8}}, {{201},{  8}},
+{{ 41},{  8}}, {{169},{  8}}, {{105},{  8}}, {{233},{  8}}, {{ 25},{  8}},
+{{153},{  8}}, {{ 89},{  8}}, {{217},{  8}}, {{ 57},{  8}}, {{185},{  8}},
+{{121},{  8}}, {{249},{  8}}, {{  5},{  8}}, {{133},{  8}}, {{ 69},{  8}},
+{{197},{  8}}, {{ 37},{  8}}, {{165},{  8}}, {{101},{  8}}, {{229},{  8}},
+{{ 21},{  8}}, {{149},{  8}}, {{ 85},{  8}}, {{213},{  8}}, {{ 53},{  8}},
+{{181},{  8}}, {{117},{  8}}, {{245},{  8}}, {{ 13},{  8}}, {{141},{  8}},
+{{ 77},{  8}}, {{205},{  8}}, {{ 45},{  8}}, {{173},{  8}}, {{109},{  8}},
+{{237},{  8}}, {{ 29},{  8}}, {{157},{  8}}, {{ 93},{  8}}, {{221},{  8}},
+{{ 61},{  8}}, {{189},{  8}}, {{125},{  8}}, {{253},{  8}}, {{ 19},{  9}},
+{{275},{  9}}, {{147},{  9}}, {{403},{  9}}, {{ 83},{  9}}, {{339},{  9}},
+{{211},{  9}}, {{467},{  9}}, {{ 51},{  9}}, {{307},{  9}}, {{179},{  9}},
+{{435},{  9}}, {{115},{  9}}, {{371},{  9}}, {{243},{  9}}, {{499},{  9}},
+{{ 11},{  9}}, {{267},{  9}}, {{139},{  9}}, {{395},{  9}}, {{ 75},{  9}},
+{{331},{  9}}, {{203},{  9}}, {{459},{  9}}, {{ 43},{  9}}, {{299},{  9}},
+{{171},{  9}}, {{427},{  9}}, {{107},{  9}}, {{363},{  9}}, {{235},{  9}},
+{{491},{  9}}, {{ 27},{  9}}, {{283},{  9}}, {{155},{  9}}, {{411},{  9}},
+{{ 91},{  9}}, {{347},{  9}}, {{219},{  9}}, {{475},{  9}}, {{ 59},{  9}},
+{{315},{  9}}, {{187},{  9}}, {{443},{  9}}, {{123},{  9}}, {{379},{  9}},
+{{251},{  9}}, {{507},{  9}}, {{  7},{  9}}, {{263},{  9}}, {{135},{  9}},
+{{391},{  9}}, {{ 71},{  9}}, {{327},{  9}}, {{199},{  9}}, {{455},{  9}},
+{{ 39},{  9}}, {{295},{  9}}, {{167},{  9}}, {{423},{  9}}, {{103},{  9}},
+{{359},{  9}}, {{231},{  9}}, {{487},{  9}}, {{ 23},{  9}}, {{279},{  9}},
+{{151},{  9}}, {{407},{  9}}, {{ 87},{  9}}, {{343},{  9}}, {{215},{  9}},
+{{471},{  9}}, {{ 55},{  9}}, {{311},{  9}}, {{183},{  9}}, {{439},{  9}},
+{{119},{  9}}, {{375},{  9}}, {{247},{  9}}, {{503},{  9}}, {{ 15},{  9}},
+{{271},{  9}}, {{143},{  9}}, {{399},{  9}}, {{ 79},{  9}}, {{335},{  9}},
+{{207},{  9}}, {{463},{  9}}, {{ 47},{  9}}, {{303},{  9}}, {{175},{  9}},
+{{431},{  9}}, {{111},{  9}}, {{367},{  9}}, {{239},{  9}}, {{495},{  9}},
+{{ 31},{  9}}, {{287},{  9}}, {{159},{  9}}, {{415},{  9}}, {{ 95},{  9}},
+{{351},{  9}}, {{223},{  9}}, {{479},{  9}}, {{ 63},{  9}}, {{319},{  9}},
+{{191},{  9}}, {{447},{  9}}, {{127},{  9}}, {{383},{  9}}, {{255},{  9}},
+{{511},{  9}}, {{  0},{  7}}, {{ 64},{  7}}, {{ 32},{  7}}, {{ 96},{  7}},
+{{ 16},{  7}}, {{ 80},{  7}}, {{ 48},{  7}}, {{112},{  7}}, {{  8},{  7}},
+{{ 72},{  7}}, {{ 40},{  7}}, {{104},{  7}}, {{ 24},{  7}}, {{ 88},{  7}},
+{{ 56},{  7}}, {{120},{  7}}, {{  4},{  7}}, {{ 68},{  7}}, {{ 36},{  7}},
+{{100},{  7}}, {{ 20},{  7}}, {{ 84},{  7}}, {{ 52},{  7}}, {{116},{  7}},
+{{  3},{  8}}, {{131},{  8}}, {{ 67},{  8}}, {{195},{  8}}, {{ 35},{  8}},
+{{163},{  8}}, {{ 99},{  8}}, {{227},{  8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
+ 0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
+ 8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  0,  0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0,  1,  2,  3,  4,  5,  6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+    0,     1,     2,     3,     4,     6,     8,    12,    16,    24,
+   32,    48,    64,    96,   128,   192,   256,   384,   512,   768,
+ 1024,  1536,  2048,  3072,  4096,  6144,  8192, 12288, 16384, 24576
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zconf.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,511 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#ifndef ZCONF_H
+#define ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ * Even better than compiling with -DZ_PREFIX would be to use configure to set
+ * this permanently in zconf.h using "./configure --zprefix".
+ */
+#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
+#  define Z_PREFIX_SET
+
+/* all linked symbols */
+#  define _dist_code            z__dist_code
+#  define _length_code          z__length_code
+#  define _tr_align             z__tr_align
+#  define _tr_flush_bits        z__tr_flush_bits
+#  define _tr_flush_block       z__tr_flush_block
+#  define _tr_init              z__tr_init
+#  define _tr_stored_block      z__tr_stored_block
+#  define _tr_tally             z__tr_tally
+#  define adler32               z_adler32
+#  define adler32_combine       z_adler32_combine
+#  define adler32_combine64     z_adler32_combine64
+#  ifndef Z_SOLO
+#    define compress              z_compress
+#    define compress2             z_compress2
+#    define compressBound         z_compressBound
+#  endif
+#  define crc32                 z_crc32
+#  define crc32_combine         z_crc32_combine
+#  define crc32_combine64       z_crc32_combine64
+#  define deflate               z_deflate
+#  define deflateBound          z_deflateBound
+#  define deflateCopy           z_deflateCopy
+#  define deflateEnd            z_deflateEnd
+#  define deflateInit2_         z_deflateInit2_
+#  define deflateInit_          z_deflateInit_
+#  define deflateParams         z_deflateParams
+#  define deflatePending        z_deflatePending
+#  define deflatePrime          z_deflatePrime
+#  define deflateReset          z_deflateReset
+#  define deflateResetKeep      z_deflateResetKeep
+#  define deflateSetDictionary  z_deflateSetDictionary
+#  define deflateSetHeader      z_deflateSetHeader
+#  define deflateTune           z_deflateTune
+#  define deflate_copyright     z_deflate_copyright
+#  define get_crc_table         z_get_crc_table
+#  ifndef Z_SOLO
+#    define gz_error              z_gz_error
+#    define gz_intmax             z_gz_intmax
+#    define gz_strwinerror        z_gz_strwinerror
+#    define gzbuffer              z_gzbuffer
+#    define gzclearerr            z_gzclearerr
+#    define gzclose               z_gzclose
+#    define gzclose_r             z_gzclose_r
+#    define gzclose_w             z_gzclose_w
+#    define gzdirect              z_gzdirect
+#    define gzdopen               z_gzdopen
+#    define gzeof                 z_gzeof
+#    define gzerror               z_gzerror
+#    define gzflush               z_gzflush
+#    define gzgetc                z_gzgetc
+#    define gzgetc_               z_gzgetc_
+#    define gzgets                z_gzgets
+#    define gzoffset              z_gzoffset
+#    define gzoffset64            z_gzoffset64
+#    define gzopen                z_gzopen
+#    define gzopen64              z_gzopen64
+#    ifdef _WIN32
+#      define gzopen_w              z_gzopen_w
+#    endif
+#    define gzprintf              z_gzprintf
+#    define gzvprintf             z_gzvprintf
+#    define gzputc                z_gzputc
+#    define gzputs                z_gzputs
+#    define gzread                z_gzread
+#    define gzrewind              z_gzrewind
+#    define gzseek                z_gzseek
+#    define gzseek64              z_gzseek64
+#    define gzsetparams           z_gzsetparams
+#    define gztell                z_gztell
+#    define gztell64              z_gztell64
+#    define gzungetc              z_gzungetc
+#    define gzwrite               z_gzwrite
+#  endif
+#  define inflate               z_inflate
+#  define inflateBack           z_inflateBack
+#  define inflateBackEnd        z_inflateBackEnd
+#  define inflateBackInit_      z_inflateBackInit_
+#  define inflateCopy           z_inflateCopy
+#  define inflateEnd            z_inflateEnd
+#  define inflateGetHeader      z_inflateGetHeader
+#  define inflateInit2_         z_inflateInit2_
+#  define inflateInit_          z_inflateInit_
+#  define inflateMark           z_inflateMark
+#  define inflatePrime          z_inflatePrime
+#  define inflateReset          z_inflateReset
+#  define inflateReset2         z_inflateReset2
+#  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateGetDictionary  z_inflateGetDictionary
+#  define inflateSync           z_inflateSync
+#  define inflateSyncPoint      z_inflateSyncPoint
+#  define inflateUndermine      z_inflateUndermine
+#  define inflateResetKeep      z_inflateResetKeep
+#  define inflate_copyright     z_inflate_copyright
+#  define inflate_fast          z_inflate_fast
+#  define inflate_table         z_inflate_table
+#  ifndef Z_SOLO
+#    define uncompress            z_uncompress
+#  endif
+#  define zError                z_zError
+#  ifndef Z_SOLO
+#    define zcalloc               z_zcalloc
+#    define zcfree                z_zcfree
+#  endif
+#  define zlibCompileFlags      z_zlibCompileFlags
+#  define zlibVersion           z_zlibVersion
+
+/* all zlib typedefs in zlib.h and zconf.h */
+#  define Byte                  z_Byte
+#  define Bytef                 z_Bytef
+#  define alloc_func            z_alloc_func
+#  define charf                 z_charf
+#  define free_func             z_free_func
+#  ifndef Z_SOLO
+#    define gzFile                z_gzFile
+#  endif
+#  define gz_header             z_gz_header
+#  define gz_headerp            z_gz_headerp
+#  define in_func               z_in_func
+#  define intf                  z_intf
+#  define out_func              z_out_func
+#  define uInt                  z_uInt
+#  define uIntf                 z_uIntf
+#  define uLong                 z_uLong
+#  define uLongf                z_uLongf
+#  define voidp                 z_voidp
+#  define voidpc                z_voidpc
+#  define voidpf                z_voidpf
+
+/* all zlib structs in zlib.h and zconf.h */
+#  define gz_header_s           z_gz_header_s
+#  define internal_state        z_internal_state
+
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+#  define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+#  define WINDOWS
+#endif
+#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+#  ifndef WIN32
+#    define WIN32
+#  endif
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+#    ifndef SYS16BIT
+#      define SYS16BIT
+#    endif
+#  endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+#  ifndef STDC
+#    define STDC
+#  endif
+#  if __STDC_VERSION__ >= 199901L
+#    ifndef STDC99
+#      define STDC99
+#    endif
+#  endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+#  define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
+#  define STDC
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const       /* note: need a more gentle solution here */
+#  endif
+#endif
+
+#if defined(ZLIB_CONST) && !defined(z_const)
+#  define z_const const
+#else
+#  define z_const
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   9 /* default is 32K LZ77 window, here alter to 512 byte for minimum memory */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+#ifndef Z_ARG /* function prototypes for stdarg */
+#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#    define Z_ARG(args)  args
+#  else
+#    define Z_ARG(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+#  if defined(M_I86SM) || defined(M_I86MM)
+     /* MSC small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef _MSC_VER
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#  if (defined(__SMALL__) || defined(__MEDIUM__))
+     /* Turbo C small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef __BORLANDC__
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+   /* If building or using zlib as a DLL, define ZLIB_DLL.
+    * This is not mandatory, but it offers a little performance increase.
+    */
+#  ifdef ZLIB_DLL
+#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+#      ifdef ZLIB_INTERNAL
+#        define ZEXTERN extern __declspec(dllexport)
+#      else
+#        define ZEXTERN extern __declspec(dllimport)
+#      endif
+#    endif
+#  endif  /* ZLIB_DLL */
+   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+    * define ZLIB_WINAPI.
+    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+    */
+#  ifdef ZLIB_WINAPI
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+     /* No need for _export, use ZLIB.DEF instead. */
+     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+#    define ZEXPORT WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA WINAPIV
+#    else
+#      define ZEXPORTVA FAR CDECL
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXPORT   __declspec(dllexport)
+#      define ZEXPORTVA __declspec(dllexport)
+#    else
+#      define ZEXPORT   __declspec(dllimport)
+#      define ZEXPORTVA __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+
+#ifndef FAR
+#  define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void const *voidpc;
+   typedef void FAR   *voidpf;
+   typedef void       *voidp;
+#else
+   typedef Byte const *voidpc;
+   typedef Byte FAR   *voidpf;
+   typedef Byte       *voidp;
+#endif
+
+#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
+#  include <limits.h>
+#  if (UINT_MAX == 0xffffffffUL)
+#    define Z_U4 unsigned
+#  elif (ULONG_MAX == 0xffffffffUL)
+#    define Z_U4 unsigned long
+#  elif (USHRT_MAX == 0xffffffffUL)
+#    define Z_U4 unsigned short
+#  endif
+#endif
+
+#ifdef Z_U4
+   typedef Z_U4 z_crc_t;
+#else
+   typedef unsigned long z_crc_t;
+#endif
+
+#if 1    /* was set to #if 1 by ./configure */
+#  define Z_HAVE_UNISTD_H
+#endif
+
+#if 1    /* was set to #if 1 by ./configure */
+#  define Z_HAVE_STDARG_H
+#endif
+
+#ifdef STDC
+#  ifndef Z_SOLO
+#    include <sys/types.h>      /* for off_t */
+#  endif
+#endif
+
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+#    include <stdarg.h>         /* for va_list */
+#  endif
+#endif
+
+#ifdef _WIN32
+#  ifndef Z_SOLO
+#    include <stddef.h>         /* for wchar_t */
+#  endif
+#endif
+
+/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
+ * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
+ * though the former does not conform to the LFS document), but considering
+ * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
+ * equivalently requesting no 64-bit operations
+ */
+#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
+#  undef _LARGEFILE64_SOURCE
+#endif
+
+#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
+#  define Z_HAVE_UNISTD_H
+#endif
+#ifndef Z_SOLO
+#  if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
+#    ifdef VMS
+#      include <unixio.h>       /* for off_t */
+#    endif
+#    ifndef z_off_t
+#      define z_off_t off_t
+#    endif
+#  endif
+#endif
+
+#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
+#  define Z_LFS64
+#endif
+
+#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
+#  define Z_LARGE64
+#endif
+
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
+#  define Z_WANT64
+#endif
+
+#if !defined(SEEK_SET) && !defined(Z_SOLO)
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+
+#ifndef z_off_t
+#  define z_off_t long
+#endif
+
+#if !defined(_WIN32) && defined(Z_LARGE64)
+#  define z_off64_t off64_t
+#else
+#  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
+#    define z_off64_t __int64
+#  else
+#    define z_off64_t z_off_t
+#  endif
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+  #pragma map(deflateInit_,"DEIN")
+  #pragma map(deflateInit2_,"DEIN2")
+  #pragma map(deflateEnd,"DEEND")
+  #pragma map(deflateBound,"DEBND")
+  #pragma map(inflateInit_,"ININ")
+  #pragma map(inflateInit2_,"ININ2")
+  #pragma map(inflateEnd,"INEND")
+  #pragma map(inflateSync,"INSY")
+  #pragma map(inflateSetDictionary,"INSEDI")
+  #pragma map(compressBound,"CMBND")
+  #pragma map(inflate_table,"INTABL")
+  #pragma map(inflate_fast,"INFA")
+  #pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* ZCONF_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zlib.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,1768 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.8, April 28th, 2013
+
+  Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
+  (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
+*/
+
+#ifndef ZLIB_H
+#define ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.8"
+#define ZLIB_VERNUM 0x1280
+#define ZLIB_VER_MAJOR 1
+#define ZLIB_VER_MINOR 2
+#define ZLIB_VER_REVISION 8
+#define ZLIB_VER_SUBREVISION 0
+
+/*
+    The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed data.
+  This version of the library supports only one compression method (deflation)
+  but other algorithms will be added later and will have the same stream
+  interface.
+
+    Compression can be done in a single step if the buffers are large enough,
+  or can be done by repeated calls of the compression function.  In the latter
+  case, the application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+    The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+    The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+    This library can optionally read and write gzip streams in memory as well.
+
+    The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+    The library does not install any signal handler.  The decoder checks
+  the consistency of the compressed data, so the library should never crash
+  even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    z_const Bytef *next_in;     /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total number of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total number of bytes output so far */
+
+    z_const char *msg;  /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: binary or text */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+     gzip header information passed to and from zlib routines.  See RFC 1952
+  for more details on the meanings of these fields.
+*/
+typedef struct gz_header_s {
+    int     text;       /* true if compressed data believed to be text */
+    uLong   time;       /* modification time */
+    int     xflags;     /* extra flags (not used when writing a gzip file) */
+    int     os;         /* operating system */
+    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
+    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
+    uInt    extra_max;  /* space at extra (only when reading header) */
+    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
+    uInt    name_max;   /* space at name (only when reading header) */
+    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
+    uInt    comm_max;   /* space at comment (only when reading header) */
+    int     hcrc;       /* true if there was or will be a header crc */
+    int     done;       /* true when done reading gzip header (not used
+                           when writing a gzip file) */
+} gz_header;
+
+typedef gz_header FAR *gz_headerp;
+
+/*
+     The application must update next_in and avail_in when avail_in has dropped
+   to zero.  It must update next_out and avail_out when avail_out has dropped
+   to zero.  The application must initialize zalloc, zfree and opaque before
+   calling the init function.  All other fields are set by the compression
+   library and must not be updated by the application.
+
+     The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree.  This can be useful for custom
+   memory management.  The compression library attaches no meaning to the
+   opaque value.
+
+     zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+     On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this if
+   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
+   returned by zalloc for objects of exactly 65536 bytes *must* have their
+   offset normalized to zero.  The default allocation function provided by this
+   library ensures this (see zutil.c).  To reduce memory requirements and avoid
+   any allocation of 64K objects, at the expense of compression ratio, compile
+   the library with -DMAX_WBITS=14 (see zconf.h).
+
+     The fields total_in and total_out can be used for statistics or progress
+   reports.  After compression, total_in holds the total size of the
+   uncompressed data and may be saved for use in the decompressor (particularly
+   if the decompressor wants to decompress everything in a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+#define Z_TREES         6
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative values
+ * are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_FIXED               4
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_TEXT     1
+#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is not
+   compatible with the zlib.h header file used by the application.  This check
+   is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression.  The fields
+   zalloc, zfree and opaque must be initialized before by the caller.  If
+   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
+   allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at all
+   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
+   requests a default compromise between speed and compression (currently
+   equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if level is not a valid compression level, or
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
+   if there is no error message.  deflateInit does not perform any compression:
+   this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full.  It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows.  deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly.  If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).  Some
+    output may be provided even if flush is not set.
+
+    Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming more
+  output, and updating avail_in or avail_out accordingly; avail_out should
+  never be zero before the call.  The application can consume the compressed
+  output when it wants, for example when the output buffer is full (avail_out
+  == 0), or after each call of deflate().  If deflate returns Z_OK and with
+  zero avail_out, it must be called again after making room in the output
+  buffer because there might be more output pending.
+
+    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+  decide how much data to accumulate before producing output, in order to
+  maximize compression.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far.  (In
+  particular avail_in is zero after the call if enough output space has been
+  provided before the call.) Flushing may degrade compression for some
+  compression algorithms and so it should be used only when necessary.  This
+  completes the current deflate block and follows it with an empty stored block
+  that is three bits plus filler bits to the next byte, followed by four bytes
+  (00 00 ff ff).
+
+    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
+  output buffer, but the output is not aligned to a byte boundary.  All of the
+  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
+  This completes the current deflate block and follows it with an empty fixed
+  codes block that is 10 bits long.  This assures that enough bytes are output
+  in order for the decompressor to finish the block before the empty fixed code
+  block.
+
+    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
+  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
+  seven bits of the current block are held to be written as the next byte after
+  the next deflate block is completed.  In this case, the decompressor may not
+  be provided enough bits at this point in order to complete decompression of
+  the data provided so far to the compressor.  It may need to wait for the next
+  block to be emitted.  This is for advanced applications that need to control
+  the emission of deflate blocks.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
+  compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there was
+  enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error.  After
+  deflate has returned Z_STREAM_END, the only possible operations on the stream
+  are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step.  In this case, avail_out must be at least the
+  value returned by deflateBound (see below).  Then deflate is guaranteed to
+  return Z_STREAM_END.  If not enough output space is provided, deflate will
+  not return Z_STREAM_END, and it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update strm->data_type if it can make a good guess about
+  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered
+  binary.  This field is only for information purposes and does not affect the
+  compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any pending
+   output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded).  In the error case, msg
+   may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression.  The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller.  If next_in is not Z_NULL and avail_in is large enough (the
+   exact value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
+   invalid, such as a null pointer to the structure.  msg is set to null if
+   there is no error message.  inflateInit does not perform any decompression
+   apart from possibly reading the zlib header if present: actual decompression
+   will be done by inflate().  (So next_in and avail_in may be modified, but
+   next_out and avail_out are unused and unchanged.) The current implementation
+   of inflateInit() does not process any header information -- that is deferred
+   until inflate() is called.
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full.  It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows.  inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly.  If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing will
+    resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there is
+    no more input data or no more space in the output buffer (see below about
+    the flush parameter).
+
+    Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming more
+  output, and updating the next_* and avail_* values accordingly.  The
+  application can consume the uncompressed output when it wants, for example
+  when the output buffer is full (avail_out == 0), or after each call of
+  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
+  called again after making room in the output buffer because there might be
+  more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
+  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer.  Z_BLOCK requests that inflate()
+  stop if and when it gets to the next deflate block boundary.  When decoding
+  the zlib or gzip format, this will cause inflate() to return immediately
+  after the header and before the first block.  When doing a raw inflate,
+  inflate() will go ahead and process the first block, and will return when it
+  gets to the end of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64 if
+  inflate() is currently decoding the last block in the deflate stream, plus
+  128 if inflate() returned immediately after decoding an end-of-block code or
+  decoding the complete header up to just before the first byte of the deflate
+  stream.  The end-of-block will not be indicated until all of the uncompressed
+  data from that block has been written to strm->next_out.  The number of
+  unused bits may in general be greater than seven, except when bit 7 of
+  data_type is set, in which case the number of unused bits will be less than
+  eight.  data_type is set as noted here every time inflate() returns for all
+  flush options, and so can be used to determine the amount of currently
+  consumed input in bits.
+
+    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
+  end of each deflate block header is reached, before any actual data in that
+  block is decoded.  This allows the caller to determine the length of the
+  deflate block header for later use in random access within a deflate block.
+  256 is added to the value of strm->data_type when inflate() returns
+  immediately after reaching the end of the deflate block header.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error.  However if all decompression is to be performed in a single step (a
+  single call of inflate), the parameter flush should be set to Z_FINISH.  In
+  this case all pending input is processed and all pending output is flushed;
+  avail_out must be large enough to hold all of the uncompressed data for the
+  operation to complete.  (The size of the uncompressed data may have been
+  saved by the compressor for this purpose.) The use of Z_FINISH is not
+  required to perform an inflation in one step.  However it may be used to
+  inform inflate that a faster approach can be used for the single inflate()
+  call.  Z_FINISH also informs inflate to not maintain a sliding window if the
+  stream completes, which reduces inflate's memory footprint.  If the stream
+  does not complete, either because not all of the stream is provided or not
+  enough output space is provided, then a sliding window will be allocated and
+  inflate() can be called again to continue the operation as if Z_NO_FLUSH had
+  been used.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call.  So the effects of the flush parameter in this implementation are
+  on the return value of inflate() as noted below, when inflate() returns early
+  when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
+  memory for a sliding window when Z_FINISH is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the Adler-32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below.  At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically, if requested when
+  initializing with inflateInit2().  Any information contained in the gzip
+  header is not retained, so applications that need that information should
+  instead use raw inflate, see inflateInit2() below, or inflateBack() and
+  perform their own processing of the gzip header and trailer.  When processing
+  gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
+  producted so far.  The CRC-32 is checked against the gzip trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing.  If Z_DATA_ERROR is returned, the application may
+  then call inflateSync() to look for a good compression block if a partial
+  recovery of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any pending
+   output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent.  In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options.  The
+   fields next_in, zalloc, zfree and opaque must be initialized before by the
+   caller.
+
+     The method parameter is the compression method.  It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer).  It should be in the range 8..15 for this
+   version of the library.  Larger values of this parameter result in better
+   compression at the expense of memory usage.  The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
+   determines the window size.  deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding.  Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper.  The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero), no
+   header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state.  memLevel=1 uses minimum memory but is
+   slow and reduces compression ratio; memLevel=9 uses maximum memory for
+   optimal speed.  The default value is 8.  See zconf.h for total memory usage
+   as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm.  Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding).  Filtered data consists mostly of small values with a somewhat
+   random distribution.  In this case, the compression algorithm is tuned to
+   compress them better.  The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
+   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
+   strategy parameter only affects the compression ratio but not the
+   correctness of the compressed output even if it is not set appropriately.
+   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
+   decoder for special applications.
+
+     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
+   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
+   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
+   set to null if there is no error message.  deflateInit2 does not perform any
+   compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output.  When using the zlib format, this
+   function must be called immediately after deflateInit, deflateInit2 or
+   deflateReset, and before any call of deflate.  When doing raw deflate, this
+   function must be called either before any call of deflate, or immediately
+   after the completion of a deflate block, i.e. after all input has been
+   consumed and all output has been delivered when using any of the flush
+   options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH.  The
+   compressor and decompressor must use exactly the same dictionary (see
+   inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary.  Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size
+   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
+   useful should be put at the end of the dictionary, not at the front.  In
+   addition, the current implementation of deflate will use at most the window
+   size minus 262 bytes of the provided dictionary.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor.  (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if not at a block boundary for raw deflate).  deflateSetDictionary does
+   not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter.  The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and can
+   consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.  The
+   stream will keep the same compression level and any other attributes that
+   may have been set by deflateInit2.
+
+     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different strategy.
+   If the compression level is changed, the input available so far is
+   compressed with the old level (and may be flushed); the new level will take
+   effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to be
+   compressed and flushed.  In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
+   strm->avail_out was zero.
+*/
+
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+                                    int good_length,
+                                    int max_lazy,
+                                    int nice_length,
+                                    int max_chain));
+/*
+     Fine tune deflate's internal compression parameters.  This should only be
+   used by someone who understands the algorithm used by zlib's deflate for
+   searching for the best matching string, and even then only by the most
+   fanatic optimizer trying to squeeze out the last compressed bit for their
+   specific input data.  Read the deflate.c source code for the meaning of the
+   max_lazy, good_length, nice_length, and max_chain parameters.
+
+     deflateTune() can be called after deflateInit() or deflateInit2(), and
+   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit() or
+   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
+   to allocate an output buffer for deflation in a single pass, and so would be
+   called before deflate().  If that first deflate() call is provided the
+   sourceLen input bytes, an output buffer allocated to the size returned by
+   deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
+   to return Z_STREAM_END.  Note that it is possible for the compressed size to
+   be larger than the value returned by deflateBound() if flush options other
+   than Z_FINISH or Z_NO_FLUSH are used.
+*/
+
+ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
+                                       unsigned *pending,
+                                       int *bits));
+/*
+     deflatePending() returns the number of bytes and bits of output that have
+   been generated, but not yet provided in the available output.  The bytes not
+   provided would be due to the available output space having being consumed.
+   The number of bits of output not provided are between 0 and 7, where they
+   await more bits to join them in order to fill out a full byte.  If pending
+   or bits are Z_NULL, then those values are not set.
+
+     deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+ */
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+   is that this function is used to start off the deflate output with the bits
+   leftover from a previous deflate stream when appending to it.  As such, this
+   function can only be used for raw deflate, and must be used before the first
+   deflate() call after a deflateInit2() or deflateReset().  bits must be less
+   than or equal to 16, and that many of the least significant bits of value
+   will be inserted in the output.
+
+     deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
+   room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
+   source stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+     deflateSetHeader() provides gzip header information for when a gzip
+   stream is requested by deflateInit2().  deflateSetHeader() may be called
+   after deflateInit2() or deflateReset() and before the first call of
+   deflate().  The text, time, os, extra field, name, and comment information
+   in the provided gz_header structure are written to the gzip header (xflag is
+   ignored -- the extra flags are set according to the compression level).  The
+   caller must assure that, if not Z_NULL, name and comment are terminated with
+   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+   available there.  If hcrc is true, a gzip header crc is included.  Note that
+   the current versions of the command-line version of gzip (up through version
+   1.3.x) do not support header crc's, and will report that it is a "multi-part
+   gzip file" and give up.
+
+     If deflateSetHeader is not used, the default gzip header has text false,
+   the time set to zero, and os set to 255, with no extra, name, or comment
+   fields.  The gzip header is returned to the default state by deflateReset().
+
+     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter.  The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library.  The default value is 15 if inflateInit is used
+   instead.  windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used.  If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be zero to request that inflate use the window size in
+   the zlib header of the compressed stream.
+
+     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
+   determines the window size.  inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream.  This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values.  If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is.  Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding.  Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
+   crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
+   invalid, such as a null pointer to the structure.  msg is set to null if
+   there is no error message.  inflateInit2 does not perform any decompression
+   apart from possibly reading the zlib header if present: actual decompression
+   will be done by inflate().  (So next_in and avail_in may be modified, but
+   next_out and avail_out are unused and unchanged.) The current implementation
+   of inflateInit2() does not process any header information -- that is
+   deferred until inflate() is called.
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence.  This function must be called immediately after a call of inflate,
+   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by that call of inflate.
+   The compressor and decompressor must use exactly the same dictionary (see
+   deflateSetDictionary).  For raw inflate, this function can be called at any
+   time to set the dictionary.  If the provided dictionary is smaller than the
+   window and there is already data in the window, then the provided dictionary
+   will amend what's there.  The application must insure that the dictionary
+   that was used for compression is provided.
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value).  inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
+                                             Bytef *dictionary,
+                                             uInt  *dictLength));
+/*
+     Returns the sliding dictionary being maintained by inflate.  dictLength is
+   set to the number of bytes in the dictionary, and that many bytes are copied
+   to dictionary.  dictionary must have enough space, where 32768 bytes is
+   always enough.  If inflateGetDictionary() is called with dictionary equal to
+   Z_NULL, then only the dictionary length is returned, and nothing is copied.
+   Similary, if dictLength is Z_NULL, then it is not set.
+
+     inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
+   stream state is inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+     Skips invalid compressed data until a possible full flush point (see above
+   for the description of deflate with Z_FULL_FLUSH) can be found, or until all
+   available input is skipped.  No output is provided.
+
+     inflateSync searches for a 00 00 FF FF pattern in the compressed data.
+   All full flush points have this pattern, but not all occurrences of this
+   pattern are full flush points.
+
+     inflateSync returns Z_OK if a possible full flush point has been found,
+   Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
+   has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
+   In the success case, the application may save the current current value of
+   total_in which indicates where valid compressed data was found.  In the
+   error case, the application may repeatedly call inflateSync, providing more
+   input each time, until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.  The
+   stream will keep attributes that may have been set by inflateInit2.
+
+     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL).
+*/
+
+ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
+                                      int windowBits));
+/*
+     This function is the same as inflateReset, but it also permits changing
+   the wrap and window size requests.  The windowBits parameter is interpreted
+   the same as it is for inflateInit2.
+
+     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
+   the windowBits parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     This function inserts bits in the inflate input stream.  The intent is
+   that this function is used to start inflating at a bit position in the
+   middle of a byte.  The provided bits will be used before any bytes are used
+   from next_in.  This function should only be used with raw inflate, and
+   should be used before the first inflate() call after inflateInit2() or
+   inflateReset().  bits must be less than or equal to 16, and that many of the
+   least significant bits of value will be inserted in the input.
+
+     If bits is negative, then the input stream bit buffer is emptied.  Then
+   inflatePrime() can be called again to put bits in the buffer.  This is used
+   to clear out bits leftover after feeding inflate a block description prior
+   to feeding inflate codes.
+
+     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
+/*
+     This function returns two values, one in the lower 16 bits of the return
+   value, and the other in the remaining upper bits, obtained by shifting the
+   return value down 16 bits.  If the upper value is -1 and the lower value is
+   zero, then inflate() is currently decoding information outside of a block.
+   If the upper value is -1 and the lower value is non-zero, then inflate is in
+   the middle of a stored block, with the lower value equaling the number of
+   bytes from the input remaining to copy.  If the upper value is not -1, then
+   it is the number of bits back from the current bit position in the input of
+   the code (literal or length/distance pair) currently being processed.  In
+   that case the lower value is the number of bytes already emitted for that
+   code.
+
+     A code is being processed if inflate is waiting for more input to complete
+   decoding of the code, or if it has completed decoding but is waiting for
+   more output space to write the literal or match data.
+
+     inflateMark() is used to mark locations in the input data for random
+   access, which may be at bit positions, and to note those cases where the
+   output of a code may span boundaries of random access blocks.  The current
+   location in the input stream can be determined from avail_in and data_type
+   as noted in the description for the Z_BLOCK flush parameter for inflate.
+
+     inflateMark returns the value noted above or -1 << 16 if the provided
+   source stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+     inflateGetHeader() requests that gzip header information be stored in the
+   provided gz_header structure.  inflateGetHeader() may be called after
+   inflateInit2() or inflateReset(), and before the first call of inflate().
+   As inflate() processes the gzip stream, head->done is zero until the header
+   is completed, at which time head->done is set to one.  If a zlib stream is
+   being decoded, then head->done is set to -1 to indicate that there will be
+   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
+   used to force inflate() to return immediately after header processing is
+   complete and before any actual data is decompressed.
+
+     The text, time, xflags, and os fields are filled in with the gzip header
+   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
+   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+   contains the maximum number of bytes to write to extra.  Once done is true,
+   extra_len contains the actual extra field length, and extra contains the
+   extra field, or that field truncated if extra_max is less than extra_len.
+   If name is not Z_NULL, then up to name_max characters are written there,
+   terminated with a zero unless the length is greater than name_max.  If
+   comment is not Z_NULL, then up to comm_max characters are written there,
+   terminated with a zero unless the length is greater than comm_max.  When any
+   of extra, name, or comment are not Z_NULL and the respective field is not
+   present in the header, then that field is set to Z_NULL to signal its
+   absence.  This allows the use of deflateSetHeader() with the returned
+   structure to duplicate the header.  However if those fields are set to
+   allocated memory, then the application will need to save those pointers
+   elsewhere so that they can be eventually freed.
+
+     If inflateGetHeader is not used, then the header information is simply
+   discarded.  The header is always checked for validity, including the header
+   CRC if present.  inflateReset() will reset the process to discard the header
+   information.  The application would need to call inflateGetHeader() again to
+   retrieve the header from the next gzip stream.
+
+     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the parameters are invalid, Z_MEM_ERROR if the internal state could not be
+   allocated, or Z_VERSION_ERROR if the version of the library does not match
+   the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *,
+                                z_const unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is potentially more efficient than
+   inflate() for file i/o applications, in that it avoids copying between the
+   output and the sliding window by simply making the window itself the output
+   buffer.  inflate() can be faster on modern CPUs when used with large
+   buffers.  inflateBack() trusts the application to not change the output
+   buffer passed by the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free the
+   allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects only
+   the raw deflate stream to decompress.  This is different from the normal
+   behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
+   in the deflate stream (in which case strm->msg is set to indicate the nature
+   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
+   In the case of Z_BUF_ERROR, an input or output error can be distinguished
+   using strm->next_in which will be Z_NULL only if in() returned an error.  If
+   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
+   non-zero.  (in() will always be called before out(), so strm->next_in is
+   assured to be defined if out() returns non-zero.) Note that inflateBack()
+   cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+#ifndef Z_SOLO
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the basic
+   stream-oriented functions.  To simplify the interface, some default options
+   are assumed (compression level and memory usage, standard memory allocation
+   functions).  The source code of these utility functions can be modified if
+   you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer.  Upon entry, destLen is the total size
+   of the destination buffer, which must be at least the value returned by
+   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer.  The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer.  Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before a
+   compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer.  Upon entry, destLen is the total size
+   of the destination buffer, which must be large enough to hold the entire
+   uncompressed data.  (The size of the uncompressed data must have been saved
+   previously by the compressor and transmitted to the decompressor by some
+   mechanism outside the scope of this compression library.) Upon exit, destLen
+   is the actual size of the uncompressed buffer.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.  In
+   the case where there is not enough room, uncompress() will fill the output
+   buffer with the uncompressed data up to that point.
+*/
+
+                        /* gzip file access functions */
+
+/*
+     This library supports reading and writing files in gzip (.gz) format with
+   an interface similar to that of stdio, using the functions that start with
+   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
+   wrapper, documented in RFC 1952, wrapped around a deflate stream.
+*/
+
+typedef struct gzFile_s *gzFile;    /* semi-opaque gzip file descriptor */
+
+/*
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+
+     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
+   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
+   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
+   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
+   for fixed code compression as in "wb9F".  (See the description of
+   deflateInit2 for more information about the strategy parameter.)  'T' will
+   request transparent writing or appending with no compression and not using
+   the gzip format.
+
+     "a" can be used instead of "w" to request that the gzip stream that will
+   be written be appended to the file.  "+" will result in an error, since
+   reading and writing to the same gzip file is not supported.  The addition of
+   "x" when writing will create the file exclusively, which fails if the file
+   already exists.  On systems that support it, the addition of "e" when
+   reading or writing will set the flag to close the file on an execve() call.
+
+     These functions, as well as gzip, will read and decode a sequence of gzip
+   streams in a file.  The append function of gzopen() can be used to create
+   such a file.  (Also see gzflush() for another way to do this.)  When
+   appending, gzopen does not test whether the file begins with a gzip stream,
+   nor does it look for the end of the gzip streams to begin appending.  gzopen
+   will simply append a gzip stream to the existing file.
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.  When
+   reading, this will be detected automatically by looking for the magic two-
+   byte gzip header.
+
+     gzopen returns NULL if the file could not be opened, if there was
+   insufficient memory to allocate the gzFile state, or if an invalid mode was
+   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
+   errno can be checked to determine if the reason gzopen failed was that the
+   file could not be opened.
+*/
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
+   are obtained from calls like open, dup, creat, pipe or fileno (if the file
+   has been previously opened with fopen).  The mode parameter is as in gzopen.
+
+     The next call of gzclose on the returned gzFile will also close the file
+   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
+   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
+   mode);.  The duplicated descriptor should be saved to avoid a leak, since
+   gzdopen does not close fd if it fails.  If you are using fileno() to get the
+   file descriptor from a FILE *, then you will have to use dup() to avoid
+   double-close()ing the file descriptor.  Both gzclose() and fclose() will
+   close the associated file descriptor, so they need to have different file
+   descriptors.
+
+     gzdopen returns NULL if there was insufficient memory to allocate the
+   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
+   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
+   used until the next gz* read, write, seek, or close operation, so gzdopen
+   will not detect if fd is invalid (unless fd is -1).
+*/
+
+ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
+/*
+     Set the internal buffer size used by this library's functions.  The
+   default buffer size is 8192 bytes.  This function must be called after
+   gzopen() or gzdopen(), and before any other calls that read or write the
+   file.  The buffer memory allocation is always deferred to the first read or
+   write.  Two buffers are allocated, either both of the specified size when
+   writing, or one of the specified size and the other twice that size when
+   reading.  A larger buffer size of, for example, 64K or 128K bytes will
+   noticeably increase the speed of decompression (reading).
+
+     The new buffer size also affects the maximum length for gzprintf().
+
+     gzbuffer() returns 0 on success, or -1 on failure, such as being called
+   too late.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy.  See the description
+   of deflateInit2 for the meaning of these parameters.
+
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.  If
+   the input file is not in gzip format, gzread copies the given number of
+   bytes into the buffer directly from the file.
+
+     After reaching the end of a gzip stream in the input, gzread will continue
+   to read, looking for another gzip stream.  Any number of gzip streams may be
+   concatenated in the input file, and will all be decompressed by gzread().
+   If something other than a gzip stream is encountered after a gzip stream,
+   that remaining trailing garbage is ignored (and no error is returned).
+
+     gzread can be used to read a gzip file that is being concurrently written.
+   Upon reaching the end of the input, gzread will return with the available
+   data.  If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
+   gzclearerr can be used to clear the end of file indicator in order to permit
+   gzread to be tried again.  Z_OK indicates that a gzip stream was completed
+   on the last gzread.  Z_BUF_ERROR indicates that the input file ended in the
+   middle of a gzip stream.  Note that gzread does not return -1 in the event
+   of an incomplete gzip stream.  This error is deferred until gzclose(), which
+   will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
+   stream.  Alternatively, gzerror can be used before gzclose to detect this
+   case.
+
+     gzread returns the number of uncompressed bytes actually read, less than
+   len for end of file, or -1 for error.
+*/
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+                                voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes written or 0 in case of
+   error.
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the arguments to the compressed file under
+   control of the format string, as in fprintf.  gzprintf returns the number of
+   uncompressed bytes actually written, or 0 in case of error.  The number of
+   uncompressed bytes written is limited to 8191, or one less than the buffer
+   size given to gzbuffer().  The caller should assure that this limit is not
+   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with
+   nothing written.  In this case, there may also be a buffer overflow with
+   unpredictable consequences, which is possible only if zlib was compiled with
+   the insecure functions sprintf() or vsprintf() because the secure snprintf()
+   or vsnprintf() functions were not available.  This can be determined using
+   zlibCompileFlags().
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+     Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+
+     gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+     Reads bytes from the compressed file until len-1 characters are read, or a
+   newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  If any characters are read or if len == 1, the
+   string is terminated with a null character.  If no characters are read due
+   to an end-of-file or len < 1, then the buffer is left untouched.
+
+     gzgets returns buf which is a null-terminated string, or it returns NULL
+   for end-of-file or in case of error.  If there was an error, the contents at
+   buf are indeterminate.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+     Writes c, converted to an unsigned char, into the compressed file.  gzputc
+   returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+     Reads one byte from the compressed file.  gzgetc returns this byte or -1
+   in case of end of file or error.  This is implemented as a macro for speed.
+   As such, it does not do all of the checking the other functions do.  I.e.
+   it does not check to see if file is NULL, nor whether the structure file
+   points to has been clobbered or not.
+*/
+
+ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+/*
+     Push one character back onto the stream to be read as the first character
+   on the next read.  At least one character of push-back is allowed.
+   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
+   fail if c is -1, and may fail if a character has been pushed but not read
+   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
+   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
+   The pushed character will be discarded if the stream is repositioned with
+   gzseek() or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file.  The parameter flush
+   is as in the deflate() function.  The return value is the zlib error number
+   (see function gzerror below).  gzflush is only permitted when writing.
+
+     If the flush parameter is Z_FINISH, the remaining data is written and the
+   gzip stream is completed in the output.  If gzwrite() is called again, a new
+   gzip stream will be started in the output.  gzread() is able to read such
+   concatented gzip streams.
+
+     gzflush should be called only when strictly necessary because it will
+   degrade compression if called too often.
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+                                   z_off_t offset, int whence));
+
+     Sets the starting position for the next gzread or gzwrite on the given
+   compressed file.  The offset represents a number of bytes in the
+   uncompressed data stream.  The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow.  If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+     gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+
+     Returns the starting position for the next gzread or gzwrite on the given
+   compressed file.  This position represents a number of bytes in the
+   uncompressed data stream, and is zero when starting, even if appending or
+   reading a gzip stream from the middle of a file using gzdopen().
+
+     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
+
+     Returns the current offset in the file being read or written.  This offset
+   includes the count of bytes that precede the gzip stream, for example when
+   appending or when using gzdopen() for reading.  When reading, the offset
+   does not include as yet unused buffered input.  This information can be used
+   for a progress indicator.  On error, gzoffset() returns -1.
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns true (1) if the end-of-file indicator has been set while reading,
+   false (0) otherwise.  Note that the end-of-file indicator is set only if the
+   read tried to go past the end of the input, but came up short.  Therefore,
+   just like feof(), gzeof() may return false even if there is no more data to
+   read, in the event that the last read request was for the exact number of
+   bytes remaining in the input file.  This will happen if the input file size
+   is an exact multiple of the buffer size.
+
+     If gzeof() returns true, then the read functions will return no more data,
+   unless the end-of-file indicator is reset by gzclearerr() and the input file
+   has grown since the previous end of file was detected.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+     Returns true (1) if file is being copied directly while reading, or false
+   (0) if file is a gzip stream being decompressed.
+
+     If the input file is empty, gzdirect() will return true, since the input
+   does not contain a gzip stream.
+
+     If gzdirect() is used immediately after gzopen() or gzdopen() it will
+   cause buffers to be allocated to allow reading the file to determine if it
+   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
+   gzdirect().
+
+     When writing, gzdirect() returns true (1) if transparent writing was
+   requested ("wT" for the gzopen() mode), or false (0) otherwise.  (Note:
+   gzdirect() is not needed when writing.  Transparent writing must be
+   explicitly requested, so the application already knows the answer.  When
+   linking statically, using gzdirect() will include all of the zlib code for
+   gzip file reading and decompression, which may not be desired.)
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file and
+   deallocates the (de)compression state.  Note that once file is closed, you
+   cannot call gzerror with file, since its structures have been deallocated.
+   gzclose must not be called more than once on the same file, just as free
+   must not be called more than once on the same allocation.
+
+     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
+   file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
+   last read ended in the middle of a gzip stream, or Z_OK on success.
+*/
+
+ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
+/*
+     Same as gzclose(), but gzclose_r() is only for use when reading, and
+   gzclose_w() is only for use when writing or appending.  The advantage to
+   using these instead of gzclose() is that they avoid linking in zlib
+   compression or decompression code that is not used when only reading or only
+   writing respectively.  If gzclose() is used, then both compression and
+   decompression code will be included the application when linking to a static
+   zlib library.
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the given
+   compressed file.  errnum is set to zlib error number.  If an error occurred
+   in the file system and not in the compression library, errnum is set to
+   Z_ERRNO and the application may consult errno to get the exact error code.
+
+     The application must not modify the returned string.  Future calls to
+   this function may invalidate the previously returned string.  If file is
+   closed, then the string previously returned by gzerror will no longer be
+   available.
+
+     gzerror() should be used to distinguish errors from end-of-file for those
+   functions above that do not distinguish those cases in their return values.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file.  This is analogous to the
+   clearerr() function in stdio.  This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+#endif /* !Z_SOLO */
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the compression
+   library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum.  If buf is Z_NULL, this function returns the
+   required initial value for the checksum.
+
+     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster.
+
+   Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+/*
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+                                          z_off_t len2));
+
+     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
+   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
+   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.  Note
+   that the z_off_t type (like off_t) is a signed integer.  If len2 is
+   negative, the result has no meaning or utility.
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running CRC-32 with the bytes buf[0..len-1] and return the
+   updated CRC-32.  If buf is Z_NULL, this function returns the required
+   initial value for the crc.  Pre- and post-conditioning (one's complement) is
+   performed within this function so it shouldn't be done by the application.
+
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+/*
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+     Combine two CRC-32 check values into one.  For two sequences of bytes,
+   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
+   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+   len2.
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
+                      (int)sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+                      ZLIB_VERSION, (int)sizeof(z_stream))
+
+#ifndef Z_SOLO
+
+/* gzgetc() macro and its supporting function and exposed data structure.  Note
+ * that the real internal state is much larger than the exposed structure.
+ * This abbreviated structure exposes just enough for the gzgetc() macro.  The
+ * user should not mess with these exposed elements, since their names or
+ * behavior could change in the future, perhaps even capriciously.  They can
+ * only be used by the gzgetc() macro.  You have been warned.
+ */
+struct gzFile_s {
+    unsigned have;
+    unsigned char *next;
+    z_off64_t pos;
+};
+ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));  /* backward compatibility */
+#ifdef Z_PREFIX_SET
+#  undef z_gzgetc
+#  define z_gzgetc(g) \
+          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+#else
+#  define gzgetc(g) \
+          ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
+#endif
+
+/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
+ * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
+ * both are true, the application gets the *64 functions, and the regular
+ * functions are changed to 64 bits) -- in case these are set on systems
+ * without large file support, _LFS64_LARGEFILE must also be true
+ */
+#ifdef Z_LARGE64
+   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
+   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
+   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
+   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
+#endif
+
+#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
+#  ifdef Z_PREFIX_SET
+#    define z_gzopen z_gzopen64
+#    define z_gzseek z_gzseek64
+#    define z_gztell z_gztell64
+#    define z_gzoffset z_gzoffset64
+#    define z_adler32_combine z_adler32_combine64
+#    define z_crc32_combine z_crc32_combine64
+#  else
+#    define gzopen gzopen64
+#    define gzseek gzseek64
+#    define gztell gztell64
+#    define gzoffset gzoffset64
+#    define adler32_combine adler32_combine64
+#    define crc32_combine crc32_combine64
+#  endif
+#  ifndef Z_LARGE64
+     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
+     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
+     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+#  endif
+#else
+   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
+   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
+   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
+   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
+   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+#endif
+
+#else /* Z_SOLO */
+
+   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+
+#endif /* !Z_SOLO */
+
+/* hack for buggy compilers */
+#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;};
+#endif
+
+/* undocumented functions */
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
+ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table    OF((void));
+ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
+ZEXTERN int            ZEXPORT inflateResetKeep OF((z_streamp));
+ZEXTERN int            ZEXPORT deflateResetKeep OF((z_streamp));
+#if defined(_WIN32) && !defined(Z_SOLO)
+ZEXTERN gzFile         ZEXPORT gzopen_w OF((const wchar_t *path,
+                                            const char *mode));
+#endif
+#if defined(STDC) || defined(Z_HAVE_STDARG_H)
+#  ifndef Z_SOLO
+ZEXTERN int            ZEXPORTVA gzvprintf Z_ARG((gzFile file,
+                                                  const char *format,
+                                                  va_list va));
+#  endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZLIB_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_ota_unpack/zliblite/zutil.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,253 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+   part of the implementation of the compression library and is
+   subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id$ */
+
+#ifndef ZUTIL_H
+#define ZUTIL_H
+
+#ifdef HAVE_HIDDEN
+#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+#else
+#  define ZLIB_INTERNAL
+#endif
+
+#include "zlib.h"
+
+#if defined(STDC) && !defined(Z_SOLO)
+#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
+#    include <stddef.h>
+#  endif
+#  include <string.h>
+#  include <stdlib.h>
+#endif
+
+#ifdef Z_SOLO
+   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
+#endif
+
+#ifndef local
+#  define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char  uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long  ulg;
+
+extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+  return (strm->msg = ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+        /* common constants */
+
+#ifndef DEF_WBITS
+#  define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+#  define DEF_MEM_LEVEL 8
+#else
+#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES    2
+/* The three kinds of block type */
+
+#define MIN_MATCH  3
+#define MAX_MATCH  258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+        /* target dependencies */
+
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
+#  define OS_CODE  0x00
+#  ifndef Z_SOLO
+#    if defined(__TURBOC__) || defined(__BORLANDC__)
+#      if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+         /* Allow compilation with ANSI keywords only enabled */
+         void _Cdecl farfree( void *block );
+         void *_Cdecl farmalloc( unsigned long nbytes );
+#      else
+#        include <alloc.h>
+#      endif
+#    else /* MSC or DJGPP */
+#      include <malloc.h>
+#    endif
+#  endif
+#endif
+
+#ifdef AMIGA
+#  define OS_CODE  0x01
+#endif
+
+#if defined(VAXC) || defined(VMS)
+#  define OS_CODE  0x02
+#  define F_OPEN(name, mode) \
+     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#if defined(ATARI) || defined(atarist)
+#  define OS_CODE  0x05
+#endif
+
+#ifdef OS2
+#  define OS_CODE  0x06
+#  if defined(M_I86) && !defined(Z_SOLO)
+#    include <malloc.h>
+#  endif
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+#  define OS_CODE  0x07
+#  ifndef Z_SOLO
+#    if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+#      include <unix.h> /* for fdopen */
+#    else
+#      ifndef fdopen
+#        define fdopen(fd,mode) NULL /* No fdopen() */
+#      endif
+#    endif
+#  endif
+#endif
+
+#ifdef TOPS20
+#  define OS_CODE  0x0a
+#endif
+
+#ifdef WIN32
+#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
+#    define OS_CODE  0x0b
+#  endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+#  define OS_CODE  0x0f
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+#  define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
+#  if defined(_WIN32_WCE)
+#    define fdopen(fd,mode) NULL /* No fdopen() */
+#    ifndef _PTRDIFF_T_DEFINED
+       typedef int ptrdiff_t;
+#      define _PTRDIFF_T_DEFINED
+#    endif
+#  else
+#    define fdopen(fd,type)  _fdopen(fd,type)
+#  endif
+#endif
+
+#if defined(__BORLANDC__) && !defined(MSDOS)
+  #pragma warn -8004
+  #pragma warn -8008
+  #pragma warn -8066
+#endif
+
+/* provide prototypes for these when building zlib without LFS */
+#if !defined(_WIN32) && \
+    (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
+    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+#endif
+
+        /* common defaults */
+
+#ifndef OS_CODE
+#  define OS_CODE  0x03  /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+#  define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+         /* functions */
+
+#if defined(pyr) || defined(Z_SOLO)
+#  define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+  * You may have to use the same strategy for Borland C (untested).
+  * The __SC__ check is for Symantec.
+  */
+#  define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+#  define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+#    define zmemcpy _fmemcpy
+#    define zmemcmp _fmemcmp
+#    define zmemzero(dest, len) _fmemset(dest, 0, len)
+#  else
+#    define zmemcpy memcpy
+#    define zmemcmp memcmp
+#    define zmemzero(dest, len) memset(dest, 0, len)
+#  endif
+#else
+   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+#  include <stdio.h>
+   extern int ZLIB_INTERNAL z_verbose;
+   extern void ZLIB_INTERNAL z_error OF((char *m));
+#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
+#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
+#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+#  define Assert(cond,msg)
+#  define Trace(x)
+#  define Tracev(x)
+#  define Tracevv(x)
+#  define Tracec(c,x)
+#  define Tracecv(c,x)
+#endif
+
+#ifndef Z_SOLO
+   voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
+                                    unsigned size));
+   void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
+#endif
+
+#define ZALLOC(strm, items, size) \
+           (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+/* Reverse the bytes in a 32-bit value */
+#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
+                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
+
+#endif /* ZUTIL_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/coap_client.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,23 @@
+#pragma once
+#include "../iot-baidu-ca/source/baidu_ca_coap.h"
+#include "../iot-baidu-ca/include/baidu_ca.h"
+#include "../iot-baidu-ca-adapter/baidu_ca_network_socket.h"
+class CoapsClient
+{
+public:
+    CoapsClient(const char* ip, unsigned short port,
+			          const char* path, const char* cert);
+    ~CoapsClient();
+		int connect();
+    int get(unsigned int nOffset, unsigned char chBuffer[], unsigned int nSize);
+		int disconnect();
+private:
+	  void network_signal_handler(const bca_addr_t *addr);
+    bca_coap_handler m_coapInstance;
+    bool m_bConnected;
+    bca_addr_t  m_peer;
+    const char* m_szPath;
+    const char* m_szCert;
+    duer::SocketAdapter::Callback  _on_network_data_signal;
+
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/package_info.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,24 @@
+#pragma once
+#include <stdint.h>
+
+#define MAX_NAME_LENGTH 64
+#define MAX_VERSION_LENGTH 24
+#define MAX_APPID_LENGTH 16
+
+typedef struct
+{
+    char name[MAX_NAME_LENGTH + 1];
+	  char developer[MAX_NAME_LENGTH + 1];
+	  char version[MAX_VERSION_LENGTH + 1];
+	  char staged_version[MAX_VERSION_LENGTH + 1];
+}os_info_t;
+
+typedef struct
+{
+	  char id[MAX_APPID_LENGTH + 1];
+	  char name[MAX_NAME_LENGTH + 1];
+	  char developer[MAX_NAME_LENGTH + 1];
+	  char version[MAX_VERSION_LENGTH + 1];
+	  char staged_version[MAX_VERSION_LENGTH + 1];
+	  char os_version[MAX_VERSION_LENGTH + 1];
+}app_info_t;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/shared_buffer.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,19 @@
+#pragma once
+#include "rtos.h"
+
+class SharedBuffer
+{
+public:
+    SharedBuffer(unsigned int size);
+    ~SharedBuffer();
+    unsigned int read(unsigned char out[], unsigned int size);
+    unsigned int write(const unsigned char in[], unsigned int size);
+    void wait();
+private:
+	  unsigned int m_nBufferSize;
+    unsigned int m_nWriteOffset;
+    unsigned int m_nDataSize;
+    unsigned char *m_pBuffer;
+    rtos::Semaphore sem_Read;
+    rtos::Semaphore sem_Write;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/url.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,22 @@
+#pragma once
+class URL
+{
+public:
+    URL(const char* url);
+    ~URL();
+    bool valid()const{return __valid;};
+    const char* scheme()const{return __scheme;};
+    const char* host()const{return __host;};
+    unsigned short port()const{return __port;};
+    const char* path()const{return __path;};
+
+	const char* url()const{return __url;};
+private:
+    bool parse(const char* url);
+    bool __valid;
+    char *__scheme;
+    char *__host;
+    unsigned short __port;
+    char *__path;
+	char * __url;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-base/baidu_media_base.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,57 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Base class of Media
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H
+
+#include "mbed.h"
+#include "baidu_recorder.h"
+#include "baidu_media_type.h"
+
+namespace duer {
+
+class MediaBase : public Recorder::IPlugin {
+public:
+    int start_play(MediaType type);
+
+    int write(const void* data, size_t size);
+
+    int regulate_voice(unsigned char vol);
+
+    int pause_play();
+
+    int stop_play();
+
+    virtual int start_record();
+
+    virtual size_t read(void* data, size_t size);
+
+    virtual int stop_record();
+
+protected:
+    virtual int on_start_play(MediaType type) = 0;
+
+    virtual int on_write(const void* data, size_t size) = 0;
+
+    virtual int on_voice(unsigned char vol) = 0;
+
+    virtual int on_pause_play() = 0;
+
+    virtual int on_stop_play() = 0;
+
+    virtual int on_start_record() = 0;
+
+    virtual size_t on_read(void* data, size_t size) = 0;
+
+    virtual int on_stop_record() = 0;
+
+private:
+    static rtos::Mutex      _s_lock;
+    static int              _s_status;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_BASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-base/baidu_media_type.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,21 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Media type
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_TYPE_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_TYPE_H
+
+namespace duer {
+
+enum MediaType {
+    TYPE_MP3,
+    TYPE_AAC,
+    TYPE_M4A,
+    TYPE_WAV,
+    TYPE_NULL
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_BASE_BAIDU_MEDIA_TYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_data_manager.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,37 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Media data Manager
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_DATA_MANAGER_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_DATA_MANAGER_H
+
+#include "baidu_media_play_type.h"
+
+namespace duer {
+
+struct MediaReport {
+    unsigned int play_url_count;
+    unsigned int invalid_url_count;
+    unsigned int play_url_failed_count;
+};
+
+void mdm_send_media_file_path(const char* media_file_path);
+
+void mdm_send_media_url(const char* media_url);
+
+MediaPlayerStatus mdm_notify_to_stop();
+
+void mdm_reset_stop_flag();
+
+int mdm_check_need_to_stop();
+
+const MediaReport& get_media_report();
+
+void start_media_data_mgr_thread();
+
+void mdm_speed_get_statistic(float* speed);
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_DATA_MANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_file_storer.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,40 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Media file storer
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_FILE_STORER_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_FILE_STORER_H
+
+#include <stdio.h>
+
+namespace duer {
+
+class MediaFileStorer {
+public:
+    static MediaFileStorer& instance();
+
+    int open(int type);
+
+    int write(const void* buff, size_t size);
+
+    int close();
+
+private:
+    MediaFileStorer();
+
+    MediaFileStorer(const MediaFileStorer&);
+
+    MediaFileStorer& operator=(const MediaFileStorer&);
+
+    void initialize();
+
+    static MediaFileStorer _s_instance;
+    bool _initialized;
+    FILE* _file;
+    int _file_index;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_FILE_STORER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-data-manager/baidu_media_manager.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,104 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Media Manager
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H
+
+#include <stddef.h>
+#include "baidu_media_play_type.h"
+
+namespace duer {
+
+class MediaManager {
+public:
+    static MediaManager& instance();
+
+    /*
+     * Initialize MediaManager object.
+     *
+     * @Return bool, success: true, fail: false
+     */
+    bool initialize();
+
+    /*
+     * Initialize MediaManager object by buffer .
+     *
+     * @Param buffer, buffer for media data
+     * @Param size, size of buffer
+     * @Return bool, success: true, fail: false
+     */
+    bool initialize(void* buffer, size_t size);
+
+    /*
+     * Play network media file
+     *
+     * @Param url, media file's url
+     * @Return MediaPlayerStatus, the last status of media player
+     */
+    MediaPlayerStatus play_url(const char* url);
+
+    /*
+     * Play local media file
+     *
+     * @Param path, media file's path
+     * @Return MediaPlayerStatus, the last status of media player
+     */
+    MediaPlayerStatus play_local(const char* path);
+
+    /*
+     * If media player's status is playing/pause, pause/resume it
+     *
+     * @Return MediaPlayerStatus, the last status of media player
+     */
+    MediaPlayerStatus pause_or_resume();
+
+    /*
+     * Stop media player
+     *
+     * @Return MediaPlayerStatus, the last status of media player
+     */
+    MediaPlayerStatus stop();
+
+    /*
+     * Get status of media player
+     *
+     * @Return MediaPlayerStatus, the current status of media player
+     */
+    MediaPlayerStatus get_media_player_status();
+
+    /*
+     * Register the callback function which is called when media player stop
+     * Can't register more than 5 function
+     *
+     * @Param callback, callback function
+     * @Return int, success: 0, fail: -1
+     */
+    int register_stop_callback(media_player_stop_callback callback);
+
+    /*
+     * Unregister the callback function
+     *
+     * @Param callback, callback function
+     * @Return int, success: 0, fail: -1
+     */
+    int unregister_stop_callback(media_player_stop_callback callback);
+
+    /*
+     * Set volume of audio
+     *
+     * @Param vol, effective range is 0~15
+     */
+    void set_volume(unsigned char vol);
+
+private:
+    MediaManager();
+
+    static MediaManager _s_instance;
+    static bool _s_initialized;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_DATA_MANAGER_BAIDU_MEDIA_MANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,41 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Media player API
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_H
+
+#include "baidu_media_play_type.h"
+#include "baidu_media_type.h"
+#include "baidu_media_play_buffer.h"
+
+namespace duer {
+
+enum MediaPlayerCmd {
+    PLAYER_CMD_START,       //to start playing media
+    PLAYER_CMD_CONTINUE,    //media data stream
+    PLAYER_CMD_STOP         //to stop mediaplayer
+};
+
+struct MediaPlayerMessage {
+    MediaPlayerCmd cmd;     //command to mediaplayer
+    MediaType type;
+    int size;               //data size in MediaPlayBuffer
+};
+
+void start_media_play_thread();
+void start_media_voice_thread();
+// return last status of media player
+MediaPlayerStatus media_play_pause_or_resume();
+MediaPlayerStatus media_play_stop();
+MediaPlayerStatus media_play_get_status();
+int media_play_register_stop_callback(media_player_stop_callback callback);
+int media_play_unregister_stop_callback(media_player_stop_callback callback);
+void media_play_set_volume(unsigned char vol);
+
+extern MediaPlayBuffer* g_media_play_buffer;
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_buffer.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,48 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Buffer for media player
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_BUFFER_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_BUFFER_H
+
+#include "rtos.h"
+
+namespace duer {
+
+// FIFO circle buffer
+class MediaPlayBuffer {
+public:
+    MediaPlayBuffer(void* buffer, size_t size);
+
+    ~MediaPlayBuffer();
+
+    // write buffer until buffer has enough space
+    void write(const void* data, size_t size);
+
+    // read buffer until buffer has enough data
+    void read(void* data, size_t size);
+
+    void clear();
+
+    static const size_t MIN_BUFFER_SIZE = 5 * 1024;
+
+    static const size_t DEFAULT_BUFFER_SIZE = 10 * 1024;
+
+private:
+    MediaPlayBuffer(const MediaPlayBuffer&);
+
+    MediaPlayBuffer& operator=(const MediaPlayBuffer&);
+
+    char* const _buffer;
+    const size_t _BUFFER_SIZE;
+    Mutex _mutex;
+    bool _wait;
+    Semaphore _semaphore;
+    int _start;
+    int _end;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_BUFFER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_m4a.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,71 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: Play m4a type file
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H
+
+#include "mp4ff.h"
+#include "rda_mp4.h"
+#include "baidu_media_type.h"
+
+namespace duer {
+
+const int M4AERR_OK = 0;
+const int M4AERR_MAC = -1;
+const int M4AERR_ARG = -2;
+const int M4AERR_VAL = -3;
+
+class MediaAdapter;
+
+class MediaPlayM4A {
+public:
+    MediaPlayM4A(MediaAdapter* media_adapter);
+
+    ~MediaPlayM4A();
+
+    int m4a_file_start(MediaType type, const unsigned char* p_buff, int buff_sz);
+
+    int m4a_file_play(const unsigned char* p_buff, int buff_sz);
+
+    int m4a_file_end(const unsigned char* p_buff, int buff_sz);
+
+    int get_m4a_file_pos();
+
+private:
+    MediaPlayM4A(const MediaPlayM4A&);
+
+    MediaPlayM4A& operator=(const MediaPlayM4A&);
+
+    int m4a_header_save(const unsigned char* p_buff, int buff_sz);
+
+    int m4a_header_parse();
+
+    int m4a_frame_to_codec(const unsigned char* p_buff, int buff_sz);
+
+    static uint32_t read_callback(void* user_data, void* buffer, uint32_t length);
+
+    static uint32_t seek_callback(void* user_data, uint64_t position);
+
+    static mp4ff_callback_t _s_mp4cb;
+
+    FILE* _p_file_sd;
+    int _m4a_header_size;
+    int _buff_data_size;
+    unsigned char* _p_buff_data;
+    int _m4a_file_pos;
+    bool _m4a_parse_done;
+
+    int _num_samples;
+    int _track;
+    int _sample_id;
+    mp4AudioSpecificConfig _mp4_asc;
+    mp4ff_t _infile;
+
+    MediaAdapter* _media_adapter;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_type.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,21 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Chen Xihao (chenxihao@baidu.com)
+//
+// Description: define export type of media module
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_TYPE_H
+#define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_TYPE_H
+
+namespace duer {
+
+enum MediaPlayerStatus {
+    MEDIA_PLAYER_IDLE,
+    MEDIA_PLAYER_PLAYING,
+    MEDIA_PLAYER_PAUSE
+};
+
+typedef void (*media_player_stop_callback)();
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_TYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/mutex/baidu_iot_mutex.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2017 Baidu Inc. All Rights Reserved.
+ * Author: Gang Chen (chengang12@baidu.com)
+ * This header file is wrapper for OS mutex
+ *
+ */
+
+#ifndef IOT_BAIDU_BAIDU_IOT_MUTEX_H
+#define IOT_BAIDU_BAIDU_IOT_MUTEX_H
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *iot_mutex_t;
+
+typedef enum {
+    IOT_MUTEX_OK = 0,       // function completed; no error or event occurred.
+    IOT_MUTEX_TIMEOUT,	    // Failed to lock mutex in specified time
+    IOT_MUTEX_ERROR,
+} iot_mutex_status;
+
+/*
+ * Create mutex
+ *
+ * @Return: the created mutex's pointer
+ */
+iot_mutex_t iot_mutex_create(void);
+
+/*
+ * Lock a mutex
+ *
+ * @param mutex[in]: a pointer point to the mutex
+ * @param timeout_ms[in]: timeout value or 0 in case of no time-out
+ *
+ * @Return: iot_mutex_status
+ */
+iot_mutex_status iot_mutex_lock(iot_mutex_t mutex, uint32_t timeout_ms);
+
+/*
+ * Try to lock a mutex, and return immediately
+ *
+ * @param mutex[in]: a pointer point to the mutex
+ *
+ * @return: true if the mutex was acquired, false otherwise.
+ */
+bool iot_mutex_try_lock(iot_mutex_t mutex);
+
+/*
+ * Unlock a mutex
+ *
+ * @param mutex[in]: a pointer point to the mutex
+ *
+ * @Return: iot_mutex_status
+ */
+iot_mutex_status iot_mutex_unlock(iot_mutex_t mutex);
+
+/*
+ * Destroy the mutex context
+ *
+ * @param mutex[in]: a pointer point to the mutex
+ *
+ * @Return: iot_mutex_status
+ */
+iot_mutex_status iot_mutex_destroy(iot_mutex_t mutex);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // end IOT_BAIDU_BAIDU_IOT_MUTEX_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_recorder.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,111 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: tai xiurong (taixiurong@baidu.com)
+//
+// Description:
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_H
+
+#include <mbed.h>
+
+#include "baidu_ca_adapter.h"
+
+// #define O_BUFFER_LEN        (800)
+// #define I_BUFFER_LEN        ((O_BUFFER_LEN - 1) / 4 * 3)
+
+//#define REC_LOG(_fmt, ...)      //LOG("[REC]"_fmt, ##__VA_ARGS__)
+
+namespace duer {
+static const unsigned int s_o_buffer_len = 800;
+static const unsigned int s_i_buffer_len = (s_o_buffer_len -1)/4 *3;
+class Recorder {
+public:
+
+    class IPlugin {
+    public:
+
+        virtual int start_record() = 0;
+
+        virtual size_t read(void* data, size_t size) = 0;
+
+        virtual int stop_record() = 0;
+
+        virtual ~IPlugin() = 0;
+
+    };
+
+    class IListener {
+    public:
+
+        virtual int on_start() = 0;
+
+        virtual int on_resume() = 0;
+
+        virtual int on_data(const void* data, size_t size) = 0;
+
+        virtual int on_pause() = 0;
+
+        virtual int on_stop() = 0;
+
+        virtual ~IListener() = 0;
+
+    };
+
+    class MiddleWare: public IListener {
+    public:
+
+        MiddleWare();
+
+        virtual ~MiddleWare();
+
+        int set_listener(IListener* listener);
+
+    protected:
+
+        int process_start();
+
+        int process_resume();
+
+        int process_data(const void* data, size_t size);
+
+        int process_pause();
+
+        int process_stop();
+
+    private:
+
+        IListener* _listener;
+    };
+
+    Recorder(IPlugin* plugin, size_t  size, void* data);
+    Recorder(IPlugin* plugin, size_t  size);
+    Recorder(IPlugin* plugin);
+
+    virtual ~Recorder();
+
+    int start();
+
+    int resume();
+
+    int pause();
+
+    int stop();
+
+    int set_listener(IListener* listener);
+
+    static void add_drop_invalid_record();
+
+private:
+    void run();
+    IPlugin*            _plugin;
+    IListener*          _listener;
+    rtos::Thread        _thread;
+    int                 _state;
+    size_t              _capacity;
+    void*               _buff;
+
+};
+
+}//duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_recorder_manager.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,61 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: tai xiurong (taixiurong@baidu.com)
+//
+// Description:
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_MANAGER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_MANAGER_H
+
+#include "baidu_recorder.h"
+
+namespace duer {
+
+class RecorderManager {
+public:
+    RecorderManager();
+
+    ~RecorderManager();
+    /*
+     *  start recoder.
+     *  @return
+     *  - -1  fail
+     *  - >=0  sucess
+     */
+    int start();
+    /*
+     *  resume recoder.
+     *  @return
+     *  - -1  fail
+     *  - >=0  sucess
+     */
+    int resume();
+    /*
+     *  pause recoder.
+     *  @return
+     *  - -1  fail
+     *  - >=0  sucess
+     */
+    int pause();
+    /*
+     *  stop recoder.
+     *  @return
+     *  - -1  fail
+     *  - >=0  sucess
+     */
+    int stop();
+    /*
+     *  set recoder listener.
+     *  @return
+     *  - -1  fail
+     *  - >=0  sucess
+     */
+    int set_listener(Recorder::IListener* listener);
+
+private:
+
+    Recorder                _recorder;
+    Recorder::MiddleWare*   _midware;
+};
+}//duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_RECORDER_MANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/recorder/baidu_speex_encoder.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,44 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: tai xiurong (taixiurong@baidu.com)
+//
+// Description:
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_SPEEX_ENCODER_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_SPEEX_ENCODER_H
+
+#include "baidu_recorder.h"
+
+namespace duer {
+
+class SpeexEncoder: public Recorder::MiddleWare {
+
+public:
+
+    SpeexEncoder(size_t buff_size, void* buff);
+    SpeexEncoder();
+
+    virtual ~SpeexEncoder();
+
+    virtual int on_start();
+
+    virtual int on_resume();
+
+    virtual int on_data(const void* data, size_t size);
+
+    virtual int on_pause();
+
+    virtual int on_stop();
+
+private:
+    static void recorder_output_handler(void* ctx, char* data, int size, int flush);
+    void*   _buff;
+    size_t  _capacity;
+    char*   _data;
+    size_t  _size;
+    void* _encoder_buffer;
+    bool _valid_record;
+    const int _min_valid_size = 512;
+};
+}//duer
+
+#endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_RECORDER_BAIDU_OS_SPEEX_ENCODER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_measure_time.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,45 @@
+#ifndef __MEASURETIME_H__
+#define __MEASURETIME_H__
+#include "us_ticker_api.h"
+
+#define ArraySize 20
+
+#define print_error printf
+
+namespace baidu{
+namespace os{
+
+typedef struct __MeasureValue{
+	unsigned int total_cnt;
+	unsigned int cur_cnt;
+	unsigned int time_begin;
+	unsigned int time_sum;
+	unsigned int time_min;
+	unsigned int time_max;
+	unsigned int arg_value;
+}MeasureValue;
+
+typedef unsigned int (*TimeFuncPtr)(void);
+
+// this class is not thread-safe
+class MeasureTime{
+public:
+	static MeasureTime* getInstMeasureTime(TimeFuncPtr time_func);
+	void addMeasureValue(int key, int count);
+	void updateMeasureValue(int key, int arg_value, int continuous_measure_flag);
+	void outputResult();
+
+private:
+	MeasureTime(TimeFuncPtr time_func);
+	MeasureTime(const MeasureTime&);
+	MeasureTime& operator=(const MeasureTime&);
+	
+private:
+	static MeasureTime* _instance;
+	static TimeFuncPtr _time_func;
+	MeasureValue MeasureArray[ArraySize];
+};
+
+} //namespace os
+} //namespace baidu
+#endif //~__MEASURETIME_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_measure_time_list.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,60 @@
+#ifndef __MEASURETIME_H__
+#define __MEASURETIME_H__
+
+#include <string>
+#include <map>
+#include <stdio.h>
+
+#define print_error printf
+
+int time_current_get(void);
+
+namespace baidu{
+namespace os{
+
+typedef struct __MeasureValue{
+	unsigned int total_cnt;
+	unsigned int cur_cnt;
+	unsigned int time_begin;
+	unsigned int time_sum;
+	unsigned int time_min;
+	unsigned int time_max;
+	unsigned int arg_value;
+}MeasureValue;
+
+typedef struct __ListNode{
+	__ListNode *next;
+	//char* Key;
+	std::string Key;
+	MeasureValue Value;
+}ListNode;
+
+typedef int (*TimeFuncPtr)(void);
+
+// this class is not thread-safe
+class MeasureTimeList{
+public:
+	static MeasureTimeList* getInstMeasureTime(TimeFuncPtr time_func);
+	//void addMeasureValue(const char* key, int count, int arg_value);
+	void addMeasureValue(const char* key, unsigned int count = 0xffffffff);
+	//void updateMeasureValue(const char* key);
+	void updateMeasureValue(const char* key, unsigned arg_value = 0);
+	void outputResult();
+	void destoryMeasureValueList();
+
+private:
+	MeasureTimeList(TimeFuncPtr time_func);
+	MeasureTimeList(const MeasureTimeList&);
+	MeasureTimeList& operator=(const MeasureTimeList&);
+	bool searchMeasureValueByKey(const char* key, ListNode* &temp);
+	
+private:
+	static MeasureTimeList* _instance;
+	static TimeFuncPtr _time_func;
+	ListNode* _pListHead;
+	ListNode* _pListTail;
+//	map<const char *, MeasureValue> _map_value;
+};
+} //namespace os
+} //namespace baidu
+#endif //~__MEASURETIME_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_status_reporter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,56 @@
+#ifndef BAIDU_OS_UTILITY_BAIDU_STATUS_REPORTER_H
+#define BAIDU_OS_UTILITY_BAIDU_STATUS_REPORTER_H
+
+#include "rtos.h"
+#include "baidu_ca_object.h"
+
+namespace duer {
+
+#define REPORT_FUNCTION_MAX 8
+
+typedef void (*ReportFunc)(Object&);
+
+class StatusReporter {
+public:
+
+    static StatusReporter& obtain();
+
+    // register the data report function
+    // Note: only register one time
+    //       how to handle register multi-time
+    //       how to provide unregister function
+    // return:
+    //       0 success, -1 fail array is full -2 param report_function is null
+    int register_report_function(ReportFunc report_function);
+
+    void start();
+
+    void stop();
+
+    // report the basic info after connect the network success
+    void device_info_report();
+
+    // report the status info every 5min
+    void device_status_report();
+
+private:
+
+    StatusReporter();
+
+    StatusReporter(const StatusReporter&);
+
+    StatusReporter& operator=(const StatusReporter&);
+
+    // timer for report statistic info about the device periodically
+    rtos::RtosTimer     _periodic_report_timer;
+
+    rtos::Mutex _report_functions_mutex;
+
+    ReportFunc _report_functions[REPORT_FUNCTION_MAX];
+
+    volatile int _current_report_function_index;
+};
+
+} // namespace duer
+
+#endif // BAIDU_OS_UTILITY_BAIDU_STATUS_REPORTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_time_calculate.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,80 @@
+#ifndef __BAIDU_TIME_CALCULATE_H__
+#define __BAIDU_TIME_CALCULATE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void add_measure_value(int key, int count);
+void update_measure_value(int key, int arg_value, int continuous_measure_flag);
+void output_measure_result();
+
+//**************************************************************************************//
+//	KEY is number from 0 to 9, because the macor ArraySize is 10. You can enlarge it if you calcute more than 10 sites.
+//	COUNTER is the biggest measurement times.
+//	ARGUEMENT is used for speed as ARGUEMENT/TIME_AVERAGE.
+//
+//	!!!!!! Take carefull: KEY in TIME_BEGIN and TIME_END must be the same. !!!!!!
+//
+//	TIME_BEGIN(1, 10);
+//	printf("ABC");
+//	TIME_END(1, 200, UNCONTINUOUS_TIME_MEASURE);
+//
+//	You can call TIME_RESULT() anywhere to print the resutl.
+//
+//**************************************************************************************//
+
+enum baidu_time_measure_params {
+    // TIME_END will measure time no matter there is a one-to-one TIME_BEGIN or not
+    CONTINUOUS_TIME_MEASURE = 0,
+    // TIME_END will measure time only when there is a one-to-one TIME_BEGIN
+    UNCONTINUOUS_TIME_MEASURE = 1,
+    MAX_TIME_CALCULATE_COUNT = 0X7FFFFFFF,
+};
+
+#define TIME_BEGIN(KEY, COUNTER) do{\
+	add_measure_value(KEY, COUNTER);\
+}while(0)
+
+#define TIME_END(KEY, ARGUEMENT, FLAG) do{\
+	update_measure_value(KEY, ARGUEMENT, FLAG);\
+}while(0)
+
+#define TIME_RESULT() do{\
+	output_measure_result();\
+}while(0)
+
+//#define BAIDU_PERFORM_STATISTIC
+
+enum baidu_perform_statistic_watch_point {
+    PERFORM_STATISTIC_START_RECORD = 1,  // from user press start button to start record
+    PERFORM_STATISTIC_RECORDER_ON_DATA,  // time consume of encode and send record data
+    PERFORM_STATISTIC_READ_VOICE_DATA, // time consume of read voice data from arm
+    PERFORM_STATISTIC_SOTP_RECORD, // from user stop record to the recorder thread stop
+    PERFORM_STATISTIC_BASE64_ENCODE, // the time consume of mbedtls_base64_encode
+    PERFORM_STATISTIC_GET_URL, // the time from user stop record to get media data from URL
+    // time consume of recorder_output_handler(encode and pass to CA)
+    PERFORM_STATISTIC_OUTPUT_RECORDER_DATA,
+    // time consume of bdspx_speex_encode encode data(exclude output encoded data)
+    PERFORM_STATISTIC_SPEEX_ENCODE,
+    PERFORM_STATISTIC_GET_MEDIA_BY_URL, // time consume from get media data from url to play it
+    PERFORM_STATISTIC_PLAY_URL_MEDIA, // time consume of mdm_media_data_out_handler(play url data)
+    PERFORM_STATISTIC_GET_MEDIA_BY_PATH, // time consume of read local media
+    PERFORM_STATISTIC_PLAY_LOCAL_MEDIA, // time consume of mdm_media_data_out_handler(play local data)
+};
+
+#ifdef BAIDU_PERFORM_STATISTIC
+#define PERFORM_STATISTIC_BEGIN(KEY, COUNTER) TIME_BEGIN(KEY, COUNTER)
+#define PERFORM_STATISTIC_END(KEY, ARGUEMENT, FLAG) TIME_END(KEY, ARGUEMENT, FLAG)
+#define PERFORM_STATISTIC_RESULT() TIME_RESULT()
+#else
+#define PERFORM_STATISTIC_BEGIN(KEY, COUNTER)
+#define PERFORM_STATISTIC_END(KEY, ARGUEMENT, FLAG)
+#define PERFORM_STATISTIC_RESULT()
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //~__BAIDU_TIME_CALCULATE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/baidu_time_calculate_list.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,17 @@
+#ifndef __BAIDU_TIME_CALCULATE_H__
+#define __BAIDU_TIME_CALCULATE_H__
+#include "baidu_measure_time_list.h"
+
+#define TIME_BEGIN(key) do{\
+	baidu::os::MeasureTimeList::getInstMeasureTime(time_current_get)->addMeasureValue(key);\
+}while(0)
+
+#define TIME_END(key, argument) do{\
+	baidu::os::MeasureTimeList::getInstMeasureTime(time_current_get)->updateMeasureValue(key, argument);\
+}while(0)
+
+#define TIME_RESULT() do{\
+	baidu::os::MeasureTimeList::getInstMeasureTime(time_current_get)->outputResult();\
+}while(0)
+
+#endif //~__BAIDU_TIME_CALCULATE_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/utility/duer_log.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,62 @@
+// Copyright (2017) Baidu Inc. All rights reserved.
+/**
+ * File: duer_log.h
+ * Auth: Su Hao(suhao@baidu.com)
+ * Desc: Print log.
+ */
+
+#ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_UTILITY_DUER_LOG_H
+#define BAIDU_IOT_TINYDU_IOT_OS_SRC_UTILITY_DUER_LOG_H
+
+#include "us_ticker_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef DUER_LOG_LEVEL
+#define DUER_LOG_LEVEL (3)
+#endif
+
+#if defined(DUER_LOG_LEVEL)
+#define DUER_LOG(_level, ...)     \
+    printf("[%s][%lu] %s(%d): ", _level, us_ticker_read(), __FILE__, __LINE__), \
+    printf(__VA_ARGS__), \
+    printf("\n")
+#endif
+
+#if defined(DUER_LOG_LEVEL) && (DUER_LOG_LEVEL >= 5)
+#define DUER_LOGV(...)            DUER_LOG("V", __VA_ARGS__)
+#else
+#define DUER_LOGV(...)
+#endif
+
+#if defined(DUER_LOG_LEVEL) && (DUER_LOG_LEVEL >= 4)
+#define DUER_LOGD(...)            DUER_LOG("D", __VA_ARGS__)
+#else
+#define DUER_LOGD(...)
+#endif
+
+#if defined(DUER_LOG_LEVEL) && (DUER_LOG_LEVEL >= 3)
+#define DUER_LOGI(...)            DUER_LOG("I", __VA_ARGS__)
+#else
+#define DUER_LOGI(...)
+#endif
+
+#if defined(DUER_LOG_LEVEL) && (DUER_LOG_LEVEL >= 2)
+#define DUER_LOGW(...)            DUER_LOG("W", __VA_ARGS__)
+#else
+#define DUER_LOGW(...)
+#endif
+
+#if defined(DUER_LOG_LEVEL) && (DUER_LOG_LEVEL >= 1)
+#define DUER_LOGE(...)            DUER_LOG("E", __VA_ARGS__)
+#else
+#define DUER_LOGE(...)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif/*BAIDU_IOT_TINYDU_IOT_OS_SRC_UTILITY_DUER_LOG_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/vs10xx/baidu_vs10xx_base.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,47 @@
+// Copyright 2017 Baidu Inc. All Rights Reserved.
+// Author: Su Hao (suhao@baidu.com)
+//
+// Description: Implement MediaBase for Vs10xx
+
+#ifndef BAIDU_TINYDU_IOT_OS_SRC_VS10XX_BAIDU_VS10XX_BASE_H
+#define BAIDU_TINYDU_IOT_OS_SRC_VS10XX_BAIDU_VS10XX_BASE_H
+
+#include "vs10xx.h"
+#include "baidu_media_base.h"
+
+namespace duer {
+
+class Vs10xxBase : public MediaBase {
+public:
+    Vs10xxBase(
+        PinName mosi,
+        PinName miso,
+        PinName sclk,
+        PinName xcs,
+        PinName xdcs,
+        PinName dreq,
+        PinName xreset);
+
+protected:
+    virtual int on_start_play(MediaType type);
+
+    virtual int on_write(const void* data, size_t size);
+
+    virtual int on_voice(unsigned char vol);
+
+    virtual int on_pause_play();
+
+    virtual int on_stop_play();
+
+    virtual int on_start_record();
+
+    virtual size_t on_read(void* data, size_t size);
+
+    virtual int on_stop_record();
+
+    vs10xx  _vs10xx;
+};
+
+} // namespace duer
+
+#endif // BAIDU_TINYDU_IOT_OS_SRC_VS10XX_BAIDU_VS10XX_BASE_H